<?php
function parseBBCode2HTML($msg) {
$msg = $msg;
$msg = str_replace(":P","<img src=\"images/smileys/000.gif\" width=\"15\" height=\"14\" border=\"0\">",$msg);
$msg = str_replace(":)","<img src=\"images/smileys/001.gif\" width=\"15\" height=\"14\" border=\"0\">",$msg);
$msg = str_replace(";)","<img src=\"images/smileys/002.gif\" width=\"15\" height=\"14\" border=\"0\">",$msg);
$msg = str_replace(":(","<img src=\"images/smileys/003.gif\" width=\"15\" height=\"14\" border=\"0\">",$msg);
$msg = str_replace("*grr*","<img src=\"images/smileys/004.gif\" width=\"15\" height=\"14\" border=\"0\">",$msg);
$msg = str_replace("o_o","<img src=\"images/smileys/005.gif\" width=\"15\" height=\"14\" border=\"0\">",$msg);
$msg = str_replace("*_*","<img src=\"images/smileys/006.gif\" width=\"15\" height=\"14\" border=\"0\">",$msg);
$msg = str_replace("._.","<img src=\"images/smileys/007.gif\" width=\"15\" height=\"14\" border=\"0\">",$msg);
$msg = str_replace("-_-","<img src=\"images/smileys/008.gif\" width=\"15\" height=\"14\" border=\"0\">",$msg);
$msg = str_replace(":D","<img src=\"images/smileys/009.gif\" width=\"15\" height=\"14\" border=\"0\">",$msg);
return $msg;
}
function linkLenght($treffer) {
$url = trim($treffer[1]);
if(substr($url,0,7)!= 'http://')
$url = "http://".$url;
if(strlen(trim($treffer[2]))!=0)
$linkname = $treffer[2];
else
$linkname = $treffer[1];
if(strlen($linkname)>50 AND !substr_count(strtolower($linkname), '[img]') AND !substr_count(strtolower($linkname), '[/img]'))
$linkname = substr($linkname, 0, 45-3)."...".substr($linkname, -5);
$ergebnis = '<a href="' . $url . '" target="_blank">' . $linkname . '</a>';
return $ergebnis;
}
function txt_format($txtbox) {
$txtbox = $txtbox;
$txtbox = preg_replace("/\[b\](.*?)\[\/b\]/", "<b>$1</b>", $txtbox);
$txtbox = preg_replace("/\[i\](.*?)\[\/i\]/", "<i>$1</i>", $txtbox);
$txtbox = preg_replace("/\[u\](.*?)\[\/u\]/", "<u>$1</u>", $txtbox);
$txtbox = str_replace("/\[s\](.*?)\[\/s\]/", "<s>$1</s>", $txtbox);
$txtbox = str_replace("/\[left\](.*)\[/left\]/", "<s>$1</s>", $txtbox);
$txtbox = str_replace("/\[center\](.*)\[/center\]/", "<s>$1</s>", $txtbox);
$txtbox = str_replace("/\[right\](.*)\[/right\]/", "<s>$1</s>", $txtbox);
$txtbox = preg_replace('#\[url\](.*)\[/url\]#isU', "$1", $txtbox);
$txtbox = preg_replace('#\[ url=(.*)\](.*)\[/url\]#isU', "$2", $txtbox);
$txtbox = str_replace("/\n/", "<br/>\n", $txtbox);
return $txtbox;
}
?>