Changeset 1850


Ignore:
Timestamp:
Feb 22, 2007, 6:31:08 AM (17 years ago)
Author:
rvelices
Message:
  • change the way confguest_access is handled so that web services work correctly (and also nbm.php and feed.php)
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions_notification_by_mail.inc.php

    r1809 r1850  
    262262  global $user, $lang, $lang_info, $env_nbm;
    263263
    264   $user = array();
    265   $user['id'] = $nbm_user['user_id'];
    266   $user = array_merge($user, getuserdata($user['id'], true));
    267 
    268   list($user['template'], $user['theme']) = explode('/', $user['template']);
     264  $user = build_user( $nbm_user['user_id'], true );
    269265
    270266  if ($env_nbm['last_language'] != $user['language'])
  • trunk/feed.php

    r1784 r1850  
    8787  if ($feed_row['user_id']!=$user['id'])
    8888  { // new user
    89     $user = array();
    9089    $user = build_user( $feed_row['user_id'], true );
    9190  }
     
    9695  if (!$user['is_the_guest'])
    9796  {// auto session was created - so switch to guest
    98     $user = array();
    9997    $user = build_user( $conf['guest_id'], true );
    10098  }
    10199}
     100
     101// Check the status now after the user has been loaded
     102check_status(ACCESS_GUEST);
    102103
    103104list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
  • trunk/include/common.inc.php

    r1849 r1850  
    186186}
    187187
    188 if ($user['is_the_guest'] and !$conf['guest_access']
    189     and !in_array( script_basename(),
    190                       // Array of basename without file extention
    191                       array('identification',
    192                             'password',
    193                             'register'
    194                         )
    195                   )
    196     )
    197 {
    198   redirect (get_absolute_root_url(false).'identification.php');
    199 }
    200 
    201188if ($conf['check_upgrade_feed']
    202189    and defined('PHPWG_IN_UPGRADE')
  • trunk/include/functions_user.inc.php

    r1817 r1850  
    393393function calculate_permissions($user_id, $user_status)
    394394{
    395   global $user;
    396 
    397395  $private_array = array();
    398396  $authorized_array = array();
     
    438436
    439437  // if user is not an admin, locked categories are forbidden
    440   if (!is_admin($user_status))
     438  if ( $user_status!='administrator' and $user_status!='webmaster' )
    441439  {
    442440    $query = '
     
    982980 * @return bool
    983981*/
    984 function get_access_type_status($user_status = '')
     982function get_access_type_status($user_status='')
    985983{
    986984  global $user;
    987985
    988   if (($user_status == '') and isset($user['status']))
     986  if ($user_status == '' and isset($user['status']) )
    989987  {
    990988    $user_status = $user['status'];
     
    10251023 * @return bool
    10261024*/
    1027 function is_autorize_status($access_type, $user_status = '')
    1028 {
    1029   return (get_access_type_status($user_status) >= $access_type);
     1025function 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);
    10301037}
    10311038
     
    10361043 * @return none
    10371044*/
    1038 function check_status($access_type, $user_status = '')
    1039 {
    1040   if (!is_autorize_status($access_type, $user_status))
     1045function check_status( $access_type )
     1046{
     1047  if (!is_autorize_status($access_type) )
    10411048  {
    10421049    access_denied();
     
    10481055 * @return bool
    10491056*/
    1050 function is_admin($user_status = '')
    1051 {
    1052   return is_autorize_status(ACCESS_ADMINISTRATOR, $user_status);
     1057function is_admin()
     1058{
     1059  return is_autorize_status(ACCESS_ADMINISTRATOR);
    10531060}
    10541061
  • trunk/qsearch.php

    r1816 r1850  
    22// +-----------------------------------------------------------------------+
    33// | PhpWebGallery - a PHP based picture gallery                           |
    4 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
     4// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    55// +-----------------------------------------------------------------------+
    6 // | branch        : BSF (Best So Far)
    76// | file          : $Id$
    87// | last update   : $Date$
     
    2726define('PHPWG_ROOT_PATH','./');
    2827include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
     28
     29// +-----------------------------------------------------------------------+
     30// | Check Access and exit when user status is not ok                      |
     31// +-----------------------------------------------------------------------+
     32check_status(ACCESS_GUEST);
    2933
    3034if (empty($_GET['q']))
  • trunk/upload.php

    r1843 r1850  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    8 // | file          : $RCSfile$
     7// | file          : $Id$
    98// | last update   : $Date$
    109// | last modifier : $Author$
     
    2726define('PHPWG_ROOT_PATH','./');
    2827include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
     28
     29check_status(ACCESS_GUEST);
    2930
    3031$username = !empty($_POST['username'])?$_POST['username']:$user['username'];
Note: See TracChangeset for help on using the changeset viewer.