<?php
|
|
/**
|
|
* @package uForum
|
|
* @file common.php
|
|
* @version $Id$
|
|
* @copyright 2009(c) PioDer <[email protected]>
|
|
* @link http://pioder.gim2przemysl.int.pl/
|
|
* @license GNU GPL v3
|
|
**/
|
|
|
|
if (is_dir('install'))
|
|
{
|
|
die('<font color="red" face="Verdana" size="6">Please delete or rename catalog "install"</font>');
|
|
}
|
|
|
|
//set global preferences from DataBase
|
|
$sql="SELECT * FROM ".CONFIG_TABLE."";
|
|
$query=DataBase::sql_query($sql,'CRITICAL','Could not obtain config information');
|
|
while($result=mysql_fetch_array($query))
|
|
{
|
|
if (($result['name']=='') or ($result['name']=='0'))
|
|
{
|
|
$forum_config['name']==false;
|
|
}
|
|
else
|
|
{
|
|
$forum_config[$result['name']] = $result['value'];
|
|
}
|
|
}
|
|
//check for disable forum
|
|
if ($_SESSION>0)
|
|
{
|
|
if (($forum_config['disable_forum']) and (User::UserInformation($_SESSION['uid'],'rank')<2))
|
|
{
|
|
die($forum_config['disable_forum']);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ($forum_config['disable_forum'])
|
|
{
|
|
die($forum_config['disable_forum']);
|
|
}
|
|
}
|
|
|
|
//check for banned user
|
|
if ($_SESSION['uid']>0)
|
|
{
|
|
$ip = $_SERVER['REMOTE_ADDR'];
|
|
$uid = $_SESSION['uid'];
|
|
$sql = "SELECT `IP`, `u_id`, `motive` FROM ".BANLIST_TABLE." WHERE `IP`='$ip' OR `u_id`='$uid'";
|
|
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain ban information'));
|
|
$motive = $result['motive'];
|
|
$db_ip = $result['IP'];
|
|
$db_uid = $result['u_id'];
|
|
if (($db_ip==$ip) || ($db_uid==$uid))
|
|
{
|
|
include('./includes/misc_functions.php');
|
|
include('./lngs/'.DefaultLang().'/main.php');
|
|
SessDelete($_SESSION['uid']);
|
|
$_SESSION['uid']='0';
|
|
message_forum($motive,'index.php', '10');
|
|
}
|
|
}
|
|
|
|
//set to variable userdata loged user informations
|
|
if ($_SESSION['uid']>0)
|
|
{
|
|
$sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`=".$_SESSION['uid']." LIMIT 1";
|
|
}
|
|
else
|
|
{
|
|
$sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='-1'";
|
|
}
|
|
$query = DataBase::sql_query($sql, 'GENERAL','Could not obtain loged user information');
|
|
$userdata = mysql_fetch_array($query);
|
|
define('RANK', $userdata['rank']);
|
|
|
|
define('TABLES_WIDTH',$forum_config['tables_width']);
|
|
//protect of database - add the backslashes
|
|
/*foreach ($_POST as $name => $value)
|
|
{
|
|
$_POST[$name] = mysql_real_escape_string($value);
|
|
}*/
|
|
?>
|