[pLog-CVS] plog/class/dao articles.class.php,1.24.2.2,1.24.2.3 blogs.class.php,1.13.2.1,1.13.2.2
Brought to you by:
jondaley
From: Oscar R. <phu...@us...> - 2004-06-08 18:32:53
|
Update of /cvsroot/plog/plog/class/dao In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21707/dao Modified Files: Tag: PLOG_0_3_2_DEVEL articles.class.php blogs.class.php Log Message: fixed a couple more things Index: blogs.class.php =================================================================== RCS file: /cvsroot/plog/plog/class/dao/blogs.class.php,v retrieving revision 1.13.2.1 retrieving revision 1.13.2.2 diff -C2 -d -r1.13.2.1 -r1.13.2.2 *** blogs.class.php 1 Jun 2004 19:13:17 -0000 1.13.2.1 --- blogs.class.php 8 Jun 2004 18:32:43 -0000 1.13.2.2 *************** *** 287,291 **** $blogSettings = new BlogSettings(); $query = "INSERT INTO ".$this->getPrefix()."blogs (blog,owner_id,about,settings) ". ! "VALUES ('$name',$ownerId,'".Db::qstr($about)."', '".serialize($blogSettings)."');"; $result = $this->_db->Execute( $query ); --- 287,291 ---- $blogSettings = new BlogSettings(); $query = "INSERT INTO ".$this->getPrefix()."blogs (blog,owner_id,about,settings) ". ! "VALUES ('".Db::qstr($name)."',$ownerId,'".Db::qstr($about)."', '".serialize($blogSettings)."');"; $result = $this->_db->Execute( $query ); *************** *** 294,298 **** return false; ! $query = "SELECT id FROM ".$this->getPrefix()."blogs WHERE blog = '".$name."' AND owner_id = ".$ownerId.";"; $result = $this->_db->Execute( $query ); --- 294,298 ---- return false; ! $query = "SELECT id FROM ".$this->getPrefix()."blogs WHERE blog = '".Db::qstr($name)."' AND owner_id = ".$ownerId.";"; $result = $this->_db->Execute( $query ); Index: articles.class.php =================================================================== RCS file: /cvsroot/plog/plog/class/dao/articles.class.php,v retrieving revision 1.24.2.2 retrieving revision 1.24.2.3 diff -C2 -d -r1.24.2.2 -r1.24.2.3 *** articles.class.php 1 Jun 2004 19:13:16 -0000 1.24.2.2 --- articles.class.php 8 Jun 2004 18:32:43 -0000 1.24.2.3 *************** *** 255,258 **** --- 255,261 ---- * @return A 2-dimensional associative array where the first index is the year and the second * index is the number of the month: result[2003][11] = _posts for november 2003_ + * + * @param blogId + * @param showAll Whether to include posts in the future and months that had no posts too */ function getNumberPostsPerMonth( $blogId ) *************** *** 289,292 **** --- 292,323 ---- return $archives; } + + /** + * like the one above but with a few changes, such as always showing posts in the future + * and returning all the months in the array, even if the total amount was '0' + * Only used in the "editPosts" screen of the admin interface + */ + function getNumberPostsPerMonthAdmin( $blogId ) + { + // query to get the earliest post + // this must be my longest and most complex SQL query ever :) + $numPostsPerMonthQuery = "SELECT COUNT(*) AS 'count', YEAR(date) AS 'year', + MONTH(date) AS 'month', DAYOFMONTH(date) AS 'daymonth' + FROM ".$this->getPrefix()."articles + WHERE status = 'PUBLISHED' AND blog_id = $blogId + GROUP BY YEAR(date), MONTH(date) + ORDER BY YEAR(date) DESC,MONTH(date) DESC;"; + + $result = $this->_db->Execute( $numPostsPerMonthQuery); + if( $result == false ) + return false; + + while( $row = $result->FetchRow()) { + $archives[$row["year"]][$row["month"]] = $row["count"]; + } + + return $archives; + } + /** |