From 43ab0be533e5a902a856f93d7c697b11daf2bb9b Mon Sep 17 00:00:00 2001 From: z0rglub Date: Sun, 18 Jan 2004 21:57:35 +0000 Subject: 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 --- include/user.inc.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'include') 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 -- cgit v1.2.3