BBCodes gehen nicht

  • Hallo,
    ich hab ein kleines Problem.
    Ich habe BBCodes in meine Seite eingebaut, funktioniert auch ganz gut. Sie besteht aus 3 Datein:
    bbcodes.php -> BBCodes und Smilies werden aufgelistet
    bbc.inc.php -> Alle BBCodes
    bbcode.js -> Die codes werden umgewandelt.

    Die .js datei ist auch brav im Header includet und wenn ich die Smilies und co. brauche, include ich sie dann im Formular, z.b bei der Gästebuch seite.
    Sämtliche Codes funktionieren auch, die Smilies werden auch umgewandelt, aber wenn ich neue BBcodes hinzufügen möchte (ich hab jetzt LEFT in die Datei geschrieben und als Bild dagestellt) werden diese nicht umgewandelt.
    Vielleicht kennt sich ja jemand aus, warum die 'neuen' nicht umgewandelt werden, aber center z.B schon :/

    Hier mal die Datein (ich hab die mal in eine zip Datei gepackt, da ich keine Anhänge mit rantun kann):
    bbcodes

  • Ähm, ich werde bestimmt nicht von einem Gast eine Datei downloaden, diese bei mir entpacken und dann auch noch fremden Quellcode durchforsten.

  • Soll ich den ganzen Quelltext von allen 3 Seiten hier rein kopieren?
    Das wird aber sehr lang.

  • Okay, dann hier die Codes:

    bbcodes.php:

    Code
    <img src="bbc/bold.gif" alt="fettgedruckter Text" title="fettgedruckter Text" border="0" onclick="bbcode(document.bbform,'B','')" onmouseover="this.style.cursor='hand';" />
    <img src="bbc/italic.gif" alt="kursiver Text" title="kursiver Text" border="0" onclick="bbcode(document.bbform,'I','')" onmouseover="this.style.cursor='hand';" />
    <img src="bbc/underline.gif" alt="unterstrichener Text" title="unterstrichener Text" border="0" onclick="bbcode(document.bbform,'U','')" onmouseover="this.style.cursor='hand';" />
    <img src="bbc/left.gif" alt="Linksbündiger Text" title="Linksbündiger Text" border="0" onclick="bbcode(document.bbform,'LEFT','')" onmouseover="this.style.cursor='hand';" />
    <img src="bbc/center.gif" alt="zentrierter Text" title="zentrierter Text" border="0" onclick="bbcode(document.bbform,'CENTER','')" onmouseover="this.style.cursor='hand';" />
    <img src="bbc/link.gif" alt="Hyperlink einf&uuml;gen" title="Hyperlink einf&uuml;gen" border="0" onclick="namedlink(document.bbform,'URL')" onmouseover="this.style.cursor='hand';" />
    <img src="bbc/email.gif" alt="E-Mail-Adresse einf&uuml;gen" title="E-Mail-Adresse einf&uuml;gen" border="0" onclick="namedlink(document.bbform,'EMAIL')" onmouseover="this.style.cursor='hand';" />
    <img src="bbc/img.gif" alt="Bild einf&uuml;gen" title="Bild einf&uuml;gen" border="0" onclick="bbcode(document.bbform,'IMG','http://')" onmouseover="this.style.cursor='hand';" />
    <img src="bbc/list.gif" alt="Liste erstellen" title="Liste erstellen" border="0" onclick="dolist(document.bbform)" onmouseover="this.style.cursor='hand';" />

    bbc.inc.php:

    ","<code>","</code>",$umwandlung);
    $umwandlung = w("

    Code
    ","

    ","<code>","</code>",$umwandlung);
    $umwandlung = str_replace("", "<b>",$umwandlung);
    $umwandlung = str_replace("", "<b>",$umwandlung);
    $umwandlung = str_replace("
    ", "</b>",$umwandlung);
    $umwandlung = str_replace("", "</b>",$umwandlung);
    $umwandlung = str_replace("", "<u>",$umwandlung);
    $umwandlung = str_replace("", "<u>",$umwandlung);
    $umwandlung = str_replace("
    ", "</u>",$umwandlung);
    $umwandlung = str_replace("", "</u>",$umwandlung);
    $umwandlung = str_replace("", "<i>",$umwandlung);
    $umwandlung = str_replace("", "<i>",$umwandlung);
    $umwandlung = str_replace("
    ", "</i>",$umwandlung);
    $umwandlung = str_replace("", "</i>",$umwandlung);
    $umwandlung = str_replace("

    ", "<center>",$umwandlung);
    $umwandlung = str_replace("

    ", "<center>",$umwandlung);
    $umwandlung = str_replace("

    ", "</center>",$umwandlung);
    $umwandlung = str_replace("

    ", "</center>",$umwandlung);
    $umwandlung = str_replace("

    ", "<left>",$umwandlung);
    $umwandlung = str_replace("

    ", "<left>",$umwandlung);
    $umwandlung = str_replace("

    ", "</left>",$umwandlung);
    $umwandlung = str_replace("

    ", "</left>",$umwandlung);
    $umwandlung = str_replace("[/image]", "'>",$umwandlung);
    $umwandlung = str_replace("[/IMAGE]", "'>",$umwandlung);
    $umwandlung = str_replace("[/img]", "'>",$umwandlung);
    $umwandlung = str_replace("[/IMG]", "'>",$umwandlung);
    $umwandlung = str_replace("[IMAGE]", "<img border=0 src='", $umwandlung);
    $umwandlung = str_replace("[image]", "<img border=0 src='", $umwandlung);
    $umwandlung = str_replace("[IMG]", "<img border=0 src='", $umwandlung);
    $umwandlung = str_replace("[img]", "<img border=0 src='", $umwandlung);
    $umwandlung = str_replace("[IMAGE float=left]", "<img border=0 style='float:left;padding-right:7px;padding-bottom:7px;padding-top:5px;' src='", $umwandlung);
    $umwandlung = str_replace("[image float=left]", "<img border=0 style='float:left;padding-right:7px;padding-bottom:7px;padding-top:5px;' src='", $umwandlung);
    $umwandlung = str_replace("[IMG float=left]", "<img border=0 style='float:left;padding-right:7px;padding-bottom:7px;padding-top:5px;' src='", $umwandlung);
    $umwandlung = str_replace("[img float=left]", "<img border=0 style='float:left;padding-right:7px;padding-bottom:7px;padding-top:5px;' src='", $umwandlung);
    $umwandlung = str_replace("[IMAGE float=right]", "<img border=0 style='float:right;padding-top:5px;padding-left:5px;padding-right:5px;padding-bottom:7px;' src='", $umwandlung);
    $umwandlung = str_replace("[image float=right]", "<img border=0 style='float:right;padding-top:5px;padding-left:5px;padding-right:5px;padding-bottom:7px;' src='", $umwandlung);
    $umwandlung = str_replace("[IMG float=right]", "<img border=0 style='float:right;padding-top:5px;padding-left:5px;padding-right:5px;padding-bottom:7px;' src='", $umwandlung);
    $umwandlung = str_replace("[img float=right', '<img border=0 style='float:right;padding-top:5px;padding-left:5px;padding-right:5px;padding-bottom:7px;' src='', $umwandlung);
    $umwandlung = ae('

      ","

    ","<ol>","</ol>",$umwandlung);
    $umwandlung = ae("

      ","

    ","<ol>","</ol>",$umwandlung);
    $umwandlung = ae("

      ","

    ","<ol type=a>","</ol>",$umwandlung);
    $umwandlung = ae("

      ","

    ","<ol type=a>","</ol>",$umwandlung);
    $umwandlung = str_replace("

      ", "<ul>", $umwandlung);
      $umwandlung = str_replace("

        ", "<ul>", $umwandlung);
        $umwandlung = str_replace("

      ", "</ul>", $umwandlung);
      $umwandlung = str_replace("

    ", "</ul>", $umwandlung);
    $umwandlung = str_replace("[*]", "<li>", $umwandlung);


    $umwandlung = str_replace("<br>", "\n",$umwandlung);
    if(count(explode("

    PHP
    ",$umwandlung)) == count(explode("

    ",$umwandlung)) && count(explode("

    PHP
    ",$umwandlung)) > 1) {
                while(count(explode("[code=php]",$umwandlung)) > 1) {
                    $anfang = strpos($umwandlung, "[code=php]")+5;
                    $ende = strpos($umwandlung, "

    ")-1;
    $code1 = substr($umwandlung,$anfang,($ende-$anfang+1));
    $code = zurueck($code1);
    $code = wordwrap($code, 80, "\n");
    $code = highlight_string($code,true);
    $umwandlung = str_replace("

    PHP
    ".$code1."

    ", $code, $umwandlung);
    }
    }

    $umwandlung = xx("","<a target='_blank' href='",$umwandlung);
    $umwandlung = xx("
    ","<a target='_blank' href='",$umwandlung);
    $umwandlung = str_replace("
    ", "</a>", $umwandlung);
    $umwandlung = str_replace("
    ", "</a>", $umwandlung);

    $umwandlung = xx("[EMAIL=','[/EMAIL]","<a href='mailto:",$umwandlung);

    $umwandlung = xx("[email=','[/email]","<a href='mailto:",$umwandlung);

    $umwandlung = str_replace("[/email]", "</a>", $umwandlung);

    $umwandlung = str_replace("[/EMAIL]", "</a>", $umwandlung);


    $umwandlung = str_replace("[i']'", "[i]", $umwandlung);

    $umwandlung = str_replace("\n", "<br>",$umwandlung);

    $abfrage4 = "SELECT * FROM smilies";

    $ergebnis4 = mysql_query($abfrage4);

    while($row4 = mysql_fetch_object($ergebnis4))

    {

    $code = htmlspecialchars($row4->code);

    $umwandlung = str_replace($code, "<img src='http://localhost/wh/smilies/smilie_".$row4->id.$row4->bild."' border='0'>",$umwandlung);

    }

    return $umwandlung;

    }

    ?>

    [/code]

  • Irgendwie gingen alle 3 Codes nicht aufeinmal, hier noch die letzte.

    bbcode.js: