[pLog-svn] r2226 - plog/branches/plog-1.0.2/class/dao
mark at devel.plogworld.net
mark at devel.plogworld.net
Wed Jun 15 03:54:21 GMT 2005
Author: mark
Date: 2005-06-15 03:54:20 +0000 (Wed, 15 Jun 2005)
New Revision: 2226
Modified:
plog/branches/plog-1.0.2/class/dao/articles.class.php
Log:
Fixed bug http://bugs.plogworld.net/view.php?id=579
Modified: plog/branches/plog-1.0.2/class/dao/articles.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/dao/articles.class.php 2005-06-15 03:53:44 UTC (rev 2225)
+++ plog/branches/plog-1.0.2/class/dao/articles.class.php 2005-06-15 03:54:20 UTC (rev 2226)
@@ -91,7 +91,7 @@
* @param blogId If set, the article must belong to the given blog
* @return Returns an Article object or 'false' otherwise.
*/
- function getBlogArticle( $artId, $blogId = -1, $includeHiddenFields = true, $date = -1, $categoryId = -1, $userId = -1, $status = POST_STATUS_ALL )
+ function getBlogArticle( $artId, $blogId = -1, $includeHiddenFields = true, $date = -1, $categoryId = -1, $userId = -1, $status = POST_STATUS_ALL, $maxDate = -1 )
{
$prefix = $this->getPrefix();
$query = "SELECT a.id, a.date,
@@ -107,15 +107,18 @@
if( $blogId != -1 )
$query .= " AND a.blog_id = ".Db::qstr($blogId);
- if( $date != -1 )
+ if( $date != -1 && $maxDate == -1 ) {
$query .= " AND a.date+0 LIKE '$date%'";
+ } elseif ( $date != -1 && $maxDate != -1 ) {
+ $query .= " AND a.date+0 >= $date AND a.date+0 <= $maxDate";
+ }
if( $userId != -1 )
$query .= " AND a.user_id = ".Db::qstr($userId);
if( $categoryId != -1 )
$query .= " AND c.id = ".Db::qstr($categoryId)." AND c.id = l.category_id AND a.id = l.article_id";
if( $status != POST_STATUS_ALL )
$query .= " AND a.status = $status;";
-
+
return $this->_getBlogArticleFromQuery( $query, $includeHiddenFields );
}
@@ -127,7 +130,7 @@
* @param blogId If set, the article must belong to the given blog
* @return Returns an Article object or 'false' otherwise.
*/
- function getBlogArticleByTitle( $artTitle, $blogId = -1, $includeHiddenFields = true, $date = -1, $categoryId = -1, $userId = -1, $status = POST_STATUS_PUBLISHED )
+ function getBlogArticleByTitle( $artTitle, $blogId = -1, $includeHiddenFields = true, $date = -1, $categoryId = -1, $userId = -1, $status = POST_STATUS_PUBLISHED, $maxDate = -1 )
{
$prefix = $this->getPrefix();
$query = "SELECT a.id, a.date,
@@ -140,8 +143,11 @@
$query .= "WHERE a.slug = '".Db::qstr($artTitle)."'";
if( $blogId != -1 )
$query .= " AND a.blog_id = ".Db::qstr($blogId);
- if( $date != -1 )
+ if( $date != -1 && $maxDate == -1 ) {
$query .= " AND a.date+0 LIKE '$date%'";
+ } elseif ( $date != -1 && $maxDate != -1 ) {
+ $query .= " AND a.date+0 >= $date AND a.date+0 <= $maxDate";
+ }
if( $userId != -1 )
$query .= " AND a.user_id = ".Db::qstr($userId);
if( $categoryId != -1 ) {
@@ -149,7 +155,7 @@
}
$query .= " AND a.status = $status;";
-
+
return $this->_getBlogArticleFromQuery( $query, $includeHiddenFields );
}
@@ -708,7 +714,7 @@
$newArticle->setId( $postId );
$this->addArticleText( $newArticle );
- // and create the link between the post and its categoriesç
+ // and create the link between the post and its categories?
$this->addPostCategoriesLink( $postId, $newArticle->getCategoryIds());
// and save the custom fields
More information about the pLog-svn
mailing list