<?
/*
KISGB - a Guest Book script written in PHP.
Copyright (C) 2001 Gaylen Fraley
hide@address.com
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
License file for more details.
*/
include("../../config.php");
$fcontents_config = file("../../config.php");
$theme = $HTTP_GET_VARS['theme'];
$PHP_SELF = $HTTP_SERVER_VARS[PHP_SELF];
if ($theme> "");
else {
$theme = "default.thm.php";
}
$theme_dir = "../../themes";
if (strtolower($HTTP_POST_VARS[new_theme])>" ") {
$thm_n = explode(".",$HTTP_POST_VARS[new_theme]);
$thm_n = $thm_n[0].".thm.php";
if (file_exists($theme_dir."/$thm_n")) {echo "File exists. Select another name.<br /><br /><a href=\"javascript:history.go(-1);\">Back</a>";exit;}
$fp = @fopen($theme_dir."/$thm_n","wb");
@fwrite($fp,"<?\n");
@fwrite($fp,"##################################################\n");
@fwrite($fp,"# Customize the ADD window with these variables #\n");
@fwrite($fp,"##################################################\n");
@fwrite($fp,"\$Awindow_title_background_color = \"".$HTTP_POST_VARS[Awindow_title_background_color]."\";\n");
@fwrite($fp,"\$Awindow_title_text_color = \"".$HTTP_POST_VARS[Awindow_title_text_color]."\";\n");
@fwrite($fp,"\$Awindow_title_border_color = \"".$HTTP_POST_VARS[Awindow_title_border_color]."\";\n");
@fwrite($fp,"\$Awindow_background_color = \"".$HTTP_POST_VARS[Awindow_background_color]."\";\n");
@fwrite($fp,"\$Awindow_text_color = \"".$HTTP_POST_VARS[Awindow_text_color]."\";\n");
@fwrite($fp,"\$Awindow_border_color = \"".$HTTP_POST_VARS[Awindow_border_color]."\";\n");
@fwrite($fp,"\$Alink_color = \"".$HTTP_POST_VARS[Alink_color]."\";\n");
@fwrite($fp,"\$Alink_visited_color = \"".$HTTP_POST_VARS[Alink_visited_color]."\";\n");
@fwrite($fp,"\$Alink_active_color = \"".$HTTP_POST_VARS[Alink_active_color]."\";\n");
@fwrite($fp,"##################################################\n");
@fwrite($fp,"# Customize the VIEW window with these variables #\n");
@fwrite($fp,"##################################################\n");
@fwrite($fp,"\$Vwindow_title_background_color = \"".$HTTP_POST_VARS[Vwindow_title_background_color]."\";\n");
@fwrite($fp,"\$Vwindow_title_text_color = \"".$HTTP_POST_VARS[Vwindow_title_text_color]."\";\n");
@fwrite($fp,"\$Vwindow_title_border_color = \"".$HTTP_POST_VARS[Vwindow_title_border_color]."\";\n");
@fwrite($fp,"\$Vwindow_background_color1 = \"".$HTTP_POST_VARS[Vwindow_background_color1]."\";\n");
@fwrite($fp,"\$Vwindow_background_image1 = \"".$HTTP_POST_VARS[Vwindow_background_image1]."\";\n");
@fwrite($fp,"\$Vwindow_text_color1 = \"".$HTTP_POST_VARS[Vwindow_text_color1]."\";\n");
@fwrite($fp,"\$Vwindow_url_color1 = \"".$HTTP_POST_VARS[Vwindow_url_color1]."\";\n");
@fwrite($fp,"\$Vwindow_hilite_color1 = \"".$HTTP_POST_VARS[Vwindow_hilite_color1]."\";\n");
@fwrite($fp,"\$Vwindow_hilite_text_color1 = \"".$HTTP_POST_VARS[Vwindow_hilite_text_color1]."\";\n");
@fwrite($fp,"\$Vwindow_border_color1 = \"".$HTTP_POST_VARS[Vwindow_border_color1]."\";\n");
@fwrite($fp,"\$Vwindow_background_color2 = \"".$HTTP_POST_VARS[Vwindow_background_color2]."\";\n");
@fwrite($fp,"\$Vwindow_background_image2 = \"".$HTTP_POST_VARS[Vwindow_background_image2]."\";\n");
@fwrite($fp,"\$Vwindow_text_color2 = \"".$HTTP_POST_VARS[Vwindow_text_color2]."\";\n");
@fwrite($fp,"\$Vwindow_url_color2 = \"".$HTTP_POST_VARS[Vwindow_url_color2]."\";\n");
@fwrite($fp,"\$Vwindow_hilite_color2 = \"".$HTTP_POST_VARS[Vwindow_hilite_color2]."\";\n");
@fwrite($fp,"\$Vwindow_hilite_text_color2 = \"".$HTTP_POST_VARS[Vwindow_hilite_text_color2]."\";\n");
@fwrite($fp,"\$Vwindow_border_color2 = \"".$HTTP_POST_VARS[Vwindow_border_color2]."\";\n");
@fwrite($fp,"\$Vlink_color = \"".$HTTP_POST_VARS[Vlink_color]."\";\n");
@fwrite($fp,"\$Vlink_visited_color = \"".$HTTP_POST_VARS[Vlink_visited_color]."\";\n");
@fwrite($fp,"\$Vlink_active_color = \"".$HTTP_POST_VARS[Vlink_active_color]."\";\n");
@fwrite($fp,"##################################################\n");
@fwrite($fp,"# Customize the INTRO window with these variables#\n");
@fwrite($fp,"##################################################\n");
@fwrite($fp,"\$Intro_background_color = \"".$HTTP_POST_VARS[Intro_background_color]."\";\n");
@fwrite($fp,"\$Intro_text_color = \"".$HTTP_POST_VARS[Intro_text_color]."\";\n");
@fwrite($fp,"\$Intro_border_color = \"".$HTTP_POST_VARS[Intro_border_color]."\";\n");
@fwrite($fp,"##################################################\n");
@fwrite($fp,"# Customize the FOOTER with these variables #\n");
@fwrite($fp,"##################################################\n");
@fwrite($fp,"\$Footer_text_color = \"".$HTTP_POST_VARS[Footer_text_color]."\";\n");
@fwrite($fp,"##################################################\n");
@fwrite($fp,"# Customize the BUTTONS with these variables. #\n");
@fwrite($fp,"##################################################\n");
@fwrite($fp,"\$button_text_color = \"".$HTTP_POST_VARS[button_text_color]."\";\n");
@fwrite($fp,"\$button_background_color = \"".$HTTP_POST_VARS[button_background_color]."\";\n");
@fwrite($fp,"\$button_border_color = \"".$HTTP_POST_VARS[button_border_color]."\";\n");
@fwrite($fp,"?>");
@fclose($fp);
highlight_file($theme_dir."/$thm_n");
echo "<br /><br />";
echo "<a href=\"javascript:location.replace('$PHP_SELF');\">Back</a>";exit;
}
$path_to_themes = "$theme_dir/$theme";
include($path_to_themes);
$fcontents_themes = file($path_to_themes);
$handle=opendir($theme_dir);
$theme_sb = "";
$selected_theme = explode('.',$theme);
$cnt = 0;
while (($file = readdir($handle))!==false) {
if ($file == '.'||$file == '..') continue;
$thm = explode('.',$file);
if (chop($thm[1]) != "thm") continue;
$cnt++;
if ($cnt==1) {
$theme_sb = "<select name=theme onchange=\"location.replace('$PHP_SELF?&theme='+this.options[this.selectedIndex].value);\">\n"; }
$selected = "";
if ($thm[0] == $selected_theme[0]) $selected = "selected";
$theme_sb .= "<option value=\"$file\" $selected>$thm[0]</option>\n";
}
if ($cnt>0) $theme_sb .= "</select>\n";
closedir($handle);
?>
<html>
<head>
<style>
#tdadd
{
vertical-align : top;
border-width:0;
font-size:smaller;
}
<?@include("../../style-sheet-button.php");?>
</style>
<script>
var gForm = "";
function getColorChart(form) {gForm = form;
var newwin = open("color_chart.html","colorchart","width=400,height=200,status");
}
var _name_="";
</script>
</head>
<body VLINK="<?=$Vlink_visited_color;?>" LINK="<?=$Vlink_color;?>" ALINK="<?=$Vlink_active_color;?>">
<form method=post>
<table width=100%>
<tr><td><table border=1>
<tr><th colspan=4 align=center>Contents of <?=$theme?></th>
<tr><th>Setting Name</th><th>Setting Value</th><th>Select<br />Color</th><th>Display</th>
<?
while (list ($line_num, $line) = each ($fcontents_themes)) {
if (substr($line,0,1)=="#") continue;
if (strpos($line,"<?")||strpos($line,"?>")) continue;
if (strpos($line,"color")===false&&strpos($line,"image")===false) continue;
$line = str_replace(";","",$line);
$settings = explode("=",$line);
reset($HTTP_POST_VARS);
if (strtolower($HTTP_POST_VARS[button])!="reset") {
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
if (chop($key) == chop(substr($settings[0],1))) {
$settings[1] = $val;
${$key} = $val;
}
}
}
$_name_ = trim(substr($settings[0],1));
$_line_ = str_replace("\"","",$settings[1]);
echo "<tr><td>".$settings[0]."</td><td><input size=15 name=".substr($settings[0],1)." value=".$settings[1]."></td><td><input id=\btn\" type=button value=\"Colors\" onClick=\"_name_='$_name_';open('colorwheel.php?_form_=0','','width=256,height=350');\">"."</td><td style=\"background-color:$_line_;\"> </td></tr>";
}
?>
</table></td>
<td width=100% valign=top><table width=100% border=0 cellspacing=0 cellpadding=0>
<tr><td width=50% valign=top align=center><center><b><font color=blue>Select Theme</b></center><br /><?=$theme_sb;?><input id="btn" type=submit name=button value=Rebuild onClick="forms[0].submit();"> <input type=submit id="btn" name=button value=Reset onClick="if (confirm('Are you sure? This will restore all original values.')) {forms[0].submit();};"> <input type=submit id="btn" name=button value=Save> ==> <input name=new_theme><br /><br /><center><b>View Screen</b></center></td></tr></table><br />
<table width=100% border=1 cellspacing=0 cellpadding=0>
<tr><td width=50% valign=top align=center><tr><td style="background-color:<?=$Intro_background_color;?>;color:<?=$Intro_text_color;?>;border-color:<?=$Intro_border_color;?>;text-align:center">Welcome to my Guest Book</td></tr>
<tr><td style="background-color:<?=$Vwindow_title_background_color;?>;color:<?=$Vwindow_title_text_color;?>;border-color:<?=$Vwindow_title_border_color;?>;">Language <select><option value="blank.gif" selected>Select</option></select> Theme <select><option value="blank.gif" selected>Select</option></select>
<br /><a href="#" onMouseOver="status='Sign Guest Book';return true;" onClick="if (this.blur) this.blur();":><span style="color:<?=$Vlink_color;?>">Sign Guest Book</span></a> | <a href="#" onMouseOver='status="Admin Menu (requires login)";return true;' onClick="if (this.blur) this.blur();"><span style="color:<?=$Vlink_color;?>">Admin Menu (requires login)</span></a></td> </tr>
<tr>
<td style="background-color:<?=$Vwindow_background_color1;?>;background-image:url(<?=$Vwindow_background_image1;?>);color:<?=$Vwindow_text_color1;?>;border-color:<?=$Vwindow_border_color1;?>;"><span style="width:100%;background-color:<?=$Vwindow_hilite_color1;?>;color:<?=$Vwindow_hilite_text_color1;?>;">Someone entered these comments on 01/01/2002 at 01:00</span><br /><br />This would be some text for message number one. Here is a link <a href="#"><span style="color:$Vwindow_url_color1;">www.test.com</span></a></td>
</tr>
<tr>
<td style="background-color:<?=$Vwindow_background_color2;?>;background-image:url(<?=$Vwindow_background_image2;?>);color:<?=$Vwindow_text_color2;?>;border-color:<?=$Vwindow_border_color2;?>;"><span style="width:100%;background-color:<?=$Vwindow_hilite_color2;?>;color:<?=$Vwindow_hilite_text_color2;?>;">Someone else entered these comments on 01/01/2002 at 12:00</span><br /><br />This would be some text for message number two. Here is a link <a href="#"><span style="color:$Vwindow_url_color2;">www.test.com</span></a></td>
</tr>
<tr><td style="background-color:<?=$Vwindow_title_background_color;?>;color:<?=$Vwindow_title_text_color;?>;border-color:<?=$Vwindow_title_border_color;?>;">Language <select><option value="blank.gif" selected>Select</option></select> Theme <select><option value="blank.gif" selected>Select</option></select>
<br /><a href="#" onMouseOver="status='Sign Guest Book';return true;" onClick="if (this.blur) this.blur();":><span style="color:<?=$Vlink_color;?>">Sign Guest Book</span></a> | <a href="#" onMouseOver='status="Admin Menu (requires login)";return true;' onClick="if (this.blur) this.blur();"><span style="color:<?=$Vlink_color;?>">Admin Menu (requires login)</span></a></td> </tr>
<tr><td style="background-color:<?=$Intro_background_color;?>;color:<?=$Intro_text_color;?>;border-color:<?=$Intro_border_color;?>;"> </td></tr></table>
<br /><br /><br /><center><b>Add/Sign Screen</b></center><table border=1 width=100% cellspacing=0 cellpadding=0 style="border-color:<?=$Awindow_title_border_color;?>;background-color:<?=$Awindow_title_background_color;?>;">
<tr><td valign=top>
<tr><td style="color:<?=$Awindow_title_text_color;?>;background-color:<?=$Awindow_title_background_color;?>" id=tdadd align=left > Please Sign Guest Book</td>
<td id=tdadd align=right style="background-color:<?=$Awindow_title_background_color;?>;color:<?=$Awindow_title_text_color;?>;"><a href="#" onMouseOver="status='View Guest Book';return true;" onClick="if (this.blur) this.blur();":><span style="color:<?=$Alink_color;?>">View Guest Book</span></a></td>
<td id=tdadd align=right style="border-color:<?=$Awindow_title_border_color?>;background-color:<?=$Awindow_title_background_color?>;color:<?=$Awindow_title_text_color?>;"><a href="#" onMouseOver='status="Admin Menu (requires login)";return true;' onClick="if (this.blur) this.blur();"><span style="color:<?=$Alink_color;?>">Admin Menu (requires login)</span></a></td> </tr>
</table>
<table width=100% cellspacing=0 cellpadding=0 border=1 style="color:<?=$Awindow_text_color;?>;background-color:<?=$Awindow_background_color;?>;border-color:<?=$Awindow_border_color;?>;
">
<tr>
<td id=tdadd> Name: *</td>
<td id=tdadd><input name=name size=30 maxlength=50></td>
</tr>
<tr>
<td id=tdadd> Your E-mail: *</td>
<td id=tdadd><input name=email size=30 maxlength=75></td>
</tr>
<tr>
<td id=tdadd> Your Home Page:</td>
<td id=tdadd><input name=home size=30 maxlength=75 value=></td>
</tr>
<tr>
<td id=tdadd> Your Picture:</td>
<td id=tdadd><input name=pic size=30 maxlength=75 value="http://"></td>
</tr>
<tr>
<td id=tdadd> ICQ:</td>
<td id=tdadd><input name=icq size=30 maxlength=15></td>
</tr>
<tr>
<td id=tdadd> AIM:</td>
<td id=tdadd><input name=aim size=30 maxlength=30></td>
</tr>
<tr>
<td id=tdadd> YIM:</td>
<td id=tdadd><input name=yim size=30 maxlength=30></td>
</tr>
<tr>
<td id=tdadd> MSN:</td>
<td id=tdadd><input name=msn size=30 maxlength=30></td>
</tr>
<tr>
<td id=tdadd> Country:</td>
<td id=tdadd><select name="nation"><option value="blank.gif" selected>Select</option></select></td>
</tr>
<tr>
<td id=tdadd> IP:</td>
<td id=tdadd>192.168.183.156</td>
</tr>
<tr>
<td id=tdadd> Comment:<br />(Max 500<br />characters)</td>
<td id=tdadd><textarea name=comments cols=40 rows=5 wrap=soft></textarea></td>
</tr>
<tr>
<td id=tdadd> </td>
<td id=tdadd><b>HTML: <b><em><font><i><p><strong><u><b><a><span><br></b></td>
</tr>
<tr>
<td id=tdadd> </td>
<td id=tdadd>Private? <input type=checkbox name=private> Password (max 10) <input type=password name=password value="" size=15 maxlength=10></td>
</tr>
<tr>
<td id=tdadd colspan=2 align=left> <b><i>(* denotes required field)</td>
</tr>
<tr>
<td id=tdadd colspan=2> </td>
</tr>
<tr>
<td id=tdadd colspan=2 align=center><input id="btn" type=button value="Smileys"></td>
</tr>
<tr>
<td id=tdadd colspan=2> </td>
</tr>
<tr>
<td id=tdadd colspan=2 align=center><input id="btn" type=button value="Add entry to Guest Book"></td>
</tr>
</table>
</td></tr>
</table>
</form>
</body>
</html>