[ansel] Patch to Gallery.php
Heath S. Hendrickson
heath at outerspaceconsultants.com
Tue Jan 27 20:33:45 PST 2004
I noticed a little flaw in the logic of the getDefaultImage() function
in lib/Gallery.php. It wasn't properly handling the case where
['default'] = -1 and ['num-images'] = 0 (in cases where you had an empty
gallery, it was displaying an error where the default image thumbnail
was supposed to be, instead of displaying nothing).
Here's a patch to fix it.
heath
-------------- next part --------------
Index: lib/Gallery.php
===================================================================
RCS file: /usr/local/horde/cvs/ansel/lib/Gallery.php,v
retrieving revision 1.47
diff -u -r1.47 Gallery.php
--- lib/Gallery.php 21 Jan 2004 19:12:48 -0000 1.47
+++ lib/Gallery.php 28 Jan 2004 04:29:28 -0000
@@ -394,10 +394,14 @@
function getDefaultImage()
{
if (isset($this->data['default'])) {
- if ($this->data['default'] == '-1' && $this->data['num-images'] > 0) {
- $this->_findDefaultImage();
+ if ($this->data['default'] == '-1') {
+ if ($this->data['num-images'] > 0) {
+ $this->_findDefaultImage();
+ return $this->data['default'];
+ }
+ } else {
+ return $this->data['default'];
}
- return $this->data['default'];
}
return false;
More information about the ansel
mailing list