Файл: test.zfarm.mobi/styledb/mystylefnc.php
Строк: 613
<?php
/////////////////////////
/*
Author MyStyle ZomBi.Biz
12/05/2013
*/
/////////////////////////
ob_start();
$time = time();
function msclubstat($stat){
if($stat == 1) $ok = ' (Создатель)';
if($stat == 2) $ok = ' (Заместитель)';
if($stat == 3) $ok = ' (Модератор)';
if($stat == 4) $ok = ' (Оцениватель)';
return $ok;
}
function bbcode($var)
{
// Список поиска
$search = array(
'#[b](.+?)[/b]#is', // Жирный
'#[i](.+?)[/i]#is', // Курсив
'#[u](.+?)[/u]#is', // Подчеркнутый
'#[s](.+?)[/s]#is', // Зачеркнутый
'#[small](.+?)[/small]#is', // Маленький шрифт
'#[big](.+?)[/big]#is', // Большой шрифт
'#[red](.+?)[/red]#is', // Красный
'#[green](.+?)[/green]#is', // Зеленый
'#[blue](.+?)[/blue]#is', // Синий
'![color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z-]+)](.+?)[/color]!is', // Цвет шрифта
'![bg=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z-]+)](.+?)[/bg]!is', // Цвет фона
);
// Список замены
$replace = array(
'<span style="font-weight: bold">$1</span>', // Жирный
'<span style="font-style:italic">$1</span>', // Курсив
'<span style="text-decoration:underline">$1</span>', // Подчеркнутый
'<span style="text-decoration:line-through">$1</span>', // Зачеркнутый
'<span style="font-size:x-small">$1</span>', // Маленький шрифт
'<span style="font-size:large">$1</span>', // Большой шрифт
'<span style="color:red">$1</span>', // Красный
'<span style="color:green">$1</span>', // Зеленый
'<span style="color:blue">$1</span>', // Синий
'<span style="color:$1">$2</span>', // Цвет шрифта
'<span style="background-color:$1">$2</span>', // Цвет фона
);
if(preg_match('#[url=((?:http|https|ftp)://.*?)](.*?)[/url]#', $var))
{
$var = preg_replace('#[url=((?:http|https|ftp)://.*?)](.*?)[/url]#su', '<a href="1">2</a>', $var);
}
elseif(preg_match('#((?:http|https|ftp)://[0-9a-zA-Z._-]+.[0-9a-zA-Z]{2,6}[0-9a-zA-Z/?.~&_=/%-:#+!]*)#', $var))
{
$var = preg_replace('#((?:http|https|ftp)://[0-9a-zA-Z._-]+.[0-9a-zA-Z]{2,6}[0-9a-zA-Z/?.~&_=/%-:#+!]*)#su', '<a target="_blank" href="1">1</a>', $var);
}
return preg_replace($search, $replace, $var);
}
function msg_game($msg)
{
echo "<div class='feedback'><ul class='feedbackPanel'><li class='feedbackPanelINFO'><span class='level'>".$msg."</span></li></ul></div>";
}
function zipcount()
{
$Contents = ob_get_contents();
$gzib_file = strlen($Contents);
$gzib_file_out = strlen(gzcompress($Contents, 9));
$gzib_pro = round(100 - (100 / ($gzib_file / $gzib_file_out)), 1);
echo $gzib_pro . '%';
}
function rl($lr)
{
$llr=$lr+1;
if($llr==2)$lr=5;
elseif($llr==3)$lr=7;
elseif($llr==4)$lr=9;
elseif($llr==5)$lr=15;
elseif($llr==6)$lr=25;
elseif($llr==7)$lr=50;
elseif($llr==8)$lr=100;
elseif($llr==9)$lr=250;
elseif($llr==10)$lr=500;
elseif($llr==11)$lr=1000;
elseif($llr==12)$lr=2000;
else $lr=0;
return $lr;
}
function what($rm = 0, $room = NULL)
{
global $user, $id, $last_visit;
if (isset($user['id'])) {
mysql_query("UPDATE `mystyle_user` SET `room` = '$room' WHERE `id` = '$user[id]'");
}
}
function update_payment($field,$value,$field2,$value2,$field3,$value3,$field4,$value4)
{
mysql_query("INSERT INTO `mystyle_payment` SET `".$field."` = '".$value."', `".$field2."` = '".$value2."', `".$field3."` = '".$value3."', `".$field4."` = '".$value4."'");
return $value;
}
function update_payment_user($field,$value,$field2,$value2,$field3,$value3,$field4,$value4)
{
mysql_query("INSERT INTO `mystyle_payment_user` SET `".$field."` = '".$value."', `".$field2."` = '".$value2."', `".$field3."` = '".$value3."', `".$field4."` = '".$value4."'");
return $value;
}
function insert_webmoney_user($field,$value,$field2,$value2,$field3,$value3,$field4,$value4,$field5,$value5,$field6,$value6)
{
mysql_query("INSERT INTO `mystyle_webmoney_user` SET `".$field."` = '".$value."', `".$field2."` = '".$value2."', `".$field3."` = '".$value3."', `".$field4."` = '".$value4."', `".$field5."` = '".$value5."', `".$field6."` = '".$value6."'");
return $value;
}
function update_web_user($field,$value,$field2,$value2)
{
mysql_query("UPDATE `mystyle_webmoney_user` SET `".$field."` = '".$value."' WHERE `".$field2."` = '".$value2."'");
return $value;
}
function update_user_web($field,$value,$field2,$value2)
{
mysql_query("UPDATE `mystyle_user` SET `".$field."` = '".$value."' WHERE `".$field2."` = '".$value2."'");
return $value;
}
function style_time($time=NULL)
{
global $user;
if ($time==NULL)$time=time();
if (isset($user))$time=$time+$user['set_timesdvig']*60*60;
$timep="".date("j M Y в H:i", $time)."";
$time_p[0]=date("j n Y", $time);
$time_p[1]=date("H:i", $time);
if ($time_p[0]==date("j n Y"))$timep=date("H:i:s", $time);
if (isset($user)){
if ($time_p[0]==date("j n Y", time()+$user['set_timesdvig']*60*60))$timep=date("H:i:s", $time);
if ($time_p[0]==date("j n Y", time()-60*60*(24-$user['set_timesdvig'])))$timep="Вчера в $time_p[1]";}
else{
if ($time_p[0]==date("j n Y"))$timep=date("H:i:s", $time);
if ($time_p[0]==date("j n Y", time()-60*60*24))$timep="Вчера в $time_p[1]";}
$timep=str_replace("Jan","Янв",$timep);
$timep=str_replace("Feb","Фев",$timep);
$timep=str_replace("Mar","Марта",$timep);
$timep=str_replace("May","Мая",$timep);
$timep=str_replace("Apr","Апр",$timep);
$timep=str_replace("Jun","Июня",$timep);
$timep=str_replace("Jul","Июля",$timep);
$timep=str_replace("Aug","Авг",$timep);
$timep=str_replace("Sep","Сент",$timep);
$timep=str_replace("Oct","Окт",$timep);
$timep=str_replace("Nov","Ноября",$timep);
$timep=str_replace("Dec","Дек",$timep);
return $timep;
}
function cut_msg($text)
{
$text = substr($text, 0, 50);
return $text;
}
function cut_msg_news($text)
{
$text = substr($text, 0, 25);
return $text;
}
function trun_to_rus($in)
{
$trans1 = array("JO","ZH","CH","SH","SCH","JE","JY","JA","jo","zh","ch","sh","sch","je","jy","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","'","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","'","y");
$trans2 = array("Ё","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы");
return str_replace($trans1, $trans2, $in);
}
function check($message)
{
$message = htmlspecialchars($message, ENT_QUOTES);
$message = nl2br($message);
$message = strtr($message, array(chr("0") => "", chr("1") => "", chr("2") => "", chr("3") => "", chr("4") => "", chr("5") => "", chr("6") => "", chr("7") => "", chr("8") => "", chr("9") => "", chr("10") => "", chr("11") => "", chr("12") => "", chr
("13") => "", chr("14") => "", chr("15") => "", chr("16") => "", chr("17") => "", chr("18") => "", chr("19") => "", chr("20") => "", chr("21") => "", chr("22") => "", chr("23") => "", chr("24") => "", chr("25") => "", chr("26") => "", chr("27") =>
"", chr("28") => "", chr("29") => "", chr("30") => "", chr("31") => ""));
$message = iconv('utf-8', 'windows-1251', $message);
$message = iconv('windows-1251', 'utf-8', $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 = preg_replace("|:|",":",$message,3);
$message = stripslashes($message);
return $message;
}
function rus_to_k($str)
{
$str = str_replace("а","a",$str);
$str = str_replace("б","b",$str);
$str = str_replace("в","v",$str);
$str = str_replace("г","g",$str);
$str = str_replace("д","d",$str);
$str = str_replace("е","e",$str);
$str = str_replace("ё","e",$str);
$str = str_replace("ж","j",$str);
$str = str_replace("з","z",$str);
$str = str_replace("и","i",$str);
$str = str_replace("й","y",$str);
$str = str_replace("к","k",$str);
$str = str_replace("л","l",$str);
$str = str_replace("м","m",$str);
$str = str_replace("н","n",$str);
$str = str_replace("о","o",$str);
$str = str_replace("п","p",$str);
$str = str_replace("р","r",$str);
$str = str_replace("с","s",$str);
$str = str_replace("т","t",$str);
$str = str_replace("у","u",$str);
$str = str_replace("ф","f",$str);
$str = str_replace("х","h",$str);
$str = str_replace("ч","c",$str);
$str = str_replace("ц","q",$str);
$str = str_replace("ш","w",$str);
$str = str_replace("щ",">",$str);
$str = str_replace("ь","<",$str);
$str = str_replace("ы","x",$str);
$str = str_replace("ъ",".",$str);
$str = str_replace("э",":",$str);
$str = str_replace("ю",";",$str);
$str = str_replace("я","}",$str);
$str = str_replace("А","a",$str);
$str = str_replace("Б","b",$str);
$str = str_replace("В","v",$str);
$str = str_replace("Г","g",$str);
$str = str_replace("Д","d",$str);
$str = str_replace("Е","e",$str);
$str = str_replace("Ё","e",$str);
$str = str_replace("Ж","j",$str);
$str = str_replace("З","z",$str);
$str = str_replace("И","i",$str);
$str = str_replace("Й","y",$str);
$str = str_replace("К","k",$str);
$str = str_replace("Л","l",$str);
$str = str_replace("М","m",$str);
$str = str_replace("Н","n",$str);
$str = str_replace("О","o",$str);
$str = str_replace("П","p",$str);
$str = str_replace("Р","r",$str);
$str = str_replace("С","s",$str);
$str = str_replace("Т","t",$str);
$str = str_replace("У","u",$str);
$str = str_replace("Ф","f",$str);
$str = str_replace("Х","h",$str);
$str = str_replace("Ч","c",$str);
$str = str_replace("Ц","q",$str);
$str = str_replace("Ш","w",$str);
$str = str_replace("Щ",">",$str);
$str = str_replace("Ь","<",$str);
$str = str_replace("Ы","x",$str);
$str = str_replace("Ъ",".",$str);
$str = str_replace("Э",":",$str);
$str = str_replace("Ю",";",$str);
$str = str_replace("Я","}",$str);
return $str;
}
function mat($var)
{
$pattern = "/w{0,5}[хx]([хxs!@#$%^&*+-|/]{0,6})[уy]([уys!@#$%^&*+-|/]{0,6})[ёiлeеюийя]w{0,7}|w{0,6}[пp]([пps!@#$%^&*+-|/]{0,6})[iие]([iиеs!@#$%^&*+-|/]{0,6})[3зс]([3зсs!@#$%^&*+-|/]{0,6})[дd]w{0,10}|[сcs][уy]([уy!@#$%^&*+-|/]{0,6})[4чkк]w{1,3}|w{0,4}[bб]([bбs!@#$%^&*+-|/]{0,6})[lл]([lлs!@#$%^&*+-|/]{0,6})[yя]w{0,10}|w{0,8}[её][bб][лске@eыиаa][наи@йвл]w{0,8}|w{0,4}[еe]([еes!@#$%^&*+-|/]{0,6})[бb]([бbs!@#$%^&*+-|/]{0,6})[uу]([uуs!@#$%^&*+-|/]{0,6})[н4ч]w{0,4}|w{0,4}[еeё]([еeёs!@#$%^&*+-|/]{0,6})[бb]([бbs!@#$%^&*+-|/]{0,6})[нn]([нns!@#$%^&*+-|/]{0,6})[уy]w{0,4}|w{0,4}[еe]([еes!@#$%^&*+-|/]{0,6})[бb]([бbs!@#$%^&*+-|/]{0,6})[оoаa@]([оoаa@s!@#$%^&*+-|/]{0,6})[тnнt]w{0,4}|w{0,10}[ё]([ё!@#$%^&*+-|/]{0,6})[б]w{0,6}|w{0,4}[pп]([pпs!@#$%^&*+-|/]{0,6})[иeеi]([иeеis!@#$%^&*+-|/]{0,6})[дd]([дds!@#$%^&*+-|/]{0,6})[oоаa@еeиi]([oоаa@еeиis!@#$%^&*+-|/]{0,6})[рr]w{0,12}/iu";
$replacement = '<font color="#FF0000">•</font>';
$var = preg_replace($pattern, $replacement, $var);
return $var;
}
function smile($text)
{
$sm = mysql_query("SELECT `name`, `path` FROM `mystyle_smile`");
while($as = mysql_fetch_assoc($sm)) {
$text = strtr($text, array(
''.$as['name'].''=>'<img src="/'.$as['path'].'" alt=""/>'));
}
return $text;
}
function passgen($k_simb=8, $types=3) {
$password="";
$small="abcdefghijklmnopqrstuvwxyz";
$large="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$numbers="1234567890";
mt_srand((double)microtime()*1000000);
for ($i=0; $i<$k_simb; $i++) {
$type=mt_rand(1,min($types,3));
switch ($type) {
case 3:
$password.=$large[mt_rand(0,25)];
break;
case 2:
$password.=$small[mt_rand(0,25)];
break;
case 1:
$password.=$numbers[mt_rand(0,9)];
break;
}
}
return $password;
}
$passgen=&passgen();
function cpg($count)
{
$count=$count+1;
if($count==0)$cena=1;
elseif($count==1)$cena=2;
elseif($count==2)$cena=5;
elseif($count==3)$cena=10;
elseif($count==4)$cena=15;
elseif($count==5)$cena=20;
elseif($count==6)$cena=25;
elseif($count==7)$cena=50;
elseif($count==8)$cena=100;
elseif($count==9)$cena=250;
elseif($count>=10 && $count<=12)$cena=500;
elseif($count>=13 && $count<=20)$cena=1000;
else $cena=100000;
return $cena;
}
function br($msg,$br='<br />'){return eregi_replace("((<br( ?/?)>)|n|r)+",$br, $msg);} // переносы строк
function hsc($text)
{
return htmlspecialchars($text);
}
function num($var)
{
$var=abs(intval($var));
if(!preg_match('/[0-9]/i',$var) && !is_numeric($var)){$var=false;}
if($var<0){$var=false;}
return $var;
}
function my_esc($str){
return mysql_real_escape_string($str);
}
function encrypt($var)
{
return md5(base64_encode($var) .'StyleCMS');
}
function sql($var)
{
return mysql_real_escape_string(trim($var));
}
function page($k_page=1){ // Выдает текущую страницу
$page=1;
if (isset($_GET['page'])){
if ($_GET['page']=='end')$page=intval($k_page);elseif(is_numeric($_GET['page'])) $page=intval($_GET['page']);}
if ($page<1)$page=1;
if ($page>$k_page)$page=$k_page;
return $page;}
function k_page($k_post=0,$k_p_str=10){ // Высчитывает количество страниц
if ($k_post!=0){$v_pages=ceil($k_post/$k_p_str);return $v_pages;}
else return 1;}
function str($link='?',$k_page=1,$page=1){ // Вывод номеров страниц (только на первый взгляд кажется сложно ;))
if ($page<1)$page=1;
if ($page!=1)echo "<a class='btnp' href="".$link."page=1" title='Первая страница'><div class='pg'><<</div></a> ";
if ($page!=1)echo "<span><a class='btnp' href="".$link."page=1" title='Страница №1'><div class='pg'>1</div></a></span>";else echo "<span class="emptyPanel pg"><div class='pg'><b>1</b></div></span>";
for ($ot=-3; $ot<=3; $ot++){
if ($page+$ot>1 && $page+$ot<$k_page){
if ($ot==-3 && $page+$ot>2)echo " ...";
if ($ot!=0)echo " <span><a class='btnp' href="".$link."page=".($page+$ot)."" title='Страница №".($page+$ot)."'><div class='pg'>".($page+$ot)."</div></a></span>";else echo " <span class="emptyPanel pg"><div class='pg'><b>".($page+$ot)."</b></div></span>";
if ($ot==3 && $page+$ot<$k_page-1)echo " ...";}}
if ($page!=$k_page)echo " <span><a class='btnp' href="".$link."page=end" title='Страница №$k_page'><div class='pg'>$k_page</div></a>";elseif ($k_page>1)echo " <span class="emptyPanel pg"><div class='pg'><b>$k_page</b></div></span>";
if ($page!=$k_page)echo " <a class='' href="".$link."page=end" title='Последняя страница'><div class='pg'><img width='33' height='33' src='images/next.png' alt=''></div></a>";
}
function insert_chat($field,$value,$field2,$value2,$field3,$value3,$field4,$value4)
{
mysql_query("INSERT INTO `mystyle_room` SET `".$field."` = '".$value."', `".$field2."` = '".$value2."', `".$field3."` = '".$value3."', `".$field4."` = '".$value4."'");
return $value;
}
function style($time=NULL)
{
global $user;
if ($time==NULL)$time=time();
if (isset($user))$time=$time+$user['set_timesdvig']*60*60;
$timep="".date("j M Y в H:i", $time)."";
$time_p[0]=date("j n Y", $time);
$time_p[1]=date("H:i", $time);
if ($time_p[0]==date("j n Y"))$timep=date("H:i:s", $time);
if (isset($user)){
if ($time_p[0]==date("j n Y", time()+$user['set_timesdvig']*60*60))$timep=date("H:i:s", $time);
if ($time_p[0]==date("j n Y", time()-60*60*(24-$user['set_timesdvig'])))$timep="Вчера в $time_p[1]";}
else{
if ($time_p[0]==date("j n Y"))$timep=date("H:i:s", $time);
if ($time_p[0]==date("j n Y", time()-60*60*24))$timep="Вчера в $time_p[1]";}
$timep=str_replace("Jan","Янв",$timep);
$timep=str_replace("Feb","Фев",$timep);
$timep=str_replace("Mar","Марта",$timep);
$timep=str_replace("May","Мая",$timep);
$timep=str_replace("Apr","Апр",$timep);
$timep=str_replace("Jun","Июня",$timep);
$timep=str_replace("Jul","Июля",$timep);
$timep=str_replace("Aug","Авг",$timep);
$timep=str_replace("Sep","Сент",$timep);
$timep=str_replace("Oct","Окт",$timep);
$timep=str_replace("Nov","Ноября",$timep);
$timep=str_replace("Dec","Дек",$timep);
return $timep;
}
function update_farm($field,$value,$field2,$value2,$field3,$value3,$field4,$value4,$field5,$value5,$field6,$value6,$field7,$value7,$field8,$value8)
{
global $user;
mysql_query("UPDATE `mystyle_farm` SET `".$field2."` = '".$value2."', `".$field3."` = '".$value3."', `".$field4."` = '".$value4."', `".$field5."` = '".$value5."', `".$field6."` = '".$value6."', `".$field7."` = '".$value7."', `".$field8."` = '".$value8."' WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function err_redpack($field)
{
echo '<div class="feedbackPanel">
<span>Вам не хватает</span> <span><span class="money nobr textshadow">Удобрения <span>'.$field.'</span></span></span>
</div>';
}
function err_corm($field)
{
echo '<div class="feedbackPanel">
<span>Вам не хватает</span> <span><span class="money nobr textshadow">Корма <span>'.$field.'</span></span></span>
</div>';
}
function err_ruby($field)
{
echo '<div class="feedbackPanel">
<span>Вам не хватает</span> <span><span class="money nobr textshadow"><img width="16" height="16" src="images/zombi/cash.png" alt=""/> <span>'.$field.'</span></span></span>
</div><a class="btn" style="text-align: center;" href="?linkpayment&link">
<img src="images/zombi/cash.png" width="16" height="16" alt="o"/>
Купить зомби баксы
</a>';
}
function err_money($field)
{
echo '<div class="feedbackPanel">
<span>Вам не хватает</span> <span><span class="money nobr textshadow"><img width="16" height="16" src="images/zombi/coins.png" alt=""/> <span>'.$field.'</span></span></span>
</div><a class="btn" style="text-align: center;" href="?linkpayment&link">
<img src="images/zombi/coins.png" width="16" height="16" alt="o"/>
Купить монеты
</a>';
}
function err_machete($field)
{
echo '<div class="feedbackPanel">
<span>Вам не хватает</span> <span><span class="money nobr textshadow">(Мачете) - <span>'.$field.'</span></span></span>
</div>';
}
function err_soil($field)
{
echo '<div class="feedbackPanel">
<span>Вам не хватает</span> <span><span class="money nobr textshadow"> (Нефти) или (Черных сердец)</span></span>
</div>';
}
function update_minus($field,$value)
{
global $user;
mysql_query("UPDATE `mystyle_user` SET `".$field."` = '".($user[''.$field.'']-$value)."' WHERE `id` = '".$user['id']."'");
return $value;
}
function update_plus($field,$value)
{
global $user;
mysql_query("UPDATE `mystyle_user` SET `".$field."` = '".($user[''.$field.'']+$value)."' WHERE `id` = '".$user['id']."'");
return $value;
}
function time_lefts($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?"$hour00":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";
}
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 Y в H:i", $time)."";
$time_p[0]=date("j n Y", $time);
$time_p[1]=date("H:i", $time);
if ($time_p[0]==date("j n Y"))$timep=date("H:i:s", $time);
if (isset($user)){
if ($time_p[0]==date("j n Y", time()+$user['set_timesdvig']*60*60))$timep=date("H:i:s", $time);
if ($time_p[0]==date("j n Y", time()-60*60*(24-$user['set_timesdvig'])))$timep="Вчера в $time_p[1]";}
else{
if ($time_p[0]==date("j n Y"))$timep=date("H:i:s", $time);
if ($time_p[0]==date("j n Y", time()-60*60*24))$timep="Вчера в $time_p[1]";}
$timep=str_replace("Jan","Янв",$timep);
$timep=str_replace("Feb","Фев",$timep);
$timep=str_replace("Mar","Марта",$timep);
$timep=str_replace("May","Мая",$timep);
$timep=str_replace("Apr","Апр",$timep);
$timep=str_replace("Jun","Июня",$timep);
$timep=str_replace("Jul","Июля",$timep);
$timep=str_replace("Aug","Авг",$timep);
$timep=str_replace("Sep","Сент",$timep);
$timep=str_replace("Oct","Окт",$timep);
$timep=str_replace("Nov","Ноября",$timep);
$timep=str_replace("Dec","Дек",$timep);
return $timep;
}
function time_left($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";
}
function delete_farm($field,$value)
{
global $user;
mysql_query("DELETE FROM `mystyle_farm` WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function update_farm_user($field,$value,$field2,$value2,$field3,$value3,$field4,$value4,$field5,$value5,$field6,$value6)
{
global $user;
mysql_query("UPDATE `mystyle_farm` SET `".$field2."` = '".$value2."', `".$field3."` = '".$value3."', `".$field4."` = '".$value4."', `".$field5."` = '".$value5."', `".$field6."` = '".$value6."' WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function update_user($field,$value)
{
global $user;
mysql_query("UPDATE `mystyle_user` SET `".$field."` = '".$value."' WHERE `id` = '".$user['id']."'");
return $value;
}
function update_log($field,$value,$field2,$value2,$field3,$value3)
{
mysql_query("INSERT INTO `mystyle_log` SET `".$field."` = '".$value."', `".$field2."` = '".$value2."', `".$field3."` = '".$value3."'");
return $value;
}
function strlen2($str)
{
$rus=array('й','ц','у','к','е','н','г','ш','щ','з','х','ъ','ф','ы','в','а','п','р','о','л','д','ж','э','я','ч','с','м','и','т','ь','б','ю','Й','Ц','У','К','Е','Н','Г','Ш','Щ','З','Х','Ъ','Ф','Ы','В','А','П','Р','О','Л','Д','Ж','Э','Я','Ч','С','М','И','Т','Ь','Б','Ю');
return strlen(str_replace($rus, '0', $str));
}
function err_game($msg)
{
echo "<div class='feedback'><ul class='feedbackPanel'><li class='feedbackPanelERROR'><span class='feedbackPanelERROR'>$msg</span></li></ul></div>";
}
function update_user_zadaniya($field,$value,$field1,$value1)
{
global $user;
mysql_query("UPDATE `mystyle_zadaniya` SET `".$field1."` = '".$value1."' WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function delete_zadaniya($field,$value)
{
global $user;
mysql_query("DELETE FROM `mystyle_zadaniya` WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function insert_sclad($field1,$value1,$field2,$value2,$field3,$value3,$field4,$value4,$field5,$value5,$field6,$value6)
{
mysql_query("INSERT INTO `mystyle_sklad` SET `".$field1."` = '".$value1."', `".$field2."` = '".$value2."', `".$field3."` = '".$value3."', `".$field4."` = '".$value4."', `".$field5."` = '".$value5."', `".$field6."` = '".$value6."'");
return $value;
}
function update_sclad($field,$value,$field1,$value1)
{
global $user;
mysql_query("UPDATE `mystyle_sklad` SET `".$field1."` = '".$value1."' WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function insert_decor($field1,$value1,$field2,$value2,$field3,$value3,$field4,$value4,$field5,$value5,$field6,$value6,$field7,$value7,$field8,$value8)
{
mysql_query("INSERT INTO `mystyle_decor_user` SET `".$field1."` = '".$value1."', `".$field2."` = '".$value2."', `".$field3."` = '".$value3."', `".$field4."` = '".$value4."', `".$field5."` = '".$value5."', `".$field6."` = '".$value6."', `".$field7."` = '".$value7."', `".$field8."` = '".$value8."'");
return $value;
}
function update_decor($field,$value,$field1,$value1)
{
global $user;
mysql_query("UPDATE `mystyle_decor_user` SET `".$field1."` = '".$value1."' WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function delete_decor($field,$value)
{
global $user;
mysql_query("DELETE FROM `mystyle_decor_user` WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function delete_sklad($field,$value)
{
global $user;
mysql_query("DELETE FROM `mystyle_sklad` WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function users($id){
$users = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_user` WHERE `id` = '$id'"));
$t=time()-600;
if($users['date_last']<=$t)
{
if($users['pol'] == 2)
{
echo '<img src="images/icons/user_avatar_male_offline.png" alt="image" width="16" height="16"/>';
}else{
echo '<img src="images/icons/user_avatar_female_offline.png" alt="image" width="16" height="16"/>';
}
}else{
if($users['pol'] == 2)
{
echo '<img src="images/icons/user_avatar_male.png" alt="image" width="16" height="16"/>';
}else{
echo '<img src="images/icons/user_avatar_female.png" alt="image" width="16" height="16"/>';
}
}
if($users['admin'] == 1)$color = 'tasty';
if($users['admin'] == 2)$color = 'level';
if($users['admin'] == 3)$color = 'level';
if($users['admin'] == 1)$admin = '(Админ)';
if($users['admin'] == 2)$admin = '(Модер)';
if($users['admin'] == 3)$admin = '(Помошник)';
$wertyu = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_msbury` WHERE `who` = '".$users['id']."'"));
if($wertyu['type'] == 0){
$who_bury = '<img width="15" height="15" src="images/mscrypt/m_anim_zomb_hand.png" alt="Не закопан" title="Не закопан" />';
}
if($wertyu['type'] == 1){
$who_bury = '<img width="15" height="15" src="images/mscrypt/ny_25.png" alt="Закопан" title="Закопан" />';
}
echo ' <a class="blueLink" href="?profile='.$users['id'].'"><span class="'.$color.'">'.$users['nick'].'</span> '.@$who_bury.' '.$admin.'</a>';
}
function insert_shahta($field1,$value1,$field2,$value2,$field3,$value3,$field4,$value4,$field5,$value5)
{
mysql_query("INSERT INTO `mystyle_shahta` SET `".$field1."` = '".$value1."', `".$field2."` = '".$value2."', `".$field3."` = '".$value3."', `".$field4."` = '".$value4."', `".$field5."` = '".$value5."'");
return $value;
}
function delete_shahta($field,$value)
{
global $user;
mysql_query("DELETE FROM `mystyle_shahta` WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function delete_oil($field,$value)
{
global $user;
mysql_query("DELETE FROM `mystyle_oil` WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function delete_slonik($field,$value)
{
global $user;
mysql_query("DELETE FROM `mystyle_slonik` WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function delete_yayca($field,$value)
{
global $user;
mysql_query("DELETE FROM `mystyle_yayca` WHERE `".$field."` = '".$value."' AND `user` = '".$user['id']."'");
return $value;
}
function rating($rating)
{
$g=floor($rating/1000000000);
$m=floor($rating/1000000);
$k=floor($rating/1000);
if($g!=0)
{
$g=$rating/1000000000;
$rating=round($g,1);
$rating="$rating г.";
}
elseif($m!=0)
{
$m=$rating/1000000;
$rating=round($m,1);
$rating="$rating м.";
}
elseif($k!=0)
{
$k=$rating/1000;
$rating=round($k,1);
$rating="$rating к.";
}
else $rating=(int)$rating;
return "$rating";
}
function update_an_user($field1,$value1,$field2,$value2,$field3,$value3,$field4,$value4,$field5,$value5,$field6,$value6,$field7,$value7,$field8,$value8,$field9,$value9)
{
global $user;
mysql_query("UPDATE `mystyle_amimals_user` SET `".$field2."` = '".$value2."', `".$field3."` = '".$value3."', `".$field4."` = '".$value4."', `".$field5."` = '".$value5."', `".$field6."` = '".$value6."', `".$field7."` = '".$value7."', `".$field8."` = '".$value8."', `".$field9."` = '".$value9."' WHERE `".$field1."` = '".$value1."' AND `user` = '".$user['id']."'");
return $value;
}
function update_animal_user($field1,$value1,$field2,$value2)
{
global $user;
mysql_query("UPDATE `mystyle_amimals_user` SET `".$field2."` = '".$value2."' WHERE `".$field1."` = '".$value1."' AND `user` = '".$user['id']."'");
return $value;
}
function update_farm_user_ud($field1,$value1,$field2,$value2)
{
global $user;
mysql_query("UPDATE `mystyle_farm` SET `".$field2."` = '".$value2."' WHERE `".$field1."` = '".$value1."' AND `user` = '".$user['id']."'");
return $value;
}
function insert_futboll_user($field1,$value1,$field2,$value2,$field3,$value3)
{
mysql_query("INSERT INTO `mystyle_command_user` SET `".$field1."` = '".$value1."', `".$field2."` = '".$value2."', `".$field3."` = '".$value3."'");
return $value;
}
function update_futboll_user($field1,$value1,$field2,$value2)
{
global $user;
mysql_query("UPDATE `mystyle_command_user` SET `".$field2."` = '".$value2."' WHERE `".$field1."` = '".$value1."'");
return $value;
}
function update_futboll_user_commandy($field1,$value1,$field2,$value2,$field3,$value3)
{
global $user;
mysql_query("UPDATE `mystyle_commandy` SET `".$field2."` = '".$value2."', `".$field3."` = '".$value3."' WHERE `".$field1."` = '".$value1."'");
return $value;
}
function update_user_online($field1,$value1,$field2,$value2)
{
global $user;
mysql_query("UPDATE `mystyle_user` SET `".$field2."` = '".$value2."' WHERE `".$field1."` = '".$value1."'");
return $value;
}
function url_img($link,$img,$name,$title){
echo '<li><a class="btn" href="'.$link.'" title="'.$title.'"><img width="16" height="16" src="'.$img.'" alt=""> '.$name.'</a></li>';
return $value;
}
function url($class,$link,$name){
echo '<li><a class="'.$class.'" href="'.$link.'""> '.$name.'</a></li>';
return $value;
}
/////////////////////////
/*
Author MyStyle ZomBi.Biz
12/05/2013
*/
/////////////////////////
?>