Esempio n. 1
0
 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 {
         $item = $app->setSearchItems($totalItemsCount, $previousItemNumber, $date);
         $resultView = new Loggix_View();
         $templateVars = array('item' => $item, 'lang' => $lang);
         $resultView->assign($templateVars);
         $result = $resultView->render($pathToIndex . '/theme/' . $resultTemplate);
     }
     $title = !empty($_GET['c']) ? $app->setTitle(array($item['keyword'], $lang['archive'])) : $app->setTitle(array('Downloads', $lang['archive']));
     // Title , Contents, Pager, and Results
     $item = array('title' => $title, 'contents' => $app->getArchives($sql), 'pager' => $app->getPager($totalItemsCount, $pageNumberToShow, $date, $expand), 'result' => $result);
 } else {