<?php
// сказать текст всем
if (strpos($say,"/g.php?sid=")!==false) $say=substr($say,0,strpos($say,"/g.php?sid="));
if ($translit) {
include "f_translit.dat";
$say=trans($say);
}
$s=$to.$say;
// UTF-8 русские буквы
$s=str_replace("\xd0\x81","Ё",$s);
$s=str_replace("\xd1\x91","ё",$s);
$s=preg_replace("/\xd0([\x90-\xbf])/e","chr(ord('\\1')+48)",$s);
$s=preg_replace("/\xd1([\x80-\x8f])/e","chr(ord('\\1')+112)",$s);
$s=str_replace('\\',"",$s);
$s=str_replace('"',"",$s);
$s=str_replace("'","",$s);
$s=preg_replace('/([^ -}А-я#])|\$|&/e',"",$s);
$s=preg_replace('/(с|c)(у|y)(ч)?(к|k)(а|a)/i',"[бип]",$s);
$s=preg_replace('/пидор/i',"[бип]",$s);
$s=preg_replace('/пиздюк/i',"[бип]",$s);
$s=preg_replace('/пизда/i',"[бип]",$s);
$s=preg_replace('/пиздец/i',"[бип]",$s);
$s=preg_replace('/хуй/i',"[бип]",$s);
$s=preg_replace('/нахуй/i',"[бип]",$s);
$s=preg_replace('/похуй/i',"[бип]",$s);
$s=preg_replace('/хуюшки/i',"[бип]",$s);
$s=preg_replace('/хуяк/i',"[бип]",$s);
$s=preg_replace('/охуеть/i',"[бип]",$s);
$s=preg_replace('/охуеть/i',"[бип]",$s);
$s=preg_replace('/схуя/i',"[бип]",$s);
$s=preg_replace('/хер/i',"[бип]",$s);
$s=preg_replace('/нихера/i',"[бип]",$s);
$s=preg_replace('/херня/i',"[бип]",$s);
$s=preg_replace('/хуйня/i',"[бип]",$s);
$s=preg_replace('/жопа/i',"[бип]",$s);
$s=preg_replace('/задница/i',"[бип]",$s);
$s=preg_replace('/пизда/i',"[бип]",$s);
$s=preg_replace('/пиздень/i',"[бип]",$s);
$s=preg_replace('/дырень/i',"[бип]",$s);
$s=preg_replace('/ябло/i',"[бип]",$s);
$s=preg_replace('/ябень/i',"[бип]",$s);
$s=preg_replace('/ябанутый/i',"[бип]",$s);
$s=preg_replace('/сука/i',"[бип]",$s);
$s=preg_replace('/тварь/i',"[бип]",$s);
$s=preg_replace('/сволочь/i',"[бип]",$s);
$s=preg_replace('/пидарас/i',"[бип]",$s);
$s=preg_replace('/гандон/i',"[бип]",$s);
$s=preg_replace('/гондон/i',"[бип]",$s);
$s=preg_replace('/гнида/i',"[бип]",$s);
$s=preg_replace('/гей/i',"[бип]",$s);
$s=preg_replace('/шлюха/i',"[бип]",$s);
$s=preg_replace('/шалава/i',"[бип]",$s);
$s=preg_replace('/блядь/i',"[бип]",$s);
$s=preg_replace('/уебище/i',"[бип]",$s);
$s=preg_replace('/педик/i',"[бип]",$s);
$s=str_replace("|","",$s);
$s=str_replace("<","",$s);
$s=str_replace(">","",$s);
$s=str_replace(".ru","",$s);
$s=str_replace(".org","",$s);
$s=str_replace(".net","",$s);
$s=str_replace(".com","",$s);
$s=str_replace(".ua","",$s);
$s=str_replace("waps.ru","",$s);
$jad=explode("|",$l_i[$loc][$login]["char"]);
if (time()<$jad[17]) {
$s=str_replace("к", "o", $s);
$s=str_replace("К", "Щ", $s);
$s=str_replace("а", "и", $s);
$s=str_replace("А", "И", $s);
$s=str_replace("В", "P", $s);
// $s=str_replace("м", "m", $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);
$s=str_replace("Т", "Г", $s);
$s=str_replace("Ь", "ь", $s);
$s=str_replace("З", "Ч", $s);
$s=str_replace("и", "ы", $s);
}
$say=substr($s,0,250);
if ($l_i[$loc][$login]['ban']>time()) {addjournal($loc,$login,"Бан!"); return;}
if (crc32($say)==$l_i[$loc][$login]["lsay1"]) {addjournal($loc,$login,"не флуди!"); return;}
$l_i[$loc][$login]["macrol"]="say|$say||";
// добавим всем, включая себя, в журнал что сказали
$b=0;
if ($char[8]) {$ts=explode("|",$l_i[$loc][$login]["skills"]); if (rand(0,100)<=$ts[21]*10) $b=1;}
if (!$char[8]) {addjournal($loc,"all",$char[0]." говорит: ".$say);
$l_i[$loc][$login]["lsay1"]=crc32($say);
}
else foreach (array_keys($l_i[$loc]) as $i) if (substr($i,0,2)=='u.'){
$skills=explode("|",$l_i[$loc][$i]["skills"]);
if ($b || rand(0,100)<=$skills[21]*20){ addjournal($loc,$i,$char[0]." говорит: ".$say);
$l_i[$loc][$login]["lsay1"]=crc32($say);
}
else {
$l_i[$loc][$login]["lsay1"]=crc32($say);
$stmp = preg_replace("/[A-ZА-Я]/","O",$say);
$stmp = preg_replace("/[a-zа-я]/","o",$stmp);
addjournal($loc,$i,$char[0]." говорит:".$stmp."");
}
}