예제 #1
0
파일: drafts.php 프로젝트: kaz6120/Loggix
        $sql = 'SELECT ' . '* ' . 'FROM ' . LOG_TABLE . ' ' . 'WHERE ' . 'draft = :draft ' . 'ORDER BY ' . 'date DESC ' . 'LIMIT ' . $page . ', ' . $config['page_max'];
        $stmt = $app->db->prepare($sql);
        $res = $stmt->execute(array(':draft' => 1));
        if ($res) {
            $items = array();
            while ($item = $stmt->fetch()) {
                $item = $app->setEntryItems($item);
                $items[] = $item;
            }
            $templateFile = $pathToIndex . '/theme/admin/drafts.html';
            $contentsView = new Loggix_View($templateFile);
            $contentsVars = array('items' => $items, 'lang' => $lang);
            $contentsView->assign($contentsVars);
            //$item['contents'] = $contentsView->render();
            $item['contents'] = $app->plugin->applyFilters('permalink-view', $contentsView->render());
        } else {
            $item['contents'] = '';
        }
        // Pager
        $countSql = 'SELECT COUNT(id) FROM ' . LOG_TABLE . " WHERE draft = '1'";
        $countRes = $app->db->query($countSql);
        $totalItemsCount = $countRes->fetchColumn();
        $item['pager'] = $app->getPager($totalItemsCount, 'all', '', '1');
        $item['result'] = '';
        // Title
        $item['title'] = $app->setTitle($lang['draft']);
        $app->display($item, $sessionState);
    }
} else {
    header('Location: ../index.php');
}
예제 #2
0
파일: index.php 프로젝트: kaz6120/Loggix
     // 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 = '';
         } 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['t']) ? $app->setTitle(array('Tag', $item['keyword'])) : $app->setTitle($lang['archive']);
         // Title , Contents, Pager, and Results
         $item = array('title' => $title, 'contents' => $app->getArchives($sql), 'pager' => $app->getPager($totalItemsCount, $pageNumberToShow, $date, $expand), 'result' => $result);
         $getLastModifiedSql = $sql;
     } else {
         $e = new Loggix_Exception();
         $item = $e->getArticleNotFoundMessage();
     }
     // (2) Permalink
 } elseif (!empty($_GET['id'])) {
     $id = intval($_GET['id']);
     $getPermalinkSql = 'SELECT ' . '`id`, `title`, `comment`, `date`, `mod`, ' . '`draft`, `allow_comments`, `allow_pings` ' . 'FROM ' . LOG_TABLE . ' AS l ' . 'WHERE ' . "(l.id = '" . $id . "') AND (l.draft = '0')";
     $getPermalinkSql = $app->setDelimitedIdentifier($getPermalinkSql);
     $stmt = $app->db->prepare($getPermalinkSql);
     if ($stmt->execute() == true) {
         $itemArray = $stmt->fetch();
         $item = $app->setEntryItems($itemArray);
         $contentsView = new Loggix_View();