From 3a07d869d0a38cdefe977ebbe5240e10759f8ec2 Mon Sep 17 00:00:00 2001 From: z0rglub Date: Mon, 26 Jan 2004 23:31:56 +0000 Subject: during synchronization, moving the structure creation to previous the update of users forbidden categories git-svn-id: http://piwigo.org/svn/branches/release-1_3@323 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'admin') diff --git a/admin/include/functions.php b/admin/include/functions.php index 84c7a93e7..b4c12619a 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -807,11 +807,6 @@ function synchronize() { global $user_restrictions,$page,$values; - if ( !isset( $page['plain_structure'] ) ) - $page['plain_structure'] = get_plain_structure(); - if ( !isset( $page['structure'] ) ) - $page['structure'] = create_structure( '' ); - update_user_category( $page['structure'] ); // cleaning user_category table for users to update @@ -840,7 +835,10 @@ function synchronize() */ function synchronize_all_users() { - global $user_restrictions; + global $user_restrictions,$page; + + $page['plain_structure'] = get_plain_structure(); + $page['structure'] = create_structure( '' ); $user_restrictions = array(); @@ -866,8 +864,11 @@ function synchronize_all_users() */ function synchronize_user( $user_id ) { - global $user_restrictions; + global $user_restrictions,$page; + $page['plain_structure'] = get_plain_structure(); + $page['structure'] = create_structure( '' ); + $user_restrictions = array(); $user_restrictions[$user_id] = update_user_restrictions( $user_id ); synchronize(); @@ -883,8 +884,11 @@ function synchronize_user( $user_id ) */ function synchronize_group( $group_id ) { - global $user_restrictions; + global $user_restrictions,$page; + $page['plain_structure'] = get_plain_structure(); + $page['structure'] = create_structure( '' ); + $user_restrictions = array(); $query = 'SELECT id'; @@ -919,7 +923,7 @@ function update_user_restrictions( $user_id ) $query.= "'".implode( ',', $restrictions )."'"; else $query.= 'NULL'; - $query .= ' WHERE id = $user_id'; + $query .= ' WHERE id = '.$user_id; $query.= ';'; mysql_query( $query ); @@ -944,8 +948,9 @@ function get_user_all_restrictions( $user_id ) $base_restrictions=get_user_restrictions($user_id,$row['status'],true,true); - $restrictions = array(); + $restrictions = $base_restrictions; foreach ( $base_restrictions as $category_id ) { + echo $category_id.' is forbidden to user '.$user_id.'
'; $restrictions = array_merge( $restrictions, $page['plain_structure'][$category_id]['all_subcats_ids'] ); -- cgit v1.2.3