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 "" . htmlentities($fText) . "", 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); }
'<input type="checkbox" name="c['.$i.']" value="1" checked="checked" />', '<label for="filter['.$i.']">Text to filter:</label><textarea name="filter['.$i.']" class="filter">'.htmlspecialchars($filterstring).'</textarea><select name="type['.$i.']">'.$opts.'</select><label for="replace['.$i.']">Replace with:</label><textarea name="replace['.$i.']"></textarea>', ($_POST['act']=='Preview') ? OutputWithLineNumbers(defuck_comment($_POST['filter'][$i])):'' )); $i++; } unset($_SESSION['2BFiltered']); } if(!empty($_POST['filter'])) { foreach($_POST['filter'] as $filterstring) { $t->Row(array( '<input type="checkbox" name="c['.$i.']" value="1" checked="checked" />', '<label for="filter['.$i.']">Text to filter:</label><textarea name="filter['.$i.']" class="filter">'.htmlspecialchars($filterstring).'</textarea><select name="type['.$i.']">'.$opts.'</select><label for="replace['.$i.']">Replace with:</label><textarea name="replace['.$i.']"></textarea>', ($_POST['act']=='Preview') ? OutputWithLineNumbers(defuck_comment($_POST['filter'][$i])):'' )); $i++; } } $t->Row(array( '<input type="checkbox" name="c[]" value="1" checked="checked" />', '<label for="filter[]">Text to filter:</label><textarea name="filter[]" class="filter"></textarea><select name="type[]">'.$opts.'</select><label for="replace[]">Replace with:</label><textarea name="replace[]"></textarea>', '' )); echo $t; ?> <input type="reset" /> <input type="submit" name="act" value="Submit" /> </form>
$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 {
// NOW add. $sql='INSERT INTO {P}Filters (filText,filReason,filPunishType,filPunishDuration,filReplacement) VALUES '; $c=0; for($i=0;$i<count($_POST['filter']);$i++) { if(strlen($_POST['filter'][$i])==0) continue; if(!(intval($_POST['confirm'][$i])==1)) continue; if(DB::Execute('SELECT 1 FROM {P}Filters WHERE filText='.DB::Q($_POST['filter'][$i]))->RecordCount()>0) Output::HardError('A filter for '.htmlentities($_POST['filter'][$i]).' already exists.'); if($c>0) $sql.=','; $sql.=sprintf('(%s,%s,%d,%s,%s)', defuck_comment(DB::Q($_POST['filter'][$i])), DB::Q($_POST['reason'][$i]), intval($_POST['type'][$i]), ParseExpiry($_POST['duration'][$i]), DB::Q($_POST['replace'][$i])); $c++; } if($c>0)DB::Execute($sql); } redirect('Done.'); break; case 'read_appeals': $page_title="Appeals"; echo '<form action="/controlpanel/process_appeals/" method="post">'; $slt=new TablePrinter('UIDAppeals');