Файл: 3020.ru/_core/_class/system.php
Строк: 81
<?php
//3020.ru - скрипты скачать можно тут
# класс системный
# author penny wise
# telegram @the_penny_wise
class system {
public static function check ($msg) # чек данных
{
$msg = htmlspecialchars($msg);
$search = array('|', ''', '$', '\', '^', '%', '`', " ", "x00", "x1A", chr( 226 ) . chr( 128 ) . chr( 174 ));
$replace = array('|', ''', '$', '\', '^', '%', '`', '', '', '', '');
$msg = str_replace($search,$replace,$msg);
$msg = stripslashes(trim($msg ));
return $msg;
}
public static function trim ($msg,$search) # удаление не нужных символов
{
$msg = str_replace($search,'',$msg);
$msg = stripslashes(trim($msg));
return $msg;
}
public static function translit($msg) { # транслит для панели
$array = array(
'_' => ' ', '%28' => ' ', '%29' => ' ', '%2A' => '*', '%2C' => ',', '%28'=> ' ','%29'=> ' ',
'a' => 'а', 'b' => 'б', 'v' => 'в', '%2B'=> '+', 'Gif' => 'Gif', 'Ljubov' => 'Любовь',
'g' => 'г', 'd' => 'д', 'e' => 'е', 'Iz_filmov'=> 'Из фильмов', 'Multy'=> 'Мульты',
'zh' => 'ж', 'z' => 'з', 'Action'=> 'Action', 'Flight'=> 'Flight', 'RPG'=> 'RPG',
'i' => 'и', 'j' => 'й', 'k' => 'к', 'TBS'=> 'TBS', 'XXX'=> 'XXX', 'Android'=> 'Android',
'l' => 'л', 'm' => 'м', 'n' => 'н', 'iOS'=> 'iOS', 'iPhone'=> 'iPhone','iPad'=> 'iPad',
'o' => 'о', 'p' => 'п', 'r' => 'р', 'iPod'=> 'iPod','RTS'=> 'RTS','Java'=> 'Java',
's' => 'с', 't' => 'т', 'u' => 'у', 'Symbian'=> 'Symbian','.x'=> '.x','UIQ'=> 'UIQ',
'f' => 'ф', 'h' => 'х', 'c' => 'ц', 'SE'=> 'SE', 'P800'=> 'P800', 'P900'=> 'P900',
'ch' => 'ч', 'w' => 'ш', 'sch' => 'щ', 'P910'=> 'P910','P990'=> 'P990','W950'=> 'W950',
'-' => '-', 'y' => 'ы', '-' => '-', 'N-Gage'=> 'N-Gage', '8x'=> '8x','2x'=> '2x','6x'=> '6x',
'x' => 'э', 'ju' => 'ю', 'ja' => 'я', 'Alcatel'=> 'Alcatel','BenQ-Siemens'=> 'BenQSiemens',
'A' => 'А', 'B' => 'Б', 'V' => 'В', 'Fly'=> 'Fly','LG'=> 'LG','Motorola'=> 'Motorola','Nokia'=> 'Nokia',
'G' => 'Г', 'D' => 'Д', 'E' => 'Е', 'Samsung'=> 'Samsung','Sony_Ericsson'=> 'Sony Ericsson',
'Zh' => 'Ж', 'Z' => 'З', '0x'=> '0x','C65'=> 'C65','SL65'=> 'SL65', 'CF62'=> 'CF62','S65'=> 'S65',
'I' => 'И', 'J' => 'Й', 'K' => 'К', 'CX75'=> 'CX75','EF81'=> 'EF81', 'EF81'=> 'EF81','SXG75'=> 'SXG75',
'L' => 'Л', 'M' => 'М', 'N' => 'Н', 'EL71'=> 'EL71','Series'=> 'Series', '40v'=> '40v','60v'=> '60v',
'O' => 'О', 'P' => 'П', 'R' => 'Р', 'N73'=> 'N73','N70'=> 'N70', 'N97'=> 'N97','N91'=> 'N91',
'S' => 'С', 'T' => 'Т', 'U' => 'У', 'X6'=> 'X6','K300'=> 'K300', 'J300'=> 'J300','Z300'=> 'Z300',
'F' => 'Ф', 'H' => 'Х', 'C' => 'Ц', 'Z600'=> 'Z600','K310'=> 'K310', '5xx'=> '5xx','W200'=> 'W200',
'Ch' => 'Ч', 'W' => 'Ш', 'Sch' => 'Щ', 'Z5xx'=> 'Z5xx','K600'=> 'K600', 'W550'=> 'W550','V%2CZ800'=> 'V,Z800',
'-' => '-', 'Y' => 'Ы', '-' => '-', 'K790'=> 'K790','S700'=> 'S700', 'W850'=> 'W850','V%2CZ800'=> 'V,Z800',
'X' => 'Э', 'Ju' => 'Ю', 'Ja' => 'Я', 'Sega'=> 'Sega','Dendy'=> 'Dendy', 'Game_Boy'=> 'Game Boy','Super_Nintendo'=> 'Super Nintendo',
'SsummVM'=> 'SsummVM','MameXM'=> 'MameXM', 'Bada'=> 'Bada','Windows_Mobile'=> 'Windows Mobile',
'Windows_Phone'=> 'Windows Phone','Internet'=> 'Internet', 'Bluetooth_WiFi_'=> 'Bluetooth/WiFi/','Windows_Mobile'=> 'Windows Mobile',
'Den_'=> 'День ','SMS'=> 'SMS', 'Pop'=> 'Pop','Rap'=> 'Rap', 'Hip-hop'=> 'Hiphop ','Rock'=> 'Rock', 'Dubstep'=> 'Dubstep',"Drum"=> "Drum",
'Bass'=> 'Bass ','House'=> 'House', 'Trap'=> 'Trap','Trance'=> 'Trance', 'Siemens'=> 'Siemens','TXT'=> 'TXT', 'fb2'=> 'fb2',
);
$msg = strtr($msg, $array);
return $msg;
}
public static function utf_strlen($msg) # обработка количество символов
{
return strlen( utf8_decode($msg) );
}
public static function time($time = NULL) # обработка времени
{
global $user;
if ($time == NULL) $time = time();
if (isset($user)) $time = $time + $user['timezone']*60*60;
$timep="".date("d.m.Y", $time)."";
$time_p[0]=date("d.m.Y", $time);
$time_p[1]=date("H:i", $time);
if ($time_p[0]==date("d.m.Y"))$timep=date("H:i:s", $time);
if (isset($user)) {
if ($time_p[0]==date("d.m.Y", time()+$user['timezone']*60*60))$timep=date("H:i:s", $time);
if ($time_p[0]==date("d.m.Y", time()-60*60*(24-$user['timezone'])))$timep="Вчера в $time_p[1]";
} else {
if ($time_p[0]==date("d.m.Y"))$timep=date("H:i:s", $time);
if ($time_p[0]==date("d.m.Y", time()-60*60*24))$timep="Вчера в $time_p[1]";
}
$timep=str_replace("Jan","Янв",$timep);
$timep=str_replace("Feb","Фев",$timep);
$timep=str_replace("Mar","Марта",$timep);
$timep=str_replace("May","Мая",$timep);
$timep=str_replace("Apr","Апр",$timep);
$timep=str_replace("Jun","Июня",$timep);
$timep=str_replace("Jul","Июля",$timep);
$timep=str_replace("Aug","Авг",$timep);
$timep=str_replace("Sep","Сент",$timep);
$timep=str_replace("Oct","Окт",$timep);
$timep=str_replace("Nov","Ноября",$timep);
$timep=str_replace("Dec","Дек",$timep);
return $timep;
}
public static function str($msg) # обработка url
{
$msg = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\1;",urldecode($msg));
$msg = html_entity_decode($msg,null,'UTF-8');
$ru=array('А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', 'а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я', ' ');
$en=array('A', 'B', 'V', 'G', 'D', 'E', 'E', 'J', 'Z', 'I', 'I', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'F', 'H', 'C', 'CH', 'SH', 'SH', '', 'I', '', 'E', 'YU', 'YA', 'a', 'b', 'v', 'g', 'd', 'e', 'e', 'j', 'z', 'i', 'i', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'c', 'ch', 'sh', 'sh', '', 'i', '', 'e', 'yu', 'ya', '_');
$msg=str_replace($ru,$en,$msg);
$msg = preg_replace('/[^/p{L}0-9]/iu','-',$msg);
$msg= preg_replace("|[-]+|is", "-", $msg);
return mb_strtolower($msg);
}
public static function out($msg) # обработка url
{
return stripslashes(trim($msg));
}
}
?>