コード例 #1
0
ファイル: mobileView.php プロジェクト: hinablue/TextCube
function printMobileEntryContentView($blogid, $entry, $keywords = array())
{
    if (doesHaveOwnership() || $entry['visibility'] >= 2 || isset($_COOKIE['GUEST_PASSWORD']) && trim($_COOKIE['GUEST_PASSWORD']) == trim($entry['password'])) {
        print getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'], $keywords);
    } else {
        ?>
	<p><?php 
        echo _text('보호된 글입니다');
        ?>
</p>
	<form method="post" action="protected/<?php 
        echo $entry['id'];
        ?>
">
		<div>
		<label for="password"><?php 
        echo _text('비밀번호');
        ?>
</label>
		<input type="password" id="password" name="password" />
		<input type="submit" value="<?php 
        echo _text('내용보기');
        ?>
" />
		</div>
	</form>
	<?php 
    }
}
コード例 #2
0
ファイル: iphoneView.php プロジェクト: hinablue/TextCube
function printIphoneEntryContentView($blogid, $entry, $keywords = array())
{
    global $blogURL;
    if (doesHaveOwnership() || $entry['visibility'] >= 2 || isset($_COOKIE['GUEST_PASSWORD']) && trim($_COOKIE['GUEST_PASSWORD']) == trim($entry['password'])) {
        $content = getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'], $keywords, 'Post', false);
        print '<div class="entry_body">' . printIphoneFreeImageResizer($content) . '</div>';
    } else {
        ?>
	<p><b><?php 
        echo _text('Protected post!');
        ?>
</b></p>
	<form id="passwordForm" class="dialog" method="post" action="<?php 
        echo $blogURL;
        ?>
/protected/<?php 
        echo $entry['id'];
        ?>
">
		<fieldset>
			<label for="password"><?php 
        echo _text('Password:'******'View Post');
        ?>
</a>
        </fieldset>
	</form>
	<?php 
    }
}
コード例 #3
0
function sendTrackback($blogid, $entryId, $url)
{
    global $defaultURL, $blog;
    requireModel('blog.entry');
    requireModel('blog.keyword');
    $entry = getEntry($blogid, $entryId);
    if (is_null($entry)) {
        return false;
    }
    $link = "{$defaultURL}/{$entryId}";
    $title = htmlspecialchars($entry['title']);
    $entry['content'] = getEntryContentView($blogid, $entryId, $entry['content'], $entry['contentformatter'], getKeywordNames($blogid));
    $excerpt = str_tag_on(UTF8::lessen(removeAllTags(stripHTML($entry['content'])), 255));
    $blogTitle = $blog['title'];
    $isNeedConvert = strpos($url, '/rserver.php?') !== false || strpos($url, 'blog.naver.com/tb') !== false || strpos($url, 'news.naver.com/tb/') !== false || strpos($url, 'blog.empas.com') !== false || strpos($url, 'blog.yahoo.com') !== false || strpos($url, 'www.blogin.com/tb/') !== false || strpos($url, 'cytb.cyworld.nate.com') !== false || strpos($url, 'www.cine21.com/Movies/tb.php') !== false;
    if ($isNeedConvert) {
        $title = UTF8::convert($title, 'EUC-KR');
        $excerpt = UTF8::convert($excerpt, 'EUC-KR');
        $blogTitle = UTF8::convert($blogTitle, 'EUC-KR');
        $content = "url=" . rawurlencode($link) . "&title=" . rawurlencode($title) . "&blog_name=" . rawurlencode($blogTitle) . "&excerpt=" . rawurlencode($excerpt);
        $request = new HTTPRequest('POST', $url);
        $request->contentType = 'application/x-www-form-urlencoded; charset=euc-kr';
        $isSuccess = $request->send($content);
    } else {
        $content = "url=" . rawurlencode($link) . "&title=" . rawurlencode($title) . "&blog_name=" . rawurlencode($blogTitle) . "&excerpt=" . rawurlencode($excerpt);
        $request = new HTTPRequest('POST', $url);
        $request->contentType = 'application/x-www-form-urlencoded; charset=utf-8';
        $isSuccess = $request->send($content);
    }
    if ($isSuccess && checkResponseXML($request->responseText) === 0) {
        //		$url = POD::escapeString(UTF8::lessenAsEncoding($url, 255));
        $trackbacklog = new TrackbackLog();
        $trackbacklog->entry = $entryId;
        $trackbacklog->url = POD::escapeString(UTF8::lessenAsEncoding($url, 255));
        $trackbacklog->add();
        //		POD::query("INSERT INTO {$database['prefix']}TrackbackLogs VALUES ($blogid, '', $entryId, '$url', UNIX_TIMESTAMP())");
        return true;
    }
    return false;
}
コード例 #4
0
ファイル: blog.feed.php プロジェクト: hinablue/TextCube
function getFeedItemByEntries($entries)
{
    global $database, $serviceURL, $defaultURL, $blog, $service;
    $channelItems = array();
    foreach ($entries as $row) {
        $entryURL = $defaultURL . '/' . ($blog['useSloganOnPost'] ? 'entry/' . rawurlencode($row['slogan']) : $row['id']);
        $content = getEntryContentView($row['blogid'], $row['id'], $row['content'], $row['contentformatter'], true, 'Post', true, true);
        $content = preg_replace('/<a href=("|\')(#[^\\1]+)\\1/i', '<a href=$1' . htmlspecialchars($entryURL) . '$2$1', $content);
        if (!$blog['publishWholeOnRSS']) {
            $content .= "<p><strong><a href=\"" . htmlspecialchars($entryURL) . "\">" . _t('글 전체보기') . "</a></strong></p>";
        } else {
            $content .= "<p><strong><a href=\"" . htmlspecialchars($entryURL) . "?commentInput=true#entry" . $row['id'] . "WriteComment\">" . _t('댓글 쓰기') . "</a></strong></p>";
        }
        $row['repliesCount'] = $row['comments'] + $row['trackbacks'];
        $item = array('id' => $row['id'], 'title' => RSSMessage($row['title']), 'link' => $entryURL, 'categories' => array(), 'description' => RSSMessage($content), 'author' => RSSMessage($row['author']), 'pubDate' => $row['published'], 'updDate' => $row['modified'], 'comments' => $entryURL . '#entry' . $row['id'] . 'comment', 'guid' => "{$defaultURL}/" . $row['id'], 'replies' => array('count' => $row['repliesCount']));
        if (!empty($row['email'])) {
            $item['email'] = RSSMessage($row['email']);
        }
        if (isset($service['useNumericURLonRSS'])) {
            if ($service['useNumericURLonRSS'] == true) {
                $item['link'] = $defaultURL . "/" . $row['id'];
            }
        }
        if (!empty($row['id'])) {
            $sql = "SELECT name, size, mime FROM {$database['prefix']}Attachments WHERE parent= {$row['id']} AND blogid = {$row['blogid']} AND enclosure = 1";
            $attaches = POD::queryRow($sql);
            if (count($attaches) > 0) {
                $item['enclosure'] = array('url' => "{$serviceURL}/attach/{$blogid}/{$attaches['name']}", 'length' => $attaches['size'], 'type' => $attaches['mime']);
            }
        }
        array_push($item['categories'], $row['categoryName']);
        $tag_result = POD::queryColumn("SELECT name \n\t\t\t\tFROM {$database['prefix']}Tags, \n\t\t\t\t\t{$database['prefix']}TagRelations \n\t\t\t\tWHERE id = tag \n\t\t\t\t\tAND entry = {$row['id']}\n\t\t\t\t\tAND blogid = {$row['blogid']}\n\t\t\t\tORDER BY name");
        foreach ($tag_result as $tag) {
            array_push($item['categories'], $tag);
        }
        array_push($channelItems, $item);
    }
    return $channelItems;
}
コード例 #5
0
ファイル: view.php プロジェクト: Avantians/Textcube
function printEntryContentView($blogid, $id, $content, $formatter, $keywords = array())
{
    print getEntryContentView($blogid, $id, $content, $formatter, $keywords);
}
コード例 #6
0
function sendTrackback($blogid, $entryId, $url)
{
    importlib('model.blog.entry');
    importlib('model.blog.keyword');
    $context = Model_Context::getInstance();
    $entry = getEntry($blogid, $entryId);
    if (is_null($entry)) {
        return false;
    }
    $link = $context->getProperty('uri.default') . "/" . $entryId;
    $title = htmlspecialchars($entry['title']);
    $entry['content'] = getEntryContentView($blogid, $entryId, $entry['content'], $entry['contentformatter'], getKeywordNames($blogid));
    $excerpt = str_tag_on(Utils_Unicode::lessen(removeAllTags(stripHTML($entry['content'])), 255));
    $blogTitle = $context->getProperty('blog.title');
    $isNeedConvert = strpos($url, '/rserver.php?') !== false || strpos($url, 'blog.naver.com/tb') !== false || strpos($url, 'news.naver.com/tb/') !== false || strpos($url, 'blog.empas.com') !== false || strpos($url, 'blog.yahoo.com') !== false || strpos($url, 'www.blogin.com/tb/') !== false || strpos($url, 'cytb.cyworld.nate.com') !== false || strpos($url, 'www.cine21.com/Movies/tb.php') !== false;
    if ($isNeedConvert) {
        $title = Utils_Unicode::convert($title, 'EUC-KR');
        $excerpt = Utils_Unicode::convert($excerpt, 'EUC-KR');
        $blogTitle = Utils_Unicode::convert($blogTitle, 'EUC-KR');
        $content = "url=" . rawurlencode($link) . "&title=" . rawurlencode($title) . "&blog_name=" . rawurlencode($blogTitle) . "&excerpt=" . rawurlencode($excerpt);
        $request = new HTTPRequest('POST', $url);
        $request->contentType = 'application/x-www-form-urlencoded; charset=euc-kr';
        $isSuccess = $request->send($content);
    } else {
        $content = "url=" . rawurlencode($link) . "&title=" . rawurlencode($title) . "&blog_name=" . rawurlencode($blogTitle) . "&excerpt=" . rawurlencode($excerpt);
        $request = new HTTPRequest('POST', $url);
        $request->contentType = 'application/x-www-form-urlencoded; charset=utf-8';
        $isSuccess = $request->send($content);
    }
    if ($isSuccess && checkResponseXML($request->responseText) === 0) {
        $trackbacklog = new TrackbackLog();
        $trackbacklog->entry = $entryId;
        $trackbacklog->url = Utils_Unicode::lessenAsEncoding($url, 255);
        $trackbacklog->add();
        return true;
    }
    return false;
}
コード例 #7
0
ファイル: feed.php プロジェクト: Avantians/Textcube
function getFeedItemByEntries($entries)
{
    $context = Model_Context::getInstance();
    $channelItems = array();
    $pool = DBModel::getInstance();
    foreach ($entries as $row) {
        $entryURL = $context->getProperty('uri.default') . '/' . ($context->getProperty('blog.useSloganOnPost') ? 'entry/' . rawurlencode($row['slogan']) : $row['id']);
        $content = getEntryContentView($row['blogid'], $row['id'], $row['content'], $row['contentformatter'], true, 'Post', true, true);
        $content = preg_replace('/<a href=("|\')(#[^\\1]+)\\1/i', '<a href=$1' . htmlspecialchars($entryURL) . '$2$1', $content);
        if ($context->getProperty('blog.publishWholeOnRSS')) {
            $content .= "<p><strong><a href=\"" . htmlspecialchars($entryURL) . "\">" . _t('글 전체보기') . "</a></strong></p>";
        } else {
            $content .= "<p><strong><a href=\"" . htmlspecialchars($entryURL) . "?commentInput=true#entry" . $row['id'] . "WriteComment\">" . _t('댓글 쓰기') . "</a></strong></p>";
        }
        $row['repliesCount'] = $row['comments'] + $row['trackbacks'];
        if (!isset($row['author']) && isset($row['userid'])) {
            $row['author'] = User::getName($row['userid']);
        }
        if (!isset($row['categoryName'])) {
            if (isset($row['categoryLabel'])) {
                $row['categoryName'] = $row['categoryLabel'];
            } else {
                $row['categoryName'] = null;
            }
        }
        $item = array('id' => $row['id'], 'title' => RSSMessage($row['title']), 'link' => $entryURL, 'categories' => array(), 'description' => RSSMessage($content), 'author' => RSSMessage($row['author']), 'pubDate' => $row['published'], 'updDate' => $row['modified'], 'comments' => $entryURL . '#entry' . $row['id'] . 'comment', 'guid' => $context->getProperty('uri.default') . "/" . $row['id'], 'replies' => array('count' => $row['repliesCount']));
        if (!empty($row['email'])) {
            $item['email'] = RSSMessage($row['email']);
        }
        if ($context->getProperty('service.useNumericURLonRSS')) {
            $item['link'] = $context->getProperty('uri.default') . "/" . $row['id'];
        }
        if (!empty($row['id'])) {
            $pool->reset("Attachments");
            $pool->setQualifier("parent", "eq", $row['id']);
            $pool->setQualifier("blogid", "eq", $row['blogid']);
            $pool->setQualifier("enclosure", "eq", 1);
            $attaches = $pool->getRow("name, size, mime");
            if (count($attaches) > 0) {
                $item['enclosure'] = array('url' => $context->getProperty('uri.service') . "/attach/{$blogid}/{$attaches['name']}", 'length' => $attaches['size'], 'type' => $attaches['mime']);
            }
        }
        array_push($item['categories'], $row['categoryName']);
        $pool->reset("Tags");
        $pool->setAlias("Tags", "t");
        $pool->setAlias("TagRelations", "r");
        $pool->join("TagRelations", "inner", array(array("t.id", "eq", "r.tag")));
        $pool->setQualifier("r.entry", "eq", $row['id']);
        $pool->setQualifier("r.blogid", "eq", $row['blogid']);
        $pool->setOrder("name", "desc");
        $tag_result = $pool->getColumn("t.name AS name");
        foreach ($tag_result as $tag) {
            array_push($item['categories'], $tag);
        }
        array_push($channelItems, $item);
    }
    return $channelItems;
}
コード例 #8
0
ファイル: keylog.php プロジェクト: Avantians/Textcube
/// Copyright (c) 2004-2015, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
// $keylog : $keylog (explanation for specific keyword)
// $entries : Posts that contain specific keyword.
$skin = new KeylogSkin($skinSetting['keylogSkin']);
$out = str_replace("[##_SKIN_head_end_##]", '<script type="text/javascript">//<![CDATA' . CRLF . 'var servicePath = "' . $context->getProperty('service.path') . '"; var blogURL = "' . $context->getProperty('uri.blog') . '"; var adminSkin = "' . $context->getProperty('panel.skin', 'canon') . '";//]]></script><script type="text/javascript" src="' . $service['resourcepath'] . '/script/common3.min.js"></script><script type="text/javascript" src="' . $service['resourcepath'] . '/script/gallery.min.js"></script>' . $skin->skin, $skin->outter);
$keylogView = $skin->keylog;
$itemsView = '';
$contentContainer = array();
foreach ($entries as $item) {
    $itemView = $skin->keylogItem;
    dress('blog_rep_link', $context->getProperty('uri.blog') . "/{$item['id']}", $itemView);
    dress('blog_rep_title', htmlspecialchars($item['title']), $itemView);
    dress('blog_rep_regdate', Timestamp::format3($item['published']), $itemView);
    if ($item['comments'] > 0) {
        dress('blog_rep_rp_cnt', "({$item['comments']})", $itemView);
    }
    $itemsView .= $itemView;
}
dress('blog_rep', $itemsView, $keylogView);
$contentContainer["keyword_{$keylog['id']}"] = getEntryContentView($blogid, $keylog['id'], $keylog['content'], $keylog['contentformatter'], array(), 'Keyword');
dress('blog_desc', setTempTag("keyword_{$keylog['id']}"), $keylogView);
dress('blog_conform', htmlspecialchars($keylog['title']), $keylogView);
dress('blog', $keylogView, $out);
dress('blog_word', htmlspecialchars($keylog['title']), $out);
dress('body_id', "tt-body-keylog", $out);
$out = revertTempTags(removeAllTags($out));
fireEvent('OBStart');
print $out;
fireEvent('OBEnd');
コード例 #9
0
ファイル: entries.php プロジェクト: Avantians/Textcube
 }
 $author = User::getName($entry['userid']);
 dress('article_rep_author', fireEvent('ViewPostAuthor', $author, $entry['id']), $entryView);
 dress('article_rep_author_link', $blogURL . "/author/" . rawurlencode($author), $entryView);
 dress('article_rep_id', $entry['id'], $entryView);
 dress('article_rep_link', $permalink, $entryView);
 dress('article_rep_rp_rssurl', $context->getProperty('uri.default') . '/rss/comment/' . $entry['id'], $entryView);
 dress('article_rep_tb_rssurl', $context->getProperty('uri.default') . '/rss/trackback/' . $entry['id'], $entryView);
 dress('article_rep_response_rssurl', $context->getProperty('uri.default') . '/rss/response/' . $entry['id'], $entryView);
 dress('article_rep_rp_atomurl', $context->getProperty('uri.default') . '/atom/comment/' . $entry['id'], $entryView);
 dress('article_rep_tb_atomurl', $context->getProperty('uri.default') . '/atom/trackback/' . $entry['id'], $entryView);
 dress('article_rep_response_atomurl', $context->getProperty('uri.default') . '/atom/response/' . $entry['id'], $entryView);
 dress('article_rep_category_body_id', getCategoryBodyIdById($blogid, $entry['category']) ? getCategoryBodyIdById($blogid, $entry['category']) : 'tt-body-category', $entryView);
 dress('article_rep_title', htmlspecialchars(fireEvent('ViewPostTitle', $entry['title'], $entry['id'])), $entryView);
 // 사용자가 작성한 본문은 interface/common/blog/end.php의 removeAllTags() 다음에 처리하기 위한 조치.
 $contentContainer["article_{$entry['id']}"] = getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'], getKeywordNames($blogid));
 dress('article_rep_desc', setTempTag("article_{$entry['id']}"), $entryView);
 dress('article_rep_category', htmlspecialchars(empty($entry['category']) ? _text('분류없음') : $entry['categoryLabel'], $entry['id']), $entryView);
 dress('article_rep_category_link', $context->getProperty('uri.blog') . "/category/" . (empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'], $service['useEncodedURL']) : $entry['category'])), $entryView);
 dress('article_rep_category_rssurl', $context->getProperty('uri.default') . "/rss/category/" . (empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'], $service['useEncodedURL']) : $entry['category'])), $entryView);
 dress('article_rep_category_atomurl', $context->getProperty('uri.default') . "/atom/category/" . (empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'], $service['useEncodedURL']) : $entry['category'])), $entryView);
 dress('article_rep_microformat_published', Timestamp::getISO8601($entry['published']), $entryView);
 dress('article_rep_microformat_updated', Timestamp::getISO8601($entry['modified']), $entryView);
 dress('article_rep_date', fireEvent('ViewPostDate', Timestamp::format5($entry['published']), $entry['published']), $entryView);
 dress('article_rep_date_modified', fireEvent('ViewPostDate', Timestamp::format5($entry['modified']), $entry['modified']), $entryView);
 dress('entry_archive_link', $context->getProperty('uri.blog') . "/archive/" . Timestamp::getDate($entry['published']), $entryView);
 if ($entry['acceptcomment'] || $entry['comments'] > 0) {
     dress('article_rep_rp_link', "loadComment({$entry['id']},1,false,false); return false", $entryView);
 } else {
     dress('article_rep_rp_link', "return false", $entryView);
 }
コード例 #10
0
ファイル: index.php プロジェクト: ragi79/Textcube
/**
 * @brief Send abstract about specific entry.
 * @see Tag, User, DBModel, Model_Context
 */
function sendAbstractToEolin()
{
    // TODO : Rewrite routines to fit Textcube 1.8 or later.
    requireModel('blog.category');
    $entryId = $_GET['entryId'];
    $context = Model_Context::getInstance();
    $blogid = $context->getProperty('blog.id');
    echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<response>\r\n";
    list($allComments, $allTrackbacks) = POD::queryRow("SELECT \n\t\t\tSUM(comments), SUM(trackbacks) \n\t\t\tFROM {$context->getProperty('database.prefix')}Entries \n\t\t\tWHERE blogid = " . $blogid . " AND draft = 0 AND visibility = 3", 'num');
    if ($entry = POD::queryRow("SELECT e.*, c.name AS categoryName \n\t\t\t\tFROM {$context->getProperty('database.prefix')}Entries e \n\t\t\t\tLEFT JOIN {$context->getProperty('database.prefix')}Categories c ON e.blogid = c.blogid AND e.category = c.id \n\t\t\t\tWHERE e.blogid = " . $blogid . " AND e.id = " . $entryId . " AND e.draft = 0 AND e.visibility = 3" . getPrivateCategoryExclusionQuery($blogid))) {
        header('Content-Type: text/xml; charset=utf-8');
        echo '<version>1.1</version>', "\r\n";
        echo '<status>1</status>', "\r\n";
        echo '<blog>', "\r\n";
        echo '<generator>' . TEXTCUBE_NAME . '/' . TEXTCUBE_VERSION . '</generator>', "\r\n";
        echo '<language>', htmlspecialchars($context->getProperty('blog.language')), '</language>', "\r\n";
        echo '<url>', htmlspecialchars($context->getProperty('uri.default')), '</url>', "\r\n";
        echo '<title>', htmlspecialchars($context->getProperty('blog.title')), '</title>', "\r\n";
        echo '<description>', htmlspecialchars($context->getProperty('blog.description')), '</description>', "\r\n";
        echo '<comments>', $allComments, '</comments>', "\r\n";
        echo '<trackbacks>', $allTrackbacks, '</trackbacks>', "\r\n";
        echo '</blog>', "\r\n";
        echo '<entry>', "\r\n";
        echo '<permalink>', htmlspecialchars($context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$entry['slogan']}" : $entry['id'])), '</permalink>', "\r\n";
        echo '<title>', htmlspecialchars($entry['title']), '</title>', "\r\n";
        echo '<content>', htmlspecialchars(getEntryContentView($blogid, $entryId, $entry['content'], $entry['contentformatter'])), '</content>', "\r\n";
        echo '<author>', htmlspecialchars(User::authorName($blogid, $entryId)), '</author>', "\r\n";
        echo '<category>', htmlspecialchars($entry['categoryName']), '</category>', "\r\n";
        $tags = Tag::getTagsWithEntryId($blogid, $entry);
        foreach ($tags as $tag) {
            echo '<tag>', htmlspecialchars($tag), '</tag>', "\r\n";
        }
        echo '<location>', htmlspecialchars($entry['location']), '</location>', "\r\n";
        echo '<comments>', $entry['comments'], '</comments>', "\r\n";
        echo '<trackbacks>', $entry['trackbacks'], '</trackbacks>', "\r\n";
        echo '<written>', Timestamp::getRFC1123($entry['published']), '</written>', "\r\n";
        foreach (getAttachments($blogid, $entry['id']) as $attachment) {
            echo '<attachment>', "\r\n";
            echo '<mimeType>', $attachment['mime'], '</mimeType>', "\r\n";
            echo '<filename>', $attachment['label'], '</filename>', "\r\n";
            echo '<length>', $attachment['size'], '</length>', "\r\n";
            echo '<url>', $context->getProperty('uri.service'), '/attachment/', $attachment['name'], '</url>', "\r\n";
            echo '</attachment>', "\r\n";
        }
        echo '</entry>', "\r\n";
    } else {
        echo '<version>1.1</version>', "\r\n", '<status>0</status>', "\r\n";
    }
    echo "</response>";
    exit;
}