<?php
// Массив хороших слов - только кириллица
$gw[] = "страху";
$gw[] = "влюблять";
$gw[] = "скорбл";
$gw[] = "авлят";
$gw[] = "гнезд";
$gw[] = "нездр";
$gw[] = "нездо";
$gw[] = "облада";
$gw[] = "владе";
$gw[] = "плох";
$gw[] = "епс";
$gw[] = "миди";
$gw[] = "яблок";
$gw[] = "бладе";
// Массив плохих слов - только кириллица
$bw[] = "><у";
$bw[] = ")(у";
$bw[] = " хуй";
$bw[] = " хуи";
$bw[] = " хуё";
$bw[] = " хуе";
$bw[] = " хий";
$bw[] = " хии";
$bw[] = " хиё";
$bw[] = " хие";
$bw[] = " хуя";
$bw[] = " хия";
$bw[] = " хуу";
$bw[] = " хиу";
$bw[] = "охуи";
$bw[] = "охии";
$bw[] = "охие";
$bw[] = "охуу";
$bw[] = "охиу";
$bw[] = "охую";
$bw[] = "ахуи";
$bw[] = "ахии";
$bw[] = "ахие";
$bw[] = "ахуу";
$bw[] = "ахиу";
$bw[] = "пизд";
$bw[] = "писд";
$bw[] = "ризд";
$bw[] = "рисд";
$bw[] = "пузд";
$bw[] = "пусд";
$bw[] = "рузд";
$bw[] = "русд";
$bw[] = "низд";
$bw[] = "нисд";
$bw[] = "нузд";
$bw[] = "нусд";
$bw[] = "пызд";
$bw[] = "пысд";
$bw[] = "рызд";
$bw[] = "рысд";
$bw[] = "нызд";
$bw[] = "нысд";
$bw[] = "пицд";
$bw[] = "рицд";
$bw[] = "ницд";
$bw[] = "нуцд";
$bw[] = "пуцд";
$bw[] = "пезд";
$bw[] = "песд";
$bw[] = "резд";
$bw[] = "ресд";
$bw[] = "пецд";
$bw[] = "рецд";
$bw[] = "нецд";
$bw[] = "незд";
$bw[] = "несд";
$bw[] = "бля";
$bw[] = "бляд";
$bw[] = "блад";
$bw[] = "блят";
$bw[] = "блать";
$bw[] = "блйад";
$bw[] = "блйат";
$bw[] = "блиад";
$bw[] = "блиат";
$bw[] = "вляд";
// $bw[]="влят";
$bw[] = "влать";
$bw[] = "влйад";
$bw[] = "влйат";
$bw[] = "влиад";
$bw[] = "влиат";
$bw[] = " ёб";
$bw[] = " ёп";
$bw[] = " еб";
$bw[] = " йоб";
$bw[] = " иоб";
$bw[] = "ъеб";
$bw[] = "аёб";
$bw[] = "аёп";
$bw[] = "аеб";
$bw[] = "айоб";
$bw[] = "аиоб";
$bw[] = "оёб";
$bw[] = "оеб";
$bw[] = "уёб";
$bw[] = "уёп";
$bw[] = "уеб";
$bw[] = "уйоб";
$bw[] = "уиоб";
$bw[] = "иеб";
$bw[] = "ыеб";
$bw[] = "муди";
$bw[] = "муда";
$bw[] = "миди";
$bw[] = "мида";
$bw[] = "член";
$bw[] = "члеп";
$bw[] = "пидор";
$bw[] = "пидар";
$bw[] = "педик";
$bw[] = "нидор";
$bw[] = "нидар";
$bw[] = "недик";
$bw[] = "нидар";
$bw[] = "пидор";
$bw[] = "пидар";
$bw[] = " жоп";
$bw[] = " жон";
$bw[] = " зхоп";
$bw[] = " зхон";
$bw[] = "драчи";
$bw[] = "драцхи";
$bw[] = "дпачи";
$bw[] = "дпацхи";
$change2 = array( chr( 195 ) . chr( 132 ) => "a", chr( 195 ) . chr( 133 ) => "a", chr( 195 ) .
chr( 134 ) => "a", chr( 195 ) . chr( 160 ) => "a", chr( 195 ) . chr( 164 ) => "a", chr( 195 ) .
chr( 165 ) => "a", chr( 195 ) . chr( 168 ) => "e", chr( 195 ) . chr( 169 ) => "e", chr( 195 ) .
chr( 137 ) => "e", chr( 206 ) . chr( 148 ) => "d", chr( 195 ) . chr( 150 ) => "o", chr( 195 ) .
chr( 182 ) => "o", chr( 195 ) . chr( 184 ) => "o", chr( 195 ) . chr( 178 ) => "o", chr( 195 ) .
chr( 152 ) => "o", chr( 195 ) . chr( 152 ) => "i", chr( 195 ) . chr( 145 ) => "i", chr( 206 ) .
chr( 155 ) => "l", chr( 206 ) . chr( 160 ) => "p", chr( 207 ) . chr( 128 ) => "p", chr( 195 ) .
chr( 156 ) => "u", chr( 195 ) . chr( 188 ) => "u", chr( 195 ) . chr( 185 ) => "u", chr( 195 ) .
chr( 159 ) => "b", );
function GetBadWord( $s ) // Возвращает первое плохое слово или пустую строку
{
global $gw, $bw, $change2;
$s = strtr( $s, $change2 );
// $s=iconv("UTF-8","windows-1251",$s);
$s = str_replace( "&", "я", $s );
$s = str_replace( "'", "ь", $s );
$s = str_replace( "<", "<", $s );
$s = str_replace( ">", ">", $s );
$s = str_replace( "_", "", $s );
$s = str_replace( "-", "", $s );
$s = str_replace( "+", "", $s );
$s = str_replace( "*", "", $s );
$s = str_replace( "^", "", $s );
$s = str_replace( "~", "", $s );
$s = str_replace( "'", "", $s );
$s = str_replace( "`", "", $s );
$s = str_replace( ":", "", $s );
$s = str_replace( "=", "", $s );
// Пробелы убираем интеллектуально
$bspos = 0;
$s = " $s ";
for ( $i = 1; $i < strlen( $s ); $i++ )
{
$ch = $s[$i];
if ( ( $ch == " " ) or ( $ch == "," ) or ( $ch == "." ) )
{
if ( ( $i - $bspos ) > 3 )
{
$s[$bspos] = " ";
}
else
{
$s[$i] = "-";
}
$bspos = $i;
}
}
$s = str_replace( "-", "", trim( $s ) );
$s_out = $s;
$s = strtolower( $s );
// Преобразуем кириллицу в нижний регистр
$s = strtr( $s, 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ', 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя' );
// Преобразуем возможные замены в кириллицу
$s = strtr( $s, 'a@b6cvgde*z3ijklmno0prs$tufhx+c4wy&9',
'ааббцвгдежззийклмноопрсстуфхххцчшуяя' );
// Удаление правильных слов
for ( $i = 0; $i < Count( $gw ); $i++ )
{
$pos = strpos( $s, $gw[$i] );
while ( $pos !== false )
{
$s = substr( $s, 0, $pos ) . substr( $s, $pos + strlen( $gw[$i] ) );
$s_out = substr( $s_out, 0, $pos ) . substr( $s_out, $pos + strlen( $gw[$i] ) );
$pos = strpos( $s, $gw[$i] );
}
}
$s = " $s";
$s_out = " $s_out";
for ( $i = 0; $i < Count( $bw ); $i++ )
{
$pos = strpos( $s, $bw[$i] );
if ( $pos !== false )
{
$pos = $pos - 5;
if ( $pos < 0 )
{
$pos = 0;
}
$s = substr( $s_out, $pos, strlen( $bw[$i] ) + 10 );
return $s;
exit;
}
}
return "";
}
?>