Файл: core/bb_code.php
Строк: 38
<?php
function bb_code($msg)
{
$msg = preg_replace('#[code](.*?)[/code]#ie', 'highlight("1")', $msg);
$msg = preg_replace('#[big](.*?)[/big]#si', '<big>1</big>', $msg);
$msg = preg_replace('#[b](.*?)[/b]#si', '<b>1</b>', $msg);
$msg = preg_replace('#[i](.*?)[/i]#si', '<i>1</i>', $msg);
$msg = preg_replace('#[u](.*?)[/u]#si', '<u>1</u>', $msg);
$msg = preg_replace('#[small](.*?)[/small]#si', '<small>1</small>', $msg);
$msg = preg_replace('#[red](.*?)[/red]#si', '<span style="color:#ff0000">1</span>', $msg);
$msg = preg_replace('#[green](.*?)[/green]#si', '<span style="color:#00cc00">1</span>', $msg);
$msg = preg_replace('#[blue](.*?)[/blue]#si', '<span style="color:#0000ff">1</span>', $msg);
$msg = preg_replace('#[yellow](.*?)[/yellow]#si', '<span style="color:#FFFF00">1</span>', $msg);
$msg = preg_replace('#[q](.*?)[/q]#si', '<div class="quote">1</div>', $msg);
$msg = preg_replace('#[del](.*?)[/del]#si', '<del>1</del>', $msg);
return $msg;
}
function links($msg)
{
$msg = preg_replace('#[url=("|'|)(.*?)("|'|)](.*?)[/url]#si', '<a href="$2">$4</a>', $msg);
$msg = preg_replace('#[url](.*?)[/url]#si', '<a href="$1">$1</a>', $msg);
return $msg;
}
function smile($msg){
$result = mysql_query("SELECT id, code FROM `smiles` ORDER BY `id` DESC ");
while($smiles = mysql_fetch_assoc($result)){
$msg = str_replace($smiles["code"], '<img src = "smiles/'.$smiles["id"].'.gif">',$msg);
}
return $msg;
}
function smiles($msg){
$result = mysql_query("SELECT id, code FROM `smiles` ORDER BY `id` DESC ");
while($smiles = mysql_fetch_assoc($result)){
$msg = str_replace($smiles["code"], '<img src = "smiles/'.$smiles["id"].'.gif">',$msg);
}
return $msg;
}
function censored($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">[censored]</font>';
$var = preg_replace($pattern, $replacement, $var);
return $var;
}
?>