[pLog-svn] r6118 - plog/branches/lifetype-1.2/class/dao

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Mon Dec 17 14:06:07 EST 2007


Author: jondaley
Date: 2007-12-17 14:06:07 -0500 (Mon, 17 Dec 2007)
New Revision: 6118

Modified:
   plog/branches/lifetype-1.2/class/dao/articles.class.php
Log:
check inputs before acting on them.  The big one is the first diff, where we call getMany(slug, null,...) and corrupt the cache

Modified: plog/branches/lifetype-1.2/class/dao/articles.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/articles.class.php	2007-12-17 19:04:49 UTC (rev 6117)
+++ plog/branches/lifetype-1.2/class/dao/articles.class.php	2007-12-17 19:06:07 UTC (rev 6118)
@@ -86,7 +86,11 @@
                                         $status = POST_STATUS_PUBLISHED,
 										$maxDate = -1 )
         {
-			// load all the articles with the same title
+
+            if(!$articleTitle)
+                return false;
+            
+                // load all the articles with the same title
 			$articles = $this->getMany( "slug",
 			                            $articleTitle,
 										CACHE_ARTICLES_BYNAME,
@@ -104,7 +108,7 @@
             }
 			
 			if( !$found ) {
-				$article = null;
+                return false;
 			}
 			
 			return( $article );
@@ -141,6 +145,9 @@
          */
         function getBlogNextArticle( $article )
         {
+            if(!$article)
+                return false;
+
             lt_include( PLOG_CLASS_PATH.'class/data/timestamp.class.php' );
             $blogInfo = $article->getBlogInfo();
             $blogSettings = $blogInfo->getSettings();
@@ -171,6 +178,9 @@
          */
         function getBlogPrevArticle( $article )
         {
+            if(!$article)
+                return false;
+
             lt_include( PLOG_CLASS_PATH.'class/data/timestamp.class.php' );
 
 			// we need to keep the timestamp in mind
@@ -1055,6 +1065,9 @@
 		 */
         function updateArticleNumReadsByName( $articleName )
         {
+            if(!$articleName)
+                return false;
+            
             // we have to build up the query, which will be pretty long...
             $query = "UPDATE ".$this->getPrefix()."articles SET ".
                      " num_reads = num_reads+1, date = date".



More information about the pLog-svn mailing list