aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-01-18 21:57:35 +0000
committerz0rglub <z0rglub@piwigo.org>2004-01-18 21:57:35 +0000
commit43ab0be533e5a902a856f93d7c697b11daf2bb9b (patch)
treef6142da1a68ce0bedd1e13deb178a205f892a8ec
parentd6e56847b966754c7c9714d9331031a2c8bf3049 (diff)
Prevent Php warnings if some user variables are NULL
git-svn-id: http://piwigo.org/svn/branches/release-1_3@295 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/user.inc.php23
1 files changed, 12 insertions, 11 deletions
diff --git a/include/user.inc.php b/include/user.inc.php
index a640ec4eb..ba1b65dda 100644
--- a/include/user.inc.php
+++ b/include/user.inc.php
@@ -102,21 +102,22 @@ $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 ) {
- // 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] );
- }
- else if ( $info == 'forbidden_categories' )
- {
- $user[$info] = $row[$info];
- $user['restrictions'] = explode( ',', $row[$info] );
- if ( $user['restrictions'][0] == '' ) $user['restrictions'] = array();
+ // 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] = $row[$info];
+ $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