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
This commit is contained in:
plegall
2011-02-24 11:30:30 +00:00
parent 139360b952
commit be797aa3da

View File

@@ -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'],