Changeset 345 for trunk/include/user.inc.php
- Timestamp:
- Feb 2, 2004, 1:55:18 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/user.inc.php
r90 r345 17 17 * * 18 18 ***************************************************************************/ 19 19 20 // retrieving user informations 20 21 // $infos array is used to know the fields to retrieve in the table "users" … … 25 26 'nb_line_page', 'status', 'language', 'maxwidth', 26 27 'maxheight', 'expand', 'show_nb_comments', 'short_period', 27 'long_period', 'template' );28 'long_period', 'template', 'forbidden_categories' ); 28 29 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; 35 32 $query_done = false; 36 33 $user['is_the_guest'] = false; … … 60 57 $page['session_id'] = $session_id; 61 58 $query = 'SELECT user_id,expiration,ip'; 62 $query.= ' FROM '. PREFIX_TABLE.'sessions';59 $query.= ' FROM '.SESSIONS_TABLE; 63 60 $query.= " WHERE id = '".$page['session_id']."'"; 64 61 $query.= ';'; … … 73 70 // deletion of the session from the database, 74 71 // because it is out-of-date 75 $delete_query = 'DELETE FROM '. PREFIX_TABLE.'sessions';72 $delete_query = 'DELETE FROM '.SESSIONS_TABLE; 76 73 $delete_query.= " WHERE id = '".$page['session_id']."'"; 77 74 $delete_query.= ';'; … … 97 94 } 98 95 $query_user .= ';'; 99 100 96 $row = mysql_fetch_array( mysql_query( $query_user ) ); 101 97 … … 103 99 // of the array $user. 104 100 foreach ( $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] ) ) 109 102 { 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] = ''; 111 113 } 112 114 } 115 116 // special for $user['restrictions'] array 117 $user['restrictions'] = explode( ',', $user['forbidden_categories'] ); 118 if ( $user['restrictions'][0] == '' ) $user['restrictions'] = array(); 113 119 ?>
Note: See TracChangeset
for help on using the changeset viewer.