diff options
author | z0rglub <z0rglub@piwigo.org> | 2004-01-26 23:31:56 +0000 |
---|---|---|
committer | z0rglub <z0rglub@piwigo.org> | 2004-01-26 23:31:56 +0000 |
commit | 3a07d869d0a38cdefe977ebbe5240e10759f8ec2 (patch) | |
tree | c107a1ff9ad16a1b9b666a3407087ff3d51a59a5 /admin/include/functions.php | |
parent | 12fd93447130059dc43d9815848182e187334db3 (diff) |
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
Diffstat (limited to 'admin/include/functions.php')
-rw-r--r-- | admin/include/functions.php | 25 |
1 files changed, 15 insertions, 10 deletions
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.'<br />'; $restrictions = array_merge( $restrictions, $page['plain_structure'][$category_id]['all_subcats_ids'] ); |