예제 #1
0
파일: index.php 프로젝트: kaz6120/Loggix
 if (!empty($_GET['t']) || !empty($_GET['k']) || !empty($_GET['d'])) {
     $previousItemNumber = empty($_GET['p']) ? '0' : $_GET['p'];
     $date = empty($_GET['d']) ? '' : $_GET['d'];
     $expand = empty($_GET['ex']) ? '0' : $_GET['ex'];
     $pageNumberToShow = empty($_GET['pn']) ? '1' : $_GET['pn'];
     // Tag Search
     if (!empty($_GET['t'])) {
         $key = $_GET['t'];
         $params = $app->getTagSqlParams();
         $sql = $app->getTagSql($params);
         $countSql = $app->getTagHitsSql($params);
         $resultTemplate = 'tag-result.html';
         // Keyword Search
     } else {
         $key = $_GET['k'];
         $params = $app->getSearchSqlParams();
         $sql = $app->getSearchSql($params);
         $countSql = $app->getSearchHitsSql($params);
         $resultTemplate = 'search-result.html';
     }
     // Count the number of hit results
     $totalItemsCount = $app->getTotalItemsCount($countSql);
     if ($totalItemsCount !== '0') {
         // Archive By Date
         if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}/', $date) || preg_match('/^[0-9]{4}-[0-9]{2}/', $date)) {
             $result = '';
         } else {
             $item = $app->setSearchItems($totalItemsCount, $previousItemNumber, $date);
             $resultView = new Loggix_View();
             $templateVars = array('item' => $item, 'lang' => $lang);
             $resultView->assign($templateVars);