View file template/functions.php

File size: 29.07Kb
<?php //Кодировка utf-8
#-----------------------------------------------------#
#          ********* WAP-MOTORS *********             #
#             Made by   :  VANTUZ                     #
#               E-mail  :  [email protected]             #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#	
//$win = iconv ('utf-8', 'windows-1251', $utf);
$_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"); 
$_win1251utf8 = array( 
"\xC0"=>"\xD0\x90","\xC1"=>"\xD0\x91","\xC2"=>"\xD0\x92","\xC3"=>"\xD0\x93","\xC4"=>"\xD0\x94", 
"\xC5"=>"\xD0\x95","\xA8"=>"\xD0\x81","\xC6"=>"\xD0\x96","\xC7"=>"\xD0\x97","\xC8"=>"\xD0\x98", 
"\xC9"=>"\xD0\x99","\xCA"=>"\xD0\x9A","\xCB"=>"\xD0\x9B","\xCC"=>"\xD0\x9C","\xCD"=>"\xD0\x9D", 
"\xCE"=>"\xD0\x9E","\xCF"=>"\xD0\x9F","\xD0"=>"\xD0\xA0","\xD1"=>"\xD0\xA1","\xD2"=>"\xD0\xA2", 
"\xD3"=>"\xD0\xA3","\xD4"=>"\xD0\xA4","\xD5"=>"\xD0\xA5","\xD6"=>"\xD0\xA6","\xD7"=>"\xD0\xA7", 
"\xD8"=>"\xD0\xA8","\xD9"=>"\xD0\xA9","\xDA"=>"\xD0\xAA","\xDB"=>"\xD0\xAB","\xDC"=>"\xD0\xAC", 
"\xDD"=>"\xD0\xAD","\xDE"=>"\xD0\xAE","\xDF"=>"\xD0\xAF","\xAF"=>"\xD0\x87","\xB2"=>"\xD0\x86", 
"\xAA"=>"\xD0\x84","\xA1"=>"\xD0\x8E","\xE0"=>"\xD0\xB0","\xE1"=>"\xD0\xB1","\xE2"=>"\xD0\xB2", 
"\xE3"=>"\xD0\xB3","\xE4"=>"\xD0\xB4","\xE5"=>"\xD0\xB5","\xB8"=>"\xD1\x91","\xE6"=>"\xD0\xB6", 
"\xE7"=>"\xD0\xB7","\xE8"=>"\xD0\xB8","\xE9"=>"\xD0\xB9","\xEA"=>"\xD0\xBA","\xEB"=>"\xD0\xBB", 
"\xEC"=>"\xD0\xBC","\xED"=>"\xD0\xBD","\xEE"=>"\xD0\xBE","\xEF"=>"\xD0\xBF","\xF0"=>"\xD1\x80", 
"\xF1"=>"\xD1\x81","\xF2"=>"\xD1\x82","\xF3"=>"\xD1\x83","\xF4"=>"\xD1\x84","\xF5"=>"\xD1\x85", 
"\xF6"=>"\xD1\x86","\xF7"=>"\xD1\x87","\xF8"=>"\xD1\x88","\xF9"=>"\xD1\x89","\xFA"=>"\xD1\x8A", 
"\xFB"=>"\xD1\x8B","\xFC"=>"\xD1\x8C","\xFD"=>"\xD1\x8D","\xFE"=>"\xD1\x8E","\xFF"=>"\xD1\x8F", 
"\xB3"=>"\xD1\x96","\xBF"=>"\xD1\x97","\xBA"=>"\xD1\x94","\xA2"=>"\xD1\x9E"); 


/* 
   $s=str_replace("\xD0\xB0","а",$s);  $s=str_replace("\xD0\x90","А",$s); 
    $s=str_replace("\xD0\xB1","б",$s);  $s=str_replace("\xD0\x91","Б",$s); 
    $s=str_replace("\xD0\xB2","в",$s);  $s=str_replace("\xD0\x92","В",$s); 
    $s=str_replace("\xD0\xB3","г",$s);  $s=str_replace("\xD0\x93","Г",$s); 
    $s=str_replace("\xD0\xB4","д",$s);  $s=str_replace("\xD0\x94","Д",$s); 
    $s=str_replace("\xD0\xB5","е",$s);  $s=str_replace("\xD0\x95","Е",$s); 
    $s=str_replace("\xD1\x91","ё",$s);  $s=str_replace("\xD0\x81","Ё",$s); 
    $s=str_replace("\xD0\xB6","ж",$s);  $s=str_replace("\xD0\x96","Ж",$s); 
    $s=str_replace("\xD0\xB7","з",$s);  $s=str_replace("\xD0\x97","З",$s); 
    $s=str_replace("\xD0\xB8","и",$s);  $s=str_replace("\xD0\x98","И",$s); 
    $s=str_replace("\xD0\xB9","й",$s);  $s=str_replace("\xD0\x99","Й",$s); 
    $s=str_replace("\xD0\xBA","к",$s);  $s=str_replace("\xD0\x9A","К",$s); 
    $s=str_replace("\xD0\xBB","л",$s);  $s=str_replace("\xD0\x9B","Л",$s); 
    $s=str_replace("\xD0\xBC","м",$s);  $s=str_replace("\xD0\x9C","М",$s); 
    $s=str_replace("\xD0\xBD","н",$s);  $s=str_replace("\xD0\x9D","Н",$s); 
    $s=str_replace("\xD0\xBE","о",$s);  $s=str_replace("\xD0\x9E","О",$s); 
    $s=str_replace("\xD0\xBF","п",$s);  $s=str_replace("\xD0\x9F","П",$s); 
    $s=str_replace("\xD1\x80","р",$s);  $s=str_replace("\xD0\xA0","Р",$s); 
    $s=str_replace("\xD1\x81","с",$s);  $s=str_replace("\xD0\xA1","С",$s); 
    $s=str_replace("\xD1\x82","т",$s);  $s=str_replace("\xD0\xA2","Т",$s); 
    $s=str_replace("\xD1\x83","у",$s);  $s=str_replace("\xD0\xA3","У",$s); 
    $s=str_replace("\xD1\x84","ф",$s);  $s=str_replace("\xD0\xA4","Ф",$s); 
    $s=str_replace("\xD1\x85","х",$s);  $s=str_replace("\xD0\xA5","Х",$s); 
    $s=str_replace("\xD1\x86","ц",$s);  $s=str_replace("\xD0\xA6","Ц",$s); 
    $s=str_replace("\xD1\x87","ч",$s);  $s=str_replace("\xD0\xA7","Ч",$s); 
    $s=str_replace("\xD1\x88","ш",$s);  $s=str_replace("\xD0\xA8","Ш",$s); 
    $s=str_replace("\xD1\x89","щ",$s);  $s=str_replace("\xD0\xA9","Щ",$s); 
    $s=str_replace("\xD1\x8A","ъ",$s);  $s=str_replace("\xD0\xAA","Ъ",$s); 
    $s=str_replace("\xD1\x8B","ы",$s);  $s=str_replace("\xD0\xAB","Ы",$s); 
    $s=str_replace("\xD1\x8C","ь",$s);  $s=str_replace("\xD0\xAC","Ь",$s); 
    $s=str_replace("\xD1\x8D","э",$s);  $s=str_replace("\xD0\xAD","Э",$s); 
    $s=str_replace("\xD1\x8E","ю",$s);  $s=str_replace("\xD0\xAE","Ю",$s); 
    $s=str_replace("\xD1\x8F","я",$s);  $s=str_replace("\xD0\xAF","Я",$s); */










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 win_to_utf($a) { 
global $_win1251utf8; 
if (is_array($a)){ 
foreach ($a as $k=>$v) { 
if (is_array($v)) { 
$a[$k] = win_to_utf($v); 
} else { 
$a[$k] = strtr($v, $_win1251utf8); 
}} 
return $a; 
} else { 
return strtr($a, $_win1251utf8); 
}} 



function rus_utf_tolower($str){
$str=strtr($str,array("A"=>"a","Б"=>"б","В"=>"в","Г"=>"г","Д"=>"д","Е"=>"е","Ё"=>"ё","Ж"=>"ж","З"=>"з","И"=>"и","Й"=>"й","К"=>"к","Л"=>"л","М"=>"м","Н"=>"н","О"=>"о","П"=>"п","Р"=>"р","С"=>"с","Т"=>"т","У"=>"у","Ф"=>"ф","Х"=>"х","Ц"=>"ц","Ч"=>"ч","Ш"=>"ш","Щ"=>"щ","Ь"=>"ь","Ъ"=>"ъ","Ы"=>"ы","Э"=>"э","Ю"=>"ю","Я"=>"я",
"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 $str;
}



//------------------ Функция определения реального IP --------------------//
if ($_SERVER['HTTP_X_FORWARDED_FOR']) $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if($_SERVER['HTTP_CLIENT_IP']) $ip = $_SERVER['HTTP_CLIENT_IP'];
else if($_SERVER['REMOTE_ADDR']) $ip = $_SERVER['REMOTE_ADDR'];
else {$ip = 'not detected';}
$ip = preg_replace("/[^0-9.]/", "", $ip);
$ip=htmlspecialchars(stripslashes($ip));


//----------------------- Функция вывода русской даты --------------------------//
$user_time=$config_clocks*3600;
$currHour=date("H",time()+$user_time); 
$currHour= round($currHour); 
$currDate=date("d F Y", time()+$user_time);
$curr=date("i:s", time()+$user_time);
$currTime=date("$currHour:i:s", time()+$user_time);
$currTime2=date("$currHour:i", time());
  
$currDate = str_replace("January","Января",$currDate);
$currDate = str_replace("February","Февраля",$currDate);
$currDate = str_replace("March","Марта",$currDate);
$currDate = str_replace("April","Апреля",$currDate);
$currDate = str_replace("May","Мая",$currDate);
$currDate = str_replace("June","Июня",$currDate);
$currDate = str_replace("July","Июля",$currDate);
$currDate = str_replace("August","Августа",$currDate);
$currDate = str_replace("September","Сентября",$currDate);
$currDate = str_replace("October","Октября",$currDate);
$currDate = str_replace("November","Ноября",$currDate);
$currDate = str_replace("December","Декабря",$currDate); 


//----------------------- Функция экранирования основных знаков --------------------------//
function check($message){ 
$message=str_replace("|","I",$message); 
$message=str_replace("||","I",$message);
$message=htmlspecialchars($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("@","&#64;", $message);      
$message=str_replace("`","", $message);  
$message=str_replace("^","", $message);   
$message=str_replace("%","&#37;", $message);  
$message=str_replace(":","&#58;",$message); 
$message=preg_replace("/&#58;/",":",$message,2); 
/* 
$message=preg_replace('/(j|J)(s|S)?/i',"***",$message); 
$message=preg_replace('/(s|S)(c|C)(r|R)(i|I)(p|P)(t|T)?/i',"***",$message); 
$message=preg_replace('/(i|I)(m|M)(g|G)?/i',"***",$message); 
$message=preg_replace('/(s|S)(r|R)(c|C)?/i',"***",$message); $message=preg_replace('/(a|A)(l|L)(e|E)(r|R)(t|T)?/i',"***",$message);                      
*/
$message=stripslashes(trim($message));               
return $message;  }

//----------------------- Функция удаления основных знаков --------------------------//
function check_full($message){ 
$message=str_replace("|","I",$message); 
$message=str_replace("||","I",$message);
$message=str_replace("&","",$message);
$message=str_replace("\"","",$message);
$message=str_replace(">","",$message);
$message=str_replace("<","",$message);
$message=htmlspecialchars($message);                  
$message=str_replace("'","",$message);            
$message=str_replace("\"","",$message);  
$message=str_replace("/\\\$/","",$message);    
$message=str_replace("$","",$message);          
$message=str_replace("\\","", $message);                            
$message=str_replace("@","", $message);      
$message=str_replace("`","", $message);    
$message=str_replace("%","", $message);
$message=str_replace("^","", $message); 
$message=stripslashes(trim($message));               
return $message;  }


//----------------------- Функция вырезания переноса строки --------------------------//
function no_br($message){ 
$message=preg_replace ("|[\r\n]+|si","",$message);
return $message;  }

//------------------ Функция определения реального браузера --------------------//
if ($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) $browsus = htmlspecialchars(stripslashes($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']));
else $browsus=htmlspecialchars(stripslashes($_SERVER['HTTP_USER_AGENT']));
$brow=strtok($browsus,'(');
$brow=strtok($brow,' ');
$brow=substr($brow,0,22);
$brow=str_replace("http://","", $brow);
if(empty($brow)){$brow='not detected';}


//------------------------- Старая функция антифлуда ------------------------------//

function CheckIP () 
{global $config_floodstime;
	
$flag= false;	
$fs= filesize(BASEDIR.'local/antiflood.dat');
$f= fopen(BASEDIR.'local/antiflood.dat', 'r');
flock($f, LOCK_SH);
$arr= @unserialize(fread($f, $fs));
flock($f, LOCK_UN);
fclose($f);
$IP= $_SERVER['REMOTE_ADDR'];
$IP=htmlspecialchars(stripslashes($IP));
$t= time();			
if (isset($arr)) { 
foreach ($arr as $k=>$v)
if ($v<$t) unset($arr[$k]);
} else $arr= array ();
if (!isset($arr[$IP])) {	
$arr[$IP]= $t + $config_floodstime;	
$flag= false;
} else {
$arr[$IP]= $t + $config_floodstime;	
$flag= true;
}
$f= fopen(BASEDIR.'local/antiflood.dat', 'a+');	
flock($f, LOCK_EX);
ftruncate($f, 0);
@fwrite($f, serialize($arr));
fflush($f);
flock($f, LOCK_UN);
fclose($f);
return $flag;
}


//--------------- Функция замены и вывода смайлов -------------------//
function smiles($string){
$dir = opendir (BASEDIR."images/smiles"); 
while ($file = readdir ($dir)) {
if (ereg (".gif$", "$file")){
$file2=str_replace(".gif","",$file);
$string=str_replace(":$file2",'<img src="'.BASEDIR.'images/smiles/'.$file.'" alt="">',$string);
}}
closedir ($dir);
return $string;  }

//--------------- Функция подсчета веса директории -------------------//
function  read_dir($dir) { 
if ($path = opendir($dir)) while ($file_name = readdir($path)) {
if (($file_name!=='.') && ($file_name!=="..")){ 
if ( is_dir($dir."/".$file_name)) $size +=read_dir($dir."/".$file_name); else  $size += filesize($dir."/".$file_name); 
}} return  $size;} 

//--------------- Функция правильного вывода веса файла -------------------//
function formatsize($file_size){

if($file_size >= 1073741824){
$file_size = round($file_size / 1073741824 * 100) / 100 . " Gb";
}elseif(
$file_size >= 1048576){
$file_size = round($file_size / 1048576 * 100) / 100 . " Mb";
}elseif(
$file_size >= 1024){
$file_size = round($file_size / 1024 * 100) / 100 . " Kb";
}else{
$file_size = round($file_size) . " b";}
return $file_size;
}


//------------------------- Функция антифлуда ------------------------------//
$php_self=check($_SERVER['PHP_SELF']);
function flooder($ip, $php_self){
global  $config_floodstime;

$old_db = file(BASEDIR."local/flood.dat");
$new_db = fopen(BASEDIR."local/flood.dat", w);
flock ($new_db,LOCK_EX);
$result = FALSE;

foreach($old_db as $old_db_line){
$old_db_arr = explode("|", $old_db_line);

if(($old_db_arr[0] + $config_floodstime) > time() ){
	
fputs ($new_db, $old_db_line);

if($old_db_arr[1] == $ip && $old_db_arr[2] == $php_self)
{ $result = TRUE; }}}

fflush($new_db);
flock ($new_db,LOCK_UN);
fclose($new_db);
return $result;
}



//------------------ Функция транслита букв --------------------//
function transliter($string){
$trans1=array("CSH","Csh","ZH","Zh","CH","Ch","SH","Sh","JO","Jo","JE","Je","JU","Ju","JA","Ja","csh","zh","ch","sh","jo","je","ju","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","&#39;","'","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","&#39;","'","y");
$trans2=array("Щ","Щ","Ж","Ж","Ч","Ч","Ш","Ш","Ё","Ё","Э","Э","Ю","Ю","Я","Я","щ","ж","ч","ш","ё","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","ь","ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ь","ы"); 
$string=str_replace($trans1,$trans2,$string);
return $string;}


//------------------ Функция антимата --------------------//
function antimat($string){
	$string=preg_replace('/(с|c|С|C)(у|y|Y|У)(ч|4|Ч)?(к|k|K|К|ча|чa|4a|4а)?(а|a)/i',"***",$string);
	$string=preg_replace('/(п|n|П)(и|u|И)(д|g|Д)(о|o|0|a|а|e|е)?(р|p)(а|a)?(з|c|с)?/i',"***",$string);
	$string=preg_replace('/(х|x|X|Х)(у|У|Y|y)(й|и|Й|И|u|е|e|Е|Ё|ё)(b|в)?(o|0|о|a|а)?/i',"***",$string);
	$string=preg_replace('/(п|n|П)(и|u|И)(з|3|З)(д|g|Д)?/i',"***",$string);
	$string=preg_replace('/(е|e|E|Е)(б|6|Б)(а|a|А|A)(т|л)?/i',"***",$string);
	$string=preg_replace('/(б|6|Б)(л|Л)(я|Я)/i',"***",$string);
return $string;}

//------------------ Функция для вывода в КТО-ГДЕ --------------------//
function str_mess($message){ 
$message=str_replace("/pages/who.php","Кто-где?",$message);
$message=str_replace("/pages/avators.php","Смотрит аватары",$message);
$message=str_replace("/pages/raitinglist.php","В рейтинге толстосумов",$message);
$message=str_replace("/pages/userlist.php","В списке юзеров",$message);
$message=str_replace("/pages/traffic.php","Cмотрит траффик",$message);
$message=str_replace("/votes","В голосовании",$message);
$message=str_replace("/pages/profil.php","В профиле",$message); 
$message=str_replace("/pages/privat.php","Читает приват",$message);
$message=str_replace("/pages/statistik.php","Cмотрит статистику",$message);
$message=str_replace("/pages/anketa.php","Cмотрит анкету",$message);
$message=str_replace("/pages/setting.php","Меняет настройки",$message);
$message=str_replace("/news","Читает новости",$message);
$message=str_replace("/forum/addtem.php","Создает тему в форуме",$message);
$message=str_replace("/forum","Общается в форуме",$message);
$message=str_replace("/games/bank.php","В банке",$message);
$message=str_replace("/games/magazin.php","В магазине",$message);
$message=str_replace("/games/perevod.php","Переводит деньги",$message);
$message=str_replace("/games/21.php","Играет в очко",$message);
$message=str_replace("/games/bandit.php","Играет в бандита",$message);
$message=str_replace("/games/kosti.php","Играет в кости",$message);
$message=str_replace("/games/hi.php","Играет в \"Угадай число\"",$message);
$message=str_replace("/games/livebank.php","В статистике вкладов",$message);
$message=str_replace("/chat/say.php","Пишет в чате",$message);
$message=str_replace("/chat","Общается в чате",$message);
$message=str_replace("/board","Читает объявления",$message);
$message=str_replace("/gallery","Смотрит фотки",$message);
$message=str_replace("/book/tegi.php","Смотрит теги",$message);
$message=str_replace("/book","Общается в гостевухе",$message);
$message=str_replace("/mail","Пишет администрации",$message);
$message=str_replace("/pages/faq.php","Читает FAQ",$message);
$message=str_replace("/pages/link.php","Размещает ссылку",$message);
$message=str_replace("/pages/statusfaq.php","Cмотрит статусы",$message);
$message=str_replace("/priv.php","Пишет приватное сообщение",$message);
$message=str_replace("/download/new.php","Качает новые скрипты",$message);
$message=str_replace("/download","Качает скрипты",$message);
$message=str_replace("/smiles.php","Смотрит смайлы",$message);
$message=str_replace("/search/index.php","В поисковике",$message);
$message=str_replace("/index.php","",$message);  
return $message;  }

function down_replace($message){ 
$message=str_replace("images","Картинки",$message);
$message=str_replace("music","Музон",$message);
$message=str_replace("video","Видео",$message);
$message=str_replace("games","Игры",$message);    
$message=str_replace("guestbooks","Гостевые книги",$message);
$message=str_replace("biblioteki","Библиотеки",$message);
$message=str_replace("chats","Чаты",$message);
$message=str_replace("connect","Связь",$message);
$message=str_replace("dosug","Развлечения",$message);
$message=str_replace("forums","Форумы",$message);
$message=str_replace("grabbers","Грабберы",$message);
$message=str_replace("informers","Информеры",$message);
$message=str_replace("katalogi","Каталоги",$message);
$message=str_replace("reklama","Реклама",$message);
$message=str_replace("rotor","Раскрутка",$message);
$message=str_replace("masters","Wap-мастеру",$message);
$message=str_replace("servises","Сервисы",$message);
$message=str_replace("builders","Строительство",$message);
$message=str_replace("votes","Опросы",$message);
$message=str_replace("downloads","Загрузки",$message);
$message=str_replace("programs","Программы",$message);
$message=str_replace("raznoe","Разное",$message);
$message=str_replace("protect","Защита",$message);
$message=str_replace("news","Новостные ленты",$message);
$message=str_replace("member","Авторизация",$message);
$message=str_replace("search","Поисковики",$message);
$message=str_replace("wap-motor","Wap-Motor",$message);          
return $message;  }	


//------------------ Функция изменения вывода файла в библиотеке --------------------//
function to_rus($str){
$str=str_replace(".txt","",$str); 
$str=str_replace("_"," ",$str); 
 
if(substr($str, 0, 1)=="!"){
$str=transliter($str); 
$str=substr($str,1); }
return $str;
}

//------------------ Функция определения прав доступа (CHMOD) --------------------//
function permissions($filez){
$filez = decoct(fileperms("$filez")) % 1000;
return $filez;
}

//------------------ Функция динамически меняющихся заголовков --------------------//
$my_title='';
if (stristr($_SERVER['PHP_SELF'],"forum/index.php")){$my_title = ' - Форум';}
if (stristr($_SERVER['PHP_SELF'],"forum/addtem.php")){$my_title = ' - Форум - добавление темы';}
if (stristr($_SERVER['PHP_SELF'],"forum/search.php")){$my_title = ' - Поиск по форуму';}
if (stristr($_SERVER['PHP_SELF'],"book/index.php")){$my_title = ' - Гостевая книга';}
if (stristr($_SERVER['PHP_SELF'],"book/tegi.php")){$my_title = ' - Справка по тегам';}
if (stristr($_SERVER['PHP_SELF'],"board/index.php")){$my_title = ' - Доска объявлений';}
if (stristr($_SERVER['PHP_SELF'],"board/search.php")){$my_title = ' - Поиск объявлений';}
if (stristr($_SERVER['PHP_SELF'],"board/add.php")){$my_title = ' - Добавление объявления';}
if (stristr($_SERVER['PHP_SELF'],"games/21.php")){$my_title = ' - 21 Очко';}
if (stristr($_SERVER['PHP_SELF'],"games/bandit.php")){$my_title = ' - Однорукий бандит';}
if (stristr($_SERVER['PHP_SELF'],"games/bank.php")){$my_title = ' - Банк';}
if (stristr($_SERVER['PHP_SELF'],"games/kosti.php")){$my_title = ' - Кости';}
if (stristr($_SERVER['PHP_SELF'],"games/hi.php")){$my_title = ' - Угадай число';}
if (stristr($_SERVER['PHP_SELF'],"games/perevod.php")){$my_title = ' - Перевод монет';}
if (stristr($_SERVER['PHP_SELF'],"games/loterea.php")){$my_title = ' - Лотерея';}
if (stristr($_SERVER['PHP_SELF'],"chat/index.php")){$my_title = ' - Мини-чат';}
if (stristr($_SERVER['PHP_SELF'],"chat/say.php")){$my_title = ' - Мини-чат - Добавление сообщений';}
if (stristr($_SERVER['PHP_SELF'],"votes/index.php")){$my_title = ' - Голосование';}
if (stristr($_SERVER['PHP_SELF'],"votes/vote.php")){$my_title = ' - Голосование - Просмотр результатов';}
if (stristr($_SERVER['PHP_SELF'],"votes/allvotes.php")){$my_title = ' -Архив голосований';}
if (stristr($_SERVER['PHP_SELF'],"gallery/index.php")){$my_title = ' - фотогалерея';}
if (stristr($_SERVER['PHP_SELF'],"who.php")){$my_title = ' - Кто-где';}
if (stristr($_SERVER['PHP_SELF'],"vhod.php")){$my_title = ' - Авторизация';}
if (stristr($_SERVER['PHP_SELF'],"userlist.php")){$my_title = ' - Список пользователей';}
if (stristr($_SERVER['PHP_SELF'],"translit.php")){$my_title = ' - Правила транслита';}
if (stristr($_SERVER['PHP_SELF'],"traffic.php")){$my_title = ' - Ваш траффик';}
if (stristr($_SERVER['PHP_SELF'],"anketa.php")){$my_title = ' - Анкета';}
if (stristr($_SERVER['PHP_SELF'],"avators.php")){$my_title = ' - Галерея аватаров';}
if (stristr($_SERVER['PHP_SELF'],"ban.php")){$my_title = ' - Бан';}
if (stristr($_SERVER['PHP_SELF'],"faq.php")){$my_title = ' - FAQ по сайту';}
if (stristr($_SERVER['PHP_SELF'],"link.php")){$my_title = ' - Добавь свой сайт';}
if (stristr($_SERVER['PHP_SELF'],"online.php")){$my_title = ' - Кто в онлайне';}
if (stristr($_SERVER['PHP_SELF'],"onlinewho.php")){$my_title = ' - Онлайн пользователей';}
if (stristr($_SERVER['PHP_SELF'],"privat.php")){$my_title = ' - Моя почта';}
if (stristr($_SERVER['PHP_SELF'],"profil.php")){$my_title = ' - Мой профиль';}
if (stristr($_SERVER['PHP_SELF'],"raitinglist.php")){$my_title = ' - Рейтинг толстосумов';}
if (stristr($_SERVER['PHP_SELF'],"referer.php")){$my_title = ' - Кто-откуда';}
if (stristr($_SERVER['PHP_SELF'],"registration.php")){$my_title = ' - Регистрация';}
if (stristr($_SERVER['PHP_SELF'],"setting.php")){$my_title = ' - Мои настройки';}
if (stristr($_SERVER['PHP_SELF'],"smiles.php")){$my_title = ' - Галерея смайлов';}
if (stristr($_SERVER['PHP_SELF'],"statistik.php")){$my_title = ' - Статистика сайта';}
if (stristr($_SERVER['PHP_SELF'],"statusfaq.php")){$my_title = ' - Статусы пользователей';}
if (stristr($_SERVER['PHP_SELF'],"subdel.php")){$my_title = ' - Отписка от новостей';}
if (stristr($_SERVER['PHP_SELF'],"news/index.php")){$my_title = ' - Новости сайта';}
if (stristr($_SERVER['PHP_SELF'],"news/komm.php")){$my_title = ' -  Комментарии новостей';}
if (stristr($_SERVER['PHP_SELF'],"mpanel")){$my_title = ' - Админка';}
if (stristr($_SERVER['PHP_SELF'],"mail/index.php")){$my_title = ' - Связь с админом';}
if (stristr($_SERVER['PHP_SELF'],"mail/lostpassword.php")){$my_title = ' - Восстановление пароля';}
if (stristr($_SERVER['PHP_SELF'],"help")){$my_title = ' - Помощь';}
if (stristr($_SERVER['PHP_SELF'],"download/index.php")){$my_title = ' - Архив скриптов - Категории';}
if (stristr($_SERVER['PHP_SELF'],"download/down.php")){$my_title = ' - Архив скриптов';}
if (stristr($_SERVER['PHP_SELF'],"download/new.php")){$my_title = ' - Архив скриптов - Новые скрипты';}
if (stristr($_SERVER['PHP_SELF'],"download/zip.php")){$my_title = ' - Архив скриптов - Просмотр архива';}
if (stristr($_SERVER['PHP_SELF'],"download/top20.php")){$my_title = ' - Архив скриптов - TOP 20 скриптов';}


//------------------ Функция правильного вывода статуса --------------------//
function user_status($message){ 
$message=str_replace('101','<font color="FF0000">Суперадмин</font>',$message);
$message=str_replace('102','<font color="FFFF00">Админ</font>',$message);
$message=str_replace('103','<font color="00FF00">Старший Модер</font>',$message);
$message=str_replace('105','<font color="0000FF">Модер</font>',$message);    
$message=str_replace('107','Пользователь',$message);        
return $message;  }	


//------------------ Функция выводящая картинку в загрузках --------------------//
function raiting_vote($string){ 	
if($string==0){$string=str_replace('0','<img src="../images/img/rating0.gif" alt="0">',$string);}
if($string>'0' && $string<='0.5'){ $string=str_replace($string,'<img src="../images/img/rating1.gif" alt="0.5"/>',$string); }
if($string>'0.5' && $string<='1'){ $string=str_replace($string,'<img src="../images/img/rating2.gif" alt="1"/>',$string); }   
if($string>'1' && $string<='1.5'){ $string=str_replace($string,'<img src="../images/img/rating3.gif" alt="1.5"/>',$string); }  
if($string>'1.5' && $string<='2'){ $string=str_replace($string,'<img src="../images/img/rating4.gif" alt="2"/>',$string); } 
if($string>'2' && $string<='2.5'){ $string=str_replace($string,'<img src="../images/img/rating5.gif" alt="2.5"/>',$string); } 
if($string>'2.5' && $string<='3'){ $string=str_replace($string,'<img src="../images/img/rating6.gif" alt="3"/>',$string); }  
if($string>'3' && $string<='3.5'){ $string=str_replace($string,'<img src="../images/img/rating7.gif" alt="3.5"/>',$string); }
if($string>'3.5' && $string<='4'){ $string=str_replace($string,'<img src="../images/img/rating8.gif" alt="4"/>',$string); }  
if($string>'4' && $string<='4.5'){ $string=str_replace($string,'<img src="../images/img/rating9.gif" alt="4.5"/>',$string); } 
if($string>'4.5' && $string<='5'){ $string=str_replace($string,'<img src="../images/img/rating10.gif" alt="5"/>',$string); }       
return $string;  }	

?>