static function updateVisitorStatistics($blogid) { global $database, $blogURL; if (!fireEvent('UpdatingVisitorStatistics', true)) { return; } if (doesHaveOwnership()) { return; } $id = session_id(); if (POD::queryCount("SELECT blogid FROM {$database['prefix']}SessionVisits WHERE id = '{$id}' AND address = '{$_SERVER['REMOTE_ADDR']}' AND blogid = {$blogid}") > 0) { return; } if (POD::queryCount("INSERT INTO {$database['prefix']}SessionVisits values('{$id}', '{$_SERVER['REMOTE_ADDR']}', {$blogid})") > 0) { if (POD::queryCount("UPDATE {$database['prefix']}BlogStatistics SET visits = visits + 1 WHERE blogid = {$blogid}") < 1) { POD::execute("INSERT into {$database['prefix']}BlogStatistics values({$blogid}, 1)"); } $period = Timestamp::getDate(); if (POD::queryCount("UPDATE {$database['prefix']}DailyStatistics SET visits = visits + 1 WHERE blogid = {$blogid} AND datemark = {$period}") < 1) { POD::execute("INSERT INTO {$database['prefix']}DailyStatistics VALUES ({$blogid}, {$period}, 1)"); } if (!empty($_SERVER['HTTP_REFERER'])) { $referer = parse_url($_SERVER['HTTP_REFERER']); if (!empty($referer['host']) && ($referer['host'] != $_SERVER['HTTP_HOST'] || strncmp($referer['path'], $blogURL, strlen($blogURL)) != 0)) { if (Filter::isFiltered('ip', $_SERVER['REMOTE_ADDR']) || Filter::isFiltered('url', $_SERVER['HTTP_REFERER'])) { return; } if (!fireEvent('AddingRefererLog', true, array('host' => $referer['host'], 'url' => $_SERVER['HTTP_REFERER']))) { return; } $host = POD::escapeString(Utils_Unicode::lessenAsEncoding($referer['host'], 64)); $url = POD::escapeString(Utils_Unicode::lessenAsEncoding($_SERVER['HTTP_REFERER'], 255)); POD::query("INSERT INTO {$database['prefix']}RefererLogs values({$blogid}, '{$host}', '{$url}', UNIX_TIMESTAMP())"); // POD::query("DELETE FROM {$database['prefix']}RefererLogs WHERE referred < UNIX_TIMESTAMP() - 604800"); // Moved to trashVan if (!POD::queryCount("UPDATE {$database['prefix']}RefererStatistics SET count = count + 1 WHERE blogid = {$blogid} AND host = '{$host}' LIMIT 1")) { POD::execute("INSERT into {$database['prefix']}RefererStatistics values({$blogid}, '{$host}', 1)"); } } } } }
<?php /// Copyright (c) 2004-2012, Needlworks / Tatter Network Foundation /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) require ROOT . '/library/preprocessor.php'; if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/backup/{$blogid}.xml")) { header('Content-Disposition: attachment; filename="Textcube-Backup-' . Timestamp::getDate(filemtime(__TEXTCUBE_CACHE_DIR__ . "/backup/{$blogid}.xml")) . '.xml"'); header('Content-Description: Textcube Backup Data'); header('Content-Transfer-Encoding: binary'); header('Content-Type: application/xml'); readfile(__TEXTCUBE_CACHE_DIR__ . "/backup/{$blogid}.xml"); } else { Respond::NotFoundPage(); }
function updateSubscriptionStatistics($target, $mother) { global $database, $blogURL; $blogid = getBlogId(); $period = Timestamp::getDate(); requireComponent('Textcube.Data.Filter'); if (Filter::isFiltered('ip', $_SERVER['REMOTE_ADDR'])) { return; } $ip = POD::escapeString($_SERVER['REMOTE_ADDR']); $host = POD::escapeString(isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : ''); $useragent = POD::escapeString(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''); POD::query("INSERT INTO {$database['prefix']}SubscriptionLogs values({$blogid}, '{$ip}', '{$host}', '{$useragent}', UNIX_TIMESTAMP())"); POD::query("DELETE FROM {$database['prefix']}SubscriptionLogs WHERE referred < UNIX_TIMESTAMP() - 604800"); if (!POD::queryCount("UPDATE {$database['prefix']}SubscriptionStatistics SET referred = UNIX_TIMESTAMP() WHERE blogid = {$blogid} AND ip = '{$ip}' AND host = '{$host}' AND useragent = '{$useragent}'")) { POD::query("INSERT INTO {$database['prefix']}SubscriptionStatistics VALUES ({$blogid}, '{$ip}', '{$host}', '{$useragent}', UNIX_TIMESTAMP(),UNIX_TIMESTAMP())"); } return $target; }
$writer = new OutputWriter(); if (defined('__TEXTCUBE_BACKUP__')) { if (!file_exists(__TEXTCUBE_CACHE_DIR__ . '/backup')) { mkdir(__TEXTCUBE_CACHE_DIR__ . '/backup'); @chmod(__TEXTCUBE_CACHE_DIR__ . '/backup', 0777); } if (!is_dir(__TEXTCUBE_CACHE_DIR__ . '/backup')) { exit; } if ($writer->openFile(__TEXTCUBE_CACHE_DIR__ . "/backup/{$blogid}.xml")) { } else { exit; } } else { if ($writer->openStdout()) { header('Content-Disposition: attachment; filename="Textcube-Backup-' . getBlogName($blogid) . "-" . Timestamp::getDate() . '.xml"'); header('Content-Description: Textcube Backup Data'); header('Content-Transfer-Encoding: binary'); header('Content-Type: application/xml'); } else { exit; } } $newlineStyle = !is_null(Setting::getServiceSettingGlobal('newlineStyle')) ? ' format="' . Setting::getServiceSettingGlobal('newlineStyle') . '"' : ''; $writer->write('<?xml version="1.0" encoding="utf-8" ?>'); $writer->write('<blog type="tattertools/1.1" extension="textcube/2.0" migrational="false">'); $setting = new BlogSetting(); if ($setting->load()) { $setting->escape(); $writer->write('<setting>' . '<name>' . $setting->name . '</name>' . '<secondaryDomain>' . $setting->secondaryDomain . '</secondaryDomain>' . '<defaultDomain>' . Validator::getBit($setting->defaultDomain) . '</defaultDomain>' . '<title>' . $setting->title . '</title>' . '<description>' . Utils_Unicode::correct($setting->description) . '</description>' . '<banner><name>' . $setting->banner . '</name>'); if ($includeFileContents && file_exists(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/{$setting->banner}")) {
dress('article_rep_tb_atomurl', $context->getProperty('uri.default') . '/atom/trackback/' . $entry['id'], $entryView); dress('article_rep_response_atomurl', $context->getProperty('uri.default') . '/atom/response/' . $entry['id'], $entryView); dress('article_rep_category_body_id', getCategoryBodyIdById($blogid, $entry['category']) ? getCategoryBodyIdById($blogid, $entry['category']) : 'tt-body-category', $entryView); dress('article_rep_title', htmlspecialchars(fireEvent('ViewPostTitle', $entry['title'], $entry['id'])), $entryView); // 사용자가 작성한 본문은 interface/common/blog/end.php의 removeAllTags() 다음에 처리하기 위한 조치. $contentContainer["article_{$entry['id']}"] = getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'], getKeywordNames($blogid)); dress('article_rep_desc', setTempTag("article_{$entry['id']}"), $entryView); dress('article_rep_category', htmlspecialchars(empty($entry['category']) ? _text('분류없음') : $entry['categoryLabel'], $entry['id']), $entryView); dress('article_rep_category_link', $context->getProperty('uri.blog') . "/category/" . (empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'], $service['useEncodedURL']) : $entry['category'])), $entryView); dress('article_rep_category_rssurl', $context->getProperty('uri.default') . "/rss/category/" . (empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'], $service['useEncodedURL']) : $entry['category'])), $entryView); dress('article_rep_category_atomurl', $context->getProperty('uri.default') . "/atom/category/" . (empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'], $service['useEncodedURL']) : $entry['category'])), $entryView); dress('article_rep_microformat_published', Timestamp::getISO8601($entry['published']), $entryView); dress('article_rep_microformat_updated', Timestamp::getISO8601($entry['modified']), $entryView); dress('article_rep_date', fireEvent('ViewPostDate', Timestamp::format5($entry['published']), $entry['published']), $entryView); dress('article_rep_date_modified', fireEvent('ViewPostDate', Timestamp::format5($entry['modified']), $entry['modified']), $entryView); dress('entry_archive_link', $context->getProperty('uri.blog') . "/archive/" . Timestamp::getDate($entry['published']), $entryView); if ($entry['acceptcomment'] || $entry['comments'] > 0) { dress('article_rep_rp_link', "loadComment({$entry['id']},1,false,false); return false", $entryView); } else { dress('article_rep_rp_link', "return false", $entryView); } dress('article_rep_rp_cnt_id', "commentCount{$entry['id']}", $entryView); list($tempTag, $commentView) = getCommentCountPart($entry['comments'], $skin); dress($tempTag, $commentView, $entryView); if ($entry['accepttrackback'] || $entry['trackbacks'] > 0) { dress('article_rep_tb_link', "toggleLayer('entry{$entry['id']}Trackback'); return false", $entryView); } else { dress('article_rep_tb_link', "return false", $entryView); } dress('article_rep_tb_cnt_id', "trackbackCount{$entry['id']}", $entryView); list($tempTag, $trackbackView) = getTrackbackCountPart($entry['trackbacks'], $skin);
function updateSubscriptionStatistics($target, $mother) { $blogid = getBlogId(); $period = Timestamp::getDate(); if (Filter::isFiltered('ip', $_SERVER['REMOTE_ADDR'])) { return; } $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $host = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : ''; $useragent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $pool = DBModel::getInstance(); $pool->reset("SubscriptionLogs"); $pool->setAttribute("blogid", $blogid); $pool->setAttribute("ip", $ip, true); $pool->setAttribute("host", $host, true); $pool->setAttribute("useragent", $useragent, true); $pool->setAttribute("referred", Timestamp::getUNIXtime()); $pool->insert(); $pool->reset("SubscriptionLogs"); $pool->setQualifier("referred", "<", Timestamp::getUNIXtime() - 604800); $pool->delete(); $pool->reset("SubscriptionStatistics"); $pool->setAttribute("referred", Timestamp::getUNIXtime()); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("ip", "eq", $ip, true); $pool->setQualifier("host", "eq", $host, true); $pool->setQualifieri("useragent", "eq", $useragent, true); if (!$pool->update('count')) { $pool->reset("SubscriptionStatistics"); $pool->setAttribute("blogid", $blogid); $pool->setAttribute("ip", $ip, true); $pool->setAttribute("host", $host, true); $pool->setAttribute("useragent", $useragent, true); $pool->setAttribute("subscribed", Timestamp::getUNIXtime()); $pool->setAttribute("referred", Timestamp::getUNIXtime()); } return $target; }
/** * @static * returns a Timestamp object with the blog time difference already * applied, if needed * * @param blog either a blog id or a BlogInfo object * @param timestamp * @return A Timestamp object with time difference applied, if needed * @see BlogInfo */ function getBlogDate($blog, $timestamp = null) { // check whether time differences are dynamically or statically // applied, because in case of the former, we don't have to do // anything here! $config =& Config::getConfig(); if ($config->getValue("time_difference_calculation") == TIME_DIFFERENCE_CALCULATION_DYNAMIC) { return new Timestamp($timestamp); } // // how's this for function overloading?? // I know it's quite hackish, but it's a bit of a pain that // we need to define two different functions depending on whether // we're getting an object or an integer! // if (is_object($blog)) { $blogSettings = $blog->getSettings(); $timeDifference = $blogSettings->getValue("time_offset"); } else { include_once PLOG_CLASS_PATH . "class/dao/blogs.class.php"; $blogs = new Blogs(); $blogInfo = $blogs->getBlogInfoById($blog); if (!$blogInfo) { $timeDifference = 0; } else { $blogSettings = $blogInfo->getSettings(); $timeDifference = $blogSettings->getValue("time_offset"); } } // generate the date with the correct time difference applied $t = new Timestamp(); $t->setDate(Timestamp::getDateWithOffset($t->getDate(), $timeDifference), DATE_FORMAT_TIMESTAMP); return $t; }