6.0.0-beta1
8/14/25

[#3806] Few bugs in lib/Block/gallery.php
Summary Few bugs in lib/Block/gallery.php
Queue Ansel
Type Bug
State Resolved
Priority 2. Medium
Owners
Requester dorm (at) dorm (dot) org
Created 04/21/2006 (7055 days ago)
Due
Updated 04/23/2006 (7053 days ago)
Assigned
Resolved 04/23/2006 (7053 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
04/23/2006 01:25:39 AM Chuck Hagenbuch Comment #2
State ⇒ Resolved
Reply to this comment
Should be able to just global $registry instead. I've done that, and 
fixed the other problems as well. Thanks!
04/21/2006 04:08:13 AM dorm (at) dorm (dot) org Comment #1
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ Few bugs in lib/Block/gallery.php
Queue ⇒ Ansel
Reply to this comment
1. $registry is needed in _content() function, but lib/base.php is not 
included.  This resuls in a fatal PHP error when displaying a gallery 
that contains no photos in this block.

2. themes/graphics/error.png no longer exists, but is used in 
_content().  Should be updated to use themes/graphics/thumb-error.png.

3. _getGallery() uses incorrect class name, Ansel_Gallery in is_a() 
call to determine if a gallery has already been selected.  Should be 
is_a($this->_gallery, 'DataTreeObject_Gallery').





Here's my patch:



--- gallery.php (revision 35)

+++ gallery.php (working copy)

@@ -60,6 +60,9 @@



      function _content()

      {

+        @define('ANSEL_BASE', dirname(__FILE__) . '/../..');

+        require ANSEL_BASE . '/lib/base.php';

+

          $gallery =& $this->_getGallery();

          if (is_a($gallery, 'PEAR_Error')) {

              return $gallery;

@@ -73,7 +76,7 @@

          if ($gallery->getDefaultImage()) {

              $html .= 
Horde::img(Ansel::getImageUrl($gallery->getDefaultImage(), 'thumb', 
true), '', '', '') . '</a>';

          } else {

-            $html .= Horde::img($registry->getImageDir() . 
'/error.png', '', '', '') . '</a>';

+            $html .= Horde::img($registry->getImageDir() . 
'/thumb-error.png', '', '', '') . '</a>';

          }



          return $html . '</a></div>';

@@ -85,7 +88,7 @@

          require ANSEL_BASE . '/lib/base.php';



          // Make sure we haven't already selected a gallery.

-        if (is_a($this->_gallery, 'Ansel_Gallery')) {

+        if (is_a($this->_gallery, 'DataTreeObject_Gallery')) {

              return $this->_gallery;

          }


Saved Queries