function setBlogTitle($blogid, $title) { $context = Model_Context::getInstance(); if ($title == $context->getProperty('blog.title')) { return true; } if (Setting::setBlogSetting('title', Utils_Unicode::lessenAsEncoding($title, 255), true) === false) { return false; } $context->setProperty('blog.title', $title); requireModel('blog.feed'); requireLibrary('blog.skin'); clearFeed(); CacheControl::flushSkin(); return true; }
function setBlogSetting($name, $value) { return Setting::setBlogSetting($name, $value); }
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);
function setSkinSetting($blogid, $setting) { global $skinSetting; // Legacy global support. TODO: DELETE THIS LINE AFTER CHECK EVERY REFERENCES IN WHOLE SOURCE importlib('blogskin'); $blogid = getBlogId(); if (strncmp($context->getProperty('skin.skin'), 'customize/', 10) == 0) { if (strcmp($context->getProperty('skin.skin'), "customize/{$blogid}") != 0) { return false; } } else { $skinSetting['skin'] = Path::getBaseName($context->getProperty('skin.skin')); // Legacy global support. TODO: DELETE THIS LINE AFTER CHECK EVERY REFERENCES IN WHOLE SOURCE $context->setProperty('skin.skin', $skinSetting['skin']); if ($context->getProperty('skin.skin') === '.' || $context->getProperty('skin.skin') === '..') { return _t('실패 했습니다'); } } $skinpath = getSkinPath($context->getProperty('skin.skin')); if (!is_dir($skinpath)) { return _t('실패 했습니다'); } foreach ($setting as $key => $value) { Setting::setSkinSetting($key, $value, $blogid); } Setting::setSkinSetting('skin', $context->getProperty('skin.skin'), $blogid); Setting::setBlogSetting('useMicroformat', $setting['useMicroformat'], true); Setting::setBlogSetting('useAjaxComment', $setting['useAjaxComment'], true); Setting::setBlogSetting('useFOAF', $setting['useFOAF'] == 1 ? 1 : 0, true); Setting::setBlogSetting('entriesOnPage', $setting['entriesOnPage'], true); Setting::setBlogSetting('entriesOnList', $setting['entriesOnList'], true); CacheControl::flushCategory(); CacheControl::flushTag(); CacheControl::flushSkin(); Setting::getSkinSettings($blogid, true); // refresh skin cache return true; }
function updateEntry($blogid, $entry, $updateDraft = 0) { global $database, $blog, $gCacheStorage; requireModel('blog.tag'); requireModel('blog.locative'); requireModel('blog.attachment'); requireModel('blog.category'); requireModel('blog.feed'); requireComponent('Textcube.Data.Tag'); if ($entry['id'] == 0) { return false; } $oldEntry = POD::queryRow("SELECT *\n\t\tFROM {$database['prefix']}Entries\n\t\tWHERE blogid = {$blogid}\n\t\tAND id = {$entry['id']}\n\t\tAND draft = 0"); if (empty($oldEntry)) { return false; } if (empty($entry['userid'])) { $entry['userid'] = getUserId(); } $entry['title'] = UTF8::lessenAsEncoding(trim($entry['title'])); $entry['location'] = UTF8::lessenAsEncoding(trim($entry['location'])); $entry['slogan'] = array_key_exists('slogan', $entry) ? trim($entry['slogan']) : ''; if (empty($entry['slogan'])) { $slogan = $slogan0 = getSlogan($entry['title']); } else { $slogan = $slogan0 = getSlogan($entry['slogan']); } $slogan = POD::escapeString(UTF8::lessenAsEncoding($slogan, 255)); $title = POD::escapeString($entry['title']); if ($entry['category'] == -1) { if ($entry['visibility'] == 1 || $entry['visibility'] == 3) { return false; } if (POD::queryCell("SELECT count(*) \n\t\t\tFROM {$database['prefix']}Entries \n\t\t\tWHERE blogid = {$blogid} \n\t\t\t\tAND id <> {$entry['id']} \n\t\t\t\tAND draft = 0 \n\t\t\t\tAND title = '{$title}' \n\t\t\t\tAND category = -1") > 0) { return false; } } if ($entry['category'] < 0) { if ($entry['visibility'] == 1) { $entry['visibility'] = 0; } if ($entry['visibility'] == 3) { $entry['visibility'] = 2; } } if ($entry['category'] == -4) { $entry['visibility'] = 0; } $result = POD::queryCount("SELECT slogan \n\t\tFROM {$database['prefix']}Entries \n\t\tWHERE blogid = {$blogid} \n\t\tAND slogan = '{$slogan}' \n\t\tAND id = {$entry['id']} \n\t\tAND draft = 0\n\t\tLIMIT 1"); if ($result == 0) { // if changed $result = POD::queryCount("SELECT slogan FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND slogan = '{$slogan}' AND draft = 0 LIMIT 1"); for ($i = 1; $result > 0; $i++) { if ($i > 1000) { return false; } $slogan = POD::escapeString(UTF8::lessenAsEncoding($slogan0, 245) . '-' . $i); $result = POD::queryCount("SELECT slogan FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND slogan = '{$slogan}' AND draft = 0 LIMIT 1"); } } $tags = getTagsWithEntryString($entry['tag']); Tag::modifyTagsWithEntryId($blogid, $entry['id'], $tags); $location = POD::escapeString($entry['location']); $latitude = isset($entry['latitude']) && !is_null($entry['latitude']) ? $entry['latitude'] : 'NULL'; $longitude = isset($entry['longitude']) && !is_null($entry['longitude']) ? $entry['longitude'] : 'NULL'; $content = POD::escapeString($entry['content']); $contentformatter = POD::escapeString($entry['contentformatter']); $contenteditor = POD::escapeString($entry['contenteditor']); switch ($entry['published']) { case 0: $published = 'published'; break; case 1: $published = 'UNIX_TIMESTAMP()'; break; default: $published = $entry['published']; $entry['visibility'] = 0 - $entry['visibility']; if ($entry['visibility'] < 0) { $closestReservedTime = Setting::getBlogSettingGlobal('closestReservedPostTime', 9999999999); if ($published < $closestReservedTime) { Setting::setBlogSetting('closestReservedPostTime', $published, true); } } break; } $result = POD::query("UPDATE {$database['prefix']}Entries\n\t\t\tSET\n\t\t\t\tuserid = {$entry['userid']},\n\t\t\t\tvisibility = {$entry['visibility']},\n\t\t\t\tstarred = {$entry['starred']},\n\t\t\t\tcategory = {$entry['category']},\n\t\t\t\tdraft = 0,\n\t\t\t\tlocation = '{$location}',\n\t\t\t\tlatitude = {$latitude},\n\t\t\t\tlongitude = {$longitude},\n\t\t\t\ttitle = '{$title}',\n\t\t\t\tcontent = '{$content}',\n\t\t\t\tcontentformatter = '{$contentformatter}',\n\t\t\t\tcontenteditor = '{$contenteditor}',\n\t\t\t\tslogan = '{$slogan}',\n\t\t\t\tacceptcomment = {$entry['acceptcomment']},\n\t\t\t\taccepttrackback = {$entry['accepttrackback']},\n\t\t\t\tpublished = {$published},\n\t\t\t\tmodified = UNIX_TIMESTAMP()\n\t\t\tWHERE blogid = {$blogid} AND id = {$entry['id']} AND draft = {$updateDraft}"); if ($result) { @POD::query("DELETE FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND id = {$entry['id']} AND draft = 1"); } updateCategoryByEntryId($blogid, $entry['id'], 'update', array('category' => array($oldEntry['category'], $entry['category']), 'visibility' => array($oldEntry['visibility'], $entry['visibility']))); CacheControl::flushEntry($entry['id']); $gCacheStorage->purge(); if ($entry['visibility'] == 3) { syndicateEntry($entry['id'], 'modify'); } POD::query("UPDATE {$database['prefix']}Attachments SET parent = {$entry['id']} WHERE blogid = {$blogid} AND parent = 0"); if ($entry['visibility'] >= 2) { clearFeed(); } return $result ? $entry['id'] : false; }
break; } } $newParameter = array(); foreach ($parameters as $item) { if (isset($_REQUEST[$item['name']])) { switch ($item['type']) { case 'string': break; case 'int': if (!is_numeric($_REQUEST[$item['name']])) { continue; } break; default: continue; break; } $newParameter[$item['name']] = $_REQUEST[$item['name']]; } } $eventName = 'ModifyPluginParam_' . $plugin; fireEvent($eventName, null, $plugin); $coverpageOrderData[$coverpageNumber][$modulePos]['parameters'] = $newParameter; Setting::setBlogSetting("coverpageOrder", serialize($coverpageOrderData)); if ($ajaxcall == false) { if ($_REQUEST['viewMode'] != '') { $_REQUEST['viewMode'] = '?' . $_REQUEST['viewMode']; } header('Location: ' . $context->getProperty('uri.blog') . '/owner/skin/coverpage' . $_REQUEST['viewMode']); }
function PN_Referer_Default() { global $pluginMenuURL, $pluginSelfParam; if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['page'])) { $_GET['page'] = $_POST['page']; } $page = Setting::getBlogSetting('RowsPerPageReferer', 20); if (empty($_POST['perPage'])) { $perPage = $page; } else { if ($page != $_POST['perPage']) { Setting::setBlogSetting('RowsPerPageReferer', $_POST['perPage']); $perPage = $_POST['perPage']; } else { $perPage = $_POST['perPage']; } } ?> <div id="part-statistics-rank" class="part"> <h2 class="caption"><span class="main-text"><?php echo _t("리퍼러 순위"); ?> </span></h2> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th class="number"><span class="text"><?php echo _t("순위"); ?> </span></th> <th class="site"><span class="text"><?php echo _t("리퍼러"); ?> </span></th> </tr> </thead> <tbody> <?php $temp = Statistics::getRefererStatistics(getBlogId()); for ($i = 0; $i < count($temp); $i++) { $record = $temp[$i]; $className = $i % 2 == 1 ? 'even-line' : 'odd-line'; $className .= $i == sizeof($temp) - 1 ? ' last-line' : ''; ?> <tr class="<?php echo $className; ?> inactive-class" onmouseover="rolloverClass(this, 'over')" onmouseout="rolloverClass(this, 'out')"> <td class="rank"><?php echo $i + 1; ?> .</td> <td class="site"><a href="http://<?php echo Utils_Misc::escapeJSInAttribute($record['host']); ?> " onclick="window.open(this.href); return false;"><?php echo htmlspecialchars($record['host']); ?> </a> <span class="count">(<?php echo $record['count']; ?> )</span></td> </tr> <?php } ?> </tbody> </table> </div> <hr class="hidden" /> <form id="part-statistics-log" class="part" method="post" action="<?php echo $pluginMenuURL; ?> "> <h2 class="caption"><span class="main-text"><?php echo _t("리퍼러 로그"); ?> </span></h2> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th class="number"><span class="text">날짜</span></th> <th class="site"><span class="text">주소</span></th> </tr> </thead> <tbody> <?php $more = false; list($referers, $paging) = Statistics::getRefererLogsWithPage($_GET['page'], $perPage); for ($i = 0; $i < count($referers); $i++) { $record = $referers[$i]; $className = $i % 2 == 1 ? 'even-line' : 'odd-line'; $className .= $i == sizeof($referers) - 1 ? ' last-line' : ''; ?> <tr class="<?php echo $className; ?> inactive-class" onmouseover="rolloverClass(this, 'over')" onmouseout="rolloverClass(this, 'out')"> <td class="date"><?php echo Timestamp::formatDate($record['referred']); ?> </td> <td class="address"><a href="<?php echo Utils_Misc::escapeJSInAttribute($record['url']); ?> " onclick="window.open(this.href); return false;" title="<?php echo htmlspecialchars($record['url']); ?> "><?php echo fireEvent('ViewRefererURL', htmlspecialchars(Utils_Unicode::lessenAsEm($record['url'], 70)), $record); ?> </a></td> </tr> <?php } ?> </tbody> </table> <div class="data-subbox"> <div id="page-section" class="section"> <div id="page-navigation"> <span id="page-list"> <?php $paging['prefix'] = $pluginSelfParam . '&page='; $pagingTemplate = '[##_paging_rep_##]'; $pagingItemTemplate = '<a [##_paging_rep_link_##]>[[##_paging_rep_link_num_##]]</a>'; echo str_repeat("\t", 8) . Paging::getPagingView($paging, $pagingTemplate, $pagingItemTemplate) . CRLF; ?> </span> </div> <div class="page-count"> <?php echo Utils_Misc::getArrayValue(explode('%1', '한 페이지에 목록 %1건 표시'), 0); ?> <select name="perPage" onchange="document.getElementById('part-statistics-log').submit()"> <?php for ($i = 10; $i <= 30; $i += 5) { if ($i == $perPage) { ?> <option value="<?php echo $i; ?> " selected="selected"><?php echo $i; ?> </option> <?php } else { ?> <option value="<?php echo $i; ?> "><?php echo $i; ?> </option> <?php } } ?> </select> <?php echo Utils_Misc::getArrayValue(explode('%1', '한 페이지에 목록 %1건 표시'), 1); ?> </div> </div> </div> </form> <div class="clear"></div> <?php }
function PN_Subscription_setTime($target) { requireComponent("Textcube.Function.Setting"); Setting::setBlogSetting('LatestRSSrefresh', time()); return true; }
<?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('__TEXTCUBE_HEADER_XML__', true); require ROOT . '/library/preprocessor.php'; if ($_POST['visibility'] == 'private') { $visibility = 'private'; } else { $visibility = 'public'; } $password = Setting::getBlogSetting('LinePassword', null, true); if (is_null($password)) { $password = md5(generatePassword()); Setting::setBlogSetting('LinePassword', $password, true); } $provider = new Model_OpenSearchProvider(); $provider->setDescriptor('ShortName', Setting::getBlogSetting('title', 'TITLE', true)); $provider->setDescriptor('Description', Setting::getBlogSetting('description', 'DESCRIPTION', true)); $provider->setDescriptor('Url', null); $provider->addAttribute('/OpenSearchDescription', 'xmlns', 'http://a9.com/-/spec/opensearch/1.1/'); $provider->addAttribute('/OpenSearchDescription/Url', 'type', 'text/html'); $provider->addAttribute('/OpenSearchDescription/Url', 'template', $context->getProperty('uri.default') . '/line?key=' . $password . '&mode=' . $visibility . '&content={searchTerms}'); $provider->setDescriptor('Language', Setting::getBlogSetting('language', 'ko-kr', true)); $provider->setDescriptor('OutputEncoding', 'utf-8'); $provider->setDescriptor('InputEncoding', 'utf-8'); $provider->generate(); echo $provider->_xmlcontent;
function setSkinSetting($blogid, $setting) { global $database; global $skinSetting; requireLibrary('blog.skin'); $blogid = getBlogId(); if (strncmp($skinSetting['skin'], 'customize/', 10) == 0) { if (strcmp($skinSetting['skin'], "customize/{$blogid}") != 0) { return false; } } else { $skinSetting['skin'] = Path::getBaseName($skinSetting['skin']); if ($skinSetting['skin'] === '.' || $skinSetting['skin'] === '..') { return _t('실패 했습니다'); } } $skinpath = ROOT . '/skin/blog/' . $skinSetting['skin']; if (!is_dir($skinpath)) { return _t('실패 했습니다'); } foreach ($setting as $key => $value) { Setting::setSkinSetting($key, $value, $blogid); } Setting::setSkinSetting('skin', $skinSetting['skin'], $blogid); Setting::setBlogSetting('useMicroformat', $setting['useMicroformat'], true); Setting::setBlogSetting('useAjaxComment', $setting['useAjaxComment'], true); Setting::setBlogSetting('useFOAF', $setting['useFOAF'] == 1 ? 1 : 0, true); Setting::setBlogSetting('entriesOnPage', $setting['entriesOnPage'], true); Setting::setBlogSetting('entriesOnList', $setting['entriesOnList'], true); CacheControl::flushCategory(); CacheControl::flushTag(); CacheControl::flushSkin(); Setting::getSkinSettings($blogid, true); // refresh skin cache return true; }
function updateEntry($blogid, $entry, $updateDraft = 0) { $gCacheStorage = globalCacheStorage::getInstance(); $pool = DBModel::getInstance(); importlib('model.blog.tag'); importlib('model.blog.locative'); importlib('model.blog.attachment'); importlib('model.blog.category'); importlib('model.blog.feed'); if ($entry['id'] == 0) { return false; } $pool->init("Entries"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("id", "eq", $entry['id']); $pool->setQualifier("draft", "eq", 0); $oldEntry = $pool->getRow(); if (empty($oldEntry)) { return false; } if (empty($entry['userid'])) { $entry['userid'] = getUserId(); } $entry['title'] = Utils_Unicode::lessenAsEncoding(trim($entry['title'])); $entry['location'] = Utils_Unicode::lessenAsEncoding(trim($entry['location'])); $entry['slogan'] = array_key_exists('slogan', $entry) ? trim($entry['slogan']) : ''; if (empty($entry['slogan'])) { $slogan = $slogan0 = getSlogan($entry['title']); } else { $slogan = $slogan0 = getSlogan($entry['slogan']); } $slogan = Utils_Unicode::lessenAsEncoding($slogan, 255); if ($entry['category'] == -1) { if ($entry['visibility'] == 1 || $entry['visibility'] == 3) { return false; } $pool->init("Entries"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("id", "neq", $entry['id']); $pool->setQualifier("draft", "eq", 0); $pool->setQualifier("title", "eq", $entry['title'], true); $pool->setQualifier("category", "eq", -1); if ($pool->getCount() > 0) { return false; } } if ($entry['category'] < 0) { if ($entry['visibility'] == 1) { $entry['visibility'] = 0; } if ($entry['visibility'] == 3) { $entry['visibility'] = 2; } } if ($entry['category'] == -4) { $entry['visibility'] = 0; } $slogan = getUniqueSlogan($blogid, $slogan, $entry['id'], true); $tags = getTagsWithEntryString($entry['tag']); Tag::modifyTagsWithEntryId($blogid, $entry['id'], $tags); $latitude = isset($entry['latitude']) && !is_null($entry['latitude']) ? $entry['latitude'] : null; $longitude = isset($entry['longitude']) && !is_null($entry['longitude']) ? $entry['longitude'] : null; switch ($entry['published']) { case 0: $published = $oldEntry['published']; break; case 1: $published = Timestamp::getUNIXtime(); break; default: $published = $entry['published']; $entry['visibility'] = 0 - $entry['visibility']; if ($entry['visibility'] < 0) { $closestReservedTime = Setting::getBlogSettingGlobal('closestReservedPostTime', 9999999999.0); if ($published < $closestReservedTime) { Setting::setBlogSetting('closestReservedPostTime', $published, true); } } break; } $pool->reset("Entries"); $pool->setAttribute("userid", $entry['userid']); $pool->setAttribute("draft", 0); $pool->setAttribute("visibility", $entry['visibility']); $pool->setAttribute("starred", $entry['starred']); $pool->setAttribute("category", $entry['category']); $pool->setAttribute("title", $entry['title'], true); $pool->setAttribute("slogan", $slogan, true); $pool->setAttribute("content", $entry['content'], true); $pool->setAttribute("contentformatter", $entry['contentformatter'], true); $pool->setAttribute("contenteditor", $entry['contenteditor'], true); $pool->setAttribute("location", $entry['location'], true); $pool->setAttribute("latitude", $latitude); $pool->setAttribute("longitude", $longitude); $pool->setAttribute("acceptcomment", $entry['acceptcomment']); $pool->setAttribute("accepttrackback", $entry['accepttrackback']); $pool->setAttribute("published", $published); $pool->setAttribute("modified", Timestamp::getUNIXtime()); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("id", "eq", $entry['id']); $pool->setQualifier("draft", "eq", $updateDraft); $result = $pool->update(); if (!$result) { return false; } $pool->reset("Entries"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("id", "eq", $entry['id']); $pool->setQualifier("draft", "eq", 1); $pool->delete(); updateCategoryByEntryId($blogid, $entry['id'], 'update', array('category' => array($oldEntry['category'], $entry['category']), 'visibility' => array($oldEntry['visibility'], $entry['visibility']))); CacheControl::flushEntry($entry['id']); $gCacheStorage->purge(); if ($entry['visibility'] == 3) { syndicateEntry($entry['id'], 'modify'); } $pool->reset("Attachments"); $pool->setAttribute("parent", $entry['id']); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("parent", "eq", 0); $pool->update(); if ($entry['visibility'] >= 2) { clearFeed(); } return $result ? $entry['id'] : false; }
function PN_Subscription_setTime($target) { Setting::setBlogSetting('LatestRSSrefresh', time()); return true; }