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

oscar at devel.lifetype.net oscar at devel.lifetype.net
Thu Feb 16 20:37:24 GMT 2006


Author: oscar
Date: 2006-02-16 20:37:23 +0000 (Thu, 16 Feb 2006)
New Revision: 2964

Modified:
   plog/trunk/class/dao/articles.class.php
Log:
this should solve the issue with the archives in the "posts" page


Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php	2006-02-16 19:57:22 UTC (rev 2963)
+++ plog/trunk/class/dao/articles.class.php	2006-02-16 20:37:23 UTC (rev 2964)
@@ -599,8 +599,8 @@
         function getNumberPostsPerMonthAdmin( $blogId )
         {
         	$prefix = $this->getPrefix();
-			$numPostsPerMonthQuery = "SELECT date 
-			                          FROM {$prefix}articles 
+			$numPostsPerMonthQuery = "SELECT DISTINCT YEAR(date) AS year,MONTH(date) AS month
+			                          FROM {$prefix}articles
 			                          WHERE blog_id = '".Db::qstr($blogId)."'
 			                          ORDER BY YEAR(date) DESC,MONTH(date) DESC;";
 
@@ -609,8 +609,10 @@
             	return Array();
             	
             while( $row = $result->FetchRow()) {
-            	$year = substr($row["date"],0,4);
-            	$month = substr($row["date"],4,2);
+            	$year = $row["year"];
+            	$month = $row["month"];
+                if( $month < 10 )
+                    $month = "0".$month;
             	$archives[$year][$month] = 1;
             }            
 



More information about the pLog-svn mailing list