From 8de8414c869099a24e5d7c89fcb29a66886fac71 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Fri, 28 May 2010 03:46:17 +0000 Subject: [PATCH] BUGFIX: postgres and sql server compatibility --- code/BlogTree.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index caa5e36..135c43f 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -222,15 +222,20 @@ class BlogTree_Controller extends Page_Controller { } function BlogEntries($limit = null) { + require_once('Zend/Date.php'); + if($limit === null) $limit = BlogTree::$default_entries_limit; // only use freshness if no action is present (might be displaying tags or rss) if ($this->LandingPageFreshness && !$this->request->param('Action')) { - $filter = "\"BlogEntry\".\"Date\" > NOW() - INTERVAL " . $this->LandingPageFreshness; + $d = new Zend_Date(SS_Datetime::now()->getValue()); + $d->sub($this->LandingPageFreshness); + $date = $d->toString('YYYY-MM-dd'); + + $filter = "\"BlogEntry\".\"Date\" > '$date'"; } else { $filter = ''; } - // allow filtering by author field and some blogs have an authorID field which // may allow filtering by id if(isset($_GET['author']) && isset($_GET['authorID'])) {