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.
 
 
 
 
 
 

372 lines
12 KiB

<?php
/**
* @package uForum
* @file admin/admin_scripts.php
* @version $Id$
* @copyright 2007-2010 (c) PioDer <[email protected]>
* @link http://www.pioder.pl/
* @license see LICENSE.txt
**/
define('IN_uF', true);
//include files
include('./../config.php');
include('./../includes/constants.php');
include('./../includes/db.php');
include('./../includes/errors.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/misc_functions.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');
}
$errors = true;
if (isset($_POST['forum_path']))
{
if (!$_POST['forum_path'])
{
$message = $lng['no_path'];
$ERROR = './template/in_error_body.tpl';
}
else
{
if ((strlen(trim($_POST['forum_name']))<3) or (strlen(trim($_POST['forum_name']))>30))
{
$message = $lng['invalid_forum_name'];
$ERROR = './template/in_error_body.tpl';
}
else
{
if ($_POST['default_skin']!='-1')
{
if ($_POST['default_lang']!='-1')
{
if($_POST['limit_tpid']!='-1')
{
if($_POST['limit_ftid']!='-1')
{
if($_POST['limit_users']!='-1')
{
if((strlen($_POST['forum_desc'])>3) or (strlen($_POST['forum_desc'])<30))
{
$errors = false;
}
else
{
$message = $lng['invalid_forum_desc'];
$ERROR = './template/in_error_body.tpl';
}
}
else
{
$message = $lng['no_limit_users'];
$ERROR = './template/in_error_body.tpl';
}
}
else
{
$message = $lng['no_limit_ftid'];
$ERROR = './template/in_error_body.tpl';
}
}
else
{
$message = $lng['no_limit_tpid'];
$ERROR = './template/in_error_body.tpl';
}
}
else
{
$message = $lng['no_lang'];
$ERROR = './template/in_error_body.tpl';
}
}
else
{
$message = $lng['no_skin'];
$ERROR = './template/in_error_body.tpl';
}
}
}
if (!$errors)
{
$name = array();
$value = array();
/* forum name */
$name[] = 'forumname';
$value[] = strip_tags($_POST['forum_name']);
/* forum description */
$name[] = 'forumdesc';
$value[] = strip_tags($_POST['forum_desc']);
/* forum path */
$name[] = 'forumpatch';
$value[] = strip_tags($_POST['forum_path']);
/* forum disabled */
$name[] = 'disable_forum';
$value[] = strip_tags($_POST['forum_disabled']);
/* default_skin */
$name[] = 'defaultskin';
$value[] = $_POST['default_skin'];
/* default lang */
$name[] = 'defaultlang';
$value[] = $_POST['default_lang'];
/* limit users */
$name[] = 'limit_users';
$value[] = $_POST['limit_users'];
/* limit posts in topic */
$name[] = 'limit_tpid';
$value[] = $_POST['limit_tpid'];
/* limit topics in forum*/
$name[] = 'limit_ftid';
$value[] = $_POST['limit_ftid'];
/* meta keywords */
$name[] = 'meta_keywords';
$value[] = strip_tags($_POST['meta_keywords']);
/* meta description */
$name[] = 'meta_description';
$value[] = strip_tags($_POST['meta_description']);
/* show queries */
$name[] = 'show_time_generation';
$value[] = (!isset($_POST['allow_time_generation'])) ? 0 : 1;
/* enable_confirms */
$name[] = 'enable_confirms';
$value[] = (!isset($_POST['enable_confirms'])) ? 0 : 1;
/* enable_confirms */
$name[] = 'ip_post_for_mod';
$value[] = (!isset($_POST['allow_ip_for_mods'])) ? 0 : 1;
/* use censorlist */
$name[] = 'use_censorlist';
$value[] = (!isset($_POST['enable_censorlist'])) ? 0 : 1;
/* enable warns */
$name[] = 'allow_warns';
$value[] = (!isset($_POST['enable_warnings'])) ? 0 : 1;
/* warns in topic */
$name[] = 'warns_in_topic';
$value[] = (!isset($_POST['warnings_in_topic'])) ? 0 : 1;
//allow_email
$name[] = 'allow_send_email';
$value[] = (!isset($_POST['enable_send_email'])) ? 0 : 1;
//allow_upload_avatars
$name[] = 'allow_upload_avatars';
$value[] = (!isset($_POST['allow_upload_avatars'])) ? 0 : 1;
/* allow shoutbox */
$name[] = 'view_shoutbox';
$value[] = (!isset($_POST['allow_shoutbox'])) ? 0 : 1;
/* shoutbox max time*/
$name[] = 'shoutbox_max_time';
$value[] = (!is_numeric($_POST['shoutbox_max_time'])) ? '14400' : $_POST['shoutbox_max_time'];
/* color mod */
$name[] = 'color_mod';
$value[] = ($_POST['color_mod']=='') ? 'green' : strip_tags($_POST['color_mod']);
/* color admin */
$name[] = 'color_admin';
$value[] = ($_POST['color_admin']=='') ? 'red' : strip_tags($_POST['color_admin']);
/* av max x */
$name[] = 'max_av_x';
$value[] = (!is_numeric($_POST['max_av_x'])) ? '150' : $_POST['max_av_x'];
/* av max y */
$name[] = 'max_av_y';
$value[] = (!is_numeric($_POST['max_av_y'])) ? '150' : $_POST['max_av_y'];
/* av max filesize */
$name[] = 'max_av_filesize';
$value[] = (!is_numeric($_POST['max_av_filesize'])) ? '102400' : ($_POST['max_av_filesize'] * 1024);
/* sig len */
$name[] = 'sig_len';
$value[] = (!is_numeric($_POST['sig_len'])) ? '200' : $_POST['sig_len'];
/* antiflood time */
$name[] = 'time_antiflood';
$value[] = (!is_numeric($_POST['time_antiflood'])) ? '30' : $_POST['time_antiflood'];
/* tables width */
$name[] = 'tables_width';
$value[] = (!is_numeric($_POST['tables_width'])) ? '900' : $_POST['tables_width'];
/* sig len */
$name[] = 'sig_len';
$value[] = (!is_numeric($_POST['sig_len'])) ? '200' : $_POST['sig_len'];
/* new password len */
$name[] = 'newpasswd_len';
$value[] = (!is_numeric($_POST['newpasswd_len'])) ? '6' : $_POST['newpasswd_len'];
/* shoutbox_max_msgs */
$name[] = 'shoutbox_max';
$value[] = (!is_numeric($_POST['shoutbox_limit'])) ? '50' : $_POST['shoutbox_limit'];
/* pm inbox max */
$name[] = 'pm_inbox_max';
$value[] = (!is_numeric($_POST['pm_inbox_max'])) ? '10' : $_POST['pm_inbox_max'];
/* pm sentbox max */
$name[] = 'pm_sentbox_max';
$value[] = (!is_numeric($_POST['pm_sentbox_max'])) ? '10' : $_POST['pm_sentbox_max'];
$count_o = count($name);
for($i=0;$i<$count_o;$i++)
{
$sql = "UPDATE `".CONFIG_TABLE."` SET `value`='".$value[$i]."' WHERE `name`='".$name[$i]."'";
DataBase::sql_query($sql, GENERAL, 'Could not update script config');
}
//end...
unset($name, $value, $count_o, $sql);
admin_message_forum($lng['forum_config_modernized'],'admin_script.php');
}
}
else
{
$ERROR='./template/blank.tpl';
}
//add skin variables
$skin = array(
'main_beam'=>$lng['scriptconfig'],
'L.submit'=>$lng['submit'],
'L.reset'=>$lng['reset'],
'L.general_preferences'=>$lng['general_preferences'],
'L.positioning'=>$lng['positioning_preferences'],
'L.other'=>$lng['other'],
'L.users'=>$lng['users_preferences'],
'L.forum_path'=>$lng['forum_path'],
'L.forum_path.D'=>$lng['t_forum_path'],
'forum_path'=>$forum_config['forumpatch'],
'L.forum_name'=>$lng['forum_name'],
'L.forum_desc'=>$lng['forum_description'],
'forum_desc'=>$forum_config['forumdesc'],
'forum_name'=>$forum_config['forumname'],
'L.forum_disabled'=>$lng['forum_disabled'],
'L.forum_disabled.D'=>$lng['t_forum_disabled'],
'forum_disabled'=>$forum_config['disable_forum'],
'L.default_skin'=>$lng['default_skin'],
'L2.default_skin'=>$lng['select_skin'],
'OPTIONS.default_skin'=>ListDir('../skins', $forum_config['defaultskin']),
'L.default_lang'=>$lng['default_lang'],
'L2.default_lang'=>$lng['select_lang'],
'OPTIONS.default_lang'=>ListDir('../lngs', $forum_config['defaultlang']),
'L.meta_keywords'=>$lng['meta_keywords'],
'meta_keywords'=>$forum_config['meta_keywords'],
'L.meta_description'=>$lng['meta_description'],
'meta_description'=>$forum_config['meta_description'],
'L.allow'=>$lng['allow'],
'L.time_generation'=>$lng['show_time_generation'],
'OPTION.time_generation'=>($forum_config['show_time_generation']) ? 'checked="checked"' : '',
'L.enable_censorlist'=>$lng['enable_censorlist'],
'OPTION.enable_censorlist'=>($forum_config['use_censorlist']) ? 'checked="checked"' : '',
'L.enable_warnings'=>$lng['warns_enabled'],
'OPTION.enable_warnings'=>($forum_config['allow_warns']) ? 'checked="checked"' : '',
'L.allow_ip_for_mods'=>$lng['allow_ip_for_mods'],
'OPTION.allow_ip_for_mods'=>($forum_config['ip_post_for_mod']) ? 'checked="checked"' : '',
'L.warnings_in_topic'=>$lng['warns_in_topic'],
'OPTION.warnings_in_topic'=>($forum_config['warns_in_topic']) ? 'checked="checked"' : '',
'L.enable_confirms'=>$lng['enable_confirms'],
'OPTION.enable_confirms'=>($forum_config['enable_confirms']) ? 'checked="checked"' : '',
'L.enable_send_email'=>$lng['enable_send_email'],
'OPTION.enable_send_email'=>($forum_config['allow_send_email']) ? 'checked="checked"' : '',
'L.allow_upload_avatars'=>$lng['allow_upload_avatars'],
'OPTION.allow_upload_avatars'=>($forum_config['allow_upload_avatars']) ? 'checked="checked"' : '',
'L.select_value'=>$lng['select_value'],
'L.limit_users'=>$lng['limit_users'],
'OPTIONS.limit_users'=>ListPages($forum_config['limit_users']),
'L.posts_in_topic'=>$lng['limit_posts'],
'L.scriptoptions'=>$lng['scriptconfig'],
'OPTIONS.limit_tpid'=>ListPages($forum_config['limit_tpid']),
'L.topics_in_forum'=>$lng['limit_topics'],
'OPTIONS.limit_ftid'=>ListPages($forum_config['limit_ftid']),
'L.admin_mod'=>$lng['admin_mod_preferences'],
'L.shoutbox'=>$lng['shoutbox_preferences'],
'L.allow_shoutbox'=>$lng['allow_shoutbox'],
'OPTION.allow_shoutbox'=>($forum_config['view_shoutbox']) ? 'checked="checked"' : '',
'L.shoutbox_max_time'=>$lng['shoutbox_time_clear'],
'OPTION.shoutbox_max_time'=>$forum_config['shoutbox_max_time'],
'L.shoutbox_limit'=>$lng['shoutbox_max_view'],
'OPTION.shoutbox_limit'=>$forum_config['shoutbox_max'],
/* pm sentbox max */
'L.pm_sentbox_max'=>$lng['pm_sentbox_max'],
'OPTION.pm_sentbox_max'=>$forum_config['pm_sentbox_max'],
/* pm inbox max */
'L.pm_inbox_max'=>$lng['pm_inbox_max'],
'OPTION.pm_inbox_max'=>$forum_config['pm_inbox_max'],
/* color mod */
'L.color_mod'=>$lng['color_mod'],
'OPTION.color_mod' => $forum_config['color_mod'],
/* color admin */
'L.color_admin'=>$lng['color_admin'],
'OPTION.color_admin' => $forum_config['color_admin'],
/* max avatar x */
'L.max_av_x'=>$lng['max_av_x'],
'OPTION.max_av_x' => $forum_config['max_av_x'],
/* max avatar y */
'L.max_av_y'=>$lng['max_av_y'],
'OPTION.max_av_y' => $forum_config['max_av_y'],
/* max avatar filesize */
'L.max_av_filesize'=>$lng['max_av_filesize'],
'OPTION.max_av_filesize' => ($forum_config['max_av_filesize'] / 1024),
/* signature len */
'L.sig_len'=>$lng['sig_len'],
'OPTION.sig_len' => $forum_config['sig_len'],
/* antiflood time */
'L.time_antiflood'=>$lng['time_antiflood'],
'OPTION.time_antiflood' => $forum_config['time_antiflood'],
/* tables width */
'L.tables_width'=>$lng['tables_width'],
'OPTION.tables_width' => $forum_config['tables_width'],
/* new password len */
'L.newpasswd_len'=>$lng['newpasswd_len'],
'OPTION.newpasswd_len' => $forum_config['newpasswd_len'],
/* sig len */
'L.sig_len'=>$lng['sig_len'],
'OPTION.sig_len'=>$forum_config['sig_len']
);
//do it!
Admin_Over::GenerateHeader();
include('./template/admin_script.tpl');
include('./template/overall_footer.tpl');
?>