Nieuw lid |
|
Hoi,
Ik ben nu bezig een niet UBB-systeem te maken, nu heb ik alleen het probleem dat ie de code's niet weergeeft.
Dit is de code:
<?php
class ubb {
function code($code) {
$iscode = explode("[code]", $code);
$iscode2 = explode("
<?php class ubb { function code($code) { $iscode = explode("[code]", $code);
", $code);
if (count($iscode) > "0" && count($iscode2) > "1") {
$showcode = $iscode[1].$iscode2[1];
$showcode = str_replace("
", "", $showcode);
$showcode = str_replace("
", "", $showcode); $showcode = str_replace("
", "", $showcode);
return highlight_string($showcode);
}
}
function parseubb($code) {
$code = htmlspecialchars($code);
$code = nl2br($code);
$tags = Array (
"(.*?)" => "<b>\\1</b>",
"(.*?)" => "<u>\\1</u>",
"(.*?)" => "<i>\\1</i>",
"(.*?)" => "<s>\\1</s>",
"[small](.*?)[/small]" => "<small>\\1</small>",
"[url]http://(.*?)[/url]" => "<A href=\"http://\\1\">http://\\1</A>",
"[url=http://(.*?)](.*?)[/url]" => "<A href=\"http://\\1\">\\2</A>",
"[quote=(.*?)](.*?)[/quote]" => "<DIV class='quotehead'>Quote door \\1:</DIV><DIV class='quote' style='width: 100%; overflow: auto;'>\\2</DIV>",
"" => "<DIV class='quotehead'>Quote:</DIV><DIV class='quote' style='width: 100%; overflow: auto;'>\\1</DIV>",
"[img](.*?)[/img]" => "<IMG src=\"\\1\" border=\"0\">",
"[img width=(.*?) height=(.*?)](.*?)[/img]" => "<IMG src=\"\\3\" width=\"\\1\" height=\"\\2\" border=\"0\">",
"[img height=(.*?) width=(.*?)](.*?)[/img]" => "<IMG src=\"\\3\" height=\"\\1\" width=\"\\2\" border=\"0\">",
"[img width=(.*?)](.*?)[/img]" => "<IMG src=\"\\2\" width=\"\\1\" border=\"0\">",
"[img height=(.*?)](.*?)[/img]" => "<IMG src=\"\\2\" height=\"\\1\" border=\"0\">"
);
$code = preg_replace("_\[code\](.*?)\[\/code\]_is", "$this->code(".$code.")", $code);
$code = preg_replace("_\[php\](.*?)\[\/php\]_is", "$this->code(".$code.")", $code);
foreach ($tags as $tag => $html) {
$tag = str_replace("[", "\[", $tag);
$tag = str_replace("]", "\]", $tag);
$tag = str_replace("/", "\/", $tag);
if (eregi("highlight\_string\('", $tag)) {
$tag = preg_replace("_highlight_string('(.*?)')_is", highlight_string('\\1'), $tag);
}
$code = preg_replace("_".$tag."_is", $html, $code);
}
#if (eregi("\[code\]", $code) && eregi("\[\/code\]", $code)) {
# $code = code(preg_replace("\[code\](.*?)\[\/code\]_is", ".", $code));
#}
return $code;
}
}
$ubb = new ubb;
echo $ubb->parseubb($_POST['ubb'])."<br /><br />";
?>[/code]
Dit is de input:
Citaat: [..]
[code*]<?php
/* UBB Systeem - Door Q-DeviL */
echo "<A href="http://www.webcentra.nl">Webcentra.nl</A>";
?>[/code]
En dit is de output:
Wat doe ik fout?
Let op! Dit is een crosspost met WMCity.nl
|