acl_get('a_auth')) ? $filename . $SID . '&mode=forum' : '';
$module['FORUM']['MODERATORS'] = ($auth->acl_get('a_authmods')) ? $filename . $SID . '&mode=mod' : '';
$module['FORUM']['SUPER_MODERATORS'] = ($auth->acl_get('a_authmods')) ? $filename . $SID . '&mode=supermod' : '';
$module['FORUM']['ADMINISTRATORS'] = ($auth->acl_get('a_authadmins')) ? $filename . $SID . '&mode=admin' : '';
$module['USER']['PERMISSIONS'] = ($auth->acl_get('a_authusers')) ? $filename . $SID . '&mode=user' : '';
$module['GROUP']['PERMISSIONS'] = ($auth->acl_get('a_authgroups')) ? $filename . $SID . '&mode=group' : '';
return;
}
define('IN_PHPBB', 1);
// Include files
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
// Grab and set some basic parameters
//
// 'mode' determines what we're altering; administrators, users, deps, etc.
// 'type' is used primarily for deps and contains the original 'mode'
$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
$type = (isset($_REQUEST['type'])) ? htmlspecialchars($_REQUEST['type']) : '';
$action = (isset($_REQUEST['action'])) ? htmlspecialchars($_REQUEST['action']) : '';
// Submitted setting data
//
// 'auth_settings' contains the submitted option settings assigned to options, should be an
// associative array
// 'auth_setting' contains the value of the submitted 'auth_option', an integer value used
// mainly by deps mode
// 'auth_option' contains a single auth_option string, used mainly by deps mode
$auth_settings = (isset($_POST['settings'])) ? $_POST['settings'] : array();
$auth_option = (isset($_REQUEST['option'])) ? htmlspecialchars($_REQUEST['option']) : '';
$auth_setting = (isset($_REQUEST['setting'])) ? intval($_REQUEST['setting']) : '';
// Forum, User or Group information
//
// 'ug_type' is either user or groups used mainly for forum/admin/mod permissions
// 'ug_data' contains the list of usernames, user_id's or group_ids for the 'ug_type'
// 'forum_id' contains the list of forums, 0 is used for "All forums", must be an array
$ug_type = (isset($_REQUEST['ug_type'])) ? htmlspecialchars($_REQUEST['ug_type']) : '';
$ug_data = (isset($_POST['ug_data'])) ? $_POST['ug_data'] : '';
$forum_id = (isset($_REQUEST['f'])) ? ((!is_array($_REQUEST['f'])) ? array(intval($_REQUEST['f'])) : array_filter($_REQUEST['f'], 'int')) : array(0);
$username = (isset($_REQUEST['username'])) ? $_REQUEST['username'] : '';
$group_id = (isset($_REQUEST['g'])) ? intval($_REQUEST['g']) : '';
// What mode are we running? So we can output the correct title, explanation
// and set the sql_option_mode/acl check
switch ($mode)
{
case 'forum':
$l_title = $user->lang['PERMISSIONS'];
$l_title_explain = $user->lang['PERMISSIONS_EXPLAIN'];
$which_acl = 'a_auth';
$sql_option_mode = 'f';
break;
case 'mod':
$l_title = $user->lang['MODERATORS'];
$l_title_explain = $user->lang['MODERATORS_EXPLAIN'];
$which_acl = 'a_authmods';
$sql_option_mode = 'm';
break;
case 'supermod':
$l_title = $user->lang['SUPER_MODERATORS'];
$l_title_explain = $user->lang['SUPER_MODERATORS_EXPLAIN'];
$which_acl = 'a_authmods';
$sql_option_mode = 'm';
break;
case 'admin':
$l_title = $user->lang['ADMINISTRATORS'];
$l_title_explain = $user->lang['ADMINISTRATORS_EXPLAIN'];
$which_acl = 'a_authadmins';
$sql_option_mode = 'a';
break;
case 'user':
$l_title = $user->lang['USER_PERMISSIONS'];
$l_title_explain = $user->lang['USER_PERMISSIONS_EXPLAIN'];
$which_acl = 'a_authusers';
$sql_option_mode = 'u';
break;
case 'group':
$l_title = $user->lang['GROUP_PERMISSIONS'];
$l_title_explain = $user->lang['GROUP_PERMISSIONS_EXPLAIN'];
$which_acl = 'a_authgroups';
$sql_option_mode = 'u';
break;
case 'deps':
$l_title = $user->lang['DEPENDENCIES'];
$l_title_explain = $user->lang['DEPENDENCIES_EXPLAIN'];
$which_acl = 'a_authdeps';
break;
}
// Permission check
if (!$auth->acl_get($which_acl))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Are we setting deps? If we are we need to re-run the mode match above for the
// relevant 'new' mode
if ($mode == 'deps')
{
switch ($type)
{
case 'mod':
case 'supermod':
$which_acl = 'a_authmods';
$sql_option_mode = 'm';
break;
case 'admin':
$which_acl = 'a_authadmins';
$sql_option_mode = 'a';
break;
}
// Permission check
if (!$auth->acl_get($which_acl))
{
trigger_error($user->lang['NO_ADMIN']);
}
}
//
//
// OUTPUT PAGE
//
//
page_header($l_title);
$auth_options = $auth_settings = array();
// Grab the list of options ... if we're in deps
// mode we want all options, else we skip the master
// options
$sql_founder = ($user->data['user_founder']) ? ' AND founder_only <> 1' : '';
$sql_limit_option = ($mode == 'deps') ? '' : "AND auth_option <> '" . $sql_option_mode . "_'";
$sql = "SELECT auth_option_id, auth_option
FROM " . ACL_OPTIONS_TABLE . "
WHERE auth_option LIKE '" . $sql_option_mode . "_%'
$sql_limit_option
$sql_founder";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$auth_options[] = $row;
}
$db->sql_freeresult($result);
unset($sql_limit_option);
// Now we'll build a list of preset options ...
$preset_options = $preset_js = $preset_update_options = '';
$holding = array();
// Do we have a parent forum? If so offer option to inherit from that
if ($forum_info['parent_id'] != 0)
{
switch ($ug_type)
{
case 'group':
$sql = "SELECT o.auth_option, a.auth_setting FROM " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_option LIKE '" . $sql_option_mode . "_%' AND a.auth_option_id = o.auth_option_id AND a.forum_id = " . $forum_info['parent_id'] . " AND a.group_id IN ($where_sql)";
break;
case 'user':
$sql = "SELECT o.auth_option, a.auth_setting FROM " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_option LIKE '" . $sql_option_mode . "_%' AND a.auth_option_id = o.auth_option_id AND a.forum_id = " . $forum_info['parent_id'] . " AND a.user_id IN ($where_sql)";
break;
}
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
do
{
switch ($row['auth_setting'])
{
case ACL_ALLOW:
$holding['allow'] .= $row['auth_option'] . ', ';
break;
case ACL_DENY:
$holding['deny'] .= $row['auth_option'] . ', ';
break;
case ACL_INHERIT:
$holding['inherit'] .= $row['auth_option'] . ', ';
break;
}
}
while ($row = $db->sql_fetchrow($result));
$preset_options .= '';
$preset_js .= "\tpresets['preset_0'] = new Array();" . "\n";
$preset_js .= "\tpresets['preset_0'] = new preset_obj('" . $holding['allow'] . "', '" . $holding['deny'] . "', '" . $holding['inherit'] . "');\n";
}
$db->sql_freeresult($result);
}
// Look for custom presets
$sql = "SELECT preset_id, preset_name, preset_data
FROM " . ACL_PRESETS_TABLE . "
WHERE preset_type = '$sql_option_mode'
ORDER BY preset_id ASC";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
do
{
$preset_update_options .= '';
$preset_options .= '';
$preset_data = unserialize($row['preset_data']);
foreach ($preset_data as $preset_type => $preset_type_ary)
{
$holding[$preset_type] = '';
foreach ($preset_type_ary as $preset_option)
{
$holding[$preset_type] .= "$preset_option, ";
}
}
$preset_js .= "\tpresets['preset_" . $row['preset_id'] . "'] = new Array();" . "\n";
$preset_js .= "\tpresets['preset_" . $row['preset_id'] . "'] = new preset_obj('" . $holding['allow'] . "', '" . $holding['deny'] . "', '" . $holding['inherit'] . "');\n";
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
unset($holding);
?>
lang['USERS']; ?> |
lang['GROUPS']; ?> |
|
|
|
|