<?php
|
|
/**
|
|
* @package uForum
|
|
* @file admin/styles.php
|
|
* @version $Id$
|
|
* @copyright 2009(c) PioDer <[email protected]>
|
|
* @link http://pioder.gim2przemysl.int.pl/
|
|
* @license GNU GPL v3
|
|
**/
|
|
define('IN_uF', true);
|
|
//include files
|
|
include('./../config.php');
|
|
include('./../includes/constants.php');
|
|
include('./../includes/db.php');
|
|
include('./../includes/errors.php');
|
|
include('./../includes/classes/class_pms.php');
|
|
//connect to database
|
|
DataBase::db_connect();
|
|
include('./../includes/sessions.php');
|
|
include('./../includes/classes/class_user.php');
|
|
include('./../common.php');
|
|
include('./../includes/admin/class_main.php');
|
|
include('./../includes/classes/class_forum.php');
|
|
include('./../includes/admin/class_forum.php');
|
|
include('./../includes/classes/secure.php');
|
|
include('./../lngs/'.Admin_Over::DefaultLang().'/admin.php');
|
|
SessDelInvalid();
|
|
SessRegister();
|
|
SessDeleteOld();
|
|
|
|
if (User::UserInformation($_SESSION['uid'],'rank')!=2)
|
|
{
|
|
admin_message_forum($lng['yournotadmin'],'../index.php');
|
|
}
|
|
if (!isset($_GET['mode']))
|
|
{
|
|
header('Location: styles.php?mode=view');
|
|
}
|
|
switch($_GET['mode'])
|
|
{
|
|
case 'delete':
|
|
{
|
|
$sid = intval($_GET['id']);
|
|
if ($sid!=$forum_config['defaultskin'])
|
|
{
|
|
$sql = "DELETE FROM ".SKINS_TABLE." WHERE `s_id`='$sid'";
|
|
DataBase::sql_query($sql,GENERAL,'Could not delete skin');
|
|
$sql = "UPDATE ".USERS_TABLE." SET `skin`='".$forum_config['defaultskin']."' WHERE `skin`='$sid'";
|
|
DataBase::sql_query($sql,GENERAL,'Could not update user');
|
|
admin_message_forum($lng['skins_deleted'],'styles.php?mode=view');
|
|
}
|
|
else
|
|
{
|
|
admin_message_forum($lng['styles_info_1'],'styles.php?mode=view');
|
|
}
|
|
break;
|
|
}
|
|
case 'view':
|
|
{
|
|
if (isset($_POST['skin']))
|
|
{
|
|
if(strlen(trim($_POST['skin']))>3)
|
|
{
|
|
if (is_dir('./../skins/'.$_POST['skin']))
|
|
{
|
|
$last = DataBase::new_id(SKINS_TABLE);
|
|
DataBase::sql_query("INSERT INTO ".SKINS_TABLE." VALUES ('$last','".strip_tags($_POST['skin'])."')",GENERAL,'Could not add skin');
|
|
$_POST['skin']='';
|
|
admin_message_forum($lng['skins_added'],'styles.php?mode=view');
|
|
}
|
|
else
|
|
{
|
|
$_POST['skin']='';
|
|
admin_message_forum($lng['invalid_skin'],'styles.php?mode=view');
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$_POST['skin']='';
|
|
}
|
|
$skin = array(
|
|
'L.main_beam'=>$lng['admin_styles'],
|
|
'L.install'=>$lng['install'],
|
|
'L.new_skin'=>$lng['new_skin'],
|
|
'L.delete'=>$lng['delete'],
|
|
'L.actual_skins'=>$lng['actual_skins']
|
|
);
|
|
Admin_Over::GenerateHeader();
|
|
include('./template/skins_beam_body.tpl');
|
|
$sql = "SELECT * FROM ".SKINS_TABLE;
|
|
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain skins information');
|
|
while ($item = DataBase::fetch($query))
|
|
{
|
|
$skin=array(
|
|
'L.delete' => $lng['delete'],
|
|
'skin_name' => $item['name'],
|
|
's_id' => $item['s_id']
|
|
);
|
|
include('./template/skins_item_add.tpl');
|
|
}
|
|
echo '</table>';
|
|
include('./template/overall_footer.tpl');
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
header('Location: styles.php?mode=view');
|
|
break;
|
|
}
|
|
}
|
|
?>
|