Файл: world-faces.ru/world-faces.ru/sys/fnc/chks.php
Строк: 24
<?php
function chck($str){
$str = htmlentities(trim($str), ENT_QUOTES, 'UTF-8');
$str = nl2br($str);
$str=str_replace("|","I",$str);
$str=str_replace("||","I",$str);
$str=htmlspecialchars($str);
$str=str_replace("'","'",$str);
$str=str_replace(""",""",$str);
$str=str_replace("$","$",$str);
$str=str_replace("$","$",$str);
$str=str_replace("\","\", $str);
$str=str_replace("`","", $str);
$str=str_replace("^","^", $str);
$str=str_replace(":",":",$str);
$str=str_replace("%","%", $str);
$str=preg_replace("|:|",":",$str,3);
$str = strtr($str, array (chr(0)=> '',chr(1)=> '',chr(2)=> '',chr(3)=> '',chr(4)=> '',chr(5)=> '',chr(6)=> '',chr(7)=> '',chr(8)=> '',chr(9)=> '',chr(10)=> '',chr(11)=> '',chr(12)=> '',chr(13)=> '',chr(14)=> '',chr(15)=> '',chr(16)=> '',chr(17)=> '',chr(18)=> '',chr(19)=> '',chr(20)=> '',chr(21)=> '',chr(22)=> '',chr(23)=> '',chr(24)=> '',chr(25)=> '',chr(26)=> '',chr(27)=> '',chr(28)=> '',chr(29)=> '',chr(30)=> '',chr(31)=> ''));
$str = str_replace("'", "'", $str);
$str = str_replace('\', "\", $str);
$str = str_replace("|", "I", $str);
$str = str_replace("||", "I", $str);
$str = str_replace("/\$/", "$", $str);
$str = iconv('utf-8', 'windows-1251', $str);
$str = iconv('windows-1251', 'utf-8', $str);
$str = strtr($str, array ('&amp;lt;'=> '<','&amp;gt;'=>'>',':'=>';','&#039;'=>'скобочка'));
$str = htmlspecialchars($str);
return $str;
}
function slv($str,$msg1,$msg2,$msg3) {
$str = (int)$str;
$str1 = abs($str) % 100;
$str2 = $str % 10;
if ($str1 > 10 && $str1 < 20) return $str .' '. $msg3;
if ($str2 > 1 && $str2 < 5) return $str .' '. $msg2;
if ($str2 == 1) return $str .' '. $msg1;
return $str .' '. $msg3;
}
function vr($times=NULL)
{
global $db, $user;
if (isset($user))$time=time()+$user['set_timesdvig']*60*60;
else $time = time();
if(($time-$times)<=60){
$timesp = slv((($time-$times)),'секунду','секунды','секунд').' назад';
return $timesp;
}else if(($time-$times)<=3600){$timesp = slv((($time-$times)/60),'минуту','минуты','минут').' назад';
return $timesp;
}else{
$today = date("j M Y", $time);
$today = date("j M Y", $time);
$yesterday = date("j M Y", strtotime("-1 day"));
$timesp=date("j M Y в H:i", $times);
$timesp = str_replace($today, 'Сегодня', $timesp);
$timesp = str_replace($yesterday, 'Вчера', $timesp);
$timesp = strtr($timesp, array ("Jan" => "Янв","Feb" => "Фев","Mar" => "Марта","May" => "Мая","Apr" => "Апр","Jun" => "Июня","Jul" => "Июля","Aug" => "Авг","Sep" => "Сент","Oct" => "Окт","Nov" => "Ноября","Dec" => "Дек",));
return $timesp;}
}
?>