function getKeylogByTitle($blogid, $title) { global $database; $title = POD::escapeString($title); $visibility = doesHaveOwnership() ? '' : 'AND visibility > 0'; return POD::queryRow("SELECT * \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 = -1 \n\t\t\t\tAND title = '{$title}' \n\t\t\tORDER BY published DESC"); }
public static function queryRowWithDBCache($query, $prefix = null, $type = 'both', $count = -1) { $cache = queryCache::getInstance(); $cache->reset($query, $prefix); if (!$cache->load()) { $cache->contents = POD::queryRow($query, $type, $count); $cache->update(); } return $cache->contents; }
function EAS_Call($type, $name, $title, $url, $content) { global $hostURL, $blogURL, $database; $blogstr = $hostURL . $blogURL; $rpc = new XMLRPC(); $rpc->url = 'http://antispam.eolin.com/RPC/index.php'; 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; $tableName = $database['prefix'] . 'RemoteResponses'; if ($type == 2) { $sql = 'SELECT COUNT(id) as cc FROM ' . $database['prefix'] . 'RemoteResponses WHERE'; $sql .= ' url = \'' . POD::escapeString($url) . '\''; $sql .= ' AND isfiltered > 0'; if ($row = POD::queryRow($sql)) { $count += @$row[0]; } } else { // Comment Case $tableName = $database['prefix'] . 'Comments'; $sql = 'SELECT COUNT(id) as cc FROM ' . $database['prefix'] . 'Comments WHERE'; $sql .= ' comment = \'' . POD::escapeString($content) . '\''; $sql .= ' AND homepage = \'' . POD::escapeString($url) . '\''; $sql .= ' AND name = \'' . POD::escapeString($name) . '\''; $sql .= ' AND isfiltered > 0'; if ($row = POD::queryRow($sql)) { $count += @$row[0]; } } // Check IP $sql = 'SELECT COUNT(id) as cc FROM ' . $tableName . ' WHERE'; $sql .= ' ip = \'' . POD::escapeString($_SERVER['REMOTE_ADDR']) . '\''; $sql .= ' AND isfiltered > 0'; if ($row = POD::queryRow($sql)) { $count += @$row[0]; } if ($count >= 10) { return false; } return true; } if (!is_null($rpc->fault)) { // EAS has some problem return true; } if ($rpc->result['result'] == true) { return false; // it's spam } return true; }
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; }
/** * @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 EntriesWithTags($target, $mother) { global $suri, $defaultURL, $blogURL, $pluginURL, $configVal, $blog, $service, $blogid, $database; requireComponent('Textcube.Function.misc'); $html = ''; if ($suri['directive'] != "/rss" && $suri['directive'] != "/atom" && $suri['directive'] != "/m" && $suri['directive'] != "/i/entry" && $suri['directive'] != "/sync") { $html = ' <div class="entries-with-tags-box"> <strong> ' . _t("Related entries") . ' </strong> <ul>'; $data = misc::fetchConfigVal($configVal); $entries = isset($data['entries']) ? $data['entries'] : 5; $conEntry = POD::queryRow("SELECT userid, category FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND id = {$mother}"); $result = POD::query("SELECT DISTINCT e.id, e.slogan, e.title, e.created, e.comments, e.trackbacks\n\t\t\t\t\t\t\t\tFROM {$database['prefix']}TagRelations AS r\n\t\t\t\t\t\t\t\tLEFT JOIN {$database['prefix']}TagRelations AS t ON t.tag = r.tag \n\t\t\t\t\t\t\t\tLEFT JOIN {$database['prefix']}Entries AS e ON e.id = t.entry \n\t\t\t\t\t\t\t\tWHERE r.entry ={$mother}\n\t\t\t\t\t\t\t\tAND r.blogid ={$blogid}\n\t\t\t\t\t\t\t\tAND t.entry !={$mother}\n\t\t\t\t\t\t\t\tAND e.userid ={$conEntry['userid']} \n\t\t\t\t\t\t\t\tAND e.category = {$conEntry['category']} \n\t\t\t\t\t\t\t\tORDER BY t.entry DESC\n\t\t\t\t\t\t\t\tLIMIT {$entries}"); if (POD::num_rows($result) > 0) { while ($row = POD::fetch($result, 'array')) { $entry = $row['id']; $slogan = rawurlencode($row['slogan']); $title = $row['title']; $created = date("Y/m/d H:m", $row['created']); $comments = $row['comments']; $trackbacks = $row['trackbacks']; if ($suri['directive'] == "/category") { $permalink = $blog['useSloganOnCategory'] ? "{$defaultURL}/entry/{$slogan}" : "{$defaultURL}/{$entry}"; } elseif ($suri['directive'] == "/tag") { $permalink = $blog['useSloganOnTag'] ? "{$defaultURL}/entry/{$slogan}" : "{$defaultURL}/{$entry}"; } else { $permalink = $blog['useSloganOnPost'] ? "{$defaultURL}/entry/{$slogan}" : "{$defaultURL}/{$entry}"; } $html .= "<li><a href=\"{$permalink}\">{$title}</a>,<span>Comments: {$comments} | Trackbacks: {$trackbacks} | {$created}</span></li>"; } } else { $html .= "<li>" . _t("No related entries.") . "</li>"; } $html .= <<<EOF \t\t</ul> \t</div> EOF; } return $target . $html; }
function DEFNENSIO_FILTER($type, $name, $title, $url, $content, $openid = false) { global $hostURL, $blogURL, $database, $configVal, $defensio_conf; //if ( doesHaveOwnership() ) return true; // owner DEFENSIO_Init(); $defensio_meta = array(); $comment = array(); $comment['referrer'] = $_SERVER['HTTP_REFERER']; $comment['user-ip'] = preg_replace('/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR']); $comment['user-ip'] = '168.126.63.1'; $comment['owner-url'] = $defensio_conf['blog']; $comment['comment_type'] = $type == 2 ? 'trackback' : 'comment'; $comment['comment-author'] = $name; $comment['article-date'] = strftime("%Y/%m/%d", time()); // $comment['permalink'] = $comment_perma_link; // Make sure it we don't send an SQL escaped string to the server $comment['comment-content'] = defensio_unescape_string($content); $comment['comment-author-url'] = $url; //$comment['comment-author-email'] = $email; // optional field $next_id = $type == 2 ? getTrackBacksNextId() : getCommentsNextId(); $comment_TYPE = $type == 2 ? 'T' : 'C'; // to using openid if ($openid) { $comment['openid'] = Acl::getIdentity('openid'); $comment['user-logged-in'] = 'true'; } // to testing // $comment['test-force'] = 'spam,x.xxxx'; // | 'ham,x.xxxx' ( 0 ~ 1) if ($r = defensio_post('audit-comment', $comment)) { $ar = Spyc::YAMLLoad($r); if (isset($ar['defensio-result'])) { if ($ar['defensio-result']['status'] == DF_SUCCESS) { // Set metadata about the comment $defensio_meta['spaminess'] = $ar['defensio-result']['spaminess']; $defensio_meta['signature'] = $ar['defensio-result']['signature']; error_log(print_r($ar, true)); if ($ar['defensio-result']['spam']) { $defensio_meta['spam'] = true; defensio_save_meta_data($comment_TYPE, $next_id, $defensio_meta); return false; } else { // not spam $defensio_meta['spaminess'] = 0; // if do you want check with Thief-cat algorithm, comment out the following two lines. if (!$defensio_conf['force_with_tca']) { defensio_save_meta_data($comment_TYPE, $next_id, $defensio_meta); return true; } } } } /* else { // Succesful http request, but Defensio failed. } */ } /* else { // Unsuccesful POST to the server. Defensio might be down. } */ //defensio_save_meta_data($comment_TYPE, $next_id, $defensio_meta); // there is problem in defensio. /////////////////////// // call fail // Do Local spam check with "Thief-cat algorithm" $count = 0; $tableName = $database['prefix'] . 'Trackbacks'; if ($type == 2) { $sql = 'SELECT COUNT(id) as cc FROM ' . $database['prefix'] . 'Trackbacks WHERE'; $sql .= ' url = \'' . POD::escapeString($url) . '\''; $sql .= ' AND isFiltered > 0'; if ($row = POD::queryRow($sql)) { $count += @$row[0]; } } else { // Comment Case $tableName = $database['prefix'] . 'Comments'; $sql = 'SELECT COUNT(id) as cc FROM ' . $database['prefix'] . 'Comments WHERE'; $sql .= ' comment = \'' . POD::escapeString($content) . '\''; $sql .= ' AND homepage = \'' . POD::escapeString($url) . '\''; $sql .= ' AND name = \'' . POD::escapeString($name) . '\''; $sql .= ' AND isFiltered > 0'; if ($row = POD::queryRow($sql)) { $count += @$row[0]; } } // Check IP $sql = 'SELECT COUNT(id) as cc FROM ' . $tableName . ' WHERE'; $sql .= ' ip = \'' . POD::escapeString($_SERVER['REMOTE_ADDR']) . '\''; $sql .= ' AND isFiltered > 0'; if ($row = POD::queryRow($sql)) { $count += @$row[0]; } $is_spam = $count >= 10 ? 1 : 0; if (isset($defensio_meta['spaminess']) and isset($defensio_meta['signature']) && $is_spam) { defensio_submit_spam($defensio_meta['signature']); } $defensio_meta['spam'] = $defensio_meta['spaminess'] = $is_spam; defensio_save_meta_data($comment_TYPE, $next_id, $defensio_meta); return !$is_spam; }
function updateRandomFeed() { global $database; $updatecycle = POD::queryCell("SELECT updatecycle FROM {$database['prefix']}FeedSettings LIMIT 1"); if ($updatecycle != 0) { if ($feed = POD::queryRow("SELECT * FROM {$database['prefix']}Feeds WHERE modified < " . (gmmktime() - $updatecycle * 60) . " ORDER BY RAND() LIMIT 1")) { Setting::setServiceSetting('lastFeedUpdate', gmmktime(), true); return array(updateFeed($feed), $feed['xmlurl']); } } return array(1, 'No feeds to update'); }
function notifyComment() { global $database, $service, $blog, $defaultURL; $blogid = getBlogId(); $sql = "SELECT\n\t\t\t\tCN.*,\n\t\t\t\tCNQ.id AS queueId,\n\t\t\t\tCNQ.commentid AS commentid,\n\t\t\t\tCNQ.sendstatus AS sendstatus,\n\t\t\t\tCNQ.checkdate AS checkdate,\n\t\t\t\tCNQ.written AS queueWritten\n\t\t\tFROM\n\t\t\t\t{$database['prefix']}CommentsNotifiedQueue AS CNQ\n\t\t\tLEFT JOIN\n\t\t\t\t{$database['prefix']}Comments AS CN ON CNQ.commentid = CN.id\n\t\t\tWHERE\n\t\t\t\tCNQ.sendstatus = 0\n\t\t\t\tand CN.parent is not null\n\t\t\tORDER BY CNQ.id ASC LIMIT 1 OFFSET 0"; $queue = POD::queryRow($sql); if (empty($queue) && empty($queue['queueId'])) { return false; } $comments = POD::queryRow("SELECT * FROM {$database['prefix']}Comments WHERE blogid = {$blogid} AND id = {$queue['commentid']}"); if (empty($comments['parent']) || $comments['secret'] == 1) { POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE id={$queue['queueId']}"); return false; } $parentComments = POD::queryRow("SELECT * FROM {$database['prefix']}Comments WHERE blogid = {$blogid} AND id = {$comments['parent']}"); if (empty($parentComments['homepage'])) { POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE id={$queue['queueId']}"); return false; } $entry = POD::queryRow("SELECT * FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND id={$comments['entry']}"); if (is_null($entry)) { $r1_comment_check_url = rawurlencode("{$defaultURL}/guestbook/" . $parentComments['id'] . "#guestbook" . $parentComments['id']); $r2_comment_check_url = rawurlencode("{$defaultURL}/guestbook/" . $comments['id'] . "#guestbook" . $comments['id']); $entry['title'] = _textf('%1 블로그의 방명록', $blog['title']); $entryPermaLink = "{$defaultURL}/guestbook/"; $entry['id'] = 0; } else { $r1_comment_check_url = rawurlencode("{$defaultURL}/" . ($blog['useSloganOnPost'] ? "entry/{$entry['slogan']}" : $entry['id']) . "#comment" . $parentComments['id']); $r2_comment_check_url = rawurlencode("{$defaultURL}/" . ($blog['useSloganOnPost'] ? "entry/{$entry['slogan']}" : $entry['id']) . "#comment" . $comments['id']); $entryPermaLink = "{$defaultURL}/" . ($blog['useSloganOnPost'] ? "entry/{$entry['slogan']}" : $entry['id']); } $data = "url=" . rawurlencode($defaultURL) . "&mode=fb" . "&s_home_title=" . rawurlencode($blog['title']) . "&s_post_title=" . rawurlencode($entry['title']) . "&s_name=" . rawurlencode($comments['name']) . "&s_no=" . rawurlencode($comments['entry']) . "&s_url=" . rawurlencode($entryPermaLink) . "&r1_name=" . rawurlencode($parentComments['name']) . "&r1_no=" . rawurlencode($parentComments['id']) . "&r1_pno=" . rawurlencode($comments['entry']) . "&r1_rno=0" . "&r1_homepage=" . rawurlencode($parentComments['homepage']) . "&r1_regdate=" . rawurlencode($parentComments['written']) . "&r1_url=" . $r1_comment_check_url . "&r2_name=" . rawurlencode($comments['name']) . "&r2_no=" . rawurlencode($comments['id']) . "&r2_pno=" . rawurlencode($comments['entry']) . "&r2_rno=" . rawurlencode($comments['parent']) . "&r2_homepage=" . rawurlencode($comments['homepage']) . "&r2_regdate=" . rawurlencode($comments['written']) . "&r2_url=" . $r2_comment_check_url . "&r1_body=" . rawurlencode($parentComments['comment']) . "&r2_body=" . rawurlencode($comments['comment']); if (strpos($parentComments['homepage'], "http://") === false) { $homepage = 'http://' . $parentComments['homepage']; } else { $homepage = $parentComments['homepage']; } $request = new HTTPRequest('POST', $homepage); $request->contentType = 'application/x-www-form-urlencoded; charset=utf-8'; $request->content = $data; if ($request->send()) { $xmls = new XMLStruct(); if ($xmls->open($request->responseText)) { $result = $xmls->selectNode('/response/error/'); if ($result['.value'] != '1' && $result['.value'] != '0') { $homepage = rtrim($homepage, '/') . '/index.php'; $request = new HTTPRequest('POST', $homepage); $request->contentType = 'application/x-www-form-urlencoded; charset=utf-8'; $request->content = $data; if ($request->send()) { } } } } else { } POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE id={$queue['queueId']}"); }
function authenticate($blogid, $loginid, $password, $blogapi = false) { global $database; $session = array(); Acl::clearAcl(); $loginid = POD::escapeString($loginid); $blogApiPassword = Setting::getBlogSettingGlobal("blogApiPassword", ""); if (strlen($password) == 32 && preg_match('/[0-9a-f]{32}/i', $password)) { // Raw login. ( with/without auth token) $userid = User::getUserIdByEmail($loginid); if (!empty($userid) && !is_null($userid)) { $query = DBModel::getInstance(); $query->reset('UserSettings'); $query->setQualifier('userid', 'equals', intval($userid)); $query->setQualifier('name', 'equals', 'AuthToken', true); $authtoken = $query->getCell('value'); if (!empty($authtoken) && $authtoken === $password) { // If user requested auth token, use it to confirm. $session['userid'] = $userid; } else { // login with md5 hash $secret = 'password = \'' . md5($password) . '\''; } } else { return false; } } else { if ($blogapi && !empty($blogApiPassword)) { // BlogAPI login $password = POD::escapeString($password); $secret = '(password = \'' . md5($password) . '\' OR \'' . $password . '\' = \'' . $blogApiPassword . '\')'; } else { // Normal login $secret = 'password = \'' . md5($password) . '\''; } } if (empty($session)) { $session = POD::queryRow("SELECT userid, loginid, name FROM {$database['prefix']}Users WHERE loginid = '{$loginid}' AND {$secret}"); } if (empty($session)) { /* You should compare return value with '=== false' which checks with variable types*/ return false; } $userid = $session['userid']; Acl::authorize('textcube', $userid); POD::execute("UPDATE {$database['prefix']}Users SET lastlogin = "******" WHERE loginid = '{$loginid}'"); // POD::execute("DELETE FROM {$database['prefix']}UserSettings WHERE userid = '$userid' AND name = 'AuthToken' LIMIT 1"); return $userid; }
function queryRowWithDBCache($query, $prefix = null, $type = MYSQL_BOTH, $count = -1) { // requireComponent('Needlworks.Cache.PageCache'); $cache = new queryCache($query, $prefix); if (!$cache->load()) { $cache->contents = POD::queryRow($query, $type, $count); $cache->update(); } return $cache->contents; }
function getRemoteResponseCount($blogid, $entryId = null) { global $database; if (is_null($entryId)) { $result = POD::queryRow("SELECT SUM(trackbacks) AS t, SUM(pingbacks) AS p\n\t\t\t\tFROM {$database['prefix']}Entries \n\t\t\t\tWHERE blogid = {$blogid} \n\t\t\t\t\tAND draft= 0"); return $result['t'] + $result['p']; } else { $result = POD::queryRow("SELECT trackbacks, pingbacks \n\t\t\tFROM {$database['prefix']}Entries \n\t\t\tWHERE blogid = {$blogid} \n\t\t\t\tAND id = {$entryId} \n\t\t\t\tAND draft= 0"); return $result['trackbacks'] + $result['pingbacks']; } }
function flushEntry($entryId = null) { global $database; if (empty($entryId)) { $entryId = ''; } else { $entryId = $entryId . '\\_'; } $cache = pageCache::getInstance(); $Entries = POD::queryColumn("SELECT name\n\t\t\tFROM {$database['prefix']}PageCacheLog\n\t\t\tWHERE blogid = " . getBlogId() . "\n\t\t\tAND (name like 'entry\\_" . $entryId . "%' OR name = 'commentRSS_" . $entryId . "')"); CacheControl::purgeItems($Entries); if (!empty($entryId)) { $entry = POD::queryRow("SELECT userid, category FROM {$database['prefix']}Entries\n\t\t\t\tWHERE blogid = " . getBlogId() . " AND id = {$entryId}"); if (!empty($entry)) { CacheControl::flushAuthor($entry['userid']); CacheControl::flushCategory($entry['category']); CacheControl::flushDBCache(); } } else { CacheControl::flushAuthor(); CacheControl::flushCategory(); CacheControl::flushDBCache(); } unset($cache); return true; }
function queryRowWithDBCache($query, $prefix = null, $type = MYSQL_BOTH, $count = -1) { $cache = new queryCache($query, $prefix); if (!$cache->load()) { $cache->contents = POD::queryRow($query, $type, $count); $cache->update(); } return $cache->contents; }
function getPluginTableName() { requireModel('common.setting'); $ctx = Model_Context::getInstance(); $likeEscape = array('/_/', '/%/'); $likeReplace = array('\\_', '\\%'); $escapename = preg_replace($likeEscape, $likeReplace, $ctx->getProperty('database.prefix')); $dbtables = POD::tableList($escapename); $dbCaseInsensitive = Setting::getServiceSetting('lowercaseTableNames', true); if ($dbCaseInsensitive === null) { $result = POD::queryRow("SHOW VARIABLES LIKE 'lower_case_table_names'"); $dbCaseInsensitive = $result['Value'] == 1 ? 1 : 0; Setting::setServiceSetting('lowercaseTableNames', $dbCaseInsensitive, true); } $definedTables = getDefinedTableNames(); $dbtables = array_values(array_diff($dbtables, $definedTables)); if ($dbCaseInsensitive == 1) { $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); } $dbtables = array_values(array_diff($dbtables, $definedTables)); } return $dbtables; }
function flushEntry($entryId = null) { global $database; if (empty($entryId)) { $entryId = ''; } else { $entryId = intval($entryId); } $Entries = POD::queryColumn("SELECT name\n\t\t\tFROM {$database['prefix']}PageCacheLog\n\t\t\tWHERE blogid = " . getBlogId() . "\n\t\t\tAND (name like 'entry-" . $entryId . "-%' OR name like '%RSS-" . $entryId . "' OR name like '%ATOM-" . $entryId . "')"); if (!empty($Entries)) { CacheControl::purgeItems($Entries); } if (!empty($entryId)) { $entry = POD::queryRow("SELECT userid, category, published FROM {$database['prefix']}Entries\n\t\t\t\tWHERE blogid = " . getBlogId() . " AND id = {$entryId}"); if (!empty($entry)) { $entry['period'] = Timestamp::getYearMonth($entry['published']); CacheControl::flushAuthor($entry['userid']); CacheControl::flushCategory($entry['category']); CacheControl::flushArchive($entry['period']); CacheControl::flushDBCache('entry'); } } else { CacheControl::flushAuthor(); CacheControl::flushCategory(); CacheControl::flushDBCache('entry'); } return true; }
function getTimeStatistics($getDate, $getHour, $getMenu) { global $database, $blogid, $configVal; requireComponent('Textcube.Function.misc'); $data = Misc::fetchConfigVal($configVal); if (is_null($data)) { $data['repliesChk'] = 2; $data['privateChk'] = 2; } $getVisibility = $data['privateChk'] == 2 ? " AND visibility > 0 " : ""; $commenterOutSql = $data['repliesChk'] == 2 ? " AND replier is NULL " : ""; $commenterOut = $data['commenterout'] ? explode("|", $data['commenterout']) : ""; if (!empty($commenterOut) && count($commenterOut) > 0) { foreach ($commenterOut as $item) { if (!empty($item)) { $commenterOutSql .= " AND name NOT LIKE '%{$item}%' "; } } } if (strlen($getHour) == 1) { $getHour = "0" . $getHour; } if ($getMenu == "entry") { $dateName = "published"; } else { $dateName = "written"; } $getYear = substr($getDate, 0, 4); $getMonth = substr($getDate, 4); if (strlen($getDate) == 4) { $getSQL = $getYear == 9999 ? "" : " AND EXTRACT(YEAR FROM FROM_UNIXTIME({$dateName})) = '{$getYear}' "; } else { $getSQL = $getYear == 9999 ? "" : " AND EXTRACT(YEAR FROM FROM_UNIXTIME({$dateName})) = '{$getYear}' "; $getSQL .= " AND EXTRACT(MONTH FROM FROM_UNIXTIME({$dateName})) = '{$getMonth}' "; } switch ($getMenu) { case "entry": $totalRow = POD::queryRow("SELECT FROM_UNIXTIME(published, '%H') AS period, COUNT(*) AS count FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND draft = 0 {$getVisibility} AND category >= 0 {$getSQL} AND FROM_UNIXTIME(published, '%H') = '{$getHour}' GROUP BY period ORDER BY period ASC"); break; case "comment": $totalRow = POD::queryRow("SELECT FROM_UNIXTIME(written, '%H') AS period, COUNT(*) AS count FROM {$database['prefix']}Comments WHERE blogid = {$blogid} AND entry > 0 AND isfiltered = 0 {$commenterOutSql} {$getSQL} AND FROM_UNIXTIME(written, '%H') = '{$getHour}' GROUP BY period ORDER BY period ASC"); break; case "trackback": $totalRow = POD::queryRow("SELECT FROM_UNIXTIME(written, '%H') AS period, COUNT(*) AS count FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid} AND entry > 0 AND type = 'trackback' AND isfiltered = 0 {$getSQL} AND FROM_UNIXTIME(written, '%H') = '{$getHour}' GROUP BY period ORDER BY period ASC"); break; case "guestbook": $totalRow = POD::queryRow("SELECT FROM_UNIXTIME(written, '%H') AS period, COUNT(*) AS count FROM {$database['prefix']}Comments WHERE blogid = {$blogid} AND entry = 0 AND isfiltered = 0 {$commenterOutSql} {$getSQL} AND FROM_UNIXTIME(written, '%H') = '{$getHour}' GROUP BY period ORDER BY period ASC"); break; default: return false; } return $totalRow; }
function getLinkCategory($blogid, $id) { global $database; return POD::queryRow("SELECT * \n\t\t\tFROM {$database['prefix']}LinkCategories \n\t\t\tWHERE blogid = {$blogid} AND id = {$id}"); }
function getTrackbackFeedByEntryId($blogid = null, $entryId, $rawMode = false, $mode = 'rss') { global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service; if (empty($blogid)) { $blogid = getBlogId(); } $entry = POD::queryRow("SELECT slogan, visibility, category FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND id = {$entryId}"); if (empty($entry)) { return false; } if ($entry['visibility'] < 2) { return false; } if (in_array($entry['category'], getCategoryVisibilityList($blogid, 'private'))) { return false; } $channel = array(); $channel = initializeRSSchannel($blogid); $channel['title'] = RSSMessage($blog['title'] . ': ' . _textf('%1 에 달린 트랙백', $entry['slogan'])); if ($blog['useSloganOnPost']) { $channel['link'] = $defaultURL . "/entry/" . URL::encode($entry['slogan'], true); } else { $channel['link'] = $defaultURL . "/" . $entryId; } $result = POD::queryAll("SELECT * \n\t\tFROM {$database['prefix']}RemoteResponses\n\t\tWHERE blogid = " . $blogid . " \n\t\t\tAND entry = " . $entryId . "\n\t\t\tAND isfiltered = 0\n\t\t\tAND type = 'trackback'"); if (!$result) { $result = array(); } $channel['items'] = array(); foreach ($result as $row) { $trackbackURL = $channel['link'] . "#trackback"; $content = htmlspecialchars($row['excerpt']); $item = array('id' => $row['id'], 'title' => RSSMessage($row['subject']), 'link' => $trackbackURL . $row['id'], 'categories' => array(), 'description' => RSSMessage($content), 'author' => RSSMessage(htmlspecialchars($row['site'])), 'pubDate' => $row['written'], 'comments' => $trackbackURL, 'guid' => $trackbackURL . $row['id']); array_push($channel['items'], $item); } if ($rawMode == true) { return $channel['items']; } $rss = array('channel' => $channel); if ($mode == 'rss') { return publishRSS($blogid, $rss); } else { if ($mode == 'atom') { return publishATOM($blogid, $rss); } } return false; }
<?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) require ROOT . '/library/preprocessor.php'; requireStrictRoute(); if (isset($suri['id'])) { if ($feed = POD::queryRow("SELECT *\n\t\tFROM {$database['prefix']}Feeds\n\t\tWHERE id = {$suri['id']}")) { Respond::ResultPage(updateFeed($feed)); exit; } else { Respond::ResultPage(-1); exit; } } set_time_limit(360); ob_implicit_flush(); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Update all feeds</title> <script type="text/javascript" src="<?php echo $context->getProperty('uri.service'); ?> /resources/script/common3.min.js"></script> <script type="text/javascript"> //<![CDATA[ var servicePath = "<?php
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; }
public function getRow($field = '*') { $field = $this->_treatReservedFields($field); return POD::queryRow('SELECT ' . $field . ' FROM ' . $this->table . $this->_makeWhereClause()); }
public function getRow($field = '*', $options = null) { $field = $this->_treatReservedFields($field); $options = $this->_treatOptions($options); if ($options['usedbcache'] == true) { $result = POD::queryRowWithDBCache('SELECT ' . $options['filter'] . $field . ' FROM ' . $this->_getTableName() . $this->_extendClause() . $this->_makeWhereClause(), $options['cacheprefix']); } else { $result = POD::queryRow('SELECT ' . $options['filter'] . $field . ' FROM ' . $this->_getTableName() . $this->_extendClause() . $this->_makeWhereClause()); } $this->_manage_pool_stack(); return $result; }
echo _t('실패했습니다.'); ?> ', "center", "bottom"); } request.send("userid=" + userid); } <?php } ?> //]]> </script> <?php // Teamblog :: Get username. $teamblog_user = POD::queryRow("SELECT name, loginid \n\t FROM {$database['prefix']}Users \n\t WHERE userid='" . getUserId() . "'"); // End TeamBlog ?> <div id="part-setting-account" class="part"> <h2 class="caption"><span class="main-text"><?php echo _t('로그인 정보'); ?> </span></h2> <div class="data-inbox"> <form id="info-section" class="section" method="post" action="<?php echo $context->getProperty('uri.blog'); ?> /owner/setting/account">
function PN_Blog_Statistics_Default() { global $database, $blogid, $defaultURL, $blogURL, $pluginURL, $pluginMenuURL, $configVal; requireComponent('Textcube.Model.Statistics'); requireComponent('Textcube.Function.misc'); $data = misc::fetchConfigVal($configVal); if (is_null($data)) { $data['privateChk'] = 2; } $getVisibility = $data['privateChk'] == 2 ? " AND visibility > 0 " : ""; $stats = Statistics::getStatistics($blogid); $getDate = isset($_GET['date']) ? $_GET['date'] : date('Y', strtotime("now")); $getMenu = isset($_GET['menu']) ? $_GET['menu'] : "entry"; $getYear = substr($getDate, 0, 4); $getMonth = substr($getDate, 4); $yearRow = POD::queryAll("SELECT EXTRACT(YEAR FROM FROM_UNIXTIME(published)) period, COUNT(*) count FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND draft = 0 {$getVisibility} AND category >= 0 GROUP BY period ORDER BY period DESC"); $yearCell = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND draft = 0 {$getVisibility} AND category >= 0 AND EXTRACT(YEAR FROM FROM_UNIXTIME(published)) = '" . date('Y', strtotime("now")) . "'"); $yearAll = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND draft = 0 {$getVisibility} AND category >= 0"); $yearSelect = "<select id=\"yearSelect\" onchange=\"execDate(this);\">\n"; $yearSelect .= "<option value=\"\">" . _t(' - 년 도 -') . "</option>\n"; $selected = $getYear == 9999 ? " selected" : ""; $yearSelect .= "<option value=\"9999\" style=\"font-weight:bold;\" {$selected}>" . _t('#전체') . "({$yearAll})</option>\n"; if (!$yearCell) { $selected = $getYear == date('Y', strtotime("now")) ? " selected" : ""; $yearSelect .= "<option value=\"" . date('Y', strtotime("now")) . "\" {$selected}>" . date('Y', strtotime("now")) . _t('년') . "(0)</option>\n"; } foreach ($yearRow as $items) { $selected = $getYear == $items['period'] ? " selected" : ""; $yearSelect .= "<option value=\"{$items['period']}\" {$selected}>{$items['period']}" . _t('년') . "({$items['count']})</option>\n"; } $yearSelect .= "</select>\n"; $monthSelect = "<select id=\"monthSelect\" onchange=\"execDate(this);\">\n"; $monthSelect .= "<option value=\"\">- " . _t('월') . " -</option>\n"; $monthSelect .= "<option value=\"{$getYear}\" " . (strlen($getDate) == 4 ? " selected" : "") . ">" . _t('#전체') . "</option>\n"; for ($i = 1; $i <= 12; $i++) { $gMonth = strlen($i) == 1 ? "0" . $i : $i; $gValue = $getYear . $gMonth; $selected = $getMonth == $gMonth ? " selected" : ""; $monthSelect .= "<option value=\"{$gValue}\" {$selected}>" . $gMonth . _t('월') . "</option>\n"; } $monthSelect .= "</select>\n"; $noticeRow = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND draft = 0 {$getVisibility} AND category = -2"); //공지 $keywordRow = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND draft = 0 {$getVisibility} AND category = -1"); //키워드 ?> <script type="text/javascript"> //<![CDATA[ function execLoadFunction() { tempDiv = document.createElement("DIV"); tempDiv.style.clear = "both"; document.getElementById("part-statistics-blog").appendChild(tempDiv); } function execDate(selectObject){ if(selectObject.options[selectObject.selectedIndex].value){ location.href="<?php echo $pluginMenuURL; ?> &date="+selectObject.options[selectObject.selectedIndex].value+"&menu=<?php echo $getMenu; ?> "; } } window.addEventListener("load", execLoadFunction, false); //]]> </script> <div id="part-statistics-blog" class="part"> <h2 class="caption"><span class="main-text"><?php echo _t('블로그 통계정보를 보여줍니다'); ?> </span></h2> <div id="statistics-main"> <div id="statistics-counter-inbox"> <div class="title"><h3><?php echo _t('종 합 정 보'); ?> </h3></div> <table width="100%"> <tbody> <tr class="tr"> <td colspan="2"><?php echo _t('년/월별 선택'); ?> <br /> <?php echo $yearSelect; ?> <?php echo $monthSelect; ?> </td> </tr> <tr height="5"><td colspan="2"></td></tr> <tr height="1" bgcolor="#dddddd"><td colspan="2"></td></tr> <tr class="tr"> <td><?php echo _t('오늘 방문자'); ?> </td> <th><?php echo number_format($stats['today']); ?> </th> </tr> <tr class="tr"> <td><?php echo _t('어제 방문자'); ?> </td> <th><?php echo number_format($stats['yesterday']); ?> </th> </tr> <tr class="tr"> <td><?php echo _t('총 방문자'); ?> </td> <th><?php echo number_format($stats['total']); ?> </th> </tr> <tr height="1" bgcolor="#dddddd"><td colspan="2"></td></tr> <tr class="tr"> <td><?php echo _t('글 개수'); ?> </td> <th><?php echo number_format(getEntriesTotalCountDB($blogid)); ?> </th> </tr> <tr class="tr"> <td><?php echo _t('공지 개수'); ?> </td> <th><?php echo number_format($noticeRow); ?> </th> </tr> <tr class="tr"> <td><?php echo _t('키워드 개수'); ?> </td> <th><?php echo number_format($keywordRow); ?> </th> </tr> <tr class="tr"> <td><?php echo _t('댓글 개수'); ?> </td> <th><?php echo number_format(getCommentCountDB($blogid)); ?> </th> </tr> <tr class="tr"> <td><?php echo _t('방명록 개수'); ?> </td> <th><?php echo number_format(getGuestbookCountDB($blogid)); ?> </th> </tr> <tr class="tr"> <td><?php echo _t('트랙백 개수'); ?> </td> <th><?php echo number_format(getTrackbackCountDB($blogid)); ?> </th> </tr> <tr height="10"><td colspan="2"></td></tr> </tbody> </table> <div class="title"><h3><?php echo _t('세 부 메 뉴'); ?> </h3></div> <table width="100%"> <tbody> <tr class="tr"> <td> » <a href="<?php echo $pluginMenuURL; ?> &date=<?php echo $getDate; ?> &menu=entry"><?php echo _get_t(_t('글(포스트) 통계'), 'entry'); ?> </a></td> </tr> <tr class="tr"> <td> » <a href="<?php echo $pluginMenuURL; ?> &date=<?php echo $getDate; ?> &menu=comment"><?php echo _get_t(_t('댓글 통계'), 'comment'); ?> </a></td> </tr> <tr class="tr"> <td> - <a href="<?php echo $pluginMenuURL; ?> &date=<?php echo $getDate; ?> &menu=commenter"><?php echo _get_t(_t('작성자 목록'), 'commenter'); ?> </a></td> </tr> <tr class="tr"> <td> » <a href="<?php echo $pluginMenuURL; ?> &date=<?php echo $getDate; ?> &menu=trackback"><?php echo _get_t(_t('트랙백 통계'), 'trackback'); ?> </a></td> </tr> <tr class="tr"> <td> » <a href="<?php echo $pluginMenuURL; ?> &date=<?php echo $getDate; ?> &menu=guestbook"><?php echo _get_t(_t('방명록 통계'), 'guestbook'); ?> </a></td> </tr> <tr class="tr"> <td> - <a href="<?php echo $pluginMenuURL; ?> &date=<?php echo $getDate; ?> &menu=guestbookcommenter"><?php echo _get_t(_t('작성자 목록'), 'guestbookcommenter'); ?> </a></td> </tr> <tr class="tr"> <td> » <a href="<?php echo $pluginMenuURL; ?> &date=<?php echo $getDate; ?> &menu=tag"><?php echo _get_t(_t('태그 통계'), 'tag'); ?> </a></td> </tr> <tr class="tr"> <td> » <a href="<?php echo $pluginMenuURL; ?> &date=<?php echo $getDate; ?> &menu=visit"><?php echo _get_t(_t('방문자 통계'), 'visit'); ?> </a></td> </tr> <tr class="tr"> <td> » <a href="<?php echo $pluginMenuURL; ?> &date=<?php echo $getDate; ?> &menu=referer"><?php echo _get_t(_t('리퍼러 통계'), 'referer'); ?> </a></td> </tr> </tbody> </table> </div> <div id="statistics-inbox"> <?php //############################## // 글(포스트) 통계 ######### //############################## if ($getMenu == "entry") { if ($getYear == 9999 && !$getMonth) { $getData = array(); $getTags = array(); $getDateTitle = _t('전체 년도별'); $tempData = getStatisticsDB('years', '', $getMenu); foreach ($tempData as $item) { array_push($getData, $item['count']); array_push($getTags, rawurlencode($item['period'] . _t('년'))); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 1); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('글(포스트) 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> YearStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> YearPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=archiveYear&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php } $getData = array(); $getTags = array(); if ($getYear == 9999) { $getDateTitle = !$getMonth ? _t('전체') : _t('전체') . ' ' . $getMonth . _t('월'); } else { $getDateTitle = !$getMonth ? $getYear . _t('년도') : $getYear . _t('년도') . $getMonth . _t('월'); } if (!$getMonth) { $lastCount = 12; $textValue = _t('월'); } else { $lastCount = $getYear == 9999 ? 31 : date('t', mktime(0, 0, 0, $getMonth, 1, $getYear)); $textValue = ""; } for ($i = 1; $i <= $lastCount; $i++) { $tempData = getStatisticsDB($getDate, $i, $getMenu); if ($tempData) { array_push($getData, $tempData['count']); array_push($getTags, rawurlencode($i . $textValue)); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 1); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('글(포스트) 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> Stic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td align="right"> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> Pizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=archiveMonth&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php if (!$getMonth) { $getData = array(); $getTags = array(); for ($i = 1; $i <= 4; $i++) { $tempData = getQuartersStatistics($getDate, $i, $getMenu); if ($tempData) { array_push($getData, $tempData); array_push($getTags, rawurlencode($i . "/4 " . _t('분기'))); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('분기별') . _t('글(포스트) 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> QuartersStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> QuartersPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php } $getData = array(); $getTags = array(); $tempData = getCategoryStatistics(); $itemCnt = getCategoryStatisticsTotal(0, $getDate); if ($itemCnt) { array_push($getData, $itemCnt); array_push($getTags, $item['id']); } foreach ($tempData as $item) { $itemCnt = getCategoryStatisticsTotal($item['id'], $getDate); if ($itemCnt) { array_push($getData, $itemCnt); array_push($getTags, $item['id']); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('카테고리별') . _t('글(포스트) 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> CategoryStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=category&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> CategoryPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=category&grpYear=" . $getYear . "&grpTypeName=category&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php $query = "SELECT * FROM {$database['prefix']}Entries_hits"; if (POD::queryRow($query)) { $getData = array(); $getTags = array(); $tempData = getEntryHitsStatistics($getDate); foreach ($tempData as $item) { array_push($getData, $item['hits']); array_push($getTags, $item['id']); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('조회수 TOP 10') . _t('글(포스트) 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> HitsStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=hits&grpXLabelType=2&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> HitsPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=entry&grpYear=" . $getYear . "&grpTypeName=hits&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php } $getData = array(); $getTags = array(); for ($i = 0; $i <= 23; $i++) { $tempData = getTimeStatistics($getDate, $i, $getMenu); if ($tempData) { if ($tempData['period'] == "00") { $tempData['period'] = str_replace("00", "0", $tempData['period']); } else { if (substr($tempData['period'], 0, 1) == "0") { $tempData['period'] = str_replace("0", "", $tempData['period']); } } array_push($getData, $tempData['count']); array_push($getTags, $tempData['period']); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('시간대별') . _t('글(포스트) 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> TimeStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=time&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> TimePizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=time&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <hr class="hidden" /> <?php } else { if ($getMenu == "comment") { //############################## // 댓글 통계 ################### //############################## if ($getYear == 9999 && !$getMonth) { $getData = array(); $getTags = array(); $getDateTitle = _t('전체 년도별'); $tempData = getStatisticsDB('years', '', $getMenu); foreach ($tempData as $item) { array_push($getData, $item['count']); array_push($getTags, rawurlencode($item['period'] . _t('년'))); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('댓글 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> YearStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> YearPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php } $getData = array(); $getTags = array(); if ($getYear == 9999) { $getDateTitle = !$getMonth ? _t('전체') : _t('전체') . ' ' . $getMonth . _t('월'); } else { $getDateTitle = !$getMonth ? $getYear . _t('년도') : $getYear . _t('년도') . $getMonth . _t('월'); } if (!$getMonth) { $lastCount = 12; $textValue = _t('월'); } else { $lastCount = $getYear == 9999 ? 31 : date('t', mktime(0, 0, 0, $getMonth, 1, $getYear)); $textValue = ""; } for ($i = 1; $i <= $lastCount; $i++) { $tempData = getStatisticsDB($getDate, $i, $getMenu); if ($tempData) { array_push($getData, $tempData['count']); array_push($getTags, rawurlencode($i . $textValue)); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('댓글 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> Stic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> Pizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php if (!$getMonth) { $getData = array(); $getTags = array(); for ($i = 1; $i <= 4; $i++) { $tempData = getQuartersStatistics($getYear, $i, $getMenu); if ($tempData) { array_push($getData, $tempData); array_push($getTags, rawurlencode($i . "/4 " . _t('분기'))); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('분기별') . _t('댓글 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> QuartersStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> QuartersPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php } $getData = array(); $getTags = array(); $tempData = getCommentEntryMaxCount($getDate); foreach ($tempData as $item) { array_push($getData, $item['comments']); array_push($getTags, $item['id']); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('댓글 TOP 10') . _t('글 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> EntryMaxStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=cmmax&grpXLabelType=2&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> EntryMaxPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=entry&grpYear=" . $getYear . "&grpTypeName=cmmax&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php $getData = array(); $getTags = array(); $tempData = getCommenterMaxCount($getDate, $getMenu); foreach ($tempData as $item) { array_push($getData, $item['namecnt']); array_push($getTags, rawurlencode($item['name'])); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('댓글자 TOP 10') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> erMaxStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=commenter&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> erMaxPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php $getData = array(); $getTags = array(); for ($i = 0; $i <= 23; $i++) { $tempData = getTimeStatistics($getDate, $i, $getMenu); if ($tempData) { if ($tempData['period'] == "00") { $tempData['period'] = str_replace("00", "0", $tempData['period']); } else { if (substr($tempData['period'], 0, 1) == "0") { $tempData['period'] = str_replace("0", "", $tempData['period']); } } array_push($getData, $tempData['count']); array_push($getTags, $tempData['period']); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('시간대별') . _t('댓글 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> TimeStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=time&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> TimePizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=time&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <hr class="hidden" /> <?php } else { if ($getMenu == "commenter") { //############################## // 댓글 작성자 목록 ############ //############################## if ($getYear == 9999) { $getDateTitle = !$getMonth ? _t('전체') : _t('전체') . ' ' . $getMonth . _t('월'); } else { $getDateTitle = !$getMonth ? $getYear . _t('년도') : $getYear . _t('년도') . $getMonth . _t('월'); } $tempData = getCommenterMaxCount($getDate, $getMenu); $tempAllCount = getCommenterMaxCount(9999, $getMenu); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('댓글') . _t('작성자') . _t('목록'); ?> (<?php echo number_format(count($tempData)) . "/" . number_format(count($tempAllCount)); echo _t('명'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div id="commenterList"> <?php $i = 0; foreach ($tempData as $item) { $guestname = htmlspecialchars(UTF8::lessenAsEm($item['name'], 20)); if (!empty($item['home'])) { $homepage = ereg('^[[:alnum:]]+:', $item['home']) ? htmlspecialchars($item['home']) : "http://" . htmlspecialchars($item['home']); $guestname = "<a href=\"{$homepage}\" onclick=\"window.open(this.href); return false;\">{$guestname}</a>"; } $count = "<span class=\"count\">(" . $item['namecnt'] . ")</span>"; ?> <div class="userlist"><?php echo $guestname; ?> <?php echo $count; ?> </div><?php if ($i % 4 == 3) { echo "<div class=\"clear\"></div>\n"; } $i++; } ?> </div> </td> </tr> </tbody> </table> <hr class="hidden" /> <?php } else { if ($getMenu == "trackback") { //############################## // 역인글 통계 ################# //############################## if ($getYear == 9999 && !$getMonth) { $getData = array(); $getTags = array(); $getDateTitle = _t('전체 년도별'); $tempData = getStatisticsDB('years', '', $getMenu); foreach ($tempData as $item) { array_push($getData, $item['count']); array_push($getTags, rawurlencode($item['period'] . _t('년'))); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> 트랙백 통계(<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> YearStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> YearPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php } $getData = array(); $getTags = array(); if ($getYear == 9999) { $getDateTitle = !$getMonth ? _t('전체') : _t('전체') . ' ' . $getMonth . _t('월'); } else { $getDateTitle = !$getMonth ? $getYear . _t('년도') : $getYear . _t('년도') . $getMonth . _t('월'); } if (!$getMonth) { $lastCount = 12; $textValue = _t('월'); } else { $lastCount = $getYear == 9999 ? 31 : date('t', mktime(0, 0, 0, $getMonth, 1, $getYear)); $textValue = ""; } for ($i = 1; $i <= $lastCount; $i++) { $tempData = getStatisticsDB($getDate, $i, $getMenu); if ($tempData) { array_push($getData, $tempData['count']); array_push($getTags, rawurlencode($i . $textValue)); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('트랙백') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> Stic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> Pizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php if (!$getMonth) { $getData = array(); $getTags = array(); for ($i = 1; $i <= 4; $i++) { $tempData = getQuartersStatistics($getYear, $i, $getMenu); if ($tempData) { array_push($getData, $tempData); array_push($getTags, rawurlencode($i . "/4 " . _t('분기'))); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('분기별') . _t('트랙백') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> QuartersStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> QuartersPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php } $getData = array(); $getTags = array(); $getLink = array(); $tempData = getTrackbackEntryMaxCount($getDate); foreach ($tempData as $item) { array_push($getData, $item['trackbacks']); array_push($getTags, $item['id']); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('트랙백') . _t('받은 TOP 10') . _t('글 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> EntryMaxStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=tbmax&grpXLabelType=2&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> EntryMaxPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=entry&grpYear=" . $getYear . "&grpTypeName=tbmax&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php $getData = array(); $getTags = array(); $tempData = getTrackbackCallEntryMaxCount($getDate); foreach ($tempData as $item) { array_push($getData, $item['trackbacklogs']); array_push($getTags, $item['id']); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('트랙백') . _t('보낸 TOP 10') . _t('글 통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> CallEntryMaxStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=cmmax&grpXLabelType=2&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> CallEntryMaxPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=entry&grpYear=" . $getYear . "&grpTypeName=cmmax&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php $getData = array(); $getTags = array(); for ($i = 0; $i <= 23; $i++) { $tempData = getTimeStatistics($getDate, $i, $getMenu); if ($tempData) { if ($tempData['period'] == "00") { $tempData['period'] = str_replace("00", "0", $tempData['period']); } else { if (substr($tempData['period'], 0, 1) == "0") { $tempData['period'] = str_replace("0", "", $tempData['period']); } } array_push($getData, $tempData['count']); array_push($getTags, $tempData['period']); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('시간대별') . _t('트랙백') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> TimeStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=time&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> TimePizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=time&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <hr class="hidden" /> <?php } else { if ($getMenu == "guestbook") { //############################## // 방명록 통계 ################# //############################## if ($getYear == 9999 && !$getMonth) { $getData = array(); $getTags = array(); $getDateTitle = _t('전체 년도별'); $tempData = getStatisticsDB('years', '', $getMenu); foreach ($tempData as $item) { array_push($getData, $item['count']); array_push($getTags, rawurlencode($item['period'] . _t('년'))); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('방명록') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> YearStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> YearPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php } $getData = array(); $getTags = array(); if ($getYear == 9999) { $getDateTitle = !$getMonth ? _t('전체') : _t('전체') . ' ' . $getMonth . _t('월'); } else { $getDateTitle = !$getMonth ? $getYear . _t('년도') : $getYear . _t('년도') . $getMonth . _t('월'); } if (!$getMonth) { $lastCount = 12; $textValue = _t('월'); } else { $lastCount = $getYear == 9999 ? 31 : date('t', mktime(0, 0, 0, $getMonth, 1, $getYear)); $textValue = ""; } for ($i = 1; $i <= $lastCount; $i++) { $tempData = getStatisticsDB($getDate, $i, $getMenu); if ($tempData) { array_push($getData, $tempData['count']); array_push($getTags, rawurlencode($i . $textValue)); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('방명록') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> Stic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> Pizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php if (!$getMonth) { $getData = array(); $getTags = array(); for ($i = 1; $i <= 4; $i++) { $tempData = getQuartersStatistics($getYear, $i, $getMenu); if ($tempData) { array_push($getData, $tempData); array_push($getTags, rawurlencode($i . "/4 " . _t('분기'))); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('분기별') . _t('방명록') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> QuartersStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> QuartersPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php } $getData = array(); $getTags = array(); $tempData = getCommenterMaxCount($getDate, $getMenu); foreach ($tempData as $item) { array_push($getData, $item['namecnt']); array_push($getTags, rawurlencode($item['name'])); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('방명록') . _t('댓글자 TOP 10') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> CommenterMaxStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=commenter&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> CommenterMaxPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php $getData = array(); $getTags = array(); for ($i = 0; $i <= 23; $i++) { $tempData = getTimeStatistics($getDate, $i, $getMenu); if ($tempData) { if ($tempData['period'] == "00") { $tempData['period'] = str_replace("00", "0", $tempData['period']); } else { if (substr($tempData['period'], 0, 1) == "0") { $tempData['period'] = str_replace("0", "", $tempData['period']); } } array_push($getData, $tempData['count']); array_push($getTags, $tempData['period']); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('시간대별') . _t('방명록') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> TimeStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=time&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> TimePizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=time&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <hr class="hidden" /> <?php } else { if ($getMenu == "guestbookcommenter") { //############################## // 방명록 작성자 목록 ############ //############################## if ($getYear == 9999) { $getDateTitle = !$getMonth ? _t('전체') : _t('전체') . ' ' . $getMonth . _t('월'); } else { $getDateTitle = !$getMonth ? $getYear . _t('년도') : $getYear . _t('년도') . $getMonth . _t('월'); } $tempData = getCommenterMaxCount($getDate, $getMenu); $tempAllCount = getCommenterMaxCount(9999, $getMenu); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('방명록') . _t('작성자') . _t('목록'); ?> (<?php echo number_format(count($tempData)) . "/" . number_format(count($tempAllCount)); ?> 명)</h3></th> </tr> </thead> <tbody> <tr> <td> <div id="commenterList"> <?php $i = 0; foreach ($tempData as $item) { $guestname = htmlspecialchars(UTF8::lessenAsEm($item['name'], 20)); if (!empty($item['home'])) { $homepage = ereg('^[[:alnum:]]+:', $item['home']) ? htmlspecialchars($item['home']) : "http://" . htmlspecialchars($item['home']); $guestname = "<a href=\"{$homepage}\" onclick=\"window.open(this.href); return false;\">{$guestname}</a>"; } $count = "<span class=\"count\">(" . $item['namecnt'] . ")</span>"; ?> <div class="userlist"><?php echo $guestname; ?> <?php echo $count; ?> </div><?php if ($i % 4 == 3) { echo "<div class=\"clear\"></div>\n"; } $i++; } ?> </div> </td> </tr> </tbody> </table> <hr class="hidden" /> <?php } else { if ($getMenu == "tag") { //############################## // 태그 통계 ################### //############################## $getDateTitle = !$getMonth ? $getYear . _t('년도') : $getYear . _t('년도') . $getMonth . _t('월'); $getData = array(); $getTags = array(); $tempData = getTagMaxCount(); foreach ($tempData as $item) { array_push($getData, $item['count']); array_push($getTags, rawurlencode($item['name'])); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 1); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo _t('인기') . _t('태그 TOP 10') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> MaxStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=tag&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> MaxPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=tag&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php $getData = array(); $getTags = array(); if ($getYear == 9999) { $getDateTitle = !$getMonth ? _t('전체') : _t('전체') . ' ' . $getMonth . _t('월'); } else { $getDateTitle = !$getMonth ? $getYear . _t('년도') : $getYear . _t('년도') . $getMonth . _t('월'); } $tempData = getTagEntryMaxCount($getDate, 1); foreach ($tempData as $item) { array_push($getData, $item['count']); array_push($getTags, $item['id']); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('태그') . _t('걸린 TOP 10') . _t('글 통계'); ?> (<?php echo number_format(getTagEntryMaxCount($getDate, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> EntryMaxStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=tagmax&grpXLabelType=2&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> EntryMaxPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=entry&grpYear=" . $getYear . "&grpTypeName=tagmax&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <hr class="hidden" /> <?php } else { if ($getMenu == "visit") { //############################## // 방문자 통계 ################# //############################## if ($getYear == 9999 && !$getMonth) { $getData = array(); $getTags = array(); $getDateTitle = _t('전체 년도별'); $tempData = getStatisticsDB('years', '', $getMenu); foreach ($tempData as $item) { array_push($getData, $item['count']); array_push($getTags, rawurlencode($item['period'] . _t('년'))); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('방문자') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> YearStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> YearPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php } $getData = array(); $getTags = array(); if ($getYear == 9999) { $getDateTitle = !$getMonth ? _t('전체') : _t('전체') . ' ' . $getMonth . _t('월'); } else { $getDateTitle = !$getMonth ? $getYear . _t('년도') : $getYear . _t('년도') . $getMonth . _t('월'); } if (!$getMonth) { $lastCount = 12; $textValue = _t('월'); } else { $lastCount = $getYear == 9999 ? 31 : date('t', mktime(0, 0, 0, $getMonth, 1, $getYear)); $textValue = ""; } for ($i = 1; $i <= $lastCount; $i++) { $tempData = getStatisticsDB($getDate, $i, $getMenu); if ($tempData) { array_push($getData, $tempData['count']); array_push($getTags, rawurlencode($i . $textValue)); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('방문자') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> Stic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> Pizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php if (!$getMonth) { $getData = array(); $getTags = array(); for ($i = 1; $i <= 4; $i++) { $tempData = getQuartersStatistics($getYear, $i, $getMenu); if ($tempData) { array_push($getData, $tempData); array_push($getTags, rawurlencode($i . "/4 " . _t('분기'))); } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 0); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo $getDateTitle; ?> <?php echo _t('분기별') . _t('방문자') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 0)) . "/" . number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> QuartersStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> QuartersPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <hr class="hidden" /> <hr class="hidden" /> <?php } } else { if ($getMenu == "referer") { //############################## // 리퍼러 통계 ################# //############################## $getData = array(); $getTags = array(); $tempData = getRefererMaxCount(); foreach ($tempData as $item) { array_push($getData, $item['count']); array_push($getTags, rawurlencode($item['host'])); } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = getStatisticsTotalDB($getDate, $getMenu, 1); ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo _t('리퍼러') . _t('TOP 10') . _t('통계'); ?> (<?php echo number_format(getStatisticsTotalDB($getDate, $getMenu, 1)); echo _t('개'); ?> )</h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> MaxStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=refer&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> MaxPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php $getData = array(); $getTags = array(); $getDuplicate = array(); $beforCount = ""; $tempData = getRefererKeywordStatistics(); foreach ($tempData as $item) { if ($item['count'] != $beforCount) { $beforCount = $item['count']; } else { array_push($getDuplicate, $item['count']); } } $getDuplicate = array_count_values($getDuplicate); $beforCount = ""; foreach ($tempData as $item) { if ($item['count'] != $beforCount && $item['rank'] < 11) { array_push($getData, $item['count']); $duplicateCount = $getDuplicate[$item['count']] ? _f("(외 %1 개)", $getDuplicate[$item['count']]) : _f("(외 %1 개)", 0); array_push($getTags, rawurlencode(htmlspecialchars(UTF8::lessenAsEm($item['keyword'], 15)) . $duplicateCount)); $beforCount = $item['count']; } } $getData = implode("|", $getData); $getTags = implode("|", $getTags); $getTotal = $tempData[0]['total']; ?> <table class="data-inbox" cellspacing="0" cellpadding="0"> <thead> <tr> <th colspan="2"><h3><?php echo _t('리퍼러') . _t('키워드 TOP 10') . _t('통계'); ?> (<?php echo number_format($tempData[0]['total']); echo _t('개'); ?> ) : <?php echo $tempData[0]['dateStart']; ?> ~ <?php echo $tempData[0]['dateEnd']; ?> </h3></th> </tr> </thead> <tbody> <tr> <td> <div class="flash-stic"> <div id="get<?php echo $getMenu; ?> KeywordMaxStic"> <?php echo open_flash_chart_object(470, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=bar&grpTypeName=referkey&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_bar" : "")); ?> </div> </div> </td> <td> <div class="flash-pizza"> <div id="get<?php echo $getMenu; ?> KeywordMaxPizza"> <?php echo open_flash_chart_object(265, 250, $blogURL . "/plugin/BlogStatisticsProcess/?grpStyle=pie&grpLinkType=&grpYear=" . $getYear . "&grpTypeName=&grpData=" . $getData . "&grpTotal=" . $getTotal . "&grpLabel=" . $getTags . (empty($getData) ? "&grpNoData_pie" : "")); ?> </div> </div> </td> </tr> </tbody> </table> <?php } } } } } } } } } ?> </div> </div> </div> <?php }
function getTeamBlogSettings() { global $database, $service, $serviceURL, $pluginURL, $configVal; requireComponent('Textcube.Function.misc'); $data = Setting::fetchConfigVal($configVal); getTeamBlogInitConfigVal($data); ?> <script type="text/javascript" src="<?php echo $pluginURL; ?> /plugin-main.js"></script> <?php $teamblog_user = POD::queryRow("SELECT name, loginid FROM {$database['prefix']}Users WHERE userid=" . getUserId()); $row = POD::queryRow("SELECT style, image, profile FROM {$database['prefix']}TeamUserSettings WHERE blogid =" . getBlogId() . " and userid=" . getUserId()); if (!$row) { POD::execute("INSERT INTO {$database['prefix']}TeamUserSettings (blogid,userid,style,image,profile,updated) VALUES(" . getBlogId() . "," . getUserId() . ",'','', '',UNIX_TIMESTAMP())"); } if ($row['image']) { $image = "{$service['path']}/attach/" . getBlogId() . "/team/" . $row['image']; $imageRemoveCheck = ""; } else { $image = "{$service['path']}/resources/image/spacer.gif"; $imageRemoveCheck = " disabled "; } $authorStyle = ""; $italicCheck = ""; $underlineCheck = ""; $boldCheck = ""; $color = ""; if ($row['style']) { $style = explode("|", $row['style']); if (isset($style[0]) && $style[0] == "true") { $authorStyle = "font-weight:bold;"; $boldCheck = " checked "; } if (isset($style[1]) && $style[1] == "true") { $authorStyle .= "font-style:italic;"; $italicCheck = " checked "; } if (isset($style[2]) && $style[2] == "true") { $authorStyle .= "text-decoration:underline;"; $underlineCheck = " checked "; } if (isset($style[3]) && !empty($style[3])) { $authorStyle .= "color:{$style[3]};"; $color = $style[3]; } if (isset($style[4]) && !empty($style[4])) { $authorStyle .= "font-family:{$style[4]};"; $family = explode(",", $style[4]); } if (isset($style[5]) && !empty($style[5])) { $authorStyle .= "font-size:{$style[5]}pt;"; $size = $style[5]; } } else { $style = array(); } $profile = ""; if ($row['profile']) { $profile = $row['profile']; } ?> <div id="part-setting-teams" class="part"> <h2 class="caption"><span class="main-text"><?php echo _t('팀블로그 정보를 설정합니다'); ?> </span></h2> <div class="data-inbox"> <div class="sectionGroup"> <fieldset class="container"> <legend><?php echo _t('필명 설정'); ?> </legend> <dl id="team-style-line" class="line"> <dt><label for="title"><?php echo _t('필명 스타일'); ?> </label></dt> <dd>by <span id="nicknameStyle" style="<?php echo $authorStyle; ?> "><?php echo htmlspecialchars($teamblog_user['name']); ?> </span></dd> <dd> <span><input <?php echo $boldCheck; ?> type="checkbox" value="1" id="fontBold" onclick="styleExecCommand('fontBold', 'fontbold', 'bold');" /> <label for="fontBold"><b><?php echo _t('굵게'); ?> </b></label></span> <span><input <?php echo $italicCheck; ?> type="checkbox" id="fontItalic" onclick="styleExecCommand('fontItalic', 'fontitalic', 'italic');" /> <label for="fontItalic"><i><?php echo _t('기울임'); ?> </i></label></span> <span><input <?php echo $underlineCheck; ?> type="checkbox" id="fontUnderline" onclick="styleExecCommand('fontUnderline', 'fontunderline', 'underline');" /> <label for="fontUnderline"><u><?php echo _t('밑줄'); ?> </u></label></span> <span id="fontStyleElement"></span> <script type="text/javascript"> //<![CDATA[ var colorCheck; var familyCheck; var sizeCheck; var html = //// '<input type="text" id="fontColor" class="input-text2" style="<?php echo empty($color) ? '' : 'color:$color'; ?> ;" value="<?php echo $color; ?> " />' + '<select id="fontColorList" style="width:80px;height:19px;" onchange="styleExecCommand(\'fontColor\', \'fontcolor\', this.value);">' + '<option class="head-option" value=""><?php echo _t('글자색'); ?> <\/option>'; for (var i = 0; i < colors.length; ++i) { <?php if (isset($style[3]) && !empty($style[3])) { echo "colorCheck = (colors[i] == '" . str_replace("#", "", $color) . "')?' selected ':'';"; } ?> html += '<option style="color:#' + colors[i] + ';" value="#' + colors[i] + '" ' + colorCheck + '>#' + colors[i] + '<\/option>'; } html += '<\/select>'; html += //// '<select id="fontFamilyList" style="width:120px;height:19px;" onchange="styleExecCommand(\'\', \'fontname\', this.value); ">' + '<option class="head-option" value=""><?php echo _t('글자체'); ?> <\/option>'; var fontset = _t('fontDisplayName:fontCode:fontFamily').split('|'); for (var i = 1; i < fontset.length; ++i) { var fontinfo = fontset[i].split(':'); if (fontinfo.length != 3) continue; <?php if (isset($style[4]) && !empty($style[4])) { echo "familyCheck = (fontinfo[1] == " . $family[0] . ")?' selected ':'';"; } ?> html += '<option style="font-family: \'' + fontinfo[1] + '\';" value="\'' + fontinfo[1] + '\', \'' + fontinfo[2] + '\'"' + familyCheck + '>' + fontinfo[0] + '<\/option>'; } for (var i = 0; i < defaultfonts.length; ++i) { var entry = defaultfonts[i]; <?php if (isset($style[4]) && !empty($style[4])) { echo "familyCheck = (entry[0] == " . $family[0] . ")?' selected ':'';"; } ?> html += '<option style="font-family: \'' + entry[0] + '\';" value="\'' + entry.join("','") + '\'" ' + familyCheck + '>' + entry[0] + '<\/option>'; } html += '<\/select>'; html += //// '<select id="fontSizeList" style="width:50px;height:19px;" onchange="styleExecCommand(\'\', \'fontsize\', this.value); ">' + '<option class="head-option" value=""><?php echo _t('크기'); ?> <\/option>'; for (var i = 8; i < 16; ++i) { <?php if (isset($style[5]) && !empty($style[5])) { echo "sizeCheck = (i == " . $size . ")?' selected ':'';"; } ?> html += '<option value="' + i + '" ' + sizeCheck + '>' + i + 'pt<\/option>'; } html += '<\/select>'; document.getElementById('fontStyleElement').innerHTML = html; //]]> </script> </dd> </dl> <dl> <dd class="button-box"> <input type="submit" class="save-button input-button" value="<?php echo _t('저장하기'); ?> " onclick="setStyleSave(); return false;" /> </dd> </dl> <dl id="team-image-line" class="line"> <dt><label for="profile"><?php echo _t('프로필 사진'); ?> </label></dt> <dd> <img id="teamImage" src="<?php echo $image; ?> " width="80" height="80" border="1" alt="<?php echo _t('프로필 사진'); ?> " /><br />(Size : <?php echo $data['imageSize']; ?> x <?php echo $data['imageSize']; ?> )<br /> <form id="file_upload_form" method="post" target="uploadTarget" enctype="multipart/form-data" action="<?php echo $blogURL; ?> /plugin/teamFileUpload/"> <input type="hidden" name="type" value="" /> <input type="file" name="teamImageFile" id="teamImageFile" size="35" onchange="uploadImage(this.form, 'upload');" /> <a href="http://mypictr.com/?size=<?php echo $data['imageSize']; ?> x<?php echo $data['imageSize']; ?> " onclick="window.open(this.href); return false;"><font color="#527A98"><u>mypictr.com</u></font></a>에서 사진 편집.<br /> <div class="tip"><?php echo _t('(찾아보기를 이용하여 사진을 선택하시면 바로 <b>변경</b> 저장됩니다)'); ?> </div> <div class="tip"> <input type="checkbox" name="imageRemove" id="imageRemove" onclick="uploadImage(this.form, 'delete');" <?php echo $imageRemoveCheck; ?> /> <label for="imageRemove"><?php echo _t('프로필 사진 초기화'); ?> </label> </div> <iframe id="uploadTarget" name="uploadTarget" style="width:0;height:0;border:0px solid;"></iframe> </form> </dd> </dl> <dl id="team-profile-line" class="line"> <dt><label for="profile"><?php echo _t('프로필 내용'); ?> </label></dt> <dd> <textarea id="profile" name="profile" cols="15" rows="7"><?php echo htmlspecialchars($profile); ?> </textarea> </dd> </dl> <dl> <dd class="button-box"> <input type="submit" class="save-button input-button" value="<?php echo _t('저장하기'); ?> " onclick="setProfileSave(); return false;" /> </dd> </dl> </fieldset> </div> </div> </div> <div class="clear"></div> <?php }
function GoogleMap_Cache() { $ctx = Model_Context::getInstance(); $dbPrefix = $ctx->getProperty('database.prefix'); $blogId = $ctx->getProperty('blog.id'); $IV = array('POST' => array('original_path' => array('string', 'default' => ''), 'path' => array('string', 'default' => ''), 'lat' => array('number', 'default' => null), 'lng' => array('number', 'default' => null))); Validator::validate($IV); if (empty($_POST['path']) || empty($_POST['original_path'])) { echo 'error: empty path'; return; } $original_path_e = POD::escapeString($_POST['original_path']); $path_e = POD::escapeString($_POST['path']); $row = POD::queryRow("SELECT * FROM {$dbPrefix}GMapLocations WHERE blogid = {$blogId} AND original_address = '{$original_path_e}'"); if ($row == null || empty($row)) { if (POD::execute("INSERT INTO {$dbPrefix}GMapLocations VALUES ({$blogId}, '{$original_path_e}', '{$path_e}', {$_POST['lng']}, {$_POST['lat']}, " . time() . ")")) { echo 'ok'; } else { echo 'error: cache failed'; } } else { echo 'duplicate'; } }
private static function DBQuery($mode = 'query', $sql) { switch ($mode) { case 'cell': return POD::queryCell($sql); case 'row': return POD::queryRow($sql); case 'execute': return POD::execute($sql); case 'count': return POD::queryCount($sql); case 'all': return POD::queryAll($sql); case 'query': default: return POD::query($sql); } return null; }
?> </span></th> <th class="delete"><span class="text"><?php echo _t('삭제'); ?> </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;
function moveCategory($blogid, $id, $direction) { $ctx = Model_Context::getInstance(); if ($direction == 'up') { $sign = '<'; $arrange = 'DESC'; } else { $sign = '>'; $arrange = 'ASC'; } $myId = $id; $myPriority = ''; $myParent = ''; $parentId = ''; $parentPriority = ''; // $parentParent = ''; $myIsHaveChild = ''; $nextId = ''; // $nextParentId = ''; $nextPriority = ''; $sql = "SELECT\n\t\t\t\t_parent.id AS parentId,\n\t\t\t\t_parent.priority AS parentPriority,\n\t\t\t\t_parent.parent AS parentParent,\n\t\t\t\t_my.priority AS myPriority,\n\t\t\t\t_my.parent AS myParent\n\t\t\tFROM " . $ctx->getProperty('database.prefix') . "Categories AS _my\n\t\t\t\tLEFT JOIN " . $ctx->getProperty('database.prefix') . "Categories AS _parent ON _parent.id = _my.parent\n\t\t\tWHERE _my.id = {$id} AND _my.blogid = {$blogid}"; $row = POD::queryRow($sql); $myParent = is_null($row['myParent']) ? 'NULL' : $row['myParent']; $parentId = is_null($row['parentId']) ? 'NULL' : $row['parentId']; $parentPriority = is_null($row['parentPriority']) ? 'NULL' : $row['parentPriority']; // $parentParent = is_null($row['parentParent']) ? 'NULL' : $row['parentParent']; $myPriority = $row['myPriority']; $sql = "SELECT count(*) FROM " . $ctx->getProperty('database.prefix') . "Categories WHERE parent = {$myId} AND blogid = {$blogid}"; $myIsHaveChild = POD::queryCell($sql) > 0 ? true : false; $aux = $parentId == 'NULL' ? 'parent is null' : "parent = {$parentId}"; $sql = "SELECT id, parent, priority FROM " . $ctx->getProperty('database.prefix') . "Categories WHERE {$aux} AND blogid = {$blogid} AND id != 0 AND priority {$sign} {$myPriority} ORDER BY priority {$arrange} LIMIT 1"; // $canMove = (POD::queryCount($sql) > 0) ? true : false; $row = POD::queryRow($sql); $nextId = is_null($row['id']) ? 'NULL' : $row['id']; // $nextParentId = is_null($row['parent']) ? 'NULL' : $row['parent']; $nextPriority = is_null($row['priority']) ? 'NULL' : $row['priority']; // 이동할 자신이 1 depth 카테고리일 때. if ($myParent == 'NULL') { // 자신이 2 depth를 가지고 있고, 위치를 바꿀 대상 카테고리가 있는 경우. if ($myIsHaveChild && $nextId != 'NULL') { $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\tpriority = {$myPriority}\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tid = {$nextId} AND blogid = {$blogid}"; POD::query($sql); $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\tpriority = {$nextPriority}\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tid = {$myId} AND blogid = {$blogid}"; POD::query($sql); // 자신이 2 depth를 가지지 않은 1 depth 카테고리이거나, 위치를 바꿀 대상이 없는 경우. } else { // 위치를 바꿀 대상 카테고리에 같은 이름이 존재하는지 판별. $myName = POD::queryCell("SELECT name FROM " . $ctx->getProperty('database.prefix') . "Categories WHERE id = {$myId} AND blogid = {$blogid}"); $overlapCount = POD::queryCell("SELECT count(*) FROM " . $ctx->getProperty('database.prefix') . "Categories WHERE name = '{$myName}' AND parent = {$nextId} AND blogid = {$blogid}"); // 같은 이름이 없으면 이동 시작. if ($overlapCount == 0) { $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories\n\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\tparent = {$nextId}\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tid = {$myId} AND blogid = {$blogid}"; POD::query($sql); $sql = "SELECT id, priority FROM " . $ctx->getProperty('database.prefix') . "Categories WHERE parent = {$nextId} AND blogid = {$blogid} ORDER BY priority DESC"; $row = POD::queryRow($sql); $nextId = is_null($row['id']) ? 'NULL' : $row['id']; $nextPriority = is_null($row['priority']) ? 'NULL' : $row['priority']; if ($nextId != 'NULL') { $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories\n\t\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\t\tpriority = " . max($nextPriority, $myPriority) . "\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tid = {$nextId} AND blogid = {$blogid}"; POD::query($sql); $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories\n\t\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\t\tpriority = " . min($nextPriority, $myPriority) . "\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tid = {$myId} AND blogid = {$blogid}"; POD::query($sql); } // 같은 이름이 있으면. } else { $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories\n\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\tpriority = {$myPriority}\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tid = {$nextId} AND blogid = {$blogid}"; POD::query($sql); $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories\n\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\tpriority = {$nextPriority}\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tid = {$myId} AND blogid = {$blogid}"; POD::query($sql); } } // 이동할 자신이 2 depth일 때. } else { // 위치를 바꿀 대상이 1 depth이면. if ($nextId == 'NULL') { $myName = POD::escapeString(POD::queryCell("SELECT name FROM " . $ctx->getProperty('database.prefix') . "Categories WHERE id = {$myId} and blogid = {$blogid}")); $overlapCount = POD::queryCell("SELECT count(*) FROM " . $ctx->getProperty('database.prefix') . "Categories WHERE name = '{$myName}' AND parent IS NULL AND blogid = {$blogid}"); // 1 depth에 같은 이름이 있으면 2 depth로 직접 이동. if ($overlapCount > 0) { $sql = "SELECT id, parent, priority FROM " . $ctx->getProperty('database.prefix') . "Categories WHERE parent IS NULL AND blogid = {$blogid} AND priority {$sign} {$parentPriority} ORDER BY priority {$arrange}"; $result = POD::queryAll($sql); foreach ($result as $row) { $nextId = $row['id']; // $nextParentId = $row['parent']; $nextPriority = $row['priority']; // 위치를 바꿀 대상 카테고리에 같은 이름이 존재하는지 판별. $myName = POD::escapeString(POD::queryCell("SELECT name FROM " . $ctx->getProperty('database.prefix') . "Categories WHERE id = {$myId} AND blogid = {$blogid}")); $overlapCount = POD::queryCell("SELECT count(*) FROM " . $ctx->getProperty('database.prefix') . "Categories WHERE name = '{$myName}' AND parent = {$nextId} AND blogid = {$blogid}"); // 같은 이름이 없으면 이동 시작. if ($overlapCount == 0) { $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories\n\t\t\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\t\t\tparent = {$nextId}\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\tid = {$myId} AND blogid = {$blogid}"; POD::query($sql); break; } } // 같은 이름이 없으면 1 depth로 이동. } else { $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories SET parent = NULL WHERE id = {$myId} AND blogid = {$blogid}"; POD::query($sql); $sql = "SELECT id, priority FROM " . $ctx->getProperty('database.prefix') . "Categories WHERE parent is null AND blogid = {$blogid} AND priority {$sign} {$parentPriority} ORDER BY priority {$arrange}"; $row = POD::queryRow($sql); $nextId = is_null($row['id']) ? 'NULL' : $row['id']; $nextPriority = is_null($row['priority']) ? 'NULL' : $row['priority']; if ($nextId == 'NULL') { $operator = $direction == 'up' ? '-' : '+'; $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories SET priority = {$parentPriority} {$operator} 1 WHERE id = {$myId} AND blogid = {$blogid}"; POD::query($sql); } else { if ($direction == 'up') { $aux = "SET priority = priority+1 WHERE priority >= {$parentPriority} AND blogid = {$blogid}"; $aux2 = "SET priority = {$parentPriority} WHERE id = {$myId} AND blogid = {$blogid}"; } else { $aux = "SET priority = priority+1 WHERE priority >= {$nextPriority} AND blogid = {$blogid}"; $aux2 = "SET priority = {$nextPriority} WHERE id = {$myId} AND blogid = {$blogid}"; } $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories {$aux}"; POD::query($sql); $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories {$aux2}"; POD::query($sql); } } // 위치를 바꿀 대상이 2 depth이면 위치 교환. } else { $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\tpriority = {$myPriority}\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tid = {$nextId} AND blogid = {$blogid}"; POD::query($sql); $sql = "UPDATE " . $ctx->getProperty('database.prefix') . "Categories\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\tpriority = {$nextPriority}\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tid = {$myId} AND blogid = {$blogid}"; POD::query($sql); } } updateEntriesOfCategory($blogid); CacheControl::flushCategory($id); }