Don't attempt to call getImages() if we know we don't have any images to get.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 30 Oct 2009 16:15:24 +0000 (12:15 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 30 Oct 2009 16:15:24 +0000 (12:15 -0400)
ansel/lib/Storage.php
ansel/lib/Tags.php

index d5f3e24..bf9519d 100644 (file)
@@ -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']);
index 0d8d355..2c4fea1 100644 (file)
@@ -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')) {