function logout() { fireEvent("Logout"); Acl::clearAcl(); Transaction::clear(); session_destroy(); }
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; }
function replace($matches) { $keyword = $matches[0]; if (!$this->_replaceOnce || !array_key_exists($keyword, $this->_binded)) { $this->_binded[$keyword] = null; $keyword = fireEvent('BindKeyword', $keyword); } return $keyword; }
function RecentRP_getRecentCommentsView($comments, $template) { global $contentContainer; $context = Model_Context::getInstance(); ob_start(); foreach ($comments as $comment) { $view = "{$template}"; Utils_Misc::dress('rctrp_rep_link', $context->getProperty('uri.blog') . "/{$comment['entry']}#comment{$comment['id']}", $view); $contentContainer["recent_comment_{$comment['id']}"] = htmlspecialchars(Utils_Unicode::lessenAsEm(strip_tags($comment['comment']), 30)); Utils_Misc::dress('rctrp_rep_desc', setTempTag("recent_comment_{$comment['id']}"), $view); Utils_Misc::dress('rctrp_rep_desc', htmlspecialchars(Utils_Unicode::lessenAsEm(strip_tags($comment['comment']), 30)), $view); Utils_Misc::dress('rctrp_rep_time', fireEvent('ViewRecentCommentDate', Timestamp::format3($comment['written'])), $view); Utils_Misc::dress('rctrp_rep_name', htmlspecialchars(Utils_Unicode::lessenAsEm(strip_tags($comment['name']), 10)) . $comment['secret'] . $comment['replier'], $view); print $view; } $view = ob_get_contents(); ob_end_clean(); return $view; }
function dumbCronScheduler($checkOnly = true) { $context = Model_Context::getInstance(); $now = Timestamp::getUNIXtime(); $dumbCronStamps = Setting::getServiceSetting('dumbCronStamps', serialize(array('1m' => 0, '5m' => 0, '30m' => 0, '1h' => 0, '2h' => 0, '6h' => 0, '12h' => 0, '24h' => 0, 'Daily' => 0)), true); $dumbCronStamps = unserialize($dumbCronStamps); $schedules = array('1m' => 60, '5m' => 60 * 5, '10m' => 60 * 10, '30m' => 60 * 30, '1h' => 60 * 60, '2h' => 60 * 60 * 2, '6h' => 60 * 60 * 6, '12h' => 60 * 60 * 12, '24h' => 60 * 60 * 24, 'Daily' => 60 * 60 * 24, '1w' => 60 * 60 * 24 * 7); /* Events: Cron1m, Cron5m, Cron30m, Cron1h, Cron2h, Cron6h, Cron12h */ $log_file = __TEXTCUBE_CACHE_DIR__ . '/cronlog.txt'; $log = fopen($log_file, "a"); foreach ($schedules as $d => $diff) { if (!isset($dumbCronStamps[$d])) { $dumbCronStamps[$d] = 0; } if ($now > $diff + $dumbCronStamps[$d]) { if ($checkOnly && eventExists("Cron{$d}")) { fclose($log); return true; } fireEvent("Cron{$d}", null, $now); if ($d == '6h') { importlib('model.blog.trash'); trashVan(); } fwrite($log, date('Y-m-d H:i:s') . ' ' . $context->getProperty('blog.name') . " Cron{$d} executed ({$_SERVER['REQUEST_URI']})\r\n"); $dumbCronStamps[$d] = $now; } } fclose($log); /* Keep just 1000 lines */ $logcontent = explode("\r\n", file_get_contents($log_file)); $logcontent = implode("\r\n", array_slice($logcontent, -1000)); $log = fopen($log_file, "w"); fwrite($log, $logcontent); fclose($log); Setting::setServiceSetting('dumbCronStamps', serialize($dumbCronStamps), true); return false; }
function pretty_dress($view) { global $blogid, $blog, $database, $service, $stats, $skinSetting; $context = Model_Context::getInstance(); /* local static */ global $pd_category, $pd_categoryXhtml, $pd_archive, $pd_calendar, $pd_tags, $pd_notices, $pd_recentEntry; global $pd_recentComment, $pd_recentTrackback, $pd_link, $pd_authorList; if (isset($_REQUEST['safe'])) { // safe mode return '<div class="coverpage-element-safebox">…</div>'; } if (isset($_REQUEST['tag'])) { // safe mode return '<div class="coverpage-element-safebox"><p>' . nl2br(htmlspecialchars($view, ENT_QUOTES)) . '</p></div>'; } $writer = User::getBlogOwnerName($blogid); $pageTitle = _t('페이지 제목'); dress('page_title', htmlspecialchars($pageTitle), $view); dress('blogger', htmlspecialchars($writer), $view); dress('title', htmlspecialchars($context->getProperty('blog.title')), $view); dress('desc', htmlspecialchars($context->getProperty('blog.description')), $view); if ($context->getProperty('blog.logo') != null) { dress('image', $context->getProperty('service.path') . "/attach/{$blogid}/" . $context->getProperty('blog.logo'), $view); } else { dress('image', $context->getProperty('service.path') . "/resources/image/spacer.gif", $view); } dress('blog_link', $context->getProperty('uri.blog') . "/", $view); dress('keylog_link', $context->getProperty('uri.blog') . "/keylog", $view); dress('localog_link', $context->getProperty('uri.blog') . "/location", $view); dress('taglog_link', $context->getProperty('uri.blog') . "/tag", $view); dress('guestbook_link', $context->getProperty('uri.blog') . "/guestbook", $view); list($view, $searchView) = Skin::cutSkinTag($view, 'search'); dress('search_name', 'search', $searchView); dress('search_text', isset($search) ? htmlspecialchars($search) : '', $searchView); dress('search_onclick_submit', 'searchBlog()', $searchView); dress('search', '<form id="TTSearchForm" action="' . parseURL($context->getProperty('uri.blog') . '/search/') . '" method="get" onsubmit="return searchBlog()">' . $searchView . '</form>', $view); dress('category', $pd_category, $view); dress('category_list', $pd_categoryXhtml, $view); dress('count_total', $stats['total'], $view); dress('count_today', $stats['today'], $view); dress('count_yesterday', $stats['yesterday'], $view); list($view, $archiveView) = Skin::cutSkinTag($view, 'archive_rep'); dress('archive_rep', getArchivesView($pd_archive, $archiveView), $view); dress('calendar', $pd_calendar, $view); list($view, $randomView) = Skin::cutSkinTag($view, 'random_tags'); dress('random_tags', getRandomTagsView($pd_tags, $randomView), $view); list($view, $recentNoticeItem) = Skin::cutSkinTag($view, 'rct_notice_rep'); list($view, $noticeView) = Skin::cutSkinTag($view, 'rct_notice'); $notices = $pd_notices; if (sizeof($notices) == 0) { $notices = array(array('title' => _t('공지 제목'), 'id' => -1)); } if (sizeof($notices) > 0) { $itemsView = ''; foreach ($notices as $notice) { $itemView = $recentNoticeItem; dress('notice_rep_title', htmlspecialchars(fireEvent('ViewNoticeTitle', Utils_Unicode::lessenAsEm($notice['title'], $skinSetting['recentNoticeLength']), $notice['id'])), $itemView); dress('notice_rep_link', "{$context->getProperty}('uri.blog')/notice/{$notice['id']}", $itemView); $itemsView .= $itemView; } dress('rct_notice_rep', $itemsView, $noticeView); dress('rct_notice', $noticeView, $view); } list($view, $authorList) = Skin::cutSkinTag($view, 'author_rep'); dress('author_rep', getAuthorListView($pd_authorList, $authorList), $view); list($view, $recentEntry) = Skin::cutSkinTag($view, 'rctps_rep'); dress('rctps_rep', getRecentEntriesView($pd_recentEntry, null, $recentEntry), $view); list($view, $recentComments) = Skin::cutSkinTag($view, 'rctrp_rep'); dress('rctrp_rep', getRecentCommentsView($pd_recentComment, null, $recentComments), $view); list($view, $recentTrackback) = Skin::cutSkinTag($view, 'rcttb_rep'); dress('rcttb_rep', getRecentTrackbacksView($pd_recentTrackback, null, $recentTrackback), $view); list($view, $s_link_rep) = Skin::cutSkinTag($view, 'link_rep'); dress('link_rep', getLinksView($pd_link, $s_link_rep), $view); dress('rss_url', "{$context->getProperty}('uri.blog')/rss", $view); dress('owner_url', "{$context->getProperty}('uri.blog')/owner", $view); dress('textcube_name', TEXTCUBE_NAME, $view); dress('textcube_version', TEXTCUBE_VERSION, $view); $tagSearches = array('@<a @i', '@</a *>@i', '@ id *= *".*"@isU', '@ onkey(down|up|press) *="@i', '@ on(click|load|unload) *="@i', '@<input +@i', '@<script.*</script *>@siU', '@<form @siU', '@</form>@siU'); $tagReplaces = array('<span ', '</span>', '', ' onnothing="', ' onnothing="', '<input disabled="disabled" ', '', '<div ', '</div>'); $view = preg_replace($tagSearches, $tagReplaces, $view); return correctCoverpageImage($view); }
<?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'; fireEvent($suri['directive'] . '/' . $suri['value']); if (!headers_sent()) { Respond::NotFoundPage(); }
<?php /// 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) $IV = array('POST' => array('id' => array('int', 'min' => 1))); require ROOT . '/library/preprocessor.php'; requireStrictRoute(); $line = Model_Line::getInstance(); $line->reset(); $line->setFilter(array('blogid', 'equals', getBlogId())); $line->setFilter(array('id', 'equals', $_POST['id'])); if ($line->remove()) { fireEvent('DeleteLine', 0, $line); Respond::ResultPage(0); } else { fireEvent('DeleteLine', -1, $line); Respond::ResultPage(-1); }
<?php } ?> </select></dd> </dl> <div id="formatbox-container" class="container"></div> <textarea id="editWindow" name="content" cols="80" rows="20"><?php echo htmlspecialchars($entry['content']); ?> </textarea> <div id="status-container" class="container"><span id="pathStr"><?php echo _t('path'); ?> </span><span class="divider"> : </span><span id="pathContent"></span></div> <?php $view = fireEvent('AddPostEditorToolbox', ''); if (!empty($view)) { ?> <div id="toolbox-container" class="container"><?php echo $view; ?> </div> <?php } ?> <div id="templateDialog" class="entry-editor-property<?php echo defined('__TEXTCUBE_POST__') ? NULL : ' hidden'; ?> "> <div class="temp-box">
if ($_POST['permalink'] == '') { $entry['slogan'] = ''; } } $entry['acceptcomment'] = empty($_POST['acceptcomment']) ? 0 : 1; $entry['accepttrackback'] = empty($_POST['accepttrackback']) ? 0 : 1; $entry['published'] = empty($_POST['published']) ? 0 : $_POST['published']; $entry['draft'] = 0; if (strpos($entry['slogan'], 'TCDraftPost') === 0) { $entry['slogan'] = $entry['title']; } if (empty($suri['id'])) { if ($id = addEntry($blogid, $entry)) { fireEvent('AddPost', $id, $entry); Setting::setBlogSetting('LatestEditedEntry_user' . getUserId(), $id, true); $result = array(); $result['error'] = ($id !== false) === true ? 0 : 1; $result['entryId'] = $id; Respond::PrintResult($result); exit; } } else { if ($id = updateEntry($blogid, $entry, $updateDraft)) { fireEvent('UpdatePost', $id, $entry); Setting::setBlogSetting('LatestEditedEntry_user' . getUserId(), $suri['id'], true); Respond::ResultPage(0); exit; } } } Respond::ResultPage(-1);
$IV = array('POST' => array('visibility' => array('int', 0, 3), 'starred' => array('int', 0, 2), 'category' => array('int', 'default' => 0), 'title' => array('string'), 'content' => array('string'), 'contentformatter' => array('string'), 'contenteditor' => array('string'), 'permalink' => array('string', 'default' => ''), 'location' => array('string', 'default' => '/'), 'latitude' => array('number', 'default' => null, 'min' => -90.0, 'max' => 90.0, 'bypass' => true), 'longitude' => array('number', 'default' => null, 'min' => -180.0, 'max' => 180.0, 'bypass' => true), 'tag' => array('string', 'default' => ''), 'acceptcomment' => array(array('0', '1'), 'default' => '0'), 'accepttrackback' => array(array('0', '1'), 'default' => '0'), 'published' => array('int', 0, 'default' => 1), 'draft' => array(array('0', '1'), 'default' => '0'))); require ROOT . '/library/preprocessor.php'; importlib("model.blog.entry"); requireStrictRoute(); $entry = array(); $entry['visibility'] = $_POST['visibility']; $entry['starred'] = $_POST['starred']; $entry['category'] = empty($_POST['category']) ? 0 : $_POST['category']; $entry['title'] = $_POST['title']; if (isset($_POST['permalink']) && $_POST['permalink'] != '') { $entry['slogan'] = $_POST['permalink']; } $entry['content'] = $_POST['content']; $entry['contentformatter'] = $_POST['contentformatter']; $entry['contenteditor'] = $_POST['contenteditor']; $entry['location'] = empty($_POST['location']) ? '/' : $_POST['location']; $entry['latitude'] = empty($_POST['latitude']) || $_POST['latitude'] == "null" ? null : $_POST['latitude']; $entry['longitude'] = empty($_POST['longitude']) || $_POST['longitude'] == "null" ? null : $_POST['longitude']; $entry['tag'] = empty($_POST['tag']) ? '' : $_POST['tag']; $entry['acceptcomment'] = empty($_POST['acceptcomment']) ? 0 : 1; $entry['accepttrackback'] = empty($_POST['accepttrackback']) ? 0 : 1; $entry['published'] = empty($_POST['published']) ? 1 : $_POST['published']; $entry['draft'] = empty($_POST['draft']) ? 0 : $_POST['draft']; if ($id = addEntry($blogid, $entry)) { fireEvent('AddPost', $id, $entry); Setting::setBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), $id); } $result = array(); $result['error'] = ($id !== false) === true ? 0 : 1; $result['entryId'] = $id; Respond::PrintResult($result);
define('__TEXTCUBE_ADMINPANEL__', true); $IV = array('GET' => array('requestURI' => array('url', 'mandatory' => false))); require ROOT . '/library/preprocessor.php'; global $openid_session; global $openid_session_id; $context = Model_Context::getInstance(); if (empty($_GET['requestURI'])) { $requestURI = $context->getProperty('uri.blog'); } else { $requestURI = filterJavaScript($_GET['requestURI']); if (Acl::getIdentity('openid')) { header("Location: {$requestURI}"); exit; } } list($openid_help_link, $openid_signup_link) = fireEvent('OpenIDAffiliateLinks', $requestURI); $img_url = $context->getProperty('uri.host') . $context->getProperty('service.path') . "/plugins/" . basename(dirname(__FILE__)) . "/login-bg.gif"; if (!empty($_COOKIE['openid'])) { $openid_remember_check = "checked"; $cookie_openid = $_COOKIE['openid']; } else { $openid_remember_check = ""; $cookie_openid = ''; } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title><?php echo _text('텍스트큐브') . ":" . _text('오픈아이디 인증');
static function updateVisitorStatistics($blogid) { global $database, $blogURL; if (!fireEvent('UpdatingVisitorStatistics', true)) { return; } if (doesHaveOwnership()) { return; } $id = session_id(); if (POD::queryCount("SELECT blogid FROM {$database['prefix']}SessionVisits WHERE id = '{$id}' AND address = '{$_SERVER['REMOTE_ADDR']}' AND blogid = {$blogid}") > 0) { return; } if (POD::queryCount("INSERT INTO {$database['prefix']}SessionVisits values('{$id}', '{$_SERVER['REMOTE_ADDR']}', {$blogid})") > 0) { if (POD::queryCount("UPDATE {$database['prefix']}BlogStatistics SET visits = visits + 1 WHERE blogid = {$blogid}") < 1) { POD::execute("INSERT into {$database['prefix']}BlogStatistics values({$blogid}, 1)"); } $period = Timestamp::getDate(); if (POD::queryCount("UPDATE {$database['prefix']}DailyStatistics SET visits = visits + 1 WHERE blogid = {$blogid} AND datemark = {$period}") < 1) { POD::execute("INSERT INTO {$database['prefix']}DailyStatistics VALUES ({$blogid}, {$period}, 1)"); } if (!empty($_SERVER['HTTP_REFERER'])) { $referer = parse_url($_SERVER['HTTP_REFERER']); if (!empty($referer['host']) && ($referer['host'] != $_SERVER['HTTP_HOST'] || strncmp($referer['path'], $blogURL, strlen($blogURL)) != 0)) { if (Filter::isFiltered('ip', $_SERVER['REMOTE_ADDR']) || Filter::isFiltered('url', $_SERVER['HTTP_REFERER'])) { return; } if (!fireEvent('AddingRefererLog', true, array('host' => $referer['host'], 'url' => $_SERVER['HTTP_REFERER']))) { return; } $host = POD::escapeString(Utils_Unicode::lessenAsEncoding($referer['host'], 64)); $url = POD::escapeString(Utils_Unicode::lessenAsEncoding($_SERVER['HTTP_REFERER'], 255)); POD::query("INSERT INTO {$database['prefix']}RefererLogs values({$blogid}, '{$host}', '{$url}', UNIX_TIMESTAMP())"); // POD::query("DELETE FROM {$database['prefix']}RefererLogs WHERE referred < UNIX_TIMESTAMP() - 604800"); // Moved to trashVan if (!POD::queryCount("UPDATE {$database['prefix']}RefererStatistics SET count = count + 1 WHERE blogid = {$blogid} AND host = '{$host}' LIMIT 1")) { POD::execute("INSERT into {$database['prefix']}RefererStatistics values({$blogid}, '{$host}', 1)"); } } } } }
function receiveNotifiedComment($post) { if (empty($post['mode']) || $post['mode'] != 'fb') { return 1; } global $database; CacheControl::flushCommentNotifyRSS(); $post = fireEvent('ReceiveNotifiedComment', $post); if ($post === false) { return 7; } $blogid = getBlogId(); $title = POD::escapeString(UTF8::lessenAsEncoding($post['s_home_title'], 255)); $name = POD::escapeString(UTF8::lessenAsEncoding($post['s_name'], 255)); $entryId = POD::escapeString($post['s_no']); $homepage = POD::escapeString(UTF8::lessenAsEncoding($post['url'], 255)); $entryurl = POD::escapeString($post['s_url']); $entrytitle = POD::escapeString($post['s_post_title']); $parent_id = $post['r1_no']; $parent_name = POD::escapeString(UTF8::lessenAsEncoding($post['r1_name'], 80)); $parent_parent = $post['r1_rno']; $parent_homepage = POD::escapeString(UTF8::lessenAsEncoding($post['r1_homepage'], 80)); $parent_written = $post['r1_regdate']; $parent_comment = POD::escapeString($post['r1_body']); $parent_url = POD::escapeString(UTF8::lessenAsEncoding($post['r1_url'], 255)); $child_id = $post['r2_no']; $child_name = POD::escapeString(UTF8::lessenAsEncoding($post['r2_name'], 80)); $child_parent = $post['r2_rno']; $child_homepage = POD::escapeString(UTF8::lessenAsEncoding($post['r2_homepage'], 80)); $child_written = $post['r2_regdate']; $child_comment = POD::escapeString($post['r2_body']); $child_url = POD::escapeString(UTF8::lessenAsEncoding($post['r2_url'], 255)); $siteid = POD::queryCell("SELECT id FROM {$database['prefix']}CommentsNotifiedSiteInfo WHERE url = '{$homepage}'"); if (empty($siteid)) { $insertId = getCommentsNotifiedSiteInfoMaxId() + 1; if (POD::execute("INSERT INTO {$database['prefix']}CommentsNotifiedSiteInfo\n\t\t\t( id, title, name, url, modified)\n\t\t\tVALUES ({$insertId}, '{$title}', '{$name}', '{$homepage}', UNIX_TIMESTAMP());")) { $siteid = $insertId; } else { return 2; } } $parentId = POD::queryCell("SELECT id\n\t\tFROM {$database['prefix']}CommentsNotified\n\t\tWHERE entry = {$entryId}\n\t\t\tAND siteid = {$siteid}\n\t\t\tAND blogid = {$blogid}\n\t\t\tAND remoteid = {$parent_id}"); if (empty($parentId)) { $insertId = getCommentsNotifiedMaxId() + 1; $sql = "INSERT INTO {$database['prefix']}CommentsNotified\n\t\t\t( blogid , replier , id , entry , parent , name , password , homepage , secret , comment , ip , written, modified , siteid , isnew , url , remoteid ,entrytitle , entryurl )\n\t\t\tVALUES (\n\t\t\t\t{$blogid}, NULL , {$insertId}, " . $entryId . ", " . (empty($parent_parent) ? 'null' : $parent_parent) . ", '" . $parent_name . "', '', '" . $parent_homepage . "', '', '" . $parent_comment . "', '', " . $parent_written . ",UNIX_TIMESTAMP(), " . $siteid . ", 1, '" . $parent_url . "'," . $parent_id . ", '" . $entrytitle . "', '" . $entryurl . "'\n)"; if (!POD::execute($sql)) { return 3; } $parentId = $insertId; } if (POD::queryCell("SELECT count(*) FROM {$database['prefix']}CommentsNotified WHERE siteid={$siteid} AND remoteid={$child_id}") > 0) { return 4; } $insertId = getCommentsNotifiedMaxId() + 1; $sql = "INSERT INTO {$database['prefix']}CommentsNotified\n\t\t( blogid , replier , id , entry , parent , name , password , homepage , secret , comment , ip , written, modified , siteid , isnew , url , remoteid ,entrytitle , entryurl )\n\t\tVALUES (\n\t\t\t{$blogid}, NULL , {$insertId}, " . $entryId . ", {$parentId}, '{$child_name}', '', '{$child_homepage}', '', '{$child_comment}', '', {$child_written}, UNIX_TIMESTAMP(), {$siteid}, 1, '{$child_url}', {$child_id}, '{$entrytitle}', '{$entryurl}')"; if (!POD::execute($sql)) { return 5; } $sql = "UPDATE {$database['prefix']}CommentsNotified SET modified = UNIX_TIMESTAMP() WHERE blogid = {$blogid} AND id = {$parentId}"; if (!POD::execute($sql)) { return 6; } return 0; }
function receiveNotifiedComment($post) { if (empty($post['mode']) || $post['mode'] != 'fb') { return 1; } $context = Model_Context::getInstance(); CacheControl::flushCommentNotifyRSS(); $post = fireEvent('ReceiveNotifiedComment', $post); if ($post === false) { return 7; } $pool = DBModel::getInstance(); $blogid = getBlogId(); $title = Utils_Unicode::lessenAsEncoding($post['s_home_title'], 255); $name = Utils_Unicode::lessenAsEncoding($post['s_name'], 255); $entryId = $post['s_no']; $homepage = Utils_Unicode::lessenAsEncoding($post['url'], 255); $entryurl = $post['s_url']; $entrytitle = $post['s_post_title']; $parent_id = $post['r1_no']; $parent_name = Utils_Unicode::lessenAsEncoding($post['r1_name'], 80); $parent_parent = $post['r1_rno']; $parent_homepage = Utils_Unicode::lessenAsEncoding($post['r1_homepage'], 80); $parent_written = $post['r1_regdate']; $parent_comment = $post['r1_body']; $parent_url = Utils_Unicode::lessenAsEncoding($post['r1_url'], 255); $child_id = $post['r2_no']; $child_name = Utils_Unicode::lessenAsEncoding($post['r2_name'], 80); $child_parent = $post['r2_rno']; $child_homepage = Utils_Unicode::lessenAsEncoding($post['r2_homepage'], 80); $child_written = $post['r2_regdate']; $child_comment = $post['r2_body']; $child_url = Utils_Unicode::lessenAsEncoding($post['r2_url'], 255); $pool->reset('CommentsNotifiedSiteInfo'); $pool->setQualifier('url', 'eq', $homepage); $siteid = $pool->getCell('id'); if (empty($siteid)) { $insertId = getCommentsNotifiedSiteInfoMaxId() + 1; $pool->reset('CommentsNotifiedSiteInfo'); $pool->setAttribute('id', $insertId); $pool->setAttribute('title', $title, true); $pool->setAttribute('name', $name, true); $pool->setAttribute('url', $homepage, true); $pool->setAttribute('modified', Timestamp::getUNIXtime()); if ($pool->insert()) { $siteid = $insertId; } else { return 2; } } $pool->reset('CommentsNotified'); $pool->setQualifier('entry', 'eq', $entryId); $pool->setQualifier('siteid', 'eq', $siteid); $pool->setQualifier('blogid', 'eq', $blogid); $pool->setQualifier('remoteid', 'eq', $parent_id); $parentId = $pool->getCell('id'); if (empty($parentId)) { $insertId = getCommentsNotifiedMaxId() + 1; $pool->reset('CommentsNotified'); $pool->setAttribute('blogid', $blogid); $pool->setAttribute('replier', NULL); $pool->setAttribute('id', $insertId); $pool->setAttribute('entry', $entryId); $pool->setAttribute('parent', empty($parent_parent) ? NULL : $parent_parent); $pool->setAttribute('name', $parent_name, true); $pool->setAttribute('password', '', true); $pool->setAttribute('homepage', $parent_homepage, true); $pool->setAttribute('secret', '', true); $pool->setAttribute('comment', $parent_comment, true); $pool->setAttribute('ip', '', true); $pool->setAttribute('written', $parent_written, true); $pool->setAttribute('modified', Timestamp::getUNIXtime()); $pool->setAttribute('siteid', $siteid); $pool->setAttribute('isnew', 1); $pool->setAttribute('url', $parent_url, true); $pool->setAttribute('remoteid', $parent_id); $pool->setAttribute('entrytitle', $entrytitle, true); $pool->setAttribute('entryurl', $entryurl, true); if (!$pool->insert()) { return 3; } $parentId = $insertId; } $pool->reset('CommentsNotified'); $pool->setQualifier('siteid', 'eq', $siteid); $pool->setQualifier('remoteid', 'eq', $child_id); if ($pool->getCount() > 0) { return 4; } $insertId = getCommentsNotifiedMaxId() + 1; $pool->reset('CommentsNotified'); $pool->setAttribute('blogid', $blogid); $pool->setAttribute('replier', NULL); $pool->setAttribute('id', $insertId); $pool->setAttribute('entry', $entryId); $pool->setAttribute('parent', $parentId); $pool->setAttribute('name', $child_name, true); $pool->setAttribute('password', '', true); $pool->setAttribute('homepage', $child_homepage, true); $pool->setAttribute('secret', '', true); $pool->setAttribute('comment', $child_comment, true); $pool->setAttribute('ip', '', true); $pool->setAttribute('written', $child_written, true); $pool->setAttribute('modified', Timestamp::getUNIXtime()); $pool->setAttribute('siteid', $siteid); $pool->setAttribute('isnew', 1); $pool->setAttribute('url', $child_url, true); $pool->setAttribute('remoteid', $child_id); $pool->setAttribute('entrytitle', $entrytitle, true); $pool->setAttribute('entryurl', $entryurl, true); if (!$pool->insert()) { return 5; } $pool->reset('CommentsNotified'); $pool->setAttribute('modified', Timestamp::getUNIXtime()); $pool->setQualifier('blogid', 'eq', $blogid); $pool->setQualifier('id', 'eq', $parentId); if (!$pool->update()) { return 6; } return 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) define('__TEXTCUBE_ADMINPANEL__', true); require ROOT . '/library/preprocessor.php'; importlib('model.blog.comment'); $IV = array('POST' => array('name' => array('string', 'default' => ''), 'comment' => array('string', 'default' => ''), 'mode' => array(array('commit'), 'default' => ''), 'homepage' => array('string', 'default' => ''), 'password' => array('string', 'default' => ''), 'secret' => array(array('on'), 'default' => null))); $context = Model_Context::getInstance(); $customIV = fireEvent('ManipulateIVRules', $IV, $context->getProperty('uri.interfaceRoute')); Validator::addRule($customIV); if (!Validator::isValid()) { Respond::PrintResult(array('error' => 1, 'description' => 'Illegal parameters')); } requireStrictRoute(); if (!Setting::getBlogSettingGlobal('acceptComments', 0) && !doesHaveOwnership()) { Respond::PrintResult(array('error' => 0, 'commentBlock' => '', 'recentCommentBlock' => '')); exit; } $pool = DBModel::getInstance(); if ((doesHaveMembership() || !empty($_POST['name'])) && !empty($_POST['comment']) && !empty($_POST['mode']) && $_POST['mode'] == 'commit') { if (!empty($_POST['name'])) { setcookie('guestName', $_POST['name'], time() + 2592000, $context->getProperty('uri.blog') . "/"); } if (!empty($_POST['homepage']) && $_POST['homepage'] != 'http://') { if (strpos($_POST['homepage'], 'http://') === 0) { setcookie('guestHomepage', $_POST['homepage'], time() + 2592000, $context->getProperty('uri.blog') . "/"); } else { setcookie('guestHomepage', 'http://' . $_POST['homepage'], time() + 2592000, $context->getProperty('uri.blog') . "/"); }
function receiveTrackback($blogid, $entry, $title, $url, $excerpt, $site) { global $database, $blog, $defaultURL; if (empty($url)) { return 5; } $post = new Post(); if (!$post->doesAcceptTrackback($entry)) { return 3; } $filtered = 0; if (!Filter::isAllowed($url)) { if (Filter::isFiltered('ip', $_SERVER['REMOTE_ADDR']) || Filter::isFiltered('url', $url)) { $filtered = 1; } else { if (Filter::isFiltered('content', $excerpt)) { $filtered = 1; } else { if (!fireEvent('AddingTrackback', true, array('entry' => $entry, 'url' => $url, 'site' => $site, 'title' => $title, 'excerpt' => $excerpt))) { $filtered = 1; } } } } $title = correctTTForXmlText($title); $excerpt = correctTTForXmlText($excerpt); $url = UTF8::lessenAsEncoding($url); $site = UTF8::lessenAsEncoding($site); $title = UTF8::lessenAsEncoding($title); $excerpt = UTF8::lessenAsEncoding($excerpt); $trackback = new Trackback(); $trackback->entry = $entry; $trackback->url = $url; $trackback->site = $site; $trackback->title = $title; $trackback->excerpt = $excerpt; if ($filtered > 0) { $trackback->isfiltered = true; } if ($trackback->add()) { if ($filtered == 0) { CacheControl::flushDBCache('trackback'); } return $filtered == 0 ? 0 : 3; } else { return 4; } return 0; }
$itemsView = '<li class="group">' . CRLF; $itemsView .= ' <span class="left">' . ($category == 0 ? _text('모든 카테고리') : ucwords(getCategoryNameById($blogid, $category))) . ' (' . $list['count'] . ')</span>' . CRLF; $itemsView .= ' <span class="right">Page <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 = 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; }
<?php /// Copyright (c) 2004-2012, Needlworks / Tatter Network Foundation /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) define('__TEXTCUBE_KEYLOG__', true); require ROOT . '/library/preprocessor.php'; if (strlen($suri['value'])) { if (!($keylog = getKeylogByTitle($blogid, $suri['value']))) { Respond::ErrorPage(); exit; } $entries = array(); $entries = getEntriesByKeyword($blogid, $keylog['title']); $skinSetting['keylogSkin'] = fireEvent('setKeylogSkin'); if (!is_null($skinSetting['keylogSkin'])) { require ROOT . '/interface/common/blog/keylog.php'; } else { Respond::ErrorPage(_t('No handling plugin')); } } else { $keywords = getKeywordNames($blogid, true); $skinSetting['keylogSkin'] = fireEvent('setKeylogSkin'); require ROOT . '/interface/common/blog/begin.php'; require ROOT . '/interface/common/blog/keywords.php'; require ROOT . '/interface/common/blog/end.php'; }
function saveFeedItem($feedId, $item) { global $database; $item = fireEvent('SaveFeedItem', $item); $item['permalink'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($item['permalink']))); $item['author'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($item['author']))); $item['title'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($item['title']))); $item['description'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($item['description']), 65535)); $tagString = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct(implode(', ', $item['tags'])))); $enclosureString = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct(implode('|', $item['enclosures'])))); if ($item['written'] > gmmktime() + 86400) { return false; } $deadLine = 0; $feedlife = POD::queryCell("SELECT feedlife FROM {$database['prefix']}FeedSettings"); if ($feedlife > 0) { $deadLine = gmmktime() - $feedlife * 86400; } if ($id = POD::queryCell("SELECT id FROM {$database['prefix']}FeedItems WHERE permalink='{$item['permalink']}'") && $item['written'] != 0) { $result = POD::query("UPDATE {$database['prefix']}FeedItems SET author = '{$item['author']}', title = '{$item['title']}', description = '{$item['description']}', tags = '{$tagString}', enclosure = '{$enclosureString}', written = {$item['written']} WHERE id = {$id}"); /* TODO : 읽은글이 읽지않은 글로 표시되는 문제 원인이 찾아질때 까지 막아둠 if (POD::num_rows($result) > 0) POD::query("DELETE FROM {$database['prefix']}FeedReads WHERE item = $id"); */ } else { if ($id != null) { return false; } else { if ($item['written'] == 0) { $item['written'] = gmmktime(); } if ($item['written'] > $deadLine) { $id = POD::queryCell("SELECT max(id) FROM {$database['prefix']}FeedItems"); if (!$id) { $id = 0; } $id++; POD::query("INSERT INTO {$database['prefix']}FeedItems VALUES({$id}, {$feedId}, '{$item['author']}', '{$item['permalink']}', '{$item['title']}', '{$item['description']}', '{$tagString}', '{$enclosureString}', {$item['written']})"); } } } return true; }
function useBlogSlogan($blogid, $useSloganOnPost, $useSloganOnCategory, $useSloganOnTag) { $ctx = Model_Context::getInstance(); $useSloganOnPost = $useSloganOnPost ? 1 : 0; $useSloganOnCategory = $useSloganOnCategory ? 1 : 0; $useSloganOnTag = $useSloganOnTag ? 1 : 0; if ($useSloganOnPost == $ctx->getProperty('blog.useSloganOnPost') && $useSloganOnCategory == $ctx->getProperty('blog.useSloganOnCategory') && $useSloganOnTag == $ctx->getProperty('blog.useSloganOnTag')) { return true; } /* if(Setting::setBlogSettingGlobal('useSloganOnPost',$useSlogan) === false || Setting::setBlogSettingGlobal('useSloganOnCategory',$useSlogan) === false || Setting::setBlogSettingGlobal('useSloganOnTag',$useSlogan) === false ) { return false; }*/ Setting::setBlogSettingGlobal('useSloganOnPost', $useSloganOnPost); Setting::setBlogSettingGlobal('useSloganOnCategory', $useSloganOnCategory); Setting::setBlogSettingGlobal('useSloganOnTag', $useSloganOnTag); $ctx->setProperty('blog.useSloganOnPost', $useSloganOnPost); $ctx->setProperty('blog.useSloganOnCategory', $useSloganOnCategory); $ctx->setProperty('blog.useSloganOnTag', $useSloganOnTag); requireModel('blog.feed'); CacheControl::flushCategory(); CacheControl::flushEntry(); CacheControl::flushTag(); fireEvent('ToggleBlogSlogan', null, $useSloganOnPost); clearFeed(); return true; }
function finishAuth($tid) { // Complete the authentication process using the server's response. $tr = Transaction::taste($tid); ob_start(); $response = $this->consumer->complete($tr['finishURL']); ob_end_clean(); $msg = ''; if ($response->status == Auth_OpenID_CANCEL) { // This means the authentication was cancelled. $msg = _text("인증이 취소되었습니다."); } else { if ($response->status == Auth_OpenID_FAILURE) { $msg = _text("오픈아이디 인증이 실패하였습니다: ") . $response->message; } else { if ($response->status == Auth_OpenID_SUCCESS) { $this->openid = $response->identity_url; $this->delegatedid = $response->endpoint->local_id; $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response); $this->sreg = $sreg_resp->contents(); if (!isset($this->sreg['nickname'])) { $this->sreg['nickname'] = ""; } $msg = ''; if (empty($tr['authenticate_only'])) { $this->setAcl($this->openid); $this->update($this->openid, $this->delegatedid, $this->sreg['nickname']); if (!empty($tr['need_writers'])) { if (!Acl::check('group.writers')) { $msg = _text("관리자 권한이 없는 오픈아이디 입니다") . " : " . $this->openid; } } fireEvent("AfterOpenIDLogin", $this->openid); } else { Acl::authorize('openid_temp', $this->openid); } } } } return $msg ? $this->_redirectWithError($msg, $tid) : $this->_redirectWithSucess($tid); }
if (count($entries) === 1) { unset($paging); } fireEvent('OBStart'); require ROOT . '/interface/common/blog/begin.php'; if (empty($entries)) { header('HTTP/1.1 404 Not Found'); if (empty($skin->pageError)) { dress('article_rep', fireEvent('ViewErrorPage', '<div class="TCwarning">' . _text('존재하지 않는 페이지입니다.') . '</div>'), $view); } else { dress('article_rep', NULL, $view); dress('page_error', fireEvent('ViewErrorPage', $skin->pageError), $view); } unset($paging); } else { require ROOT . '/interface/common/blog/entries.php'; } require ROOT . '/interface/common/blog/end.php'; fireEvent('OBEnd'); } else { if (!empty($freeSlogan)) { header("HTTP/1.1 404 Not Found"); exit; } list($entries, $paging) = getEntriesWithPagingByPage($blogid, $suri['page'], $blog['entriesOnPage']); fireEvent('OBStart'); require ROOT . '/interface/common/blog/begin.php'; require ROOT . '/interface/common/blog/entries.php'; require ROOT . '/interface/common/blog/end.php'; fireEvent('OBEnd'); }
function treatPluginTable($plugin, $name, $fields, $keys, $version) { $context = Model_Context::getInstance(); $query = DBModel::getInstance(); if (doesExistTable($context->getProperty('database.prefix') . $name)) { $keyname = 'Database_' . $name; $value = $plugin; $result = Setting::getServiceSetting($keyname, null, true); if (is_null($result)) { $keyname = Utils_Unicode::lessenAsEncoding($keyname, 32); $value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255); $query->reset('ServiceSettings'); $query->setAttribute('name', $keyname, true); $query->setAttribute('value', $value, true); $query->insert(); } else { $keyname = Utils_Unicode::lessenAsEncoding($keyname, 32); $value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255); $values = explode('/', $result, 2); if (strcmp($plugin, $values[0]) != 0) { // diff plugin return false; // nothing can be done } else { if (strcmp($version, $values[1]) != 0) { $query->reset('ServiceSettings'); $query->setQualifier('name', 'equals', $keyname, true); $query->setAttribute('value', $value, true); $query->update(); $eventName = 'UpdateDB_' . $name; fireEvent($eventName, $values[1]); } } } return true; } else { $query->init($name); $query->structure = array("blogid" => array("type" => 'integer', "isNull" => false, "default" => 0, "index" => true)); $isaiExists = false; foreach ($fields as $field) { $branch = array(); $ai = ''; if (strtolower($field['attribute']) == 'int' || strtolower($field['attribute']) == 'mediumint') { if ($field['autoincrement'] == 1 && !$isaiExists) { $branch['autoincrement'] = true; //$branch['index'] = true; $isaiExists = true; if (!in_array($field['name'], $keys)) { $branch['index'] = true; } } } $branch['type'] = strtolower($field['attribute']); if ($field['isnull'] == 0) { $branch['isNull'] = false; } else { $branch['isNull'] = true; } if (!is_null($field['default'])) { $branch['default'] = $field['default']; } if ($field['length'] >= 0) { $branch['length'] = $field['length']; } $query->structure[$field['name']] = $branch; } array_unshift($keys, 'blogid'); $query->option['primary'] = $keys; if ($query->create()) { $keyname = Utils_Unicode::lessenAsEncoding('Database_' . $name, 32); $value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255); Setting::setServiceSetting($keyname, $value, true); return true; } else { return false; } } return true; }
/resources/script/<?php echo $context->getProperty('service.admin_script'); ?> "></script> <?php } } if ($blogMenu['topMenu'] == 'entry' && in_array($blogMenu['contentMenu'], array('post', 'edit', 'keylog', 'template', 'notice'))) { ?> <script type="text/javascript" src="<?php echo $context->getProperty('service.path'); ?> /resources/script/editor3.js"></script> <?php } echo fireEvent('ShowAdminHeader', ''); /** Get Help URL **/ $submenuURL = null; if (strstr($blogMenu['contentMenu'], 'adminMenu?name=') !== false) { // Plugin. $submenuURL = $pluginMenuValue[0]; } else { $submenuURL = $blogMenu['contentMenu']; } $helpURL = $blogMenu['topMenu'] . (isset($blogMenu['contentMenu']) ? '/' . $submenuURL : ''); $writer = User::getName(); ?> </head> <body id="body-<?php echo $blogMenu['topMenu']; ?>
function printFeeds($blogid, $group = 0, $starredOnly = false, $searchKeyword = null) { ?> <div id="feedAdder"> <div class="title"><span><?php echo _t('피드 등록하기'); ?> </span></div> <div class="button-box"> <input type="text" id="newFeedURL" class="input-text" name="newFeedURL" value="<?php echo _t('피드 주소를 입력하세요.'); ?> " onfocus="if(this.value == '<?php echo _t('피드 주소를 입력하세요.'); ?> ') this.value = ''" onblur="if(this.value == '') this.value = '<?php echo _t('피드 주소를 입력하세요.'); ?> '" onkeydown="if(event.keyCode==13) Reader.addFeed(this.value)"/> <a class="add-button button" href="#void" onclick="Reader.addFeed(document.getElementById('newFeedURL').value)"><span class="text"><?php echo _t('추가'); ?> </span></a> <?php echo fireEvent('AddFeedURLToolbox', ''); ?> </div> </div> <ul id="feedList"> <?php $count = 0; foreach (getFeeds($blogid, $group, $starredOnly, $searchKeyword) as $feed) { if ($feed['modified'] > time() - 86400) { $status = 'Update'; } else { if ($feed['modified'] == 0) { $status = 'Failure'; } else { $status = 'UpdateNo'; } } $className = $count % 2 == 1 ? 'even-line' : 'odd-line'; ?> <li class="<?php echo $className; ?> inactive-class" onmouseover="rolloverClass(this, 'over')" onmouseout="rolloverClass(this, 'out')" onclick="Reader.selectFeed(this, <?php echo $feed['id']; ?> )"> <div class="title"><?php echo $feed['blogURL'] ? '<a href="' . htmlspecialchars($feed['blogURL']) . '" onclick="window.open(this.href); event.cancelBubble=true; return false;" title="' . _t('이 피드의 원본 사이트를 새 창으로 엽니다.') . '">' : ''; echo htmlspecialchars($feed['title']); echo $feed['blogURL'] ? "</a>\n" : ''; ?> </div> <div class="description"><?php echo $feed['description'] ? '<span class="divider"> | </span>' : ' '; echo htmlspecialchars($feed['description']); ?> </div> <div class="button-box"> <a id="iconFeedStatus<?php echo $feed['id']; ?> " class="update-button button" onclick="Reader.updateFeed(<?php echo $feed['id']; ?> , '<?php echo _t('피드를 갱신 했습니다.'); ?> '); event.cancelBubble=true; return false;" title="<?php echo _t('이 피드를 갱신 합니다.'); ?> "><span class="text"><?php echo _t('피드 갱신'); ?> </span></a> <span class="divider">|</span> <a class="edit-button button" href="#void" onclick="Reader.editFeed(<?php echo $feed['id']; ?> , '<?php echo escapeJSInAttribute($feed['xmlurl']); ?> ')" title="<?php echo _t('이 피드 정보를 수정합니다.'); ?> "><span class="text"><?php echo _t('수정'); ?> </span></a> </div> </li> <?php $count++; } ?> </ul> <div id="feedEditor" style="display: none;"> <div class="title"><span class="text"><?php echo _t('피드 수정하기'); ?> </span></div> <div class="input-box"> <div class="input-field"> <select id="changeFeedGroup"> <?php foreach (getFeedGroups($blogid) as $group) { if ($group['id'] == 0) { $group['title'] = _t('그룹 없음'); } ?> <option value="<?php echo $group['id']; ?> "><?php echo htmlspecialchars($group['title']); ?> </option> <?php } ?> </select> <input type="text" id="changeFeedURL" class="text-readonly-input" readonly="readonly"/> </div> <div class="button-box"> <input type="button" class="delete-button input-button" value="<?php echo _t('삭제'); ?> " onclick="Reader.deleteFeed(); return false;"/> <span class="divider">|</span> <input type="submit" class="edit-button input-button" value="<?php echo _t('저장'); ?> " onclick="Reader.editFeedExecute(); return false;"/> <span class="divider">|</span> <input type="button" class="cancel-button input-button" value="<?php echo _t('취소'); ?> " onclick="Reader.cancelEditFeed(); return false;"/> </div> </div> </div> <?php }
<?php /// 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) define('NO_SESSION', true); define('__TEXTCUBE_LOGIN__', true); define('__TEXTCUBE_CUSTOM_HEADER__', true); require ROOT . '/library/preprocessor.php'; importlib("model.blog.feed"); requireStrictBlogURL(); $children = array(); $cache = pageCache::getInstance(); $cache->reset('linesRSS'); if (!$cache->load()) { $result = getLinesFeed(getBlogId(), 'public', 'rss'); if ($result !== false) { $cache->reset('linesRSS'); $cache->contents = $result; $cache->update(); } } header('Content-Type: application/rss+xml; charset=utf-8'); fireEvent('FeedOBStart'); echo fireEvent('ViewLinesRSS', $cache->contents); fireEvent('FeedOBEnd');
function refreshFeed($blogid, $mode = 'both') { global $database, $serviceURL, $defaultURL, $blog, $service; $channel = array(); $channel = initializeRSSchannel($blogid); $result = 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 >= 0 AND (c.visibility > 1 OR e.category = 0)\n\t\tORDER BY e.published \n\t\tDESC LIMIT {$blog['entriesOnRSS']}"); if (!$result) { $result = array(); } $channel['items'] = getFeedItemByEntries($result); // RSS if ($mode == 'both' || $mode == 'rss') { $path = ROOT . '/cache/rss'; if (file_exists($path)) { if (!is_dir($path)) { return false; } } else { if (!mkdir($path)) { return false; } @chmod($path, 0777); } $path .= "/{$blogid}.xml"; $fileHandle = fopen($path, 'w'); $rss = array('channel' => $channel); if (fwrite($fileHandle, publishRSS($blogid, $rss))) { @chmod($path, 0666); fireEvent('refreshRSS', $rss); $result = true; } else { $result = false; } fclose($fileHandle); } // ATOM if ($mode == 'both' || $mode == 'atom') { $path = ROOT . '/cache/atom'; if (file_exists($path)) { if (!is_dir($path)) { return false; } } else { if (!mkdir($path)) { return false; } @chmod($path, 0777); } $path .= "/{$blogid}.xml"; $fileHandle = fopen($path, 'w'); $atom = array('channel' => $channel); if (fwrite($fileHandle, publishATOM($blogid, $atom))) { @chmod($path, 0666); fireEvent('refreshATOM', $atom); $result = true; } else { $result = false; } fclose($fileHandle); } if ($result) { return true; } else { return false; } }
function metaWeblog_editPost() { $params = func_get_args(); $result = api_login($params[1], $params[2]); if ($result) { return $result; } $post = api_make_post($params[3], $params[4], $params[0]); $post->created = null; if (!$post) { return new XMLRPCFault(1, "Textcube editing error"); } $ret = $post->update(); // 기존 글의 파일들 지우기 (잘 찾아서) // 새로 업로드 된 파일들 옮기기 api_update_attaches_with_replace($post->id); fireEvent('UpdatePostByBlogAPI', $id, $post); RSS::refresh(); $post->close(); if ($ret != false) { Setting::setBlogSettingGlobal('LatestEditedEntry', $post->id); } return $ret ? true : false; }
function publishEntries() { global $database; $blogid = getBlogId(); $closestReservedTime = Setting::getBlogSettingGlobal('closestReservedPostTime', INT_MAX); if ($closestReservedTime < Timestamp::getUNIXtime()) { $entries = POD::queryAll("SELECT id, visibility, category\n\t\t\tFROM {$database['prefix']}Entries \n\t\t\tWHERE blogid = {$blogid} AND draft = 0 AND visibility < 0 AND published < UNIX_TIMESTAMP()"); if (count($entries) == 0) { return; } foreach ($entries as $entry) { $result = POD::query("UPDATE {$database['prefix']}Entries \n\t\t\t\tSET visibility = 0 \n\t\t\t\tWHERE blogid = {$blogid} AND id = {$entry['id']} AND draft = 0"); if ($entry['visibility'] == -3) { if ($result && setEntryVisibility($entry['id'], 2)) { $updatedEntry = getEntry($blogid, $entry['id']); if (!is_null($updatedEntry)) { fireEvent('UpdatePost', $entry['id'], $updatedEntry); setEntryVisibility($entry['id'], 3); } } } else { if ($result) { setEntryVisibility($entry['id'], abs($entry['visibility'])); $updatedEntry = getEntry($blogid, $entry['id']); if (!is_null($updatedEntry)) { fireEvent('UpdatePost', $entry['id'], $updatedEntry); } } } } $newClosestTime = POD::queryCell("SELECT min(published)\n\t\t\tFROM {$database['prefix']}Entries\n\t\t\tWHERE blogid = {$blogid} AND draft = 0 AND visibility < 0 AND published > UNIX_TIMESTAMP()"); if (!empty($newClosestTime)) { Setting::setBlogSettingGlobal('closestReservedPostTime', $newClosestTime); } else { Setting::setBlogSettingGlobal('closestReservedPostTime', INT_MAX); } } }