Файл: public_html/system/functions.php
Строк: 1151
<?
function _string($string) {
$string = trim($string);
$string = mysql_escape_string($string);
$string = htmlspecialchars($string);
return $string;
}
function _num($i) {
$i = (int) abs($i);
return $i;
}
function n_f($i) {
if($i >= 99999 && $i < 1000000) {
$i = number_format($i, 0, '', '.');
$i = round($i,1).'k';
}
elseif($i >= 999999 && $i < 1000000000) {
$i = number_format($i, 0, '', '.');
$i = round($i,1).'m';
}
elseif($i >= 999999999 && $i < 1000000000000) {
$i = number_format($i, 0, '', '.');
$i = round($i,1).'b';
}
elseif($i >= 999999999999 && $i < 1000000000000000) {
$i = number_format($i, 0, '', '.');
$i = round($i,1).'t';
}
elseif($i >= 999999999999999 && $i < 1000000000000000000) {
$i = number_format($i, 0, '', '.');
$i = round($i,1).'q';
}
elseif($i >= 999999999999999999) {
$i = number_format($i, 0, '', '.');
$i = round($i,1).'u';
}else{
$i = number_format($i, 0, '', ''');
}
return $i;
}
function detect_browser(){
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$mobile = strpos($_SERVER['HTTP_USER_AGENT'],"Mobile");
$Silk = strpos($_SERVER['HTTP_USER_AGENT'],"Silk/");
$Kindle = strpos($_SERVER['HTTP_USER_AGENT'],"Kindle");
$operam = strpos($_SERVER['HTTP_USER_AGENT'],"Opera Mini");
$operai = strpos($_SERVER['HTTP_USER_AGENT'],"Opera Mini");
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");
$wind = strpos($_SERVER['HTTP_USER_AGENT'],"windows");
$bsd1 = strpos($_SERVER['HTTP_USER_AGENT'],"bsd");
$lin = strpos($_SERVER['HTTP_USER_AGENT'],"linux");
$unix = strpos($_SERVER['HTTP_USER_AGENT'],"unix");
$x11 = strpos($_SERVER['HTTP_USER_AGENT'],"x11");
$macos = strpos($_SERVER['HTTP_USER_AGENT'],"macos");
$macintosh = strpos($_SERVER['HTTP_USER_AGENT'],"macintosh");
if ($iphone || $mobile || $Silk || $Kindle || $operam || $operai || $android || $palmpre || $ipod || $berry){
$browser = 'mobile';
} else {
$browser = 'pc';
}
return $browser;
}
function NameBot(){
$array = array('q','w','r','t','p','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m');
$array2 = array('e','y','u','i','o','a');
$strlen = rand(5,6);
$name = '';
for($i = 1; $i <= $strlen; $i ++) {
if ($i == 1) {
$key = array_rand($array);
$name .= $array[$key];
}
elseif ($i == 2) {
$key = array_rand($array2);
$name .= $array2[$key];
}
elseif ($i <= 3) {
$key = array_rand($array);
$name .= $array[$key];
}
else
{
$key = array_rand($array);
$name .= $array[$key];
}
}
$name = mb_convert_case($name, MB_CASE_TITLE, "UTF-8");
return $name;
}
function pages($path) {
global $page, $pages;
if(($page - 1) > 0) {
echo ' <a href="'.$path.'page=1"><<</a> ';
}else{
echo '<<';
}
if($page - 1 > 0) {
echo ' <a href="'.$path.'page='.($page - 1).'"><</a> ';
} else{
echo ' < ';
}
if($page == $pages && $page - 4 > 0) {
echo ' <a href="'.$path.'page='.($page - 4).'">'.($page - 4).'</a> ';
}
if($page == $pages && $page - 3 > 0) {
echo ' <a href="'.$path.'page='.($page - 3).'">'.($page - 3).'</a> ';
}
if($page - 2 > 0) {
echo ' <a href="'.$path.'page='.($page - 2).'">'.($page - 2).'</a> ';
}
if($page - 1 > 0) {
echo ' <a href="'.$path.'page='.($page - 1).'">'.($page - 1).'</a> ';
}
echo $page;
if($page + 1 <= $pages) {
echo ' <a href="'.$path.'page='.($page + 1).'">'.($page + 1).'</a> ';
}
if($page + 2 <= $pages) {
echo ' <a href="'.$path.'page='.($page + 2).'">'.($page + 2).'</a> ';
}
if($page == 1 && $page + 3 <= $pages) {
echo ' <a href="'.$path.'page='.($page + 3).'">'.($page + 3).'</a> ';
}
if($page == 1 && $page + 4 <= $pages) {
echo ' <a href="'.$path.'page='.($page + 4).'">'.($page + 4).'</a> ';
}
if($page + 1 <= $pages) {
echo ' <a href="'.$path.'page='.($page + 1).'">></a> ';
}else{
echo ' > ';
}
if(($page + 1) <= $pages) {
echo ' <a href="'.$path.'page='.$pages.'">>></a> ';
}else{
echo ' >> ';
}
}
//// функция бб кодов by semdan
function bbcode($msg){
global $user;
////////////////////////////////// ссылки ///////////////////////////////////////////////////////////////////////////////////////////////
$msg=preg_replace("/[img=(.*)]/Usi","<img src='\1'>",$msg); //
$msg=preg_replace("/[site=(.*)](.*)[/site]/Usi","<a href='\1'>\2</a>",$msg); //
$msg=preg_replace("/[url=(.*)](.*)[/url]/Usi","<a href='\1'>\2</a>",$msg); //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////// доп рамки ///////////////////////////////////////////////////////////////////////////////////////////
$msg=preg_replace("/[ramkt](.*)[/ramkt]/Usi","<span style='border-style: dashed; border-color:Black'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt2](.*)[/ramkt2]/Usi","<span style='border-style: dashed; border-color:Navy'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt3](.*)[/ramkt3]/Usi","<span style='border-style: dashed; border-color:DarkGreen'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt4](.*)[/ramkt4]/Usi","<span style='border-style: dashed; border-color:Lime'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt5](.*)[/ramkt5]/Usi","<span style='border-style: dashed; border-color:MidnightBlue'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt6](.*)[/ramkt6]/Usi","<span style='border-style: dashed; border-color:Indigo'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt7](.*)[/ramkt7]/Usi","<span style='border-style: dashed; border-color:LawnGreen'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt8](.*)[/ramkt8]/Usi","<span style='border-style: dashed; border-color:DarkRed'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt9](.*)[/ramkt9]/Usi","<span style='border-style: dashed; border-color:FireBrick'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt10](.*)[/ramkt10]/Usi","<span style='border-style: dashed; border-color:MediumVioletRed'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt11](.*)[/ramkt11]/Usi","<span style='border-style: dashed; border-color:Crimson'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt12](.*)[/ramkt12]/Usi","<span style='border-style: dashed; border-color:DeepPink'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt13](.*)[/ramkt13]/Usi","<span style='border-style: dashed; border-color:Gold'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt14](.*)[/ramkt14]/Usi","<span style='border-style: dashed; border-color:Yellow'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt15](.*)[/ramkt15]/Usi","<span style='border-style: dashed; border-color:DeepPink'>\1</span>",$msg); //
$msg=preg_replace("/[ramkt17](.*)[/ramkt16]/Usi","<span style='border-style: dashed; border-color:Bisque'>\1</span>",$msg); //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// текст ////////////////////////////////////////////////////////////////////////////////////////////////////
$msg=preg_replace("/[center](.*)[/center]/Usi","<div align='center'>\1</div>",$msg); //
$msg=preg_replace("/[right](.*)[/right]/Usi","<div align='right'>\1</div>",$msg); //
$msg=preg_replace("/[left](.*)[/left]/Usi","<div align='left'>\1</div>",$msg); //
$msg=preg_replace("/[br]/Usi","<br>",$msg); //
$msg=preg_replace("/[hr]/Usi","<hr>",$msg); //
$msg=preg_replace("/[big](.*)[/big]/Usi","<span style='font-size:large;'>\1</span>",$msg); //
$msg=preg_replace("/[sol](.*)[/col]/Usi","<span style='border:1px solid;'>\1</span>",$msg); //
$msg=preg_replace("/[das](.*)[/das]/Usi","<span style='border:1px dashed;'>\1</span>",$msg); //
$msg=preg_replace("/[dot](.*)[/dot]/Usi","<span style='border:1px dotted;'>\1</span>",$msg); //
$msg=preg_replace("/[ex](.*)[/ex]/Usi","<span style='text-decoration:line-through;'>\1</span>",$msg); //
$msg=preg_replace("/[dotss](.*)[/dotss]/Usi","<span style='text-decoration:underline'>\1</span>",$msg); //
$msg=preg_replace("/[up](.*)[/up]/Usi","<span style='text-decoration:overline;'>\1</span>",$msg); //
$msg=preg_replace("/[i](.*)[/i]/Usi","<em>\1</em>",$msg); //
$msg=preg_replace("/[b](.*)[/b]/Usi","<b>\1</b>",$msg); //
$msg=preg_replace("/[small](.*)[/small]/Usi","<small>\1</small>",$msg); //
$msg=preg_replace("/[color=(.*)](.*)[/color]/Usi", "<font color='\1'>\2</font>", $msg); //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////// работа с текстом ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$msg=preg_replace("/[gradient=(.*),(.*)](.*)[/gradient]/Usi", "<span style='background: linear-gradient(135deg, #\1 20%, #\2 70%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;'>\3</span>", $msg); //
$msg=preg_replace("/[gradient3=(.*),(.*),(.*)](.*)[/gradient]/Usi","<span style='background: linear-gradient(135deg, #\1 20%, #\2 50%, #\3);-webkit-background-clip: text;-webkit-text-fill-color: transparent;'>\4</span>",$msg); //
$msg=preg_replace("/[transparent=(.*)](.*)[/transparent]/Usi","<span style='background: #\1;display: inline-table;color: white;border-radius: 5px;mix-blend-mode: multiply;padding: 5px 10px;'>\2</span>",$msg); //
$msg=preg_replace("/[bit](.*)[/bit]/Usi","<marquee behavior='alternate'>\1</marquee>",$msg); /////////////////////////////////////////////////////////////////////////////////////////////////////
$msg=preg_replace("/[textp](.*)[/textp]/Usi","<p align='right'>\1</p>",$msg); //
$msg=preg_replace("/[marq](.*)[/marq]/Usi","<marquee>\1</marquee>",$msg); //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$msg=preg_replace("/[prlink](.*)[/prlink]/Usi","<blockquote style='border: 3px solid rgb(218, 112, 214); margin: 0px; padding: 5px;'>\1</blockquote>",$msg); //
$msg=preg_replace("/[prlink2](.*)[/prlink2]/Usi","<blockquote style='border: 1px solid rgb(218, 112, 214); margin: 0px; padding: 5px;'>\1</span>",$msg); //
$msg=preg_replace("/[prlink3](.*)[/prlink3]/Usi","<blockquote style='border: 1px solid rgb(218, 112, 214); margin: 1px; padding: 1px;'>\1</blockquote>",$msg); //
$msg=preg_replace("/[prlink4](.*)[/prlink4]/Usi","<blockquote style='border: 1px solid rgb(110, 112, 214); margin: 1px; padding: 1px;'>\1</blockquote>",$msg); //
$msg=preg_replace("/[prlink4](.*)[/prlink4]/Usi","<blockquote style='border: 1px solid rgb(666, 43, 211); margin: 1px; padding: 1px;'>\1</blockquote>",$msg); //
$msg=preg_replace("/[prlink6](.*)[/prlink6]/Usi","<blockquote style='border: 1px solid rgb(777, 43, 666); center: 0px; padding: 1px;'>\1</blockquote>",$msg); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$msg=preg_replace("/[rams](.*)[/rams]/Usi","<blockquote style='BORDER-LEFT: #F70000 3px solid; padding: 15px; BORDER-TOP: #119931 3px solid; padding: 15px; BORDER-BOTTOM: #E3AF40 3px solid; padding: 15px; BORDER-RIGHT: #924E96 3px solid' padding:='' 15px=''>\1</blockquote>",$msg); //
$msg=preg_replace("/[rams2](.*)[/rams2]/Usi","<blockquote style='BORDER-LEFT: #F70000 1px solid; padding: 5px; BORDER-TOP: #119931 1px solid; padding: 3px; BORDER-BOTTOM: red 3px solid; padding: 1px; BORDER-RIGHT: #924E96 3px solid' padding:='' 1px=''>\1</blockquote>",$msg); //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$msg=preg_replace("/[bDarkOrange](.*)[/bDarkOrange]/Usi","<span style='background-color : DarkOrange'>\1</span>",$msg);
$msg=preg_replace("/[bred](.*)[/bred]/Usi","<span style='background-color : red'>\1</span>",$msg);
$msg=preg_replace("/[bgreen](.*)[/bgreen]/Usi","<span style='background-color : green'>\1</span>",$msg);
$msg=preg_replace("/[bblue](.*)[/bblue]/Usi","<span style='background-color : blue'>\1</span>",$msg);
$msg=preg_replace("/[byellow](.*)[/b]/Usi","<span style='background-color : yellow'>\1</span>",$msg);
$msg=preg_replace("/[bbrown](.*)[/bbrown]/Usi","<span style='background-color : brown'>\1</span>",$msg);
$msg=preg_replace("/[borange](.*)[/borange]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
$msg=preg_replace("/[b](.*)[/b]/Usi","<span style='background-color : '>\1</span>",$msg);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$msg=preg_replace("/[mp3]/Usi",'<object type="application/x-shockwave-flash" data="http://btvar.ru/music/ump3player_500x70.swf" height="70" width="500"><param name="wmode" value="transparent" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="http://btvar.ru/music/ump3player_500x70.swf" /><param name="FlashVars" value="way=http://mmars.ru/15.mp3&swf=http://btvar.ru/music/ump3player_500x70.swf&w=500&h=74&time_seconds=0&autoplay=0&q=1&skin=sky&volume=70&comment=ЛАРИН" /></object>',$msg);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
return $msg; //
} //
////бб коды конец///
////////////////////
function smiles($string) {
$string = str_replace(array('Гг','Гг'), '<img src="/images/smiles/gg.gif" alt="*"/>', $string);
$string = str_replace(array('.ппц.','ппц'), '<img src="/images/smiles/ppc.gif" alt="*"/>', $string);
$string = str_replace(array('.гы.','гы)'), '<img src="/images/smiles/gi.gif" alt="*"/>', $string);
$string = str_replace(array(':ы)',':ыы'), '<img src="/images/smiles/i.gif" alt="*"/>', $string);
$string = str_replace(array('дану',':дану'), '<img src="/images/smiles/dany.gif" alt="*"/>', $string);
$string = str_replace(array('.рукалицо.','.1.'), '<img src="/images/smiles/ruka.gif" alt="*"/>', $string);
$string = str_replace(array('=)'),'<img src="/images/smiles/happy.gif" alt="*"/>', $string);
$string = str_replace(array('=('),'<img src="/images/smiles/buhoj.gif" alt="*"/>', $string);
$string = str_replace(array('плачу'),'<img src="/images/smiles/pla.png" alt="*"/>', $string);
$string = str_replace(array(':сердце'),'<img src="/images/smiles/lub.png" alt="*"/>', $string);
$string = str_replace(array(':)'),'<img src="/images/smiles/).gif" alt="*"/>', $string);
$string = str_replace(array('лецон'),'<img src="/images/smiles/ka.png" alt="*"/>', $string);
$string = str_replace(array(':('),'<img src="/images/smiles/(.gif" alt="*"/>', $string);
$string = str_replace(array(':D'),'<img src="/images/smiles/D.gif" alt="*"/>', $string);
$string = str_replace(array(';)'),'<img src="/images/smiles/hi.gif" alt="*"/>', $string);
$string = str_replace(array(':оу'),'<img src="/images/smiles/oy.gif" alt="*"/>', $string);
$string = str_replace(array(':love'),'<img src="/images/smiles/love.gif" alt="*"/>', $string);
$string = str_replace(array(':ок',':ок'), '<img src="/images/smiles/tt.png" alt="*"/>', $string);
$string = str_replace(array(':xaxa'),'<img src="/images/smiles/xaxa.gif" alt="*"/>', $string);
$string = str_replace(array(':w'),'<img src="/images/smiles/w.gif" alt="*"/>', $string);
$string = str_replace(array(':zloy'),'<img src="/images/smiles/zlo.gif" alt="*"/>', $string);
$string = str_replace(array(':str'),'<img src="/images/smiles/str.gif" alt="*"/>', $string);
$string = str_replace(array(':vopr'),'<img src="/images/smiles/vopros.gif" alt="*"/>', $string);
$string = str_replace(array(':cofe'),'<img src="/images/smiles/cofe.gif" alt="*"/>', $string);
$string = str_replace(array(':prelest'),'<img src="/images/smiles/prelest.gif" alt="*"/>', $string);
$string = str_replace(array(':uch'),'<img src="/images/smiles/lamer.gif" alt="*"/>', $string);
$string = str_replace(array(':zubch'),'<img src="/images/smiles/zubch.gif" alt="*"/>', $string);
$string = str_replace(array(':mister'),'<img src="/images/smiles/mister.gif" alt="*"/>', $string);
$string = str_replace(array(':yo'),'<img src="/images/smiles/pank.gif" alt="*"/>', $string);
$string = str_replace(array(':poka'),'<img src="/images/smiles/poka.gif" alt="*"/>', $string);
$string = str_replace(array(':rzhu'),'<img src="/images/smiles/rzhu.gif" alt="*"/>', $string);
$string = str_replace(array(':ок',':ок'), '<img src="/images/smiles/tt.gif" alt="*"/>', $string);
$string = str_replace(array(':rules'),'<img src="/images/smiles/rules.gif" alt="*"/>', $string);
$string = str_replace(array(':roza'),'<img src="/images/smiles/roza.gif" alt="*"/>', $string);
$string = str_replace(array(':plak'),'<img src="/images/smiles/plak.gif" alt="*"/>', $string);
$string = str_replace(array(':pivo'),'<img src="/images/smiles/pivo.gif" alt="*"/>', $string);
$string = str_replace(array(':vpr'),'<img src="/images/smiles/vpr.gif" alt="*"/>', $string);
$string = str_replace(array(':ura'),'<img src="/images/smiles/ura.gif" alt="*"/>', $string);
$string = str_replace(array(':podarok'),'<img src="/images/smiles/podarok.png" alt="*"/>', $string);
$string = str_replace(array('12341'),'<img src="/images/smiles/12341.png" width="100%" alt="*"/>', $string);
$string = str_replace(array(':be'),'<img src="/images/smiles/be.gif" alt="*"/>', $string);
$string = str_replace(array(':povar'),'<img src="/images/smiles/povar.gif" alt="*"/>', $string);
$string = str_replace(array(':kur'),'<img src="/images/smiles/kur.gif" alt="*"/>', $string);
$string = str_replace(array(':haha'),'<img src="/images/smiles/haha.gif" alt="*"/>', $string);
$string = str_replace(array(':vinsent'),'<img src="/images/smiles/vinsent.gif" alt="*"/>', $string);
$string = str_replace(array(':not'),'<img src="/images/smiles/not.gif" alt="*"/>', $string);
$string = str_replace(array(':nooo'),'<img src="/images/smiles/facepalm.gif" alt="*"/>', $string);
$string = str_replace(array(':nono'),'<img src="/images/smiles/nono.gif" alt="*"/>', $string);
$string = str_replace(array(':nezn'),'<img src="/images/smiles/neznaju.gif" alt="*"/>', $string);
$string = str_replace(array(':mafiya'),'<img src="/images/smiles/mafiya.gif" alt="*"/>', $string);
$string = str_replace(array(':romashki'),'<img src="/images/smiles/romashki.gif" alt="*"/>', $string);
$string = str_replace(array(':music'),'<img src="/images/smiles/ar.gif" alt="*"/>', $string);
$string = str_replace(array(':gitara'),'<img src="/images/smiles/gitara.gif" alt="*"/>', $string);
$string = str_replace(array(':aaa'),'<img src="/images/smiles/aaa.gif" alt="*"/>', $string);
$string = str_replace(array(':mjach'),'<img src="/images/smiles/mjach.gif" alt="*"/>', $string);
$string = str_replace(array(':nea'),'<img src="/images/smiles/nea.gif" alt="*"/>', $string);
$string = str_replace(array(':hi'),'<img src="/images/smiles/privet.gif" alt="*"/>', $string);
$string = str_replace(array(':pobeda'),'<img src="/images/smiles/pobeda.gif" alt="*"/>', $string);
$string = str_replace(array(':kovyr'),'<img src="/images/smiles/kovyr.gif" alt="*"/>', $string);
$string = str_replace(array(':klass'),'<img src="/images/smiles/klass.gif" alt="*"/>', $string);
$string = str_replace(array(':kiss'),'<img src="/images/smiles/kiss.gif" alt="*"/>', $string);
$string = str_replace(array(':king'),'<img src="/images/smiles/king.gif" alt="*"/>', $string);
$string = str_replace(array(':jester'),'<img src="/images/smiles/jester.gif" alt="*"/>', $string);
$string = str_replace(array(':mash'),'<img src="/images/smiles/mash.gif" alt="*"/>', $string);
$string = str_replace(array(':help'),'<img src="/images/smiles/help.gif" alt="*"/>', $string);
$string = str_replace(array(':hello'),'<img src="/images/smiles/hello.gif" alt="*"/>', $string);
$string = str_replace(array(':gy'),'<img src="/images/smiles/gy.gif" alt="*"/>', $string);
$string = str_replace(array(':gum'),'<img src="/images/smiles/ochki.gif" alt="*"/>', $string);
$string = str_replace(array(':zzz'),'<img src="/images/smiles/zzz.gif" alt="*"/>', $string);
$string = str_replace(array(':gbita'),'<img src="/images/smiles/gbita.gif" alt="*"/>', $string);
$string = str_replace(array(':fingal'),'<img src="/images/smiles/fingal.gif" alt="*"/>', $string);
$string = str_replace(array(':8'),'<img src="/images/smiles/8.gif" alt="*"/>', $string);
$string = str_replace(array(':dz'),'<img src="/images/smiles/dz.gif" alt="*"/>', $string);
$string = str_replace(array(':chit'),'<img src="/images/smiles/chit.gif" alt="*"/>', $string);
$string = str_replace(array(':druzhba'),'<img src="/images/smiles/druzhba.gif" alt="*"/>', $string);
$string = str_replace(array(':drazn'),'<img src="/images/smiles/drazn.gif" alt="*"/>', $string);
$string = str_replace(array(':]'),'<img src="/images/smiles/[.gif" alt="*"/>', $string);
$string = str_replace(array(':-P'),'<img src="/images/smiles/P.gif" alt="*"/>', $string);
$string = str_replace(array(':cop'),'<img src="/images/smiles/cop.gif" alt="*"/>', $string);
$string = str_replace(array(':cool'),'<img src="/images/smiles/cool.gif" alt="*"/>', $string);
$string = str_replace(array(':shtanga'),'<img src="/images/smiles/shtanga.gif" alt="*"/>', $string);
$string = str_replace(array(':bravo'),'<img src="/images/smiles/bravo.gif" alt="*"/>', $string);
$string = str_replace(array(':boks'),'<img src="/images/smiles/boks.gif" alt="*"/>', $string);
$string = str_replace(array(':bita'),'<img src="/images/smiles/bita.gif" alt="*"/>', $string);
$string = str_replace(array(':oy'),'<img src="/images/smiles/oy.gif" alt="*"/>', $string);
$string = str_replace(array(':music'),'<img src="/images/smiles/ar.gif" alt="*"/>', $string);
$string = str_replace(array(':shamp'),'<img src="/images/smiles/shamp.gif" alt="*"/>', $string);
//////////////////////////////////////////////
$string = str_replace(array('спам','https://','htt ps://','https: //','mars.keo.su','.ru','пойдешь в мою игру','моя игра','ru','заходи моя игра','новая игра заходи'),'<font color="red">спам</font>', $string);
$string = str_replace(array('.tk','вартрон','вартрон.','wartron','битва за трон','Битва за Трон','Моя игра','','','','','','','','','','','','','',''),'<font color="red">спам</font>', $string);
$string = str_replace(array('','','','','','','','','','','','','','','','','','','','',''),'<font color="red">спам</font>', $string);
$string = str_replace(array('','','','','','','','','','','','','','','','','','','','',''),'<font color="red">спам</font>', $string);
$string = str_replace(array('','','','','','','','','','','','','','','','','','','','',''),'<font color="red">спам</font>', $string);
$string = str_replace(array('','','','','','','','','','','','','','','','','','','','',''),'<font color="red">спам</font>', $string);
$string = str_replace(array('','','','','','','','','','','','','','','','','','','','',''),'<font color="red">спам</font>', $string);
$string = str_replace(array('','','','','','','','','','','','','','','','','','','','',''),'<font color="red">спам</font>', $string);
/////////////////////////////////////////////
////ЭТО//МУЗЫКА//КОТОРАЯ//ЕСТЬ//НА//САЙТЕ////
$string = str_replace(array('gansello_mehtai'),'<object type="application/x-shockwave-flash" data="http://flv-mp3.com/i/pic/ump3player_500x70.swf" height="80" width="470"><param name="wmode" value="transparent" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="http://flv-mp3.com/i/pic/ump3player_500x70.swf" /><param name="FlashVars" value="way=http://btvar.ru/music/mehtai.mp3&swf=http://flv-mp3.com/i/pic/ump3player_500x70.swf&w=470&h=70&time_seconds=164&autoplay=0&q=&skin=blue&volume=70&comment=<font face=’Verdana’ size=’18’ color=’#E60EB7’>ганселло)</font>" /></object>', $string);
$string = str_replace(array('_vverh_po_'),'<object type="application/x-shockwave-flash" data="http://btvar.ru/music/ump3player_500x70.swf" height="70" width="500"><param name="wmode" value="transparent" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="http://btvar.ru/music/ump3player_500x70.swf" /><param name="FlashVars" value="way=http://btvar.ru/music/vverh.mp3&swf=http://btvar.ru/music/ump3player_500x70.swf&w=500&h=74&time_seconds=0&autoplay=0&q=1&skin=sky&volume=70&comment=в верх по леснице винтовой" /></object>', $string);
$string = str_replace(array(''),'', $string);
$string = str_replace(array(''),'', $string);
$string = str_replace(array(''),'', $string);
$string = str_replace(array(''),'', $string);
$string = str_replace(array(''),'', $string);
$string = str_replace(array(''),'', $string);
$string = str_replace(array(''),'', $string);
$string = str_replace(array(''),'', $string);
$string = str_replace(array(''),'', $string);
$string = str_replace(array(''),'', $string);
$string = str_replace(array(''),'', $string);
////ЭТО//МУЗЫКА//КОТОРАЯ//ЕСТЬ//НА//САЙТЕ////
/////////КАРТИНКИ//////ББКОДЫ////////////////
$string = str_replace(array('23_fevvv'),'<img src="https://pp.vk.me/c836431/v836431996/2fb4d/DIwxwutz3sE.jpg" alt="*"/>', $string);
$string = str_replace(array('2017-02-27_22-38-29.png'),'<img src="http://titan.epizy.com/2017-02-27_22-38-29.png" alt="*"/>', $string);
$string = str_replace(array(''),'<img src="" alt="*"/>', $string);
$string = str_replace(array(''),'<img src="" alt="*"/>', $string);
$string = str_replace(array(''),'<img src="" alt="*"/>', $string);
$string = str_replace(array(''),'<img src="" alt="*"/>', $string);
$string = str_replace(array(''),'<img src="" alt="*"/>', $string);
$string = str_replace(array(''),'<img src="" alt="*"/>', $string);
$string = str_replace(array(''),'<img src="" alt="*"/>', $string);
$string = str_replace(array(''),'<img src="" alt="*"/>', $string);
$string = str_replace(array(''),'<img src="" alt="*"/>', $string);
/////////КАРТИНКИ//////ББКОДЫ////////////////
$string=bbcode($string);
return $string;
}
function smils($string) {
$string = str_replace(array('Гг','Гг'), '<img src="/images/smiles/gg.gif" alt="*"/>', $string);
$string = str_replace(array('.ппц.','ппц'), '<img src="/images/smiles/ppc.gif" alt="*"/>', $string);
$string = str_replace(array('.гы.','гы)'), '<img src="/images/smiles/gi.gif" alt="*"/>', $string);
$string = str_replace(array(':ы)',':ыы'), '<img src="/images/smiles/i.gif" alt="*"/>', $string);
$string = str_replace(array('дану',':дану'), '<img src="/images/smiles/dany.gif" alt="*"/>', $string);
$string = str_replace(array('.рукалицо.','.1.'), '<img src="/images/smiles/ruka.gif" alt="*"/>', $string);
$string = str_replace(array('O:-)','o:-)'),'<img src="/images/smiles/mini_angel.gif" alt="*"/>', $string);
$string = str_replace(array(']:-)',']:-]'),'<img src="/images/smiles/mini_diablo.gif" alt="*"/>', $string);
$string = str_replace(array(':$',':-$',':-['),'<img src="/images/smiles/mini_blush.gif" alt="*"/>', $string);
$string = str_replace(array(':))',':-))','-))','=))'),'<img src="/images/smiles/mini_lol.gif" alt="*"/>', $string);
$string = str_replace(array(':)',':-)','=)'),'<img src="/images/smiles/mini_ulibka.gif" alt="*"/>', $string);
$string = str_replace(array(';)',';-)'),'<img src="/images/smiles/mini_podmigivanie.gif" alt="*"/>', $string);
$string = str_replace(array(':-D',':-d',':D',')))'),'<img src="/images/smiles/mini_spin.gif" alt="*"/>', $string);
$string = str_replace(array(':-P',':-p',':-Р',':-р',':P',':p'),'<img src="/images/smiles/mini_yazyk.gif" alt="*"/>', $string);
$string = str_replace(array(':(',':-('),'<img src="/images/smiles/mini_sad.gif" alt="*"/>', $string);
$string = str_replace(array(':'(',':'-('),'<img src="/images/smiles/mini_cry.gif" alt="*"/>', $string);
$string = str_replace(array(':]',':-]'),'<img src="/images/smiles/mini_dovolen.gif" alt="*"/>', $string);
$string = str_replace(array(':-/',':-\'),'<img src="/images/smiles/mini_hm.gif" alt="*"/>', $string);
$string = str_replace(array('8-)','%-)'),'<img src="/images/smiles/mini_krut.gif" alt="*"/>', $string);
$string = str_replace(array(':*',':-*'),'<img src="/images/smiles/mini_kiss.gif" alt="*"/>', $string);
$string = str_replace(array('%)','%-)'),'<img src="/images/smiles/mini_crazy.gif" alt="*"/>', $string);
$string = str_replace(array(':-o',':-O',':-о',':-О','O.o','О.о','O_o','o_O'),'<img src="/images/smiles/mini_chok.gif" alt="*"/>', $string);
$string = str_replace(array('O^','o^'),'<img src="/images/smiles/mini_bye.gif" alt="*"/>', $string);
$string = str_replace(array(':Ob',':ob'),'<img src="/images/smiles/mini_good.gif" alt="*"/>', $string);
$string = str_replace(array('6-(','%-E',':gigi'),'<img src="/images/smiles/mini_fingal.gif" alt="*"/>', $string);
$string = str_replace(array(':bravo',':браво'),'<img src="/images/smiles/mini_bravo.gif" alt="*"/>', $string);
$string = str_replace(array(':heart',':сердце'),'<img src="/images/smiles/mini_heart.gif" alt="*"/>', $string);
$string = str_replace(array(':fig',':фиг'),'<img src="/images/smiles/mini_fig.gif" alt="*"/>', $string);
$string = str_replace(array(':rose',':роза','@--'),'<img src="/images/smiles/mini_rose.gif" alt="*"/>', $string);
$string = str_replace(array(':krut',':крут'),'<img src="/images/smiles/mini_krut.gif" alt="*"/>', $string);
$string = str_replace(array('dOOb','doob','d00b'),'<img src="/images/smiles/mini_friends.gif" alt="*"/>', $string);
return $string;
}
function bbpanel($form, $field) {
return '<script language="JavaScript" type="text/javascript">
function tag(text1, text2) {
if ((document.selection)) {
document.' . $form . '.' . $field . '.focus();
document.' . $form . '.document.selection.createRange().text = text1+document.' . $form . '.document.selection.createRange().text+text2;
} else if(document.forms['' . $form . ''].elements['' . $field . ''].selectionStart!=undefined) {
var element = document.forms['' . $form . ''].elements['' . $field . ''];
var str = element.value;
var start = element.selectionStart;
var length = element.selectionEnd - element.selectionStart;
element.value = str.substr(0, start) + text1 + str.substr(start, length) + text2 + str.substr(start + length);
} else
document.' . $form . '.' . $field . '.value += text1+text2;
}
</script>
<a href="javascript:tag(' [b][/b] ','')"><img src=" http://btvar.ru/images/smiles/b.gif " alt="*"/></a>
<a href="javascript:tag(' [I][/I] ','')"><img src=" http://btvar.ru/images/smiles/ii.gif " alt="*"/></a>
<a href="javascript:tag(' [dotss][/dotss] ','')"><img src=" http://btvar.ru/images/smiles/u.gif " alt="*"/></a>
<a href="javascript:tag(' [url=/][/url] ','')"><img src=" http://btvar.ru/images/smiles/url.gif " alt="*"/></a>
<a href="javascript:tag(' [img=][/img] ','')"><img src=" http://btvar.ru/images/smiles/img.gif " alt="*"/></a>
<a href="javascript:tag(' [color=red][/color] ','')"><img src=" http://btvar.ru/images/smiles/red.gif " alt="*"/></a>
<a href="javascript:tag(' [color=green][/color] ','')"><img src=" http://btvar.ru/images/smiles/green.gif " alt="*"/></a>
<a href="javascript:tag(' [color=blue][/color] ','')"><img src=" http://btvar.ru/images/smiles/blue.gif " alt="*"/></a>
<br/>
<a href="javascript:tag(' :) ','')"><img src="/images/smiles/happy.gif" alt="*"/></a>
<a href="javascript:tag(' :nezn ','')"><img src="/images/smiles/neznaju.gif" alt="*"/></a>
<a href="javascript:tag(' :nono ','')"><img src="/images/smiles/nono.gif" alt="*"/></a>
<a href="javascript:tag(' :roza ','')"><img src="/images/smiles/roza.gif" alt="*"/></a>
<a href="javascript:tag(' :xaxa ','')"><img src="/images/smiles/xaxa.gif" alt="*"/></a>
<a href="javascript:tag(' :zloy ','')"><img src="/images/smiles/zlo.gif" alt="*"/></a>
<a href="javascript:tag(' :) ','')"><img src="/images/smiles/).gif" alt="*"/></a>
<a href="javascript:tag(' :str ','')"><img src="/images/smiles/str.gif" alt="*"/></a>
</br>
<a href="javascript:tag(' :klass ','')"><img src="/images/smiles/klass.gif" alt="*"/></a>
<a href="javascript:tag(' лецон ','')"><img src="/images/smiles/ka.png" alt="*"/></a>
<a href="javascript:tag(' :vopr ','')"><img src="/images/smiles/vopros.gif" alt="*"/></a>
<a href="javascript:tag(' :cofe ','')"><img src="/images/smiles/cofe.gif" alt="*"/></a>
<a href="javascript:tag(':mister ','')"><img src="/images/smiles/mister.gif" alt="*"/></a>
<a href="javascript:tag(' :w ','')"><img src="/images/smiles/w.gif" alt="*"/></a>
<a href="javascript:tag(' :plak ','')"><img src="/images/smiles/plak.gif" alt="*"/></a>
<a href="javascript:tag(' Гг ','')"><img src="/images/smiles/gg.gif" alt="*"/></a><br>
<a href="javascript:tag(' :not ','')"><img src="/images/smiles/not.gif" alt="*"/></a>
<a href="javascript:tag(' :zubch ','')"><img src="/images/smiles/zubch.gif" alt="*"/></a>
<a href="javascript:tag(' :uch ','')"><img src="/images/smiles/lamer.gif" alt="*"/></a>
<a href="javascript:tag(' :gy ','')"><img src="/images/smiles/gy.gif" alt="*"/></a>
<a href="javascript:tag(' :prelest ','')"><img src="/images/smiles/prelest.gif" alt="*"/></a>
<a href="javascript:tag(' :poka ','')"><img src="/images/smiles/poka.gif" alt="*"/></a>
<a href="javascript:tag(' :love ','')"><img src="/images/smiles/love.gif" alt="*"/></a>
<a href="javascript:tag(' :mafiya ','')"><img src="/images/smiles/mafiya.gif" alt="*"/></a><br>
<a href="javascript:tag(' :vpr ','')"><img src="/images/smiles/vpr.gif" alt="*"/></a>
<a href="javascript:tag(' :kur ','')"><img src="/images/smiles/kur.gif" alt="*"/></a>
<a href="javascript:tag(' :help ','')"><img src="/images/smiles/help.gif" alt="*"/></a>
<a href="javascript:tag(' :vinsent ','')"><img src="/images/smiles/vinsent.gif" alt="*"/></a>
<a href="javascript:tag(' :kiss ','')"><img src="/images/smiles/kiss.gif" alt="*"/></a>
<a href="javascript:tag(' :hello ','')"><img src="/images/smiles/hello.gif" alt="*"/></a><br>
<a href="javascript:tag(' :gum ','')"><img src="/images/smiles/ochki.gif" alt="*"/></a>
<a href="javascript:tag(' :zzz ','')"><img src="/images/smiles/zzz.gif" alt="*"/></a>
<a href="javascript:tag(' :bita ','')"><img src="/images/smiles/bita.gif" alt="*"/></a>
<a href="javascript:tag(' :kovyr ','')"><img src="/images/smiles/kovyr.gif" alt="*"/></a>
<a href="javascript:tag(' :pobeda ','')"><img src="/images/smiles/pobeda.gif" alt="*"/></a>
<a href="javascript:tag(' :hi ','')"><img src="/images/smiles/privet.gif" alt="*"/></a>
<br>
<a href="javascript:tag(' :nooo ','')"><img src="/images/smiles/facepalm.gif" alt="*"/></a>
<a href="javascript:tag(' :] ','')"><img src="/images/smiles/[.gif" alt="*"/></a>
<a href="javascript:tag(' :nea ','')"><img src="/images/smiles/nea.gif" alt="*"/></a>
<a href="javascript:tag(' :rzhu ','')"><img src="/images/smiles/rzhu.gif" alt="*"/></a>
<a href="javascript:tag(' :mjach ','')"><img src="/images/smiles/mjach.gif" alt="*"/></a>
<a href="javascript:tag(' :mash ','')"><img src="/images/smiles/mash.gif" alt="*"/></a>
<a href="javascript:tag(' :8 ','')"><img src="/images/smiles/8.gif" alt="*"/></a>
<br>
<a href="javascript:tag(' :pivo ','')"><img src="/images/smiles/pivo.gif" alt="*"/></a>
<a href="javascript:tag(' :jester ','')"><img src="/images/smiles/jester.gif" alt="*"/></a>
<a href="javascript:tag(' :boks ','')"><img src="/images/smiles/boks.gif" alt="*"/></a>
<a href="javascript:tag(' :bravo ','')"><img src="/images/smiles/bravo.gif" alt="*"/></a>
<a href="javascript:tag(' :shtanga ','')"><img src="/images/smiles/shtanga.gif" alt="*"/></a>
<a href="javascript:tag(' :dz ','')"><img src="/images/smiles/dz.gif" alt="*"/></a>
<a href="javascript:tag(' :ок ','')"><img src="/images/smiles/tt.png" alt="*"/></a>
<br>
<a href="javascript:tag(' ::yo ','')"><img src="/images/smiles/pank.gif" alt="*"/></a>
<a href="javascript:tag(' :shamp ','')"><img src="/images/smiles/shamp.gif" alt="*"/></a>
<a href="javascript:tag(' :kur ','')"><img src="/images/smiles/kur.gif" alt="*"/></a>
<a href="javascript:tag(' :fingal ','')"><img src="/images/smiles/fingal.gif" alt="*"/></a>
<a href="javascript:tag(' :drazn ','')"><img src="/images/smiles/drazn.gif" alt="*"/></a>
<a href="javascript:tag(' :oy ','')"><img src="/images/smiles/oy.gif" alt="*"/></a>
';
}
function _time($i) {
$h = floor(($i / 3600) - $d * 24);
$m = floor(($i - $h * 3600 - $d * 86400) / 60);
$s = $i - ($m * 60 + $h * 3600 + $d * 86400);
return ($h > 0 ? ($h < 10 ? '0':'').$h.':':'').($m > 0 ? ($m < 10 ? '0':'').$m.':':'00:').($s > 0 ? ($s < 10 ? '0':'').$s:'00');
}
function bb($string) {
$string = str_replace("rn","<br/>",$string);
return $string;
}
function _times($i) {
$d = floor($i / 86400);
$h = floor(($i / 3600) - $d * 24);
$m = floor(($i - $h * 3600 - $d * 86400) / 60);
$s = $i - ($m * 60 + $h * 3600 + $d * 86400);
if($d > 0) {
$result = $d.' д';
}
elseif($h > 0)
{
$result = $h.' ч';
}elseif($m > 0)
{
$result = $m.' мин';
}elseif($s >= 0)
{
$result = $s.' сек';
}
return $result.' назад';
}
function tl($tl){
$d=3600*24;
$day=floor($tl/$d);
$tl=$tl-($d*$day);
$hour=floor($tl/3600);
$tl=$tl-(3600*$hour);
$minute=floor($tl/60);
$tl=$tl-(60*$minute);
$second=floor($tl);
$dayt="".($day>0?"$day д. ":null)."";
$hourt="".($hour>0?"$hour ч. ":null)."";
$minutet="".($minute>0?"$minute м. ":null)."";
$secondt="".($second>0?"$second с. ":null)."";
if($day>0){
$minutet=NULL;
$secondt=NULL;
}
if($hour>0 && $day==0){
$secondt=NULL;
$dayt=NULL;
}
return "$dayt$hourt$minutet$secondt";
}
###############################
######### Функция ника id ########
###############################
function nick($id){
$users = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."' LIMIT 1"));
$refi = mysql_fetch_assoc(mysql_query("SELECT `vip` FROM `set` WHERE `usr` = '$users[login]' LIMIT 1"));
if($users['access']==2){$sh = '<font color="red">[ADM]</font>';}
if($users['access']==3){$sh = '<font color="#bce4f4">[MOD]</font>';}
//-----Если пол == 0(мужской)-----//
if($users['sex'] == 0){
if($users['online'] > time()-600){$p = '<img src="/images/icon/race/sex/'.$users['sex'].'.png">';} else {$p = '<img src="/images/icon/race/sex/'.$users['sex'].'-off.png">';}
}elseif($users['sex'] == 1){
if($users['online'] > time()-600){$p = '<img src="/images/icon/race/sex/'.$users['sex'].'.png">';} else {$p = '<img src="/images/icon/race/sex/'.$users['sex'].'-off.png">';}
}
if($users['access'] == 2){
if($users['online'] > time()-600){$p = '<img src="/images/icon/race/sex/adm.png">';} else {$p = '<img src="/images/icon/race/sex/adm-off.png">';}
}
$colors = strong($users['colors']);
$style = strong($users['elita_colors']);
if($users['elita_colors']==0){
return (empty($users)?'[Удален]':''.$p.' '.$sh.' <a href="/user/?id='.$users['id'].'"><font color='.$colors.'>'.$users['login'].'</font></a>');
}else{
return (empty($users)?'[Удален]':''.$p.' '.$sh.' <a href="/user/?id='.$users['id'].'"><font color="'.$users['elita_color'].'" style="text-shadow: 0px 0px 5px;"><span class="baby"><b>'.$users['login'].'</b></span></font></a>');
}
}
/* Вывод оставшегося времени */
function vremja($time=NULL)
{
global $user;
if ($time==NULL)$time=time();
if (isset($user))$time=$time+$user['set_timesdvig']*60*60;
$timep="".date("j M в H:i", $time)."";
$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;
}
function p_1($l){ if($l == 1){ $result = 13400; } elseif($l == 2) { $result = 21700; } elseif($l == 3) { $result = 36100; } elseif($l == 4) { $result = 56000; } elseif($l == 5) { $result = 72000; } elseif($l == 6) { $result = 500; } elseif($l == 7) { $result = 1000; } elseif($l == 8) { $result = 1400; } elseif($l == 9) { $result = 2500; } elseif($l == 10) { $result = 1800; } elseif($l == 11) { $result = 2100; } return $result; } function p_2($l){ if($l == 1){ $result = 9200; } elseif($l == 2) { $result = 11760; } elseif($l == 3) { $result = 22640; } elseif($l == 4) { $result = 35450; } elseif($l == 5) { $result = 56430; } elseif($l == 6) { $result = 500; } elseif($l == 7) { $result = 1000; } elseif($l == 8) { $result = 1400; } elseif($l == 9) { $result = 2500; } elseif($l == 10) { $result = 1800; } return $result; } function p_3($l){ if($l == 1){ $result = 11000; } elseif($l == 2) { $result = 22000; } elseif($l == 3) { $result = 33000; } elseif($l == 4) { $result = 44000; } elseif($l == 5) { $result = 55000; } elseif($l == 6) { $result = 500; } elseif($l == 7) { $result = 1000; } elseif($l == 8) { $result = 1400; } elseif($l == 9) { $result = 2500; } elseif($l == 10) { $result = 1800; } return $result; } function p_4($l){ if($l == 1){ $result = 5000; } elseif($l == 2) { $result = 10000; } elseif($l == 3) { $result = 15000; } elseif($l == 4) { $result = 20000; } elseif($l == 5) { $result = 30000; } elseif($l == 6) { $result = 500; } elseif($l == 7) { $result = 1000; } elseif($l == 8) { $result = 1400; } elseif($l == 9) { $result = 2500; } elseif($l == 10) { $result = 1800; } return $result; } function up_1($l){ if($l == 1){ $result = 10; } elseif($l == 2) { $result = 15; } elseif($l == 3) { $result = 20; } elseif($l == 4) { $result = 25; } elseif($l == 5) { $result = 30; } elseif($l == 6) { $result = 35; } elseif($l == 7) { $result = 40; } elseif($l == 8) { $result = 45; } elseif($l == 9) { $result = 50; } elseif($l == 10) { $result = 55; } return $result; } function up_2($l){ if($l == 1){ $result = 11; } elseif($l == 2) { $result = 13; } elseif($l == 3) { $result = 15; } elseif($l == 4) { $result = 20; } elseif($l == 5) { $result = 25; } elseif($l == 6) { $result = 30; } elseif($l == 7) { $result = 35; } elseif($l == 8) { $result = 40; } elseif($l == 9) { $result = 45; } elseif($l == 10) { $result = 50; } return $result; } function up_3($l){ if($l == 1){ $result = 12; } elseif($l == 2) { $result = 18; } elseif($l == 3) { $result = 36; } elseif($l == 4) { $result = 48; } elseif($l == 5) { $result = 52; } elseif($l == 6) { $result = 66; } elseif($l == 7) { $result = 72; } elseif($l == 8) { $result = 18; } elseif($l == 9) { $result = 84; } elseif($l == 10) { $result = 90; } return $result; } function up_4($l){ if($l == 1){ $result = 4; } elseif($l == 2) { $result = 8; } elseif($l == 3) { $result = 12; } elseif($l == 4) { $result = 16; } elseif($l == 5) { $result = 20; } elseif($l == 6) { $result = 24; } elseif($l == 7) { $result = 28; } elseif($l == 8) { $result = 32; } elseif($l == 9) { $result = 36; } elseif($l == 10) { $result = 40; } return $result; } function cena_m2($id = 0){ $sell = mysql_fetch_array (mysql_query("SELECT * FROM `user_pets` WHERE `id` = '".$id."'")); $cena = mysql_fetch_array (mysql_query("SELECT * FROM `pets_tj` WHERE `name` = '".$sell ['name']."'")); $st = $cena['g']; if($cena['g'] != '0') { $default_money2 = $st / 2; } else { $default_money2 = '0'; } if($sell['tune_1'] < '6') { $tune_1_money2 = '0'; } elseif($sell['tune_1'] == '6') { $tune_1_money2 = '20'; } elseif($sell['tune_1'] == '7') { $tune_1_money2 = '70';
} elseif($sell['tune_1'] == '8') { $tune_1_money2 = '140'; } elseif($sell['tune_1'] == '9') { $tune_1_money2 = '280'; } elseif($sell['tune_1'] == '10') { $tune_1_money2 = '370'; } if($sell['tune_2'] < '6') { $tune_2_money2 = '0'; } elseif($sell['tune_2'] == '6') { $tune_2_money2 = '20'; } elseif($sell['tune_2'] == '7') { $tune_2_money2 = '70'; } elseif($sell['tune_2'] == '8') { $tune_2_money2 = '140'; } elseif($sell['tune_2'] == '9') { $tune_2_money2 = '280'; } elseif($sell['tune_2'] == '10') { $tune_2_money2 = '370'; } if($sell['tune_3'] < '6') { $tune_3_money2 = '0'; } elseif($sell['tune_3'] == '6') { $tune_3_money2 = '20'; } elseif($sell['tune_3'] == '7') { $tune_3_money2 = '70'; } elseif($sell['tune_3'] == '8') { $tune_3_money2 = '140'; } elseif($sell['tune_3'] == '9') { $tune_3_money2 = '280'; } elseif($sell['tune_3'] == '10') { $tune_3_money2 = '370'; } if($sell['tune_4'] < '6') { $tune_4_money2 = '0'; } elseif($sell['tune_4'] == '6') { $tune_4_money2 = '20'; } elseif($sell['tune_4'] == '7') { $tune_4_money2 = '70'; } elseif($sell['tune_4'] == '8') { $tune_4_money2 = '140'; } elseif($sell['tune_4'] == '9') { $tune_4_money2 = '280'; } elseif($sell['tune_4'] == '10') { $tune_4_money2 = '370'; } $count = $default_money2 + $tune_1_money2 + $tune_2_money2 + $tune_3_money2 + $tune_4_money2 ; if($count != 0) { $cnt = $count; } else { $cnt = '0'; } return intval($cnt); } function cena_m($id = 0){ $sell = mysql_fetch_array (mysql_query("SELECT * FROM `user_pets` WHERE `id` = '".$id."'")); $cena = mysql_fetch_array (mysql_query("SELECT * FROM `pets_tj` WHERE `name` = '".$sell ['name']."'")); $st = $cena['rubins']; if($cena['rubins'] != '0') { $default_money = $st / 2; } else { $default_money = '0'; } if($sell['tune_1'] == '2') { $tune_1_money = '670'; } elseif($sell['tune_1'] == '3') { $tune_1_money = '1755'; } elseif($sell['tune_1'] == '4') { $tune_1_money = '3560'; } elseif($sell['tune_1'] == '5') { $tune_1_money = '6360'; } elseif($sell['tune_1'] >= '6') { $tune_1_money = '9960'; } if($sell['tune_2'] == '2') { $tune_2_money = '4600'; } elseif($sell['tune_2'] == '3') { $tune_2_money = '1048'; } elseif($sell['tune_2'] == '4') { $tune_2_money = '2180'; } elseif($sell['tune_2'] == '5') { $tune_2_money = '3952'; } elseif($sell['tune_2'] >= '6') { $tune_2_money = '6773'; } if($sell['tune_3'] == '2') { $tune_3_money = '550'; } elseif($sell['tune_3'] == '3') { $tune_3_money = '1650'; } elseif($sell['tune_3'] == '4') { $tune_3_money = '3300'; } elseif($sell['tune_3'] == '5') { $tune_3_money = '5500'; } elseif($sell['tune_3'] >= '6') { $tune_3_money = '8250'; } if($sell['tune_4'] == '2') { $tune_4_money = '250'; } elseif($sell['tune_4'] == '3') { $tune_4_money = '750'; } elseif($sell['tune_4'] == '4') { $tune_4_money = '1500'; } elseif($sell['tune_4'] == '5') { $tune_4_money = '2500'; } elseif($sell['tune_4'] >= '6') { $tune_4_money = '4000'; } $count = $default_money + $tune_1_money + $tune_2_money + $tune_3_money + $tune_4_money; if($count != 0) { $cnt = $count; } else { $cnt = '0'; } return intval($cnt); }
?>
<?php
// Функция обработки bbCode
function print_page($message)
{
// Разрезаем слишком длинные слова
$message = preg_replace_callback(
"|([a-zа-яd!]{35,})|i",
"split_text",
$message);
// Тэги - [code], [php]
preg_match_all( "#[php](.+)[/php]#isU", $message, $matches );
$cnt = count( $matches[0] );
for ( $i = 0; $i < $cnt; $i++ ) {
$phpBlocks[] = '<div class="codePHP">'.highlight_string( $matches[1][$i], true ).'</div>';
$uniqidPHP = '[php_'.uniqid('').']';
$uniqidsPHP[] = $uniqidPHP;
$message = str_replace( $matches[0][$i], $uniqidPHP, $message );
}
$spaces = array( ' ', "t" );
$entities = array( ' ', ' ' );
preg_match_all( "#[code](.+)[/code]#isU", $message, $matches );
$cnt = count( $matches[0] );
for ( $i = 0; $i < $cnt; $i++ ) {
$codeBlocks[] = '<div class="code">'.nl2br( str_replace( $spaces, $entities, htmlspecialchars( $matches[1][$i] ) ) ).'</div>';
$uniqidCode = '[code_'.uniqid('').']';
$uniqidsCode[] = $uniqidCode;
$message = str_replace( $matches[0][$i], $uniqidCode, $message );
}
// обработка регулярными выражениями bb кодов
$message = htmlspecialchars( $message );
$message = preg_replace("#[b](.+)[/b]#isU", '<b>\1</b>', $message);
$message = preg_replace("#[i](.+)[/i]#isU", '<i>\1</i>', $message);
$message = preg_replace("#[u](.+)[/u]#isU", '<u>\1</u>', $message);
$message = preg_replace("#[quote](.+)[/quote]#isU",'<div class="quoteHead">Цитата</div><div class="quoteContent">\1</div>',$message);
$message = preg_replace("#[quote="([- 0-9a-zа-яА-Я]{1,30})"](.+)[/quote]#isU", '<div class="quoteHead">\1 пишет:</div><div class="quoteContent">\2</div>', $message);
$message = preg_replace("#[url][s]*([S]+)[s]*[/url]#isU",'<a href="\1" target="_blank">\1</a>',$message);
$message = preg_replace("#[url[s]*=[s]*([S]+)[s]*][s]*([^[]*)[/url]#isU",
'<a href="\1" target="_blank">\2</a>',$message);
$message = preg_replace("#[img][s]*([S]+)[s]*[/img]#isU",'<img src="\1" alt="" />',$message);
$message = preg_replace("#[color=red](.+)[/color]#isU",'<span style="color:#FF0000">\1</span>',$message);
$message = preg_replace("#[color=green](.+)[/color]#isU",'<span style="color:#008000">\1</span>',$message);
$message = preg_replace("#[color=blue](.+)[/color]#isU",'<span style="color:#0000FF">\1</span>',$message);
$message = preg_replace_callback("#[list]s*((?:[*].+)+)[/list]#siU",'getUnorderedList',$message);
$message = preg_replace_callback("#[list=([a|1])]s*((?:[*].+)+)[/list]#siU", 'getOrderedList',$message);
// добавляем переносы строк
$message = nl2br( $message);
if ( isset( $uniqidCode ) ) $message = str_replace( $uniqidsCode, $codeBlocks, $message );
if ( isset( $uniqidPHP ) ) $message = str_replace( $uniqidsPHP, $phpBlocks, $message );
// Возвращаем уже код с html вместо bb code
return $message;
}
// New Times
function NewTime($i) {
$d = floor($i / 86400);
$h = floor(($i / 3600) - $d * 24);
$m = floor(($i - $h * 3600 - $d * 86400) / 60);
$s = $i - ($m * 60 + $h * 3600 + $d * 86400);
if($d > 0) {
$result = $d.' д '.$h.' ч.';
}
elseif($h > 0)
{
$result = $h.' ч '.$m.' м.';
}elseif($m > 0)
{
$result = $m.' мин '.$s.' сек.';
}elseif($s >= 0)
{
$result = $s.' сек';
}
return $result;
}
?>