// 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 { $e = new Loggix_Exception(); $item = $e->getArticleNotFoundMessage(); } // (2) Permalink } elseif (!empty($_GET['id'])) { $id = intval($_GET['id']); $getPermalinkSql = 'SELECT ' . '* ' . 'FROM ' . DOWNLOADS_META_TABLE . ' ' . 'WHERE ' . '(id = :id) AND (draft = :draft)'; $getPermalinkSql = $app->setDelimitedIdentifier($getPermalinkSql); $stmt = $app->db->prepare($getPermalinkSql); $stmt->execute(array(':id' => $id, ':draft' => 0)); $itemArray = $stmt->fetch(); if ($itemArray == true) { $item = $stmt->fetch(); $item['title_date'] = date($config['title_date_format'], strtotime($item['file_date']));