예제 #1
0
파일: blog.php 프로젝트: ygres/sblog
 function search()
 {
     system::setParam("page", "search");
     if (!empty($_GET["text"])) {
         $words = $_GET["text"];
         $cacheID = "SEARCH_RES|{$words}";
         $this->smarty->assign("searchWord", addslashes($words));
         if (mb_strlen($words) <= 2) {
             $this->smarty->assign("smallWord", true);
             return false;
         }
         $this->smarty->setCacheID($cacheID);
         if (!$this->smarty->isCached()) {
             $res = blog::search($words);
             if ($res->num_rows > 0) {
                 $posts = $res->fetchAll();
                 $this->smarty->assign("searchRes", $posts);
             }
         }
         //this->smarty->clearCache ("main.tpl");
         //$this->smarty->clearCache ("search.tpl");
     } else {
         system::redirect('/');
     }
 }