<?php
|
|
/**
|
|
* @package uForum
|
|
* @file groups.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');
|
|
//connect to database
|
|
DataBase::db_connect();
|
|
include('./includes/sessions.php');
|
|
include('./includes/class_user.php');
|
|
include('./common.php');
|
|
include('./includes/class_overall.php');
|
|
include('./includes/class_topic.php');
|
|
include('./includes/classes/secure.php');
|
|
include('./lngs/'.Over::DefaultLang().'/main.php');
|
|
sess_del_invalid($_SESSION['uid']);
|
|
sess_register($_SESSION['uid']);
|
|
sess_delete_old();
|
|
$start = Over::TimeGeneration();
|
|
foreach ($_POST as $name => $value)
|
|
{
|
|
if ($forum_config['use_censorlist'])
|
|
{
|
|
$_POST[$name] = Secure::UseCensorlist($value);
|
|
}
|
|
}
|
|
if(isset($_GET['mode']))
|
|
{
|
|
switch($_GET['mode'])
|
|
{
|
|
case 'view':
|
|
{
|
|
$start = Over::TimeGeneration();
|
|
$default_skin = Over::ViewSkinName();
|
|
$gid = intval($_GET['id']);
|
|
if ((isset($_POST['nick']))and ($_POST['nick']!=''))
|
|
{
|
|
if($_POST['nick']!='')
|
|
{
|
|
$uid =User::UserIdByNick($_POST['nick']);
|
|
Secure::user_exists($uid);
|
|
User::AddToGroup($uid, $gid);
|
|
message_forum($lng['useraddedtogroup'],'groups.php?mode=view&id='.$gid);
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
}
|
|
elseif ((isset($_POST['delnick']))and ($_POST['delnick']!=''))
|
|
{
|
|
$uid =User::UserIdByNick($_POST['delnick']);
|
|
Secure::user_exists($uid);
|
|
User::DeleteFromGroup($uid, $gid);
|
|
message_forum($lng['userdeletedforgroup'],'groups.php?mode=view&id='.$gid);
|
|
}
|
|
else
|
|
{
|
|
$_POST['nick']='';
|
|
$_POST['delnick']='';
|
|
}
|
|
$sql = "SELECT `g_id`, `name`, `desc`, `m_id` FROM `".GROUPS_TABLE."` WHERE `g_id`='$gid'";
|
|
$group = mysql_fetch_array(DataBase::sql_query($sql, 'GENERAL', 'Could not obtain groups information.'));
|
|
if ($group['g_id']=='')
|
|
{
|
|
message_forum($lng['no_group'], 'index.php');
|
|
}
|
|
unset($tmp);
|
|
$skin = Over::generate_header($lng['showgroup'].': '.$group['name'], '</a>> <a href="groups.php?mode=view&id='.$group['g_id'].'" class="navigator">'.$lng['showgroup'].': '.$group['name']);
|
|
include('./skins/'.$default_skin.'/overall_header.tpl');
|
|
$skin = array(
|
|
'moderate'=>Over::IfModGroup($group['m_id']),
|
|
'name'=>$group['name'],
|
|
'desc'=>$group['desc'],
|
|
'lregdate'=>$lng['luregister'],
|
|
'llastvisit'=>$lng['lulastvisit'],
|
|
'lposts'=>$lng['posts'],
|
|
'luname'=>$lng['user_name'],
|
|
'g_id'=>$group['g_id']
|
|
);
|
|
include('./skins/'.$default_skin.'/group_view_head_body.tpl');
|
|
$sql = "SELECT ".USERS_GROUP_TABLE.".*, ".USERS_TABLE.".* FROM `".USERS_GROUP_TABLE."` LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id =".USERS_GROUP_TABLE.".u_id WHERE `g_id`='$gid'";
|
|
$query = DataBase::sql_query($sql, 'GENERAL', 'Could not obtain users in groups information.');
|
|
$amout = @mysql_num_rows($query);
|
|
if ($amout>0)
|
|
{
|
|
while($result = mysql_fetch_array($query))
|
|
{
|
|
$skin = array(
|
|
'id'=>$result['u_id'],
|
|
'uname'=>Topic::UserName($result['nick'], $result['rank']),
|
|
'regdate'=>date('d-m-Y, G:i',$result['regdate']),
|
|
'lastvisit'=>($result['lastvisit']>0) ? date('d-m-Y, G:i',$result['lastvisit']) : $lng['never'],
|
|
'posts'=>$result['posts']
|
|
);
|
|
include('./skins/'.$default_skin.'/users_item_add_body.tpl');
|
|
}
|
|
}
|
|
else
|
|
{
|
|
echo '<tr><td width="100%" colspan="8" height="19" class="fitem"><p class="fstandard" align="center">'.$lng['no_elements'].'!</p></td></tr>';
|
|
}
|
|
if ($_SESSION['uid']>0)
|
|
{
|
|
if(RANK=='2')
|
|
{
|
|
$skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
|
|
}
|
|
else
|
|
{
|
|
$skin['pa_link']='';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$skin['pa_link']='';
|
|
}
|
|
echo '</table>';
|
|
$stop = Over::TimeGeneration();
|
|
$skin['queries'] = Over::ShowQueries($start, $stop);
|
|
include('./skins/'.$default_skin.'/overall_footer.tpl');
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
message_forum($lng['invalidmode'],'groups.php');
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$default_skin = Over::ViewSkinName();
|
|
$skin = Over::generate_header($lng['lgroups'], '</a>> <a href="groups.php" class="navigator">'.$lng['lgroups']);
|
|
include('./skins/'.$default_skin.'/overall_header.tpl');
|
|
$sql = "SELECT `g_id`, `name`, `desc` FROM `".GROUPS_TABLE."` ORDER BY `sort`";
|
|
$query = DataBase::sql_query($sql, 'GENERAL', 'Could not obtain groups information.');
|
|
if (@mysql_num_rows($query)>0)
|
|
{
|
|
while($item = mysql_fetch_array($query))
|
|
{
|
|
$skin = array(
|
|
'g_id'=>$item['g_id'],
|
|
'name'=>$item['name'],
|
|
'desc'=>$item['desc']
|
|
);
|
|
include('./skins/'.$default_skin.'/group_add_body.tpl');
|
|
}
|
|
}
|
|
else
|
|
{
|
|
echo '<table class="maintable"><tr><td width="'.TABLES_WIDTH.'" colspan="8"
|
|
height="19" class="fitem"><p class="fstandard" align="center">'.$lng['no_groups'].'!</p></td></tr></table>';
|
|
}
|
|
if ($_SESSION['uid']>0)
|
|
{
|
|
if(RANK=='2')
|
|
{
|
|
$skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
|
|
}
|
|
else
|
|
{
|
|
$skin['pa_link']='';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$skin['pa_link']='';
|
|
}
|
|
$stop = Over::TimeGeneration();
|
|
$skin['queries'] = Over::ShowQueries($start, $stop);
|
|
include('./skins/'.$default_skin.'/overall_footer.tpl');
|
|
}
|
|
?>
|