aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-09-12 08:33:56 +0000
committerz0rglub <z0rglub@piwigo.org>2004-09-12 08:33:56 +0000
commit9519786fa4f2fc88f9778045904275e7591daf88 (patch)
tree8b7a79d39d079257dac49fafb46ba74773eb9812 /admin/include
parentc6e6f131fa83da48d6e96645767d3d124cf82e19 (diff)
verification of number of elements to delete in the function and not before
calling function (for delete_elements and delete_categories) git-svn-id: http://piwigo.org/svn/trunk@521 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/include/functions.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 4a38f9b05..f40889b67 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -193,6 +193,11 @@ DELETE FROM '.SITES_TABLE.'
function delete_categories($ids)
{
global $counts;
+
+ if (count($ids) == 0)
+ {
+ return;
+ }
// destruction of all the related elements
$query = '
@@ -206,10 +211,7 @@ SELECT id
{
array_push($element_ids, $row['id']);
}
- if (count($element_ids) > 0)
- {
- delete_elements($element_ids);
- }
+ delete_elements($element_ids);
// destruction of the links between images and this category
$query = '
@@ -268,6 +270,11 @@ DELETE FROM '.CATEGORIES_TABLE.'
function delete_elements($ids)
{
global $counts;
+
+ if (count($ids) == 0)
+ {
+ return;
+ }
// destruction of the comments on the image
$query = '