View file gb/func.php

File size: 19.15Kb
<?
################################################################################
################################################################################
####Скрипт создан by TarZan(icq 616787528) и by Berkut(icq 265753)                                                                                                        ####
####Скрипт распространяеться бесплатно!!                                                                                                 					    ####
####Запрещаеться продавать и переделывать даный скрипт!!!                                                                                                                 ####
####Скрипт скачан с сайта http://bm7.su!!!                                                                                                     	                                               ####
####Все дополнения и новый скрипты ожидайте на сайте http://bm7.su                                                                                                ####
################################################################################
################################################################################
/////////////////////////////////////////Ф-ция переобразования с верхнего регистра в нижний///////////////////////////
function rusniz($action){
$action=strtr($action,array("А"=>"а","Б"=>"б","В"=>"в","Г"=>"г","Д"=>"д","Е"=>"е","Ё"=>"ё","Ж"=>"ж","З"=>"з","И"=>"и","Й"=>"й","К"=>"к","Л"=>"л","М"=>"м","Н"=>"н","О"=>"о","П"=>"п","Р"=>"р","С"=>"с","Т"=>"т","У"=>"у","Ф"=>"ф","Х"=>"х","Ц"=>"ц","Ч"=>"ч","Ш"=>"ш","Щ"=>"щ","Ь"=>"ь","Ъ"=>"ъ","Ы"=>"ы","Э"=>"э","Ю"=>"ю","Я"=>"я",
"A"=>"a","B"=>"b","C"=>"c","D"=>"d","E"=>"e","I"=>"i","F"=>"f","G"=>"g","H"=>"h","J"=>"j","K"=>"k","L"=>"l","M"=>"m","N"=>"n","O"=>"o","P"=>"p","Q"=>"q","R"=>"r","S"=>"s","T"=>"t","U"=>"u","V"=>"v","W"=>"w","X"=>"x","Y"=>"y","Z"=>"z"));
 return $action;
}
/////////////////////////////////////////УТФ-8 на ВИН1251///////////////////////////////////////////////////////////
$_utf8win1251 = array(
"\xD0\x90"=>"\xC0","\xD0\x91"=>"\xC1","\xD0\x92"=>"\xC2","\xD0\x93"=>"\xC3","\xD0\x94"=>"\xC4",
"\xD0\x95"=>"\xC5","\xD0\x81"=>"\xA8","\xD0\x96"=>"\xC6","\xD0\x97"=>"\xC7","\xD0\x98"=>"\xC8",
"\xD0\x99"=>"\xC9","\xD0\x9A"=>"\xCA","\xD0\x9B"=>"\xCB","\xD0\x9C"=>"\xCC","\xD0\x9D"=>"\xCD",
"\xD0\x9E"=>"\xCE","\xD0\x9F"=>"\xCF","\xD0\xA0"=>"\xD0","\xD0\xA1"=>"\xD1","\xD0\xA2"=>"\xD2",
"\xD0\xA3"=>"\xD3","\xD0\xA4"=>"\xD4","\xD0\xA5"=>"\xD5","\xD0\xA6"=>"\xD6","\xD0\xA7"=>"\xD7",
"\xD0\xA8"=>"\xD8","\xD0\xA9"=>"\xD9","\xD0\xAA"=>"\xDA","\xD0\xAB"=>"\xDB","\xD0\xAC"=>"\xDC",
"\xD0\xAD"=>"\xDD","\xD0\xAE"=>"\xDE","\xD0\xAF"=>"\xDF","\xD0\x87"=>"\xAF","\xD0\x86"=>"\xB2",
"\xD0\x84"=>"\xAA","\xD0\x8E"=>"\xA1","\xD0\xB0"=>"\xE0","\xD0\xB1"=>"\xE1","\xD0\xB2"=>"\xE2",
"\xD0\xB3"=>"\xE3","\xD0\xB4"=>"\xE4","\xD0\xB5"=>"\xE5","\xD1\x91"=>"\xB8","\xD0\xB6"=>"\xE6",
"\xD0\xB7"=>"\xE7","\xD0\xB8"=>"\xE8","\xD0\xB9"=>"\xE9","\xD0\xBA"=>"\xEA","\xD0\xBB"=>"\xEB",
"\xD0\xBC"=>"\xEC","\xD0\xBD"=>"\xED","\xD0\xBE"=>"\xEE","\xD0\xBF"=>"\xEF","\xD1\x80"=>"\xF0",
"\xD1\x81"=>"\xF1","\xD1\x82"=>"\xF2","\xD1\x83"=>"\xF3","\xD1\x84"=>"\xF4","\xD1\x85"=>"\xF5",
"\xD1\x86"=>"\xF6","\xD1\x87"=>"\xF7","\xD1\x88"=>"\xF8","\xD1\x89"=>"\xF9","\xD1\x8A"=>"\xFA",
"\xD1\x8B"=>"\xFB","\xD1\x8C"=>"\xFC","\xD1\x8D"=>"\xFD","\xD1\x8E"=>"\xFE","\xD1\x8F"=>"\xFF",
"\xD1\x96"=>"\xB3","\xD1\x97"=>"\xBF","\xD1\x94"=>"\xBA","\xD1\x9E"=>"\xA2");

function utf_to_win($a) {
global $_utf8win1251;
if (is_array($a)){
foreach ($a as $k => $v) {
if (is_array($v)) {
$a[$k] = utf_to_win($v);
} else {
$a[$k] = strtr($v, $_utf8win1251);
}}
return $a;
} else {
return strtr($a, $_utf8win1251);
}
}
///////////////////////////////////////////ф-ция смайлов/////////////////////////////////////////////////////////////////////
function smile ( $text )
{
	$files = glob( 'smiles/*.gif' );
	$smiles = array( );
	$pics = array( );
		
	foreach ( $files as $a_files )
	{
		$name = pathinfo( $a_files, PATHINFO_FILENAME );
		$smiles[] = '|\.'. preg_quote( $name ) .'\.|i'; 
		$pics[] = '<img src="' . $a_files . '" alt="' . $name . '">';
	}
return preg_replace( $smiles, $pics, $text );
}

///////////////////////////////////////////////ф-ция подсветки кода/////////////////////////////////////////////////////////////////
/*function highlight($code) {
$code=strtr($code,array("&lt;"=>"<","&gt;"=>">","&amp;"=>"&","&#36;"=>"\$","&quot;"=>"\"","&#39;"=>"'","&#92;"=>"\\","&#37;"=>"%","<br>"=>"\r\n","&#94;"=>"^","&#58;"=>":"));
$code=highlight_string($code,true);
$code=strtr($code,array("\r\n"=>"<br>","<br />"=>"<br>",'\"'=>'"',"\'"=>"'","\$"=>"&#36;","'"=>"&#39;","\\"=>"&#92;","%"=>"&#37;","^"=>"&#94;",":"=>"&#58;")); //,""=>""
$code='<div class=code>'.$code.'</div>';
return $code;
}*/
function highlight($code) {

$code = strtr($code,array('&#124;'=>'|','&lt;'=>'<','&gt;'=>'>','&amp;'=>'&','&#36;'=>'$','&quot;'=>'"','&#39;'=>"'",'&#92;'=>'`','&#37;'=>'%','&#94;'=>'^','&#58;'=>':','<br />'=>"\r\n"));

if(!strpos($code,'<?') && substr($code,0,2)!='<?') {$code="<?php\r\n".trim($code);}  

$code = highlight_string($code,true);

$code = strtr($code,array("\r\n"=>'<br />','|'=>'&#124;','$'=>'&#36;',"'"=>'&#39;','`'=>'&#92;','%'=>'&#37;','^'=>'&#94;',':'=>'&#58;'));

$code = '<div class="d">'.$code.'</div>';
return $code;
}
////////////////////////////////////////////////ф-ция бб-кодов////////////////////////////////////////////////////////////////
function bb_code($text)
{
//$preg = array('(?<!\\\\)\[code(?::\w+)?\](.*?)\[\/code(?::\w+)?\]/sie'          => "highlight_code('\\1');",);
$text = preg_replace('#\[code\](.*?)\[/code\]#ie', 'highlight("\1")', $text);
$text = preg_replace('#\[big\](.*?)\[/big\]#si', '<big>\1</big>', $text);
$text = preg_replace('#\[i\](.*?)\[/i\]#si', '<i>\1</i>', $text); 
$text = preg_replace('#\[u\](.*?)\[/u\]#si', '<u>\1</u>', $text); 
$text = preg_replace('#\[del\](.*?)\[/del\]#si', '<del>\1</del>', $text); 
$text = preg_replace('#\[b\](.*?)\[/b\]#si', '<b>\1</b>', $text); 
$text = preg_replace('#\[url\](.*?)\|(.*?)\[/url\]#si', '<a href="http://\\1">\2</a>', $text); 
$text = preg_replace('#\[small\](.*?)\[/small\]#si', '<small>\1</small>', $text);
$text = preg_replace('#\[green\](.*?)\[/green\]#si', '<font color="#00FF00">\1</font>', $text); 
$text = preg_replace('#\[blue\](.*?)\[/blue\]#si', '<font color="#0000FF">\1</font>', $text); 
$text = preg_replace('#\[yellow\](.*?)\[/yellow\]#si', '<font color="#FFFF00">\1</font>', $text); 
$text = preg_replace('#\[url\](.*?)\|(.*?)\[/url\]#si', '<a href="http:\1">\2</a>', $text); 
$text = preg_replace('#\[http\](.*?)\[/http\]#si', '<a href="\\1">\\1</a>', $text); 
return $text;
}
///////////////////////////////////////////////////ф-ция антимата/////////////////////////////////////////////////////////////
function antimat($text){  
$text=str_replace('Сука','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('СУКА','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('сука','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('сучка','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Сучка','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('СУЧКА','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('петух','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Петух','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('чмо','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Чмо','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('гандон','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Гандон','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ГАНДОН','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ебло','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Ебло','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ЕБЛО','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ебало','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Ебало','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ЕБАЛО','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('хуй','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Хуй','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ХУЙ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('хуя','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Хуя','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ХУЯ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('хуйня','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Хуйня','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ХУЙНЯ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('жопа','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Жопа','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ЖОПА','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('блядь','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Блядь','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('БЛЯД','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Бляд','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('бляд','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('блядина','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Блядина','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('БЛЯДИНА','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('блять','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Блять','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('БЛЯТЬ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('чмо','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Чмо','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ЧМО','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ебать','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Ебать','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ЕБАТЬ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ебат','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Ебат','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ЕБАТ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('пидор','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Пидор','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ПИДОР','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ПИДАР','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Пидар','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('педрила','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Педрила','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ПЕДРИЛА','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('пидрила','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Пидрила','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ПИДРИЛА','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ебал','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Ебал','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ЕБАЛ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('нахуй','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Нахуй','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('НАХУЙ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('нахуя','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Нахуя','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('НАХУЯ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('нихуя','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Нихуя','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('НИХУЯ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ахует','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Ахует','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('АХУЕТ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ахуел','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Ахуел','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('АХУЕЛ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ахренеть','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Ахренеть','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('АХРЕНЕТЬ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ахренет','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Ахренет','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('АХРЕНЕТ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ЕБАЛ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Ебал','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ебал','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Раком','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('раком','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('РАКОМ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ХРЕН','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Хрен','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('хрен','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('ХРЕНЬ','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('Хрень','<font color=#00ff00> МАТ </font>',$text); 
$text=str_replace('хрень','<font color=#00ff00> МАТ </font>',$text); 
return $text; }
//////////////////////////////////////////////ф-ция антирекламы//////////////////////////////////////////////////////////////////
function antirek($message){ 
$message=str_replace("://"," * ",$message);
$message=str_replace(".ru"," ** ",$message);
$message=str_replace(".Ru"," * ",$message);
$message=str_replace(".RU"," ** ",$message);
$message=str_replace(".su"," ** ",$message);
$message=str_replace(".net"," ** ",$message);
$message=str_replace(".com"," ** ",$message);
$message=str_replace(".us"," ** ",$message);
$message=str_replace("wap"," ** ",$message);
$message=str_replace(".cn"," ** ",$message);
$message=str_replace(".wen"," ** ",$message);
$message=str_replace("h2m"," ** ",$message);
return $message; }
//////////////////////////////////////////////ф-ция транслита//////////////////////////////////////////////////////////////////
function translate($mess) 
{ 
$array = array( 
"Jo" => "Ё", 
"jo" => "ё", 
"Yo" => "Ё", 
"yo" => "ё", 
"Zh" => "Ж", 
"zh" => "ж", 
"*" => "ж", 
"Ch" => "Ч", 
"ch" => "ч", 
"Sh" => "Ш", 
"sh" => "ш", 
"Shc" => "Щ", 
"shc" => "щ", 
"''" => 'ъ', 
"'" => "ь", 
"Ye" => "Э", 
"ye" => "э", 
"Yu" => "Ю", 
"yu" => "ю", 
"Ya" => "Я", 
"ya" => "я", 
"X" => "Ы", 
"x" => "ы", 
"A" => "А", 
"a" => "а", 
"B" => "Б", 
"b" => "б", 
"C" => "Ц", 
"c" => "ц", 
"D" => "Д", 
"d" => "д", 
"E" => "Е", 
"e" => "е", 
"F" => "Ф", 
"f" => "ф", 
"G" => "Г", 
"g" => "г", 
"H" => "Х", 
"h" => "х", 
"I" => "И", 
"i" => "и", 
"K" => "К", 
"k" => "к", 
"L" => "Л", 
"l" => "л", 
"M" => "М", 
"m" => "м", 
"N" => "Н", 
"n" => "н", 
"O" => "О", 
"o" => "о", 
"P" => "П", 
"p" => "п", 
"Q" => "Ь", 
"q" => "ь", 
"R" => "Р", 
"r" => "р", 
"S" => "С", 
"s" => "с", 
"T" => "Т", 
"t" => "т", 
"U" => "У", 
"u" => "у", 
"V" => "В", 
"v" => "в", 
"W" => "Ш", 
"w" => "ш", 
"Y" => "Й", 
"y" => "й", 
"Z" => "З", 
"z" => "з" 
); 

return (strtr($mess, $array)); 
}
///////////////////////////////////////////////функция переобразования даты и вывода ее типа "Сегодня"/////////////////////////////////////////////////////////////////

function today($string){
$tim=$string;
$tim=ereg_replace("-", ".", $tim);
$tim=ereg_replace(" ", " / ", $tim);
$tim=substr($tim,0,18);
$tim=substr($tim,-16,16);
$tim=''.substr($tim,6,2).'.'.substr($tim,3,2).'.'.substr($tim,0,2).' / '.substr($tim,11,5);
if(date('d')==''.substr($tim,0,2).'' && date('m')==''.substr($tim,3,2).'' && date('y')==''.substr($tim,6,2).'')
{$tim='Сегодня / '.substr($tim,11,5);}
return $tim; 
}

function no_br($msg, $replace = ""){ 
$msg = preg_replace ("|[\r\n]+|si", $replace, $msg);
return $msg;
}

/////////////////////////////////////////Реальный юзер агент////////////////////////////////////////////////////////////
$user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
if ( stristr( $user_agent, 'Opera Mini' ) ) {
$user_agent = isset( $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'] ) ? $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'] : $user_agent;
}
$user_agent=htmlspecialchars(stripslashes(strtok($user_agent, '/')));
$ua=htmlspecialchars(stripslashes(strtok($user_agent, '/')));
/////////////////////////////////////////Реальный IP////////////////////////////////////////////////////////////
if (getenv('HTTP_X_FORWARDED_FOR')) 
        $ip = htmlspecialchars(stripslashes(getenv('HTTP_X_FORWARDED_FOR'))); 
else 
        $ip = htmlspecialchars(stripslashes(getenv('REMOTE_ADDR'))); 
//////////////////////////////////////////ф-ции фильтрации/////////////////////////////////////////////////////////////////
function chek($message){
$message=str_replace("|","I",$message);
$message = htmlspecialchars($message);     
$message = trim($message);
$message=str_replace("'","&#39;",$message);            
$message=str_replace("\"","&#34;",$message);  
$message=str_replace("\$","&#36;",$message);    
$message=str_replace("$","&#36;",$message);          
$message=str_replace("\\","&#92;", $message);                            
$message=str_replace("^","&#94;", $message);   
$message=str_replace("%","&#37;", $message);
$message=str_replace("`","", $message);   
$message = stripslashes(trim($message));
return $message; 
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
?>