Changeset 2223 for trunk/admin/cat_perm.php
- Timestamp:
- Feb 28, 2008, 3:41:48 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/cat_perm.php
r1961 r2223 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 7PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | file : $Id$ … … 73 73 // +-----------------------------------------------------------------------+ 74 74 75 if (isset($_POST) and false)76 {77 echo '<pre>';78 print_r($_POST);79 echo '</pre>';80 }81 75 82 76 if (isset($_POST['deny_groups_submit']) … … 203 197 // +-----------------------------------------------------------------------+ 204 198 205 $template->set_filename s(array('cat_perm'=>'admin/cat_perm.tpl'));199 $template->set_filename('cat_perm', 'admin/cat_perm.tpl'); 206 200 207 201 $template->assign_vars( … … 231 225 ORDER BY name ASC 232 226 ;'; 233 $result = pwg_query($query); 234 235 while ($row = mysql_fetch_array($result)) 236 { 237 $groups[$row['id']] = $row['name']; 238 } 239 227 $groups = simple_hash_from_query($query, 'id', 'name'); 228 $template->assign('all_groups', $groups); 229 230 // groups granted to access the category 240 231 $query = ' 241 232 SELECT group_id … … 244 235 ;'; 245 236 $group_granted_ids = array_from_query($query, 'group_id'); 246 247 // groups granted to access the category 248 foreach ($group_granted_ids as $group_id) 249 { 250 $template->assign_block_vars( 251 'group_granted', 252 array( 253 'NAME'=>$groups[$group_id], 254 'ID'=>$group_id 255 ) 256 ); 257 } 237 $template->assign('group_granted_ids', $group_granted_ids); 238 258 239 259 240 // groups denied 260 foreach (array_diff(array_keys($groups), $group_granted_ids) as $group_id) 261 { 262 $template->assign_block_vars( 263 'group_denied', 264 array( 265 'NAME'=>$groups[$group_id], 266 'ID'=>$group_id 267 ) 268 ); 269 } 241 $template->assign('group_denied_ids', 242 array_diff(array_keys($groups), $group_granted_ids) 243 ); 270 244 271 245 // users... … … 277 251 FROM '.USERS_TABLE.' 278 252 ;'; 279 $result = pwg_query($query); 280 while($row = mysql_fetch_array($result)) 281 { 282 $users[$row['id']] = $row['username']; 283 } 253 $users = simple_hash_from_query($query, 'id', 'username'); 254 $template->assign('all_users', $users); 255 284 256 285 257 $query = ' … … 290 262 $user_granted_direct_ids = array_from_query($query, 'user_id'); 291 263 292 foreach ($user_granted_direct_ids as $user_id) 293 { 294 $template->assign_block_vars( 295 'user_granted', 296 array( 297 'NAME'=>$users[$user_id], 298 'ID'=>$user_id 299 ) 300 ); 301 } 264 $template->assign('user_granted_direct_ids', $user_granted_direct_ids); 265 266 302 267 303 268 $user_granted_indirect_ids = array(); … … 336 301 foreach ($user_granted_indirect_ids as $user_id) 337 302 { 338 $group = '';339 340 303 foreach ($granted_groups as $group_id => $group_users) 341 304 { 342 305 if (in_array($user_id, $group_users)) 343 306 { 344 $group = $groups[$group_id]; 307 $template->append( 308 'user_granted_indirects', 309 array( 310 'USER'=>$users[$user_id], 311 'GROUP'=>$groups[$group_id] 312 ) 313 ); 345 314 break; 346 315 } 347 316 } 348 349 $template->assign_block_vars(350 'user_granted_indirect',351 array(352 'NAME'=>$users[$user_id],353 'GROUP'=>$group354 )355 );356 317 } 357 318 } … … 360 321 $user_granted_indirect_ids, 361 322 $user_granted_direct_ids); 362 363 foreach ($user_denied_ids as $user_id) 364 { 365 $template->assign_block_vars( 366 'user_denied', 367 array( 368 'NAME'=>$users[$user_id], 369 'ID'=>$user_id 370 ) 371 ); 372 } 323 $template->assign('user_denied_ids', $user_denied_ids); 373 324 374 325
Note: See TracChangeset
for help on using the changeset viewer.