function clearCache() { global $database, $changed, $errorlog, $memcache; static $isCleared = false; if ($isCleared == true) { return; } if (!is_null($blogids = POD::queryColumn("SELECT blogid FROM {$database['prefix']}PageCacheLog"))) { $changed = true; $errorlog = false; echo '<li>', _textf('페이지 캐시를 초기화합니다.'), ': '; foreach ($blogids as $ids) { if (CacheControl::flushAll($ids) == false) { $errorlog = true; } } if ($errorlog == false) { echo '<span class="result success">', _text('성공'), '</span></li>'; } else { echo '<span class="result fail">', _text('실패'), '</span></li>'; } } if (!is_null($memcache)) { echo '<li>', _textf('Memcached 캐시를 초기화합니다.'), ': '; if ($memcache->flush()) { echo '<span class="result success">', _text('성공'), '</span></li>'; } else { echo '<span class="result fail">', _text('실패'), '</span></li>'; } } echo '<li>', _textf('공지사항 캐시를 초기화합니다.'), ': '; if (POD::execute("DELETE FROM {$database['prefix']}ServiceSettings WHERE name like 'TextcubeNotice%'")) { echo '<span class="result success">', _text('성공'), '</span></li>'; } else { echo '<span class="result fail">', _text('실패'), '</span></li>'; } $isCleared = true; }
function openid_ViewCommenter($name, $comment) { $context = Model_Context::getInstance(); if ($comment['secret']) { return $name; } if (empty($comment['openid'])) { return $name; } $openidlogodisplay = Setting::getBlogSettingGlobal("OpenIDLogoDisplay", 0); if ($openidlogodisplay) { $name = "<a href=\"" . $comment['openid'] . "\" class=\"openid\"><img src=\"" . $context->getProperty('service.path') . "/resources/image/icon_openid.gif\" alt=\"OpenID Logo\" title=\"" . _textf("오픈아이디(%1)로 작성하였습니다", $comment['openid']) . "\" /></a>" . $name; } else { preg_match_all('@<a(.*)>(.*)</a>@Usi', $name, $temp); for ($i = 0; $i < count($temp[0]); $i++) { if (strip_tags($temp[2][$i]) == $comment['name']) { $name = str_replace($temp[0][$i], "<a{$temp[1][$i]} title='" . _textf("오픈아이디(%1)로 작성하였습니다", $comment['openid']) . "'>" . $temp[2][$i] . "</a>", $name); } } $name .= "<a href=\"" . $comment['openid'] . "\" class=\"openid\"> </a>"; } return $name; }
function clearCache() { global $database, $changed, $errorlog, $memcache; static $isCleared = false; $context = Model_Context::getInstance(); if ($isCleared == true) { return; } if (!is_null($blogids = POD::queryColumn("SELECT blogid FROM {$database['prefix']}PageCacheLog"))) { $changed = true; $errorlog = false; echo '<li>', _textf('페이지 캐시를 초기화합니다.'), ': '; foreach ($blogids as $ids) { if (CacheControl::flushAll($ids) == false) { $errorlog = true; } } if ($errorlog == false) { echo '<span class="result success">', _text('성공'), '</span></li>'; } else { echo '<span class="result fail">', _text('실패'), '</span></li>'; } } if ($context->getProperty('service.codecache', false)) { $changed = true; $errorlog = false; echo '<li>', _textf('코드 캐시를 초기화합니다.'), ': '; $code = new CodeCache(); $code->flush(); if ($errorlog == false) { echo '<span class="result success">', _text('성공'), '</span></li>'; } else { echo '<span class="result fail">', _text('실패'), '</span></li>'; } } if (!is_null($memcache)) { echo '<li>', _textf('Memcached 캐시를 초기화합니다.'), ': '; if ($memcache->flush()) { echo '<span class="result success">', _text('성공'), '</span></li>'; } else { echo '<span class="result fail">', _text('실패'), '</span></li>'; } } echo '<li>', _textf('공지사항 캐시를 초기화합니다.'), ': '; if (POD::execute("DELETE FROM {$database['prefix']}ServiceSettings WHERE name like 'TextcubeNotice%'")) { echo '<span class="result success">', _text('성공'), '</span></li>'; } else { echo '<span class="result fail">', _text('실패'), '</span></li>'; } if (!is_null($blogids = POD::queryColumn("SELECT DISTINCT blogid FROM {$database['prefix']}BlogSettings"))) { $changed = true; $errorlog = false; echo '<li>', _textf('댓글 및 트랙백 휴지통을 비웁니다.'), ': '; foreach ($blogids as $ids) { emptyTrash(true, $ids); emptyTrash(false, $ids); } if ($errorlog == false) { echo '<span class="result success">', _text('성공'), '</span></li>'; } else { echo '<span class="result fail">', _text('실패'), '</span></li>'; } } $isCleared = true; }
if ($imageName = printIphoneAttachmentExtract(printIphoneEntryContent($blogid, $item['userid'], $item['id']))) { $imageSrc = printIphoneImageResizer($blogid, $imageName, 28); } else { $imageSrc = $service['path'] . '/resources/style/iphone/image/noPostThumb.png'; } $itemsView .= '<li class="post_item">' . CRLF; $itemsView .= ' <span class="image"><img src="' . $imageSrc . '" width="28" height="28" /></span>' . CRLF; $itemsView .= ' <a href="' . $blogURL . '/entry/' . $item['id'] . '" class="link">' . CRLF; $itemsView .= ' <div class="post">' . CRLF; $itemsView .= ' <span class="title">' . fireEvent('ViewListTitle', htmlspecialchars($item['title'])) . '</span>' . CRLF; $itemsView .= ' <span class="description">' . Timestamp::format5($item['published']) . ', ' . 'Comments(' . ($item['comments'] > 0 ? $item['comments'] : 0) . ')' . '</span>' . CRLF; $itemsView .= ' </div>' . CRLF; $itemsView .= ' </a>' . CRLF; $itemsView .= '</li>' . CRLF; } $itemsView .= '<li class="pagination">' . CRLF; if (isset($paging['prev'])) { $itemsView .= '<a href="' . $blogURL . '/category/' . $category . '?page=' . $paging['prev'] . '" class="previous">' . _textf('%1 페이지', $paging['prev']) . '</a>' . CRLF; } if (isset($paging['next'])) { $itemsView .= '<a href="' . $blogURL . '/category/' . $category . '?page=' . $paging['next'] . '" class="next">' . _textf('%1 페이지', $paging['next']) . '</a>' . CRLF; } if ($suri['page'] > 1 && $suri['page'] != $paging['pages']) { $itemsView .= '<strong>' . $suri['page'] . '</strong>' . CRLF; } $itemsView .= '</li>' . CRLF; print $itemsView; ?> </ul> <?php }
function notifyComment() { global $database, $service, $blog, $defaultURL; $blogid = getBlogId(); $sql = "SELECT\n\t\t\t\tCN.*,\n\t\t\t\tCNQ.id AS queueId,\n\t\t\t\tCNQ.commentid AS commentid,\n\t\t\t\tCNQ.sendstatus AS sendstatus,\n\t\t\t\tCNQ.checkdate AS checkdate,\n\t\t\t\tCNQ.written AS queueWritten\n\t\t\tFROM\n\t\t\t\t{$database['prefix']}CommentsNotifiedQueue AS CNQ\n\t\t\tLEFT JOIN\n\t\t\t\t{$database['prefix']}Comments AS CN ON CNQ.commentid = CN.id\n\t\t\tWHERE\n\t\t\t\tCNQ.sendstatus = 0\n\t\t\t\tand CN.parent is not null\n\t\t\tORDER BY CNQ.id ASC LIMIT 1 OFFSET 0"; $queue = POD::queryRow($sql); if (empty($queue) && empty($queue['queueId'])) { return false; } $comments = POD::queryRow("SELECT * FROM {$database['prefix']}Comments WHERE blogid = {$blogid} AND id = {$queue['commentid']}"); if (empty($comments['parent']) || $comments['secret'] == 1) { POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE id={$queue['queueId']}"); return false; } $parentComments = POD::queryRow("SELECT * FROM {$database['prefix']}Comments WHERE blogid = {$blogid} AND id = {$comments['parent']}"); if (empty($parentComments['homepage'])) { POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE id={$queue['queueId']}"); return false; } $entry = POD::queryRow("SELECT * FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND id={$comments['entry']}"); if (is_null($entry)) { $r1_comment_check_url = rawurlencode("{$defaultURL}/guestbook/" . $parentComments['id'] . "#guestbook" . $parentComments['id']); $r2_comment_check_url = rawurlencode("{$defaultURL}/guestbook/" . $comments['id'] . "#guestbook" . $comments['id']); $entry['title'] = _textf('%1 블로그의 방명록', $blog['title']); $entryPermaLink = "{$defaultURL}/guestbook/"; $entry['id'] = 0; } else { $r1_comment_check_url = rawurlencode("{$defaultURL}/" . ($blog['useSloganOnPost'] ? "entry/{$entry['slogan']}" : $entry['id']) . "#comment" . $parentComments['id']); $r2_comment_check_url = rawurlencode("{$defaultURL}/" . ($blog['useSloganOnPost'] ? "entry/{$entry['slogan']}" : $entry['id']) . "#comment" . $comments['id']); $entryPermaLink = "{$defaultURL}/" . ($blog['useSloganOnPost'] ? "entry/{$entry['slogan']}" : $entry['id']); } $data = "url=" . rawurlencode($defaultURL) . "&mode=fb" . "&s_home_title=" . rawurlencode($blog['title']) . "&s_post_title=" . rawurlencode($entry['title']) . "&s_name=" . rawurlencode($comments['name']) . "&s_no=" . rawurlencode($comments['entry']) . "&s_url=" . rawurlencode($entryPermaLink) . "&r1_name=" . rawurlencode($parentComments['name']) . "&r1_no=" . rawurlencode($parentComments['id']) . "&r1_pno=" . rawurlencode($comments['entry']) . "&r1_rno=0" . "&r1_homepage=" . rawurlencode($parentComments['homepage']) . "&r1_regdate=" . rawurlencode($parentComments['written']) . "&r1_url=" . $r1_comment_check_url . "&r2_name=" . rawurlencode($comments['name']) . "&r2_no=" . rawurlencode($comments['id']) . "&r2_pno=" . rawurlencode($comments['entry']) . "&r2_rno=" . rawurlencode($comments['parent']) . "&r2_homepage=" . rawurlencode($comments['homepage']) . "&r2_regdate=" . rawurlencode($comments['written']) . "&r2_url=" . $r2_comment_check_url . "&r1_body=" . rawurlencode($parentComments['comment']) . "&r2_body=" . rawurlencode($comments['comment']); if (strpos($parentComments['homepage'], "http://") === false) { $homepage = 'http://' . $parentComments['homepage']; } else { $homepage = $parentComments['homepage']; } $request = new HTTPRequest('POST', $homepage); $request->contentType = 'application/x-www-form-urlencoded; charset=utf-8'; $request->content = $data; if ($request->send()) { $xmls = new XMLStruct(); if ($xmls->open($request->responseText)) { $result = $xmls->selectNode('/response/error/'); if ($result['.value'] != '1' && $result['.value'] != '0') { $homepage = rtrim($homepage, '/') . '/index.php'; $request = new HTTPRequest('POST', $homepage); $request->contentType = 'application/x-www-form-urlencoded; charset=utf-8'; $request->content = $data; if ($request->send()) { } } } } else { } POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE id={$queue['queueId']}"); }
function notifyComment() { $blogid = getBlogId(); $context = Model_Context::getInstance(); $pool = DBModel::getInstance(); $pool->init("CommentsNotifiedQueue"); $pool->setAlias("CommentsNotifiedQueue", "CNQ"); $pool->setAlias("Comments", "CN"); $pool->join("Comments", "left", array(array("CNQ.commentid", "eq", "CN.id"))); $pool->setQualifier("CNQ.sendstatus", "eq", 0); $pool->setQualifier("CN.parent", "neq", null); $pool->setOrder("CNQ.id", "asc"); $pool->setLimit(1); $queue = $pool->getRow("CN.*,\n\t\t\t\tCNQ.id AS queueId,\n\t\t\t\tCNQ.commentid AS commentid,\n\t\t\t\tCNQ.sendstatus AS sendstatus,\n\t\t\t\tCNQ.checkdate AS checkdate,\n\t\t\t\tCNQ.written AS queueWritten"); if (empty($queue) && empty($queue['queueId'])) { return false; } $pool->init("Comments"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("id", "eq", $queue['commentid']); $comments = $pool->getRow(); if (empty($comments['parent']) || $comments['secret'] == 1) { $pool->init("CommentsNotifiedQueue"); $pool->setQualifier("id", "eq", $queue['queueId']); $pool->delete(); return false; } $pool->init("Comments"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("id", "eq", $queue['parent']); $parentComments = $pool->getRow(); if (empty($parentComments['homepage'])) { $pool->init("CommentsNotifiedQueue"); $pool->setQualifier("id", "eq", $queue['queueId']); $pool->delete(); return false; } $pool->init("Entries"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("id", "eq", $comments['entry']); $entry = $pool->getRow(); if (is_null($entry)) { $r1_comment_check_url = rawurlencode($context->getProperty('uri.default') . "/guestbook/" . $parentComments['id'] . "#guestbook" . $parentComments['id']); $r2_comment_check_url = rawurlencode($context->getProperty('uri.default') . "/guestbook/" . $comments['id'] . "#guestbook" . $comments['id']); $entry['title'] = _textf('%1 블로그의 방명록', $context->getProperty('blog.title')); $entryPermaLink = $context->getProperty('uri.default') . "/guestbook/"; $entry['id'] = 0; } else { $r1_comment_check_url = rawurlencode($context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$entry['slogan']}" : $entry['id']) . "#comment" . $parentComments['id']); $r2_comment_check_url = rawurlencode($context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$entry['slogan']}" : $entry['id']) . "#comment" . $comments['id']); $entryPermaLink = $context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$entry['slogan']}" : $entry['id']); } $data = "url=" . rawurlencode($context->getProperty('uri.default')) . "&mode=fb" . "&s_home_title=" . rawurlencode($context->getProperty('blog.title')) . "&s_post_title=" . rawurlencode($entry['title']) . "&s_name=" . rawurlencode($comments['name']) . "&s_no=" . rawurlencode($comments['entry']) . "&s_url=" . rawurlencode($entryPermaLink) . "&r1_name=" . rawurlencode($parentComments['name']) . "&r1_no=" . rawurlencode($parentComments['id']) . "&r1_pno=" . rawurlencode($comments['entry']) . "&r1_rno=0" . "&r1_homepage=" . rawurlencode($parentComments['homepage']) . "&r1_regdate=" . rawurlencode($parentComments['written']) . "&r1_url=" . $r1_comment_check_url . "&r2_name=" . rawurlencode($comments['name']) . "&r2_no=" . rawurlencode($comments['id']) . "&r2_pno=" . rawurlencode($comments['entry']) . "&r2_rno=" . rawurlencode($comments['parent']) . "&r2_homepage=" . rawurlencode($comments['homepage']) . "&r2_regdate=" . rawurlencode($comments['written']) . "&r2_url=" . $r2_comment_check_url . "&r1_body=" . rawurlencode($parentComments['comment']) . "&r2_body=" . rawurlencode($comments['comment']); if (strpos($parentComments['homepage'], "http://") === false) { $homepage = 'http://' . $parentComments['homepage']; } else { $homepage = $parentComments['homepage']; } $request = new HTTPRequest('POST', $homepage); $request->contentType = 'application/x-www-form-urlencoded; charset=utf-8'; $request->content = $data; if ($request->send()) { $xmls = new XMLStruct(); if ($xmls->open($request->responseText)) { $result = $xmls->selectNode('/response/error/'); if ($result['.value'] != '1' && $result['.value'] != '0') { $homepage = rtrim($homepage, '/') . '/index.php'; $request = new HTTPRequest('POST', $homepage); $request->contentType = 'application/x-www-form-urlencoded; charset=utf-8'; $request->content = $data; if ($request->send()) { } } } } $pool->init("CommentsNotifiedQueue"); $pool->setQualifier("id", "eq", $queue['queueId']); $pool->delete(); }
function sendInvitationMail($blogid, $userid, $name, $comment, $senderName, $senderEmail) { $ctx = Model_Context::getInstance(); $pool = DBModel::getInstance(); if (empty($blogid)) { $pool->reset('BlogSettings'); $blogid = $pool->getCell('max(blogid)'); // If no blogid, get the latest created blogid. } $email = User::getEmail($userid); $pool->reset('Users'); $pool->setQualifier('userid', 'eq', $userid); $password = getCell('password'); $authtoken = getAuthToken($userid); $blogName = getBlogName($blogid); if (empty($email)) { return 1; } if (!preg_match('/^[^@]+@([-a-zA-Z0-9]+\\.)+[-a-zA-Z0-9]+$/', $email)) { return 2; } if (empty($name)) { $name = User::getName($userid); } if (strcmp($email, Utils_Unicode::lessenAsEncoding($email, 64)) != 0) { return 11; } //$loginid = POD::escapeString(Utils_Unicode::lessenAsEncoding($email, 64)); $name = POD::escapeString(Utils_Unicode::lessenAsEncoding($name, 32)); //$headers = 'From: ' . encodeMail($senderName) . '<' . $senderEmail . ">\n" . 'X-Mailer: ' . TEXTCUBE_NAME . "\n" . "MIME-Version: 1.0\nContent-Type: text/html; charset=utf-8\n"; if (empty($name)) { $subject = _textf('귀하를 %1님이 초대합니다', $senderName); } else { $subject = _textf('%1님을 %2님이 초대합니다', $name, $senderName); } $message = file_get_contents(ROOT . "/resources/style/letter/letter.html"); $message = str_replace('[##_title_##]', _text('초대장'), $message); $message = str_replace('[##_content_##]', $comment, $message); $message = str_replace('[##_images_##]', $ctx->getProperty('uri.service') . "/resources/style/letter", $message); $message = str_replace('[##_link_##]', getInvitationLink(getBlogURL($blogName), $email, $password, $authtoken), $message); $message = str_replace('[##_go_blog_##]', getBlogURL($blogName), $message); $message = str_replace('[##_link_title_##]', _text('블로그 바로가기'), $message); if (empty($name)) { $message = str_replace('[##_to_##]', '', $message); } else { $message = str_replace('[##_to_##]', _text('받는 사람') . ': ' . $name, $message); } $message = str_replace('[##_sender_##]', _text('보내는 사람') . ': ' . $senderName, $message); $ret = sendEmail($senderName, $senderEmail, $name, $email, $subject, $message); if ($ret !== true) { return array(14, $ret[1]); } return true; }
define('__TEXTCUBE_CUSTOM_HEADER__', true); define('__TEXTCUBE_LOGIN__', true); require ROOT . '/library/preprocessor.php'; requireStrictBlogURL(); $context = Model_Context::getInstance(); $author = $suri['value']; $authorId = User::getUserIdByName($author); if (empty($authorId)) { exit; } $blogid = getBlogId(); $cache = pageCache::getInstance(); $cache->reset('authorATOM-' . $authorId); if (!$cache->load()) { importlib("model.blog.feed"); list($entries, $paging) = getEntriesWithPagingByAuthor($blogid, $author, 1, 1, 1); if (empty($entries)) { header("Location: " . $context->getProperty('uri.host') . $context->getProperty('uri.blog') . "/atom"); exit; } $result = getFeedWithEntries($blogid, $entries, _textf('%1 의 글 목록', $author), 'atom'); if ($result !== false) { $cache->reset('authorATOM-' . $authorId); $cache->contents = $result; $cache->update(); } } header('Content-Type: application/atom+xml; charset=utf-8'); fireEvent('FeedOBStart'); echo fireEvent('ViewAuthorATOM', $cache->contents); fireEvent('FeedOBEnd');
function getCategoryFeedByCategoryId($blogid, $categoryIds, $mode = 'rss', $categoryTitle = null) { $context = Model_Context::getInstance(); $channel = array(); $channel = initializeRSSchannel($blogid); $pool = DBModel::getInstance(); $pool->reset("Entries"); $pool->setAlias("Entries", "e"); $pool->setAlias("Categories", "c"); $pool->setAlias("Users", "u"); $pool->extend("Categories", "left", array(array("e.blogid", "eq", "c.blogid"), array("e.category", "eq", "c.id"))); $pool->extend("Users", "left", array(array("e.userid", "eq", "u.userid"))); $pool->setQualifier("e.blogid", "eq", $blogid); $pool->setQualifier("e.draft", "eq", 0); $pool->setQualifier("e.visibility", ">=", $context->getProperty('blog.publishEolinSyncOnRSS') ? 2 : 3); $pool->setQualifier("e.category", "hasoneof", $categoryIds); $pool->setOrder("e.published", "desc"); $pool->setLimit($context->getProperty('blog.entriesOnRSS')); $entries = $pool->getAll("e.*, c.name AS categoryName, u.name as author, u.loginid AS email"); return getFeedWithEntries($blogid, $entries, _textf('%1 카테고리 글 목록', $categoryTitle), $mode); }
$itemsView = '<li class="group ui-bar ui-bar-e">' . CRLF; $itemsView .= ' <span class="left">' . htmlspecialchars($search) . ' ' . _text('검색 결과') . '(' . $list['count'] . ')</span>' . CRLF; $itemsView .= ' <span class="right ui-li-aside">' . _text('페이지') . '<span class="now_page">' . $paging['page'] . '</span> / ' . $paging['pages'] . '</span>' . CRLF; $itemsView .= '</li>' . CRLF; foreach ($list['items'] as $item) { $author = User::getName($item['userid']); if ($imageName = printMobileAttachmentExtract(printMobileEntryContent($blogid, $item['userid'], $item['id']))) { $imageSrc = printMobileImageResizer($blogid, $imageName, 80); } else { $imageSrc = $service['path'] . '/resources/style/iphone/image/noPostThumb.png'; } $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>' . Timestamp::format5($item['published']) . '</span><span class="ui-li-count"> ' . _textf('댓글 %1개', $item['comments'] > 0 ? $item['comments'] : 0) . '</p>' . CRLF; $itemsView .= ' </a>' . CRLF; $itemsView .= '</li>' . CRLF; } $itemsView .= '</ul>' . CRLF; print $itemsView; print printMobileListNavigation($paging, 'search/' . $search); ?> </ul> <?php printMobileHTMLFooter(); } else { ?> <div data-role="page" data-theme="a" id="search"> <form id="searchForm" method="GET" class="dialog snug editorBar" action="<?php echo $blogURL;
if ($imageName = printIphoneAttachmentExtract(printIphoneEntryContent($blogid, $item['userid'], $item['id']))) { $imageSrc = printIphoneImageResizer($blogid, $imageName, 28); } else { $imageSrc = $service['path'] . '/resources/style/iphone/image/noPostThumb.png'; } $itemsView .= '<li class="post_item">' . CRLF; $itemsView .= ' <span class="image"><img src="' . $imageSrc . '" width="28" height="28" /></span>' . CRLF; $itemsView .= ' <a href="' . $blogURL . '/entry/' . $item['id'] . '" class="link">' . CRLF; $itemsView .= ' <div class="post">' . CRLF; $itemsView .= ' <span class="title">' . fireEvent('ViewListTitle', htmlspecialchars($item['title'])) . '</span>' . CRLF; $itemsView .= ' <span class="description">' . Timestamp::format5($item['published']) . ', ' . 'Comments(' . ($item['comments'] > 0 ? $item['comments'] : 0) . ')' . '</span>' . CRLF; $itemsView .= ' </div>' . CRLF; $itemsView .= ' </a>' . CRLF; $itemsView .= '</li>' . CRLF; } $itemsView .= '<li class="pagination">' . CRLF; if (isset($paging['prev'])) { $itemsView .= '<a href="' . $blogURL . '/archive/' . $period . '?page=' . $paging['prev'] . '" class="previous">' . _textf('%1 페이지', $paging['prev']) . '</a>' . CRLF; } if (isset($paging['next'])) { $itemsView .= '<a href="' . $blogURL . '/archive/' . $period . '?page=' . $paging['next'] . '" class="next">' . _textf('%1 페이지', $paging['next']) . '</a>' . CRLF; } if ($suri['page'] > 1 && $suri['page'] != $paging['pages']) { $itemsView .= '<strong>' . $suri['page'] . '</strong>' . CRLF; } $itemsView .= '</li>' . CRLF; print $itemsView; ?> </ul> <?php }
function getCategoryFeedByCategoryId($blogid, $categoryIds, $mode = 'rss', $categoryTitle = null) { $ctx = Model_Context::getInstance(); $channel = array(); $channel = initializeRSSchannel($blogid); $entries = POD::queryAll("SELECT \n\t\t\te.*, \n\t\t\tc.name AS categoryName, \n\t\t\tu.name AS author,\n\t\t\tu.loginid AS email\n\t\tFROM " . $ctx->getProperty('database.prefix') . "Entries e \n\t\tLEFT JOIN " . $ctx->getProperty('database.prefix') . "Categories c\n\t\t\tON e.blogid = c.blogid AND e.category = c.id\n\t\tLEFT JOIN " . $ctx->getProperty('database.prefix') . "Users u\n\t\t\tON e.userid = u.userid\n\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 AND e.visibility >= " . ($ctx->getProperty('blog.publishEolinSyncOnRSS') ? '2' : '3') . " AND e.category IN (" . implode(',', $categoryIds) . ")\n\t\tORDER BY e.published \n\t\tDESC LIMIT " . $ctx->getProperty('blog.entriesOnRSS')); return getFeedWithEntries($blogid, $entries, _textf('%1 카테고리 글 목록', $categoryTitle), $mode); }
if (!doesHaveOwnership() && empty($_POST["comment_{$replyId}"])) { printMobileErrorPage(_text('댓글 작성 오류.'), _text('내용을 입력해 주세요.'), "{$blogURL}/comment/comment/{$replyId}"); } else { $comment = array(); $comment['entry'] = $entryId; $comment['parent'] = $replyId; $comment['name'] = empty($_POST["name_{$replyId}"]) ? '' : $_POST["name_{$replyId}"]; $comment['password'] = empty($_POST["password_{$replyId}"]) ? '' : $_POST["password_{$replyId}"]; $comment['homepage'] = empty($_POST["homepage_{$replyId}"]) || $_POST["homepage_{$replyId}"] == 'http://' ? '' : $_POST["homepage_{$replyId}"]; $comment['secret'] = empty($_POST["secret_{$replyId}"]) ? 0 : 1; $comment['comment'] = $_POST["comment_{$replyId}"]; $comment['ip'] = $_SERVER['REMOTE_ADDR']; $result = addComment($blogid, $comment); if (in_array($result, array('ip', 'name', 'homepage', 'comment', 'openidonly', 'etc'))) { if ($result == 'openidonly') { $blockMessage = _text('댓글을 쓰기 위해서는 OpenID로 로그인해야 합니다.'); } else { $blockMessage = _textf('%1 은 차단되었습니다.', $result); } printMobileErrorPage(_text('댓글 작성이 차단되었습니다.'), $blockMessage, "{$blogURL}/comment/{$entryId}"); } else { if ($result === false) { printMobileErrorPage(_text('댓글 작성 오류.'), _text('댓글을 작성할 수 없었습니다.'), "{$blogURL}/comment/{$entryId}"); } else { setcookie('guestName', $comment['name'], time() + 2592000, $blogURL); setcookie('guestHomepage', $comment['homepage'], time() + 2592000, $blogURL); printMobileSimpleMessage(_text('댓글이 등록되었습니다.'), _text('댓글 페이지로 이동'), "{$blogURL}/comment/{$entryId}"); } } } }
?> </a></li> <?php } ?> <?php if (!empty($openid_signup_link)) { ?> <li><a href="<?php echo $openid_signup_link; ?> "><?php echo _text('오픈아이디 발급하기'); ?> </a></li> <?php } ?> <li id="openid-helper"><?php echo _textf('Technically supported by %1', '<a href="http://www.idtail.com/">idtail.com</a>'); ?> </li> </ul> </div> </div> </div> </form> </div> </div> </body> </html>
function getCategoryFeedByCategoryId($blogid, $categoryIds, $mode = 'rss', $categoryTitle = null) { global $database, $serviceURL, $defaultURL, $blog, $service; $channel = array(); $channel = initializeRSSchannel($blogid); $entries = POD::queryAll("SELECT \n\t\t\te.*, \n\t\t\tc.name AS categoryName, \n\t\t\tu.name AS author,\n\t\t\tu.loginid AS email\n\t\tFROM {$database['prefix']}Entries e \n\t\tLEFT JOIN {$database['prefix']}Categories c\n\t\t\tON e.blogid = c.blogid AND e.category = c.id\n\t\tLEFT JOIN {$database['prefix']}Users u\n\t\t\tON e.userid = u.userid\n\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 AND e.visibility >= " . ($blog['publishEolinSyncOnRSS'] ? '2' : '3') . " AND e.category IN (" . implode(',', $categoryIds) . ")\n\t\tORDER BY e.published \n\t\tDESC LIMIT {$blog['entriesOnRSS']}"); if (!$entries) { $entries = array(); } $channel['items'] = getFeedItemByEntries($entries); if (!is_null($categoryTitle)) { $channel['title'] = RSSMessage($blog['title'] . ': ' . _textf('%1 카테고리 글 목록', htmlspecialchars($categoryTitle))); } $rss = array('channel' => $channel); if ($mode == 'rss') { return publishRSS($blogid, $rss); } else { if ($mode == 'atom') { return publishATOM($blogid, $rss); } } return false; }
function applyMF2Comment($type, $commentItem, $debugType) { $type .= "_rep"; if (!preg_match('/<(p|div|li|table|tr|td|span|cite|strong)[^>]*class=[\'"][^\'"]*\\bvcard\\b[^\'"]*[\'"][^>]*>/sm', $commentItem)) { $commentItem = addAttributeCore($commentItem, '@(.*?)(<(p|div|li|td|span|cite|strong)[^>]*>[^<>]*?\\[##_' . $type . '_name_##\\].*?</\\3>)(.*)@sm', array('class' => 'vcard'), array(1, 2, 4), 1); if (!preg_match('@<(p|div|li|td|span|cite|strong)[^>]*class=[\'"][^\'"]*\\bvcard\\b[^\'"]*[\'"][^>]*>@sm', $commentItem)) { $commentItem = str_replace("[##_{$type}_name_##]", "<span class=\"vcard\">[##_{$type}_name_##]</span>", $commentItem); array_push($this->microformatDebug, _textf('Microformat-info: %1 작성자를 감싸고 있는 태그가 없어 span으로 감싼 뒤 class="vcard"를 추가합니다.', $debugType)); } else { array_push($this->microformatDebug, _textf('Microformat-info: %1 영역에 class="vcard"를 삽입합니다.', $debugType)); } } else { array_push($this->microformatDebug, _textf('Microformat-info: %1 영역에 class="vcard"가 있으므로, vcard는 삽입하지 않았습니다.', $debugType)); } return $commentItem; }
</dl> <dl id="checkbox-line"> <dt><span class="label"><?php echo _text('선택사항'); ?> </span></dt> <dd> <div id="email-save"><input type="checkbox" id="save" class="checkbox" name="save"<?php echo empty($_COOKIE['TSSESSION_LOGINID']) ? '' : 'checked="checked"'; ?> /><label for="save"><?php echo _text('이메일 저장'); ?> </label></div> <div id="permanent-login"><input type="checkbox" id="autologin" class="checkbox" name="autologin" /><label for="autologin"><?php echo _textf('%1 동안 로그인 상태 유지', Timestamp::getHumanReadablePeriod($context->getProperty('service.autologinTimeout'))); ?> </label></div> <?php echo $showPasswordReset ? '<div id="password_int"><input type="checkbox" class="checkbox" id="reset" name="reset" /><label for="reset">' . _text('암호 초기화') . '</label></div>' . CRLF : ''; ?> </dd> </dl> <div class="button-box"> <input type="submit" class="login-button input-button" name="button_login" value="<?php echo _text('로그인'); ?> " /> </div> <div class="return-box">
/// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) define('NO_SESSION', true); define('__TEXTCUBE_CUSTOM_HEADER__', true); define('__TEXTCUBE_LOGIN__', true); require ROOT . '/library/preprocessor.php'; requireStrictBlogURL(); $context = Model_Context::getInstance(); $period = $suri['id']; $blogid = getBlogId(); $cache = pageCache::getInstance(); $cache->reset('archiveAtom-' . $period); if (!$cache->load()) { requireModel("blog.feed"); list($entries, $paging) = getEntriesWithPagingByPeriod($blogid, $period, 1, 1, 1); //var_dump($entries); if (empty($entries)) { header("Location: " . $context->getProperty('uri.host') . $context->getProperty('uri.blog') . "/atom"); exit; } $result = getFeedWithEntries($blogid, $entries, _textf('%1 기간의 글 목록', $period), 'atom'); if ($result !== false) { $cache->reset('archiveAtom-' . $period); $cache->contents = $result; $cache->update(); } } header('Content-Type: application/rss+xml; charset=utf-8'); fireEvent('FeedOBStart'); echo fireEvent('ViewArchiveRSS', $cache->contents); fireEvent('FeedOBEnd');
if (!doesHaveOwnership() && empty($_GET["comment_{$entryId}"])) { printIphoneErrorPage(_text('Comment write error.'), _text('Please enter content.'), "{$blogURL}/comment/{$entryId}"); } else { $comment = array(); $comment['entry'] = $entryId; $comment['parent'] = null; $comment['name'] = empty($_GET["name_{$entryId}"]) ? '' : $_GET["name_{$entryId}"]; $comment['password'] = empty($_GET["password_{$entryId}"]) ? '' : $_GET["password_{$entryId}"]; $comment['homepage'] = empty($_GET["homepage_{$entryId}"]) || $_GET["homepage_{$entryId}"] == 'http://' ? '' : $_GET["homepage_{$entryId}"]; $comment['secret'] = empty($_GET["secret_{$entryId}"]) ? 0 : 1; $comment['comment'] = $_GET["comment_{$entryId}"]; $comment['ip'] = $_SERVER['REMOTE_ADDR']; $result = addComment($blogid, $comment); if (in_array($result, array('ip', 'name', 'homepage', 'comment', 'openidonly', 'etc'))) { if ($result == 'openidonly') { $blockMessage = _text('You have to log in with and OpenID to leave a comment.'); } else { $blockMessage = _textf('Blocked %1', $result); } printIphoneErrorPage(_text('Comment write blocked.'), $blockMessage, "{$blogURL}/comment/{$entryId}"); } else { if ($result === false) { printIphoneErrorPage(_text('Comment write error.'), _text('Cannot write comment.'), "{$blogURL}/comment/{$entryId}"); } else { setcookie('guestName', $comment['name'], time() + 2592000, $blogURL); setcookie('guestHomepage', $comment['homepage'], time() + 2592000, $blogURL); printIphoneSimpleMessage(_text('Comment registered.'), _text('Go to comments page'), "{$blogURL}/comment/{$entryId}"); } } } }
function sendInvitationMail($blogid, $userid, $name, $comment, $senderName, $senderEmail) { global $database, $service, $hostURL, $serviceURL; if (empty($blogid)) { $blogid = POD::queryCell("SELECT max(blogid)\n\t\t\tFROM {$database['prefix']}BlogSettings"); // If no blogid, get the latest created blogid. } $email = getUserEmail($userid); $password = POD::queryCell("SELECT password\n\t\tFROM {$database['prefix']}Users\n\t\tWHERE userid = " . $userid); $authtoken = getAuthToken($userid); $blogName = getBlogName($blogid); if (empty($email)) { return 1; } if (!preg_match('/^[^@]+@([-a-zA-Z0-9]+\\.)+[-a-zA-Z0-9]+$/', $email)) { return 2; } if (empty($name)) { $name = User::getName($userid); } if (strcmp($email, UTF8::lessenAsEncoding($email, 64)) != 0) { return 11; } //$loginid = POD::escapeString(UTF8::lessenAsEncoding($email, 64)); $name = POD::escapeString(UTF8::lessenAsEncoding($name, 32)); //$headers = 'From: ' . encodeMail($senderName) . '<' . $senderEmail . ">\n" . 'X-Mailer: ' . TEXTCUBE_NAME . "\n" . "MIME-Version: 1.0\nContent-Type: text/html; charset=utf-8\n"; if (empty($name)) { $subject = _textf('귀하를 %1님이 초대합니다', $senderName); } else { $subject = _textf('%1님을 %2님이 초대합니다', $name, $senderName); } $message = file_get_contents(ROOT . "/resources/style/letter/letter.html"); $message = str_replace('[##_title_##]', _text('초대장'), $message); $message = str_replace('[##_content_##]', $comment, $message); $message = str_replace('[##_images_##]', $serviceURL . "/resources/style/letter", $message); $message = str_replace('[##_link_##]', getInvitationLink(getBlogURL($blogName), $email, $password, $authtoken), $message); $message = str_replace('[##_go_blog_##]', getBlogURL($blogName), $message); $message = str_replace('[##_link_title_##]', _text('블로그 바로가기'), $message); if (empty($name)) { $message = str_replace('[##_to_##]', '', $message); } else { $message = str_replace('[##_to_##]', _text('받는 사람') . ': ' . $name, $message); } $message = str_replace('[##_sender_##]', _text('보내는 사람') . ': ' . $senderName, $message); $ret = sendEmail($senderName, $senderEmail, $name, $email, $subject, $message); if ($ret !== true) { return array(14, $ret[1]); } return true; }
function printMobileListNavigation($paging, $postfix) { $script = ''; $context = Model_Context::getInstance(); $pageId = $context->getProperty('suri.page'); $itemsView = '<div data-role="navbar" data-theme="c">' . CRLF; $itemsView .= '<ul>' . CRLF; if (isset($paging['prev'])) { $itemsView .= '<li><a data-role="button" data-theme="d" data-icon="arrow-l" href="' . $context->getProperty('uri.blog') . '/' . $postfix . '?page=' . $paging['prev'] . '" class="previous">' . _textf('%1 페이지', $paging['prev']) . '</a></li>' . CRLF; $script .= '$("#blog_posts_' . $pageId . '").swiperight(function() {$.mobile.changePage("' . $context->getProperty('uri.blog') . '/' . $postfix . '?page=' . $paging['prev'] . '",{reverse: true});});'; } /*if ($suri['page'] > 1 && $suri['page'] != $paging['pages']) { $itemsView .= '<li>'._textf('%1 페이지',$suri['page']) . '</li>'.CRLF; }*/ if (isset($paging['next'])) { $itemsView .= '<li><a data-role="button" data-theme="d" data-icon="arrow-r" href="' . $context->getProperty('uri.blog') . '/' . $postfix . '?page=' . $paging['next'] . '" class="next">' . _textf('%1 페이지', $paging['next']) . '</a></li>' . CRLF; $script .= '$("#blog_posts_' . $pageId . '").swipeleft(function() {$.mobile.changePage("' . $context->getProperty('uri.blog') . '/' . $postfix . '?page=' . $paging['next'] . '");});'; } $itemsView .= '</ul>' . CRLF; $itemsView .= '</div>' . CRLF; if (!empty($script)) { $itemsView .= '<script>' . CRLF . $script . CRLF . '</script>'; } return $itemsView; }