[pLog-svn] r788 - plog/trunk/class/dao
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Fri Jan 21 21:23:10 GMT 2005
Author: oscar
Date: 2005-01-21 21:23:10 +0000 (Fri, 21 Jan 2005)
New Revision: 788
Modified:
plog/trunk/class/dao/userinfo.class.php
Log:
fixed a crash where if the avatar used by the picture had been deleted, UserInfo::getUserPicture() was returning a null object.
Modified: plog/trunk/class/dao/userinfo.class.php
===================================================================
--- plog/trunk/class/dao/userinfo.class.php 2005-01-21 19:48:32 UTC (rev 787)
+++ plog/trunk/class/dao/userinfo.class.php 2005-01-21 21:23:10 UTC (rev 788)
@@ -155,12 +155,9 @@
*/
function getPicture()
{
- if( !$this->_resourcePicture && $this->hasPicture()) {
- // we need to load the GalleryResource object from the db if we haven't done
- // it yet, but let's do it dynamically...
- include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
- $resources = new GalleryResources();
- $this->_resourcePicture = $resources->getResource( $this->_resourcePictureId );
+ // only load if this user really has a picture...
+ if( $this->_resourcePicture && $this->hasPicture()) {
+ $this->_loadPicture();
}
return $this->_resourcePicture;
@@ -173,10 +170,28 @@
*/
function hasPicture()
{
- return( $this->_resourcePictureId != 0 && $this->_resourcePictureId != "");
+ return( $this->_resourcePictureId != 0 && $this->_resourcePictureId != "" && $this->_loadPicture() != null );
}
/**
+ * @private
+ * loads the user picture. Returns a GalleryObject if successful or false otherwise
+ */
+ function _loadPicture()
+ {
+ include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
+ $resources = new GalleryResources();
+ $picture = $resources->getResource( $this->_resourcePictureId );
+
+ if( !$picture )
+ $this->_resourcePicture = null;
+ else
+ $this->_resourcePicture = $picture;
+
+ return( $this->_resourcePicture );
+ }
+
+ /**
* returns the status of the blog
*
* @return the current status of the blog
More information about the pLog-svn
mailing list