예제 #1
0
파일: drafts.php 프로젝트: kaz6120/Loggix
 if (isset($_GET['p'])) {
     $page = $_GET['p'];
 }
 if (isset($_GET['d'])) {
     $date = $_GET['d'];
 }
 if (isset($_GET['ex'])) {
     $expand = $_GET['ex'];
 }
 $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();
예제 #2
0
파일: index.php 프로젝트: kaz6120/Loggix
         // 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();
         $templateVars = array('session_state' => $sessionState, 'module' => $module, 'item' => $item, 'lang' => $lang);
         $contentsView->assign($templateVars);
         $template = $pathToIndex . '/theme/permalink.html';
         $titleDate = date($config['title_date_format'], strtotime($item['date']));
         $item = array('title_date' => $titleDate, 'title' => $app->setTitle($item['title']), 'contents' => $app->plugin->applyFilters('permalink-view', $contentsView->render($template)), 'pager' => '', 'result' => '');
         $getLastModifiedSql = $getPermalinkSql;
     } else {
         $e = new Loggix_Exception();
         $item = $e->getFileNotFoundMessage();
     }
     // (3) Index View (Show the Latest Entries)
 } else {
     $getLatestItemsSql = 'SELECT ' . '*' . 'FROM ' . LOG_TABLE . ' ' . 'WHERE ' . "draft = '0' " . 'ORDER BY ' . 'date DESC ' . 'LIMIT ' . $config['page_max'];
     $countTotalItemsSql = 'SELECT ' . 'COUNT(id) ' . 'FROM ' . LOG_TABLE . ' l ' . 'WHERE ' . "draft = '0'";