Beispiel #1
0
try {
    $_SERVER['QUERY_STRING'] = htmlentities($_SERVER['QUERY_STRING']);
    $app->insertSafe();
    // (1) Keyword Search, or Archive By Date
    if (!empty($_GET['c']) || !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'];
        // Keyword Search
        if (isset($_GET['k'])) {
            $key = $_GET['k'];
            $q = array('fields' => '*', 'table' => TRACKBACK_TABLE . ' AS t', 'title' => 't.title', 'comment' => 't.excerpt', 'date' => 't.date', 'draft' => 't.trash', 'group_by' => 't.blog_id');
            $resultViewFile = 'search-result.html';
            $sql = $app->getSearchSQL($q);
            $sql2 = $app->getSearchHitsSQL($q);
        }
        if ($res = $app->db->query($sql)) {
            // Get the number of hit results
            $res2 = $app->db->query($sql2);
            $totalItemsCount = count($res2->fetchAll());
            //$res2->numRows();
            //echo $totalItemsCount;
            // Archive By Date
            if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}/', $date)) {
                $contents = $app->getArchives($res);
                $pager = $app->getPager($totalItemsCount, $pageNumberToShow, $date, $expand);
                $result = '';
            } else {
                $contents = $app->getArchives($res);
                $pager = $app->getPager($totalItemsCount, $pageNumberToShow, $date, $expand);