<?php
/* Written by Gerben Schmidt, http://scripts.zomp.nl */
ob_start();
include_once("functions.php");
include('config.php');
include("session.php");
include("header.php");
$user = loadUser($_SESSION['login'],$link,$table_users);
if(!$_SESSION["loggedIn"] || !$user['admin']){ echo "You don't have enough privileges to view this page."; exit; }
else
{
// **********************************************************************
// **********************************************************************
// START loggedIn
// check if theme has already been initialized in db
$query = "SELECT * FROM $table_themes WHERE name = '$settings[skin]'";
$result = mysql_query($query, $link);
$numrows = mysql_num_rows($result);
if($numrows){
$theme = mysql_fetch_array($result);
}
else
{
// create the initial record for the database table
$query="INSERT INTO $table_themes (name, options, headerimage, color1, color2, color3, color4, color5, color6, font1, font1color, font2, font2color, font3, font3color, font4, font4color) VALUES ('$settings[skin]', '$_POST[options]', '$image', '$_POST[color1]', '$_POST[color2]', '$_POST[color3]', '$_POST[color4]', '$_POST[color5]', '$_POST[color6]', '$_POST[font1]', '$_POST[font1color]', '$_POST[font2]', '$_POST[font2color]', '$_POST[font3]', '$_POST[font3color]', '$_POST[font4]', '$_POST[font4color]')";
$result=mysql_query($query, $link) or die("Died inserting info into db. Error returned if any: ".mysql_error());
}
if(file_exists("../themes/$settings[skin]/options_config.php")){
include("../themes/$settings[skin]/options_config.php");
}
// START Submit
if($_POST['Submit']){
// upload script
include("upload_theme_image.php");
// START empty messages
if(empty($messages)) {
if($_POST[remove]){
$image = '';
}
$query="UPDATE $table_themes SET options = '$_POST[options]', headerimage = '$image', color1 = '$_POST[color1]', color2 = '$_POST[color2]', color3 = '$_POST[color3]', color4 = '$_POST[color4]', color5 = '$_POST[color5]', color6 = '$_POST[color6]', font1 = '$_POST[font1]', font1color = '$_POST[font1color]', font2 = '$_POST[font2]', font2color = '$_POST[font2color]', font3 = '$_POST[font3]', font3color = '$_POST[font3color]', font4 = '$_POST[font4]', font4color = '$_POST[font4color]' WHERE name = '$settings[skin]'";
$result=mysql_query($query, $link) or die("Died inserting data into db. Error returned if any: ".mysql_error());
header("Location: settings_theme.php?message=5");
ob_end_flush();
}
// END empty messages
}
// END submit
?>
<div id="submenu"><a href="changeclothes.php" class="sub"><?php echo "$lang_choose_theme"; ?></a> | <a href="settings_theme.php" class="sub"><?php echo "$lang_theme_options_for"; ?></a> | <a href="themes.php" class="sub"><?php echo "$lang_theme_html_editor"; ?></a></div>
<div id="side">
<div class="title"> </div>
<div class="box"><?php if(!empty($messages)){
displayErrors($messages);
}
elseif($_GET[message] && empty($messages)){
displayMessage($_GET[message]);
}
else{
echo "$lang_message013";
}
?>
</div></div>
<div id="main">
<?php
// ****************
// START if options
if($options){
?>
<form name="myform" method="post" enctype="multipart/form-data">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="text"> <!-- START first table class="text" -->
<tr><td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
<td><h1><?php echo "$lang_theme_options_for_theme"; ?> <?php echo "$settings[skin]"; ?></h1></td>
<td><input type="submit" name="Submit" value="<?php echo "$lang_submit"; ?>" id="button" /></td>
</tr></table>
</td></tr>
<tr>
<td colspan="2"><?php echo "$lang_choose"; ?> <a href="changeclothes.php"><?php echo "$lang_another_theme"; ?></a></td>
</tr>
<tr><td colspan="2"> </td></tr>
<tr>
<td colspan="2">
<fieldset id="titlediv">
<legend><?php echo "$lang_theme_options"; ?></legend>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="text"> <!-- START second table class="text" -->
<tr>
<td colspan="2"><?php echo "$lang_theme_options_descr"; ?></td>
</tr>
<tr><td colspan="2"> </td></tr>
<!-- activate theme options -->
<tr>
<td><strong><?php echo "$lang_activate_theme_options"; ?></strong></td>
<td><?php if($theme[options]){ ?>
<input name="options" type="checkbox" value="1" checked="checked" />
<?php }
else
{ ?>
<input name="options" type="checkbox" value="1" />
<?php } ?>
</td>
</tr>
<!-- first you may change the backgroundimage of #header -->
<?php if ($theme[headerimage]){ ?>
<tr><td colspan="2"> </td></tr>
<tr>
<td valign="top"><?php echo "$lang_curr_headerimg"; ?></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="text">
<tr>
<td width="43%"><img src="<?php echo "../thumbs/$theme[headerimage]"; ?>" /></td>
<td valign="bottom" width="57%"><input name="remove" type="checkbox" id="remove" value="1" />
<?php echo "$lang_remove" ?></td>
</tr>
</table></td>
</tr>
<?php } ?>
<tr><td colspan="2"> </td></tr>
<tr>
<td width="38%"><?php echo "$lang_new_headerimg"; ?></td>
<td width="62%">
<input type="file" value="1" name="image[]" \>
<br \></td>
</tr>
<!-- then there's 4 text areas for which you may change both font and fontcolour -->
<?php
// font1
if($options[font1]){ ?>
<tr><td colspan="2"> </td></tr>
<tr>
<td valign="top"><?php echo "$options[font1]"; ?></td>
<td><select name="font1" STYLE="width: 200px;">
<option selected><?php echo "$theme[font1]"; ?></option>
<option value="Arial, sans-serif">Arial</option>
<option value="Helvetica, sans-serif">Helvetica</option>
<option value="Times New Roman, serif">Times New Roman</option>
<option value="Times, serif">Times</option>
<option value="Verdana, sans-serif">Verdana</option>
<option value="Georgia, serif">Georgia</option>
<option value="Trebuchet MS, serif">Trebuchet MS</option>
<option value="Courier, serif">Courier</option>
<option value="Geneva, sans-serif">Geneva</option>
</select></td>
</tr>
<tr>
<td valign="top"><?php echo "$options[font1]"; ?> <?php echo "$lang_color"; ?></td>
<td><a href="javascript:pickColor('pick7');" id="pick7" style="border: 1px solid #000000; font-family:Verdana; font-size:10px; text-decoration: none;"> </a>
<input id="pick7field" size="7" onChange="relateColor('pick7', this.value);" name="font1color" value="<?php echo "$theme[font1color]"; ?>">
<script language="javascript">relateColor('pick7', getObj('pick7field').value);</script></td>
</tr>
<?php }
// font2
if($options[font2]){ ?>
<tr><td colspan="2"> </td></tr>
<tr>
<td valign="top"><?php echo "$options[font2]"; ?></td>
<td><select name="font2" STYLE="width: 200px;">
<option selected><?php echo "$theme[font2]"; ?></option>
<option value="Arial, sans-serif">Arial</option>
<option value="Helvetica, sans-serif">Helvetica</option>
<option value="Times New Roman, serif">Times New Roman</option>
<option value="Times, serif">Times</option>
<option value="Verdana, sans-serif">Verdana</option>
<option value="Georgia, serif">Georgia</option>
<option value="Trebuchet MS, serif">Trebuchet MS</option>
<option value="Courier, serif">Courier</option>
<option value="Geneva, sans-serif">Geneva</option>
</select></td>
</tr>
<tr>
<td valign="top"><?php echo "$options[font2]"; ?> <?php echo "$lang_color"; ?></td>
<td><a href="javascript:pickColor('pick8');" id="pick8" style="border: 1px solid #000000; font-family:Verdana; font-size:10px; text-decoration: none;"> </a>
<input id="pick8field" size="7" onChange="relateColor('pick8', this.value);" name="font2color" value="<?php echo "$theme[font2color]"; ?>">
<script language="javascript">relateColor('pick8', getObj('pick8field').value);</script></td>
</tr>
<?php }
// font3
if($options[font3]){ ?>
<tr><td colspan="2"> </td></tr>
<tr>
<td valign="top"><?php echo "$options[font3]"; ?></td>
<td><select name="font3" STYLE="width: 200px;">
<option selected><?php echo "$theme[font3]"; ?></option>
<option value="Arial, sans-serif">Arial</option>
<option value="Helvetica, sans-serif">Helvetica</option>
<option value="Times New Roman, serif">Times New Roman</option>
<option value="Times, serif">Times</option>
<option value="Verdana, sans-serif">Verdana</option>
<option value="Georgia, serif">Georgia</option>
<option value="Trebuchet MS, serif">Trebuchet MS</option>
<option value="Courier, serif">Courier</option>
<option value="Geneva, sans-serif">Geneva</option>
</select></td>
</tr>
<tr>
<td valign="top"><?php echo "$options[font3]"; ?> <?php echo "$lang_color"; ?></td>
<td><a href="javascript:pickColor('pick9');" id="pick9" style="border: 1px solid #000000; font-family:Verdana; font-size:10px; text-decoration: none;"> </a>
<input id="pick9field" size="7" onChange="relateColor('pick9', this.value);" name="font3color" value="<?php echo "$theme[font3color]"; ?>">
<script language="javascript">relateColor('pick9', getObj('pick9field').value);</script></td>
</tr>
<?php }
// font4
if($options[font4]){ ?>
<tr><td colspan="2"> </td></tr>
<tr>
<td valign="top"><?php echo "$options[font4]"; ?></td>
<td><select name="font4" STYLE="width: 200px;">
<option selected><?php echo "$theme[font4]"; ?></option>
<option value="Arial, sans-serif">Arial</option>
<option value="Helvetica, sans-serif">Helvetica</option>
<option value="Times New Roman, serif">Times New Roman</option>
<option value="Times, serif">Times</option>
<option value="Verdana, sans-serif">Verdana</option>
<option value="Georgia, serif">Georgia</option>
<option value="Trebuchet MS, serif">Trebuchet MS</option>
<option value="Courier, serif">Courier</option>
<option value="Geneva, sans-serif">Geneva</option>
</select></td>
</tr>
<tr>
<td valign="top"><?php echo "$options[font4]"; ?> <?php echo "$lang_color"; ?></td>
<td><a href="javascript:pickColor('pick10');" id="pick10" style="border: 1px solid #000000; font-family:Verdana; font-size:10px; text-decoration: none;"> </a>
<input id="pick10field" size="7" onChange="relateColor('pick10', this.value);" name="font4color" value="<?php echo "$theme[font4color]"; ?>">
<script language="javascript">relateColor('pick10', getObj('pick10field').value);</script></td>
</tr>
<?php } ?>
<!-- and then there's 6 more colors you may change -->
<?php
// color1
if ($options[color1]){ ?>
<tr><td colspan="2"> </td></tr>
<tr>
<td><?php echo "$options[color1]"; ?> <?php echo "$lang_color"; ?></td>
<td>
<a href="javascript:pickColor('pick1');" id="pick1" style="border: 1px solid #000000; font-family:Verdana; font-size:10px; text-decoration: none;"> </a>
<input id="pick1field" size="7" onChange="relateColor('pick1', this.value);" name="color1" value="<?php echo "$theme[color1]"; ?>">
<script language="javascript">relateColor('pick1', getObj('pick1field').value);</script></td>
</tr>
<?php }
// color2
if ($options[color2]){ ?>
<tr><td colspan="2"> </td></tr>
<tr>
<td><?php echo "$options[color2]"; ?> <?php echo "$lang_color"; ?></td>
<td><a href="javascript:pickColor('pick2');" id="pick2" style="border: 1px solid #000000; font-family:Verdana; font-size:10px; text-decoration: none;"> </a>
<input id="pick2field" size="7" onChange="relateColor('pick2', this.value);" name="color2" value="<?php echo "$theme[color2]"; ?>">
<script language="javascript">relateColor('pick2', getObj('pick2field').value);</script></td>
</tr>
<?php }
// color3
if ($options[color3]){ ?>
<tr><td colspan="2"> </td></tr>
<tr>
<td><?php echo "$options[color3]"; ?> <?php echo "$lang_color"; ?></td>
<td><a href="javascript:pickColor('pick3');" id="pick3" style="border: 1px solid #000000; font-family:Verdana; font-size:10px; text-decoration: none;"> </a>
<input id="pick3field" size="7" onChange="relateColor('pick3', this.value);" name="color3" value="<?php echo "$theme[color3]"; ?>">
<script language="javascript">relateColor('pick3', getObj('pick3field').value);</script></td>
</tr>
<?php }
// color4
if ($options[color4]){
?>
<tr>
<td> <?php echo "$options[color4]"; ?></td>
<td><a href="javascript:pickColor('pick4');" id="pick4" style="border: 1px solid #000000; font-family:Verdana; font-size:10px; text-decoration: none;"> </a>
<input id="pick4field" size="7" onChange="relateColor('pick4', this.value);" name="color4" value="<?php echo "$theme[color4]"; ?>">
<script language="javascript">relateColor('pick4', getObj('pick4field').value);</script></td>
</tr>
<?php }
// color5
if ($options[color5]){
?>
<tr><td colspan="2"> </td></tr>
<tr>
<td><?php echo "$options[color5]"; ?> <?php echo "$lang_color"; ?></td>
<td><a href="javascript:pickColor('pick5');" id="pick5" style="border: 1px solid #000000; font-family:Verdana; font-size:10px; text-decoration: none;"> </a>
<input id="pick5field" size="7" onChange="relateColor('pick5', this.value);" name="color5" value="<?php echo "$theme[color5]"; ?>">
<script language="javascript">relateColor('pick5', getObj('pick5field').value);</script></td>
</tr>
<?php }
// color6
if ($options[color6]){
?>
<tr>
<td> <?php echo "$options[color6]"; ?></td>
<td><a href="javascript:pickColor('pick6');" id="pick6" style="border: 1px solid #000000; font-family:Verdana; font-size:10px; text-decoration: none;"> </a>
<input id="pick6field" size="7" onChange="relateColor('pick6', this.value);" name="color6" value="<?php echo "$theme[color6]"; ?>">
<script language="javascript">relateColor('pick6', getObj('pick6field').value);</script></td>
</tr>
<?php } ?>
</table> <!-- END second table class="text" -->
</fieldset></td>
</tr>
<tr><td colspan="2"> </td></tr>
<tr>
<td colspan="2"><input type="submit" name="Submit" value="<?php echo "$lang_submit"; ?>" id="submit"></td>
</tr>
</table> <!-- END first table class="text" -->
</form>
<?php }
// END if options
// **************
else // START if no options
{ ?>
<fieldset id="titlediv">
<legend><?php echo "$lang_theme_options"; ?></legend>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="text">
<tr><td colspan="2"><h1><?php echo "$lang_theme_options $settings[skin]"; ?></h1></td></tr>
<tr><td colspan="2"><?php echo "$lang_message014"; ?></td></tr>
</table>
</fieldset>
<?php
} // END if no options
} // END loggedIn
// **********************************************************************
// **********************************************************************
?>
</div>
<?php
include('footer.php');
?>