i made a plugin but i dunno what i done wrong.
the plugin is working but is not in right place.
you can see the plugin here:
tsse.smart-host.ro :: Welcome !
and the code is:
Code:
<?php
define('TS_P_VERSION', '0.1 by GaBoNtZ');
// Security Check.
if (!defined('IN_PLUGIN_SYSTEM'))
{
die("<font face='verdana' size='2' color='darkred'><b>Error!</b> Direct initialization of this file is not allowed.</font>");
}
// BEGIN Plugin: Template Changer
require_once('global.php');
gzip();
dbconn();
loggedinorreturn();
maxsysop();
$action = isset($_POST['action']) ? htmlspecialchars_uni($_POST['action']) : (isset($_GET['action']) ? htmlspecialchars_uni($_GET['action']) : '');
$type = isset($_POST['type']) ? htmlspecialchars_uni($_POST['type']) : (isset($_GET['type']) ? htmlspecialchars_uni($_GET['type']) : '');
$lang->load('usercp');
function form($name,$emailcheck=false)
{
return print("<form method='post' action='".$_SERVER['SCRIPT_NAME']."' name='theme_changer' ".($emailcheck ? "onSubmit='return checkEmail(this)'" : "")."><input type='hidden' name='action' value='".htmlspecialchars_uni($name)."'><input type='hidden' name='type' value='save'>");
}
function submit()
{
global $lang;
return tr($lang->usercp['savesettings'], "<input type='submit' class='btn' value='".$lang->global['buttonsave']."'></form>",1);
}
if ($type != 'save')
{
//stdhead($lang->usercp['tracker']);
//usercpmenu ("tracker");
print ("<table border=0 cellspacing=0 cellpadding=5 width=100%>");
form ("tracker");
}
if ($type == 'save')
{
$stylesheet = htmlspecialchars_uni($_POST["stylesheet"]);
if ($stylesheet != $CURUSER['stylesheet'])
$updateset[] = "stylesheet = " . sqlesc($stylesheet);
if (isset($updateset) && count($updateset) > 0)
sql_query("UPDATE users SET " . implode(", ", $updateset) . " WHERE id=".sqlesc($CURUSER['id'])) or sqlerr(__FILE__, __LINE__);
redirect("index.php");
}
$defaulttemplate = ts_template();
$template_dirs = dir_list(INC_PATH.'/templates');
if (empty($template_dirs))
$dirlist .= '<option value="">There is no template</option>';
else
{
foreach ($template_dirs as $dir)
{
if (substr($dir, -4, 1) !== '.')
{
$dirlist .= '<option value="'.$dir.'" '.($CURUSER['stylesheet'] == $dir ? 'selected="selected"' : ($defaulttemplate == $dir ? 'selected="selected"' : '')).'>'.$dir.'</option>';
}
}
}
$t_image = '<img src="'.$BASEURL.'/include/templates/'.($CURUSER['stylesheet'] ? htmlspecialchars_uni($CURUSER['stylesheet']) : 'default').'/images/header.jpg" border="0" width="100" height="20" style="vertical-align: middle;" id="t_image">';
tr($lang->usercp['stylesheet'], "<select name='stylesheet' id='specialboxs' style='vertical-align: middle;' OnChange='javascript:document.forms[0].t_image.src=\"".$BASEURL."/include/templates/\"+this.value+\"/images/header.jpg\"'>\n$dirlist \n</select> ".$t_image,1);
submit();
//End Plugin: Template Changer
?>
maybe someone can correct this?