<?php
//смайлы
function smiles($txtsob)
{
global $status, $postov;
if($status == "uzer" || $status == "moder" || $status == "admin")
{
$txtsob =str_replace(":)","<img src='../img/1.gif' alt=''>",$txtsob);
$txtsob =str_replace(":-)","<img src='../img/1.gif' alt=''>",$txtsob);
$txtsob =str_replace(":(","<img src='../img/2.gif' alt=''>",$txtsob);
$txtsob =str_replace(":-(","<img src='../img/2.gif' alt=''>",$txtsob);
$txtsob =str_replace(":aaa:","<img src='../img/aaa.gif' alt=''>",$txtsob);
$txtsob =str_replace(":airkiss:","<img src='../img/airkiss.gif' alt=''>",$txtsob);
$txtsob =str_replace(":atlet:","<img src='../img/atlet.gif' alt=''>",$txtsob);
$txtsob =str_replace(":baby:","<img src='../img/baby.gif' alt=''>",$txtsob);
$txtsob =str_replace(":be:","<img src='../img/be.gif' alt=''>",$txtsob);
$txtsob =str_replace(":blin:","<img src='../img/blin.gif' alt=''>",$txtsob);
$txtsob =str_replace(":blum:","<img src='../img/blum.gif' alt=''>",$txtsob);
$txtsob =str_replace(":bounce:","<img src='../img/bounce.gif' alt=''>",$txtsob);
$txtsob =str_replace(":bugaga:","<img src='../img/bugaga.gif' alt=''>",$txtsob);
$txtsob =str_replace(":buhoj:","<img src='../img/buhoj.gif' alt=''>",$txtsob);
$txtsob =str_replace(":bwink:","<img src='../img/bwink.gif' alt=''>",$txtsob);
$txtsob =str_replace(":D:","<img src='../img/D.gif' alt=''>",$txtsob);
$txtsob =str_replace(":D","<img src='../img/D.gif' alt=''>",$txtsob);
$txtsob =str_replace(":exercise:","<img src='../img/exercise.gif' alt=''>",$txtsob);
$txtsob =str_replace(":fingal:","<img src='../img/fingal.gif' alt=''>",$txtsob);
$txtsob =str_replace(":flirt:","<img src='../img/flirt.gif' alt=''>",$txtsob);
$txtsob =str_replace(":flood:","<img src='../img/flood.gif' alt=''>",$txtsob);
$txtsob =str_replace(":fuck:","<img src='../img/fuck.gif' alt=''>",$txtsob);
$txtsob =str_replace(":girl_blum:","<img src='../img/girl_blum.gif' alt=''>",$txtsob);
$txtsob =str_replace(":girl_cry:","<img src='../img/girl_cry.gif' alt=''>",$txtsob);
$txtsob =str_replace(":girl_hide:","<img src='../img/girl_hide.gif' alt=''>",$txtsob);
$txtsob =str_replace(":girl_wink:","<img src='../img/girl_wink.gif' alt=''>",$txtsob);
$txtsob =str_replace(":girls:","<img src='../img/girls.gif' alt=''>",$txtsob);
$txtsob =str_replace(":happy:","<img src='../img/happy.gif' alt=''>",$txtsob);
$txtsob =str_replace(":hello:","<img src='../img/hello.gif' alt=''>",$txtsob);
$txtsob =str_replace(":help:","<img src='../img/help.gif' alt=''>",$txtsob);
$txtsob =str_replace(":help2:","<img src='../img/help2.gif' alt=''>",$txtsob);
$txtsob =str_replace(":klass:","<img src='../img/klass.gif' alt=''>",$txtsob);
$txtsob =str_replace(":krut:","<img src='../img/krut.gif' alt=''>",$txtsob);
$txtsob =str_replace(":krutoy:","<img src='../img/krutoy.gif' alt=''>",$txtsob);
$txtsob =str_replace(":kuku:","<img src='../img/kuku.gif' alt=''>",$txtsob);
$txtsob =str_replace(":kulak:","<img src='../img/kulak.gif' alt=''>",$txtsob);
$txtsob =str_replace(":lamer:","<img src='../img/lamer.gif' alt=''>",$txtsob);
$txtsob =str_replace(":mister:","<img src='../img/mister.gif' alt=''>",$txtsob);
$txtsob =str_replace(":musik:","<img src='../img/musik.gif' alt=''>",$txtsob);
$txtsob =str_replace(":nea:","<img src='../img/nea.gif' alt=''>",$txtsob);
$txtsob =str_replace(":nozh:","<img src='../img/nozh.gif' alt=''>",$txtsob);
$txtsob =str_replace(":nyam2:","<img src='../img/nyam2.gif' alt=''>",$txtsob);
$txtsob =str_replace(":obana:","<img src='../img/obana.gif' alt=''>",$txtsob);
$txtsob =str_replace(":oops:","<img src='../img/oops.gif' alt=''>",$txtsob);
$txtsob =str_replace(":oy:","<img src='../img/oy.gif' alt=''>",$txtsob);
$txtsob =str_replace(":pistolet:","<img src='../img/pistolet.gif' alt=''>",$txtsob);
$txtsob =str_replace(":proud:","<img src='../img/proud.gif' alt=''>",$txtsob);
$txtsob =str_replace(":rap:","<img src='../img/rap.gif' alt=''>",$txtsob);
$txtsob =str_replace(":respekt:","<img src='../img/respekt.gif' alt=''>",$txtsob);
$txtsob =str_replace(":rok:","<img src='../img/rok.gif' alt=''>",$txtsob);
$txtsob =str_replace(":shok2:","<img src='../img/shok2.gif' alt=''>",$txtsob);
$txtsob =str_replace(":smert:","<img src='../img/smert.gif' alt=''>",$txtsob);
$txtsob =str_replace(":spy:","<img src='../img/spy.gif' alt=''>",$txtsob);
$txtsob =str_replace(":svist:","<img src='../img/svist.gif' alt=''>",$txtsob);
$txtsob =str_replace(":love_site:","<img src='../img/love_site.gif' alt=''>",$txtsob);
$txtsob =str_replace(":xaxa:","<img src='../img/xaxa.gif' alt=''>",$txtsob);
}
if($postov >= "500" || $status == "moder" || $status == "admin")//VIP смайлы
{
$txtsob =str_replace(":zygi:","<img src='../img/zygi.gif' alt=''>",$txtsob);
$txtsob =str_replace(":zhopa:","<img src='../img/zhopa.gif' alt=''>",$txtsob);
$txtsob =str_replace(":yy0mz:","<img src='../img/yy0mz.gif' alt=''>",$txtsob);
$txtsob =str_replace(":yahoo:","<img src='../img/yahoo.gif' alt=''>",$txtsob);
$txtsob =str_replace(":to_babru:","<img src='../img/to_babru.gif' alt=''>",$txtsob);
$txtsob =str_replace(":tease:","<img src='../img/tease.gif' alt=''>",$txtsob);
$txtsob =str_replace(":szampan:","<img src='../img/szampan.gif' alt=''>",$txtsob);
$txtsob =str_replace(":starwars:","<img src='../img/starwars.gif' alt=''>",$txtsob);
$txtsob =str_replace(":slil:","<img src='../img/slil.gif' alt=''>",$txtsob);
$txtsob =str_replace(":russian_roulette:","<img src='../img/russian_roulette.gif' alt=''>",$txtsob);
$txtsob =str_replace(":russian:","<img src='../img/russian.gif' alt=''>",$txtsob);
$txtsob =str_replace(":russi_2faws:","<img src='../img/russi_2faws.gif' alt=''>",$txtsob);
$txtsob =str_replace(":rembo:","<img src='../img/rembo.gif' alt=''>",$txtsob);
$txtsob =str_replace(":pooh_door:","<img src='../img/pooh_door.gif' alt=''>",$txtsob);
$txtsob =str_replace(":perdun:","<img src='../img/perdun.gif' alt=''>",$txtsob);
$txtsob =str_replace(":patstulom:","<img src='../img/patstulom.gif' alt=''>",$txtsob);
$txtsob =str_replace(":offtopic-2:","<img src='../img/offtopic-2.gif' alt=''>",$txtsob);
$txtsob =str_replace(":offtop:","<img src='../img/offtop.gif' alt=''>",$txtsob);
$txtsob =str_replace(":kid:","<img src='../img/kid.gif' alt=''>",$txtsob);
$txtsob =str_replace(":jjot:","<img src='../img/jjot.gif' alt=''>",$txtsob);
$txtsob =str_replace(":impreza:","<img src='../img/impreza.gif' alt=''>",$txtsob);
$txtsob =str_replace(":google:","<img src='../img/google.gif' alt=''>",$txtsob);
$txtsob =str_replace(":ganja:","<img src='../img/ganja.gif' alt=''>",$txtsob);
$txtsob =str_replace(":fans:","<img src='../img/fans.gif' alt=''>",$txtsob);
$txtsob =str_replace(":dance3:","<img src='../img/dance3.gif' alt=''>",$txtsob);
$txtsob =str_replace(":comando:","<img src='../img/comando.gif' alt=''>",$txtsob);
$txtsob =str_replace(":close_tema:","<img src='../img/close_tema.gif' alt=''>",$txtsob);
$txtsob =str_replace(":clapping:","<img src='../img/clapping.gif' alt=''>",$txtsob);
$txtsob =str_replace(":boyan:","<img src='../img/boyan.gif' alt=''>",$txtsob);
$txtsob =str_replace(":bije:","<img src='../img/bije.gif' alt=''>",$txtsob);
$txtsob =str_replace(":aikido:","<img src='../img/aikido.gif' alt=''>",$txtsob);
$txtsob =str_replace(":admintut:","<img src='../img/admintut.gif' alt=''>",$txtsob);
$txtsob =str_replace(":83:","<img src='../img/83.gif' alt=''>",$txtsob);
$txtsob =str_replace(":75:","<img src='../img/75.gif' alt=''>",$txtsob);
$txtsob =str_replace(":37:","<img src='../img/37.gif' alt=''>",$txtsob);
$txtsob =str_replace(":123:","<img src='../img/123.gif' alt=''>",$txtsob);
$txtsob =str_replace(":122:","<img src='../img/122.gif' alt=''>",$txtsob);
$txtsob =str_replace(":121:","<img src='../img/121.gif' alt=''>",$txtsob);
$txtsob =str_replace(":120:","<img src='../img/120.gif' alt=''>",$txtsob);
}
if($status == "moder" || $status == "admin")
{
$txtsob =str_replace(":ban:","<img src='../img/ban.gif' alt=''>",$txtsob);
$txtsob =str_replace(":ban2:","<img src='../img/ban2.gif' alt=''>",$txtsob);
$txtsob =str_replace(":banned:","<img src='../img/banned.gif' alt=''>",$txtsob);
$txtsob =str_replace(":devil:","<img src='../img/devil.gif' alt=''>",$txtsob);
$txtsob =str_replace(":flood1:","<img src='../img/flood1.gif' alt=''>",$txtsob);
$txtsob =str_replace(":huligan:","<img src='../img/huligan.gif' alt=''>",$txtsob);
$txtsob =str_replace(":offtop:","<img src='../img/offtop.gif' alt=''>",$txtsob);
}
return $txtsob;
}
//бб коды
function url_replace($m)
{
if( !isset($m[3]) )
{
return '<a href="' . $m[1] . '">' . $m[2] . '</a>';
}else
{
return '<a href="' . $m[3] . '">' . $m[3] . '</a>';
}
}
function bb($txtsob)
{
$txtsob = preg_replace('#\[big\](.*?)\[/big\]#si', '<big>\1</big>', $txtsob);
$txtsob = preg_replace('#\[b\](.*?)\[/b\]#si', '<b>\1</b>', $txtsob);
$txtsob = preg_replace('#\[i\](.*?)\[/i\]#si', '<i>\1</i>', $txtsob);
$txtsob = preg_replace('#\[u\](.*?)\[/u\]#si', '<u>\1</u>', $txtsob);
$txtsob = preg_replace('#\[small\](.*?)\[/small\]#si', '<small>\1</small>', $txtsob);
$txtsob = preg_replace('#\[red\](.*?)\[/red\]#si', '<font color="#FF0000">\1</font>', $txtsob);
$txtsob = preg_replace('#\[green\](.*?)\[/green\]#si', '<font color="#00FF00">\1</font>', $txtsob);
$txtsob = preg_replace('#\[blue\](.*?)\[/blue\]#si', '<font color="#0000FF">\1</font>', $txtsob);
$txtsob = preg_replace('#\[yellow\](.*?)\[/yellow\]#si', '<font color="#FFFF00">\1</font>', $txtsob);
$txtsob = preg_replace('#\[q\](.*?)\[/q\]#si', '<div class="ramk">\1</div>', $txtsob);
$txtsob = preg_replace('#\[del\](.*?)\[/del\]#si', '<del>\1</del>', $txtsob);
$txtsob = preg_replace_callback('~\\[url=(http://.+?)\\](.+?)\\[/url\\]|(http://(www.)?[0-9a-z\.-]+\.[0-9a-z]{2,6}[0-9a-zA-Z/\?\.\~&_=/%-:#]*)~', 'url_replace', $txtsob);
return $txtsob;
}
//обратные смайлы
function off_smiles($txtsob)
{
//стандартные смайлы
$txtsob =str_replace("<img src='../img/1.gif' alt=''>",":)",$txtsob);
$txtsob =str_replace("<img src='../img/1.gif' alt=''>",":-)",$txtsob);
$txtsob =str_replace("<img src='../img/2.gif' alt=''>",":(",$txtsob);
$txtsob =str_replace("<img src='../img/2.gif' alt=''>",":-(",$txtsob);
//остальные
$txtsob =str_replace("<img src='../img/",":",$txtsob);
$txtsob =str_replace(".gif' alt=''>",":",$txtsob);
return $txtsob;
}
//обратные бб коды
function off_bb($txtsob)
{
$txtsob = preg_replace('#<big>(.*?)</big>#si', '[big]\1[/big]', $txtsob);
$txtsob = preg_replace('#<b>(.*?)</b>#si', '[b]\1[/b]', $txtsob);
$txtsob = preg_replace('#<i>(.*?)</i>#si', '[i]\1[/i]', $txtsob);
$txtsob = preg_replace('#<u>(.*?)</u>#si', '[u]\1[/u]', $txtsob);
$txtsob = preg_replace('#<small>(.*?)</small>#si', '[small]\1[/small]', $txtsob);
$txtsob = preg_replace('#<font color="\#FF0000">(.*?)</font>#si', '[red]\1[/red]', $txtsob);
$txtsob = preg_replace('#<font color="\#00FF00">(.*?)</font>#si', '[green]\1[/green]', $txtsob);
$txtsob = preg_replace('#<font color="\#0000FF">(.*?)</font>#si', '[blue]\1[/blue]', $txtsob);
$txtsob = preg_replace('#<font color="\#FFFF00">(.*?)</font>#si', '[yellow]\1[/yellow]', $txtsob);
$txtsob = preg_replace('#<div class="ramk">(.*?)</div>#si', '[q]\1[/q]', $txtsob);
$txtsob = preg_replace('#<del>(.*?)</del>#si', '[del]\1[/del]', $txtsob);
$txtsob = preg_replace('#<a href="(.*?)">(.*?)</a>#si', '[url=\1]\2[/url]', $txtsob);
return $txtsob;
}
//транслит
function translit($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","'","'","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("Щ","Щ","Ж","Ж","Ч","Ч","Ш","Ш","Ё","Ё","Э","Э","Ю","Ю","Я","Я","щ","ж","ч","ш","ё","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","ь","ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ь","ы");
$string=str_replace($trans1,$trans2,$string);
return $string;
}
?>