📄 ad_groups.php
字号:
<?php
class ad_groups
{
var $base_url;
function ad_groups( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
}
switch ( $IN['code'] )
{
case "doadd" :
$this->save_group( "add" );
break;
case "add" :
$this->group_form( "add" );
break;
case "edit" :
$this->group_form( "edit" );
break;
case "doedit" :
$this->save_group( "edit" );
break;
case "delete" :
$this->delete_form( );
break;
case "dodelete" :
$this->do_delete( );
break;
case "fedit" :
$this->forum_perms( );
break;
case "dofedit" :
$this->do_forum_perms( );
break;
default :
$this->main_screen( );
break;
}
}
function forum_perms( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
if ( $IN['id'] == "" )
{
$ADMIN->error( "无法找到用户团队ID,请检查后重试!" );
}
$ADMIN->page_title = "用户团队论坛栏目权限设置";
$ADMIN->page_detail = "你可以在下面快速的设置用户团队在论坛栏目的权限,如果你需要修改用户团队,请返回[用户团队管理]选项。<br><br>你只需要在下面的选择表框中选择或取消相关权限设置。<br><b>全局设置</b> 指所有的用户团队都拥有此权限。你可以在[用户团队管理]中进行设置和修改。";
$DB->query( "SELECT g_title, g_id FROM ibf_groups WHERE g_id='".$IN['id']."'" );
$group = $DB->fetch_row( );
$gid = $group['g_id'];
$cats = array( );
$forums = array( );
$children = array( );
$DB->query( "SELECT * from ibf_categories WHERE id > 0 ORDER BY position ASC" );
while ( $r = $DB->fetch_row( ) )
{
$cats[$r['id']] = $r;
}
$DB->query( "SELECT * from ibf_forums ORDER BY position ASC" );
while ( $r = $DB->fetch_row( ) )
{
if ( 0 < $r['parent_id'] )
{
$children[$r['parent_id']][] = $r;
}
else
{
$forums[] = $r;
}
}
$ADMIN->html .= $SKIN->start_form( array(
1 => array( "code", "dofedit" ),
2 => array( "act", "group" ),
3 => array(
"id",
$gid
)
) );
$SKIN->td_header[] = array( "论坛栏目名称", "20%" );
$SKIN->td_header[] = array( "回复", "10%" );
$SKIN->td_header[] = array( "主题", "10%" );
$SKIN->td_header[] = array( "发表主题", "15%" );
$SKIN->td_header[] = array( "回复主题", "15%" );
$SKIN->td_header[] = array( "查看主题", "15%" );
$SKIN->td_header[] = array( "上传文件", "15%" );
$ADMIN->html .= $SKIN->start_table( "论坛栏目权限设置:".$group['g_title'] );
$last_cat_id = -1;
foreach ( $cats as $c )
{
$ADMIN->html .= $SKIN->add_td_basic( $c['name'], "center", "catrow" );
$last_cat_id = $c['id'];
foreach ( $forums as $r )
{
if ( $r['category'] == $last_cat_id )
{
$read = "";
$start = "";
$reply = "";
$upload = "";
$global = "<center>全局设置</center>";
if ( $r['read_perms'] == "*" )
{
$read = $global;
}
else if ( preg_match( "/(^|,)".$gid."(,|\$)/", $r['read_perms'] ) )
{
$read = "<center><input type='checkbox' name='read_".$r['id']."' value='1' checked></center>";
}
else
{
$read = "<center><input type='checkbox' name='read_".$r['id']."' value='1'></center>";
}
if ( $r['start_perms'] == "*" )
{
$start = $global;
}
else if ( preg_match( "/(^|,)".$gid."(,|\$)/", $r['start_perms'] ) )
{
$start = "<center><input type='checkbox' name='start_".$r['id']."' value='1' checked></center>";
}
else
{
$start = "<center><input type='checkbox' name='start_".$r['id']."' value='1'></center>";
}
if ( $r['reply_perms'] == "*" )
{
$reply = $global;
}
else if ( preg_match( "/(^|,)".$gid."(,|\$)/", $r['reply_perms'] ) )
{
$reply = "<center><input type='checkbox' name='reply_".$r['id']."' value='1' checked></center>";
}
else
{
$reply = "<center><input type='checkbox' name='reply_".$r['id']."' value='1'></center>";
}
if ( $r['upload_perms'] == "*" )
{
$upload = $global;
}
else if ( preg_match( "/(^|,)".$gid."(,|\$)/", $r['upload_perms'] ) )
{
$upload = "<center><input type='checkbox' name='upload_".$r['id']."' value='1' checked></center>";
}
else
{
$upload = "<center><input type='checkbox' name='upload_".$r['id']."' value='1'></center>";
}
if ( $r['subwrap'] == 1 && $r['sub_can_post'] != 1 )
{
$ADMIN->html .= $SKIN->add_td_basic( "> ".$r['name'], "left", "catrow2" );
}
else
{
$css = $r['subwrap'] == 1 ? "catrow2" : "";
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>".$r['name']."</b><br>".$r['description'],
"<center>".$r['posts']."</center>",
"<center>".$r['topics']."</center>",
$start,
$reply,
$read,
$upload
), $css );
}
if ( isset( $children[$r['id']] ) && 0 < count( $children[$r['id']] ) )
{
foreach ( $children[$r['id']] as $idx => $rd )
{
$read = "";
$start = "";
$reply = "";
$upload = "";
$global = "<center>全局设置</center>";
if ( $rd['read_perms'] == "*" )
{
$read = $global;
}
else if ( preg_match( "/(^|,)".$gid."(,|\$)/", $rd['read_perms'] ) )
{
$read = "<center><input type='checkbox' name='read_".$rd['id']."' value='1' checked></center>";
}
else
{
$read = "<center><input type='checkbox' name='read_".$rd['id']."' value='1'></center>";
}
if ( $rd['start_perms'] == "*" )
{
$start = $global;
}
else if ( preg_match( "/(^|,)".$gid."(,|\$)/", $rd['start_perms'] ) )
{
$start = "<center><input type='checkbox' name='start_".$rd['id']."' value='1' checked></center>";
}
else
{
$start = "<center><input type='checkbox' name='start_".$rd['id']."' value='1'></center>";
}
if ( $rd['reply_perms'] == "*" )
{
$reply = $global;
}
else if ( preg_match( "/(^|,)".$gid."(,|\$)/", $rd['reply_perms'] ) )
{
$reply = "<center><input type='checkbox' name='reply_".$rd['id']."' value='1' checked></center>";
}
else
{
$reply = "<center><input type='checkbox' name='reply_".$rd['id']."' value='1'></center>";
}
if ( $rd['upload_perms'] == "*" )
{
$upload = $global;
}
else if ( preg_match( "/(^|,)".$gid."(,|\$)/", $rd['upload_perms'] ) )
{
$upload = "<center><input type='checkbox' name='upload_".$rd['id']."' value='1' checked></center>";
}
else
{
$upload = "<center><input type='checkbox' name='upload_".$rd['id']."' value='1'></center>";
}
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>".$rd['name']."</b><br>".$rd['description'],
"<center>".$rd['posts']."</center>",
"<center>".$rd['topics']."</center>",
$start,
$reply,
$read,
$upload
), "subforum" );
}
}
}
}
}
$ADMIN->html .= $SKIN->end_form( "更新论坛栏目权限设置" );
$ADMIN->html .= $SKIN->end_table( );
$ADMIN->output( );
}
function do_forum_perms( )
{
global $IN;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
if ( $IN['id'] == "" )
{
$ADMIN->error( "无法找到用户团队ID,请检查后重试!" );
}
$gid = $IN['id'];
$DB->query( "SELECT g_id, g_title FROM ibf_groups WHERE g_id='".$IN['id']."'" );
if ( !( $gr = $DB->fetch_row( ) ) )
{
$ADMIN->error( "不是有效的用户团队ID" );
}
$forum_q = $DB->query( "SELECT id, read_perms, start_perms, reply_perms, upload_perms FROM ibf_forums ORDER BY position ASC" );
while ( $row = $DB->fetch_row( $forum_q ) )
{
$read = "";
$reply = "";
$start = "";
$upload = "";
if ( $row['read_perms'] == "*" )
{
$read = "*";
}
else
{
$read_ids = explode( ",", $row['read_perms'] );
if ( is_array( $read_ids ) )
{
foreach ( $read_ids as $i )
{
if ( $gid == $i )
{
}
else
{
$read .= $i.",";
}
}
}
if ( $IN["read_".$row['id']] == 1 )
{
$read .= $gid.",";
}
$read = preg_replace( "/,\$/", "", $read );
$read = preg_replace( "/^,/", "", $read );
}
if ( $row['reply_perms'] == "*" )
{
$reply = "*";
}
else
{
$reply_ids = explode( ",", $row['reply_perms'] );
if ( is_array( $reply_ids ) )
{
foreach ( $reply_ids as $i )
{
if ( $gid == $i )
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -