function printIphoneCategoriesView($totalPosts, $categories) { global $blogURL, $service, $blog; requireModel('blog.category'); requireLibrary('blog.skin'); $blogid = getBlogId(); $categoryCount = 0; $categoryCountAll = 0; $parentCategoryCount = 0; $tree = array('id' => 0, 'label' => 'All Category', 'value' => $totalPosts, 'link' => "{$blogURL}/category/0", 'children' => array()); foreach ($categories as $category1) { $children = array(); if (doesHaveOwnership() || getCategoryVisibility($blogid, $category1['id']) > 1) { foreach ($category1['children'] as $category2) { if (doesHaveOwnership() || getCategoryVisibility($blogid, $category2['id']) > 1) { array_push($children, array('id' => $category2['id'], 'label' => $category2['name'], 'value' => doesHaveOwnership() ? $category2['entriesinlogin'] : $category2['entries'], 'link' => "{$blogURL}/category/" . $category2['id'], 'children' => array())); $categoryCount = $categoryCount + (doesHaveOwnership() ? $category2['entriesinlogin'] : $category2['entries']); } $categoryCountAll = $categoryCountAll + (doesHaveOwnership() ? $category2['entriesinlogin'] : $category2['entries']); } $parentCategoryCount = doesHaveOwnership() ? $category1['entriesinlogin'] - $categoryCountAll : $category1['entries'] - $categoryCountAll; if ($category1['id'] != 0) { array_push($tree['children'], array('id' => $category1['id'], 'label' => $category1['name'], 'value' => $categoryCount + $parentCategoryCount, 'link' => "{$blogURL}/category/" . $category1['id'], 'children' => $children)); } $categoryCount = 0; $categoryCountAll = 0; $parentCategoryCount = 0; } } return printIphonePrintTreeView($tree, true); }
function CT_Start_Default($target) { requireModel("blog.attachment"); requireComponent("Eolin.PHP.Core"); requireComponent("Textcube.Function.misc"); global $blogid, $blogURL, $database, $service; $target .= '<ul>'; $target .= '<li><a href="' . $blogURL . '/owner/entry/post">' . _t('새 글을 씁니다') . '</a></li>' . CRLF; $latestEntryId = Setting::getBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), 0); if ($latestEntryId !== 0) { $latestEntry = CT_Start_Default_getEntry($blogid, $latestEntryId); if ($latestEntry != false) { $target .= '<li><a href="' . $blogURL . '/owner/entry/edit/' . $latestEntry['id'] . '">' . _f('최근글(%1) 수정', htmlspecialchars(Utils_Unicode::lessenAsEm($latestEntry['title'], 10))) . '</a></li>'; } } if (Acl::check('group.administrators')) { $target .= '<li><a href="' . $blogURL . '/owner/skin">' . _t('스킨을 변경합니다') . '</a></li>' . CRLF; $target .= '<li><a href="' . $blogURL . '/owner/skin/sidebar">' . _t('사이드바 구성을 변경합니다') . '</a></li>' . CRLF; $target .= '<li><a href="' . $blogURL . '/owner/skin/setting">' . _t('블로그에 표시되는 값들을 변경합니다') . '</a></li>' . CRLF; $target .= '<li><a href="' . $blogURL . '/owner/entry/category">' . _t('카테고리를 변경합니다') . '</a></li>' . CRLF; $target .= '<li><a href="' . $blogURL . '/owner/plugin">' . _t('플러그인을 켜거나 끕니다') . '</a></li>' . CRLF; } if ($service['reader'] != false) { $target .= '<li><a href="' . $blogURL . '/owner/network/reader">' . _t('RSS 리더를 봅니다') . '</a></li>' . CRLF; } $target .= '</ul>'; return $target; }
function printMobileCategoriesView($totalPosts, $categories) { $context = Model_Context::getInstance(); requireModel('blog.category'); requireLibrary('blog.skin'); $blogid = $context->getProperty('blog.id'); $categoryCount = 0; $categoryCountAll = 0; $parentCategoryCount = 0; $tree = array('id' => 0, 'label' => 'All Category', 'value' => $totalPosts, 'link' => $context->getProperty('uri.blog') . "/category/0", 'children' => array()); foreach ($categories as $category1) { $children = array(); if (doesHaveOwnership() || getCategoryVisibility($blogid, $category1['id']) > 1) { foreach ($category1['children'] as $category2) { if (doesHaveOwnership() || getCategoryVisibility($blogid, $category2['id']) > 1) { array_push($children, array('id' => $category2['id'], 'label' => $category2['name'], 'value' => doesHaveOwnership() ? $category2['entriesinlogin'] : $category2['entries'], 'link' => $context->getProperty('uri.blog') . "/category/" . $category2['id'], 'children' => array())); $categoryCount = $categoryCount + (doesHaveOwnership() ? $category2['entriesinlogin'] : $category2['entries']); } $categoryCountAll = $categoryCountAll + (doesHaveOwnership() ? $category2['entriesinlogin'] : $category2['entries']); } $parentCategoryCount = doesHaveOwnership() ? $category1['entriesinlogin'] - $categoryCountAll : $category1['entries'] - $categoryCountAll; if ($category1['id'] != 0) { array_push($tree['children'], array('id' => $category1['id'], 'label' => $category1['name'], 'value' => $categoryCount + $parentCategoryCount, 'link' => $context->getProperty('uri.blog') . "/category/" . $category1['id'], 'children' => $children)); } $categoryCount = 0; $categoryCountAll = 0; $parentCategoryCount = 0; } } return printMobilePrintTreeView($tree, true); }
/** * @brief Send abstract about specific entry. * @see Tag, User, DBModel, Model_Context */ function sendAbstractToEolin() { // TODO : Rewrite routines to fit Textcube 1.8 or later. requireModel('blog.category'); $entryId = $_GET['entryId']; $context = Model_Context::getInstance(); $blogid = $context->getProperty('blog.id'); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<response>\r\n"; list($allComments, $allTrackbacks) = POD::queryRow("SELECT \n\t\t\tSUM(comments), SUM(trackbacks) \n\t\t\tFROM {$context->getProperty('database.prefix')}Entries \n\t\t\tWHERE blogid = " . $blogid . " AND draft = 0 AND visibility = 3", 'num'); if ($entry = POD::queryRow("SELECT e.*, c.name AS categoryName \n\t\t\t\tFROM {$context->getProperty('database.prefix')}Entries e \n\t\t\t\tLEFT JOIN {$context->getProperty('database.prefix')}Categories c ON e.blogid = c.blogid AND e.category = c.id \n\t\t\t\tWHERE e.blogid = " . $blogid . " AND e.id = " . $entryId . " AND e.draft = 0 AND e.visibility = 3" . getPrivateCategoryExclusionQuery($blogid))) { header('Content-Type: text/xml; charset=utf-8'); echo '<version>1.1</version>', "\r\n"; echo '<status>1</status>', "\r\n"; echo '<blog>', "\r\n"; echo '<generator>' . TEXTCUBE_NAME . '/' . TEXTCUBE_VERSION . '</generator>', "\r\n"; echo '<language>', htmlspecialchars($context->getProperty('blog.language')), '</language>', "\r\n"; echo '<url>', htmlspecialchars($context->getProperty('uri.default')), '</url>', "\r\n"; echo '<title>', htmlspecialchars($context->getProperty('blog.title')), '</title>', "\r\n"; echo '<description>', htmlspecialchars($context->getProperty('blog.description')), '</description>', "\r\n"; echo '<comments>', $allComments, '</comments>', "\r\n"; echo '<trackbacks>', $allTrackbacks, '</trackbacks>', "\r\n"; echo '</blog>', "\r\n"; echo '<entry>', "\r\n"; echo '<permalink>', htmlspecialchars($context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$entry['slogan']}" : $entry['id'])), '</permalink>', "\r\n"; echo '<title>', htmlspecialchars($entry['title']), '</title>', "\r\n"; echo '<content>', htmlspecialchars(getEntryContentView($blogid, $entryId, $entry['content'], $entry['contentformatter'])), '</content>', "\r\n"; echo '<author>', htmlspecialchars(User::authorName($blogid, $entryId)), '</author>', "\r\n"; echo '<category>', htmlspecialchars($entry['categoryName']), '</category>', "\r\n"; $tags = Tag::getTagsWithEntryId($blogid, $entry); foreach ($tags as $tag) { echo '<tag>', htmlspecialchars($tag), '</tag>', "\r\n"; } echo '<location>', htmlspecialchars($entry['location']), '</location>', "\r\n"; echo '<comments>', $entry['comments'], '</comments>', "\r\n"; echo '<trackbacks>', $entry['trackbacks'], '</trackbacks>', "\r\n"; echo '<written>', Timestamp::getRFC1123($entry['published']), '</written>', "\r\n"; foreach (getAttachments($blogid, $entry['id']) as $attachment) { echo '<attachment>', "\r\n"; echo '<mimeType>', $attachment['mime'], '</mimeType>', "\r\n"; echo '<filename>', $attachment['label'], '</filename>', "\r\n"; echo '<length>', $attachment['size'], '</length>', "\r\n"; echo '<url>', $context->getProperty('uri.service'), '/attachment/', $attachment['name'], '</url>', "\r\n"; echo '</attachment>', "\r\n"; } echo '</entry>', "\r\n"; } else { echo '<version>1.1</version>', "\r\n", '<status>0</status>', "\r\n"; } echo "</response>"; exit; }
function KeywordUI_bindTag($target, $mother) { global $blogURL, $pluginURL, $configVal; requireModel('blog.keyword'); $blogid = getBlogId(); if (isset($mother) && isset($target)) { $tagsWithKeywords = array(); $keywordNames = getKeywordNames($blogid); foreach ($target as $tag => $tagLink) { if (in_array($tag, $keywordNames) == true) { $tagsWithKeywords[$tag] = $tagLink . "<a href=\"#\" class=\"key1\" onclick=\"openKeyword('{$blogURL}/keylog/" . URL::encode($tag) . "'); return false\"><img src=\"" . $pluginURL . "/images/flag_green.gif\" alt=\"Keyword " . $tag . "\"/></a>"; } else { $tagsWithKeywords[$tag] = $tagLink; } } $target = $tagsWithKeywords; } return $target; }
function dumbCronScheduler($checkOnly = true) { $ctx = 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 = ROOT . '/cache/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') { requireModel('blog.trash'); trashVan(); } fwrite($log, date('Y-m-d H:i:s') . ' ' . $ctx->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; }
<?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) $IV = array('POST' => array('targets' => array('list', 'default' => '', 'mandatory' => false), 'ip' => array('ip', 'default' => '', 'mandatory' => false))); require ROOT . '/library/preprocessor.php'; requireModel("blog.comment"); requireStrictRoute(); $isAjaxRequest = checkAjaxRequest(); if (isset($suri['id'])) { if (trashCommentInOwner($blogid, $suri['id']) === true) { $isAjaxRequest ? Respond::ResultPage(0) : header("Location: " . $_SERVER['HTTP_REFERER']); } else { $isAjaxRequest ? Respond::ResultPage(-1) : header("Location: " . $_SERVER['HTTP_REFERER']); } } else { if (!empty($_POST['targets'])) { foreach (explode(',', $_POST['targets']) as $target) { trashCommentInOwner($blogid, $target); } } if (!empty($_POST['ip'])) { trashCommentInOwnerByIP($blogid, $_POST['ip']); } Respond::ResultPage(0); }
function setEntryVisibility($id, $visibility) { global $database; requireModel("blog.feed"); requireModel("blog.category"); requireComponent('Needlworks.Cache.PageCache'); $blogid = getBlogId(); if ($visibility < 0 || $visibility > 3) { return false; } list($oldVisibility, $category) = POD::queryRow("SELECT visibility, category FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND id = {$id} AND draft = 0"); if ($category < 0) { if ($visibility == 1) { $visibility = 0; } if ($visibility == 3) { $visibility = 2; } } if ($oldVisibility === null) { return false; } if ($visibility == $oldVisibility) { return true; } if ($oldVisibility == 3) { syndicateEntry($id, 'delete'); } else { if ($visibility == 3) { if (!syndicateEntry($id, 'create')) { POD::query("UPDATE {$database['prefix']}Entries \n\t\t\t\tSET visibility = {$oldVisibility}, \n\t\t\t\t\tmodified = UNIX_TIMESTAMP() \n\t\t\t\tWHERE blogid = {$blogid} AND id = {$id}"); return false; } } } $result = POD::queryCount("UPDATE {$database['prefix']}Entries \n\t\tSET visibility = {$visibility}, \n\t\t\tmodified = UNIX_TIMESTAMP() \n\t\tWHERE blogid = {$blogid} AND id = {$id}"); if (!$result) { // Error. return false; } if ($result == 0) { // Not changed. return true; } if ($category >= 0) { if ($oldVisibility >= 2 && $visibility < 2 || $oldVisibility < 2 && $visibility >= 2) { clearFeed(); } if ($oldVisibility == 3 && $visibility <= 2 || $oldVisibility <= 2 && $visibility == 3) { clearFeed(); } if ($category > 0) { updateCategoryByEntryId($blogid, $id, 'update', $parameters = array('visibility' => array($oldVisibility, $visibility))); } // updateEntriesOfCategory($blogid, $category); } CacheControl::flushEntry($id); CacheControl::flushDBCache('entry'); CacheControl::flushDBCache('comment'); CacheControl::flushDBCache('trackback'); fireEvent('ChangeVisibility', $visibility, $id); return true; }
<?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) $IV = array('POST' => array('name' => array('string'), 'rss' => array('string', 'default' => ''), 'url' => array('string'), 'category' => array('int', 'mandatory' => false), 'newCategory' => array('string', 'mandatory' => false))); require ROOT . '/library/preprocessor.php'; requireModel("blog.link"); requireStrictRoute(); if (strpos($_POST['rss'], 'http://') !== 0) { $_POST['rss'] = 'http://' . $_POST['rss']; } if (strpos($_POST['url'], 'http://') !== 0) { $_POST['url'] = 'http://' . $_POST['url']; } Respond::ResultPage(addLink($blogid, $_POST));
<?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) $IV = array('POST' => array('fileName' => array('filename'), 'order' => array(array('0', '1')))); require ROOT . '/library/preprocessor.php'; requireModel('blog.attachment'); requireStrictRoute(); $result = setEnclosure($_POST['fileName'], $_POST['order']); Respond::PrintResult(array('error' => $result < 3 ? 0 : 1, 'order' => $result));
<?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) if (isset($_POST['page'])) { $_GET['page'] = $_POST['page']; } $IV = array('GET' => array('category' => array('int', 'mandatory' => false), 'visibility' => array('string', 'mandatory' => false), 'page' => array('int', 1, 'default' => 1), 'tagId' => array('int', 1, 'mandatory' => false), 'search' => array('string', 'mandatory' => false)), 'POST' => array('category' => array('int', 'mandatory' => false), 'visibility' => array('string', 'mandatory' => false), 'categoryAtHome' => array('int', 'mandatory' => false), 'perPage' => array('int', 1, 'mandatory' => false), 'search' => array('string', 'mandatory' => false), 'withSearch' => array(array('on'), 'mandatory' => false))); require ROOT . '/library/preprocessor.php'; requireModel("blog.trash"); requireModel("blog.entry"); trashVan(); publishEntries(); // 카테고리 설정. if (isset($_POST['category'])) { $categoryId = $_POST['category']; } else { if (isset($_GET['category'])) { $categoryId = $_GET['category']; } else { if (isset($_POST['categoryAtHome'])) { $categoryId = $_POST['categoryAtHome']; } else { $categoryId = -5; } } } // 공개 / 비공개 설정 if (isset($_GET['visibility'])) { $_POST['visibility'] = $_GET['visibility'];
function cancelInvite($userid, $clean = true) { global $database; requireModel('blog.user'); if (POD::queryCell("SELECT count(*) FROM {$database['prefix']}Users WHERE userid = {$userid} AND lastlogin = 0") == 0) { return false; } if (POD::queryCell("SELECT count(*) FROM {$database['prefix']}Users WHERE userid = {$userid} AND host = " . getUserId()) === 0) { return false; } $blogidWithOwner = User::getOwnedBlogs($userid); foreach ($blogidWithOwner as $blogids) { if (deleteBlog($blogids) === false) { return false; } } if ($clean && !POD::queryAll("SELECT * FROM {$database['prefix']}Privileges WHERE userid = {$userid}")) { User::removePermanent($userid); } return true; }
<?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) if (count($_POST) > 0) { $IV = array('POST' => array('deleteCategory' => array('id', 'mandatory' => false), 'direction' => array(array('up', 'down'), 'mandatory' => false), 'id' => array('int', 'mandatory' => false), 'newCategory' => array('string', 'mandatory' => false), 'modifyCategoryName' => array('string', 'mandatory' => false), 'modifyCategoryBodyId' => array('string', 'default' => 'tt-body-category'), 'visibility' => array('int', 'mandatory' => false))); } require ROOT . '/library/preprocessor.php'; $context = Model_Context::getInstance(); requireModel('blog.category'); requireModel('blog.entry'); if (!empty($_POST['id'])) { $selected = $_POST['id']; } else { if (empty($_GET['id'])) { $selected = 0; } else { $selected = $_GET['id']; } } if (!empty($_POST['visibility'])) { $setVisibility = $_POST['visibility']; $visibility = setCategoryVisibility($blogid, $selected, $setVisibility); } else { $visibility = getCategoryVisibility($blogid, $selected); } if (!empty($_POST['deleteCategory'])) { $parent = getParentCategoryId($blogid, $_POST['deleteCategory']); $selected = is_null($parent) ? 0 : $parent; $_POST['modifyCategoryName'] = '';
function addUser($email, $name, $comment, $senderName, $senderEmail) { requireModel('blog.user'); requireModel('blog.blogSetting'); global $database, $service, $blogURL, $hostURL, $user, $blog; $blogid = getBlogId(); if (empty($email)) { return 1; } if (!preg_match('/^[^@]+@([-a-zA-Z0-9]+\\.)+[-a-zA-Z0-9]+$/', $email)) { return array(2, _t('이메일이 바르지 않습니다.')); } $isUserExists = User::getUserIdByEmail($email); if (empty($isUserExists)) { // If user is not exist User::add($email, $name); } $userid = User::getUserIdByEmail($email); $result = addBlog(getBlogId(), $userid, null); if ($result === true) { return sendInvitationMail(getBlogId(), $userid, User::getName($userid), $comment, $senderName, $senderEmail); } return $result; }
if (isset($_GET['url'])) { $_POST['url'] = $_GET['url']; } if (isset($_GET['withSearch'])) { $_POST['withSearch'] = $_GET['withSearch']; } if (isset($_GET['search'])) { $_POST['search'] = $_GET['search']; } if (isset($_GET['trashType'])) { $_POST['trashType'] = $_GET['trashType']; } $IV = array('GET' => array('page' => array('int', 1, 'default' => 1)), 'POST' => array('category' => array('int', 'default' => 0), 'site' => array('string', 'default' => ''), 'url' => array('url', 'default' => ''), 'ip' => array('ip', 'default' => ''), 'withSearch' => array(array('on'), 'mandatory' => false), 'search' => array('string', 'default' => ''), 'perPage' => array('int', 10, 30, 'mandatory' => false))); require ROOT . '/library/preprocessor.php'; requireModel("blog.response.remote"); requireModel("blog.trash"); $categoryId = empty($_POST['category']) ? 0 : $_POST['category']; $site = empty($_POST['site']) ? '' : $_POST['site']; $url = empty($_POST['url']) ? '' : $_POST['url']; $ip = empty($_POST['ip']) ? '' : $_POST['ip']; $search = empty($_POST['withSearch']) || empty($_POST['search']) ? '' : trim($_POST['search']); $perPage = Setting::getBlogSettingGlobal('rowsPerPage', 10); if (isset($_POST['perPage']) && is_numeric($_POST['perPage'])) { $perPage = $_POST['perPage']; Setting::setBlogSettingGlobal('rowsPerPage', $_POST['perPage']); } $tabsClass = array(); $tabsClass['postfix'] = null; $tabsClass['postfix'] .= isset($_POST['category']) ? '&category=' . $_POST['category'] : ''; $tabsClass['postfix'] .= isset($_POST['site']) ? '&site=' . $_POST['site'] : ''; $tabsClass['postfix'] .= isset($_POST['ip']) ? '&ip=' . $_POST['ip'] : '';
function setCategoryVisibility($blogid, $id, $visibility) { requireModel('blog.feed'); if ($id == 0) { return false; } $parentVisibility = getParentCategoryVisibility($blogid, $id); if ($parentVisibility !== false && $parentVisibility < 2) { return false; } // return without changing if parent category is set to hidden. $pool = DBModel::getInstance(); $pool->reset('Categories'); $pool->setAttribute('visibility', $visibility); $pool->setQualifier('blogid', 'eq', $blogid); $pool->setQualifier('id', 'eq', $id); $result = $pool->update(); if ($result && $visibility == 1) { $result = setChildCategoryVisibility($blogid, $id, $visibility); } if ($result) { clearFeed(); } updateEntriesOfCategory($blogid); CacheControl::flushCategory($id); return $result ? $visibility : false; }
/// 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('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');
function setCategoryVisibility($blogid, $id, $visibility) { global $database; requireModel('blog.feed'); if ($id == 0) { return false; } $parentVisibility = getParentCategoryVisibility($blogid, $id); if ($parentVisibility !== false && $parentVisibility < 2) { return false; } // return without changing if parent category is set to hidden. $result = POD::query("UPDATE {$database['prefix']}Categories\n\t\tSET visibility = {$visibility}\n\t\tWHERE blogid = {$blogid}\n\t\t\tAND id = {$id}"); if ($result && $visibility == 1) { $result = setChildCategoryVisibility($blogid, $id, $visibility); } if ($result) { clearFeed(); } updateEntriesOfCategory($blogid); CacheControl::flushCategory($id); return $result ? $visibility : false; }
<?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) $ajaxcall = false; if (isset($_REQUEST['ajaxcall'])) { $ajaxcall = true; $ajaxmethod = $_REQUEST['ajaxcall']; } $IV = array('REQUEST' => array('coverpageNumber' => array('int'), 'modulePos' => array('int'), 'viewMode' => array('string', 'default' => ''))); require ROOT . '/library/preprocessor.php'; requireLibrary('blog.skin'); requireModel("blog.sidebar"); requireModel("blog.coverpage"); requireStrictRoute(); $ctx = Model_Context::getInstance(); $skin = new Skin($ctx->getProperty('skin.skin')); $coverpageCount = count($skin->coverpageBasicModules); $coverpageOrderData = getCoverpageModuleOrderData($coverpageCount); $coverpageNumber = $_REQUEST['coverpageNumber']; $modulePos = $_REQUEST['modulePos']; if ($coverpageNumber < 0 || $coverpageNumber >= $coverpageCount) { Respond::ErrorPage(); } if (!isset($coverpageOrderData[$coverpageNumber]) || !isset($coverpageOrderData[$coverpageNumber][$modulePos])) { Respond::ErrorPage(); } $pluginData = $coverpageOrderData[$coverpageNumber][$modulePos]; if ($pluginData['type'] != 3) { Respond::ErrorPage();
$entry['id'] = $entryId; $entry['slogan'] = getSloganById($blogid, $entryId); if (!$comment['secret']) { $pool = DBModel::getInstance(); $pool->reset('Entries'); $pool->setQualifier('blogid', 'equals', $blogid); $pool->setQualifier('id', 'equals', $entryId); $pool->setQualifier('draft', 'equals', 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']); } } requireModel('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;
function save() { global $database; requireModel('common.setting'); if (isset($this->name)) { $this->name = trim($this->name); if (!BlogSetting::validateName($this->name)) { return $this->_error('name'); } Setting::setBlogSettingGlobal('name', $this->name); } if (isset($this->secondaryDomain)) { $this->secondaryDomain = trim($this->secondaryDomain); if (!Validator::domain($this->secondaryDomain)) { return $this->_error('secondaryDomain'); } Setting::setBlogSettingGlobal('secondaryDomain', $this->secondaryDomain); } if (isset($this->defaultDomain)) { Setting::setBlogSettingGlobal('defaultDomain', Validator::getBit($this->defaultDomain)); } if (isset($this->title)) { $this->title = trim($this->title); Setting::setBlogSettingGlobal('title', $this->title); } if (isset($this->description)) { $this->description = trim($this->description); Setting::setBlogSettingGlobal('description', $this->description); } if (isset($this->banner)) { if (strlen($this->banner) != 0 && !Validator::filename($this->banner)) { return $this->_error('banner'); } Setting::setBlogSettingGlobal('logo', $this->banner); } if (isset($this->useSloganOnPost)) { Setting::setBlogSettingGlobal('useSloganOnPost', Validator::getBit($this->useSloganOnPost)); } if (isset($this->useSloganOnCategory)) { Setting::setBlogSettingGlobal('useSloganOnCategory', Validator::getBit($this->useSloganOnCategory)); } if (isset($this->useSloganOnTag)) { Setting::setBlogSettingGlobal('useSloganOnTag', Validator::getBit($this->useSloganOnTag)); } if (isset($this->postsOnPage)) { if (!Validator::number($this->postsOnPage, 1)) { return $this->_error('postsOnPage'); } Setting::setBlogSettingGlobal('entriesOnPage', $this->postsOnPage); } if (isset($this->postsOnList)) { if (!Validator::number($this->postsOnList, 1)) { return $this->_error('postsOnList'); } Setting::setBlogSettingGlobal('entriesOnList', $this->postsOnList); } if (isset($this->postsOnFeed)) { if (!Validator::number($this->postsOnFeed, 1)) { return $this->_error('postsOnFeed'); } Setting::setBlogSettingGlobal('entriesOnRSS', $this->postsOnFeed); } if (isset($this->publishWholeOnFeed)) { Setting::setBlogSettingGlobal('publishWholeOnRSS', Validator::getBit($this->publishWholeOnFeed)); } if (isset($this->acceptGuestComment)) { Setting::setBlogSettingGlobal('allowWriteOnGuestbook', Validator::getBit($this->acceptGuestComment)); } if (isset($this->acceptcommentOnGuestComment)) { Setting::setBlogSettingGlobal('allowWriteDblCommentOnGuestbook', Validator::getBit($this->acceptcommentOnGuestComment)); } if (isset($this->language)) { if (!Validator::language($this->language)) { return $this->_error('language'); } Setting::setBlogSettingGlobal('language', $this->language); } if (isset($this->timezone)) { if (empty($this->timezone)) { return $this->_error('timezone'); } Setting::setBlogSettingGlobal('timezone', $this->timezone); } return true; }
function FM_TTML_bindAttachments($entryId, $folderPath, $folderURL, $content, $useAbsolutePath = false, $bRssMode = false) { $context = Model_Context::getInstance(); requireModel('blog.attachment'); $blogid = getBlogId(); getAttachments($blogid, $entryId); // For attachment caching. $view = str_replace('[##_ATTACH_PATH_##]', $useAbsolutePath ? $context->getProperty('uri.service') . "/attach/{$blogid}" : $folderURL, $content); $view = str_replace('http://tt_attach_path/', $useAbsolutePath ? $context->getProperty('uri.service') . "/attach/{$blogid}/" : $folderURL . '/', $view); $count = 0; $bWritedGalleryJS = false; while (($start = strpos($view, '[##_')) !== false && ($end = strpos($view, '_##]', $start + 4)) !== false) { $count++; $attributes = explode('|', substr($view, $start + 4, $end - $start - 4)); $prefix = ''; $buf = ''; if ($attributes[0] == 'Gallery') { if (count($attributes) % 2 == 1) { array_pop($attributes); } if (defined('__TEXTCUBE_MOBILE__') || defined('__TEXTCUBE_IPHONE__')) { $images = array_slice($attributes, 1, count($attributes) - 2); for ($i = 0; $i < count($images); $i++) { if (!empty($images[$i])) { if ($i % 2 == 0) { $buf .= '<div align="center">' . FM_TTML_getAttachmentBinder($images[$i], '', $folderPath, $folderURL, 1, $useAbsolutePath, $bRssMode) . '</div>'; } else { if (strlen($images[$i]) > 0) { $buf .= "<div align=\"center\">{$images[$i]}</div>"; } } } } } else { if ($bRssMode == true) { $items = array(); for ($i = 1; $i < sizeof($attributes) - 2; $i += 2) { array_push($items, array($attributes[$i], $attributes[$i + 1])); } $galleryAttributes = Misc::getAttributesFromString($attributes[sizeof($attributes) - 1]); $images = array_slice($attributes, 1, count($attributes) - 2); for ($i = 0; $i < count($images); $i++) { if (!empty($images[$i])) { if ($i % 2 == 0) { $setWidth = $setHeight = 0; if (list($width, $height) = @getimagesize("{$folderPath}/{$images[$i]}")) { $setWidth = $width; $setHeight = $height; if (isset($galleryAttributes['width']) && $galleryAttributes['width'] < $setWidth) { $setHeight = $setHeight * $galleryAttributes['width'] / $setWidth; $setWidth = $galleryAttributes['width']; } if (isset($galleryAttributes['height']) && $galleryAttributes['height'] < $setHeight) { $setWidth = $setWidth * $galleryAttributes['height'] / $setHeight; $setHeight = $galleryAttributes['height']; } if (intval($setWidth > 0) && intval($setHeight) > 0) { $tempProperty = 'width="' . intval($setWidth) . '" height="' . intval($setHeight) . '"'; } else { $tempProperty = ''; } $buf .= '<div align="center">' . FM_TTML_getAttachmentBinder($images[$i], $tempProperty, $folderPath, $folderURL, 1, $useAbsolutePath, $bRssMode) . '</div>'; } } else { if (strlen($images[$i]) > 0) { $buf .= "<div align=\"center\">{$images[$i]}</div>"; } } } } } else { $id = "gallery{$entryId}{$count}"; $cssId = "tt-gallery-{$entryId}-{$count}"; $contentWidth = Misc::getContentWidth(); $items = array(); for ($i = 1; $i < sizeof($attributes) - 2; $i += 2) { array_push($items, array($attributes[$i], $attributes[$i + 1])); } $galleryAttributes = Misc::getAttributesFromString($attributes[sizeof($attributes) - 1]); if (!isset($galleryAttributes['width'])) { $galleryAttributes['width'] = $contentWidth; } if (!isset($galleryAttributes['height'])) { $galleryAttributes['height'] = 3 / 4 * $galleryAttributes['width']; } if ($galleryAttributes['width'] > $contentWidth) { $galleryAttributes['height'] = $galleryAttributes['height'] * $contentWidth / $galleryAttributes['width']; $galleryAttributes['width'] = $contentWidth; } if ($useAbsolutePath == true && $bWritedGalleryJS == false) { $bWritedGalleryJS = true; $buf .= printScript('gallery.js'); } $buf .= CRLF . '<div id="' . $cssId . '" class="tt-gallery-box">' . CRLF; $buf .= ' <script type="text/javascript">' . CRLF; $buf .= ' //<![CDATA[' . CRLF; $buf .= "\t\t\tvar {$id} = new TTGallery(\"{$cssId}\");" . CRLF; $buf .= "\t\t\t{$id}.prevText = \"" . _text('이전 이미지 보기') . "\"; " . CRLF; $buf .= "\t\t\t{$id}.nextText = \"" . _text('다음 이미지 보기') . "\"; " . CRLF; $buf .= "\t\t\t{$id}.enlargeText = \"" . _text('원본 크기로 보기') . "\"; " . CRLF; $buf .= "\t\t\t{$id}.altText = \"" . _text('갤러리 이미지') . "\"; " . CRLF; foreach ($items as $item) { $setWidth = $setHeight = 0; if (list($width, $height) = @getimagesize("{$folderPath}/{$item['0']}")) { $setWidth = $width; $setHeight = $height; if (isset($galleryAttributes['width']) && $galleryAttributes['width'] < $setWidth) { $setHeight = $setHeight * $galleryAttributes['width'] / $setWidth; $setWidth = $galleryAttributes['width']; } if (isset($galleryAttributes['height']) && $galleryAttributes['height'] < $setHeight) { $setWidth = $setWidth * $galleryAttributes['height'] / $setHeight; $setHeight = $galleryAttributes['height']; } $item[1] = str_replace("'", ''', $item[1]); $buf .= $id . '.appendImage("' . ($useAbsolutePath ? $context->getProperty('uri.service') . "/attach/{$blogid}/{$item['0']}" : "{$folderURL}/{$item['0']}") . '", "' . htmlspecialchars($item[1]) . '", ' . intval($setWidth) . ', ' . intval($setHeight) . ");"; } } $buf .= "\t\t\t{$id}.show();" . CRLF; $buf .= "\t\t//]]>" . CRLF; $buf .= ' </script>' . CRLF; $buf .= ' <noscript>' . CRLF; foreach ($items as $item) { $setWidth = $setHeight = 0; if (list($width, $height) = @getimagesize("{$folderPath}/{$item['0']}")) { $setWidth = $width; $setHeight = $height; if (isset($galleryAttributes['width']) && $galleryAttributes['width'] < $setWidth) { $setHeight = $setHeight * $galleryAttributes['width'] / $setWidth; $setWidth = $galleryAttributes['width']; } if (isset($galleryAttributes['height']) && $galleryAttributes['height'] < $setHeight) { $setWidth = $setWidth * $galleryAttributes['height'] / $setHeight; $setHeight = $galleryAttributes['height']; } $buf .= '<div class="imageblock center" style="text-align: center; clear: both;">'; if ($useAbsolutePath) { $buf .= ' <img src="' . $context->getProperty('uri.service') . "/attach/" . $blogid . "/" . $item[0] . '" width="' . intval($setWidth) . '" height="' . intval($setHeight) . '" alt="' . _text('사용자 삽입 이미지') . '" />' . CRLF; } else { $buf .= ' <img src="' . $folderURL . "/" . $item[0] . '" width="' . intval($setWidth) . '" height="' . intval($setHeight) . '" alt="' . _text('사용자 삽입 이미지') . '" />' . CRLF; } if (!empty($item[1])) { $buf .= ' <p class="cap1">' . $item[1] . '</p>' . CRLF; } $buf .= '</div>'; } } $buf .= ' </noscript>' . CRLF; $buf .= '</div>' . CRLF; } } } else { if ($attributes[0] == 'iMazing') { if (defined('__TEXTCUBE_MOBILE__') || defined('__TEXTCUBE_IPHONE__') || $bRssMode == true) { $images = array_slice($attributes, 1, count($attributes) - 3); for ($i = 0; $i < count($images); $i += 2) { if (!empty($images[$i])) { $buf .= '<div>' . FM_TTML_getAttachmentBinder($images[$i], '', $folderPath, $folderURL, 1, $useAbsolutePath) . '</div>'; } } $buf .= $attributes[count($attributes) - 1]; } else { $params = Misc::getAttributesFromString($attributes[sizeof($attributes) - 2]); $id = $entryId . $count; $imgs = array_slice($attributes, 1, count($attributes) - 3); $imgStr = ''; for ($i = 0; $i < count($imgs); $i += 2) { if ($imgs[$i] != '') { $imgStr .= $context->getProperty('service.path') . '/attach/' . $blogid . '/' . $imgs[$i]; if ($i < count($imgs) - 2) { $imgStr .= '*!'; } } } if (!empty($attributes[count($attributes) - 1])) { $caption = '<p class="cap1">' . $attributes[count($attributes) - 1] . '</p>'; } else { $caption = ''; } $buf .= '<div style="clear: both; text-align: center"><img src="' . ($useAbsolutePath ? $context->getProperty('uri.service') : $context->getProperty('service.path')) . '/resources/image/gallery/gallery_enlarge.gif" alt="' . _text('확대') . '" style="cursor:pointer" onclick="openFullScreen(\'' . $context->getProperty('service.path') . '/iMazing?d=' . urlencode($id) . '&f=' . urlencode($params['frame']) . '&t=' . urlencode($params['transition']) . '&n=' . urlencode($params['navigation']) . '&si=' . urlencode($params['slideshowinterval']) . '&p=' . urlencode($params['page']) . '&a=' . urlencode($params['align']) . '&o=' . $blogid . '&i=' . $imgStr . '\',\'' . htmlspecialchars(str_replace("'", "'", $attributes[count($attributes) - 1])) . '\',\'' . $context->getProperty('service.path') . '\')" />'; $buf .= '<div id="iMazingContainer' . $id . '" class="iMazingContainer" style="width:' . $params['width'] . 'px; height:' . $params['height'] . 'px;"></div><script type="text/javascript">//<![CDATA[' . CRLF; $buf .= 'iMazing' . $id . 'Str = getEmbedCode(\'' . $context->getProperty('service.path') . '/resources/script/gallery/iMazing/main.swf\',\'100%\',\'100%\',\'iMazing' . $id . '\',\'#FFFFFF\',"image=' . $imgStr . '&frame=' . $params['frame'] . '&transition=' . $params['transition'] . '&navigation=' . $params['navigation'] . '&slideshowInterval=' . $params['slideshowinterval'] . '&page=' . $params['page'] . '&align=' . $params['align'] . '&skinPath=' . $context->getProperty('service.path') . '/resources/script/gallery/iMazing/&","false"); writeCode(iMazing' . $id . 'Str, "iMazingContainer' . $id . '");'; $buf .= '//]]></script><noscript>'; for ($i = 0; $i < count($imgs); $i += 2) { $buf .= '<img src="' . ($useAbsolutePath ? $context->getProperty('uri.service') : $context->getProperty('service.path')) . '/attach/' . $blogid . '/' . $imgs[$i] . '" alt="" />'; } $buf .= '</noscript>'; $buf .= $caption . '</div>'; } } else { if ($attributes[0] == 'Jukebox') { if (defined('__TEXTCUBE_MOBILE__') || defined('__TEXTCUBE_IPHONE__')) { $sounds = array_slice($attributes, 1, count($attributes) - 3); for ($i = 0; $i < count($sounds); $i += 2) { if (!empty($sounds[$i])) { echo "<a href=\"{$folderURL}/{$sounds[$i]}\">{$sounds[$i]}</a><br />"; } } } else { $params = Misc::getAttributesFromString($attributes[sizeof($attributes) - 2]); foreach ($params as $key => $value) { if ($key == 'autoPlay') { unset($params['autoplay']); $params['autoplay'] = $value; } } if ($params['visible'] == 1) { $width = '250px'; $height = '27px'; } else { $width = '0px'; $height = '0px'; } $id = $entryId . $count; $imgs = array_slice($attributes, 1, count($attributes) - 3); $imgStr = ''; for ($i = 0; $i < count($imgs); $i++) { if ($imgs[$i] == '') { continue; } if ($i % 2 == 1) { $imgStr .= urlencode($imgs[$i]) . '_*'; continue; } else { if ($i < count($imgs) - 1) { $imgStr .= $context->getProperty('service.path') . "/attach/{$blogid}/" . urlencode($imgs[$i]) . '*!'; } } } if (!empty($attributes[count($attributes) - 1])) { $caption = '<div class="cap1" style="text-align: center">' . $attributes[count($attributes) - 1] . '</div>'; } else { $caption = ''; } $buf .= '<div id="jukeBox' . $id . 'Div" style="margin-left: auto; margin-right: auto; width:' . $width . '; height:' . $height . ';"><div id="jukeBoxContainer' . $id . '" style="width:' . $width . '; height:' . $height . ';"></div>'; $buf .= '<script type="text/javascript">//<![CDATA[' . CRLF; $buf .= 'writeCode(getEmbedCode(\'' . $context->getProperty('service.path') . '/resources/script/jukebox/flash/main.swf\',\'100%\',\'100%\',\'jukeBox' . $id . 'Flash\',\'#FFFFFF\',"sounds=' . $imgStr . '&autoplay=' . $params['autoplay'] . '&visible=' . $params['visible'] . '&id=' . $id . '","false"), "jukeBoxContainer' . $id . '")'; $buf .= '//]]></script><noscript>'; for ($i = 0; $i < count($imgs); $i++) { if ($i % 2 == 0) { $buf .= '<a href="' . ($useAbsolutePath ? $context->getProperty('uri.service') : $context->getProperty('service.path')) . '/attach/' . $blogid . '/' . $imgs[$i] . '">'; } else { $buf .= htmlspecialchars($imgs[$i]) . '</a><br/>'; } } $buf .= '</noscript>'; $buf .= '</div>'; } } else { $contentWidth = Misc::getContentWidth(); switch (count($attributes)) { case 4: list($newProperty, $onclickFlag) = FM_TTML_createNewProperty($attributes[1], $contentWidth, $attributes[2]); if (defined('__TEXTCUBE_MOBILE__') || defined('__TEXTCUBE_IPHONE__')) { $buf = '<div>' . FM_TTML_getAttachmentBinder($attributes[1], $newProperty, $folderPath, $folderURL, 1, $useAbsolutePath) . "</div><div>{$attributes['3']}</div>"; } else { if (trim($attributes[3]) == '') { $caption = ''; } else { $caption = '<p class="cap1">' . $attributes[3] . '</p>'; } switch ($attributes[0]) { case '1L': $prefix = '<div class="imageblock left" style="float: left; margin-right: 10px;">'; break; case '1R': $prefix = '<div class="imageblock right" style="float: right; margin-left: 10px;">'; break; case '1C': default: $prefix = '<div class="imageblock center" style="text-align: center; clear: both;">'; break; } $buf = $prefix . FM_TTML_getAttachmentBinder($attributes[1], $newProperty, $folderPath, $folderURL, 1, $useAbsolutePath, $bRssMode, $onclickFlag) . $caption . '</div>'; } break; case 7: $eachImageWidth = floor(($contentWidth - 5 * 3) / 2); list($newProperty1, $onclickFlag1) = FM_TTML_createNewProperty($attributes[1], $eachImageWidth, $attributes[2]); list($newProperty2, $onclickFlag2) = FM_TTML_createNewProperty($attributes[4], $eachImageWidth, $attributes[5]); if (defined('__TEXTCUBE_MOBILE__') || defined('__TEXTCUBE_IPHONE__')) { $buf = '<div>' . FM_TTML_getAttachmentBinder($attributes[1], $newProperty1, $folderPath, $folderURL, 1, $useAbsolutePath, $bRssMode) . "</div><div>{$attributes['3']}</div>"; $buf .= '<div>' . FM_TTML_getAttachmentBinder($attributes[4], $newProperty2, $folderPath, $folderURL, 1, $useAbsolutePath, $bRssMode) . "</div><div>{$attributes['6']}</div>"; } else { $cap1 = strlen(trim($attributes[3])) > 0 ? '<p class="cap1">' . $attributes[3] . '</p>' : ''; $cap2 = strlen(trim($attributes[6])) > 0 ? '<p class="cap1">' . $attributes[6] . '</p>' : ''; $buf = '<div class="imageblock dual" style="text-align: center;"><table cellspacing="5" cellpadding="0" border="0" style="margin: 0 auto;"><tr><td>' . FM_TTML_getAttachmentBinder($attributes[1], $newProperty1, $folderPath, $folderURL, 2, $useAbsolutePath, $bRssMode, $onclickFlag1) . $cap1 . '</td><td>' . FM_TTML_getAttachmentBinder($attributes[4], $newProperty2, $folderPath, $folderURL, 2, $useAbsolutePath, $bRssMode, $onclickFlag2) . $cap2 . '</td></tr></table></div>'; } break; case 10: $eachImageWidth = floor(($contentWidth - 5 * 4) / 3); list($newProperty1, $onclickFlag1) = FM_TTML_createNewProperty($attributes[1], $eachImageWidth, $attributes[2]); list($newProperty2, $onclickFlag2) = FM_TTML_createNewProperty($attributes[4], $eachImageWidth, $attributes[5]); list($newProperty3, $onclickFlag3) = FM_TTML_createNewProperty($attributes[7], $eachImageWidth, $attributes[8]); if (defined('__TEXTCUBE_MOBILE__') || defined('__TEXTCUBE_IPHONE__')) { $buf = '<div>' . FM_TTML_getAttachmentBinder($attributes[1], $newProperty1, $folderPath, $folderURL, 1, $useAbsolutePath, $bRssMode) . "</div><div>{$attributes['3']}</div>"; $buf .= '<div>' . FM_TTML_getAttachmentBinder($attributes[4], $newProperty2, $folderPath, $folderURL, 1, $useAbsolutePath, $bRssMode) . "</div><div>{$attributes['6']}</div>"; $buf .= '<div>' . FM_TTML_getAttachmentBinder($attributes[7], $newProperty3, $folderPath, $folderURL, 1, $useAbsolutePath, $bRssMode) . "</div><div>{$attributes['9']}</div>"; } else { $cap1 = strlen(trim($attributes[3])) > 0 ? '<p class="cap1">' . $attributes[3] . '</p>' : ''; $cap2 = strlen(trim($attributes[6])) > 0 ? '<p class="cap1">' . $attributes[6] . '</p>' : ''; $cap3 = strlen(trim($attributes[9])) > 0 ? '<p class="cap1">' . $attributes[9] . '</p>' : ''; $buf = '<div class="imageblock triple" style="text-align: center"><table cellspacing="5" cellpadding="0" border="0" style="margin: 0 auto;"><tr><td>' . FM_TTML_getAttachmentBinder($attributes[1], $newProperty1, $folderPath, $folderURL, 3, $useAbsolutePath, $bRssMode, $onclickFlag1) . $cap1 . '</td><td>' . FM_TTML_getAttachmentBinder($attributes[4], $newProperty2, $folderPath, $folderURL, 3, $useAbsolutePath, $bRssMode, $onclickFlag2) . $cap2 . '</td><td>' . FM_TTML_getAttachmentBinder($attributes[7], $newProperty3, $folderPath, $folderURL, 3, $useAbsolutePath, $bRssMode, $onclickFlag3) . $cap3 . '</td></tr></table></div>'; } break; // 어디에도 해당되지 않을 경우 임시 태그를 되살림. // 어디에도 해당되지 않을 경우 임시 태그를 되살림. default: $buf = '[###_###_###_' . implode('|', $attributes) . '_###_###_###]'; break; } } } } $view = substr($view, 0, $start) . $buf . substr($view, $end + 4); } $view = preg_replace(array("@\\[###_###_###_@", "@_###_###_###\\]@"), array('[##_', '_##]'), $view); return $view; }
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; }
<?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) $ajaxcall = isset($_REQUEST['ajaxcall']) && $_REQUEST['ajaxcall'] == true ? true : false; $IV = array('REQUEST' => array('sidebarNumber' => array('int'), 'modulePos' => array('int'), 'targetSidebarNumber' => array('int'), 'targetPos' => array('int'), 'viewMode' => array('string', 'default' => ''))); require ROOT . '/library/preprocessor.php'; requireLibrary('blog.skin'); requireModel("blog.sidebar"); requireStrictRoute(); $ctx = Model_Context::getInstance(); $skin = new Skin($ctx->getProperty('skin.skin')); $sidebarCount = count($skin->sidebarBasicModules); $sidebarOrder = getSidebarModuleOrderData($sidebarCount); if ($_REQUEST['targetPos'] < 0 || $_REQUEST['targetPos'] > count($sidebarOrder[$_REQUEST['sidebarNumber']]) || $_REQUEST['targetSidebarNumber'] < 0 || $_REQUEST['targetSidebarNumber'] >= count($sidebarOrder)) { if ($_SERVER['REQUEST_METHOD'] != 'POST') { header('Location: ' . $context->getProperty('uri.blog') . '/owner/skin/sidebar' . $_REQUEST['viewMode']); } else { Respond::ResultPage(-1); } } else { if ($_REQUEST['sidebarNumber'] == $_REQUEST['targetSidebarNumber'] && $_REQUEST['modulePos'] < $_REQUEST['targetPos']) { $_REQUEST['targetPos']--; } $temp = array_splice($sidebarOrder[$_REQUEST['sidebarNumber']], $_REQUEST['modulePos'], 1); array_splice($sidebarOrder[$_REQUEST['targetSidebarNumber']], $_REQUEST['targetPos'], 0, $temp); Setting::setBlogSettingGlobal("sidebarOrder", serialize($sidebarOrder)); $skin->purgeCache(); } if ($_REQUEST['viewMode'] != '') {
function setDefaultPost($blogid, $userid) { requireModel('blog.entry'); $entry = array(); $entry['category'] = 0; $entry['visibility'] = 2; $entry['location'] = '/'; $entry['tag'] = ''; $entry['title'] = _t('환영합니다!'); $entry['slogan'] = 'welcome'; $entry['contentformatter'] = 'ttml'; $entry['contenteditor'] = 'tinyMCE'; $entry['starred'] = 0; $entry['acceptcomment'] = 1; $entry['accepttrackback'] = 1; $entry['published'] = null; $entry['firstEntry'] = true; $entry['content'] = getDefaultPostContent(); return addEntry($blogid, $entry, $userid); }
<?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) $IV = array('POST' => array('targets' => array('list', 'default' => ''))); require ROOT . '/library/preprocessor.php'; requireModel("blog.response.remote"); requireStrictRoute(); if (isset($suri['id'])) { $isAjaxRequest = checkAjaxRequest(); if (trashTrackback($blogid, $suri['id']) !== false) { $isAjaxRequest ? Respond::ResultPage(0) : header("Location: " . $_SERVER['HTTP_REFERER']); } else { $isAjaxRequest ? Respond::ResultPage(-1) : header("Location: " . $_SERVER['HTTP_REFERER']); } } else { foreach (explode(',', $_POST['targets']) as $target) { trashTrackback($blogid, $target); } Respond::ResultPage(0); }
<?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) $IV = array('GET' => array('draft' => array('any', 'mandatory' => false), 'popupEditor' => array('any', 'mandatory' => false), 'returnURL' => array('string', 'mandatory' => false), 'slogan' => array('string', 'mandatory' => false), 'category' => array('int', 'default' => 0), 'editor' => array('string', 'mandatory' => false)), 'POST' => array('category' => array('int', 'default' => 0), 'search' => array('string', 'default' => ''), 'slogan' => array('string', 'mandatory' => false), 'returnURL' => array('string', 'mandatory' => false))); require ROOT . '/library/preprocessor.php'; requireModel("blog.entry"); requireModel("blog.tag"); requireModel("blog.locative"); requireModel("blog.attachment"); $context = Model_Context::getInstance(); $isKeyword = false; define('__TEXTCUBE_EDIT__', true); if (defined('__TEXTCUBE_POST__')) { $suri['id'] = 0; } if (isset($_GET['draft'])) { $entry = getEntry(getBlogId(), $suri['id'], true); } else { $entry = getEntry(getBlogId(), $suri['id'], false); } if (is_null($entry)) { Respond::ErrorPage(_t('포스트 정보가 존재하지 않습니다.')); $isKeyword = $entry['category'] == -1; } if (defined('__TEXTCUBE_POST__') && isset($_GET['category'])) { $entry['category'] = $_GET['category']; } if (isset($_POST['slogan'])) { $_GET['slogan'] = $_POST['slogan'];
function showEmoticons_getEmoticons($target) { global $blogURL, $pluginURL, $__HCEMO; requireModel('reader.common'); requireComponent('Textcube.Model.Paging'); requireComponent('Textcube.Function.misc'); require_once 'emoticons.inc.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link type="text/css" rel="stylesheet" href="<?php echo $pluginURL; ?> /styles/default.css" /> </head> <script type="text/javascript"> //<![CDDA[ function insertHCEMO(_emoticons, _imagessrc){ var emoTag = '<img src="'+_imagessrc+'" border="0" alt="'+_emoticons+'" longdesc="[##_HCEMO_'+_emoticons+'_##]" />'; var isWYSIWYG = false; try{ if(parent.editor.editMode == 'WYSIWYG') isWYSIWYG = true; } catch(e){ } if(isWYSIWYG) { parent.editor.command('Raw', emoTag); }else{ parent.insertTag(parent.editor.textarea, emoTag); } } //]]> </script> <body style="margin:0;padding:0;border:none;background-color:#ffffff;"> <div id="emoticonsBody" style="height:200px;width:100%;overflow-x:hidden;overflow-y:auto;background-color:#fff;"> <?php $page = isset($_GET['page']) ? $_GET['page'] : 1; $items = isset($__HCEMO) ? count($__HCEMO) : 0; $listLength = 33; $paging = HCEMO_getFetchWithPaging($items, $page, $listLength, "{$blogURL}/plugin/getEmoticons"); $pagingTemplate = '[##_paging_rep_##]'; $pagingItemTemplate = '<a [##_paging_rep_link_##] class="num">[##_paging_rep_link_num_##]</a>'; if ($items > 0) { $counter['start'] = ($page - 1) * $listLength; $counter['end'] = $page * $listLength - 1; $counter['step'] = 0; foreach ($__HCEMO as $key => $images) { if ($counter['step'] >= $counter['start'] && $counter['step'] <= $counter['end']) { echo "<img class=\"emoticons\" src=\"{$pluginURL}/emoticons/{$images}\" border=\"0\" alt=\"{$key}\" onclick=\"insertHCEMO('{$key}','{$pluginURL}/emoticons/{$images}'); return false\" />"; } $counter['step']++; } } else { echo '<p style="margin-top:30px; text-align:center; font-size:9pt;">No emoticons installed.</p>'; } $prev_page = isset($paging['prev']) ? " href='?page={$paging['prev']}' " : ''; $next_page = isset($paging['next']) ? " href='?page={$paging['next']}' " : ''; $no_more_prev = isset($paging['prev']) ? '' : 'no-more-prev'; $no_more_next = isset($paging['next']) ? '' : 'no-more-next'; $target = '<div class="paging-list"><a ' . $prev_page . ' class="prev ' . $no_more_prev . '">prev </a>'; $target .= '<span class="numbox">' . str_repeat("\t", 12) . Paging::getPagingView($paging, $pagingTemplate, $pagingItemTemplate) . '</span>'; $target .= '<a ' . $next_page . ' class="next ' . $no_more_next . '"> next</a>'; $target .= '<div class="totalResults">'; $target .= 'Total ' . $items . ' icons.'; $target .= '</div></div>'; echo $target; ?> </div> </body> </html> <?php }
</span></th> </tr> </thead> <tbody> <?php //$likeEscape = array ( '/_/' , '/%/' ); //$likeReplace = array ( '\\_' , '\\%' ); //$escapename = preg_replace($likeEscape, $likeReplace, $database['prefix']); $dbtables = POD::tableList($database['prefix']); if (in_array(POD::dbms(), array('MySQL', 'MySQLi'))) { $result = POD::queryRow("SHOW VARIABLES LIKE 'lower_case_table_names'"); $dbCaseInsensitive = $result['Value'] == 1 ? true : false; } else { $dbCaseInsensitive = true; } requireModel('common.setting'); $definedTables = getDefinedTableNames(); $dbtables = array_values(array_diff($dbtables, $definedTables)); if ($dbCaseInsensitive == true) { $tempTables = $definedTables; $definedTables = array(); foreach ($tempTables as $table) { $table = strtolower($table); array_push($definedTables, $table); } $tempTables = $dbtables; $dbtables = array(); foreach ($tempTables as $table) { $table = strtolower($table); array_push($dbtables, $table); }
<?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) require ROOT . '/library/preprocessor.php'; requireModel('blog.entry'); requireModel('blog.response.remote'); requireModel('blog.sidebar'); define('__TEXTCUBE_NO_ENTRY_CACHE__', true); $entries = array(); if (is_null($entry = getEntry($blogid, $suri['id'], true))) { $entry = getEntry($blogid, $suri['id'], false); } if (!is_null($entry)) { if (isset($entry['appointed'])) { $entry['published'] = $entry['appointed']; } if (isset($entry['category']) && $entry['category'] >= 0) { $entry['categoryLabel'] = getCategoryLabelById($blogid, $entry['category']); } $entries[0] = $entry; } unset($entry); require ROOT . '/interface/common/blog/begin.php'; require ROOT . '/interface/common/blog/entries.php'; $pageTitle = _t('미리보기') . ' - ' . $pageTitle; require ROOT . '/interface/common/blog/end.php';