Ignore:
Timestamp:
Feb 2, 2004, 1:55:18 AM (20 years ago)
Author:
gweltas
Message:

Merge of the 1.3.1 release
Creation of an unique include file (common.php)
Creation of an unique define file (include/constants.php)
Modification of the installation procedure

File:
1 edited

Legend:

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

    r90 r345  
    1717 *                                                                         *
    1818 ***************************************************************************/
     19
    1920// retrieving user informations
    2021// $infos array is used to know the fields to retrieve in the table "users"
     
    2526                'nb_line_page', 'status', 'language', 'maxwidth',
    2627                'maxheight', 'expand', 'show_nb_comments', 'short_period',
    27                 'long_period', 'template' );
     28                'long_period', 'template', 'forbidden_categories' );
    2829
    29 $query_user  = 'SELECT ';
    30 foreach ( $infos as $i => $info ) {
    31   if ( $i > 0 ) $query_user.= ',';
    32   $query_user.= $info;
    33 }
    34 $query_user.= ' FROM '.PREFIX_TABLE.'users';
     30$query_user = 'SELECT '.implode( ',', $infos );
     31$query_user.= ' FROM '.USERS_TABLE;
    3532$query_done = false;
    3633$user['is_the_guest'] = false;
     
    6057  $page['session_id'] = $session_id;
    6158  $query = 'SELECT user_id,expiration,ip';
    62   $query.= ' FROM '.PREFIX_TABLE.'sessions';
     59  $query.= ' FROM '.SESSIONS_TABLE;
    6360  $query.= " WHERE id = '".$page['session_id']."'";
    6461  $query.= ';';
     
    7370        // deletion of the session from the database,
    7471        // because it is out-of-date
    75         $delete_query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
     72        $delete_query = 'DELETE FROM '.SESSIONS_TABLE;
    7673        $delete_query.= " WHERE id = '".$page['session_id']."'";
    7774        $delete_query.= ';';
     
    9794}
    9895$query_user .= ';';
    99 
    10096$row = mysql_fetch_array( mysql_query( $query_user ) );
    10197
     
    10399// of the array $user.
    104100foreach ( $infos as $info ) {
    105   $user[$info] = $row[$info];
    106   // If the field is true or false, the variable is transformed into a
    107   // boolean value.
    108   if ( $row[$info] == 'true' or $row[$info] == 'false' )
     101  if ( isset( $row[$info] ) )
    109102  {
    110     $user[$info] = get_boolean( $row[$info] );
     103    // If the field is true or false, the variable is transformed into a
     104    // boolean value.
     105    if ( $row[$info] == 'true' or $row[$info] == 'false' )
     106      $user[$info] = get_boolean( $row[$info] );
     107    else
     108      $user[$info] = $row[$info];   
     109  }
     110  else
     111  {
     112    $user[$info] = '';
    111113  }
    112114}
     115
     116// special for $user['restrictions'] array
     117$user['restrictions'] = explode( ',', $user['forbidden_categories'] );
     118if ( $user['restrictions'][0] == '' ) $user['restrictions'] = array();
    113119?>
Note: See TracChangeset for help on using the changeset viewer.