From fc0c23c9cc683cd7f3e2fbcb97a6589a5f32bb0c Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Fri, 30 Oct 2009 12:15:24 -0400 Subject: [PATCH] Don't attempt to call getImages() if we know we don't have any images to get. --- ansel/lib/Storage.php | 2 +- ansel/lib/Tags.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ansel/lib/Storage.php b/ansel/lib/Storage.php index d5f3e2455..bf9519ded 100644 --- a/ansel/lib/Storage.php +++ b/ansel/lib/Storage.php @@ -525,7 +525,7 @@ class Ansel_Storage /* First check if we want a specific gallery or a list of images */ if (!empty($params['gallery_id'])) { $sql = 'SELECT ' . $this->_getImageFields() . ' FROM ansel_images WHERE gallery_id = ' . $params['gallery_id'] . ' ORDER BY image_sort'; - } elseif (is_array($params['ids']) && count($params['ids']) > 0) { + } elseif (!empty($params['ids']) && is_array($params['ids']) && count($params['ids']) > 0) { $sql = 'SELECT ' . $this->_getImageFields() . ' FROM ansel_images WHERE image_id IN ('; $i = 1; $cnt = count($params['ids']); diff --git a/ansel/lib/Tags.php b/ansel/lib/Tags.php index 0d8d3550e..2c4fea1d9 100644 --- a/ansel/lib/Tags.php +++ b/ansel/lib/Tags.php @@ -519,7 +519,7 @@ class Ansel_Tags_Search { return $iresults; } - $images = array_values($GLOBALS['ansel_storage']->getImages($iresults['images'])); + $images = count($iresults['images']) ? array_values($GLOBALS['ansel_storage']->getImages($iresults['images'])) : array(); if (($conf['comments']['allow'] == 'all' || ($conf['comments']['allow'] == 'authenticated' && Horde_Auth::getAuth())) && $registry->hasMethod('forums/numMessagesBatch')) { -- 2.11.0