Changeset 702 for trunk/forum/includes/acp/acp_permissions.php
- Timestamp:
- Mar 31, 2010, 6:32:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/forum/includes/acp/acp_permissions.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_permissions.php 8710 2008-07-29 13:35:49Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 24 24 var $u_action; 25 25 var $permission_dropdown; 26 26 27 27 function main($id, $mode) 28 28 { … … 55 55 return; 56 56 } 57 trigger_error('NO_MODE', E_USER_ERROR); 58 } 59 60 // Copy forum permissions 61 if ($mode == 'setting_forum_copy') 62 { 63 $this->tpl_name = 'permission_forum_copy'; 64 65 if ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')) 66 { 67 $this->page_title = 'ACP_FORUM_PERMISSIONS_COPY'; 68 $this->copy_forum_permissions(); 69 return; 70 } 71 57 72 trigger_error('NO_MODE', E_USER_ERROR); 58 73 } … … 95 110 $db->sql_freeresult($result); 96 111 } 97 112 98 113 // Map usernames to ids and vice versa 99 114 if ($usernames) … … 113 128 } 114 129 unset($username); 115 130 116 131 // Build forum ids (of all forums are checked or subforum listing used) 117 132 if ($all_forums) … … 218 233 } 219 234 220 221 235 // Handle actions 222 236 if (strpos($mode, 'setting_') === 0 && $action) … … 225 239 { 226 240 case 'delete': 227 228 if (!check_form_key($form_name)) 229 { 230 trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); 231 } 232 // All users/groups selected? 233 $all_users = (isset($_POST['all_users'])) ? true : false; 234 $all_groups = (isset($_POST['all_groups'])) ? true : false; 235 236 if ($all_users || $all_groups) 237 { 238 $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type); 239 240 if ($all_users && sizeof($items['user_ids'])) 241 if (confirm_box(true)) 242 { 243 // All users/groups selected? 244 $all_users = (isset($_POST['all_users'])) ? true : false; 245 $all_groups = (isset($_POST['all_groups'])) ? true : false; 246 247 if ($all_users || $all_groups) 241 248 { 242 $user_id = $items['user_ids']; 249 $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type); 250 251 if ($all_users && sizeof($items['user_ids'])) 252 { 253 $user_id = $items['user_ids']; 254 } 255 else if ($all_groups && sizeof($items['group_ids'])) 256 { 257 $group_id = $items['group_ids']; 258 } 243 259 } 244 else if ($all_groups && sizeof($items['group_ids'])) 260 261 if (sizeof($user_id) || sizeof($group_id)) 245 262 { 246 $ group_id = $items['group_ids'];263 $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id); 247 264 } 248 } 249 250 if (sizeof($user_id) || sizeof($group_id)) 251 { 252 $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id); 265 else 266 { 267 trigger_error($user->lang['NO_USER_GROUP_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); 268 } 253 269 } 254 270 else 255 271 { 256 trigger_error($user->lang['NO_USER_GROUP_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); 272 if (isset($_POST['cancel'])) 273 { 274 $u_redirect = $this->u_action . '&type=' . $permission_type; 275 foreach ($forum_id as $fid) 276 { 277 $u_redirect .= '&forum_id[]=' . $fid; 278 } 279 redirect($u_redirect); 280 } 281 282 $s_hidden_fields = array( 283 'i' => $id, 284 'mode' => $mode, 285 'action' => array($action => 1), 286 'user_id' => $user_id, 287 'group_id' => $group_id, 288 'forum_id' => $forum_id, 289 'type' => $permission_type, 290 ); 291 if (isset($_POST['all_users'])) 292 { 293 $s_hidden_fields['all_users'] = 1; 294 } 295 if (isset($_POST['all_groups'])) 296 { 297 $s_hidden_fields['all_groups'] = 1; 298 } 299 confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); 257 300 } 258 301 break; … … 529 572 continue; 530 573 } 531 574 532 575 if ($branch_there) 533 576 { … … 540 583 return $s_options; 541 584 } 542 585 543 586 /** 544 587 * Build dropdown field for changing permission types … … 547 590 { 548 591 global $user, $auth; 549 592 550 593 $s_dropdown_options = ''; 551 594 foreach ($options as $setting) … … 627 670 trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); 628 671 } 629 672 630 673 $ug_id = $forum_id = 0; 631 674 … … 763 806 $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_ids, $forum_ids); 764 807 765 trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); 808 if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') 809 { 810 trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids))); 811 } 812 else 813 { 814 trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); 815 } 766 816 } 767 817 … … 810 860 { 811 861 global $user, $db, $auth; 812 862 813 863 // User or group to be set? 814 864 $ug_type = (sizeof($user_id)) ? 'user' : 'group'; … … 830 880 $this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : array(0 => 0))); 831 881 832 trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); 882 if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') 883 { 884 trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_id))); 885 } 886 else 887 { 888 trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); 889 } 833 890 } 834 891 … … 950 1007 WHERE ug.user_id = ' . $user_id . ' 951 1008 AND ug.user_pending = 0 1009 AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) 952 1010 ORDER BY g.group_type DESC, g.group_id DESC'; 953 1011 $result = $db->sql_query($sql); … … 1111 1169 1112 1170 /** 1171 * Handles copying permissions from one forum to others 1172 */ 1173 function copy_forum_permissions() 1174 { 1175 global $auth, $cache, $template, $user; 1176 1177 $user->add_lang('acp/forums'); 1178 1179 $submit = isset($_POST['submit']) ? true : false; 1180 1181 if ($submit) 1182 { 1183 $src = request_var('src_forum_id', 0); 1184 $dest = request_var('dest_forum_ids', array(0)); 1185 1186 if (confirm_box(true)) 1187 { 1188 if (copy_forum_permissions($src, $dest)) 1189 { 1190 cache_moderators(); 1191 1192 $auth->acl_clear_prefetch(); 1193 $cache->destroy('sql', FORUMS_TABLE); 1194 1195 trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); 1196 } 1197 else 1198 { 1199 trigger_error($user->lang['SELECTED_FORUM_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); 1200 } 1201 } 1202 else 1203 { 1204 $s_hidden_fields = array( 1205 'submit' => $submit, 1206 'src_forum_id' => $src, 1207 'dest_forum_ids' => $dest, 1208 ); 1209 1210 $s_hidden_fields = build_hidden_fields($s_hidden_fields); 1211 1212 confirm_box(false, $user->lang['COPY_PERMISSIONS_CONFIRM'], $s_hidden_fields); 1213 } 1214 } 1215 1216 $template->assign_vars(array( 1217 'S_FORUM_OPTIONS' => make_forum_select(false, false, false, false, false), 1218 )); 1219 } 1220 1221 /** 1113 1222 * Get already assigned users/groups 1114 1223 */ … … 1151 1260 $sql_where = 'AND (' . $db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . $db->sql_in_set('a.auth_role_id', $role_ids) . ')'; 1152 1261 } 1153 else 1262 else if (sizeof($role_ids)) 1263 { 1264 $sql_where = 'AND ' . $db->sql_in_set('a.auth_role_id', $role_ids); 1265 } 1266 else if (sizeof($option_ids)) 1154 1267 { 1155 1268 $sql_where = 'AND ' . $db->sql_in_set('a.auth_option_id', $option_ids);
Note:
See TracChangeset
for help on using the changeset viewer.