diff options
author | ctrlaltca@gmail.com <> | 2011-11-09 22:12:14 +0000 |
---|---|---|
committer | ctrlaltca@gmail.com <> | 2011-11-09 22:12:14 +0000 |
commit | 51aa293bdd77fa6a7bc65341c962655ab7ef52e7 (patch) | |
tree | 6638d1ce920df99d38f91c9a9b9c43f9381f8d95 /demos/blog/protected/Pages/SearchPost.php | |
parent | 5380a870b799098d7900b1098b4e9930ba71f10e (diff) |
fix #370:
- deprecated TSqliteCache, use TDbCache instead
- reworked the dataaccess code of demos/blog
- other smalll fixes around
Diffstat (limited to 'demos/blog/protected/Pages/SearchPost.php')
-rw-r--r-- | demos/blog/protected/Pages/SearchPost.php | 16 |
1 files changed, 4 insertions, 12 deletions
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()
|