Ignore:
Timestamp:
Jun 6, 2007, 12:01:15 AM (17 years ago)
Author:
rub
Message:

Resolved issue 0000697: with generic user a author name is necessary to comment picture.

+ Change way to determinate if user is a guest (use functions like is_admin)

File:
1 edited

Legend:

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

    r1985 r2029  
    147147  $user['id'] = $user_id;
    148148  $user = array_merge( $user, getuserdata($user_id, $use_cache) );
    149   $user['is_the_guest'] = ($user['id'] == $conf['guest_id']);
    150   $user['is_the_default'] = ($user['id'] == $conf['default_user_id']);
    151149
    152150  // calculation of the number of picture to display per page
     
    10161014      $cookie = array('id' => (int)$user_id, 'key' => $key);
    10171015      setcookie($conf['remember_me_name'],
    1018                 serialize($cookie),
    1019                 time()+$conf['remember_me_length'],
    1020                 cookie_path()
    1021               );
    1022         }
     1016            serialize($cookie),
     1017            time()+$conf['remember_me_length'],
     1018            cookie_path()
     1019          );
     1020    }
    10231021  }
    10241022  else
     
    10911089
    10921090/*
     1091 * Return user status used in this library
     1092 * @return string
     1093*/
     1094function get_user_status($user_status)
     1095{
     1096  global $user;
     1097
     1098  if (empty($user_status))
     1099  {
     1100    if (isset($user['status']))
     1101    {
     1102      $user_status = $user['status'];
     1103    }
     1104    else
     1105    {
     1106      // swicth to default value
     1107      $user_status = '';
     1108    }
     1109  }
     1110  return $user_status;
     1111}
     1112
     1113/*
    10931114 * Return access_type definition of uuser
    10941115 * Test does with user status
     
    10971118function get_access_type_status($user_status='')
    10981119{
    1099   global $user, $conf;
    1100 
    1101   if (empty($user_status))
    1102   {
    1103     if (isset($user['status']))
    1104     {
    1105       $user_status = $user['status'];
    1106     }
    1107     else
    1108     {
    1109       // swicth to default value
    1110       $user_status = '';
    1111     }
    1112   }
    1113 
    1114   switch ($user_status)
     1120  global $conf;
     1121
     1122  switch (get_user_status($user_status))
    11151123  {
    11161124    case 'guest':
     
    11741182
    11751183/*
    1176  * Return if user is an administrator
     1184 * Return if user is only a guest
     1185 * @return bool
     1186*/
     1187 function is_a_guest($user_status = '')
     1188{
     1189  return get_user_status($user_status) == 'guest';
     1190}
     1191
     1192/*
     1193 * Return if user is, at least, a classic user
     1194 * @return bool
     1195*/
     1196 function is_classic_user($user_status = '')
     1197{
     1198  return is_autorize_status(ACCESS_CLASSIC, $user_status);
     1199}
     1200
     1201/*
     1202 * Return if user is, at least, an administrator
    11771203 * @return bool
    11781204*/
Note: See TracChangeset for help on using the changeset viewer.