Esempio n. 1
0
     // 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']));
Esempio n. 2
0
        $res = $app->db->query($sql);
        if ($res) {
            $items = array();
            while ($item = $res->fetch()) {
                $item = $app->setEntryItems($item);
                $items[] = $item;
            }
            $templateFile = $pathToIndex . LM_Downloads::THEME_PATH . 'admin/drafts.html';
            $contentsView = new Loggix_View($templateFile);
            $contentsVars = array('items' => $items, 'lang' => $lang);
            $contentsView->assign($contentsVars);
            $item['contents'] = $contentsView->render();
        } else {
            $item['contents'] = '';
        }
        // Pager
        $countSql = 'SELECT COUNT(id) FROM ' . DOWNLOADS_META_TABLE . " WHERE draft = '1'";
        $countRes = $app->db->query($countSql);
        $hits = $countRes->fetchColumn();
        $item['pager'] = $app->getPager('', 'all', $hits, '', '1');
        /*
        $totalItemsCount = $countRes->fetchColumn();
        $item['pager'] = $app->getPager($totalItemsCount, 'all', '', '1');
        */
        $item['result'] = '';
        $item['title'] = $app->setTitle($lang['dl_draft']);
        $app->display($item, $sessionState);
    }
} else {
    header('Location: ../index.php');
}