/** * Set Entry Items * * @param array $item * @uses getCategoryArray * @uses getCategoryIdArray * @uses smiley * @return array $item */ public function setEntryItems($item) { global $pathToIndex, $lang, $module; $item['id'] = intval($item['id']); $item['date'] = $item['date']; $item['title'] = htmlspecialchars($item['title']); $item['comment'] = $item['comment']; $item['tag'] = ''; if (isset($_GET['id'])) { foreach ($this->getTagArray() as $row) { $item['tag'] .= in_array($row[0], $this->getTagIdArray()) ? '<a href="' . $pathToIndex . '/index.php?t=' . $row[0] . '&ex=1">' . htmlspecialchars($row[1]) . '</a> ' : ''; } } // Apply Smiley $item['comment'] = $this->setSmiley($item['comment']); $item['comment'] = str_replace('href="./data', 'href="' . $pathToIndex . '/data', $item['comment']); $item['comment'] = str_replace('src="./data', 'src="' . $pathToIndex . '/data', $item['comment']); $item['comment'] = str_replace('src="./theme/images', 'src="' . $pathToIndex . '/theme/images', $item['comment']); // Apply plugin filter $item['comment'] = $this->plugin->applyFilters('entry-content', $item['comment']); // Visitor's comments if (class_exists('Loggix_Module_Comment')) { $aComment = new Loggix_Module_Comment(); $item['comments'] = $aComment->getCommentStatus($item); $module['LM']['comment']['list'] = $aComment->getCommentList($item); } // Trackback if (class_exists('Loggix_Module_Trackback')) { $aTrackback = new Loggix_Module_Trackback(); $item['trackbacks'] = $aTrackback->getTrackbackStatus($item); $module['LM']['trackback']['uri'] = $aTrackback->getTrackbackUri($item); $module['LM']['trackback']['list'] = $aTrackback->getTrackbackList($item); } // RSS if (class_exists('Loggix_Module_Rss')) { $aRss = new Loggix_Module_Rss(); $item['comment'] = $aRss->toEnclosure($item['comment']); } return $item; }
<?php /** * Receiving Trackback Ping * * @package Trackback * @uses Loggix_Application * @since 4.5.9 * @version 9.3.24 */ /** * Include Core Module class */ $pathToIndex = '../..'; require_once $pathToIndex . '/lib/Loggix/Module/Trackback.php'; $trackback = new Loggix_Module_Trackback(); $config = $trackback->getConfigArray(); $error = 0; $message = ''; $trackback->insertSafe(); if (!isset($_GET['id'])) { $error = 1; $message = 'You must set blog id!'; } else { $id = $_GET['id']; // Check if trackback is allowed $checkSql = 'SELECT ' . 'allow_pings ' . 'FROM ' . LOG_TABLE . ' ' . 'WHERE ' . 'id = :id'; $stmt = $trackback->db->prepare($checkSql); $stmt->execute(array(':id' => $id)); $checkRes = $stmt->fetchColumn(); // echo var_dump($checkRes);
} /** * Generate Recent Trackbacks List * * @return string */ public function getRecentTrackbacks() { global $pathToIndex, $lang; $this->getModuleLanguage('trackback'); $trackbackList = ''; $sql = 'SELECT ' . 'id, blog_id, title, name, date ' . 'FROM ' . TRACKBACK_TABLE . ' ' . 'ORDER BY ' . 'date DESC ' . 'LIMIT ' . self::$config['recent_trackback_max']; $stmt = $this->db->prepare($sql); $res = $stmt->execute(); if ($res) { while ($row = $stmt->fetch()) { if (!in_array($row['blog_id'], $this->getDraftLogIdArray())) { $trackbackTitle = htmlspecialchars(stripslashes($row['title'])); $trackbackList .= '<li>' . '<a href="' . $pathToIndex . '/index.php?id=' . $row['blog_id'] . '#tb' . $row['id'] . '" title=""' . $trackbackTitle . '"">' . 'From ' . htmlspecialchars(stripslashes($row['name'])) . '<br />' . date('y/m/d H:i', strtotime($row['date'])) . '</a>' . "</li>\n"; } } } if ($trackbackList == '') { $trackbackList = '<li>' . $lang['trackback']['default_message'] . '</li>'; } return $trackbackList; } } // Create a recent trackbacks list object $recentTrackbacks = new Loggix_Module_Trackback(); $module['LM']['trackback']['recent'] = $recentTrackbacks->getRecentTrackbacks();
$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. header('Location: ./drafts.php'); exit; } else { // If the entry status is public, move to published page. if (class_exists('Loggix_Module_Trackback')) { $tb = new Loggix_Module_Trackback(); $tb->sendTrackback($id); } header('Location: ../index.php?id=' . urlencode($id)); exit; } } else { echo 'Insert Error'; } } else { header('Location: ./write.php'); } } else { header('Location: ../index.php'); }
<?php /** * @package Trackback * @since 6.1.29 * @version 9.2.5 */ /** * Include Trackback Module class */ $pathToIndex = '../..'; require_once $pathToIndex . '/lib/Loggix/Module/Trackback.php'; $app = new Loggix_Module_Trackback(); $config = $app->getConfigArray(); $sessionState = $app->getSessionState(); try { $_SERVER['QUERY_STRING'] = htmlentities($_SERVER['QUERY_STRING']); $app->insertSafe(); // (1) Keyword Search, or Archive By Date if (!empty($_GET['c']) || !empty($_GET['k']) || !empty($_GET['d'])) { $previousItemNumber = empty($_GET['p']) ? '0' : $_GET['p']; $date = empty($_GET['d']) ? '' : $_GET['d']; $expand = empty($_GET['ex']) ? '0' : $_GET['ex']; $pageNumberToShow = empty($_GET['pn']) ? '1' : $_GET['pn']; // Keyword Search if (isset($_GET['k'])) { $key = $_GET['k']; $q = array('fields' => '*', 'table' => TRACKBACK_TABLE . ' AS t', 'title' => 't.title', 'comment' => 't.excerpt', 'date' => 't.date', 'draft' => 't.trash', 'group_by' => 't.blog_id'); $resultViewFile = 'search-result.html'; $sql = $app->getSearchSQL($q); $sql2 = $app->getSearchHitsSQL($q);
} $app->db->beginTransaction(); $sql = 'UPDATE ' . LOG_TABLE . ' ' . 'SET ' . '`title` = :title, ' . '`comment` = :comment, ' . '`text_mode` = :text_mode, ' . '`excerpt` = :excerpt, ' . '`date` = :date, ' . '`mod` = :mod, ' . '`draft` = :draft, ' . '`allow_comments` = :allow_comments, ' . '`allow_pings` = :allow_pings ' . 'WHERE ' . 'id = :id'; $sql = $app->setDelimitedIdentifier($sql); $stmt = $app->db->prepare($sql); $res = $stmt->execute(array(':title' => $title, ':comment' => $comment, ':text_mode' => $textMode, ':excerpt' => $excerpt, ':date' => $postDate, ':mod' => $modDate, ':draft' => $draft, ':allow_comments' => $allowComments, ':allow_pings' => $allowPings, ':id' => $id)); // Add Tag $app->addTag(LOG_TAG_MAP_TABLE, $id); if ($res) { $app->db->commit(); $sql = 'SELECT ' . 'draft ' . 'FROM ' . LOG_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 { // Send Trackback if ($draft == '0' && class_exists('Loggix_Module_Trackback')) { $aTrackback = new Loggix_Module_Trackback(); $pingStatus = $aTrackback->sendTrackback($id); } header('Location: ' . $pathToIndex . '/index.php?id=' . $id); } } } else { header('Location: ./write.php'); } } else { header('Location: ../index.php'); }
<?php /** * Delete Trackback Ping URI from SQLite Database. * * @package Loggix_Module_Trackback * @since 5.6.9 * @version 8.1.6 */ /** * Include Session class */ $pathToIndex = '../..'; require_once $pathToIndex . '/lib/Loggix/Module/Trackback.php'; $trackback = new Loggix_Module_Trackback(); $sessionState = $trackback->getSessionState(); $trackback->insertSafe(); if ($sessionState == 'on') { if (empty($_REQUEST['ping_id']) || empty($_REQUEST['article_id'])) { header('Location: ' . $pathToIndex . '/index.php'); exit; } else { $pingId = intval($_REQUEST['ping_id']); $articleId = intval($_REQUEST['article_id']); // Submit delete query $sql = 'DELETE FROM ' . TRACKBACK_TABLE . ' ' . 'WHERE ' . "id = '" . $pingId . "'"; $res = $trackback->db->query($sql); if ($res) { header('Location: ' . $pathToIndex . '/index.php?id=' . $articleId . '#trackbacks'); } }