aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2014-03-24 20:19:22 +0000
committerplegall <plg@piwigo.org>2014-03-24 20:19:22 +0000
commit3d72b90e2d372e6eb9a290188478f64affbcfd0f (patch)
tree29fa5c0ceb54a0549e342fd7323d2c199dc58e21 /include
parentd5670ed32ff6d9ae2721e7cda8c5d309847239b5 (diff)
bug 3057: avoid warnings and SQL crash when encountering inconsistent
permissions + rewrite permissions consistancy check when setting albums to private status. git-svn-id: http://piwigo.org/svn/branches/2.6@27925 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/functions_category.inc.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 43289ca01..5a4416a18 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -538,6 +538,15 @@ FROM '.CATEGORIES_TABLE.' as c
if ( !isset( $cat['id_uppercat'] ) )
continue;
+ // Piwigo before 2.5.3 may have generated inconsistent permissions, ie
+ // private album A1/A2 permitted to user U1 but private album A1 not
+ // permitted to U1.
+ //
+ // TODO 2.7: add an upgrade script to repair permissions and remove this
+ // test
+ if ( !isset($cats[ $cat['id_uppercat'] ]))
+ continue;
+
$parent = & $cats[ $cat['id_uppercat'] ];
$parent['nb_categories']++;