[pLog-svn] r5519 - plog/branches/lifetype-1.2/class/gallery/dao
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Sun Jun 10 17:09:47 EDT 2007
Author: jondaley
Date: 2007-06-10 17:09:47 -0400 (Sun, 10 Jun 2007)
New Revision: 5519
Modified:
plog/branches/lifetype-1.2/class/gallery/dao/galleryalbums.class.php
Log:
fixed getAlbumByName to return false correctly. Also updated documentation to say ;name' instead of 'id'
Modified: plog/branches/lifetype-1.2/class/gallery/dao/galleryalbums.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/gallery/dao/galleryalbums.class.php 2007-06-10 20:41:15 UTC (rev 5518)
+++ plog/branches/lifetype-1.2/class/gallery/dao/galleryalbums.class.php 2007-06-10 21:09:47 UTC (rev 5519)
@@ -107,7 +107,7 @@
/**
* Returns a specific album from the database given its 'mangled name'
*
- * @param id A valid album identifier.
+ * @param name An album name
* @param ownerId (optional) The album should have the given id _and_ it should
* belong to the given user.
* @param fetchResources (optional) Whether at the same time, we should also fetch the
@@ -121,19 +121,20 @@
* shown in the main page.
* @return Returns a valid GalleryAlbum object or 'false' if the album could not be found.
*/
- function getAlbumByName( $id, $ownerId = -1, $fetchResources = true, $onlyShownAlbums = false )
- {
+ function getAlbumByName( $name, $ownerId = -1, $fetchResources = true, $onlyShownAlbums = false )
+ {
// there might be more than one with the same name...
- $albums = $this->getMany( "mangled_name", $id, CACHE_GALLERYALBUMBYNAME );
- $found = false;
+ $albums = $this->getMany( "mangled_name", $name, CACHE_GALLERYALBUMBYNAME );
+ if(!$albums){
+ return false;
+ }
foreach( $albums as $album ) {
if( $this->check( $album, $ownerId, $onlyShownAlbums )) {
- $found = true;
- break;
+ return $album;
}
}
-
- return( $album );
+
+ return false;
}
/**
@@ -145,7 +146,6 @@
return false;
if( $onlyShownAlbums && !$album->getShowAlbum())
return false;
-
return( true );
}
More information about the pLog-svn
mailing list