<?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
{
if($_POST['Submit']){
if(!$_POST[skin])
{
$messages[]="$lang_message028";
}
if(empty($messages)) {
$query="UPDATE $table_settings SET skin = '$_POST[skin]'";
$result=mysql_query($query, $link) or die("Died inserting data into db. Error returned if any: ".mysql_error());
header("Location: changeclothes.php?message=5");
ob_end_flush();
}
}
if(!$_POST['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"; ?></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_message012";
}
?>
</div></div>
<div id="main">
<form name="myform" method="post" enctype="multipart/form-data">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="text">
<tr>
<td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><h1><?php echo "$lang_choose_theme"; ?></h1></td>
<td><input type="submit" name="Submit" value="<?php echo"$lang_submit"; ?>" id="submit"></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><br /><table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
$path = "../themes/";
$dp = opendir($path);
while($item = readdir($dp)){
if(substr($item,0,1)!='.'){
if($item == $settings[skin]){
?>
<tr>
<td width="11%"><input name="skin" type="radio" value="<?php echo "$item"; ?>" checked="checked" /></td>
<td width="16%"> </td>
<td width="27%"><img src="<?php echo "../themes/$item/preview.jpg"; ?>" /></td>
<td width="4%"> </td>
<td width="42%" class="title"><?php echo "$item"; ?></td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<?php
}
elseif($item != 'theme_security.php') // filter it out
{
?>
<tr>
<td><input name="skin" type="radio" value="<?php echo "$item"; ?>" /></td>
<td> </td>
<td><img src="<?php echo "../themes/$item/preview.jpg"; ?>" /></td>
<td> </td>
<td class="title"><?php echo "$item"; ?></td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<?php
}
}
}
?>
</table></td>
</tr>
<tr>
<td width="47%"> </td>
<td width="53%"> </td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="Submit" value="<?php echo"$lang_submit"; ?>" id="submit"></td>
</tr>
</table>
</form>
</div>
<?php
}
}
include('footer.php');
?>