Esempio n. 1
0
function DEFENSIO()
{
    global $blogid, $pluginMenuURL, $pluginURL, $pluginSelfParam, $blog, $user, $blogURL, $defaultURL, $hostURL, $service, $skinSetting, $configVal;
    requireComponent('Textcube.Function.misc');
    $comment_TYPE = !empty($_GET['t']) ? $_GET['t'] : '';
    $page = !empty($_GET['page']) ? $_GET['page'] : 1;
    $perPage = getBlogSetting('rowsPerPage', 10);
    if ($comment_TYPE != "T") {
        $comment_TYPE = "C";
    }
    $data = misc::fetchConfigVal($configVal);
    $blogHome = preg_replace("'^http://'", "", $hostURL);
    print '<div><h2 class="caption"><span class="main-text">Defensio Anti Spam Filter</span></h2></div>';
    if (!isset($data['apikey']) || $data['apikey'] == '') {
        print <<<ENDL
\t\t<div>
\t\t\t<p><a href="http://www.defensio.com">Defensio</a>'s blog spam web service aggressively and intelligently prevents comment and trackback spam from hitting your blog. You should quickly notice a dramatic reduction in the amount of spam you have to worry about.</p><br />
\t\t\t<p>When the filter does rarely make a mistake (say, the odd spam message gets through or a rare good comment is marked as spam) we've made it a joy to sort through your comments and set things straight. Not only will the filter learn and improve over time, but it will do so in a personalized way!</p><br />
\t\t\t<p>In order to use our service, you will need a free Defensio API key. Get yours now at <a href="http://www.defensio.com/signup">Defensio.com</a>.</p>
\t\t</div>
ENDL;
        return;
    }
    print "<div>";
    // TODO: Cache?
    // get stats
    $stats = defensio_get_stats();
    if ($stats !== false) {
        $accuracy = number_format($stats['accuracy'] * 100, 2, '.', '');
        $spam = $stats['spam'];
        $ham = $stats['ham'];
        $fn = $stats['false-negatives'];
        $fp = $stats['false-positives'];
        $apikey = $data['apikey'];
        print <<<ENDL
\t\t<div class="defensio_stats" style="margin:10px;padding:5px;">
\t\t<div style="float:right;"><a href="http://defensio.com/manage/stats/{$apikey}">Detail Stats</a></div>
\t\t<ul>
\t\t\t<li><strong>Recent accuracy: {$accuracy}%</strong><hr></li>
\t\t\t<li><strong>{$spam}</strong> spams, <strong>{$ham}</strong> legitimate comments</li>
\t\t\t<li><strong>{$fn}</strong> false negatives (undetected spam)</li>
\t\t\t<li><strong>{$fp}</strong> false positives (legitimate comments identified as spam)</li>
\t\t</ul>
\t\t</div>
ENDL;
    }
    // get quarntines list
    list($comments, $paging) = defensio_get_data($comment_TYPE, $page, $perPage);
    include 'template/' . ($comment_TYPE == 'C' ? 'comment' : 'trackback') . '.php';
    print "</div>";
}
Esempio n. 2
0
function getEntriesWithPagingByTag($blogid, $tag, $page, $count, $countItem = null)
{
    global $database, $folderURL, $suri;
    if ($tag === null) {
        return Paging::fetch(null, $page, $count, "{$folderURL}/{$suri['value']}");
    }
    $tag = POD::escapeString($tag);
    $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0' . getPrivateCategoryExclusionQuery($blogid);
    $visibility .= doesHaveOwnership() && !Acl::check('group.editors') ? ' AND (e.userid = ' . getUserId() . ' OR e.visibility > 0)' : '';
    $sql = "SELECT e.*, c.label AS categoryLabel \n\t\tFROM {$database['prefix']}Entries e\n\t\tLEFT JOIN {$database['prefix']}Categories c ON e.blogid = c.blogid AND e.category = c.id \n\t\tLEFT JOIN {$database['prefix']}TagRelations t ON e.id = t.entry AND e.blogid = t.blogid \n\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 {$visibility} AND e.category >= 0 AND t.tag = '{$tag}' \n\t\tORDER BY e.published DESC";
    return Paging::fetch($sql, $page, $count, "{$folderURL}/" . (!getBlogSetting('useSloganOnTag', true) && isset($suri['id']) ? $suri['id'] : $suri['value']), "?page=", $countItem);
}
Esempio n. 3
0
<?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';
requireStrictRoute();
if (false) {
    fetchConfigVal();
    getBlogSetting();
    setBlogSetting();
}
if (isset($_REQUEST['name']) && isset($adminHandlerMappings[$_REQUEST['name']])) {
    $IV = array('REQUEST' => array('name' => array('string')));
    foreach ($adminHandlerMappings[$_GET['name']]['params'] as $param) {
        $ivItem = array($param['type']);
        if (isset($param['default']) && !is_null($param['default'])) {
            $ivItem['default'] = $param['default'];
        }
        if (isset($param['mandatory']) && !is_null($param['mandatory'])) {
            $ivItem['mandatory'] = $param['mandatory'];
        }
        $IV['REQUEST'][$param['name']] = $ivItem;
    }
    if (Validator::validate($IV)) {
        $plugin = $adminHandlerMappings[$_REQUEST['name']]['plugin'];
        $handler = $adminHandlerMappings[$_REQUEST['name']]['handler'];
        $pluginAccessURL = $context->getProperty('uri.blog') . '/owner/plugin/adminMenu?name=' . $plugin;
        $pluginMenuURL = 'invalid link';
        $pluginHandlerURL = $context->getProperty('uri.blog') . '/owner/plugin/adminHandler?name=' . $plugin;
        $pluginSelfURL = $context->getProperty('uri.blog') . '/owner/plugin/adminHandler?name=' . $plugin . '/' . $handler;