From def737885ff1dbaf25c2ea192b296f89a32d33c7 Mon Sep 17 00:00:00 2001 From: z0rglub Date: Sat, 3 Jan 2004 19:31:34 +0000 Subject: user restricitions are now stored in the database git-svn-id: http://piwigo.org/svn/branches/release-1_3@241 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/user.inc.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/include/user.inc.php b/include/user.inc.php index a91a4b61b..e33809430 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,7 +25,7 @@ $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 ) { @@ -102,12 +103,21 @@ $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' ) { $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(); + } + else + { + $user[$info] = $row[$info]; + } } ?> \ No newline at end of file -- cgit v1.2.3