<?php

function bbcodehightlight($arr) {
    $arr[0] = html_entity_decode($arr[0], ENT_QUOTES, 'UTF-8');
    return '<div class="php_code" style="overflow:auto;">' . preg_replace('#<code>(.*?)</code>#si', '\\1', highlight_string($arr[0], 1)) . '</div>' . "\n";
}

function BBcode($msg) {
    $bbcode = array(
        '/\[i\](.+)\[\/i\]/isU' => '<em>$1</em>',
        '/\[dotss\](.+)\[\/dotss\]/isU' => '<span style="text-decoration:underline">$1</span>',
        '/\[b\](.+)\[\/b\]/isU' => '<strong>$1</strong>',
        '/\[u\](.+)\[\/u\]/isU' => '<span style="text-decoration:underline;">$1</span>',
        '/\[ut\](.+)\[\/ut\]/isU' => '<span style="border-bottom: 1px dotted;">$1</span>',
        '/\[xx-small\](.+)\[\/xx-small\]/isU' => '<span style="font-size:xx-small;">$1</span>',
        '/\[x-small\](.+)\[\/x-small\]/isU' => '<span style="font-size:x-small;">$1</span>',
        '/\[in\](.+)\[\/in\]/isU' => '<input type="text" value="$1" />',
        '/\[das\](.+)\[\/das\]/isU' => '<span style="border:1px dashed;">$1</span>',
        '/\[marq\](.+)\[\/marq\]/isU' => '<marquee>$1</marquee>',
        '/\[c\](.+)\[\/c\]/isU' => '<center>$1</center>',
        '/\[sol\](.+)\[\/sol\]/isU' => '<span style="border:1px solid;">$1</span>',
        '/\[s\](.+)\[\/s\]/isU' => '<span style="text-decoration:line-through;">$1</span>',
        '/\[up\](.+)\[\/up\]/isU' => '<span style="text-decoration:overline;">$1</span>',
        '/\[bl\](.+)\[\/bl\]/isU' => '<span style="text-decoration:blink;">$1</span>',
        '/\[bblue\](.+)\[\/bblue\]/isU' => '<span style="background-color : blue;">$1</span>',
        '/\[bDeepPink\](.+)\[\/bDeepPink\]/isU' => '<span style="background-color : bDeepPink;">$1</span>',
        '/\[bLightSalmon\](.+)\[\/bLightSalmon\]/isU' => '<span style="background-color : bLightSalmon;">$1</span>',
        '/\[bLime\](.+)\[\/bLime\]/isU' => '<span style="background-color : bLime;">$1</span>',
        '/\[bDarkOrange\](.+)\[\/bDarkOrange\]/isU' => '<span style="background-color : bDarkOrange;">$1</span>',
        '/\[dLimeGreen\](.+)\[\/dLimeGreen\]/isU' => '<span style="background-color : LimeGreen;">$1</span>',
        '/\[bFireBrick\](.+)\[\/bFireBrick\]/isU' => '<span style="background-color : bFireBrick;">$1</span>',
        '/\[bOrangeRed\](.+)\[\/bOrangeRed\]/isU' => '<span style="background-color : bOrangeRed;">$1</span>',
        '/\[bGoldenrod\](.+)\[\/bGoldenrod\]/isU' => '<span style="background-color : Goldenrod;">$1</span>',
        '/\[bTurquoise\](.+)\[\/bTurquoise\]/isU' => '<span style="background-color : Turquoise;">$1</span>',
        '/\[byellow\](.+)\[\/byellow\]/isU' => '<span style="background-color : yellow;">$1</span>',
        '/\[bbrown\](.+)\[\/bbrown\]/isU' => '<span style="background-color : brown;">$1</span>',
        '/\[bwhite\](.+)\[\/bwhite\]/isU' => '<span style="background-color : white;">$1</span>',
        '/\[borange\](.+)\[\/borange\]/isU' => '<span style="background-color : orange;">$1</span>',
        '/\[bblack\](.+)\[\/bblack\]/isU' => '<span style="background-color : black;">$1</span>',
        '/\[bgrey\](.+)\[\/bgrey\]/isU' => '<span style="background-color : grey;">$1</span>',
        '/\[bpink\](.+)\[\/bpink\]/isU' => '<span style="background-color : pink;">$1</span>',
        '/\[bviolet\](.+)\[\/bviolet\]/isU' => '<span style="background-color : violet;">$1</span>', '/\[bblue\](.+)\[\/bblue\]/isU' => '<span style="background-color : blue;">$1</span>',
        '/\[byellow\](.+)\[\/byellow\]/isU' => '<span style="background-color : yellow;">$1</span>',
        '/\[bbrown\](.+)\[\/bbrown\]/isU' => '<span style="background-color : brown;">$1</span>',
        '/\[bwhite\](.+)\[\/bwhite\]/isU' => '<span style="background-color : white;">$1</span>',
        '/\[borange\](.+)\[\/borange\]/isU' => '<span style="background-color : orange;">$1</span>',
        '/\[bblack\](.+)\[\/bblack\]/isU' => '<span style="background-color : black;">$1</span>',
        '/\[bgrey\](.+)\[\/bgrey\]/isU' => '<span style="background-color : grey;">$1</span>',
        '/\[bpink\](.+)\[\/bpink\]/isU' => '<span style="background-color : pink;">$1</span>',
        '/\[bviolet\](.+)\[\/bviolet\]/isU' => '<span style="background-color : violet;">$1</span>', '/\[bred\](.+)\[\/bred\]/isU' => '<span style="background-color : red;">$1</span>',
        '/\[bgreen\](.+)\[\/bgreen\]/isU' => '<span style="background-color : green;">$1</span>', '/\[big\](.+)\[\/big\]/isU' => '<span style="font-size:large;">$1</span>',
        '/\[das\](.+)\[\/das\]/isU' => '<span style="border:1px dashed;">$1</span>',
        '/\[dot\](.+)\[\/dot\]/isU' => '<span style="border:1px dotted;">$1</span>',
        '/\[dou\](.+)\[\/dou\]/isU' => '<span style="border:3px double #E1E1E4;">$1</span>', '/\[dot\](.+)\[\/dot\]/isU' => '<span style="border:1px dotted;">$1</span>',
        '/\[dou\](.+)\[\/dot\]/isU' => '<span style="border:3px double #E1E1E4;">$1</span>', '/\[dot\](.+)\[\/dot\]/isU' => '<span style="border:1px dotted;">$1</span>',
        '/\[scr-1\](.+)\[\/scr-1\]/isU' => '<span style="background-color:Peru;"><span style="color:LightPink;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-w\](.+)\[\/scr-w\]/isU' => '<span style="background-color:#ffffff;"><span style="color:#ffffff;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-b\](.+)\[\/scr-b\]/isU' => '<span style="background-color:#000000;"><span style="color:#000000;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-bl\](.+)\[\/scr-bl\]/isU' => '<span style="background-color:Blue;"><span style="color:Blue;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-r\](.+)\[\/scr-r\]/isU' => '<span style="background-color:red;"><span style="color:red;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-g\](.+)\[\/scr-g\]/isU' => '<span style="background-color:green;"><span style="color:green;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-d\](.+)\[\/scr-d\]/isU' => '<span style="background-color:DarkMagenta;"><span style="color:DarkMagenta;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-c\](.+)\[\/scr-c\]/isU' => '<span style="background-color:Crimson;"><span style="color:Crimson;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-bu\](.+)\[\/scr-bu\]/isU' => '<span style="background-color:Burlywood;"><span style="color:Burlywood;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-k\](.+)\[\/scr-k\]/isU' => '<span style="background-color:Khaki;"><span style="color:Khaki;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-bl\](.+)\[\/scr-bl\]/isU' => '<span style="background-color:Blue;"><span style="color:Blue;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-r\](.+)\[\/scr-r\]/isU' => '<span style="background-color:red;"><span style="color:red;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-g\](.+)\[\/scr-g\]/isU' => '<span style="background-color:green;"><span style="color:green;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-d\](.+)\[\/scr-d\]/isU' => '<span style="background-color:DarkMagenta;"><span style="color:DarkMagenta;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-c\](.+)\[\/scr-c\]/isU' => '<span style="background-color:Crimson;"><span style="color:Crimson;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-bu\](.+)\[\/scr-bu\]/isU' => '<span style="background-color:Burlywood;"><span style="color:Burlywood;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[scr-k\](.+)\[\/scr-k\]/isU' => '<span style="background-color:Khaki;"><span style="color:Khaki;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[ramk-1\](.+)\[\/ramk-1\]/isU' => '<span style="background-color:LightGreen;"><span style="color:Khaki;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[ramk-2\](.+)\[\/ramk-2\]/isU' => '<span style="background-color:MediumSeaGreen;"><span style="color:Khaki;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[ramk-3\](.+)\[\/ramk-3\]/isU' => '<span style="background-color:ForestGreen;"><span style="color:Khaki;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[ramk-4\](.+)\[\/ramk-4\]/isU' => '<span style="background-color:PaleTurquoise;"><span style="color:Khaki;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[ramk-5\](.+)\[\/ramk-5\]/isU' => '<span style="background-color:SteelBlue;"><span style="color:Khaki;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[ramk-6\](.+)\[\/ramk-6\]/isU' => '<span style="background-color:Orchid;"><span style="color:Khaki;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[ramk-7\](.+)\[\/ramk-7\]/isU' => '<span style="background-color:DimGray;"><span style="color:Khaki;"><span style="border:1px dashed;">$1</span></span></span>',
        '/\[bit\](.+)\[\/bit\]/isU' => '<marquee behavior=alternate>$1</marquee>',
        '/\[sizem1\](.+)\[\/sizem1\]/isU' => '<font size=-1>$1</font size>',
        '/\[sizem2\](.+)\[\/sizem2\]/isU' => '<font size=-2>$1</font size>',
        '/\[sizem3\](.+)\[\/sizem3\]/isU' => '<font size=3>$1</font size>',
        '/\[sizem4\](.+)\[\/sizem4\]/isU' => '<font size=4>$1</font size>',
        '/\[sizem5\](.+)\[\/sizem5\]/isU' => '<font size=5>$1</font size>',
        '/\[sizem6\](.+)\[\/sizem6\]/isU' => '<font size=6>$1</font size>',
        '/\[sizem7\](.+)\[\/sizem7\]/isU' => '<font size=7>$1</font size>',
        '/\[textp\](.+)\[\/textp\]/isU' => '<p align="right">$1</p>',
        '/\[prlink\](.+)\[\/prlink\]/isU' => '<blockquote style="border: 3px solid rgb(218, 112, 214); margin: 0px; padding: 5px;">$1</blockquote>',
        '/\[prlink2\](.+)\[\/prlink2\]/isU' => '<blockquote style="border: 1px solid rgb(218, 112, 214); margin: 0px; padding: 5px;">$1</blockquote>',
        '/\[prlink3\](.+)\[\/prlink3\]/isU' => '<blockquote style="border: 1px solid rgb(218, 112, 214); margin: 1px; padding: 1px;">$1</blockquote>',
        '/\[prlink4\](.+)\[\/prlink4\]/isU' => '<blockquote style="border: 1px solid rgb(110, 112, 214); margin: 1px; padding: 1px;">$1</blockquote>',
        '/\[prlink5\](.+)\[\/prlink5\]/isU' => '<blockquote style="border: 1px solid rgb(666, 43, 211); margin: 1px; padding: 1px;">$1</blockquote>',
        '/\[prlink6\](.+)\[\/prlink6\]/isU' => '<blockquote style="border: 3px solid rgb(218, 112, 214); margin: 0px; padding: 5px;">$1</blockquote>',
        '/\[prlink7\](.+)\[\/prlink7\]/isU' => '<blockquote style="border: 1px solid rgb(777, 43, 666); center: 0px; padding: 1px;">$1</blockquote>',
        '/\[ramkt\](.+)\[\/ramkt\]/isU' => '<blockquote style="BORDER-LEFT: #F70000 3px solid; padding: 15px; BORDER-TOP: #999931 3px solid; padding: 15px; BORDER-BOTTOM: #E3AF40 3px solid; padding: 15px; BORDER-RIGHT: #924E96 3px solid" padding: 15px>$1</blockquote>',
        '/\[rams\](.+)\[\/rams\]/isU' => '<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>',
        '/\[rams2\](.+)\[\/rams2\]/isU' => '<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>>',
        '/\[ramkt2\](.+)\[\/ramkt2\]/isU' => '<span style="border-style: dashed; border-color:yellow">$1</span> <br />',
        '/\[ramkt3\](.+)\[\/ramkt3\]/isU' => '<span style="border-style: dashed; border-color:LightGreen">$1</span>',
        '/\[ramkt4\](.+)\[\/ramkt4\]/isU' => '<span style="border-style: dashed; border-color:SteelBlue">$1</span>',
        '/\[ramkt5\](.+)\[\/ramkt5\]/isU' => '<span style="border-style: dashed; border-color:LightPink">$1</span>',
        '/\[ramkt6\](.+)\[\/ramkt6\]/isU' => '<span style="border-style: dashed; border-color:Gray">$1</span>',
        '/\[ramkt7\](.+)\[\/ramkt7\]/isU' => '<span style="border-style: dashed; border-color:White">$1</span>',
        '/\[ramkt8\](.+)\[\/ramkt8\]/isU' => '<span style="border-style: dashed; border-color:MediumSlateBlue">$1</span> ',
        '/\[ramkt9\](.+)\[\/ramkt9\]/isU' => '<span style="border-style: dashed; border-color:LightSalmon">$1</span>',
        '/\[ramkt10\](.+)\[\/ramkt10\]/isU' => '<span style="border-style: dashed; border-color:DarkOrange">$1</span>',
        '/\[ramkt11\](.+)\[\/ramkt11\]/isU' => '<span style="border-style: dashed; border-color:SpringGreen">$1</span>',
        '/\[ramkt12\](.+)\[\/ramkt12\]/isU' => '<span style="border-style: dashed; border-color:Yellow">$1</span>',
        '/\[ramkt13\](.+)\[\/ramkt13\]/isU' => '<span style="border-style: dashed; border-color:Gold">$1</span>',
        '/\[ramkt14\](.+)\[\/ramkt14\]/isU' => '<span style="border-style: dashed; border-color:DarkRed">$1</span>',
        '/\[ramkt15\](.+)\[\/ramkt15\]/isU' => '<span style="border-style: dashed; border-color:DeepPink">$1</span>',
        '/\[dou\](.+)\[\/dou\]/isU' => '<span style="border:3px double #E1E1E4;">$1</span>',
        '/\[dou\](.+)\[\/dou\]/isU' => '<span style="border:3px double #E1E1E4;">$1</span>',
        '/\[big\](.+)\[\/big\]/isU' => '<span style="font-size:large;">$1</span>',
        '/\[small\](.+)\[\/small\]/isU' => '<span style="font-size:small;">$1</span>',
        '/\[code\](.+)\[\/code\]/isU' => '<code>$1</code>',
        '/\[f=([0-9]+)\/([0-9]+)\/([0-9]+)\](.+)\[\/f\]/isU' => "<a href='/forum/$1/$2/$3'>$4</a>",
        '/\[u=([0-9]+)\](.+)\[\/u\]/isU' => "<a href='/info.php?id=$1'>$2</a>",
        '/\[red\](.+)\[\/red\]/isU' => '<span style="color:#ff0000;">$1</span>',
        '/\[yellow\](.+)\[\/yellow\]/isU' => '<span style="color:#ffff22;">$1</span>',
        '/\[green\](.+)\[\/green\]/isU' => '<span style="color:#00bb00;">$1</span>',
        '/\[blue\](.+)\[\/blue\]/isU' => '<span style="color:#0000bb;">$1</span>',
        '/\[brown\](.+)\[\/brown\]/isU' => '<span style="color:brown;">$1</span>',
        '/\[white\](.+)\[\/white\]/isU' => '<span style="color:#ffffff;">$1</span>',
        '/\[black\](.+)\[\/black\]/isU' => '<span style="color:black;">$1</span>',
        '/\[orange\](.+)\[\/orange\]/isU' => '<span style="color:orange;">$1</span>',
        '/\[pink\](.+)\[\/pink\]/isU' => '<span style="color:pink;">$1</span>',
        '/\[violet\](.+)\[\/violet\]/isU' => '<span style="color:violet;">$1</span>',
        '/\[gray\](.+)\[\/gray\]/isU' => '<span style="color:gray;">$1</span>',
        '/\[size=([0-9]+)\](.+)\[\/size\]/isU' => '<span style="font-size:$1px;">$2</span>',
        '/\[maroon\](.+)\[\/maroon\]/isU' => '<span style="color:maroon;">$1</span>',
        '/\[teal\](.+)\[\/teal\]/isU' => '<span style="color:teal;">$1</span>',
        '/\[scarlet\](.+)\[\/scarlet\]/isU' => '<span style="color:scarlet;">$1</span>',
        '/\[carmine\](.+)\[\/carmine\]/isU' => '<span style="color:carmine;">$1</span>',
        '/\[vermilion\](.+)\[\/vermilion\]/isU' => '<span style="color:vermilion;">$1</span>',
        '/\[alizarin\](.+)\[\/alizarin\]/isU' => '<span style="color:alizarin;">$1</span>',
        '/\[chestnut\](.+)\[\/chestnut\]/isU' => '<span style="color:chestnut;">$1</span>',
        '/\[crimson\](.+)\[\/crimson\]/isU' => '<span style="color:crimson;">$1</span>',
        '/\[darkcoral\](.+)\[\/darkcoral\]/isU' => '<span style="color:darkcoral;">$1</span>',
        '/\[burntsiena\](.+)\[\/burntsiena\]/isU' => '<span style="color:burntsiena;">$1</span>',
        '/\[burntsiena\](.+)\[\/burntsiena\]/isU' => '<span style="color:burntsiena;">$1</span>',
        '/\[coral\](.+)\[\/coral\]/isU' => '<span style="color:coral;">$1</span>',
        '/\[salmon\](.+)\[\/salmon\]/isU' => '<span style="color:salmon;">$1</span>',
        '/\[pinkorange\](.+)\[\/pinkorange\]/isU' => '<span style="color:#ff9966;">$1</span>',
        '/\[palepink\](.+)\[\/palepink\]/isU' => '<span style="color:palepink;">$1</span>',
        '/\[lavenderblush\](.+)\[\/lavenderblush\]/isU' => '<span style="color:lavenderblush;">$1</span>',
        '/\[carrot\](.+)\[\/carrot\]/isU' => '<span style="color:carrot;">$1</span>',
        '/\[jaco\](.+)\[\/jaco\]/isU' => '<span style="color:jaco;">$1</span>',
        '/\[tangerine\](.+)\[\/tangerine\]/isU' => '<span style="color:#ff8800;">$1</span>',
        '/\[margarine\](.+)\[\/margarine\]/isU' => '<span style="color:margarine;">$1</span>',
        '/\[safetyorange\](.+)\[\/safetyorange\]/isU' => '<span style="color:safetyorange;">$1</span>',
        '/\[palebrown\](.+)\[\/palebrown\]/isU' => '<span style="color:#987654;">$1</span>',
        '/\[palebrown\](.+)\[\/palebrown\]/isU' => '<span style="color:#442d25;">$1</span>',
        '/\[coffee\](.+)\[\/coffee\]/isU' => '<span style="color:#442d25;">$1</span>',
        '/\[bistre\](.+)\[\/bistre\]/isU' => '<span style="color:#3d2b1f;">$1</span>',
        '/\[cinnamon\](.+)\[\/cinnamon\]/isU' => '<span style="color:cinnamon;">$1</span>',
        '/\[byron\](.+)\[\/byron\]/isU' => '<span style="color:byron;">$1</span>',
        '/\[sepia\](.+)\[\/sepia\]/isU' => '<span style="color:sepia;">$1</span>',
        '/\[umber\](.+)\[\/umber\]/isU' => '<span style="color:umber;">$1</span>',
        '/\[schoolbus\](.+)\[\/schoolbus\]/isU' => '<span style="color:#ff8d00;">$1</span>',
        '/\[gold\](.+)\[\/gold\]/isU' => '<span style="color:gold;">$1</span>',
        '/\[mustard\](.+)\[\/mustard\]/isU' => '<span style="color:#ffdb58;">$1</span>',
        '/\[sandybrown\](.+)\[\/sandybrown\]/isU' => '<span style="color:#fcdd78;">$1</span>',
        '/\[lemon\](.+)\[\/lemon\]/isU' => '<span style="color:#fde910;">$1</span>',
        '/\[lime\](.+)\[\/lime\]/isU' => '<span style="color:lime;">$1</span>',
        '/\[olive\](.+)\[\/olive\]/isU' => '<span style="color:olive;">$1</span>',
        '/\[asparagus\](.+)\[\/asparagus\]/isU' => '<span style="color:asparagus;">$1</span>',
        '/\[ferngreen\](.+)\[\/ferngreen\]/isU' => '<span style="color:#4f7942;">$1</span>',
        '/\[toadinlove\](.+)\[\/toadinlove\]/isU' => '<span style="color:toadinlove;">$1</span>',
        '/\[vertdepomme\](.+)\[\/vertdepomme\]/isU' => '<span style="color:#34c924;">$1</span>',
        '/\[brightgreen\](.+)\[\/brightgreen\]/isU' => '<span style="color:#66ff00;">$1</span>',
        '/\[pistachio\](.+)\[\/pistachio\]/isU' => '<span style="color:#bef574;">$1</span>',
        '/\[Saint\](.+)\[\/Saint\]/isU' => ' <span style="color:green;"><marquee><span style="border:0px dotted;"><em><span style="text-decoration:underline;">TEKCT 3aMEHeH Ha  CEKPETHbIN bb code <br /> </span></em></span></marquee><strong>xakep by Saint  JumanG.ru i WmSait.ru</strong>  </span>',
        '/\[greenyellow\](.+)\[\/greenyellow\]/isU' => '<span style="color:#adff2f;">$1</span>',
        '/\[chartreuse\](.+)\[\/chartreuse\]/isU' => '<span style="color:chartreuse;">$1</span>',
        '/\[mossgreen\](.+)\[\/mossgreen\]/isU' => '<span style="color:mossgreen;">$1</span>',
        '/\[palegreen\](.+)\[\/palegreen\]/isU' => '<span style="color:palegreen;">$1</span>',
        '/\[darkspringgreen\](.+)\[\/darkspringgreen\]/isU' => '<span style="color:#177245;">$1</span>',
        '/\[jade\](.+)\[\/jade\]/isU' => '<span style="color:jade;">$1</span>',
        '/\[navy\](.+)\[\/navy\]/isU' => '<span style="color:navy;">$1</span>',
        '/\[aqua\](.+)\[\/aqua\]/isU' => '<span style="color:aqua;">$1</span>',
        '/\[st\](.+)\[\/st\]/isU' => '<span style="color:#082567;"><span style="color:red;">[SUPPORT]</span>  kidaem HA koh R329486466357 deneg 100000000 dolars  i bb code propadet :D Saint</span>',
        '/\[moray\](.+)\[\/moray\]/isU' => '<span style="color:moray;">$1</span>',
        '/\[pinegreen\](.+)\[\/pinegreen\]/isU' => '<span style="color:#01796f;">$1</span>',
        '/\[robineggblue\](.+)\[\/robineggblue\]/isU' => '<span style="color:#00cccc;">$1</span>',
        '/\[turquoise\](.+)\[\/turquoise\]/isU' => '<span style="color:turquoise;">$1</span>',
        '/\[brightturquoise\](.+)\[\/brightturquoise\]/isU' => '<span style="color:#08e0de;">$1</span>',
        '/\[electric\](.+)\[\/electric\]/isU' => '<span style="color:#7df9ff;">$1</span>',
        '/\[paleblue\](.+)\[\/paleblue\]/isU' => '<span style="color:#afeeee;">$1</span>',
        '/\[sapphire\](.+)\[\/sapphire\]/isU' => '<span style="color:#082567;">$1</span>',
        '/\[powderblue\](.+)\[\/powderblue\]/isU' => '<span style="color:powderblue;">$1</span>',
        '/\[blacksea\](.+)\[\/blacksea\]/isU' => '<span style="color:#1a4780;">$1</span>',
        '/\[cobalt\](.+)\[\/cobalt\]/isU' => '<span style="color:cobalt;">$1</span>',
        '/\[denim\](.+)\[\/denim\]/isU' => '<span style="color:#0047ab;">$1</span>',
        '/\[royalblue\](.+)\[\/royalblue\]/isU' => '<span style="color:royalblue;">$1</span>',
        '/\[kleinblue\](.+)\[\/kleinblue\]/isU' => '<span style="color:#3a75c4;">$1</span>',
        '/\[azure\](.+)\[\/azure\]/isU' => '<span style="color:#007fff;">$1</span>',
        '/\[purple\](.+)\[\/purple\]/isU' => '<span style="color:purple;">$1</span>',
        '/\[amethyst\](.+)\[\/amethyst\]/isU' => '<span style="color:amethyst;">$1</span>',
        '/\[seroburomalinovyj\](.+)\[\/seroburomalinovyj\]/isU' => '<span style="color:#735184;">$1</span>',
        '/\[darkviolet\](.+)\[\/darkviolet\]/isU' => '<span style="color:#423181;">$1</span>',
        '/\[indigo\](.+)\[\/indigo\]/isU' => '<span style="color:indigo;">$1</span>',
        '/\[plum\](.+)\[\/plum\]/isU' => '<span style="color:plum;">$1</span>',
        '/\[silver\](.+)\[\/silver\]/isU' => '<span style="color:silver;">$1</span>',
        '/\[wetasphalt\](.+)\[\/wetasphalt\]/isU' => '<span style="color:#505050;">$1</span>',
        '/\[anthracite\](.+)\[\/anthracite\]/isU' => '<span style="color:#808080;">$1</span>',
        '/\[slategray\](.+)\[\/slategray\]/isU' => '<span style="color:slategray;">$1</span>',
        '/\[lightgrey\](.+)\[\/lightgrey\]/isU' => '<span style="color:lightgrey;">$1</span>',
        '/\[quartz\](.+)\[\/quartz\]/isU' => '<span style="color:quartz;">$1</span>',
        '/\[darkbrown\](.+)\[\/darkbrown\]/isU' => '<span style="color:darkbrown;">$1</span>',
        '/\[f=([0-9]+)\/([0-9]+)\/([0-9]+)\](.+)\[\/f\]/isU' => "<a href='/forum/$1/$2/$3'>$4</a>",
        '/\[u=([0-9]+)\](.+)\[\/u\]/isU' => "<a href='/info.php?id=$1'>$2</a>"
    );
    $bbcode['/\[color=([\0-9a-zA-Z]+)\](.+)\[\/color\]/isU'] = '<span style="color:#$1;">$2</span>';
    $bbcode['/\[color=([\0-9a-zA-Z]+)\](.+)\[\/color\]/isU'] = '<span style="color:#$1;">$2</span>';
    $bbcode['/\[cvet=([\0-9a-zA-Z]+)\](.+)\[\/cvet\]/isU'] = '<span style="color:#$1;">$2</span>';
    $bbcode['/\[cvet=([\0-9a-zA-Z]+)\](.+)\[\/cvet\]/isU'] = '<span style="color:#$1;">$2</span>';
    $bbcode['/\[color=([\#0-9a-zA-Z]+)\](.+)\[\/color\]/isU'] = '<span style="color:$1;">$2</span>';
    $msg = preg_replace(array_keys($bbcode), array_values($bbcode), $msg);
    $msg = preg_replace('#&lt;\?(.*?)\?&gt;#sui', 'bbcodehightlight', $msg);
    $msg = preg_replace('#\[you100\](.*?)\[/you100\]#si', '
	<object width="100" height="80">
	<param name="movie" value="http://www.youtube.com/v/\1?version=3">
	</param>
	<param name="allowFullScreen" value="true">
	</param>
	<embed src="http://www.youtube.com/v/\1?version=3" type="application/x-shockwave-flash" width="100" height="80" allowfullscreen="true">
	</embed></object>', $msg); #
    $msg = preg_replace('#\[you150\](.*?)\[/you150\]#si', '
	<object width="150" height="100">
	<param name="movie" value="http://www.youtube.com/v/\1?version=3">
	</param>
	<param name="allowFullScreen" value="true">
	</param>
	<embed src="http://www.youtube.com/v/\1?version=3" type="application/x-shockwave-flash" width="150" height="100" allowfullscreen="true">
	</embed></object>', $msg); #
    $msg = preg_replace('#\[mp3\](.*?)\[/mp3\]#si', '
	<object width="470" height="70" data="http://flv-mp3.com/i/pic/ump3player_500x70.swf" type="application/x-shockwave-flash">
  <param value="transparent" name="wmode">
  <param value="true" name="allowFullScreen">
  <param value="always" name="allowScriptAccess>
  <param value="http://flv-mp3.com/i/pic/ump3player_500x70.swf" name="movie">
  <param value="way=$1&swf=http://flv-mp3.com/i/pic/ump3player_500x70.swf&w=470&h=70& time_seconds=0&autoplay=0&q=&skin=sky&volume=70&comment=Sevfo.Com" name="FlashVars">
</object>', $msg); #




    $msg = preg_replace('#\[you300\](.*?)\[/you300\]#si', '
	<object width="300" height="300">
	<param name="movie" value="http://www.youtube.com/v/\1?version=3">
	</param>
	<param name="allowFullScreen" value="true">
	</param>
	<embed src="http://www.youtube.com/v/\1?version=3" type="application/x-shockwave-flash" width="300" height="300" allowfullscreen="true">
	</embed></object>', $msg); #





    $msg = preg_replace('#\[you250\](.*?)\[/you250\]#si', '
	<object width="250" height="200">
	<param name="movie" value="http://www.youtube.com/v/\1?version=3">
	</param>
	<param name="allowFullScreen" value="true">
	</param>
	<embed src="http://www.youtube.com/v/\1?version=3" type="application/x-shockwave-flash" width="250" height="200" allowfullscreen="true">
	</embed></object>', $msg); #
    $msg = preg_replace('#\[you400\](.*?)\[/you400\]#si', '
	<object width="400" height="250"><param name="movie" value="http://www.youtube.com/v/\1?version=3"></param>
	<param name="allowFullScreen" value="true"></param>
	<embed src="http://www.youtube.com/v/\1?version=3" type="application/x-shockwave-flash" width="400" height="250" allowfullscreen="true"></embed>
        </object>', $msg); #
    $msg = preg_replace('#\[you500\](.*?)\[/you500\]#si', '
	<object width="500" height="340">
	<param name="movie" value="http://www.youtube.com/v/\1?version=3">
	</param>
	<param name="allowFullScreen" value="true">
	</param>
	<embed src="http://www.youtube.com/v/\1?version=3" type="application/x-shockwave-flash" width="500" height="340" allowfullscreen="true">
	</embed></object>', $msg); #

    $msg = preg_replace('#\[you250\](.*?)\[/you250\]#si', '
	<object width="250" height="150">
	<param name="movie" value="http://www.youtube.com/v/\1?version=3">
	</param>
	<param name="allowFullScreen" value="true">
	</param>
	<embed src="http://www.youtube.com/v/\1?version=3" type="application/x-shockwave-flash" width="250" height="150" allowfullscreen="true">
	</embed></object>', $msg); #
    $msg = preg_replace('#\[google\](.*?)\[/google\]#si', '
	<a href="http://www.google.ru/search?q=$1">Link  <span style="color:#6600ff">G</span><span style="color:green">o</span><span style="color:black">o</span><span style="color:#0000ff">g</span><span style="color:#008000">l</span><span style="color:#7700ff">e</span> <i>  :$1</i></a> ', $msg);
    $msg = preg_replace('#\[googleimg\](.*?)\[/googleimg\]#si', '<a href="http://www.google.com.ua/images?q=$1">Link imG <span style="color:#6600ff">G</span><span style="color:green">o</span><span style="color:black">o</span><span style="color:#0000ff">g</span><span style="color:#008000">l</span><span style="color:#7700ff">e</span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[vkman\](.*?)\[/vkman\]#si', '<a href=http://vkontakte.ru/gsearch.php?section=people&q=$1">vkontakte <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[vkmusic\](.*?)\[/vkmusic\]#si', '<a href="http://vkontakte.ru/gsearch.php?section=audio&q=$1"><span style="color:#6600ff">Music</span> vkontake <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[vkvideo\](.*?)\[/vkvideo\]#si', '<a href="http://vkontakte.ru/gsearch.php?section=video&q=$1">Video <span style="color:#6600ff">vkontakte </span><i>\1</i></a> ', $msg);
    $msg = preg_replace('#\[wiki\](.*?)\[/wiki\]#si', '[url=http://ru.wikipedia.org/wiki/\1]Wiki <i>\1</i>[/url] ', $msg);
    $msg = preg_replace('#\[ya\](.*?)\[/ya\]#si', '<a href="http://yandex.ru/yandsearch?text=$1"> <span style="color:#ff0000">Y</span>andex <span style="color:#6600ff">Link </span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[yaimg\](.*?)\[/yaimg\]#si', '<a href="http://images.yandex.ru/yandsearch?text=$1"> <span style="color:#ff0000">Y</span>andex <span style="color:#6600ff">Link </span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[yaavto\](.*?)\[/yaavto\]#si', '<a href="http://auto.yandex.ru/models.xml?text=$1"> Avto <span style="color:#ff0000">Y</span>andex <span style="color:#6600ff">Link </span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[yavideo\](.*?)\[/yavideo\]#si', '<a href="http://video.yandex.ru/#search?text=$1">Video <span style="color:#ff0000">Y</span>andex <span style="color:#6600ff">Link </span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[yamusic\](.*?)\[/yamusic\]#si', '<a href="http://music.yandex.ru/#!/search?text=$1">Music <span style="color:#ff0000">Y</span>andex <span style="color:#6600ff">Link </span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[yaPeople\](.*?)\[/yaPeople\]#si', '<a href="http://yandex.ru/yandsearch?text=$1">People <span style="color:#ff0000">Y</span>andex <span style="color:#6600ff">Link </span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[yablogs\](.*?)\[/yablogs\]#si', '<a href="http://blogs.yandex.ru/search.xml?text=$1">blogs <span style="color:#ff0000">Y</span>andex <span style="color:#6600ff">Link </span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[translateru\](.*?)\[/translateru\]#si', '<a href="http://translate.google.ru/#ru/en/$1">translate ru-en <span style="color:#ff0000">G</span>oogle translate <span style="color:#6600ff">The text of the translation Link </span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[translateen\](.*?)\[/translateen\]#si', '<a href="http://translate.google.ru/#en/ru/$1">translate en-ru <span style="color:#ff0000">G</span>oogle translate <span style="color:#6600ff">The text of the translation Link </span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[translateruuk\](.*?)\[/translateruuk\]#si', '<a href="http://translate.google.ru/#ru/uk/$1">translate ru-uk <span style="color:#ff0000">G</span>oogle translate <span style="color:#6600ff">The text of the translation Link </span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[translateukru\](.*?)\[/translateukru\]#si', '<a href="http://translate.google.ru/#ru/uk/$1">translate uk-ru <span style="color:#ff0000">G</span>oogle translate <span style="color:#6600ff">The text of the translation Link </span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[bing\](.*?)\[/bing\]#si', '<a href="http://www.bing.com/search?q=$1">bing Link </span> <i>$1</i></a> ', $msg);
    $msg = preg_replace('#\[mail\](.*?)\[/mail\]#si', '<a href="http://go.mail.ru/search?q=$1">Mail.Ru <i>$1</i></a> ', $msg);
    return $msg;
}
