From 51aa293bdd77fa6a7bc65341c962655ab7ef52e7 Mon Sep 17 00:00:00 2001 From: "ctrlaltca@gmail.com" <> Date: Wed, 9 Nov 2011 22:12:14 +0000 Subject: fix #370: - deprecated TSqliteCache, use TDbCache instead - reworked the dataaccess code of demos/blog - other smalll fixes around --- demos/blog/protected/Pages/SearchPost.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'demos/blog/protected/Pages/SearchPost.php') diff --git a/demos/blog/protected/Pages/SearchPost.php b/demos/blog/protected/Pages/SearchPost.php index a824d257..dc483f9a 100644 --- a/demos/blog/protected/Pages/SearchPost.php +++ b/demos/blog/protected/Pages/SearchPost.php @@ -7,23 +7,15 @@ class SearchPost extends BlogPage public function onInit($param) { parent::onInit($param); - $this->_posts=$this->DataAccess->queryPosts( - $this->getPostFilter(), - '', + $this->_posts=$this->DataAccess->queryPostsSearch( + $this->getPostKeywords(), 'ORDER BY create_time DESC', 'LIMIT '.$this->getPageOffset().','.$this->getPageSize()); } - private function getPostFilter() + private function getPostKeywords() { - $filter='a.status=0'; - $keywords=explode(' ',$this->Request['keyword']); - foreach($keywords as $keyword) - { - if(($keyword=$this->DataAccess->escapeString(trim($keyword)))!=='') - $filter.=" AND (content LIKE '%$keyword%' OR title LIKE '%$keyword%')"; - } - return $filter; + return explode(' ',$this->Request['keyword']); } private function getPageOffset() -- cgit v1.2.3