예제 #1
0
파일: index.php 프로젝트: kaz6120/Loggix
try {
    $_SERVER['QUERY_STRING'] = htmlentities($_SERVER['QUERY_STRING']);
    // Cleanup the request array.
    $app->insertSafe();
    // (1) Search by Tag, by Keyword, and 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 = $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 = '';