コード例 #1
0
ファイル: Application.php プロジェクト: allysha/Loggix
 /**
  * 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] . '&amp;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;
 }
コード例 #2
0
ファイル: post.php プロジェクト: kaz6120/Loggix
<?php

/**
 * Post Comment Controller
 *
 * @package  Loggix_Module_Comment
 * @since    5.5.15
 * @version  9.3.17
 */
/**
 * Include Module class
 */
$pathToIndex = '../..';
require_once $pathToIndex . '/lib/Loggix/Module/Comment.php';
$app = new Loggix_Module_Comment();
$config = $app->getConfigArray();
$app->insertTagSafe();
if (isset($_POST['title'], $_POST['comment'], $_POST['user_name'], $_POST['user_pass'], $_POST['refer_id'], $_POST['parent_key']) && $_POST['title'] != '' && $_POST['comment'] != '' && $_POST['user_name'] != '' && $_POST['user_pass'] != '' && $_POST['refer_id'] != '' && $_POST['parent_key'] != '') {
    // Check if posting comment to the entry is allowed.
    $checkSql = 'SELECT ' . 'allow_comments ' . 'FROM ' . LOG_TABLE . ' ' . 'WHERE ' . "id = '" . $_POST['refer_id'] . "'";
    $checkRes = $app->db->query($checkSql);
    $checkRes = $checkRes->fetchColumn();
    $receiveComment = $checkRes == '1' ? 'allowed' : 'not_allowed';
    /**
     * Comment User Cookie
     */
    if (isset($_POST['loggix_comment_cookie'])) {
        if (isset($_POST['user_name'])) {
            $item['user_cookie']['user_name'] = $_POST['user_name'];
            setcookie('loggix_comment_user', $item['user_cookie']['user_name'], time() + 86400 * 365, '/');
        }
コード例 #3
0
ファイル: index.php プロジェクト: allysha/Loggix
<?php

/**
 * @package   Comments
 * @since     5.7.19
 * @version   9.5.18
 */
/**
 * Include Comment Module class
 */
$pathToIndex = '../..';
require_once $pathToIndex . '/lib/Loggix/Module/Comment.php';
$app = new Loggix_Module_Comment();
$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'];
            $params = array('fields' => '*', 'table' => COMMENT_TABLE . ' AS l', 'title' => 'l.title', 'comment' => 'l.comment', 'date' => 'l.date', 'draft' => 'l.trash', 'group_by' => 'l.refer_id');
            $resultTemplateFile = 'search-result.html';
            $sql = $app->getSearchSQL($params);
            $countSql = $app->getSearchHitsSQL($params);
コード例 #4
0
ファイル: edit.php プロジェクト: kaz6120/Loggix
<?php

/**
 * Edit Comment Controller
 *
 * @package   Loggix_Module_Comment
 * @since     5.5.15
 * @version   9.5.20
 */
/**
 * Include Module class
 */
$pathToIndex = '../..';
require_once $pathToIndex . '/lib/Loggix/Module/Comment.php';
$app = new Loggix_Module_Comment();
$config = $app->getConfigArray();
$sessionState = $app->getSessionState();
$app->getModuleLanguage('comment');
$app->insertTagSafe();
// Display Editor
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
    // Main Contents
    $sql = 'SELECT ' . '* ' . 'FROM ' . COMMENT_TABLE . ' ' . 'WHERE ' . 'id = :id';
    $stmt = $app->db->prepare($sql);
    $stmt->execute(array(':id' => $id));
    if ($stmt) {
        while ($row = $stmt->fetch()) {
            $item['comments']['id'] = intval($row['id']);
            $item['comments']['tid'] = intval($row['tid']);
            $item['comments']['user_name'] = htmlspecialchars($row['user_name']);
コード例 #5
0
ファイル: Comment.php プロジェクト: kaz6120/Loggix
     * Generate Recent Comments List
     *
     * @return string
     */
    public function getRecentComments()
    {
        global $pathToIndex, $lang;
        $this->getModuleLanguage('comment');
        $commentList = '';
        $sql = 'SELECT ' . 'id, tid, title, comment, ' . 'user_name, user_pass, user_uri, date, refer_id, trash ' . 'FROM ' . COMMENT_TABLE . ' ' . 'WHERE ' . 'trash = :trash ' . 'ORDER BY ' . 'date DESC ' . 'LIMIT ' . self::$config['recent_comment_max'];
        $stmt = $this->db->prepare($sql);
        $res = $stmt->execute(array(':trash' => 0));
        if ($res) {
            while ($row = $stmt->fetch()) {
                if (!in_array($row['refer_id'], $this->getDraftLogIdArray())) {
                    $userClass = in_array($row['user_name'], $this->getAdminNicknameListArray()) ? 'admin' : 'guest';
                    $targetId = $pathToIndex . '/index.php?id=' . $row['refer_id'] . '#c' . $row['id'];
                    $commentTitle = htmlspecialchars($row['title']);
                    $commentList .= '<li>' . '<a href="' . $targetId . '" class="' . $userClass . '" title="&quot;' . $commentTitle . '&quot;">' . 'From ' . htmlspecialchars($row['user_name']) . '<br />' . date('y/m/d H:i', strtotime($row['date'])) . '</a>' . "</li>\n";
                }
            }
        }
        if ($commentList == '') {
            $commentList = '<li>' . $lang['comment']['default_message'] . '</li>';
        }
        return $commentList;
    }
}
// Create a recent comments list object
$aLoggixModuleComment = new Loggix_Module_Comment();
$module['LM']['comment']['recent'] = $aLoggixModuleComment->getRecentComments();