[pLog-svn] r3115 - plog/trunk/class/dao

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Fri Mar 24 04:29:17 GMT 2006


Author: jondaley
Date: 2006-03-24 04:29:16 +0000 (Fri, 24 Mar 2006)
New Revision: 3115

Modified:
   plog/trunk/class/dao/articles.class.php
Log:
need to make sure articles is valid before passing it to a foreach loop

Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php	2006-03-24 04:20:16 UTC (rev 3114)
+++ plog/trunk/class/dao/articles.class.php	2006-03-24 04:29:16 UTC (rev 3115)
@@ -102,13 +102,16 @@
 										CACHE_ARTICLES_BYNAME );
 								
 			$found = false;
-			foreach( $articles as $article ) {
-				if( $this->check( $article, $date, $categoryId, $status, $userId, $maxDate )) {
-					$found = true;
-					break;
-				}
-				// if not, continue with the next...
-			}
+			if($articles){
+                foreach( $articles as $article ) {
+                    if( $this->check( $article, $date, $categoryId,
+                                      $status, $userId, $maxDate )) {
+                        $found = true;
+                        break;
+                    }
+                        // if not, continue with the next...
+                }
+            }
 			
 			if( !$found ) {
 				$article = null;



More information about the pLog-svn mailing list