function CT_Start_Default($target) { importlib("model.blog.attachment"); $context = Model_Context::getInstance(); $blogURL = $context->getProperty('uri.blog'); $blogid = $context->getProperty('blog.id'); $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 ($context->getProperty('service.reader', false) != false) { $target .= '<li><a href="' . $blogURL . '/owner/network/reader">' . _t('RSS 리더를 봅니다') . '</a></li>' . CRLF; } $target .= '</ul>'; return $target; }
function getRecentNotices($blogid) { $context = Model_Context::getInstance(); $query = getDefaultDBModelOnNotice($blogid); $query->setLimit($context->getProperty('skin.noticesOnRecent')); return $query->getAll('id, title, slogan, published, userid'); }
function __construct() { $context = Model_Context::getInstance(); $this->buf = new Utils_OutputWriter(); $this->skin = new Skin($context->getProperty('skin.skin')); $this->view = $this->skin->outter; }
public function addSupport($parameters) { if (!is_array($parameters)) { $parameters = array($parameters); } $context = Model_Context::getInstance(); foreach ($parameters as $p) { switch ($p) { case 'URLglobals': global $serviceURL, $pathURL, $defaultURL, $baseURL, $pathURL, $hostURL, $folderURL, $blogURL; $context->useNamespace('uri'); $serviceURL = $context->getProperty('service'); $pathURL = $context->getProperty('path'); $defaultURL = $context->getProperty('default'); $baseURL = $context->getProperty('base'); $hostURL = $context->getProperty('host'); $folderURL = $context->getProperty('folder'); $blogURL = $context->getProperty('blog'); $context->useNamespace(); break; case 'globals': global $database, $service, $suri; $database = $context->getAllFromNamespace('database'); $service = $context->getAllFromNamespace('service'); $suri = $context->getAllFromNamespace('suri'); break; default: } } }
function getDefinedTableNames() { $context = Model_Context::getInstance(); $prefix = $context->getProperty('database.prefix'); $definedTables = array("{$prefix}Attachments", "{$prefix}BlogSettings", "{$prefix}BlogStatistics", "{$prefix}Categories", "{$prefix}Comments", "{$prefix}CommentsNotified", "{$prefix}CommentsNotifiedQueue", "{$prefix}CommentsNotifiedSiteInfo", "{$prefix}DailyStatistics", "{$prefix}Entries", "{$prefix}EntriesArchive", "{$prefix}FeedGroupRelations", "{$prefix}FeedGroups", "{$prefix}FeedItems", "{$prefix}FeedReads", "{$prefix}OpenIDUsers", "{$prefix}Feeds", "{$prefix}FeedSettings", "{$prefix}FeedStarred", "{$prefix}Filters", "{$prefix}Lines", "{$prefix}Links", "{$prefix}LinkCategories", "{$prefix}PageCacheLog", "{$prefix}Plugins", "{$prefix}Privileges", "{$prefix}RefererLogs", "{$prefix}RefererStatistics", "{$prefix}ReservedWords", "{$prefix}ServiceSettings", "{$prefix}Sessions", "{$prefix}SessionVisits", "{$prefix}SkinSettings", "{$prefix}TagRelations", "{$prefix}Tags", "{$prefix}TeamEntryRelations", "{$prefix}RemoteResponseLogs", "{$prefix}RemoteResponses", "{$prefix}Users", "{$prefix}UserSettings", "{$prefix}Widgets", "{$prefix}XMLRPCPingSettings"); return $definedTables; }
function open($filter = '', $fields = '*', $sort = 'datemark DESC') { $ctx = Model_Context::getInstance(); if (is_numeric($filter)) { $filter = 'AND datemark = ' . $filter; } else { if (!empty($filter)) { $filter = 'AND ' . $filter; } } if (!empty($sort)) { $sort = 'ORDER BY ' . $sort; } $this->close(); $this->_result = POD::query("SELECT {$fields} FROM " . $ctx->getProperty('database.prefix') . "DailyStatistics WHERE blogid = " . getBlogId() . " {$filter} {$sort}"); if ($this->_result) { if ($this->_count = POD::num_rows($this->_result)) { return $this->shift(); } else { POD::free($this->_result); } } unset($this->_result); return false; }
function __construct($table = null) { $this->context = Model_Context::getInstance(); $this->_called = true; $this->_buffer = null; $this->reset($table); }
/** Library binders **/ function importlib() { $context = Model_Context::getInstance(); $args = func_get_args(); if (empty($args)) { return false; } foreach ($args as $libPath) { $paths = explode(".", $libPath); if (end($paths) == "*") { array_pop($paths); foreach (new DirectoryIterator(ROOT . '/library/' . implode("/", $paths)) as $fileInfo) { if ($fileInfo->isFile()) { require_once $fileInfo->getPathname(); //$context->setPropertyItem('import.lib', implode(".", $paths).'.'.preg_replace('/\\.[^.\\s]{3,4}$/', '', $fileInfo->getFilename())); } } } else { //if (!in_array($libPath, $context->getProperty('import.lib',array()))) { require_once ROOT . '/library/' . str_replace(".", "/", $libPath) . ".php"; // $context->setPropertyItem('import.lib', $libPath); //} } } return true; }
private static function initialize() { global $memcache; /** After PHP 5.0.5, session write performs after object destruction. */ self::$mc = $memcache; /** To Avoid this, just copy memcache handle into Session object. */ self::$context = Model_Context::getInstance(); }
function CT_RecentPS_Default($target) { $context = Model_Context::getInstance(); $target .= '<ol>' . CRLF; $target .= _getRecentEntriesView(_getRecentEntries($context->getProperty('blog.id')), ' <li><a class="edit-link" href="[##_rctps_rep_edit_link_##]" style="background-image: url(\'' . $context->getProperty('plugin.uri', '') . '/images/edit.gif\'); background-position: left center; background-repeat: no-repeat; display: block; float: left; height: 12px; margin: 2px 5px 0 0; width: 12px;" title="' . _t('이 포스트를 편집합니다.') . '"><span class="text" style="display: none;">[편집하기]</span></a> <a href="[##_rctps_rep_link_##]" title="' . _t('포스트를 보여줍니다.') . '">[##_rctps_rep_title_##]</a> <span class="cnt">[##_rctps_rep_rp_cnt_##]</span></li>' . CRLF); $target .= ' </ol>' . CRLF; return $target; }
function CT_RecentRP_Default($target) { $context = Model_Context::getInstance(); $target .= '<ol>' . CRLF; $target .= RecentRP_getRecentCommentsView(RecentRP_getRecentComments($context->getProperty('blog.id')), ' <li><span class="date" style="display: block; font-family: Verdana, 돋움, Dotum, Tahoma, \'Lucida Grande\', sans-serif; font-size: 0.9em;">[##_rctrp_rep_time_##]</span> <a href="[##_rctrp_rep_link_##]">[##_rctrp_rep_desc_##]</a> <span class="name" style="color: #ABABAB;">[##_rctrp_rep_name_##]</span></li>' . CRLF); $target .= ' </ol>' . CRLF; return revertTempTags($target); }
function FM_Textile_summary($blogid, $id, $content, $keywords = array(), $useAbsolutePath = true) { $context = Model_Context::getInstance(); $view = FM_Textile_format($blogid, $id, $content, $keywords, $useAbsolutePath, true); if (!$context->getProperty("blog.publishWholeOnRSS")) { $view = Utils_Unicode::lessen(removeAllTags(stripHTML($view)), 255); } return $view; }
function TextcubeBirthdayDataSet($DATA) { $context = Model_Context::getInstance(); $cfg = $context->getProperty('plugin.config'); // if( $cfg['month'] != 날짜냐?) return "잘못된 날짜입니다."; // 등등등등 여기서 원하는 검증을 하시고 검증 실패시 사용자에게 보여줄 에러메세지를 보내주심 됩니다. // 성공하면 그냥 true return true; }
function FM_Modern_adminheader($target, $mother) { $context = Model_Context::getInstance(); if ($context->getProperty('editor.key') == 'modern') { if ($context->getProperty('suri.directive') == '/owner/entry/post' || $context->getProperty('suri.directive') == '/owner/entry/edit') { $target .= "\t<link rel=\"stylesheet\" media=\"screen\" type=\"text/css\" href=\"" . $context->getProperty('plugin.uri') . "/editor.css\" />\n"; $target .= "\t<script type=\"text/javascript\" src=\"" . $context->getProperty('plugin.uri') . "/editor.js\"></script>\n"; } } return $target; }
function FAS_Call($type, $name, $title, $url, $content) { $context = Model_Context::getInstance(); $pool = DBModel::getInstance(); $blogstr = $context->getProperty('uri.host') . $context->getProperty('uri.blog'); $DDosTimeWindowSize = 300; $rpc = new XMLRPC(); $rpc->url = 'http://antispam.textcube.org/RPC/'; if ($rpc->call('checkSpam', $blogstr, $type, $name, $title, $url, $content, $_SERVER['REMOTE_ADDR']) == false) { // call fail // Do Local spam check with "Thief-cat algorithm" $count = 0; if ($type == 2) { $storage = "RemoteResponses"; $pool->reset($storage); $pool->setQualifier("url", "eq", $url, true); $pool->setQualifier("isfiltered", ">", 0); if ($cnt = $pool->getCount("id")) { $count += $cnt; } } else { // Comment Case $storage = "Comments"; $pool->reset($storage); $pool->setQualifier("comment", "eq", ${$content}, true); $pool->setQualifier("name", "eq", $name, true); $pool->setQualifier("homepage", "eq", $url, true); $pool->setQualifier("isfiltered", ">", 0); if ($cnt = $pool->getCount("id")) { $count += $cnt; } } // Check IP $pool->reset($storage); $pool->setQualifier("ip", "eq", $_SERVER['REMOTE_ADDR'], true); $pool->setQualifier("written", ">", Timestamp::getUNIXtime() - $DDosTimeWindowSize); if ($cnt = $pool->getCount("id")) { $count += $cnt; } if ($count >= 10) { return false; } return true; } if (!is_null($rpc->fault)) { // FAS has some problem return true; } if ($rpc->result['result'] == true) { return false; // it's spam } return true; }
function checkCronJob() { $context = Model_Context::getInstance(); /* Cron, only in single page request, not in a page dead link */ if (!empty($_SERVER['HTTP_REFERER']) || !dumbCronScheduler(true)) { return; } $request = new HTTPRequest('GET', $context->getProperty('uri.default') . '/cron'); $request->timeout = 2; $request->send(); }
function WikiCube_FormatErrorPage($target) { global $configVal; $config = Setting::fetchConfigVal($configVal); if (empty($config['mode'])) { $config['mode'] = 'entry'; } $context = Model_Context::getInstance(); $additional = '<div style="border:none;width:100%;text-align:center;"><a href="' . $context->getProperty('uri.blog') . '/owner/entry/post?slogan=' . $context->getProperty('suri.value') . ($config['mode'] == 'entry' ? '' : '&category=-3') . '">' . _text('Empty page. Click here to add a new entry.') . '</a></div>'; return $target . $additional; }
function deleteOpenID($openidForDel) { $context = Model_Context::getInstance(); for ($i = 0; $i < OPENID_REGISTERS; $i++) { $openid = Setting::getUserSetting("openid." . $i, null, true); if ($openid == $openidForDel) { Setting::removeUserSetting("openid." . $i, true); break; } } echo "<html><head><script type=\"text/javascript\">//<![CDATA[" . CRLF . "alert('" . _t('삭제되었습니다.') . "'); document.location.href='" . $context->getProperty('uri.blog') . "/owner/setting/account'; //]]></script></head></html>"; }
function getKeywordsWithPaging($blogid, $search, $page, $count) { $ctx = Model_Context::getInstance(); $aux = ''; if ($search !== true && $search) { $search = POD::escapeString($search); $aux = "AND (title LIKE '%{$search}%' OR content LIKE '%{$search}%')"; } $visibility = doesHaveOwnership() ? '' : 'AND visibility > 0'; $sql = "SELECT * \n\t\tFROM " . $ctx->getProperty('database.prefix') . "Entries \n\t\tWHERE blogid = {$blogid} \n\t\t\tAND draft = 0 {$visibility} \n\t\t\tAND category = -1 {$aux} \n\t\tORDER BY published DESC"; return Paging::fetch($sql, $page, $count, $ctx->getProperty('uri.folder') . "/" . $ctx->getProperty('suri.value')); }
function SB_Spacer($target) { $context = Model_Context::getInstance(); $data = $context->getProperty('plugin.config'); if (!is_null($data) && array_key_exists('height', $data)) { $height = $data['height']; } else { $height = '20'; } $text = '<div class="SB_Spacer" style="height:' . $height . 'px;"></div>'; return $text; }
function resampleImage($imgString, $filename, $useAbsolutePath = true) { $blogid = getBlogId(); $context = Model_Context::getInstance(); if (!extension_loaded('gd') || !file_exists(ROOT . "/attach/{$blogid}/{$filename}")) { return $imgString; } if (!is_dir(ROOT . "/cache/thumbnail")) { @mkdir(ROOT . "/cache/thumbnail"); @chmod(ROOT . "/cache/thumbnail", 0777); } if (!is_dir(ROOT . "/cache/thumbnail/" . getBlogId())) { @mkdir(ROOT . "/cache/thumbnail/" . getBlogId()); @chmod(ROOT . "/cache/thumbnail/" . getBlogId(), 0777); } $origImageSrc = ($useAbsolutePath ? $context->getProperty('uri.service') : $context->getProperty('uri.path')) . "/attach/{$blogid}/{$filename}"; $tempWidth = $tempHeight = ''; if (preg_match('/width="([1-9][0-9]*)"/i', $imgString, $temp)) { $tempWidth = $temp[1]; } if (preg_match('/height="([1-9][0-9]*)"/i', $imgString, $temp)) { $tempHeight = $temp[1]; } if (!empty($tempWidth) && is_numeric($tempWidth) && !empty($tempHeight) && is_numeric($tempHeight)) { $resizeImage = getImageResizer($filename, array('width' => $tempWidth, 'height' => $tempHeight, 'absolute' => $useAbsolutePath)); } else { if (!empty($tempWidth) && !is_numeric($tempWidth) && empty($tempHeight)) { $resizeImage = getImageResizer($filename, array('width' => $tempWidth, 'absolute' => $useAbsolutePath)); } else { if (empty($tempWidth) && !empty($tempHeight) && is_numeric($tempHeight)) { $resizeImage = getImageResizer($filename, array('height' => $tempHeight, 'absolute' => $useAbsolutePath)); } else { return $imgString; } } } if ($resizeImage === false) { return $imgString; } if (basename($resizeImage[0]) == $filename) { return $imgString; } $resizeImageSrc = $resizeImage[0]; $resizeImageWidth = $resizeImage[1]; $resizeImageHeight = $resizeImage[2]; $imgString = preg_replace('/src="([^"]+)"/i', 'src="' . $resizeImageSrc . '"', $imgString); $imgString = preg_replace('/width="([^"]+)"/i', 'width="' . $resizeImageWidth . '"', $imgString); $imgString = preg_replace('/height="([^"]+)"/i', 'height="' . $resizeImageHeight . '"', $imgString); $imgString = preg_replace('/onclick="open_img\\(\'([^\']+)\'\\)"/', "onclick=\"open_img('{$origImageSrc}')\"", $imgString); return $imgString; }
/** * @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 getDefaultDBModelOnNotice($blogid) { $context = Model_Context::getInstance(); $query = DBModel::getInstance(); $query->reset('Entries'); $query->setQualifier('blogid', 'equals', $blogid); $query->setQualifier('draft', 'equals', 0); if (!doesHaveOwnership()) { $query->setQualifier('visibility', 'bigger', 1); } $query->setQualifier('category', 'equals', -2); $query->setOrder('published', 'DESC'); return $query; }
function activateDetailPanelJS() { global $fxList; $context = Model_Context::getInstance(); $jsVal = ''; if (!empty($fxList) && $context->getProperty('service.interface') == 'simple') { $jsVal = "jQuery(document).ready(function(jQuery) {" . CRLF; foreach ($fxList as $fxItem) { $jsVal .= TAB . TAB . TAB . TAB . TAB . TAB . TAB . 'jQuery("#toggle' . $fxItem . '").click( function() {' . CRLF . TAB . TAB . TAB . TAB . TAB . TAB . TAB . TAB . 'if (jQuery("#' . $fxItem . '").is(":hidden")) {' . CRLF . TAB . TAB . TAB . TAB . TAB . TAB . TAB . TAB . ' jQuery("#' . $fxItem . '").slideDown(150);' . CRLF . TAB . TAB . TAB . TAB . TAB . TAB . TAB . TAB . '} else {' . CRLF . TAB . TAB . TAB . TAB . TAB . TAB . TAB . TAB . ' jQuery("#' . $fxItem . '").slideUp(150);' . CRLF . TAB . TAB . TAB . TAB . TAB . TAB . TAB . TAB . '}' . CRLF . TAB . TAB . TAB . TAB . TAB . TAB . TAB . TAB . 'return false;' . CRLF . TAB . TAB . TAB . TAB . TAB . TAB . TAB . TAB . '});' . CRLF . TAB . TAB . TAB . TAB . TAB . TAB . TAB . TAB . 'jQuery("#' . $fxItem . '").css("display","none");' . CRLF; } $jsVal .= TAB . TAB . TAB . TAB . TAB . TAB . TAB . "});" . CRLF; } return $jsVal; }
public function updateContext($ns = null) { $context = Model_Context::getInstance(); if (!is_null($ns)) { $configs = array($ns); } else { $context->setProperty('backend_name', $this->backend_name); $configs = array('database', 'service'); } foreach ($configs as $namespace) { foreach ($this->{$namespace} as $k => $v) { $context->setProperty($k, $v, $namespace); } } }
function getEditorInfo($editor) { global $editorMappings, $pluginURL, $pluginName; $context = Model_Context::getInstance(); if (!isset($editorMappings[$editor])) { reset($editorMappings); $editor = key($editorMappings); // gives first declared (thought to be default) editor } if (isset($editorMappings[$editor]['plugin'])) { $pluginURL = $context->getProperty('service.path') . '/plugins/' . $editorMappings[$editor]['plugin']; $pluginName = $editorMappings[$editor]['plugin']; include_once ROOT . "/plugins/{$editorMappings[$editor]['plugin']}/index.php"; } return $editorMappings[$editor]; }
function _getRecentEntriesView($entries, $template) { global $blogURL, $skinSetting; $context = Model_Context::getInstance(); ob_start(); foreach ($entries as $entry) { $view = $template; Misc::dress('rctps_rep_link', $context->getProperty('uri.blog') . "/" . $entry['id'], $view); Misc::dress('rctps_rep_edit_link', $context->getProperty('uri.blog') . "/owner/entry/edit/" . $entry['id'], $view); Misc::dress('rctps_rep_title', htmlspecialchars(Utils_Unicode::lessenAsEm($entry['title'], 30)), $view); Misc::dress('rctps_rep_rp_cnt', "<span id=\"commentCountOnRecentEntries{$entry['id']}\">" . ($entry['comments'] > 0 ? "({$entry['comments']})" : '') . '</span>', $view); print $view; } $view = ob_get_contents(); ob_end_clean(); return $view; }
function getRandomTags($blogid) { $context = Model_Context::getInstance(); $pool = DBModel::getInstance(); $pool->init("Tags"); $pool->setAlias("Tags", "t"); $pool->setAlias("TagRelations", "r"); $pool->setAlias("Entries", "e"); $pool->setGroup("r.tag", "t.name", "t.id"); if ($context->getProperty('skin.tagsOnTagbox', -1) != -1) { $pool->setLimit($context->getProperty('skin.tagsOnTagbox')); } if ($context->getProperty('skin.tagboxAlign') == 1) { // order by count $pool->setOrder("cnt", "desc"); if (doesHaveOwnership()) { $pool->join("TagRelations", "inner", array(array("r.blogid", "eq", $blogid), array("r.tag", "eq", "t.id"))); } else { $pool->join("TagRelations", "inner", array(array("r.blogid", "eq", $blogid), array("r.tag", "eq", "t.id"))); $pool->join("Entries", "inner", array(array("r.entry", "eq", "e.id"), array("e.visibility", ">", 0), array("e.blogid", "eq", $blogid))); } } else { if ($context->getProperty('skin.tagboxAlign') == 2) { // order by name $pool->setOrder("t.name", "desc"); if (doesHaveOwnership()) { $pool->join("TagRelations", "inner", array(array("r.blogid", "eq", $blogid), array("r.tag", "eq", "t.id"))); $pool->setOption(array('filter' => 'DISTINCT')); } else { $pool->join("TagRelations", "inner", array(array("r.blogid", "eq", $blogid), array("r.tag", "eq", "t.id"))); $pool->join("Entries", "inner", array(array("r.entry", "eq", "e.id"), array("e.visibility", ">", 0), array("e.blogid", "eq", $blogid))); $pool->setOption(array('filter' => 'DISTINCT')); } } else { // random $pool->setOrder("RAND()", "desc"); if (doesHaveOwnership()) { $pool->join("TagRelations", "inner", array(array("r.blogid", "eq", $blogid), array("r.tag", "eq", "t.id"))); } else { $pool->join("TagRelations", "inner", array(array("r.blogid", "eq", $blogid), array("r.tag", "eq", "t.id"))); $pool->join("Entries", "inner", array(array("r.entry", "eq", "e.id"), array("e.visibility", ">", 0), array("e.blogid", "eq", $blogid))); } } } return $pool->getAll("t.name, count(*) as cnt, t.id"); }
function URLkeeper($target) { $context = Model_Context::getInstance(); $data = $context->getProperty('plugin.config'); $config = $data['viewForm']; $target .= ' <script type="text/javascript"> //<![CDATA[ window.onload = function(){ var type = navigator.appName var lang; var msg; var myurl = location.href; var config = "' . $config . '"; if (type=="Netscape") lang = navigator.language else lang = navigator.userLanguage // 국가코드에서 앞 2글자만 자름 var lang = lang.substr(0,2) // 한글인 경우 if (lang == "ko") msg = " 원래 주소인 "+myurl+" 로 접속해주세요."; // 다른 언어인 경우 else msg = "please, visit directly via "+myurl; try { if(top != self){ if (config == "1") { window.open(myurl,"_top"); }else{ if (confirm(msg)) window.open(myurl,"_top"); } } } catch (e) { } } //]]> </script> ' . CRLF; return $target; }
function GoogleBlogSearchPinging_ping($target) { /* TODO : do not send ping when private entry/post is added / modified */ static $lastPing = null; $ctx = Model_Context::getInstance(); $pingUrl = 'http://blogsearch.google.com/ping'; $ping = $pingUrl . '?name=' . rawurlencode($ctx->getProperty('blog.title')) . '&url=' . rawurlencode($ctx->getProperty('uri.default') . "/"); if (!isset($lastPing) || $ping != $lastPing) { if (ini_get('allow_url_fopen')) { file_get_contents($ping); } else { $request = new HTTPRequest($ping); $request->send(); } $lastPing = $ping; } return $target; }