/** * @covers SebastianBergmann\CodeCoverage\Filter::isFiltered * @covers SebastianBergmann\CodeCoverage\Filter::isFile */ public function testNonFilesAreFiltered() { $this->assertTrue($this->filter->isFiltered('vfs://root/a/path')); $this->assertTrue($this->filter->isFiltered('xdebug://debug-eval')); $this->assertTrue($this->filter->isFiltered('eval()\'d code')); $this->assertTrue($this->filter->isFiltered('runtime-created function')); $this->assertTrue($this->filter->isFiltered('assert code')); $this->assertTrue($this->filter->isFiltered('regexp code')); }
echo _t('삭제'); ?> </span></th> </tr> </thead> <?php if (sizeof($trackbacks) > 0) { echo "\t\t\t\t\t\t\t\t\t<tbody>"; } $siteNumber = array(); for ($i = 0; $i < sizeof($trackbacks); $i++) { $trackback = $trackbacks[$i]; $isFilterURL = Filter::isFiltered('url', $trackback['url']); $filteredURL = getURLForFilter($trackback['url']); $filter = new Filter(); if (Filter::isFiltered('ip', $trackback['ip'])) { $isIpFiltered = true; } else { $isIpFiltered = false; } if (!isset($siteNumber[$trackback['site']])) { $siteNumber[$trackback['site']] = $i; $currentSite = $i; } else { $currentSite = $siteNumber[$trackback['site']]; } $className = $i % 2 == 1 ? 'even-line' : 'odd-line'; $className .= $i == sizeof($trackbacks) - 1 ? ' last-line' : ''; ?> <tr class="<?php echo $className;
function receiveTrackback($blogid, $entry, $title, $url, $excerpt, $site) { global $database, $blog, $defaultURL; if (empty($url)) { return 5; } $post = new Post(); if (!$post->doesAcceptTrackback($entry)) { return 3; } $filtered = 0; if (!Filter::isAllowed($url)) { if (Filter::isFiltered('ip', $_SERVER['REMOTE_ADDR']) || Filter::isFiltered('url', $url)) { $filtered = 1; } else { if (Filter::isFiltered('content', $excerpt)) { $filtered = 1; } else { if (!fireEvent('AddingTrackback', true, array('entry' => $entry, 'url' => $url, 'site' => $site, 'title' => $title, 'excerpt' => $excerpt))) { $filtered = 1; } } } } $title = correctTTForXmlText($title); $excerpt = correctTTForXmlText($excerpt); $url = UTF8::lessenAsEncoding($url); $site = UTF8::lessenAsEncoding($site); $title = UTF8::lessenAsEncoding($title); $excerpt = UTF8::lessenAsEncoding($excerpt); $trackback = new Trackback(); $trackback->entry = $entry; $trackback->url = $url; $trackback->site = $site; $trackback->title = $title; $trackback->excerpt = $excerpt; if ($filtered > 0) { $trackback->isfiltered = true; } if ($trackback->add()) { if ($filtered == 0) { CacheControl::flushDBCache('trackback'); } return $filtered == 0 ? 0 : 3; } else { return 4; } return 0; }
<?php $more = false; $mergedComments = array(); $lastVisitNotifiedPage = Setting::getBlogSettingGlobal('lastVisitNotifiedPage', null); setBlogSetting('lastVisitNotifiedPage', time()); for ($i = 0; $i < count($comments); $i++) { array_push($mergedComments, $comments[$i]); $result = getCommentCommentsNotified($comments[$i]['id']); for ($j = 0; $j < count($result); $j++) { array_push($mergedComments, $result[$j]); } } $nameNumber = array(); for ($i = 0; $i < sizeof($mergedComments); $i++) { $comment = $mergedComments[$i]; if (Filter::isFiltered('name', $comment['name'])) { $isNameFiltered = true; } else { $isNameFiltered = false; } if (!isset($nameNumber[$comment['name']])) { $nameNumber[$comment['name']] = $i; $currentNumber = $i; } else { $currentNumber = $nameNumber[$comment['name']]; } $className = $i % 2 == 1 ? 'even-line' : 'odd-line'; $className .= $comment['parent'] ? ' reply-line' : null; $className .= $i == sizeof($mergedComments) - 1 ? ' last-line' : ''; ?> <tr class="<?php
static function updateVisitorStatistics($blogid) { global $database, $blogURL; if (!fireEvent('UpdatingVisitorStatistics', true)) { return; } if (doesHaveOwnership()) { return; } $id = session_id(); if (POD::queryCount("SELECT blogid FROM {$database['prefix']}SessionVisits WHERE id = '{$id}' AND address = '{$_SERVER['REMOTE_ADDR']}' AND blogid = {$blogid}") > 0) { return; } if (POD::queryCount("INSERT INTO {$database['prefix']}SessionVisits values('{$id}', '{$_SERVER['REMOTE_ADDR']}', {$blogid})") > 0) { if (POD::queryCount("UPDATE {$database['prefix']}BlogStatistics SET visits = visits + 1 WHERE blogid = {$blogid}") < 1) { POD::execute("INSERT into {$database['prefix']}BlogStatistics values({$blogid}, 1)"); } $period = Timestamp::getDate(); if (POD::queryCount("UPDATE {$database['prefix']}DailyStatistics SET visits = visits + 1 WHERE blogid = {$blogid} AND datemark = {$period}") < 1) { POD::execute("INSERT INTO {$database['prefix']}DailyStatistics VALUES ({$blogid}, {$period}, 1)"); } if (!empty($_SERVER['HTTP_REFERER'])) { $referer = parse_url($_SERVER['HTTP_REFERER']); if (!empty($referer['host']) && ($referer['host'] != $_SERVER['HTTP_HOST'] || strncmp($referer['path'], $blogURL, strlen($blogURL)) != 0)) { if (Filter::isFiltered('ip', $_SERVER['REMOTE_ADDR']) || Filter::isFiltered('url', $_SERVER['HTTP_REFERER'])) { return; } if (!fireEvent('AddingRefererLog', true, array('host' => $referer['host'], 'url' => $_SERVER['HTTP_REFERER']))) { return; } $host = POD::escapeString(Utils_Unicode::lessenAsEncoding($referer['host'], 64)); $url = POD::escapeString(Utils_Unicode::lessenAsEncoding($_SERVER['HTTP_REFERER'], 255)); POD::query("INSERT INTO {$database['prefix']}RefererLogs values({$blogid}, '{$host}', '{$url}', UNIX_TIMESTAMP())"); // POD::query("DELETE FROM {$database['prefix']}RefererLogs WHERE referred < UNIX_TIMESTAMP() - 604800"); // Moved to trashVan if (!POD::queryCount("UPDATE {$database['prefix']}RefererStatistics SET count = count + 1 WHERE blogid = {$blogid} AND host = '{$host}' LIMIT 1")) { POD::execute("INSERT into {$database['prefix']}RefererStatistics values({$blogid}, '{$host}', 1)"); } } } } }
function updateComment($blogid, $comment, $password) { global $database, $user; $openid = Acl::getIdentity('openid'); if (!doesHaveOwnership()) { // if filtered, only block and not send to trash if (!Filter::isAllowed($comment['homepage'])) { if (Filter::isFiltered('ip', $comment['ip'])) { return 'blocked'; } if (Filter::isFiltered('name', $comment['name'])) { return 'blocked'; } if (Filter::isFiltered('url', $comment['homepage'])) { return 'blocked'; } if (Filter::isFiltered('content', $comment['comment'])) { return 'blocked'; } if (!fireEvent('ModifyingComment', true, $comment)) { return 'blocked'; } } } $comment['homepage'] = stripHTML($comment['homepage']); $comment['name'] = UTF8::lessenAsEncoding($comment['name'], 80); $comment['homepage'] = UTF8::lessenAsEncoding($comment['homepage'], 80); $comment['comment'] = UTF8::lessenAsEncoding($comment['comment'], 65535); $setPassword = ''; if ($user !== null) { $comment['replier'] = getUserId(); $name = POD::escapeString($user['name']); $setPassword = '******'\','; $homepage = POD::escapeString($user['homepage']); if (empty($homepage) && $openid) { $homepage = POD::escapeString($openid); } } else { $name = POD::escapeString($comment['name']); if ($comment['password'] !== true) { $setPassword = '******'' . (empty($comment['password']) ? '' : md5($comment['password'])) . '\', '; } $homepage = POD::escapeString($comment['homepage']); } $comment0 = POD::escapeString($comment['comment']); $guestcomment = false; if (POD::queryExistence("SELECT *\n\t\tFROM {$database['prefix']}Comments\n\t\tWHERE blogid = {$blogid}\n\t\t\tAND id = {$comment['id']}\n\t\t\tAND replier IS NULL")) { $guestcomment = true; } $wherePassword = ''; if (!doesHaveOwnership()) { if ($guestcomment == false) { if (!doesHaveMembership()) { return false; } $wherePassword = '******' . getUserId(); } else { if (empty($password) && $openid) { $wherePassword = '******'' . $openid . '\''; } else { $wherePassword = '******'' . md5($password) . '\''; } } } $replier = is_null($comment['replier']) ? 'NULL' : "'{$comment['replier']}'"; $result = POD::query("UPDATE {$database['prefix']}Comments\n\t\t\t\tSET\n\t\t\t\t\tname = '{$name}',\n\t\t\t\t\t{$setPassword}\n\t\t\t\t\thomepage = '{$homepage}',\n\t\t\t\t\tsecret = {$comment['secret']},\n\t\t\t\t\tcomment = '{$comment0}',\n\t\t\t\t\tip = '{$comment['ip']}',\n\t\t\t\t\twritten = UNIX_TIMESTAMP(),\n\t\t\t\t\tisfiltered = {$comment['isfiltered']},\n\t\t\t\t\treplier = {$replier}\n\t\t\t\tWHERE blogid = {$blogid}\n\t\t\t\t\tAND id = {$comment['id']} {$wherePassword}"); if ($result) { CacheControl::flushCommentRSS($comment['entry']); // Assume blogid = current blogid. CacheControl::flushDBCache('comment'); return true; } else { return false; } }
function updateComment($blogid, $comment, $password) { $openid = Acl::getIdentity('openid'); if (!doesHaveOwnership()) { // if filtered, only block and not send to trash if (!Filter::isAllowed($comment['homepage'])) { if (Filter::isFiltered('ip', $comment['ip'])) { return 'blocked'; } if (Filter::isFiltered('name', $comment['name'])) { return 'blocked'; } if (Filter::isFiltered('url', $comment['homepage'])) { return 'blocked'; } if (Filter::isFiltered('content', $comment['comment'])) { return 'blocked'; } if (!fireEvent('ModifyingComment', true, $comment)) { return 'blocked'; } } } $pool = DBModel::getInstance(); $comment['homepage'] = stripHTML($comment['homepage']); $comment['name'] = Utils_Unicode::lessenAsEncoding($comment['name'], 80); $comment['homepage'] = Utils_Unicode::lessenAsEncoding($comment['homepage'], 80); $comment['comment'] = Utils_Unicode::lessenAsEncoding($comment['comment'], 65535); $guestcomment = false; $pool->reset('Comments'); $pool->setQualifier('blogid', 'eq', $blogid); $pool->setQualifier('id', 'eq', $comment['id']); $pool->setQualifier('replier', 'eq', NULL); if ($pool->doesExist()) { $guestcomment = true; } $pool->reset('Comments'); $setPassword = ''; $userid = getUserId(); if (!empty($userid)) { $comment['replier'] = $userid; $name = User::getName($userid); $homepage = User::getHomepage($userid); $pool->setAttribute('password', '', true); if (empty($homepage) && $openid) { $homepage = $openid; } } else { $name = $comment['name']; if ($comment['password'] !== true) { $pool->setAttribute('password', empty($comment['password']) ? '' : md5($comment['password']), true); } $homepage = $comment['homepage']; } $comment0 = $comment['comment']; $wherePassword = ''; if (!doesHaveOwnership()) { if ($guestcomment == false) { if (!doesHaveMembership()) { return false; } $pool->setQualifier('replier', 'eq', $userid); } else { if (empty($password) && $openid) { $pool->setQualifier('openid', 'eq', $openid, true); } else { $pool->setQualifier('password', 'eq', md5($password), true); } } } $replier = is_null($comment['replier']) ? NULL : $comment['replier']; $pool->setAttribute('name', $name, true); $pool->setAttribute('homepage', $homepage, true); $pool->setAttribute('secret', $comment['secret']); $pool->setAttribute('comment', $comment0, true); $pool->setAttribute('ip', $comment['ip'], true); $pool->setAttribute('written', Timestamp::getUNIXtime()); $pool->setAttribute('isfiltered', $comment['isfiltered']); $pool->setAttribute('replier', $replier); $pool->setQualifier('blogid', 'eq', $blogid); $pool->setQualifier('id', 'eq', $comment['id']); $result = $pool->update(); if ($result) { CacheControl::flushCommentRSS($comment['entry']); // Assume blogid = current blogid. CacheControl::flushDBCache('comment'); return true; } else { return false; } }
if (sizeof($comments) > 0) { echo "\t\t\t\t\t\t\t\t\t<tbody>"; } $nameNumber = array(); $ipNumber = array(); for ($i = 0; $i < sizeof($comments); $i++) { $comment = $comments[$i]; $i % 2 == 1 ? $className = 'even-line' : ($className = 'odd-line'); $comment['parent'] ? $className .= ' reply-line' : null; $filter = new Filter(); if (Filter::isFiltered('name', $comment['name'])) { $isNameFiltered = true; } else { $isNameFiltered = false; } if (Filter::isFiltered('ip', $comment['ip'])) { $isIpFiltered = true; } else { $isIpFiltered = false; } if (!isset($nameNumber[$comment['name']])) { $nameNumber[$comment['name']] = $i; $currentNumber = $i; } else { $currentNumber = $nameNumber[$comment['name']]; } if (!isset($ipNumber[$comment['ip']])) { $ipNumber[$comment['ip']] = $i; $currentIP = $i; } else { $currentIP = $ipNumber[$comment['ip']];
?> <tr class="empty-list"> <td colspan="8"><?php echo _t('걸린글이 없습니다'); ?> </td> </tr> <?php } else { $siteNumber = array(); for ($i = 0; $i < sizeof($trackbacks); $i++) { $trackback = $trackbacks[$i]; $isFilterURL = Filter::isFiltered('url', $trackback['url']); $filteredURL = getURLForFilter($trackback['url']); $filter = new Filter(); if (isset($trackback['ip']) && Filter::isFiltered('ip', $trackback['ip'])) { $isIpFiltered = true; } else { $isIpFiltered = false; } if (isset($trackback['site'])) { if (!isset($siteNumber[$trackback['site']])) { $siteNumber[$trackback['site']] = $i; $currentSite = $i; } else { $currentSite = $siteNumber[$trackback['site']]; } } else { $currentSite = $i; } $className = $i % 2 == 1 ? 'even-line' : 'odd-line';
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; }
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; }