<?php
/*
 ########################################################################
#                                                                        #
#           Version 4       /                        /   /               #
#          -----------__---/__---__------__----__---/---/-               #
#           | /| /  /___) /   ) (_ `   /   ) /___) /   /                 #
#          _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___               #
#                       Free Content / Management System                 #
#                                   /                                    #
#                                                                        #
#                                                                        #
#   Copyright 2005-2006 by webspell.org                                  #
#                                                                        #
#   visit webSPELL.org, webspell.info to get webSPELL for free           #
#   - Script runs under the GNU GENERAL PUBLIC LICENSE                   #
#   - It's NOT allowed to remove this copyright-tag                      #
#   -- http://www.fsf.org/licensing/licenses/gpl.html                    #
#                                                                        #
#   Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at),   #
#   Far Development by Development Team - webspell.org                   #
#                                                                        #
#   visit webspell.org                                                   #
#                                                                        #
 ########################################################################
*/

if(!ispageadmin($userID) OR substr(basename($_SERVER[REQUEST_URI]),0,15) != "admincenter.php") die('Access denied.');

if($_POST['submit']) {
    safe_query("UPDATE ".PREFIX."styles SET title='".$_POST['title']."', bgpage='".$_POST['page']."', border='".$_POST['borderc']."', bghead='".$_POST['head']."', bgcat='".$_POST['cat']."', bg1='".$_POST['bg1']."', bg2='".$_POST['bg2']."', bg3='".$_POST['bg3']."', bg4='".$_POST['bg4']."', win='".$_POST['win']."', loose='".$_POST['loose']."', draw='".$_POST['draw']."' ");
		
  $file = ("../_stylesheet.css");
	$fp = fopen ($file, "w");
	fwrite ($fp, $_POST['stylesheet']);
	fclose($fp);
	redirect("admincenter.php?site=styles","Successfully updated.");
}
else {
	echo'<h2>styles</h2>';
	$ergebnis=safe_query("SELECT * FROM ".PREFIX."styles");
    $ds=mysql_fetch_array($ergebnis);
	
    $file = ("../_stylesheet.css");
	$size = filesize($file);
	$fp = fopen ($file, "r");
	$stylesheet = fread($fp, $size);
	fclose($fp);
	
	echo'<form method="post" action="admincenter.php?site=styles">
	     <table cellpadding="0" cellspacing="3">
		   <tr>
		     <td align="right">Pagetitle:</td><td><input type="text" name="title" value="'.$ds[title].'" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td><td>&nbsp;</td>
		   </tr>
		   <tr>
		     <td align="right">Page-Backgroundcolor:</td><td><input type="text" name="page" value="'.$ds[bgpage].'" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td><td style="border: 1px solid #000000;" width="20" bgcolor="'.$ds[bgpage].'">&nbsp;</td></tr>
		   </tr>
		   <tr>
		     <td align="right">Table-Bordercolor:</td><td><input type="text" name="borderc" value="'.$ds[border].'" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td><td style="border: 1px solid #000000;" width="20" bgcolor="'.$ds[border].'">&nbsp;</td>
		   </tr>
		   <tr>
		     <td align="right">Head-BG:</td><td><input type="text" name="head" value="'.$ds[bghead].'" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td><td style="border: 1px solid #000000;" width="20" bgcolor="'.$ds[bghead].'">&nbsp;</td>
		   </tr>
		   <tr>
		     <td align="right">Category-BG:</td><td><input type="text" name="cat" value="'.$ds[bgcat].'" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td><td style="border: 1px solid #000000;" width="20" bgcolor="'.$ds[bgcat].'">&nbsp;</td>
		   </tr>
		   <tr>
		     <td align="right">Cell-BG 1:</td><td><input type="text" name="bg1" value="'.$ds[bg1].'" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td><td style="border: 1px solid #000000;" width="20" bgcolor="'.$ds[bg1].'">&nbsp;</td>
		   </tr>
		   <tr>
		     <td align="right">Cell-BG 2:</td><td><input type="text" name="bg2" value="'.$ds[bg2].'" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td><td style="border: 1px solid #000000;" width="20" bgcolor="'.$ds[bg2].'">&nbsp;</td>
		   </tr>
		   <tr>
		     <td align="right">Cell-BG 3:</td><td><input type="text" name="bg3" value="'.$ds[bg3].'" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td><td style="border: 1px solid #000000;" width="20" bgcolor="'.$ds[bg3].'">&nbsp;</td>
		   </tr>
		   <tr>
		     <td align="right">Cell-BG 4:</td><td><input type="text" name="bg4" value="'.$ds[bg4].'" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td><td style="border: 1px solid #000000;" width="20" bgcolor="'.$ds[bg4].'">&nbsp;</td>
		   </tr>
		   <tr>
		     <td align="right">Win Fontcolor:</td><td><input type="text" name="win" value="'.$ds[win].'" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td><td style="border: 1px solid #000000;" width="20" bgcolor="'.$ds[win].'">&nbsp;</td>
		   </tr>
		   <tr>
		     <td align="right">Loose Fontcolor:</td><td><input type="text" name="loose" value="'.$ds[loose].'" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td><td style="border: 1px solid #000000;" width="20" bgcolor="'.$ds[loose].'">&nbsp;</td>
		   </tr>
		   <tr>
		     <td align="right">Draw Fontcolor:</td><td><input type="text" name="draw" value="'.$ds[draw].'" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td><td style="border: 1px solid #000000;" width="20" bgcolor="'.$ds[draw].'">&nbsp;</td>
		   </tr>
		   <tr>
		 </table>
		 <table cellpadding="0" cellspacing="3">
		     <td>
			   Stylesheet: Do not delete classes! It would have consiquences on the whole homepage!<br>
			   <textarea name="stylesheet" cols="100" rows="30" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'">'.$stylesheet.'</textarea>    
			 </td>
		   </tr>
		   <tr><td><input type="submit" name="submit" value="update"></td></tr>
		 </table>
		 </form>';
}
		 
?>
