1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| function format($text)
{
global $site_config, $smilies;
$s = $text;
$s = htmlspecialchars($s);
$s = stripslashes($s);
$s = format_urls($s);
// Raccourcis :
// [forum]
$s = str_replace("[forum]","<a href=forums.php> Forum </a>", $s);
// Annonce
$s = str_replace("[annonce]","http://www.rapid-tracker.net/announce.php",$s);
// Jeu
$s = str_replace(":jeu:","<<<@!1!@>>>
$s = preg_replace(
"/\<<<@!2!@>>>
$s = preg_replace(
"/\[quote=(.+?)\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
"<p class=sub><b>\\1 wrote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\2</td></tr></table><br />", $s);
// $s = preg_replace(
"/\[code\]\s*((\s|.)+?)\s*\[\/code\]\s*/i",
"<p class=sub><b>Code:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\1</td></tr></table><br />", $s);
//[blink]Text[/blink]
$s = preg_replace("/\[blink\]((\s|.)+?)\[\/blink\]/", "<blink>\\1</blink>", $s);
//[hr]
$s = preg_replace("/\[hr\]/i", "<hr>", $s);
//[hr=#ffffff] [hr=red]
$s = preg_replace("/\[hr=((#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])|([a-zA-z]+))\]/i", "<hr color=\"\\1\"/>", $s);
//[swf]http://somesite.com/test.swf[/swf]
$s = preg_replace("/\[swf\]((www.|http:\/\/|https:\/\/)[^\s]+(\.swf))\[\/swf\]/i",
"<param name=movie value=\\1/><embed width=470 height=310 src=\\1></embed>", $s);
//[swf=http://somesite.com/test.swf]
$s = preg_replace("/\[swf=((www.|http:\/\/|https:\/\/)[^\s]+(\.swf))\]/i",
"<param name=movie value=\\1/><embed width=470 height=310 src=\\1></embed>", $s);
// Linebreaks
$s = nl2br($s);
// Maintain spacing
$s = str_replace(" ", " ", $s);
// Smilies
require_once("smilies.php");
reset($smilies);
while (list($code, $url) = each($smilies))
$s = str_replace($code, "<img border=0 src=" . $site_config['SITEURL'] . "/images/smilies/$url>", $s);
$r = mysql_query("SELECT * FROM censor");
while($rr=mysql_fetch_row($r))
$s = preg_replace("/".preg_quote($rr[0])."/i", $rr[1], $s);
return $s;
} |
Partager