* @link http://www.pioder.pl/ * @license see LICENSE.txt **/ define('IN_uF', true); //include files require('./config.php'); require('./includes/constants.php'); require('./includes/db.php'); require('./includes/errors.php'); //connect to database DataBase::db_connect(); require('./includes/sessions.php'); require('./includes/classes/class_user.php'); require('./common.php'); require('./includes/misc_functions.php'); require('./includes/classes/class_topic.php'); require('./includes/classes/secure.php'); require('./lngs/'.DefaultLang().'/main.php'); SessDelInvalid(); SessRegister(); SessDeleteOld(); $start = 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 = TimeGeneration(); $default_skin = ViewSkinName(); $gid = addslashes(strip_tags($_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']=''; } $bool = ($gid == 'mods') ? true : ($gid == 'admins') ? true : false; if (!$bool) { $sql = "SELECT `g_id`, `name`, `desc`, `m_id` FROM `".GROUPS_TABLE."` WHERE `g_id`='$gid'"; $group = DataBase::fetch(DataBase::sql_query($sql, GENERAL, 'Could not obtain groups information.')); if ($group['g_id']=='') { message_forum($lng['no_group'], 'groups.php'); } } if ($gid == 'admins') { $group['name'] = $lng['admins']; $group['desc'] = $lng['admins_desc']; } if ($gid == 'mods') { $group['name'] = $lng['mods']; $group['desc'] = $lng['mods_desc']; } unset($tmp); $skin = GenerateHeader($lng['showgroup'].': '.$group['name'], ''.$lng['lgroups'].' » '.$group['name']); require('./skins/'.$default_skin.'/overall_header.tpl'); $skin = array( 'moderate'=>(is_numeric($gid)) ? 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'] ); require('./skins/'.$default_skin.'/group_view_head_body.tpl'); if ($gid == 'admins') { $rnk = 2; } else {$rnk = 1;} if (is_numeric($gid)) { $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'"; } else { $sql = "SELECT * FROM ".USERS_TABLE." WHERE `rank` = '$rnk'"; } $query = DataBase::sql_query($sql, GENERAL, 'Could not obtain users in groups information.'); $amout = DataBase::num_rows($query); if ($amout>0) { while($result = DataBase::fetch($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'] ); require('./skins/'.$default_skin.'/users_item_add_body.tpl'); } } else { echo '

'.$lng['no_elements'].'!

'; } echo ''; $stop = TimeGeneration(); $skin['queries'] = ShowQueries($start, $stop); require('./skins/'.$default_skin.'/overall_footer.tpl'); break; } default: { message_forum($lng['invalidmode'],'groups.php'); } } } else { $default_skin = ViewSkinName(); $skin = GenerateHeader($lng['lgroups'], '
'.$lng['lgroups']); require('./skins/'.$default_skin.'/overall_header.tpl'); $special_groups[] = array('admins', $lng['admins'], $lng['admins_desc']); $special_groups[] = array('mods', $lng['mods'], $lng['mods_desc']); $i = 0; while($i<2) { $color = ($i==0) ? $forum_config['color_admin'] : $forum_config['color_mod']; $skin = array ( 'g_id'=>$special_groups[$i][0], 'name' => ''.$special_groups[$i][1].'', 'desc' =>$special_groups[$i][2] ); require('./skins/'.$default_skin.'/group_add_body.tpl'); $i++; } echo '
'; $sql = "SELECT `g_id`, `name`, `desc` FROM `".GROUPS_TABLE."` ORDER BY `sort`"; $query = DataBase::sql_query($sql, GENERAL, 'Could not obtain groups information.'); if (DataBase::num_rows($query)>0) { while($item = DataBase::fetch($query)) { $skin = array( 'g_id'=>$item['g_id'], 'name'=>$item['name'], 'desc'=>$item['desc'] ); require('./skins/'.$default_skin.'/group_add_body.tpl'); } } else { echo '

'.$lng['no_groups'].'!

'; } $stop = TimeGeneration(); $skin['queries'] = ShowQueries($start, $stop); require('./skins/'.$default_skin.'/overall_footer.tpl'); } ?>