aboutsummaryrefslogtreecommitdiffstats
path: root/include/category_cats.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-02-24 11:30:30 +0000
committerplegall <plg@piwigo.org>2011-02-24 11:30:30 +0000
commitbe797aa3da9b4a16010efeab33f40862864222d2 (patch)
treecc0a226fc7d239926fd50001b0f44602ed2e4c5a /include/category_cats.inc.php
parent139360b952ff62f6a727a6b1f1e092c08b0b72d4 (diff)
bug 937: problem on empty albums (visible for admins) with a representative_picture_id defined.
git-svn-id: http://piwigo.org/svn/trunk@9365 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/category_cats.inc.php')
-rw-r--r--include/category_cats.inc.php29
1 files changed, 14 insertions, 15 deletions
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php
index 8e48927c9..4271ad9be 100644
--- a/include/category_cats.inc.php
+++ b/include/category_cats.inc.php
@@ -205,23 +205,17 @@ SELECT id, path, tn_ext, level
{
if ($row['id'] == $category['representative_picture_id'])
{
- if ($category['count_images']>0)
+ // searching a random representant among elements in sub-categories
+ $image_id = get_random_image_in_category($category);
+
+ if (isset($image_id) and !in_array($image_id, $image_ids))
{
- // searching a random representant among elements in sub-categories
- $image_id = get_random_image_in_category($category);
-
- if (isset($image_id))
- {
- if (!in_array($image_id, $image_ids))
- {
- array_push($new_image_ids, $image_id);
- }
-
- $user_representative_updates_for[ $user['id'].'#'.$category['id'] ] = $image_id;
-
- $category['representative_picture_id'] = $image_id;
- }
+ array_push($new_image_ids, $image_id);
}
+
+ $user_representative_updates_for[ $user['id'].'#'.$category['id'] ] = $image_id;
+
+ $category['representative_picture_id'] = $image_id;
}
}
unset($category);
@@ -287,6 +281,11 @@ if (count($categories) > 0)
foreach ($categories as $category)
{
+ if (0 == $category['count_images'])
+ {
+ continue;
+ }
+
$category['name'] = trigger_event(
'render_category_name',
$category['name'],