Changeset 2029


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)

Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/feed.php

    r1900 r2029  
    9292{
    9393  $image_only = true;
    94   if (!$user['is_the_guest'])
     94  if (!is_a_guest())
    9595  {// auto session was created - so switch to guest
    9696    $user = build_user( $conf['guest_id'], true );
  • trunk/identification.php

    r2014 r2029  
    4141{
    4242  $redirect_to = urldecode($_GET['redirect']);
    43   if ( $user['is_the_guest'] )
     43  if ( is_a_guest() )
    4444  {
    4545    array_push($errors, l10n('access_forbiden'));
  • trunk/include/common.inc.php

    r1903 r2029  
    55// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    87// | file          : $Id$
    98// | last update   : $Date$
     
    166165// only now we can set the localized username of the guest user (and not in
    167166// include/user.inc.php)
    168 if ($user['is_the_guest'])
     167if (is_a_guest())
    169168{
    170169  $user['username'] = $lang['guest'];
  • trunk/include/config_default.inc.php

    r1970 r2029  
    174174//    'http://phpwebgallery.net' => array('label' => 'PWG website', 'new_window' => false, 'eval_visible' => 'return true;'),
    175175//    'http://forum.phpwebgallery.net' => array('label' => 'For ADMIN', 'new_window' => true, 'eval_visible' => 'return is_admin();'),
    176 //    'http://phpwebgallery.net/doc' => array('label' => 'For Guest', 'new_window' => true, 'eval_visible' => 'return $user[\'is_the_guest\'];'),
     176//    'http://phpwebgallery.net/doc' => array('label' => 'For Guest', 'new_window' => true, 'eval_visible' => 'return is_a_guest();'),
    177177//    'http://download.gna.org/phpwebgallery/' =>
    178178//      array('label' => 'PopUp', 'new_window' => true,
     
    214214//  $conf['random_index_redirect'] = array(
    215215//    PHPWG_ROOT_PATH.'index.php?/best_rated' => 'return true;',
    216 //    PHPWG_ROOT_PATH.'index.php?/recent_pics' => 'return $user[\'is_the_guest\'];',
     216//    PHPWG_ROOT_PATH.'index.php?/recent_pics' => 'return is_a_guest();',
    217217//    PHPWG_ROOT_PATH.'random.php' => '',
    218218//    PHPWG_ROOT_PATH.'index.php?/categories' => '',
  • trunk/include/functions.inc.php

    r2026 r2029  
    424424    $do_log = false;
    425425  }
    426   if ($user['is_the_guest'] and !$conf['history_guest'])
     426  if (is_a_guest() and !$conf['history_guest'])
    427427  {
    428428    $do_log = false;
  • trunk/include/functions_comment.inc.php

    r2027 r2029  
    5959
    6060  // we do here only BASIC spam check (plugins can do more)
    61   if ( !$user['is_the_guest'] )
     61  if ( !is_a_guest() )
    6262    return $action;
    6363
     
    119119  }
    120120
    121   if ( $user['is_the_guest'] )
     121  // display author field if the user status is guest or generic
     122  if (!is_classic_user())
    122123  {
    123124    if ( empty($comm['author']) )
  • trunk/include/functions_html.inc.php

    r1900 r2029  
    575575      .urlencode(urlencode($_SERVER['REQUEST_URI']));
    576576
    577   if ( isset($user['is_the_guest']) and !$user['is_the_guest'] )
     577  if ( isset($user) and !is_a_guest() )
    578578  {
    579579    echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />';
  • 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*/
  • trunk/include/menubar.inc.php

    r1932 r2029  
    164164//---------------------------------------------------------- special categories
    165165// favorites categories
    166 if ( !$user['is_the_guest'] )
     166if ( !is_a_guest() )
    167167{
    168168  $template->assign_block_vars('username', array());
     
    243243//--------------------------------------------------------------------- summary
    244244
    245 if ($user['is_the_guest'])
     245if (is_a_guest())
    246246{
    247247  $template->assign_block_vars('login', array());
  • trunk/include/page_tail.php

    r1900 r2029  
    55// | 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$
     
    3938//--------------------------------------------------------------------- contact
    4039
    41 if (!$user['is_the_guest'])
     40if (!is_a_guest())
    4241{
    4342  $template->assign_block_vars(
  • trunk/include/picture_comment.inc.php

    r1900 r2029  
    4444if ( $page['show_comments'] and isset( $_POST['content'] ) )
    4545{
    46   if ( $user['is_the_guest'] and !$conf['comments_forall'] )
     46  if ( is_a_guest() and !$conf['comments_forall'] )
    4747  {
    4848    die ('Session expired');
     
    6262  {
    6363    case 'moderate':
    64       array_push( $infos, $lang['comment_to_validate'] );
     64      array_push( $infos, l10n('comment_to_validate') );
    6565    case 'validate':
    66       array_push( $infos, $lang['comment_added']);
     66      array_push( $infos, l10n('comment_added'));
    6767      break;
    6868    case 'reject':
     
    138138        array(
    139139          'COMMENT_AUTHOR' => empty($row['author'])
    140             ? $lang['guest']
     140            ? l10n('guest')
    141141            : $row['author'],
    142142
     
    169169  }
    170170
    171   if (!$user['is_the_guest']
    172       or ($user['is_the_guest'] and $conf['comments_forall']))
     171  if (!is_a_guest()
     172      or (is_a_guest() and $conf['comments_forall']))
    173173  {
    174174    include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
     
    184184          'CONTENT' => $content
    185185        ));
    186     // display author field if the user is not logged in
    187     if ($user['is_the_guest'])
     186
     187    // display author field if the user status is guest or generic
     188    if (!is_classic_user())
    188189    {
    189190      $template->assign_block_vars(
  • trunk/include/ws_functions.inc.php

    r1912 r2029  
    703703  $comment_post_data = null;
    704704  if ($is_commentable and
    705       (!$user['is_the_guest']
    706         or ($user['is_the_guest'] and $conf['comments_forall'] )
     705      (!is_a_guest()
     706        or (is_a_guest() and $conf['comments_forall'] )
    707707      )
    708708      )
     
    885885{
    886886  global $user, $conf;
    887   if (!$user['is_the_guest'])
     887  if (!is_a_guest())
    888888  {
    889889    $_SESSION = array();
     
    903903  global $user, $lang_info;
    904904  $res = array();
    905   $res['username'] = $user['is_the_guest'] ? 'guest' : $user['username'];
     905  $res['username'] = is_a_guest() ? 'guest' : $user['username'];
    906906  foreach ( array('status', 'template', 'theme', 'language') as $k )
    907907  {
  • trunk/notification.php

    r1900 r2029  
    55// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    87// | file          : $Id$
    98// | last update   : $Date$
     
    5453
    5554$feed_url=PHPWG_ROOT_PATH.'feed.php';
    56 if ($user['is_the_guest'])
     55if (is_a_guest())
    5756{
    5857  $feed_image_only_url=$feed_url;
  • trunk/picture.php

    r2014 r2029  
    579579
    580580// favorite manipulation
    581 if (!$user['is_the_guest'])
     581if (!is_a_guest())
    582582{
    583583  // verify if the picture is already in the favorite of the user
  • trunk/profile.php

    r2014 r2029  
    207207function load_profile_in_template($url_action, $url_redirect, $userdata)
    208208{
    209   global $template;
     209  global $template, $conf;
    210210
    211211  $template->set_filename('profile_content', 'profile_content.tpl');
     
    294294  }
    295295
    296   if (!($userdata['is_the_guest'] or $userdata['is_the_default']))
     296  if (!(in_array($userdata['id'], array($conf['guest_id'], $conf['default_user_id']))))
    297297  {
    298298    $template->assign_block_vars('not_special_user', array());
  • trunk/ws.php

    r1900 r2029  
    8181      array(
    8282        'image_id' => array(),
    83         'author' => array( 'default' => $user['is_the_guest']? 'guest':$user['username']),
     83        'author' => array( 'default' => is_a_guest()? 'guest':$user['username']),
    8484        'content' => array(),
    8585        'key' => array(),
Note: See TracChangeset for help on using the changeset viewer.