Page 1 of 1

phpbb php bbcode

Posted: Mon Nov 05, 2007 5:38 pm
by s.dot
http://www.phpbb.com/mods/db/index.php? ... rib_id=769

Is all I could find to add a php bbcode button and syntax highlighter to a forum I'm working on. Which mod is it that this board uses (or is it a custom mod?).

I'd go with the one above, but it only has 142 downloads =/ So I suspect it's not the one I'm looking for.

phpbb v 2.0.22

Posted: Mon Nov 05, 2007 5:45 pm
by feyd
We're using Geshi, with some custom-ish stuff for the php tag.

Posted: Mon Nov 05, 2007 6:11 pm
by s.dot
Does geshi become available as a phpbb mod? Or is that custom done as well.

I really only need the php button, but geshi would be cool too.

Posted: Mon Nov 05, 2007 6:20 pm
by feyd
It's an older mod...

You should be able to dig out exactly what's been changed in the moderator boards (MOD discussion, I believe.)

Posted: Mon Nov 05, 2007 6:38 pm
by s.dot
Oh. I couldn't. I hate copying (even with permission) :P

I'll figure something out! Thanks feyd.

Posted: Tue Nov 06, 2007 3:14 am
by s.dot
So i tried installing the geshi mod. No luck.

So i figured I did something wrong.

Did a clean phpbb install. Installed the multiple bbcodes mod, and then tried the geshi mod again.

No luck.

Nothing shows up in the bbcode bar, and syntax="php" /syntax doesn't work.

Any suggestions?

Posted: Tue Nov 06, 2007 11:02 pm
by s.dot
Okay, I tinkered around and found the problem. It appears someone copy/pasted the MOD instructions, thus making entities show up as their character counterparts.

Code: Select all

if ( $board_config['syntax_status'] != SYNTAX_NO_PARSE )
    {
        $text = preg_replace("/\[syntax:$uid=\"?([a-zA-Z0-9\-_\+\#\$\%]+)\"?\](.*?)\[\/syntax:$uid\]/sie", "'{$bbcode_tpl['syntax_open']}' . geshi_highlight('\\2', '\\1', '$uid') . '{$bbcode_tpl['syntax_close']}'", $text);
    }
    else
    {
        $text = preg_replace("/\[syntax:$uid=(\"?[a-zA-Z0-9\-_\+\#\$\%]+\"?)\](.*?)\[\/syntax:$uid\]/si", "[syntax=\\1]\\2
", $text);
}

...........

$text = bbencode_first_pass_pda($text, $uid, '#\[syntax=(\\\"[a-zA-Z0-9\-_]+\\\")\]#is', '[/syntax]', '', false, '', "[syntax:$uid=\\1]");[/syntax]

Those quotes (") in the regex should be "

I'm not entirely sure, as it may be a server configuration that is doing that -- I'm not familiar with phpbb coding. But changing those did the trick.

Hope this is usefull for someone else having the same problem.