<?php
|
|
/**
|
|
* @package uForum
|
|
* @file warns.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');
|
|
//connect to database
|
|
DataBase::db_connect();
|
|
include('./includes/sessions.php');
|
|
include('./includes/classes/class_user.php');
|
|
include('./common.php');
|
|
include('./includes/misc_functions.php');
|
|
include('./includes/classes/class_topic.php');
|
|
include('./includes/classes/class_posting.php');
|
|
include('./includes/classes/class_forum.php');
|
|
include('./includes/classes/secure.php');
|
|
include('./lngs/'.DefaultLang().'/main.php');
|
|
$start = TimeGeneration();
|
|
SessDelInvalid();
|
|
SessRegister();
|
|
SessDeleteOld();
|
|
foreach ($_POST as $name => $value)
|
|
{
|
|
if ($forum_config['use_censorlist'])
|
|
{
|
|
$_POST[$name] = Secure::UseCensorlist($value);
|
|
}
|
|
}
|
|
if (!$forum_config['allow_warns'])
|
|
{
|
|
message_forum($lng['warns_disabled'],'index.php');
|
|
}
|
|
|
|
$default_skin = ViewSkinName();
|
|
|
|
switch(trim($_GET['mode']))
|
|
{
|
|
case 'add':
|
|
{
|
|
$uid = intval($_GET['id']);
|
|
if (User::RankAdminMod($_SESSION['uid'])=='0')
|
|
{
|
|
message_forum($lng['is_no_mod'],'warns.php?mode=view&id='.$uid);
|
|
}
|
|
$msg ='./skins/'.$default_skin.'/blank.tpl';
|
|
if ((isset($_POST['textedit'])) and (isset($_POST['value'])))
|
|
{
|
|
if (($_POST['textedit'] !="" ) and (strlen($_POST['textedit'])>10))
|
|
{
|
|
if ((strpos($_POST['value'],'+')!==false) or (strpos($_POST['value'],'-')!==false))
|
|
{
|
|
if ($_POST['value'] == '+')
|
|
{
|
|
if (User::UserInformation($_GET['id'],'rank')>0)
|
|
{
|
|
message_forum($lng['cannot_add_warn_am'],'warns.php?mode=view&id='.$_GET['id']);
|
|
}
|
|
}
|
|
$_POST['textedit'] = Secure::TagsReplace($_POST['textedit']);
|
|
User::UserAddWarn($_GET['id'],$_POST['value'] ,addslashes(strip_tags($_POST['textedit'])));
|
|
$stop = TimeGeneration();
|
|
message_forum($lng['warn_is_added'],'warns.php?mode=view&id='.$_GET['id']);
|
|
}
|
|
else
|
|
{
|
|
$message = $lng['werror_1'];
|
|
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$message = $lng['perror_1'];
|
|
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$_POST['textedit']='';
|
|
$_POST['value']='';
|
|
}
|
|
$nick_name = User::UserInformation($_GET['id'],'nick');
|
|
if($nick_name=='')
|
|
{
|
|
message_forum($lng['no_user'],'index.php');
|
|
}
|
|
//add skin variables
|
|
$skin = array(
|
|
'f_id'=>$_GET['id'],
|
|
'smiles'=>Post::SmilesShow(),
|
|
'action'=>'warns.php?mode=add&id='.$_GET['id'],
|
|
//labels
|
|
'lsmiles'=>$lng['smiles'],
|
|
'lmsg'=>$lng['motive'],
|
|
'ladd'=>$lng['add'],
|
|
'ldelete'=>$lng['delete'],
|
|
'lsave'=>$lng['save'],
|
|
'lvalue'=>$lng['value'],
|
|
'lreset'=>$lng['reset'],
|
|
'lwarn'=>$lng['warn'],
|
|
'lall_warns'=>$lng['all_warns'],
|
|
'queries'=>ShowQueries($start, TimeGeneration())
|
|
);
|
|
$skin = array_push_assoc($skin, GenerateHeader($lng['add_warn'].': '.$nick_name,'</a>> <a href="warns.php?mode=add&id='.$uid.'" class="navigator">'.$lng['add_warn'].': '.$nick_name));
|
|
if(User::UserInformation($_SESSION['uid'],'rank')=='2')
|
|
{
|
|
$skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
|
|
}
|
|
else
|
|
{
|
|
$skin['pa_link']='';
|
|
}
|
|
include('./skins/'.$default_skin.'/overall_header.tpl');
|
|
include('./skins/'.$default_skin.'/warns_add_body.tpl');
|
|
include('./skins/'.$default_skin.'/overall_footer.tpl');
|
|
break;
|
|
}
|
|
case 'view':
|
|
{
|
|
$uid = $_GET['id'];
|
|
$sql = "SELECT `u_id`, `nick` FROM `".USERS_TABLE."` WHERE `u_id`='$uid'";
|
|
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain user information');
|
|
$user = DataBase::fetch($query);
|
|
if ($user['u_id']=='')
|
|
{
|
|
message_forum($lng['no_user'],'index.php');
|
|
}
|
|
//add skin variables
|
|
$skin = array(
|
|
'lvalue' => $lng['value'],
|
|
'lmotive' => $lng['motive']
|
|
);
|
|
$skin = array_push_assoc($skin, GenerateHeader($lng['show_warns'].': '.$user['nick'],'</a>> <a href="warns.php?mode=view&id='.$uid.'" class="navigator">'.$lng['show_warns'].': '.$user['nick']));
|
|
include('./skins/'.$default_skin.'/overall_header.tpl');
|
|
include('./skins/'.$default_skin.'/warns_view_body.tpl');
|
|
$sql = "SELECT * FROM `".WARNINGS_TABLE."` WHERE `u_id`='$uid'";
|
|
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain user warns information');
|
|
$result = DataBase::num_rows($query);
|
|
$warns_count = 0;
|
|
while($item = DataBase::fetch($query))
|
|
{
|
|
$skin = array(
|
|
'value'=>$item['value'],
|
|
'motive'=>$item['motive']
|
|
);
|
|
include('./skins/'.$default_skin.'/warns_view_item_body.tpl');
|
|
$warns_count = ($item['value']=='+') ? $warns_count + 1 : $warns_count -1;
|
|
}
|
|
$stop = TimeGeneration();
|
|
$skin = array(
|
|
'lall_warns'=>$lng['all_warns'],
|
|
'all_warns'=>($warns_count>0) ? '<span class="fstandard" style="color: "red"><b>'.($warns_count*10).'%</b></span>' : '<span class="fstandard" style="color: green"><b>'.$warns_count.'%</b></span>',
|
|
'queries'=>ShowQueries($start, $stop)
|
|
);
|
|
$user_rank = ($_SESSION['uid']>0) ? RANK : 0;
|
|
if ($user_rank>0)
|
|
{
|
|
$skin['add']='<td width="128"><a href="warns.php?mode=add&id='.$uid.'" class="fstandard"><b><u>'.$lng['add_warn'].'</u></b></a></td>';
|
|
}
|
|
else
|
|
{
|
|
$skin['add']='';
|
|
}
|
|
if ($result>0)
|
|
{
|
|
$skin['no_elements']='';
|
|
}
|
|
else
|
|
{
|
|
$skin['no_elements']='<tr><td width="748" colspan="2" class="fitem"><p class="fstandard" align="center">'.$lng['no_elements'].'!</p></td></tr>';
|
|
}
|
|
include('./skins/'.$default_skin.'/warns_view_end_body.tpl');
|
|
include('./skins/'.$default_skin.'/overall_footer.tpl');
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
$stop = TimeGeneration();
|
|
message_forum($lng['invalidmode'],'index.php');
|
|
break;
|
|
}
|
|
}
|
|
?>
|