aboutsummaryrefslogtreecommitdiffstats
path: root/admin/element_set.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/element_set.php')
-rw-r--r--admin/element_set.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/admin/element_set.php b/admin/element_set.php
index 530bbd5f5..ee9884e31 100644
--- a/admin/element_set.php
+++ b/admin/element_set.php
@@ -147,20 +147,27 @@ SELECT id
;';
$virtual_categories = array_from_query($query, 'id');
- $query = '
+ if (!empty($virtual_categories))
+ {
+ $query = '
SELECT DISTINCT(image_id)
FROM '.IMAGE_CATEGORY_TABLE.'
;';
- $all_elements = array_from_query($query, 'image_id');
-
- $query = '
+ $all_elements = array_from_query($query, 'image_id');
+
+ $query = '
SELECT DISTINCT(image_id)
FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id IN ('.implode(',', $virtual_categories).')
;';
- $linked_to_virtual = array_from_query($query, 'image_id');
+ $linked_to_virtual = array_from_query($query, 'image_id');
- $page['cat_elements_id'] = array_diff($all_elements, $linked_to_virtual);
+ $page['cat_elements_id'] = array_diff($all_elements, $linked_to_virtual);
+ }
+ else
+ {
+ $page['cat_elements_id'] = array();
+ }
}
else if ('duplicates' == $_GET['cat'])
{