Пример #1
0
function Check4Filtered($headline, $body, $returnbool = false)
{
    global $ANTIRANDOM, $User;
    $hl_df = defuck_comment($headline);
    $b_df = defuck_comment($body);
    $res = DB::Execute("SELECT filText,filReason,filPunishType,filPunishDuration,filReplacement FROM {P}Filters");
    $dbg = '';
    while (list($fText, $fReason, $fPunishment, $fPunishTime, $fReplacement) = $res->FetchRow()) {
        // Fastest string search method.
        $idx = strpos($hl_df . ' ' . $b_df, $fText);
        if ($idx === false) {
            continue;
        }
        if ($returnbool === true) {
            return true;
        }
        switch ($fPunishment) {
            case 0:
                // Just replace
                $headline = str_ireplace($fText, $fReplacement, $headline);
                $body = str_ireplace($fText, $fReplacement, $body);
                break;
            case 1:
                // 403
                header('HTTP/1.1 403 Forbidden');
                Output::HardError("<b>ATBBS has denied your post, as it contains &quot;" . htmlentities($fText) . "&quot;, which is banned for the following reason:</b><br />{$fReason}");
                break;
            case 2:
                // Ban
                AddBan($User->ID, $_SERVER['REMOTE_ADDR'], $fPunishTime, '<span class="tag filter">Filter</span>' . $fReason, 0);
                break;
            default:
                // Ignore.
                break;
        }
    }
    $score = GetRandomScore($headline . ' ' . $body);
    if ($score >= ANTIRANDOM_MAX_SCORE) {
        if ($returnbool === true) {
            return true;
        }
        header('HTTP/1.1 403 Forbidden');
        Output::HardError("Your post contains random data (Score: {$score}, Max score: " . ANTIRANDOM_MAX_SCORE . "). Knock it the f**k off.");
        exit;
    }
    Check4Ban(true);
    if ($returnbool === true) {
        return false;
    }
    return array($headline, $body);
}
Пример #2
0
$SUSPECTS[]='St0P dDOsIn9 AT!';
$SUSPECTS[]='sTOp DD0sINg a+!';
$SUSPECTS[]='sTop DD0s|N9 AT!'; 
$SUSPECTS[]='S+op DdoSinG At!';
$SUSPECTS[]='S+Op DDOsIng AT!';
$SUSPECTS[]='s+oP DdosiNG at!';
*/
/*$ORIGINAL  ="BTW, HERE'S THE TRUE COLORS OF YOUR GLORIOUS HERO CHRISTOPHER POOLE: HTTP://WWW.ANONTALK.COM/DUMP/MOOTARD.TXT";
$SUSPECTS[]='btW, HER3'."'".'S tHE TRUe COloRs OF YOur GLOriOUs h3Ro <HristoPhEr POoL3: HTTP://Www.@noNt@LK.{0M/DUMp/MoOtArD.Txt';
*/
$ORIGINAL = $_GET['input'];
echo "<h2>Debugging</h2><p>Using " . mb_detect_encoding($ORIGINAL) . " encoding.</p>\n";
// ISO-8859-1
echo "<h2>Original Text</h2><p>" . OutputWithLineNumbers($ORIGINAL) . "\n";
echo "<h2>Defucked Text</h2>" . OutputWithLineNumbers(defuck_comment($ORIGINAL)) . "\n";
echo "<h2>Randomness Score: " . GetRandomScore(defuck_comment($ORIGINAL)) . "</h2>";
$rm = var_export(GatherReplacements($ORIGINAL), true);
//file_put_contents('replacement_matrix.php','<'.'?php'.$rm);
//echo "<h2>Replacement Matrix</h2><pre>".htmlspecialchars($rm)."</pre>\n";
function ordUTF8($c, $index = 0, &$bytes = null)
{
    $len = strlen($c);
    $bytes = 0;
    if ($index >= $len) {
        return false;
    }
    $h = ord($c[$index]);
    if ($h <= 0x7f) {
        $bytes = 1;
        return $h;
    } else {