Пример #1
0
     } 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']));
         $item = $app->setEntryItems($itemArray);
         $permalinkTemplateFile = $pathToIndex . LM_Downloads::THEME_PATH . 'parmalink.html';
         $contentsView = new Loggix_View($permalinkTemplateFile);
         $contentsVars = array('session_state' => $sessionState, 'module' => $module, 'item' => $item, 'lang' => $lang);
         $contentsView->assign($contentsVars);
         $permalinkTitle = $app->setTitle(array('Downloads', $item['file_title']));
         $item = array('title' => $permalinkTitle, 'contents' => $app->plugin->applyFilters('permalink-view', $contentsView->render()), 'pager' => '', 'result' => '');
     } else {
         $e = new Loggix_Exception();
         $item = $e->getFileNotFoundMessage();
     }
     // (3) Index View (Show Recent Entries)
 } else {
     $getLatestItemsSql = 'SELECT ' . '* ' . 'FROM ' . DOWNLOADS_META_TABLE . ' AS d ' . 'WHERE ' . "d.draft = '0' " . 'ORDER BY ' . 'd.file_date DESC ' . 'LIMIT ' . $config['page_max'];
     $countTotalItemsSql = 'SELECT ' . 'COUNT(d.id) ' . 'FROM ' . DOWNLOADS_META_TABLE . ' AS d ' . 'WHERE ' . "d.draft = '0'";
     $totalItemsCount = $app->getTotalItemsCount($countTotalItemsSql);
Пример #2
0
 }
 if (isset($_GET['p'])) {
     $page = $_GET['p'];
 }
 if (isset($_GET['d'])) {
     $date = $_GET['d'];
 }
 if (isset($_GET['ex'])) {
     $expand = $_GET['ex'];
 }
 $sql = 'SELECT ' . '* ' . 'FROM ' . DOWNLOADS_META_TABLE . ' ' . 'WHERE ' . "draft = '1' " . 'ORDER BY ' . 'file_date DESC ' . 'LIMIT ' . $page . ', ' . $config['page_max'];
 $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');