Ignore:
Timestamp:
Feb 22, 2007, 9:20:30 PM (17 years ago)
Author:
rub
Message:

o Proposition: improved display of 'x images in y sub-categories' or 'x images in this category' for cases when categories contain both images and sub-categories
o Good idea of this new way for way confguest_access, but I kept last implementation for access methods (Could be useful on future development)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_user.inc.php

    r1850 r1851  
    436436
    437437  // if user is not an admin, locked categories are forbidden
    438   if ( $user_status!='administrator' and $user_status!='webmaster' )
     438  if (!is_admin($user_status))
    439439  {
    440440    $query = '
     
    982982function get_access_type_status($user_status='')
    983983{
    984   global $user;
     984  global $user, $conf;
    985985
    986986  if ($user_status == '' and isset($user['status']) )
     
    993993  {
    994994    case 'guest':
     995    {
     996      if
     997        (
     998          !isset($user) or
     999          ($user['id']==$conf['guest_id'] and !$conf['guest_access'])
     1000        )
     1001      {
     1002        $access_type_status = ACCESS_NONE;
     1003      }
     1004      else
     1005      {
     1006        $access_type_status = ACCESS_GUEST;
     1007      }
     1008      break;
     1009    }
    9951010    case 'generic':
    9961011    {
     
    10231038 * @return bool
    10241039*/
    1025 function is_autorize_status($access_type)
    1026 {
    1027   global $user, $conf;
    1028   if (
    1029       !isset($user) or
    1030       ($user['id']==$conf['guest_id'] and $conf['guest_access']==false)
    1031     )
    1032   {
    1033     return ACCESS_NONE>=$access_type;
    1034   }
    1035 
    1036   return (get_access_type_status() >= $access_type);
     1040function is_autorize_status($access_type, $user_status = '')
     1041{
     1042  return (get_access_type_status($user_status) >= $access_type);
    10371043}
    10381044
     
    10431049 * @return none
    10441050*/
    1045 function check_status( $access_type )
    1046 {
    1047   if (!is_autorize_status($access_type) )
     1051function check_status($access_type, $user_status = '')
     1052{
     1053  if (!is_autorize_status($access_type, $user_status))
    10481054  {
    10491055    access_denied();
     
    10551061 * @return bool
    10561062*/
    1057 function is_admin()
    1058 {
    1059   return is_autorize_status(ACCESS_ADMINISTRATOR);
     1063 function is_admin($user_status = '')
     1064{
     1065  return is_autorize_status(ACCESS_ADMINISTRATOR, $user_status);
    10601066}
    10611067
Note: See TracChangeset for help on using the changeset viewer.