acl_get('a_auth')) ? $filename . $SID . '&mode=forums' : ''; $module['Forums']['MODERATORS'] = ($auth->acl_get('a_authmods')) ? $filename . $SID . '&mode=moderators' : ''; $module['Forums']['SUPER_MODERATORS'] = ($auth->acl_get('a_authmods')) ? $filename . $SID . '&mode=supermoderators' : ''; $module['General']['ADMINISTRATORS'] = ($auth->acl_get('a_authadmins')) ? $filename . $SID . '&mode=administrators' : ''; return; } define('IN_PHPBB', 1); // Include files $phpbb_root_path = '../'; require($phpbb_root_path . 'extension.inc'); require('pagestart.' . $phpEx); require($phpbb_root_path . 'includes/functions_admin.'.$phpEx); // Define some vars if (isset($_REQUEST['f'])) { $forum_id = intval($_REQUEST['f']); $forum_sql = " WHERE forum_id = $forum_id"; } else { $forum_id = 0; $forum_sql = ''; } $mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : ''; // Start program proper switch ($mode) { case 'forums': $l_title = $user->lang['PERMISSIONS']; $l_title_explain = $user->lang['PERMISSIONS_EXPLAIN']; $which_acl = 'a_auth'; $type_sql = 'f'; break; case 'moderators': $l_title = $user->lang['MODERATORS']; $l_title_explain = $user->lang['MODERATORS_EXPLAIN']; $which_acl = 'a_authmods'; $type_sql = 'm'; break; case 'supermoderators': $l_title = $user->lang['SUPER_MODERATORS']; $l_title_explain = $user->lang['SUPER_MODERATORS_EXPLAIN']; $which_acl = 'a_authmods'; $type_sql = 'm'; break; case 'administrators': $l_title = $user->lang['ADMINISTRATORS']; $l_title_explain = $user->lang['ADMINISTRATORS_EXPLAIN']; $which_acl = 'a_authadmins'; $type_sql = 'a'; break; } // Permission check if (!$auth->acl_get($which_acl)) { trigger_error($user->lang['NO_ADMIN']); } // Call update or delete, both can take multiple user/group // ids. Additionally inheritance is handled (by the auth API) if (isset($_POST['update'])) { $auth_admin = new auth_admin(); // Admin wants subforums to inherit permissions ... so handle this if (!empty($_POST['inherit'])) { array_push($_POST['inherit'], $forum_id); $forum_id = $_POST['inherit']; } foreach ($_POST['entries'] as $id) { $auth_admin->acl_set($_POST['type'], $forum_id, $id, $_POST['option']); } cache_moderators(); trigger_error('Permissions updated successfully'); } else if (isset($_POST['delete'])) { $auth_admin = new auth_admin(); $option_ids = false; if (!empty($_POST['option'])) { $sql = "SELECT auth_option_id FROM " . ACL_OPTIONS_TABLE . " WHERE auth_value LIKE '" . $_POST['option'] . "_%'"; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) { $option_ids = array(); do { $option_ids[] = $row['auth_option_id']; } while($row = $db->sql_fetchrow($result)); } $db->sql_freeresult($result); } foreach ($_POST['entries'] as $id) { $auth_admin->acl_delete($_POST['type'], $forum_id, $id, $option_ids); } cache_moderators(); trigger_error('Permissions updated successfully'); } else if (isset($_POST['presetsave'])) { print_r($_POST['option']); $holding_ary = array(); foreach ($_POST['option'] as $acl_option => $allow_deny) { switch ($allow_deny) { case ACL_ALLOW: $holding_ary['allow'][] = $acl_option; break; case ACL_DENY: $holding_ary['deny'][] = $acl_option; break; case ACL_INHERIT: $holding_ary['inherit'][] = $acl_option; break; } } $sql = array( 'preset_user_id' => $user->data['user_id'], 'preset_type' => $type_sql, 'preset_data' => $db->sql_escape(serialize($holding_ary)) ); if (!empty($_POST['presetname'])) { $sql['preset_name'] = $db->sql_escape($_POST['presetname']); } if (!empty($_POST['presetname']) || $_POST['presetoption'] != -1) { $sql = ($_POST['presetoption'] == -1) ? 'INSERT INTO ' . ACL_PRESETS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql) : 'UPDATE ' . ACL_PRESETS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql) . ' WHERE preset_id =' . $_POST['presetoption']; $db->sql_query($sql); } } else if (isset($_POST['presetdel'])) { if (!empty($_POST['presetoption'])) { $sql = "DELETE FROM " . ACL_PRESETS_TABLE . " WHERE preset_id = " . intval($_POST['presetoption']); $db->sql_query($sql); } } // Get required information, either all forums if no id was // specified or just the requsted if it was if (!empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators') { // 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); $db->sql_freeresult($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($_POST['advanced']) || empty($_POST['entries'])) { ?>lang['Users']; ?> |
lang['Groups']; ?> |
lang['ACL_EXPLAIN']; ?>