Fix usage of listlimt setting in blocks
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 1 Jan 2011 16:16:02 +0000 (11:16 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 1 Jan 2011 16:16:02 +0000 (11:16 -0500)
ansel/lib/Block/gallery.php
ansel/lib/Block/recent_comments.php
ansel/lib/Block/recently_added.php

index 607e438..8702b0b 100644 (file)
@@ -49,7 +49,9 @@ class Horde_Block_ansel_gallery extends Horde_Block
                             'default' => true));
 
         $storage = $GLOBALS['injector']->getInstance('Ansel_Storage');
-        if ($storage->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) {
+        if (empty($GLOBALS['conf']['gallery']['listlimit']) ||
+            ($storage->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit'])) {
+
             foreach ($storage->listGalleries() as $gal) {
                 $params['gallery']['values'][$gal->id] = $gal->get('name');
             }
index b18b515..cc430d6 100644 (file)
@@ -41,7 +41,9 @@ class Horde_Block_ansel_recent_comments extends Horde_Block
                         'default' => '__random',
                         'values' => array('all' => 'All')));
         $storage = $GLOBALS['injector']->getInstance('Ansel_Storage');
-        if ($storage->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) {
+        if (empty($GLOBALS['conf']['gallery']['listlimit']) ||
+            ($storage->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit'])) {
+
             foreach ($storage->listGalleries(array('perm' => Horde_Perms::READ)) as $id => $gal) {
                 $params['gallery']['values'][$id] = $gal->get('name');
             }
index 6af4caf..558eddf 100644 (file)
@@ -44,7 +44,9 @@ class Horde_Block_ansel_recently_added extends Horde_Block
                              'default' => 10),
         );
 
-        if ($GLOBALS['injector']->getInstance('Ansel_Storage')->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) {
+        if (empty($GLOBALS['conf']['gallery']['listlimit']) ||
+            ($GLOBALS['injector']->getInstance('Ansel_Storage')->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit'])) {
+
             foreach ($GLOBALS['injector']->getInstance('Ansel_Storage')->listGalleries(array('perm' => Horde_Perms::READ)) as $id => $gal) {
                 if (!$gal->hasPasswd() && $gal->isOldEnough()) {
                     $params['gallery']['values'][$id] = $gal->get('name');