Ignore:
Timestamp:
Mar 10, 2006, 9:17:18 PM (18 years ago)
Author:
rub
Message:

Step 4 improvement issue 0000301:

o Correction lock categories and is_admin (functions with parameters now)
o Cannot use check_status with upgrade.php and upgrade_feed.php => New function check_upgrade use in upgrade*.php (new functionality for upgrade_feed.php)
o upgrade_feed.php is showed only for administrator user

File:
1 edited

Legend:

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

    r1072 r1075  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    77// | branch        : BSF (Best So Far)
     
    278278function calculate_permissions($user_id, $user_status)
    279279{
     280  global $user;
     281
    280282  $private_array = array();
    281283  $authorized_array = array();
     
    293295
    294296  // if user is not an admin, locked categories can be considered as private$
    295   if (!is_admin())
     297  if (!is_admin($user_status))
    296298  {
    297299    $query = '
     
    542544 * @return bool
    543545*/
    544 function is_autorize_status($access_type)
     546function is_autorize_status($access_type, $user_status = '')
    545547{
    546548  global $user;
    547549
     550  if (($user_status == '') and isset($user['status']))
     551  {
     552    $user_status = $user['status'];
     553  }
     554
    548555  $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       }
     556  switch ($user_status)
     557  {
     558    case 'guest':
     559    case 'generic':
     560    {
     561      $access_type_status = ACCESS_GUEST;
     562      break;
     563    }
     564    case 'normal':
     565    {
     566      $access_type_status = ACCESS_CLASSIC;
     567      break;
     568    }
     569    case 'admin':
     570    {
     571      $access_type_status = ACCESS_ADMINISTRATOR;
     572      break;
     573    }
     574    case 'webmaster':
     575    {
     576      $access_type_status = ACCESS_WEBMASTER;
     577      break;
    574578    }
    575579  }
     
    584588 * @return none
    585589*/
    586 function check_status($access_type)
     590function check_status($access_type, $user_status = '')
    587591{
    588592  global $lang;
    589593
    590   if (!is_autorize_status($access_type))
     594  if (!is_autorize_status($access_type, $user_status))
    591595  {
    592596    echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />';
     
    600604 * @return bool
    601605*/
    602 function is_admin()
    603 {
    604   return is_autorize_status(ACCESS_ADMINISTRATOR);
     606function is_admin($user_status = '')
     607{
     608  return is_autorize_status(ACCESS_ADMINISTRATOR, $user_status);
    605609}
    606610
Note: See TracChangeset for help on using the changeset viewer.