Revision 546
Added by doc almost 18 years ago
| index.php | ||
|---|---|---|
| 118 | 118 |
// Get user perms |
| 119 | 119 |
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
| 120 | 120 |
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
| 121 |
if(is_numeric(array_search($admin->get_group_id(), $admin_groups)) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
|
| 121 |
|
|
| 122 |
$in_group = FALSE; |
|
| 123 |
foreach($admin->get_groups_id() as $cur_gid){
|
|
| 124 |
if (in_array($cur_gid, $admin_groups)) {
|
|
| 125 |
$in_group = TRUE; |
|
| 126 |
} |
|
| 127 |
} |
|
| 128 |
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
|
| 122 | 129 |
if($page['visibility'] == 'deleted') {
|
| 123 | 130 |
if(PAGE_TRASH == 'inline') {
|
| 124 | 131 |
$can_modify = true; |
| ... | ... | |
| 370 | 377 |
// Insert values into the add page form |
| 371 | 378 |
|
| 372 | 379 |
// Group list 1 |
| 373 |
if($admin->get_group_id() == 1) {
|
|
| 374 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
| 375 |
} else {
|
|
| 376 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id != '".$admin->get_group_id()."'"; |
|
| 377 |
} |
|
| 380 |
|
|
| 381 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
| 382 |
|
|
| 378 | 383 |
$get_groups = $database->query($query); |
| 379 | 384 |
$template->set_block('main_block', 'group_list_block', 'group_list');
|
| 380 | 385 |
// Insert admin group and current group first |
| ... | ... | |
| 390 | 395 |
) |
| 391 | 396 |
); |
| 392 | 397 |
$template->parse('group_list', 'group_list_block', true);
|
| 393 |
if($admin->get_group_id() != 1) {
|
|
| 394 |
$template->set_var(array( |
|
| 395 |
'ID' => $admin->get_group_id(), |
|
| 396 |
'TOGGLE' => '', |
|
| 397 |
'DISABLED' => ' disabled', |
|
| 398 |
'LINK_COLOR' => '000000', |
|
| 399 |
'CURSOR' => 'default', |
|
| 400 |
'NAME' => $admin->get_group_name(), |
|
| 401 |
'CHECKED' => ' checked' |
|
| 402 |
) |
|
| 403 |
); |
|
| 404 |
$template->parse('group_list', 'group_list_block', true);
|
|
| 405 |
} |
|
| 398 |
|
|
| 406 | 399 |
while($group = $get_groups->fetchRow()) {
|
| 400 |
// check if the user is a member of this group |
|
| 401 |
$flag_disabled = ''; |
|
| 402 |
$flag_checked = ''; |
|
| 403 |
$flag_cursor = 'pointer'; |
|
| 404 |
$flag_color = ''; |
|
| 405 |
if (in_array($group["group_id"], $admin->get_groups_id())) {
|
|
| 406 |
$flag_disabled = ' disabled'; |
|
| 407 |
$flag_checked = ' checked'; |
|
| 408 |
$flag_cursor = 'default'; |
|
| 409 |
$flag_color = '000000'; |
|
| 410 |
} |
|
| 411 |
|
|
| 407 | 412 |
// Check if the group is allowed to edit pages |
| 408 | 413 |
$system_permissions = explode(',', $group['system_permissions']);
|
| 409 | 414 |
if(is_numeric(array_search('pages_modify', $system_permissions))) {
|
| 410 | 415 |
$template->set_var(array( |
| 411 | 416 |
'ID' => $group['group_id'], |
| 412 | 417 |
'TOGGLE' => $group['group_id'], |
| 413 |
'CHECKED' => '',
|
|
| 414 |
'DISABLED' => '',
|
|
| 415 |
'LINK_COLOR' => '',
|
|
| 416 |
'CURSOR' => 'pointer',
|
|
| 418 |
'CHECKED' => $flag_checked,
|
|
| 419 |
'DISABLED' => $flag_disabled,
|
|
| 420 |
'LINK_COLOR' => $flag_color,
|
|
| 421 |
'CURSOR' => $flag_checked,
|
|
| 417 | 422 |
'NAME' => $group['name'], |
| 418 |
'CHECKED' => '' |
|
| 419 | 423 |
) |
| 420 | 424 |
); |
| 421 | 425 |
$template->parse('group_list', 'group_list_block', true);
|
| 422 | 426 |
} |
| 423 | 427 |
} |
| 424 | 428 |
// Group list 2 |
| 425 |
if($admin->get_group_id() == 1) {
|
|
| 426 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
| 427 |
} else {
|
|
| 428 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id != '".$admin->get_group_id()."'"; |
|
| 429 |
} |
|
| 429 |
|
|
| 430 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
| 431 |
|
|
| 430 | 432 |
$get_groups = $database->query($query); |
| 431 | 433 |
$template->set_block('main_block', 'group_list_block2', 'group_list2');
|
| 432 | 434 |
// Insert admin group and current group first |
| ... | ... | |
| 442 | 444 |
) |
| 443 | 445 |
); |
| 444 | 446 |
$template->parse('group_list2', 'group_list_block2', true);
|
| 445 |
if($admin->get_group_id() != 1) {
|
|
| 446 |
$template->set_var(array( |
|
| 447 |
'ID' => $admin->get_group_id(), |
|
| 448 |
'TOGGLE' => '', |
|
| 449 |
'DISABLED' => ' disabled', |
|
| 450 |
'LINK_COLOR' => '000000', |
|
| 451 |
'CURSOR' => 'default', |
|
| 452 |
'NAME' => $admin->get_group_name(), |
|
| 453 |
'CHECKED' => ' checked' |
|
| 454 |
) |
|
| 455 |
); |
|
| 456 |
$template->parse('group_list2', 'group_list_block2', true);
|
|
| 457 |
} |
|
| 447 |
|
|
| 458 | 448 |
while($group = $get_groups->fetchRow()) {
|
| 449 |
// check if the user is a member of this group |
|
| 450 |
$flag_disabled = ''; |
|
| 451 |
$flag_checked = ''; |
|
| 452 |
$flag_cursor = 'pointer'; |
|
| 453 |
$flag_color = ''; |
|
| 454 |
if (in_array($group["group_id"], $admin->get_groups_id())) {
|
|
| 455 |
$flag_disabled = ' disabled'; |
|
| 456 |
$flag_checked = ' checked'; |
|
| 457 |
$flag_cursor = 'default'; |
|
| 458 |
$flag_color = '000000'; |
|
| 459 |
} |
|
| 460 |
|
|
| 459 | 461 |
$template->set_var(array( |
| 460 | 462 |
'ID' => $group['group_id'], |
| 461 | 463 |
'TOGGLE' => $group['group_id'], |
| 462 |
'CHECKED' => '',
|
|
| 463 |
'DISABLED' => '',
|
|
| 464 |
'LINK_COLOR' => '',
|
|
| 465 |
'CURSOR' => 'pointer',
|
|
| 464 |
'CHECKED' => $flag_checked,
|
|
| 465 |
'DISABLED' => $flag_disabled,
|
|
| 466 |
'LINK_COLOR' => $flag_color,
|
|
| 467 |
'CURSOR' => $flag_cursor,
|
|
| 466 | 468 |
'NAME' => $group['name'], |
| 467 |
'CHECKED' => '' |
|
| 468 | 469 |
) |
| 469 | 470 |
); |
| 470 | 471 |
$template->parse('group_list2', 'group_list_block2', true);
|
| ... | ... | |
| 482 | 483 |
// Get user perms |
| 483 | 484 |
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
| 484 | 485 |
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
| 485 |
if(is_numeric(array_search($admin->get_group_id(), $admin_groups)) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
|
| 486 |
|
|
| 487 |
$in_group = FALSE; |
|
| 488 |
foreach($admin->get_groups_id() as $cur_gid){
|
|
| 489 |
if (in_array($cur_gid, $admin_groups)) {
|
|
| 490 |
$in_group = TRUE; |
|
| 491 |
} |
|
| 492 |
} |
|
| 493 |
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
|
| 486 | 494 |
$can_modify = true; |
| 487 | 495 |
} else {
|
| 488 | 496 |
$can_modify = false; |
Also available in: Unified diff
added the "users in multiple groups" feature (closes parts of ticket #546)