예제 #1
0
파일: index.php 프로젝트: allysha/Loggix
 $_SERVER['QUERY_STRING'] = htmlentities($_SERVER['QUERY_STRING']);
 // Cleanup the request array.
 $app->insertSafe();
 // (1) Category, Keyword Search, or Archive By Date
 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 = array('fields' => '*', 'main_table' => 'loggix_downloads_meta', 'draft' => 'draft', 'date' => 'file_date', 'map_table' => 'loggix_downloads_tag_map', 'log_id' => 'log_id', 'tag_id' => 'tag_id', 'tag_name' => 'tag_name', 'tag_table' => 'loggix_downloads_tag');
         $resultTemplate = 'tag-result.html';
         $sql = $app->getTagSql($params);
         $countSql = $app->getTagHitsSql($params);
         // Keyword Search
     } else {
         $key = $_GET['k'];
         $params = array('fields' => 'id, file_title, file_type, file_name, file_size, ' . 'file_date, file_mod, file_date, file_comment, ' . 'text_mode, file_count, draft', 'table' => 'loggix_downloads_meta AS l', 'title' => 'l.file_title', 'comment' => 'l.file_comment', 'date' => 'l.file_date', 'draft' => 'l.draft', 'group_by' => '');
         $resultTemplate = 'search-result.html';
         $sql = $app->getSearchSql($params);
         $countSql = $app->getSearchHitsSql($params);
     }
     // 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)) {
             $result = '';
         } else {