aboutsummaryrefslogtreecommitdiffstats
path: root/include/user.inc.php
diff options
context:
space:
mode:
authorgweltas <gweltas@piwigo.org>2004-02-02 00:55:18 +0000
committergweltas <gweltas@piwigo.org>2004-02-02 00:55:18 +0000
commitbef4b3e3aa8e3d54cbf8b4962b9b5d4a89b55429 (patch)
tree647b2cf07ee8451a9314e1e8aebd11d9396cb32b /include/user.inc.php
parenteea989f019f21fbd7ae4aa8e2f4a1503992c23bf (diff)
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 git-svn-id: http://piwigo.org/svn/trunk@345 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/user.inc.php')
-rw-r--r--include/user.inc.php36
1 files changed, 21 insertions, 15 deletions
diff --git a/include/user.inc.php b/include/user.inc.php
index a91a4b61b..d25f26b7a 100644
--- a/include/user.inc.php
+++ b/include/user.inc.php
@@ -16,6 +16,7 @@
* the Free Software Foundation; *
* *
***************************************************************************/
+
// retrieving user informations
// $infos array is used to know the fields to retrieve in the table "users"
// Each field becomes an information of the array $user.
@@ -24,14 +25,10 @@
$infos = array( 'id', 'username', 'mail_address', 'nb_image_line',
'nb_line_page', 'status', 'language', 'maxwidth',
'maxheight', 'expand', 'show_nb_comments', 'short_period',
- 'long_period', 'template' );
+ 'long_period', 'template', 'forbidden_categories' );
-$query_user = 'SELECT ';
-foreach ( $infos as $i => $info ) {
- if ( $i > 0 ) $query_user.= ',';
- $query_user.= $info;
-}
-$query_user.= ' FROM '.PREFIX_TABLE.'users';
+$query_user = 'SELECT '.implode( ',', $infos );
+$query_user.= ' FROM '.USERS_TABLE;
$query_done = false;
$user['is_the_guest'] = false;
@@ -59,7 +56,7 @@ if ( isset( $session_id )
{
$page['session_id'] = $session_id;
$query = 'SELECT user_id,expiration,ip';
- $query.= ' FROM '.PREFIX_TABLE.'sessions';
+ $query.= ' FROM '.SESSIONS_TABLE;
$query.= " WHERE id = '".$page['session_id']."'";
$query.= ';';
$result = mysql_query( $query );
@@ -72,7 +69,7 @@ if ( isset( $session_id )
{
// deletion of the session from the database,
// because it is out-of-date
- $delete_query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
+ $delete_query = 'DELETE FROM '.SESSIONS_TABLE;
$delete_query.= " WHERE id = '".$page['session_id']."'";
$delete_query.= ';';
mysql_query( $delete_query );
@@ -96,18 +93,27 @@ if ( !$query_done )
$user['is_the_guest'] = true;
}
$query_user .= ';';
-
$row = mysql_fetch_array( mysql_query( $query_user ) );
// affectation of each value retrieved in the users table into a variable
// of the array $user.
foreach ( $infos as $info ) {
- $user[$info] = $row[$info];
- // If the field is true or false, the variable is transformed into a
- // boolean value.
- if ( $row[$info] == 'true' or $row[$info] == 'false' )
+ if ( isset( $row[$info] ) )
{
- $user[$info] = get_boolean( $row[$info] );
+ // If the field is true or false, the variable is transformed into a
+ // boolean value.
+ if ( $row[$info] == 'true' or $row[$info] == 'false' )
+ $user[$info] = get_boolean( $row[$info] );
+ else
+ $user[$info] = $row[$info];
+ }
+ else
+ {
+ $user[$info] = '';
}
}
+
+// special for $user['restrictions'] array
+$user['restrictions'] = explode( ',', $user['forbidden_categories'] );
+if ( $user['restrictions'][0] == '' ) $user['restrictions'] = array();
?> \ No newline at end of file