Beispiel #1
0
function printMobileEntryListView($entries, $listid, $title, $paging, $count = 0, $header = true)
{
    $context = Model_Context::getInstance();
    $itemsView = '<ul data-role="listview" class="posts" id="' . $listid . '" title="' . $title . '" selected="false" data-inset="true">' . CRLF;
    if ($header) {
        $itemsView .= '<li class="group ui-bar ui-bar-e">' . CRLF;
        $itemsView .= '	<h3>' . $title . '</h3>' . CRLF;
        $itemsView .= '	<span class="ui-li-count">' . $count . '</span>' . CRLF;
        $itemsView .= '	<span class="ui-li-aside">' . _text('페이지') . ' ' . $paging['page'] . ' / ' . $paging['pages'] . '</span>' . CRLF;
        $itemsView .= '</li>' . CRLF;
    }
    foreach ($entries as $item) {
        $author = User::getName($item['userid']);
        if ($imageName = printMobileAttachmentExtract($item['content'])) {
            $imageSrc = printMobileImageResizer($context->getProperty('blog.id'), $imageName, 80);
        } else {
            $imageSrc = $context->getProperty('service.path') . '/resources/style/iphone/images/noPostThumb.png';
        }
        $itemsView .= '<li data-role="list-divider" role="heading" class="ui-li ui-li-divider ui-bar-b ui-btn-up-c" style="font-size:8pt;font-weight:normal">';
        $itemsView .= '	' . Timestamp::format5($item['published']) . '</li>' . CRLF;
        $itemsView .= '<li class="post_item">' . CRLF;
        $itemsView .= '	<a href="' . $context->getProperty('uri.blog') . '/entry/' . $item['id'] . '" class="link">' . CRLF;
        $itemsView .= '	<img src="' . $imageSrc . '"  />' . CRLF;
        $itemsView .= '	<h3>' . fireEvent('ViewListTitle', htmlspecialchars($item['title'])) . '</h3>' . CRLF;
        $itemsView .= '	<p class="ui-li-count"> ' . _textf('댓글 %1개', $item['comments'] > 0 ? $item['comments'] : 0) . '</p>' . CRLF;
        if (!empty($item['content'])) {
            $itemsView .= '	<p>' . htmlspecialchars(Utils_Unicode::lessenAsEm(removeAllTags(stripHTML($item['content'])), 150)) . '</p>' . CRLF;
        }
        $itemsView .= '	</a>' . CRLF;
        $itemsView .= '</li>' . CRLF;
    }
    $itemsView .= '</ul>' . CRLF;
    return $itemsView;
}
Beispiel #2
0
function FM_Textile_summary($blogid, $id, $content, $keywords = array(), $useAbsolutePath = true)
{
    $context = Model_Context::getInstance();
    $view = FM_Textile_format($blogid, $id, $content, $keywords, $useAbsolutePath, true);
    if (!$context->getProperty("blog.publishWholeOnRSS")) {
        $view = Utils_Unicode::lessen(removeAllTags(stripHTML($view)), 255);
    }
    return $view;
}
Beispiel #3
0
function FM_TTML_summary($blogid, $id, $content, $keywords = array(), $useAbsolutePath = true)
{
    global $blog;
    $view = FM_TTML_format($blogid, $id, $content, $keywords, $useAbsolutePath, true);
    if (!$blog['publishWholeOnRSS']) {
        $view = Utils_Unicode::lessen(removeAllTags(stripHTML($view)), 255);
    }
    return $view;
}
Beispiel #4
0
        ?>
/owner/<?php 
        echo $editmode;
        ?>
/edit/<?php 
        echo $entryModifyLink;
        ?>
'<?php 
        echo $entry['draft'] ? "+(confirm('" . _t('임시 저장본을 보시겠습니까?') . "') ? '?draft' : '')" : '';
        ?>
; document.getElementById('list-form').submit(); return false;"><?php 
        echo htmlspecialchars($entry['title']);
        ?>
</a>
												<span class="description"><?php 
        echo $contentLength > 0 ? Utils_Unicode::lessenAsEm(removeAllTags(strip_tags($entry['content'])), $contentLength) : '';
        ?>
</span>
											</td>
											<td class="category">
<?php 
        if ($entry['category'] == 0) {
            ?>
<a id="category_<?php 
            echo $entry['id'];
            ?>
" class="uncategorized" href="<?php 
            echo $context->getProperty('uri.blog');
            ?>
/owner/entry?category=-10"><?php 
            echo _t('분류 없음');
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;
}
Beispiel #6
0
                }
                $skin = new Skin($context->getProperty('skin.skin'));
                printHtmlHeader();
                ?>
<script type="text/javascript">
	//<![CDATA[
		alert("<?php 
                echo _text('댓글이 등록되었습니다.');
                ?>
");
<?php 
                notifyComment();
                $entry = array();
                $entry['id'] = $comment['entry'];
                $entry['slogan'] = getSloganById($blogid, $entry['id']);
                $tempComments = revertTempTags(removeAllTags(getCommentView($entry, $skin)));
                $tempRecentComments = revertTempTags(getRecentCommentsView(getRecentComments($blogid), null, $skin->recentCommentItem));
                ?>
		if (opener == null) {
			loader = parent;
		} else {
			loader = opener;
		}
		try {
			var obj = loader.document.getElementById("entry<?php 
                echo $comment['entry'];
                ?>
Comment");
			obj.innerHTML = "<?php 
                echo str_innerHTML($tempComments);
                ?>
Beispiel #7
0
                    $pool->setQualifier('visibility', 'equals', 3);
                    $pool->setQualifier('acceptcomment', 'equals', 1);
                    $row = $pool->getAll('*');
                    if (!empty($row)) {
                        sendCommentPing($entryId, $context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$row['slogan']}" : $entryId), is_null($user) ? $comment['name'] : $user['name'], is_null($user) ? $comment['homepage'] : $user['homepage']);
                    }
                }
                importlib('model.blog.skin');
                $skin = new Skin($context->getProperty('skin.skin'));
                if ($entryId > 0) {
                    $commentBlock = getCommentView($entry, $skin);
                    dress('article_rep_id', $entryId, $commentBlock);
                    $commentBlock = escapeCData(revertTempTags(removeAllTags($commentBlock)));
                    $recentCommentBlock = escapeCData(revertTempTags(getRecentCommentsView(getRecentComments($blogid), null, $skin->recentCommentItem)));
                    $commentCount = getCommentCount($blogid, $entryId);
                    $commentCount = $commentCount > 0 ? $commentCount : 0;
                    list($tempTag, $commentView) = getCommentCountPart($commentCount, $skin);
                } else {
                    $commentView = '';
                    $commentBlock = getCommentView($entry, $skin);
                    dress('article_rep_id', $entryId, $commentBlock);
                    $commentBlock = escapeCData(revertTempTags(removeAllTags($commentBlock)));
                    $commentCount = 0;
                    $recentCommentBlock = escapeCData(revertTempTags(getRecentCommentsView(getRecentComments($blogid), $skin->recentComment, $skin->recentCommentItem)));
                }
                Respond::PrintResult(array('error' => 0, 'commentView' => $commentView, 'commentCount' => $commentCount, 'commentBlock' => $commentBlock, 'recentCommentBlock' => $recentCommentBlock));
                exit;
            }
        }
    }
}
Beispiel #8
0
function FM_default_summary($blogid, $id, $content, $keywords = array(), $useAbsolutePath = false)
{
    if (!$blog['publishWholeOnRSS']) {
        $content = Utils_Unicode::lessen(removeAllTags(stripHTML($content)), 255);
    }
    return $content;
}
Beispiel #9
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;
}
Beispiel #10
0
 if (isset($_GET['category'])) {
     // category exists
     if (Validator::isInteger($_GET['category'], 0)) {
         list($entries, $paging) = getEntryWithPaging($blogid, $suri['id'], false, $_GET['category']);
     }
 } else {
     // Just normal entry view
     list($entries, $paging) = getEntryWithPaging($blogid, $suri['id']);
 }
 if (isset($_POST['partial'])) {
     // Partial output.
     header('Content-Type: text/plain; charset=utf-8');
     $skin = new Skin($context->getProperty('skin.skin'));
     $view = '[##_article_rep_##]';
     require ROOT . '/interface/common/blog/entries.php';
     $view = removeAllTags($view);
     if ($view != '[##_article_rep_##]') {
         print $view;
     }
 } else {
     require ROOT . '/interface/common/blog/begin.php';
     if (empty($entries)) {
         header('HTTP/1.1 404 Not Found');
         if (empty($skin->pageError)) {
             dress('article_rep', '<div class="TCwarning">' . _text('존재하지 않는 페이지입니다.') . '</div>', $view);
         } else {
             dress('article_rep', NULL, $view);
             dress('page_error', $skin->pageError, $view);
         }
         unset($paging);
     } else {
Beispiel #11
0
function MT_Cover_getRecentEntries($parameters)
{
    global $skin;
    $context = Model_Context::getInstance();
    $data = $context->getProperty('plugin.config');
    importlib("model.blog.entry");
    importlib("model.blog.tag");
    $data['coverMode'] = !isset($data['coverMode']) ? 1 : $data['coverMode'];
    if (Utils_Misc::isMetaBlog() != true) {
        $data['coverMode'] = 1;
    }
    $data['screenshot'] = !isset($data['screenshot']) ? 1 : $data['screenshot'];
    $data['screenshotSize'] = !isset($data['screenshotSize']) ? 90 : $data['screenshotSize'];
    $data['paging'] = !isset($data['paging']) ? '2' : $data['paging'];
    $data['contentLength'] = !isset($data['contentLength']) ? 250 : $data['contentLength'];
    if (isset($parameters['preview'])) {
        // preview mode
        $retval = '표지에 최신 글 목록을 추가합니다.';
        return htmlspecialchars($retval);
    }
    $entryLength = isset($parameters['entryLength']) ? $parameters['entryLength'] : 10;
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail")) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail");
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail", 0777);
    }
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id'))) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id'));
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id'), 0777);
    }
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id') . "/coverPostThumbnail/")) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id') . "/coverPostThumbnail/");
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id') . "/coverPostThumbnail/", 0777);
    }
    $page = $data['paging'] == '1' && !empty($_GET['page']) ? intval($_GET['page']) : 1;
    $cache = new PageCache();
    $cache->name = 'MT_Cover_RecentPS';
    if ($cache->load()) {
        //If successful loads
        $cache->contents = unserialize($cache->contents);
        // If coverpage is single mode OR coverpage is coverblog and cache is not expired, return cache contents.
        if (($data['coverMode'] == 1 || $data['coverMode'] == 2) && array_key_exists($page, $cache->contents) && Timestamp::getUNIXtime() - $cache->dbContents < 300) {
            return $cache->contents[$page];
        }
    }
    $pool = DBModel::getInstance();
    $pool->reset("BlogSettings");
    $pool->setQualifier("name", "eq", 'visibility', true);
    $pool->setQualifier("value", "<", 2);
    $privateBlogId = $pool->getCell("blogid");
    $pool->reset("Entries");
    $pool->join("Categories", "left", array(array("e.blogid", "eq", "c.blogid"), array("e.category", "eq", "c.id")));
    $pool->setQualifier("e.draft", "eq", 0);
    $pool->setQualifier("e.category", "beq", 0);
    if ($privateBlogId) {
        $pool->setQualifier("e.blogid", "hasnoneof", $privateBlogId);
    }
    if (Utils_Misc::isMetaBlog() == true && doesHaveOwnership() && $context->getProperty('service.type', 'single') != 'single') {
        $pool->setQualifier("e.visibility", ">", 1);
        $pool->setQualifierSet(array("c.visibility", ">", 1), "OR", array("e.category", "eq", 0));
    } else {
        if (!doesHaveOwnership()) {
            $pool->setQualifier("e.visibility", ">", 1);
            $pool->setQualifierSet(array("c.visibility", ">", 1), "OR", array("e.category", "eq", 0));
        }
    }
    if ($data['coverMode'] != 2) {
        $pool->setQualifier("e.blogid", "eq", $context->getProperty("blog.id"));
    }
    list($entries, $paging) = Paging::fetch($pool, $page, $entryLength);
    $html = '';
    foreach ((array) $entries as $entry) {
        $tagLabelView = "";
        $blogid = $data['coverMode'] == 2 ? $entry['blogid'] : $context->getProperty('blog.id');
        $entryTags = getTags($blogid, $entry['id']);
        $defaultURL = getDefaultURL($blogid);
        if (sizeof($entryTags) > 0) {
            $tags = array();
            foreach ($entryTags as $entryTag) {
                $tags[$entryTag['name']] = "<a href=\"{$defaultURL}/tag/" . (Setting::getBlogSettingGlobal('useSloganOnTag', true) ? URL::encode($entryTag['name'], $service['useEncodedURL']) : $entryTag['id']) . '">' . htmlspecialchars($entryTag['name']) . '</a>';
            }
            $tagLabelView = "<div class=\"post_tags\"><span>TAG : </span>" . implode(",\r\n", array_values($tags)) . "</div>";
        }
        if (empty($entry['category'])) {
            $entry['label'] = _text('분류없음');
            $entry['link'] = "{$defaultURL}/category";
        } else {
            $entry['link'] = "{$defaultURL}/category/" . (Setting::getBlogSettingGlobal('useSloganOnCategory', true) ? URL::encode($entry['label'], $service['useEncodedURL']) : $entry['category']);
        }
        $permalink = "{$defaultURL}/" . (Setting::getBlogSettingGlobal('useSloganOnPost', true) ? "entry/" . URL::encode($entry['slogan'], $context->getProperty('service.useEncodedURL', false)) : $entry['id']);
        $html .= '<div class="coverpost">' . CRLF;
        if ($imageName = MT_Cover_getAttachmentExtract($entry['content'])) {
            if (($tempImageSrc = MT_Cover_getImageResizer($blogid, $imageName, $data['screenshotSize'])) && $data['screenshot'] == 1) {
                $html .= '<div class="img_preview"><a href="' . $permalink . '"><img src="' . $tempImageSrc . '" alt="" /></a></div>' . CRLF;
            }
        }
        $html .= '	<div class="content_box">';
        $html .= '		<h2><a href="' . $permalink . '">' . htmlspecialchars($entry['title']) . '</a></h2>' . CRLF;
        $html .= '		<div class="post_info">' . CRLF;
        $html .= '			<span class="category"><a href="' . htmlspecialchars($entry['link']) . '">' . htmlspecialchars($entry['label']) . '</a></span>' . CRLF;
        $html .= '			<span class="date">' . Timestamp::format5($entry['published']) . '</span>' . CRLF;
        $html .= '			<span class="author"><span class="preposition">by </span>' . User::getName($entry['userid']) . '</span>' . CRLF;
        $html .= '		</div>' . CRLF;
        $html .= '		<div class="post_content">' . htmlspecialchars(Utils_Unicode::lessenAsEm(removeAllTags(stripHTML($entry['content'])), $data['contentLength'])) . '</div>' . CRLF;
        $html .= $tagLabelView;
        $html .= '		<div class="clear"></div>' . CRLF;
        $html .= '	</div>';
        $html .= '</div>' . CRLF;
    }
    if ($data['paging'] == '1') {
        $paging['page'] = $page;
        $paging['total'] = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}Entries e WHERE {$multiple} e.draft = 0 {$visibility} AND e.category >= 0");
        $html .= Paging::getPagingView($paging, $skin->paging, $skin->pagingItem) . CRLF;
        $html .= '<script type="text/javascript">' . CRLF;
        $html .= '//<![CDATA[' . CRLF;
        if ($paging['page'] > 1) {
            $html .= 'var prevURL = "' . $paging['url'] . '?page=' . ($paging['page'] - 1) . '"' . CRLF;
        }
        if ($paging['page'] < $paging['total']) {
            $html .= 'var nextURL = "' . $paging['url'] . '?page=' . ($paging['page'] + 1) . '"' . CRLF;
        }
        $html .= '//]]>' . CRLF;
        $html .= '</script>';
    }
    $target = $html;
    $cache->contents[$page] = $target;
    $cache->contents = serialize($cache->contents);
    $cache->dbContents = Timestamp::getUNIXtime();
    $cache->update();
    unset($cache);
    return $target;
}
Beispiel #12
0
function MT_Cover_getRecentEntries($parameters)
{
    global $database, $blog, $service, $serviceURL, $suri, $configVal, $defaultURL, $skin;
    requireModel("blog.entry");
    requireModel("blog.tag");
    $data = Setting::fetchConfigVal($configVal);
    $data['coverMode'] = !isset($data['coverMode']) ? 1 : $data['coverMode'];
    if (Misc::isMetaBlog() != true) {
        $data['coverMode'] = 1;
    }
    $data['screenshot'] = !isset($data['screenshot']) ? 1 : $data['screenshot'];
    $data['screenshotSize'] = !isset($data['screenshotSize']) ? 90 : $data['screenshotSize'];
    $data['paging'] = !isset($data['paging']) ? '2' : $data['paging'];
    $data['contentLength'] = !isset($data['contentLength']) ? 250 : $data['contentLength'];
    if (isset($parameters['preview'])) {
        // preview mode
        $retval = '표지에 최신 글 목록을 추가합니다.';
        return htmlspecialchars($retval);
    }
    $entryLength = isset($parameters['entryLength']) ? $parameters['entryLength'] : 10;
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail")) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail");
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail", 0777);
    }
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId())) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId());
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId(), 0777);
    }
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId() . "/coverPostThumbnail/")) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId() . "/coverPostThumbnail/");
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId() . "/coverPostThumbnail/", 0777);
    }
    $page = $data['paging'] == '1' && !empty($_GET['page']) ? intval($_GET['page']) : 1;
    $cache = new PageCache();
    $cache->name = 'MT_Cover_RecentPS';
    if ($cache->load()) {
        //If successful loads
        $cache->contents = unserialize($cache->contents);
        // If coverpage is single mode OR coverpage is coverblog and cache is not expired, return cache contents.
        if (($data['coverMode'] == 1 || $data['coverMode'] == 2) && array_key_exists($page, $cache->contents) && Timestamp::getUNIXtime() - $cache->dbContents < 300) {
            return $cache->contents[$page];
        }
    }
    if (Misc::isMetaBlog() == true && doesHaveOwnership() && $service['type'] != 'single') {
        $visibility = 'AND e.visibility > 1 AND (c.visibility > 1 OR e.category = 0)';
    } else {
        $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 1 AND (c.visibility > 1 OR e.category = 0)';
    }
    $multiple = $data['coverMode'] == 2 ? '' : 'e.blogid = ' . getBlogId() . ' AND';
    $privateBlogId = POD::queryColumn("SELECT blogid \n\t\tFROM {$database['prefix']}BlogSettings\n\t\tWHERE name = 'visibility'\n\t\tAND value < 2");
    if (!empty($privateBlogId)) {
        $privateBlogs = ' AND e.blogid NOT IN (' . implode(',', $privateBlogId) . ')';
    } else {
        $privateBlogs = '';
    }
    list($entries, $paging) = Paging::fetch("SELECT e.blogid, e.id, e.userid, e.title, e.content, e.slogan, e.category, e.published, e.contentformatter, c.label\n\t\tFROM {$database['prefix']}Entries e\n\t\tLEFT JOIN {$database['prefix']}Categories c ON e.blogid = c.blogid AND e.category = c.id\n\t\tWHERE {$multiple} e.draft = 0 {$visibility} AND e.category >= 0 {$privateBlogs}\n\t\tORDER BY published DESC", $page, $entryLength);
    $html = '';
    foreach ((array) $entries as $entry) {
        $tagLabelView = "";
        $blogid = $data['coverMode'] == 2 ? $entry['blogid'] : getBlogId();
        $entryTags = getTags($blogid, $entry['id']);
        $defaultURL = getDefaultURL($blogid);
        if (sizeof($entryTags) > 0) {
            $tags = array();
            foreach ($entryTags as $entryTag) {
                $tags[$entryTag['name']] = "<a href=\"{$defaultURL}/tag/" . (Setting::getBlogSettingGlobal('useSloganOnTag', true) ? URL::encode($entryTag['name'], $service['useEncodedURL']) : $entryTag['id']) . '">' . htmlspecialchars($entryTag['name']) . '</a>';
            }
            $tagLabelView = "<div class=\"post_tags\"><span>TAG : </span>" . implode(",\r\n", array_values($tags)) . "</div>";
        }
        if (empty($entry['category'])) {
            $entry['label'] = _text('분류없음');
            $entry['link'] = "{$defaultURL}/category";
        } else {
            $entry['link'] = "{$defaultURL}/category/" . (Setting::getBlogSettingGlobal('useSloganOnCategory', true) ? URL::encode($entry['label'], $service['useEncodedURL']) : $entry['category']);
        }
        $permalink = "{$defaultURL}/" . (Setting::getBlogSettingGlobal('useSloganOnPost', true) ? "entry/" . URL::encode($entry['slogan'], $service['useEncodedURL']) : $entry['id']);
        $html .= '<div class="coverpost">' . CRLF;
        if ($imageName = MT_Cover_getAttachmentExtract($entry['content'])) {
            if (($tempImageSrc = MT_Cover_getImageResizer($blogid, $imageName, $data['screenshotSize'])) && $data['screenshot'] == 1) {
                $html .= '<div class="img_preview"><a href="' . $permalink . '"><img src="' . $tempImageSrc . '" alt="" /></a></div>' . CRLF;
            }
        }
        $html .= '	<div class="content_box">';
        $html .= '		<h2><a href="' . $permalink . '">' . htmlspecialchars($entry['title']) . '</a></h2>' . CRLF;
        $html .= '		<div class="post_info">' . CRLF;
        $html .= '			<span class="category"><a href="' . htmlspecialchars($entry['link']) . '">' . htmlspecialchars($entry['label']) . '</a></span>' . CRLF;
        $html .= '			<span class="date">' . Timestamp::format5($entry['published']) . '</span>' . CRLF;
        $html .= '			<span class="author"><span class="preposition">by </span>' . User::getName($entry['userid']) . '</span>' . CRLF;
        $html .= '		</div>' . CRLF;
        $html .= '		<div class="post_content">' . htmlspecialchars(Utils_Unicode::lessenAsEm(removeAllTags(stripHTML($entry['content'])), $data['contentLength'])) . '</div>' . CRLF;
        $html .= $tagLabelView;
        $html .= '		<div class="clear"></div>' . CRLF;
        $html .= '	</div>';
        $html .= '</div>' . CRLF;
    }
    if ($data['paging'] == '1') {
        $paging['page'] = $page;
        $paging['total'] = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}Entries e WHERE {$multiple} e.draft = 0 {$visibility} AND e.category >= 0");
        $html .= getPagingView($paging, $skin->paging, $skin->pagingItem) . CRLF;
        $html .= '<script type="text/javascript">' . CRLF;
        $html .= '//<![CDATA[' . CRLF;
        if ($paging['page'] > 1) {
            $html .= 'var prevURL = "' . $paging['url'] . '?page=' . ($paging['page'] - 1) . '"' . CRLF;
        }
        if ($paging['page'] < $paging['total']) {
            $html .= 'var nextURL = "' . $paging['url'] . '?page=' . ($paging['page'] + 1) . '"' . CRLF;
        }
        $html .= '//]]>' . CRLF;
        $html .= '</script>';
    }
    $target = $html;
    $cache->contents[$page] = $target;
    $cache->contents = serialize($cache->contents);
    $cache->dbContents = Timestamp::getUNIXtime();
    $cache->update();
    unset($cache);
    return $target;
}
Beispiel #13
0
if (!empty($sidebarElements)) {
    foreach ($sidebarElements as $element) {
        $pluginData = $skin->sidebarStorage[$element];
        $plugin = $pluginData['plugin'];
        include_once ROOT . "/plugins/{$plugin}/index.php";
        $pluginURL = $context->getProperty('service.path') . "/plugins/{$plugin}";
        // LEGACY SUPPORT
        $pluginPath = ROOT . "/plugins/{$plugin}";
        // LEGACY SUPPORT
        $context->setProperty('plugin.uri', $context->getProperty('service.path') . "/plugins/{$plugin}");
        $context->setProperty('plugin.path', ROOT . "/plugins/{$plugin}");
        $context->setProperty('plugin.name', ROOT . $plugin);
        if (!empty($configMappings[$plugin]['config'])) {
            $configVal = getCurrentSetting($plugin);
            // LEGACY SUPPORT
            $context->setProperty('plugin.config', Setting::fetchConfigVal($configVal));
        } else {
            $configVal = '';
            $context->setProperty('plugin.config', array());
        }
        dress($element, call_user_func($pluginData['handler'], $pluginData['parameters']), $view);
    }
}
// Coverpage dressing
$coverpageElements = array_keys($skin->coverpageStorage);
foreach ($coverpageElements as $element) {
    dress($element, $skin->coverpageStorage[$element], $view);
}
$view = revertTempTags(removeAllTags($view));
print $view;
$gCacheStorage->save();
Beispiel #14
0
/// 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');
Beispiel #15
0
                }
            }
        }
        if (count($entries) > 1 || count($entries) == 1 && empty($suri['value'])) {
            unset($totalTags);
        }
        if (count($entries) == 1) {
            // Adds trackback RDF
            $info = array();
            $info['title'] = htmlspecialchars($entries[0]['title']);
            $info['permalink'] = $permalink;
            $info['trackbackURL'] = $context->getProperty('uri.default') . "/trackback/" . $entries[0]['id'];
            $entriesView .= getTrackbackRDFView($blogid, $info);
        }
        if (isset($cache)) {
            $cache->contents = revertTempTags(removeAllTags($entriesView));
            if (isset($paging)) {
                $cache->dbContents = $paging;
            }
            $cache->update();
        }
    }
}
$view = str_replace("[##_article_rep_##]", "<div class=\"hfeed\">[##_article_rep_##]</div>", $view);
if (isset($isKeylog) && $isKeylog) {
    dressInsertBefore('list', $entriesView, $view);
    $isKeylog = false;
} else {
    if (isset($cache->contents)) {
        dressInsertBefore('article_rep', $entriesView, $view);
    } else {
Beispiel #16
0
function FM_default_summary($blogid, $id, $content, $keywords = array(), $useAbsolutePath = false)
{
    $context = Model_Context::getInstance();
    if (!$context->getProperty('blog.publishWholeOnRSS')) {
        $content = Utils_Unicode::lessen(removeAllTags(stripHTML($content)), 255);
    }
    return $content;
}
Beispiel #17
0
<?php

/// Copyright (c) 2004-2016, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
require ROOT . '/library/preprocessor.php';
importlib('model.blog.entry');
$context = Model_Context::getInstance();
$skin = new Skin($context->getProperty('skin.skin'));
$entry = array();
$entry['id'] = $suri['id'];
$entry['slogan'] = getSloganById($blogid, $entry['id']);
$IV = array('POST' => array('page' => array('int', 1), 'listOnly' => array('int', 0, 1)));
$result['error'] = 0;
$result['commentBlock'] = revertTempTags(removeAllTags(getCommentView($entry, $skin, $_POST['listOnly'] ? false : true, $_POST['page'], 20, true)));
Respond::PrintResult($result);