A lightweight forum engine written in PHP. Repository is now obsolete and read-only. http://www.pioder.pl/uforum.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

112 lines
3.2 KiB

<?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/class_db.php');
include('./../includes/class_error.php');
include('./../includes/classes/class_pms.php');
//connect to database
DataBase::db_connect();
include('./../includes/sessions.php');
include('./../includes/class_user.php');
include('./../common.php');
include('./../includes/admin/class_main.php');
include('./../includes/class_forum.php');
include('./../includes/admin/class_forum.php');
include('./../includes/classes/secure.php');
include('./../lngs/'.Admin_Over::DefaultLang().'/admin.php');
sess_del_invalid($_SESSION['uid']);
sess_register($_SESSION['uid']);
sess_delete_old();
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 = @mysql_fetch_array($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;
}
}
?>