From: Michael J. Rubinsky Date: Fri, 30 Oct 2009 16:15:24 +0000 (-0400) Subject: Don't attempt to call getImages() if we know we don't have any images to get. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=fc0c23c9cc683cd7f3e2fbcb97a6589a5f32bb0c;p=horde.git Don't attempt to call getImages() if we know we don't have any images to get. --- 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')) {