Changeset 1072 for trunk/include/functions_user.inc.php
- Timestamp:
- Mar 9, 2006, 11:46:28 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_user.inc.php
r1070 r1072 538 538 539 539 /* 540 * Return if current is an administrator 540 * Return if current user have access to access_type definition 541 * Test does with user status 542 * @return bool 543 */ 544 function is_autorize_status($access_type) 545 { 546 global $user; 547 548 $access_type_status = ACCESS_NONE; 549 if (isset($user['status'])) 550 { 551 switch ($user['status']) 552 { 553 case 'guest': 554 case 'generic': 555 { 556 $access_type_status = ACCESS_GUEST; 557 break; 558 } 559 case 'normal': 560 { 561 $access_type_status = ACCESS_CLASSIC; 562 break; 563 } 564 case 'admin': 565 { 566 $access_type_status = ACCESS_ADMINISTRATOR; 567 break; 568 } 569 case 'webmaster': 570 { 571 $access_type_status = ACCESS_WEBMASTER; 572 break; 573 } 574 } 575 } 576 577 return ($access_type_status >= $access_type); 578 } 579 580 /* 581 * Check if current user have access to access_type definition 582 * Stop action if there are not access 583 * Test does with user status 584 * @return none 585 */ 586 function check_status($access_type) 587 { 588 global $lang; 589 590 if (!is_autorize_status($access_type)) 591 { 592 echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />'; 593 echo '<a href="'.PHPWG_ROOT_PATH.'identification.php">'.$lang['identification'].'</a></div>'; 594 exit(); 595 } 596 } 597 598 /* 599 * Return if current user is an administrator 541 600 * @return bool 542 601 */ 543 602 function is_admin() 544 603 { 545 global $user; 546 547 return ($user['status'] == 'webmaster' or $user['status'] == 'admin') ? true : false; 604 return is_autorize_status(ACCESS_ADMINISTRATOR); 548 605 } 549 606
Note: See TracChangeset
for help on using the changeset viewer.