[Tickets #3806] NEW: Few bugs in lib/Block/gallery.php

bugs@bugs.horde.org bugs at bugs.horde.org
Thu Apr 20 21:08:14 PDT 2006


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=3806
-----------------------------------------------------------------------
 Ticket             | 3806
 Created By         | dorm at dorm.org
 Summary            | Few bugs in lib/Block/gallery.php
 Queue              | Ansel
 State              | Unconfirmed
 Priority           | 2. Medium
 Type               | Bug
 Owners             | 
-----------------------------------------------------------------------


dorm at dorm.org (2006-04-20 21:08) wrote:

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;
         }





More information about the bugs mailing list