📄 groups.php
字号:
<?php
//******************************************************//
// ///////// //// /////
// // // // // //
// // ///// ////// //// ////
// // // //// // // // //
// ///////// ///// ////// ///// /////
//******************************************************//
// icebb.net // 1.0
//******************************************************//
// group admin module
// $Id: groups.php 267 2005-07-29 15:03:12Z mutantmonkey $
//******************************************************//
class groups
{
function run()
{
global $icebb,$config,$db,$std;
$this->lang = $icebb->admin->learn_language('global');
$this->html = $icebb->admin_skin->load_template('global');
$icebb->admin->page_title = "Manage Groups";
switch($icebb->input['func'])
{
case 'new':
$this->new_group();
break;
case 'edit':
$this->edit();
break;
case 'del':
$this->delete();
// NICHT DA!
// Warum schreibst deutsch MutantMonkey?
// Ich weiss nicht :P
break;
case 'permgroups':
$this->permgroups();
break;
case 'ranks':
$this->ranks();
break;
default:
$this->show_list();
break;
}
$icebb->admin->html = $this->html->header().$icebb->admin->html.$this->html->footer();
$icebb->admin->output();
}
function show_list()
{
global $icebb,$config,$db,$std;
$icebb->admin_skin->table_titles[] = array("{none}",'60%');
$icebb->admin_skin->table_titles[] = array("{none}",'40%');
$icebb->admin->html.= $icebb->admin_skin->start_table("Groups");
$tforum = $db->query("SELECT * FROM icebb_groups");
while($r = $db->fetch_row($tforum))
{
if(in_array($r['gid'],array(3,4))) // don't show "Guests" and "Validating members". By request of David
{
continue;
}
$thisrow = array();
$thisrow[0] = "<b>{$r['g_prefix']}{$r['g_title']}{$r['g_suffix']}</b>";
$thisrow[1] = "<div style='text-align:right'><a href='{$icebb->base_url}act=groups&func=edit&gid={$r['gid']}'>Edit</a>";
$thisrow[1] .= $r['gid'] > 5 ? " · <a href='{$icebb->base_url}act=groups&func=del&gid={$r['gid']}'>Remove</a></div>" : "</div>"; // Hiding the delete link for the default groups
$icebb->admin->html.= $icebb->admin_skin->table_row($thisrow);
}
$icebb->admin->html.= $icebb->admin_skin->end_table();
$icebb->admin->html .= "<div class='buttonrow'><input type='button' value='New Group' onclick=\"window.location='{$icebb->base_url}act=groups&func=new'\" class='button' /></div></form>";
}
function show_search_results()
{
global $icebb,$config,$db,$std;
if($icebb->input['search_how']=='sw')
{
$where = " LIKE '{$icebb->input['username']}%'";
$wheretype_english = "%d users have usernames that start with %s";
}
else if($icebb->input['search_how']=='ew')
{
$where = " LIKE '%{$icebb->input['username']}'";
$wheretype_english = "%d users have usernames that end with %s";
}
else if($icebb->input['search_how']=='co')
{
$where = " LIKE '%{$icebb->input['username']}%'";
$wheretype_english = "%d users have usernames that contain with %s";
}
else if($icebb->input['search_how']=='is')
{
$where = "='{$icebb->input['username']}'";
$wheretype_english = "%d users have usernames that are %s";
}
$db->query("SELECT COUNT(*) as count FROM icebb_users WHERE username{$where}");
$count = $db->fetch_row();
$db->query("SELECT u.*,g.g_title FROM icebb_users AS u LEFT JOIN icebb_groups AS g ON u.user_group=g.gid WHERE username{$where}");
while($u = $db->fetch_row())
{
$thisrow[] = "<div style='text-align:center'><a href='{$icebb->base_url}act=users&func=edit&uid={$u['id']}&search_how={$icebb->input['search_how']}&searchq={$icebb->input['username']}'><img src='{$u['avatar']}' border='0' alt='' width='64' height='64' /><br />{$u['username']}</a><br /><span style='font-size:70%'>{$u['title']}</span></div>";
$ucount++;
if($ucount==4 || $ucount==$count['count'])
{
$result_html .= $icebb->admin_skin->table_row($thisrow,'col1'," valign='top'");
$thisrow = array();
$ucount=0;
}
}
$icebb->admin_skin->table_titles[] = array("{none}",'25%');
$icebb->admin_skin->table_titles[] = array("{none}",'25%');
$icebb->admin_skin->table_titles[] = array("{none}",'25%');
$icebb->admin_skin->table_titles[] = array("{none}",'25%');
$icebb->admin->html .= $icebb->admin_skin->start_table(sprintf($wheretype_english,$count['count'],$icebb->input['username']));
$icebb->admin->html .= $result_html;
$icebb->admin->html .= $icebb->admin_skin->end_table();
}
function edit()
{
global $icebb,$config,$db,$std;
if(isset($icebb->input['submit']))
{
if(!get_magic_quotes_gpc())
{
$icebb->input['suffix'] = addslashes($icebb->input['suffix']);
$icebb->input['prefix'] = addslashes($icebb->input['prefix']);
}
$icebb->input['suffix'] = html_entity_decode($icebb->input['suffix'],ENT_QUOTES);
$icebb->input['prefix'] = html_entity_decode($icebb->input['prefix'],ENT_QUOTES);
$icebb->input['suffix'] = $db->escape_string($icebb->input['suffix']);
$icebb->input['prefix'] = $db->escape_string($icebb->input['prefix']);
$icebb->input['flood_control'] = intval($icebb->input['flood_control']);
if(is_array($icebb->input['permgroup']))
{
foreach($icebb->input['permgroup'] as $pg)
{
$permgroups_a[] = $pg;
}
$permgroups = implode($permgroups_a);
}
else {
$permgroups = $icebb->input['permgroup'];
}
//$db->query("UPDATE icebb_groups SET g_flood_control='{$icebb->input['flood_control']}',g_suffix='{$icebb->input['suffix']}',g_prefix='{$icebb->input['prefix']}',g_status='{$icebb->input['status']}',g_mods='{$icebb->input['mods']}',g_icon='{$icebb->input['icon']}',g_desc='{$icebb->input['desc']}',g_title='{$icebb->input['title']}',g_view_board='{$icebb->input['view_board']}',g_is_mod='{$icebb->input['is_mod']}',g_post_in_locked='{$icebb->input['post_in_locked']}',g_is_admin='{$icebb->input['is_admin']}',g_view_offline_board='{$icebb->input['view_offline_board']}',g_permgroup='{$permgroups}',g_promote_group='{$icebb->input['promote_group']}',g_promote_posts='{$icebb->input['promote_posts']}' WHERE gid='{$icebb->input['gid']}' LIMIT 1");
$db->query("UPDATE icebb_groups SET g_flood_control='{$icebb->input['flood_control']}',g_suffix='{$icebb->input['suffix']}',g_prefix='{$icebb->input['prefix']}',g_icon='{$icebb->input['icon']}',g_title='{$icebb->input['title']}',g_view_board='{$icebb->input['view_board']}',g_is_mod='{$icebb->input['is_mod']}',g_post_in_locked='{$icebb->input['post_in_locked']}',g_is_admin='{$icebb->input['is_admin']}',g_view_offline_board='{$icebb->input['view_offline_board']}',g_permgroup='{$permgroups}',g_promote_group='{$icebb->input['promote_group']}',g_promote_posts='{$icebb->input['promote_posts']}' WHERE gid='{$icebb->input['gid']}' LIMIT 1");
// recache groups
$db->query("SELECT * FROM icebb_groups");
while($g = $db->fetch_row())
{
foreach($g as $gkey => $gval)
{
$g[$gkey] = wash_key(str_replace("&","&",$gval));
}
$groups[] = $g;
}
$std->recache($groups,'groups');
$icebb->admin->redirect("Group edited",$icebb->base_url."act=groups");
}
$db->query("SELECT * FROM icebb_forum_permgroups");
while($pg = $db->fetch_row())
{
$permgroups[] = array($pg['permid'],$pg['permname']);
}
$db->query("SELECT * FROM icebb_groups WHERE gid='{$icebb->input['gid']}' LIMIT 1");
$g = $db->fetch_row();
$icebb->admin->page_title = "Edit Group";
$status1['1'] = 'Open';
$status1['2'] = 'Closed';
$status1['3'] = 'Hidden';
foreach($status1 as $k => $v)
{
$status[] = array($k,$v);
}
$g['suffix'] = html_entity_decode($g['suffix'],ENT_QUOTES);
$g['prefix'] = html_entity_decode($g['prefix'],ENT_QUOTES);
$icebb->admin_skin->table_titles= array(array('{none}','40%'),array('{none}','60%'));
$icebb->admin->html = $icebb->admin_skin->start_form('admin.php',array('s'=>$icebb->adsess['sessid'],'act'=>'groups','func'=>'edit','gid'=>$icebb->input['gid'],'submit'=>'1'),'post'," name='adminfrm'");
if($g['gid']=='1')
{
$icebb->admin->html .= $icebb->admin_skin->start_table("Notice");
$icebb->admin->html .= $icebb->admin_skin->table_row(array("You are editing the main administrator group. Some options will not be available."),'row1',' colspan="2"');
$icebb->admin->html .= $icebb->admin_skin->end_table();
}
$icebb->admin->html .= $icebb->admin_skin->start_table("Edit {$g['g_title']}");
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Group Title</b>",$icebb->admin_skin->form_input('title',$g['g_title'])));
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Permission Group</b>",$icebb->admin_skin->form_multiselect('permgroup',$permgroups,$g['g_permgroup'],6)));
/*$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Description</b>",$icebb->admin_skin->form_textarea('desc',$g['g_desc'])));
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Status</b>",$icebb->admin_skin->form_dropdown('status',$status,$g['g_status'])));*/
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Prefix</b>",$icebb->admin_skin->form_input('prefix',$g['g_prefix'])));
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Suffix</b>",$icebb->admin_skin->form_input('suffix',$g['g_suffix'])));
//$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Group mods</b><br /><small>(Seperate IDs with a comma)</small>",$icebb->admin_skin->form_input('mods',$g['g_mods'])));
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Team Icon</b><small>(Filename of image in /skins/##/icons/)</small>",$icebb->admin_skin->form_input('icon',$g['g_icon'])));
$icebb->admin->html .= $icebb->admin_skin->end_table();
$icebb->admin->html .= $icebb->admin_skin->start_table("Permissions");
if($g['gid']=='1')
{
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>View Board?</b>", $icebb->admin_skin->form_yes_no('view_board',1,null,' disabled="disabled"')));
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Is Global Moderator?</b>", $icebb->admin_skin->form_yes_no('is_mod',1,null,' disabled="disabled"')));
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Allow replies in locked topics?</b>", $icebb->admin_skin->form_yes_no('post_in_locked',1,null,' disabled="disabled"')));
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Is Administrator?</b>", $icebb->admin_skin->form_yes_no('is_admin',1,null,' disabled="disabled"')));
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>View Offline Board?</b>", $icebb->admin_skin->form_yes_no('view_offline_board',1,null,' disabled="disabled"')));
}
else {
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>View Board?</b>", $icebb->admin_skin->form_yes_no('view_board',$g['g_view_board'])));
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Is Global Moderator?</b>", $icebb->admin_skin->form_yes_no('is_mod',$g['g_is_mod'])));
$icebb->admin->html .= $icebb->admin_skin->table_row(array("<b>Allow replies in locked topics?</b>", $icebb->admin_skin->form_yes_no('post_in_locked',$g['g_post_in_locked'])));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -