Beispiel #1
0
             $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']));
         $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();
Beispiel #2
0
 if (isset($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i'], $_POST['s'])) {
     $Y = $_POST['y'];
     $m = $_POST['m'];
     $d = $_POST['d'];
     $H = $_POST['h'];
     $i = $_POST['i'];
     $s = $_POST['s'];
     $postDate = $Y . '-' . $m . '-' . $d . ' ' . $H . ':' . $i . ':' . $s;
     $modDate = $Y . '-' . $m . '-' . $d . ' ' . $H . ':' . $i . ':' . $s;
 } else {
     $postDate = gmdate('Y-m-d H:i:s', time() + $cfg['tz'] * 3600);
     $modDate = gmdate('Y-m-d H:i:s', time() + $cfg['tz'] * 3600);
 }
 $app->db->beginTransaction();
 $sql = 'UPDATE ' . DOWNLOADS_META_TABLE . ' ' . 'SET ' . '`file_title` = :title, ' . '`file_comment` = :comment, ' . '`file_date` = :date, ' . '`file_mod` = :mod, ' . '`draft` = :draft ' . 'WHERE ' . 'id = :id';
 $sql = $app->setDelimitedIdentifier($sql);
 $stmt = $app->db->prepare($sql);
 $res = $stmt->execute(array(':title' => $title, ':comment' => $comment, ':date' => $postDate, ':mod' => $modDate, ':draft' => $draft, ':id' => $id));
 $app->addTag(DOWNLOADS_TAG_MAP_TABLE, $id);
 if ($res) {
     $app->sendDownloadableFile();
     $app->db->commit();
     $sql = 'SELECT ' . 'draft ' . 'FROM ' . DOWNLOADS_META_TABLE . ' ' . 'WHERE ' . 'id = :id';
     $stmt = $app->db->prepare($sql);
     $stmt->execute(array('id' => $id));
     $item = $stmt->fetch();
     if ($item['draft'] == '1') {
         header('Location: ./drafts.php');
     } else {
         header('Location: ../index.php?id=' . $id);
     }