mysql_query("SET NAMES 'utf8'");
mysql_query("SET SESSION collation_connection = 'utf8_general_ci'");
$input = json_decode ($HTTP_RAW_POST_DATA, true);
$text = addslashes( $input['object']['text']);
$rulelistret = check ($text , $hash , $owner);
mysql_query ("INSERT IGNORE INTO `bans` SET `in_post` = $in_post, `owner` = $owner, `post_id` = $post , `from_id` = $user , `text` = '$text', `hash` = '$hash' , `rule` = $rule , `stringattach` = '$arraystring' , `link` = '$links' , `api_response` = ''");
function check ($te , $hash = "none" , $owner) {
global $comment;
$arrayret = [];
/*
if ($hash == 'd41d8cd98f00b204e9800998ecf8427e') $hash = 'none';
$time = (time())-(60*60*24*7);
$count = mysql_fetch_array (mysql_query ("SELECT COUNT(*) FROM `posts` WHERE `time`<$time AND `hash` = '$hash'"));
if ($count[0] > 4) return -1;*/
$ta = " $te ";
$r = str_replace (array ("k" , "e" , "E" , "o" , "O" , "p" , "P" , "H" , "T" , "y" , "a" , "A" , "K" , "x" , "X" , "c" , "C" , "B" , "M" , "!" , "*" , "#" , "%" , "&" , "?" , "_" , "-") , array ("к" , "е" , "е" , "о" , "о" , "р" , "р" , "н" , "т" , "у" , "а" , "а" , "к" , "x" , "x" , "с" , "с" , "в" , "м" ) , $te);
if ($comment)
$s = mysql_query ("SELECT * FROM `rules` WHERE `comments_e` = 1 AND `disable` = 0 AND (`groups` = $owner OR `groups` = 0) ORDER BY `rules`.`id` ASC ");
else
$s = mysql_query ("SELECT * FROM `rules` WHERE `posts_e` = 1 AND `disable` = 0 AND (`groups` = $owner OR `groups` = 0) ORDER BY `rules`.`id` ASC ");
for ($q = mysql_fetch_array ($s) ; $q!=false ; $q = mysql_fetch_array ($s)) {
$arr[] = $q;
}
foreach ($arr as $cur) {
$t = $ta;
if ($cur[0] != 118) {
$t = $r;
}
$test=json_decode ($cur[1] , true);
$counta = count ($test);
unset ($xx);
foreach ($test as $ss) {
if (cw($ss , $t)) $xx++;
if ($xx==$counta && $counta!=0) {$arrayret[] = $cur[0];}
}
}
return $arrayret;
}
function cw ($worlds , $text) {
if ( gettype($worlds)=="array") {
foreach ($worlds as $world) {
$lw = $world;
$lt = mb_strtolower ($text , "UTF-8");
$c = preg_match("/$lw/uis" , "$lt");
if ($c==1) { return true;}
}
return false;
} else {
$lw =$worlds;
$lt = mb_strtolower ($text , "UTF-8");
$c = preg_match("/$lw/uis" , "$lt" );
if ($c==1) { return true;} else return false;
}
}