get_acl_admin('auth') )
{
return;
}
$filename = basename(__FILE__);
$module['Forums']['Permissions'] = $filename . $SID . '&mode=forums';
$module['Forums']['Moderators'] = $filename . $SID . '&mode=moderators';
$module['General']['Administrators'] = $filename . $SID . '&mode=administrators';
return;
}
define('IN_PHPBB', 1);
//
// Include files
//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
//
// Do we have forum admin permissions?
//
if ( !$acl->get_acl_admin('auth') )
{
message_die(MESSAGE, $lang['No_admin']);
}
//
// Define some vars
//
if ( isset($HTTP_GET_VARS['f']) || isset($HTTP_POST_VARS['f']) )
{
$forum_id = ( isset($HTTP_POST_VARS['f']) ) ? intval($HTTP_POST_VARS['f']) : intval($HTTP_GET_VARS['f']);
$forum_sql = " WHERE forum_id = $forum_id";
}
else
{
unset($forum_id);
$forum_sql = '';
}
$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
//
// Start program proper
//
switch ( $mode )
{
case 'forums':
$l_title = $lang['Permissions'];
$l_title_explain = $lang['Permissions_explain'];
$l_can = '_can';
break;
case 'moderators':
$l_title = $lang['Moderators'];
$l_title_explain = $lang['Moderators_explain'];
$l_can = '_can';
break;
case 'administrators':
$l_title = $lang['Administrators'];
$l_title_explain = $lang['Administrators_explain'];
$l_can = '_can_admin';
break;
}
//
// Get required information, either all forums if
// no id was specified or just the requsted if it
// was
//
if ( !empty($forum_id) || $mode == 'administrators' )
{
//
// Clear some vars, grab some info if relevant ...
//
$s_hidden_fields = '';
if ( !empty($forum_id) )
{
$sql = "SELECT forum_name
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
$result = $db->sql_query($sql);
$forum_info = $db->sql_fetchrow($result);
$l_title .= ' : ' . $forum_info['forum_name'] . '';
}
//
// Generate header
//
page_header($l_title);
?>
sql_query($sql);
$group_list = '';
while ( $row = $db->sql_fetchrow($result) )
{
$group_list .= '';
}
$db->sql_freeresult($result);
if ( empty($HTTP_POST_VARS['advanced']) || empty($HTTP_POST_VARS['entries']) )
{
?>
sql_query($sql);
$auth_options = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_options[] = $row;
}
$db->sql_freeresult($result);
if ( $HTTP_POST_VARS['type'] == 'user' && !empty($HTTP_POST_VARS['new']) )
{
$HTTP_POST_VARS['entries'] = explode("\n", $HTTP_POST_VARS['entries']);
}
$where_sql = '';
foreach ( $HTTP_POST_VARS['entries'] as $value )
{
$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . ( ( $HTTP_POST_VARS['type'] == 'user' && !empty($HTTP_POST_VARS['new']) ) ? '\'' . $value . '\'' : intval($value) );
}
switch ( $HTTP_POST_VARS['type'] )
{
case 'group':
$l_type = 'Group';
$sql = ( empty($HTTP_POST_VARS['new']) ) ? "SELECT g.group_id AS id, g.group_name AS name, o.auth_option, a.auth_allow_deny FROM " . GROUPS_TABLE . " g, " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_type LIKE '$type_sql' AND a.auth_option_id = o.auth_option_id $forum_sql AND g.group_id = a.group_id AND g.group_id IN ($where_sql) ORDER BY g.group_name ASC" : "SELECT group_id AS id, group_name AS name FROM " . GROUPS_TABLE . " WHERE group_id IN ($where_sql) ORDER BY group_name ASC";
break;
case 'user':
$l_type = 'User';
$sql = ( empty($HTTP_POST_VARS['new']) ) ? "SELECT u.user_id AS id, u.username AS name, o.auth_option, a.auth_allow_deny FROM " . USERS_TABLE . " u, " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_type LIKE '$type_sql' AND a.auth_option_id = o.auth_option_id $forum_sql AND u.user_id = a.user_id AND u.user_id IN ($where_sql) ORDER BY u.username, u.user_regdate ASC" : "SELECT user_id AS id, username AS name FROM " . USERS_TABLE . " WHERE username IN ($where_sql) ORDER BY username, user_regdate ASC";
break;
}
$result = $db->sql_query($sql);
$ug = '';;
$ug_hidden = '';
$auth = array();
while ( $row = $db->sql_fetchrow($result) )
{
$ug_test = ( $row['name'] == 'ADMINISTRATORS' ) ? $lang['Admin_group'] : $row['name'];
$ug .= ( !strstr($ug, $ug_test) ) ? $ug_test . "\n" : '';
$ug_test = '';
$ug_hidden = ( !strstr($ug_hidden, $ug_test) ) ? $ug_test : '';
$auth[$row['auth_option']] = ( isset($auth_group[$row['auth_option']]) ) ? min($auth_group[$row['auth_option']], $row['auth_allow_deny']) : $row['auth_allow_deny'];
}
$db->sql_freeresult($result);
?>
sql_query($sql);
$select_list = '';
while ( $row = $db->sql_fetchrow($result) )
{
$select_list .= '';
}
$db->sql_freeresult($result);
page_header($l_title);
?>