From 6b0b5ca92809045cbc87f4d57dd453fc385b4900 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sat, 1 Jan 2011 11:16:02 -0500 Subject: [PATCH] Fix usage of listlimt setting in blocks --- ansel/lib/Block/gallery.php | 4 +++- ansel/lib/Block/recent_comments.php | 4 +++- ansel/lib/Block/recently_added.php | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ansel/lib/Block/gallery.php b/ansel/lib/Block/gallery.php index 607e438fa..8702b0b67 100644 --- a/ansel/lib/Block/gallery.php +++ b/ansel/lib/Block/gallery.php @@ -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'); } diff --git a/ansel/lib/Block/recent_comments.php b/ansel/lib/Block/recent_comments.php index b18b51588..cc430d620 100644 --- a/ansel/lib/Block/recent_comments.php +++ b/ansel/lib/Block/recent_comments.php @@ -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'); } diff --git a/ansel/lib/Block/recently_added.php b/ansel/lib/Block/recently_added.php index 6af4caf5f..558eddf62 100644 --- a/ansel/lib/Block/recently_added.php +++ b/ansel/lib/Block/recently_added.php @@ -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'); -- 2.11.0