/** * Re-cache moderators and foes if group has a_ or m_ permissions */ function group_update_listings($group_id) { global $db, $cache, $auth; $hold_ary = $auth->acl_group_raw_data($group_id, array('a_', 'm_')); if (!sizeof($hold_ary)) { return; } $mod_permissions = $admin_permissions = false; foreach ($hold_ary as $g_id => $forum_ary) { foreach ($forum_ary as $forum_id => $auth_ary) { foreach ($auth_ary as $auth_option => $setting) { if ($mod_permissions && $admin_permissions) { break 3; } if ($setting != ACL_YES) { continue; } if ($auth_option == 'm_') { $mod_permissions = true; } if ($auth_option == 'a_') { $admin_permissions = true; } } } } if ($mod_permissions) { if (!function_exists('phpbb_cache_moderators')) { global $phpbb_root_path, $phpEx; include $phpbb_root_path . 'includes/functions_admin.' . $phpEx; } phpbb_cache_moderators($db, $cache, $auth); } if ($mod_permissions || $admin_permissions) { if (!function_exists('phpbb_update_foes')) { global $phpbb_root_path, $phpEx; include $phpbb_root_path . 'includes/functions_admin.' . $phpEx; } phpbb_update_foes($db, $auth, array($group_id)); } }
/** * Apply all permissions */ function set_all_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id) { global $db, $cache, $user, $auth; global $request; // User or group to be set? $ug_type = sizeof($user_id) ? 'user' : 'group'; // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) { send_status_line(403, 'Forbidden'); trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } $auth_settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, \phpbb\request\request_interface::POST); $auth_roles = $request->variable('role', array(0 => array(0 => 0)), false, \phpbb\request\request_interface::POST); $ug_ids = $forum_ids = array(); // We need to go through the auth settings foreach ($auth_settings as $ug_id => $forum_auth_row) { $ug_id = (int) $ug_id; $ug_ids[] = $ug_id; foreach ($forum_auth_row as $forum_id => $auth_options) { $forum_id = (int) $forum_id; $forum_ids[] = $forum_id; // Check role... $assigned_role = isset($auth_roles[$ug_id][$forum_id]) ? (int) $auth_roles[$ug_id][$forum_id] : 0; // If the auth settings differ from the assigned role, then do not set a role... if ($assigned_role) { if (!$this->check_assigned_role($assigned_role, $auth_options)) { $assigned_role = 0; } } // Update the permission set... $auth_admin->acl_set($ug_type, $forum_id, $ug_id, $auth_options, $assigned_role, false); } } $auth_admin->acl_clear_prefetch(); // Do we need to recache the moderator lists? if ($permission_type == 'm_') { phpbb_cache_moderators($db, $cache, $auth); } // Remove users who are now moderators or admins from everyones foes list if ($permission_type == 'm_' || $permission_type == 'a_') { phpbb_update_foes($db, $auth, $group_id, $user_id); } $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_ids, $forum_ids); if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') { trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids))); } else { trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } }
/** * Removes moderators and administrators from foe lists. * * @deprecated 3.1.0 (To be removed: 3.3.0) * @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore * @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore * @return null */ function update_foes($group_id = false, $user_id = false) { global $db, $auth; return phpbb_update_foes($db, $auth, $group_id, $user_id); }