[pLog-svn] r959 - plog/branches/plog-0.3.2/class/action

oscar at devel.plogworld.net oscar at devel.plogworld.net
Sun Feb 6 13:35:21 GMT 2005


Author: oscar
Date: 2005-02-06 13:35:21 +0000 (Sun, 06 Feb 2005)
New Revision: 959

Modified:
   plog/branches/plog-0.3.2/class/action/defaultaction.class.php
Log:
plog 0.3.2 did not allow to see the articles posted by one user  (parameter "userId" from the DefaultAction class) ... Believe it or not, the code wasn't even there!


Modified: plog/branches/plog-0.3.2/class/action/defaultaction.class.php
===================================================================
--- plog/branches/plog-0.3.2/class/action/defaultaction.class.php	2005-02-06 13:06:32 UTC (rev 958)
+++ plog/branches/plog-0.3.2/class/action/defaultaction.class.php	2005-02-06 13:35:21 UTC (rev 959)
@@ -8,6 +8,8 @@
     include_once( PLOG_CLASS_PATH."class/dao/blogsettings.class.php" );
     include_once( PLOG_CLASS_PATH."class/view/errorview.class.php" );
     include_once( PLOG_CLASS_PATH."class/dao/referers.class.php" );
+    include_once( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
+    include_once( PLOG_CLASS_PATH."class/data/integervalidator.class.php" );
 
     /**
      * This class represents the defaut view in our application
@@ -42,6 +44,11 @@
                 	$this->_categoryId = 0;
                 else
                 	$this->_categoryId = -1;
+                	
+            $this->_userId = $this->_request->getValue( "userId" );
+            $val = new IntegerValidator( $this->_userId );
+            if( !$val->validate())
+                $this->_userId = 0;
 
             return true;
         }
@@ -92,14 +99,20 @@
 				// if posts in the future are to be shown, we shouldn't set a maximum date
 				$blogArticles = $articles->getBlogArticles( $blogId, $this->_date,
 								$this->_postAmount, $this->_categoryId,
-								POST_STATUS_PUBLISHED, 0 );			
+								POST_STATUS_PUBLISHED, $this->_userId );			
 			}
 			else {
 				$blogArticles = $articles->getBlogArticles( $blogId, $this->_date,
 								$this->_postAmount, $this->_categoryId,
-								POST_STATUS_PUBLISHED, 0, $todayTimestamp );
+								POST_STATUS_PUBLISHED, $this->_userId, $todayTimestamp );
 			}
-
+			
+			if( $this->_categoryId > 0 ) {
+	           $categories = new ArticleCategories();
+	           $category = $categories->getCategory( $this->_categoryId, $this->_blogInfo->getId());		
+			}
+			$this->_view->setValue( "category", $category );
+    
             // if we couldn't fetch the articles, send an error and quit
             if( !$blogArticles ) {
             	$this->_view = new ErrorView( $this->_blogInfo );




More information about the pLog-svn mailing list