Example #1
0
     $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() + $config['tz'] * 3600);
     $modDate = gmdate('Y-m-d H:i:s', time() + $config['tz'] * 3600);
 }
 // Upload Attachiments
 $app->sendAttachments();
 // Insert an new entry
 $app->db->beginTransaction();
 $sql = 'INSERT INTO ' . LOG_TABLE . ' ' . '(' . '`title`, ' . '`comment`, ' . '`excerpt`, ' . '`date`, ' . '`mod`, ' . '`draft`' . ') ' . 'VALUES ' . '(' . ':title, ' . ':comment, ' . ':excerpt, ' . ':date, ' . ':mod, ' . ':draft' . ')';
 $sql = $app->setDelimitedIdentifier($sql);
 $stmt = $app->db->prepare($sql);
 $res = $stmt->execute(array(':title' => $title, ':comment' => $comment, ':excerpt' => $excerpt, ':date' => $postDate, ':mod' => $modDate, ':draft' => $draftStatus));
 // Get the new entry ID.
 //        $id = $app->db->lastInsertId();
 $selectMaxSql = 'SELECT MAX(id) FROM ' . LOG_TABLE;
 $id = $app->db->query($selectMaxSql)->fetchColumn();
 // Plugin action
 $app->plugin->doAction('after-new-entry-posted', $id);
 // Add tags
 $app->addTag(LOG_TAG_MAP_TABLE, $id);
 // echo var_dump($res);
 if (!empty($res)) {
     $app->db->commit();
     if ($draftStatus == '1') {
         // If the entry is draft, move to draft page.
Example #2
0
             $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();
         $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();
     }