function getRecentTrackbackTrash($blogid) { $trackbacks = array(); $context = Model_Context::getInstance(); $pool = DBModel::getInstance(); $pool->init("RemoteResponses"); if (doesHaveOwnership()) { $pool->setQualifier("blogid", "eq", $blogid); $pool->setOrder("written", "desc"); $pool->setLimit($context->getProperty('skin.trackbacksOnRecent')); $result = $pool->getAll(); } else { $pool->setAlias("RemoteResponses", "t"); $pool->setAlias("Entries", "e"); $pool->join("Entries", "left", array(array("t.blogid", "eq", "e.blogid"), array("t.entry", "eq", "e.id"))); $pool->setQualifier("t.blogid", "eq", $blogid); $pool->setQualifier("t.responsetype", "eq", 'trackback', true); $pool->setQualifier("e.draft", "eq", 0); $pool->setQualifier("e.visibility", ">=", 2); $pool->setOrder("t.written", "desc"); $pool->setLimit($context->getProperty('skin.trackbacksOnRecent')); $result = $pool->getAll("t.*"); } if ($result && !empty($result)) { $trackbacks = $result; } return $trackbacks; }
function getEntriesByKeyword($blogid, $keyword) { global $database; $keyword = POD::escapeString($keyword); $visibility = doesHaveOwnership() ? '' : 'AND visibility > 1'; return POD::queryAll("SELECT id, userid, title, category, comments, published \n\t\t\tFROM {$database['prefix']}Entries \n\t\t\tWHERE blogid = {$blogid} \n\t\t\t\tAND draft = 0 {$visibility} \n\t\t\t\tAND category >= 0 \n\t\t\t\tAND (title LIKE '%{$keyword}%' OR content LIKE '%{$keyword}%')\n\t\t\tORDER BY published DESC"); }
function requireOwnership() { if (doesHaveOwnership()) { return true; } requireLogin(); return false; }
function TestSuite_upgrade_repos_via_user() { if (doesHaveOwnership()) { $result = TestSuite_upgrade_repos(null, null); if ($result) { Respond::ResultPage(0); } } Respond::Resultpage(-1); }
function getDefaultDBModelOnNotice($blogid) { $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 CT_Start_Default_getEntry($blogid, $id) { global $database; if ($id == 0) { return null; } $visibility = doesHaveOwnership() ? '' : 'AND visibility > 0'; $entry = POD::queryRow("SELECT id,title,visibility FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND id = {$id} AND draft = 0 {$visibility}"); if (!$entry) { return false; } return $entry; }
function getEntriesByKeyword($blogid, $keyword) { $pool = DBModel::getInstance(); $pool->reset('Entries'); $pool->setQualifier('blogid', 'eq', $blogid); $pool->setQualifier('draft', 'eq', 0); if (doesHaveOwnership()) { $pool->setQualifier('visibility', 'b', 1); } $pool->setQualifier('category', 'beq', 0); $pool->setQualifierSet(array('title', 'like', $keyword, true), 'OR', array('content', 'like', $keyword, true)); $pool->setOrder('published', 'DESC'); return $pool->getRow('id,userid,title,category,comments,published'); }
function getEntriesCountByCategory($blogid, $id) { $context = Model_Context::getInstance(); if ($context->getProperty('category.raw') === null) { getCategories($blogid, 'raw'); } //To cache category information. $result = MMCache::queryRow($context->getProperty('category.raw'), 'id', $id); if ($id === 0 || $result == '' || $id === null) { return 0; } else { if (doesHaveOwnership() && Acl::check('group.editors')) { return $result['entriesinlogin']; } else { return $result['entries']; } } }
function _getRecentEntries($blogid) { $query = DBModel::getInstance(); $query->reset('Entries'); $query->setQualifier('blogid', 'equals', $blogid); $query->setQualifier('draft', 'equals', 0); if (doesHaveOwnership()) { $query->setQualifier('visibility', 'bigger', 0); } $query->setQualifier('category', 'bigger or same', 0); $query->setLimit(8); $query->setOrder('published', 'desc'); $result = $query->getAll('id,title,comments'); if (!empty($result)) { return $result; } else { return array(); } }
function CT_Start_Default_getEntry($blogid, $id) { if ($id == 0) { return null; } $visibility = doesHaveOwnership() ? '' : 'AND visibility > 0'; $pool = DBModel::getInstance(); $pool->reset("Entries"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("id", "eq", $id); $pool->setQualifier("draft", "eq", 0); if (!doesHaveOwnership()) { $pool->setQualifier("visibility", ">", 0); } $entry = $pool->getRow("id,title,visibility"); if (!$entry) { return false; } return $entry; }
static function updateVisitorStatistics($blogid) { global $database, $blogURL; if (!fireEvent('UpdatingVisitorStatistics', true)) { return; } if (doesHaveOwnership()) { return; } $id = session_id(); if (POD::queryCount("SELECT blogid FROM {$database['prefix']}SessionVisits WHERE id = '{$id}' AND address = '{$_SERVER['REMOTE_ADDR']}' AND blogid = {$blogid}") > 0) { return; } if (POD::queryCount("INSERT INTO {$database['prefix']}SessionVisits values('{$id}', '{$_SERVER['REMOTE_ADDR']}', {$blogid})") > 0) { if (POD::queryCount("UPDATE {$database['prefix']}BlogStatistics SET visits = visits + 1 WHERE blogid = {$blogid}") < 1) { POD::execute("INSERT into {$database['prefix']}BlogStatistics values({$blogid}, 1)"); } $period = Timestamp::getDate(); if (POD::queryCount("UPDATE {$database['prefix']}DailyStatistics SET visits = visits + 1 WHERE blogid = {$blogid} AND datemark = {$period}") < 1) { POD::execute("INSERT INTO {$database['prefix']}DailyStatistics VALUES ({$blogid}, {$period}, 1)"); } if (!empty($_SERVER['HTTP_REFERER'])) { $referer = parse_url($_SERVER['HTTP_REFERER']); if (!empty($referer['host']) && ($referer['host'] != $_SERVER['HTTP_HOST'] || strncmp($referer['path'], $blogURL, strlen($blogURL)) != 0)) { if (Filter::isFiltered('ip', $_SERVER['REMOTE_ADDR']) || Filter::isFiltered('url', $_SERVER['HTTP_REFERER'])) { return; } if (!fireEvent('AddingRefererLog', true, array('host' => $referer['host'], 'url' => $_SERVER['HTTP_REFERER']))) { return; } $host = POD::escapeString(Utils_Unicode::lessenAsEncoding($referer['host'], 64)); $url = POD::escapeString(Utils_Unicode::lessenAsEncoding($_SERVER['HTTP_REFERER'], 255)); POD::query("INSERT INTO {$database['prefix']}RefererLogs values({$blogid}, '{$host}', '{$url}', UNIX_TIMESTAMP())"); // POD::query("DELETE FROM {$database['prefix']}RefererLogs WHERE referred < UNIX_TIMESTAMP() - 604800"); // Moved to trashVan if (!POD::queryCount("UPDATE {$database['prefix']}RefererStatistics SET count = count + 1 WHERE blogid = {$blogid} AND host = '{$host}' LIMIT 1")) { POD::execute("INSERT into {$database['prefix']}RefererStatistics values({$blogid}, '{$host}', 1)"); } } } } }
function getLinkListView($links) { $context = Model_Context::getInstance(); if (rtrim($context->getProperty('suri.url'), '/') == $context->getProperty('uri.path')) { $home = true; } else { $home = false; } $categoryName = null; $buffer = '<ul>' . CRLF; $showXfn = Setting::getBlogSettingGlobal('useMicroformat', 3) > 1; foreach ($links as $link) { if (!doesHaveOwnership() && $link['visibility'] == 0 || !doesHaveMembership() && $link['visibility'] < 2) { continue; } if ($categoryName != $link['categoryName']) { if (!empty($categoryName)) { $buffer .= '</ul>' . CRLF . '</li>' . CRLF; } $categoryName = $link['categoryName']; $buffer .= '<li><span class="link_ct">' . htmlspecialchars($link['categoryName']) . '</span>' . CRLF . '<ul>' . CRLF; } if ($showXfn && $home && $link['xfn']) { addXfnAttrs(htmlspecialchars($link['url']), htmlspecialchars($link['xfn']), $link['url']); } $buffer .= '<li><a href="' . htmlspecialchars($link['url']) . '">' . fireEvent('ViewLink', htmlspecialchars(Utils_Unicode::lessenAsEm($link['name'], $context->getProperty('skin.linkLength')))) . '</a></li>' . CRLF; } if (!empty($categoryName)) { $buffer .= '</ul>' . CRLF . '</li>' . CRLF; } $buffer .= '</ul>' . CRLF; return $buffer; }
require ROOT . '/library/preprocessor.php'; requireView('iphoneView'); list($entryId) = getCommentAttributes($blogid, $suri['id'], 'entry'); printMobileHTMLHeader(); printMobileHTMLMenu('', 'comment'); ?> <div id="comment_<?php echo $entryId . "_" . $suri['id']; ?> " title="Delete <?php echo $suri['id']; ?> " class="panel"> <?php if (doesHaveOwnership()) { ?> <h3 class="title"><?php echo _text('삭제하시겠습니까?'); ?> </h3> <div class="content"> <a data-role="button" data-theme="b" href="<?php echo $blogURL; ?> /comment/delete/action/<?php echo $suri['id']; ?> "><?php echo _text('네'); ?>
function getRecentRemoteResponses($blogid, $count = false, $guestShip = false, $type = null) { global $database, $skinSetting; if (!is_null($type)) { $typeFilter = " AND t.responsetype = '" . POD::escapeString($type) . "'"; } else { $typeFilter = ''; } $sql = doesHaveOwnership() && !$guestShip ? "SELECT t.*, e.slogan \n\t\tFROM \n\t\t\t{$database['prefix']}RemoteResponses t\n\t\t\tLEFT JOIN {$database['prefix']}Entries e ON t.blogid = e.blogid AND t.entry = e.id AND e.draft = 0\n\t\tWHERE \n\t\t\tt.blogid = {$blogid} AND t.isfiltered = 0 {$typeFilter} \n\t\tORDER BY \n\t\t\tt.written \n\t\tDESC LIMIT " . ($count != false ? $count : $skinSetting['trackbacksOnRecent']) : "SELECT t.*, e.slogan \n\t\tFROM \n\t\t\t{$database['prefix']}RemoteResponses t \n\t\t\tLEFT JOIN {$database['prefix']}Entries e ON t.blogid = e.blogid AND t.entry = e.id\n\t\tWHERE \n\t\t\tt.blogid = {$blogid} \n\t\t\tAND t.isfiltered = 0 \n\t\t\tAND e.draft = 0 \n\t\t\tAND e.visibility >= 2 " . getPrivateCategoryExclusionQuery($blogid) . "\n\t\t\t{$typeFilter}\n\t\tORDER BY \n\t\t\tt.written \n\t\tDESC LIMIT " . ($count != false ? $count : $skinSetting['trackbacksOnRecent']); if ($result = POD::queryAllWithDBCache($sql, 'remoteResponse')) { return $result; } else { return array(); } }
function printIphoneCommentFormView($entryId, $title, $actionURL) { global $blogURL; ?> <form method="GET" action="<?php echo $blogURL; ?> /<?php echo $actionURL; ?> /add/<?php echo $entryId; ?> " class="commentForm"> <h2><?php echo $title; ?> </h2> <fieldset> <?php if (!doesHaveOwnership()) { ?> <input type="hidden" name="id" value="<?php echo $entryId; ?> " /> <input type="hidden" id="secret_<?php echo $entryId; ?> " name="secret_<?php echo $entryId; ?> " value="0" /> <div class="row"> <label><?php echo _text('비밀 댓글'); ?> </label> <div class="toggle" onclick="secretToggleCheck(this, <?php echo $entryId; ?> );"><span class="thumb"></span><span class="toggleOn">|</span><span class="toggleOff">O</span></div> </div> <div class="row"> <label for="name_<?php echo $entryId; ?> "><?php echo _text('이름'); ?> </label> <input type="text" id="name_<?php echo $entryId; ?> " name="name_<?php echo $entryId; ?> " value="<?php echo isset($_COOKIE['guestName']) ? htmlspecialchars($_COOKIE['guestName']) : ''; ?> " /> </div> <div class="row"> <label for="password_<?php echo $entryId; ?> "><?php echo _text('비밀번호'); ?> </label> <input type="password" id="password_<?php echo $entryId; ?> " name="password_<?php echo $entryId; ?> " /> </div> <div class="row"> <label for="homepage_<?php echo $entryId; ?> "><?php echo _text('홈페이지'); ?> </label> <input type="text" id="homepage_<?php echo $entryId; ?> " name="homepage_<?php echo $entryId; ?> " value="<?php echo isset($_COOKIE['guestHomepage']) && $_COOKIE['guestHomepage'] != 'http://' ? htmlspecialchars($_COOKIE['guestHomepage']) : 'http://'; ?> " /> </div> <?php } ?> <div class="row"> <textarea cols="40" rows="6" id="comment_<?php echo $entryId; ?> " name="comment_<?php echo $entryId; ?> "></textarea> </div> <a href="#" class="whiteButton margin-top10" type="submit"><?php echo _text('작성'); ?> </a> </fieldset> </form> <?php }
function getTagFrequency($tag, $max, $min) { $pool = DBModel::getInstance(); $blogid = getBlogId(); if (is_array($tag) && array_key_exists('cnt', $tag)) { $count = $tag['cnt']; } else { if (!is_array($tag)) { $tag = array('name' => $tag); } $pool->init("Tags"); $pool->setAlias("Tags", "t"); $pool->setAlias("TagRelations", "r"); $pool->join("TagRelations", "inner", array(array("r.tag", "eq", "t.id"), array("r.blogid", "eq", $blogid))); $pool->setQualifier("t.name", "eq", $tag['name'], true); if (!doesHaveOwnership()) { $pool->setAlias("Entries", "e"); $pool->join("Entries", "inner", array(array("e.blogid", "eq", "r.blogid"), array("e.id", "eq", "r.entry"), array("e.visibility", ">", 0))); } $count = $pool->getCount(); } $dist = $max / 3; if ($count == $min) { return 5; } else { if ($count == $max) { return 1; } else { if ($count >= $min + $dist * 2) { return 2; } else { if ($count >= $min + $dist) { return 3; } else { return 4; } } } } }
function Recaptcha_AddingCommentHandler($target, $mother) { $context = Model_Context::getInstance(); $config = $context->getProperty('plugin.config'); if (doesHaveOwnership() || doesHaveMembership()) { return true; } /* Skip validation if signed-in. */ if (!is_null($config) && isset($config['secretKey'])) { $recaptcha_response = $_POST["g-recaptcha-response"]; $reqURL = "https://www.google.com/recaptcha/api/siteverify?secret={$config['secretKey']}&response={$recaptcha_response}"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $reqURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec($ch); curl_close($ch); if ($output === false) { Respond::PrintResult(array('error' => 2, 'description' => 'Cannot connect to the Google reCAPTCHA server.')); return false; } else { $resp = json_decode($output, true); if ($resp['success'] === true) { /* Yay! The user is human. */ return true; } else { $err = implode(' ', $resp['error-codes']); if (strpos($err, 'missing-input-secret') !== false) { Respond::PrintResult(array('error' => 2, 'description' => 'Missing reCAPTCHA secret key!')); } elseif (strpos($err, 'missing-input-response') !== false) { Respond::PrintResult(array('error' => 2, 'description' => 'Missing reCAPTCHA response!')); } elseif (strpos($err, 'invalid-input-secret') !== false) { Respond::PrintResult(array('error' => 2, 'description' => 'Invalid reCAPTCHA secret key.')); } elseif (strpos($err, 'invalid-input-response') !== false) { Respond::PrintResult(array('error' => 2, 'description' => 'Invalid reCAPTCHA response.')); } } } /* It seems to be a robot! Silently fail. */ return false; } /* If the plugin is not configured yet, bypass validation. */ return true; }
function setPageCacheLog() { global $database; if (doesHaveOwnership()) { $this->_dbContents['owner'] = $this->dbContents; } else { $this->_dbContents['user'] = $this->dbContents; } return POD::execute("REPLACE INTO {$database['prefix']}PageCacheLog \n\t\t\tVALUES(" . getBlogId() . ", '" . POD::escapeString($this->realName) . "', '" . tc_escape_string(serialize($this->_dbContents)) . "')"); }
function PN_BlogStatisticsProcess($target) { global $blogid, $pluginURL, $defaultURL, $blog; if (doesHaveOwnership()) { include_once 'lib/open-flash-chart.php'; $grpStyle = $_GET['grpStyle']; $grpData = explode("|", $_GET['grpData']); $grpTotal = $_GET['grpTotal']; $grpYear = $_GET['grpYear']; $grpTypeName = $_GET['grpTypeName']; $grpLinkType = $_GET['grpLinkType']; $grpXLabelType = isset($_GET['grpXLabelType']) ? $_GET['grpXLabelType'] : 0; $grpLabel = explode("|", $_GET['grpLabel']); $grpSubTitle = array(); $grpLabelTemp = array(); if (!empty($_GET['grpData'])) { if ($grpTypeName == "category") { for ($i = 0; $i < count($grpLabel); $i++) { $grpSubTitle[] = rawurlencode($grpLabel[$i] == 0 ? _t('분류없음') : htmlspecialchars(UTF8::lessenAsEm(getCategoryNameById($blogid, $grpLabel[$i]), 15))); } } else { if ($grpTypeName == "hits" || $grpTypeName == "cmmax" || $grpTypeName == "tbmax" || $grpTypeName == "tagmax") { for ($i = 0; $i < count($grpLabel); $i++) { $grpSubTitle[] = rawurlencode(htmlspecialchars(UTF8::lessenAsEm(str_replace(",", "-", getEntryTitleById($blogid, $grpLabel[$i])), 25))); } } else { if ($grpTypeName == "commenter" || $grpTypeName == "tag") { for ($i = 0; $i < count($grpLabel); $i++) { $grpSubTitle[] = htmlspecialchars(UTF8::lessenAsEm($grpLabel[$i], 15)); $grpLabelTemp[] = htmlspecialchars(UTF8::lessenAsEm($grpLabel[$i], 6, '')); } $grpLabel = $grpLabelTemp; } else { if ($grpTypeName == "time") { for ($i = 0; $i < count($grpLabel); $i++) { $grpSubTitle[] = rawurlencode($grpLabel[$i] . "시"); } } else { if ($grpTypeName == "refer") { for ($i = 0; $i < count($grpLabel); $i++) { $tmpHost = explode('.', $grpLabel[$i]); $tmpHostCnt = count($tmpHost) - 1; $tmpDomain = (strlen($tmpHost[$tmpHostCnt]) < 3 ? $tmpHost[$tmpHostCnt - 2] . '.' : '') . $tmpHost[$tmpHostCnt - 1] . '.' . $tmpHost[$tmpHostCnt]; $cutDomain = explode('.', $tmpDomain); $grpSubTitle[] = htmlspecialchars($grpLabel[$i]); $grpLabelTemp[] = htmlspecialchars(UTF8::lessenAsEm($cutDomain[0], 6, '')); } $grpLabel = $grpLabelTemp; } else { if ($grpTypeName == "referkey") { for ($i = 0; $i < count($grpLabel); $i++) { $tmpLabel = explode('(', $grpLabel[$i]); $grpSubTitle[] = htmlspecialchars(UTF8::lessenAsEm($grpLabel[$i], 15)); $grpLabelTemp[] = htmlspecialchars(UTF8::lessenAsEm($tmpLabel[0], 6, '')); } $grpLabel = $grpLabelTemp; } } } } } } $g = new graph(); $g->bg_colour = '#FFFFFF'; if ($grpStyle == "pie") { $grpClickLink = ""; $grpPercent = array(); $grpLink = array(); for ($i = 0; $i < count($grpData); $i++) { $grpPercent[] = round($grpData[$i] / $grpTotal * 100, 0); } if ($grpLinkType == "archiveYear") { for ($i = 0; $i < count($grpLabel); $i++) { $permalink = $defaultURL . "/archive/" . substr($grpLabel[$i], 0, 4); $grpLink[] = "javascript:window.open('{$permalink}');void(0)"; } $grpClickLink = "<br>click on the pie."; } else { if ($grpLinkType == "archiveMonth" && $grpYear != "9999") { for ($i = 0; $i < count($grpLabel); $i++) { $cutMonth = str_replace("월", "", $grpLabel[$i]); $tmpMonth = strlen($cutMonth) == 1 ? "0" . $cutMonth : $cutMonth; $permalink = $defaultURL . "/archive/" . $grpYear . $tmpMonth; $grpLink[] = "javascript:window.open('{$permalink}');void(0)"; } $grpClickLink = "<br>click on the pie."; } else { if ($grpLinkType == "category") { for ($i = 0; $i < count($grpLabel); $i++) { $permalink = $defaultURL . "/category/" . getCategoryLabelById($blogid, $grpLabel[$i]); $grpLink[] = "javascript:window.open('{$permalink}');void(0)"; } $grpClickLink = "<br>click on the pie."; } else { if ($grpLinkType == "entry") { for ($i = 0; $i < count($grpLabel); $i++) { $permalink = $defaultURL . ($blog['useSlogan'] ? "/entry/" . getEntrySloganById($blogid, $grpLabel[$i]) : "/" . $grpLabel[$i]); $grpLink[] = "javascript:window.open('{$permalink}');void(0)"; } $grpClickLink = "<br>click on the pie."; } else { if ($grpLinkType == "tag") { for ($i = 0; $i < count($grpLabel); $i++) { $permalink = $defaultURL . "/tag/" . $grpLabel[$i]; $grpLink[] = "javascript:window.open('{$permalink}');void(0)"; } $grpClickLink = "<br>click on the pie."; } } } } } $g->pie(75, '#ffffff', '#000000', false, 1); $g->pie_values($grpData, $grpLabel, $grpLink, $grpSubTitle); $g->pie_slice_colours(array('#B9D2E6', '#E2B11C', '#A3CF22', '#EC7122', '#4FC0C0', '#D45E5E', '#A275A2', '#52A7D2', '#9F373B', '#B4ADA5', '#5FC97E', '#CFB85D', '#9DC64E', '#FFAB29', '#E23838', '#43CEA9', '#4CA9D9', '#BA4ECA', '#6C79DA', '#CCCCCC', '#AB5C06', '#C06868', '#5FC97E', 'CFB85D')); $g->set_tool_tip((count($grpSubTitle) ? '#x_title#<br>' : '#x_label#<br>') . '#val#(#percent#%25)' . $grpClickLink); } else { if ($grpStyle == "bar") { $g->title(' ', '{font-size:12px; color:#000000;margin-top:0px;padding:3px;}'); $g->set_data($grpData); $g->set_bar_titles($grpSubTitle); $g->bar_glass(70, '#68B1D9', '#62A0C1', '', 12); $g->bar_colours(array('#B9D2E6', '#E2B11C', '#A3CF22', '#EC7122', '#4FC0C0', '#D45E5E', '#A275A2', '#52A7D2', '#9F373B', '#B4ADA5', '#5FC97E', '#CFB85D', '#9DC64E', '#FFAB29', '#E23838', '#43CEA9', '#4CA9D9', '#BA4ECA', '#6C79DA', '#CCCCCC', '#AB5C06', '#C06868', '#5FC97E', 'CFB85D')); $g->x_axis_colour('#909090', '#D2D2FB'); $g->y_axis_colour('#909090', '#D2D2FB'); $g->set_x_labels($grpLabel); $g->set_x_label_style(10, '#000000', $grpXLabelType, -1); $g->set_y_label_style(9, '#888888'); $tmp_data_max = floor(Max($grpData) * 1.2); if ($tmp_y_max = $tmp_data_max % 10) { $tmp_data_max = $tmp_data_max + (10 - $tmp_y_max); } $g->set_y_max($tmp_data_max); $g->set_y_legend('', 11, '#736AFF'); $g->set_tool_tip((count($grpSubTitle) ? '#x_title#<br>' : '#x_label#<br>') . '#val#'); } else { if ($grpStyle == "line") { $g->title('', '{font-size:1px; color:#000000;}'); $g->set_data($grpData); $g->line_dot(2, 4, '#6FBBC6', _t('최근 7일간 방문자 수'), 11); // <-- 3px thick + dots $g->set_x_labels($grpLabel); $g->set_x_label_style(8, '#333333', $grpXLabelType, -1); $g->x_axis_colour('#909090', '#e7e7e7'); $g->y_axis_colour('#909090', '#e7e7e7'); $tmp_data_max = floor(Max($grpData) * 1.2); if ($tmp_y_max = $tmp_data_max % 10) { $tmp_data_max = $tmp_data_max + (10 - $tmp_y_max); } $g->set_y_max($tmp_data_max); $g->set_y_legend('', 1, '#736AFF'); $g->y_label_steps(4); $g->set_y_label_style(8, '#333333', $grpXLabelType, -1); $g->set_tool_tip((count($grpSubTitle) ? '#x_title#<br>' : '#x_label#<br>') . '#val#'); } } } echo $g->render(); flush(); } } }
</div> <?php $entryTags = getTags($entry['blogid'], $entry['id']); if (sizeof($entryTags) > 0) { ?> <div class="entry_tags" data-role="content" data-theme="c"> <h3 class="tags_title">Tags</h3> <?php $tags = array(); $relTag = Setting::getBlogSettingGlobal('useMicroformat', 3) > 1 && (count($entries) == 1 || !empty($skin->hentryExisted)); foreach ($entryTags as $entryTag) { $tags[$entryTag['name']] = '<a href="' . $context->getProperty('uri.blog') . '/tag/' . $entryTag['id'] . '">' . htmlspecialchars($entryTag['name']) . '</a>'; } echo implode(",\r\n", array_values($tags)); ?> </div> </div> <?php } if (doesHaveOwnership() || $entry['visibility'] >= 2 || isset($_COOKIE['GUEST_PASSWORD']) && trim($_COOKIE['GUEST_PASSWORD']) == trim($entry['password'])) { printMobileNavigation($entry, true, true, $paging); } else { printMobileNavigation($entry, false, false, $paging); } if (!empty($entryPrint)) { ?> </div> <?php } } printMobileHTMLFooter();
function getRecentGuestbook($blogid, $count = false) { global $skinSetting, $database; $comments = array(); $sql = "SELECT r.*\n\t\tFROM\n\t\t\t{$database['prefix']}Comments r\n\t\tWHERE\n\t\t\tr.blogid = {$blogid} AND r.entry = 0 AND r.isfiltered = 0\n\t\tORDER BY\n\t\t\tr.written\n\t\tDESC LIMIT " . ($count != false ? $count : $skinSetting['commentsOnRecent']); if ($result = POD::queryAll($sql)) { foreach ($result as $comment) { if ($comment['secret'] == 1 && !doesHaveOwnership()) { if (!doesHaveOpenIDPriv($comment)) { $comment['name'] = ''; $comment['homepage'] = ''; $comment['comment'] = _text('관리자만 볼 수 있는 댓글입니다.'); } } array_push($comments, $comment); } } return $comments; }
function getRecentGuestbook($blogid, $count = false) { $context = Model_Context::getInstance(); $comments = array(); $pool = DBModel::getInstance(); $pool->init("Comments"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("entry", "eq", 0); $pool->setQualifier("isfiltered", "eq", 0); $pool->setOrder("written", "desc"); $pool->setLimit($count != false ? $count : $context->getProperty('skin.commentsOnRecent')); if ($result = $pool->getAll()) { foreach ($result as $comment) { if ($comment['secret'] == 1 && !doesHaveOwnership()) { if (!doesHaveOpenIDPriv($comment)) { $comment['name'] = ''; $comment['homepage'] = ''; $comment['comment'] = _text('관리자만 볼 수 있는 댓글입니다.'); } } array_push($comments, $comment); } } return $comments; }
function getTagFrequency($tag, $max, $min) { global $database; $blogid = getBlogId(); if (is_array($tag) && array_key_exists('cnt', $tag)) { $count = $tag['cnt']; } else { if (!is_array($tag)) { $tag = array('name' => $tag); } if (doesHaveOwnership()) { $count = POD::queryCell("SELECT count(*) FROM {$database['prefix']}Tags t\n\t\t\t\tINNER JOIN {$database['prefix']}TagRelations r ON r.tag = t.id AND r.blogid = {$blogid}\n\t\t\t\tWHERE t.name = '" . POD::escapeString($tag['name']) . "'"); } else { $count = POD::queryCell("SELECT count(*) FROM {$database['prefix']}Tags t\n\t\t\t\tINNER JOIN {$database['prefix']}TagRelations r ON r.tag = t.id AND r.blogid = {$blogid} \n\t\t\t\tINNER JOIN {$database['prefix']}Entries e ON e.blogid = r.blogid AND e.id = r.entry AND e.visibility > 0 \n\t\t\t\tWHERE t.name = '" . POD::escapeString($tag['name']) . "'"); } } $dist = $max / 3; if ($count == $min) { return 5; } else { if ($count == $max) { return 1; } else { if ($count >= $min + $dist * 2) { return 2; } else { if ($count >= $min + $dist) { return 3; } else { return 4; } } } } }
function getCalendar($blogid, $period) { global $database; $skinSetting = Setting::getSkinSettings($blogid); $pool = DBModel::getInstance(); $pool->init("Entries"); $pool->setAlias("Entries", "e"); $pool->setQualifier("e.blogid", "eq", $blogid); $pool->setQualifier("e.draft", "eq", 0); $pool->setQualifier("e.category", ">=", 0); if (!doesHaveOwnership()) { $pool->setQualifier("e.visibility", ">", 0); $pool = getPrivateCategoryExclusionQualifier($pool, $blogid); } $calendar = array('days' => array()); if ($period === true || !checkPeriod($period)) { $period = Timestamp::getYearMonth(); } $calendar['period'] = $period; $calendar['year'] = substr($period, 0, 4); $calendar['month'] = substr($period, 4, 2); switch (POD::dbms()) { case 'Cubrid': $pool->setQualifier("TO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'YYYY')", "eq", $calendar['year'], true); $pool->setQualifier("TO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'MM')", "eq", $calendar['month'], true); $result = $pool->getAll("TO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'DD')", array('filter' => 'distinct', 'usedbcache' => true, 'cacheprefix' => 'entry')); break; case 'SQLite3': $pool->setQualifier("strftime('%Y',e.published,'unixepoch')", "eq", $calendar['year'], true); $pool->setQualifier("strftime('%m',e.published,'unixepoch')", "eq", $calendar['month'], true); $result = $pool->getAll("strftime('%d',e.published,'unixepoch')", array('filter' => 'distinct', 'usedbcache' => true, 'cacheprefix' => 'entry')); break; case 'MySQL': case 'MySQLi': case 'PostgreSQL': default: $pool->setQualifier("YEAR(FROM_UNIXTIME(e.published))", "eq", $calendar['year'], true); $pool->setQualifier("MONTH(FROM_UNIXTIME(e.published))", "eq", $calendar['month'], true); $result = $pool->getAll("DAYOFMONTH(FROM_UNIXTIME(e.published))", array('filter' => 'distinct', 'usedbcache' => true, 'cacheprefix' => 'entry')); break; } if ($result) { foreach ($result as $dayArray) { list($day) = $dayArray; array_push($calendar['days'], $day); } } $calendar['days'] = array_flip($calendar['days']); return $calendar; }
<?php /// Copyright (c) 2004-2015, Needlworks / Tatter Network Foundation /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) $IV = array('POST' => array('save' => array(array('on'), 'mandatory' => false))); require ROOT . '/library/preprocessor.php'; if (false) { doesHaveMembership(); doesHaveOwnership(); Session::authorize(); login(); fetchConfigVal(); }
function getRecentEntries($blogid) { global $database, $skinSetting; $entries = array(); $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0' . getPrivateCategoryExclusionQuery($blogid); $result = POD::query("SELECT e.id, e.userid, e.title, e.slogan, e.comments, e.published \n\t\tFROM {$database['prefix']}Entries e\n\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 {$visibility} AND e.category >= 0 \n\t\tORDER BY published DESC LIMIT {$skinSetting['entriesOnRecent']}"); while ($entry = POD::fetch($result)) { array_push($entries, $entry); } return $entries; }
function getCalendar($blogid, $period) { global $database; $calendar = array('days' => array()); if ($period === true || !checkPeriod($period)) { $period = Timestamp::getYearMonth(); } $calendar['period'] = $period; $calendar['year'] = substr($period, 0, 4); $calendar['month'] = substr($period, 4, 2); $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0' . getPrivateCategoryExclusionQuery($blogid); switch (POD::dbms()) { case 'Cubrid': $result = POD::queryAllWithDBCache("SELECT DISTINCT TO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'DD')\n\t\t\t\tFROM {$database['prefix']}Entries e\n\t\t\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 {$visibility} AND e.category >= 0 AND\n\t\t\t\t\tTO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'YYYY') = '{$calendar['year']}' AND\n\t\t\t\t\tTO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'MM') = '{$calendar['month']}'", 'entry'); break; case 'MySQL': case 'MySQLi': case 'PostgreSQL': default: $result = POD::queryAllWithDBCache("SELECT DISTINCT DAYOFMONTH(FROM_UNIXTIME(e.published)) \n\t\t\t\tFROM {$database['prefix']}Entries e\n\t\t\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 {$visibility} AND e.category >= 0 AND YEAR(FROM_UNIXTIME(e.published)) = {$calendar['year']} AND MONTH(FROM_UNIXTIME(e.published)) = {$calendar['month']}", 'entry'); break; } if ($result) { foreach ($result as $dayArray) { list($day) = $dayArray; array_push($calendar['days'], $day); } } $calendar['days'] = array_flip($calendar['days']); return $calendar; }
setcookie('guestHomepage', 'http://' . $_POST['homepage'], time() + 2592000, $context->getProperty('uri.blog') . "/"); } } $comment = array(); list($comment['entry']) = getCommentAttributes($blogid, $suri['id'], 'entry'); if (count($comment) == 0) { Respond::ErrorPage(_text('댓글이 존재하지 않습니다.')); } $comment['parent'] = $suri['id']; $comment['name'] = empty($_POST['name']) ? '' : trim($_POST['name']); $comment['password'] = empty($_POST['password']) ? '' : $_POST['password']; $comment['homepage'] = empty($_POST['homepage']) || $_POST['homepage'] == 'http://' ? '' : trim($_POST['homepage']); $comment['secret'] = empty($_POST['secret']) ? 0 : 1; $comment['comment'] = trim($_POST['comment']); $comment['ip'] = $_SERVER['REMOTE_ADDR']; if (!doesHaveMembership() && !doesHaveOwnership() && $comment['name'] == '') { ?> <script type="text/javascript"> //<![CDATA[ alert("<?php echo _text('이름을 입력해 주십시오.'); ?> "); //]]> </script> <?php } else { if ($comment['comment'] == '') { ?> <script type="text/javascript"> //<![CDATA[
Validator::addRule($customIV); if (!Validator::isValid()) { Respond::PrintResult(array('error' => 1, 'description' => 'Illegal parameters')); } requireStrictRoute(); header('Content-Type: text/xml; charset=utf-8'); if (!isset($_POST['key']) || $_POST['key'] != md5(filemtime(ROOT . '/config.php')) || !Setting::getBlogSettingGlobal('acceptComments', 0)) { Respond::PrintResult(array('error' => 0, 'commentBlock' => '', 'recentCommentBlock' => '')); exit; } $userName = isset($_POST["name"]) ? trim($_POST["name"]) : ''; $userPassword = isset($_POST["password"]) ? $_POST["password"] : ''; $userSecret = isset($_POST["secret"]) ? 1 : 0; $userHomepage = isset($_POST["homepage"]) ? trim($_POST["homepage"]) : ''; $userComment = isset($_POST["comment"]) ? trim($_POST["comment"]) : ''; if (!doesHaveMembership() && !doesHaveOwnership() && $userName == '') { Respond::PrintResult(array('error' => 2, 'description' => _text('이름을 입력해 주십시오.'))); exit; } else { if ($userComment == '') { Respond::PrintResult(array('error' => 2, 'description' => _text('본문을 입력해 주십시오.'))); exit; } else { if (!empty($userName)) { setcookie('guestName', $userName, time() + 2592000, $context->getProperty('uri.blog') . "/"); } if (!empty($userHomepage) && $userHomepage != 'http://') { if (strpos($userHomepage, 'http://') !== 0) { $userHomepage = "http://{$userHomepage}"; } setcookie('guestHomepage', $userHomepage, time() + 2592000, $context->getProperty('uri.blog') . "/");
function getEntriesCountByCategory($blogid, $id) { requireComponent('Needlworks.Cache.PageCache'); global $__gCacheCategoryRaw; if (empty($__gCacheCategoryRaw)) { getCategories($blogid, 'raw'); } //To cache category information. $result = MMCache::queryRow($__gCacheCategoryRaw, 'id', $id); if ($id === 0 || $result == '' || $id === null) { return 0; } else { if (doesHaveOwnership() && Acl::check('group.editors')) { return $result['entriesinlogin']; } else { return $result['entries']; } } }