Topic: PHP Highlighting for code tags

If you have a forum where you have alot of PHP coding withing your code tags, replace line 431 in parser.php (this is in v1.2.10)

$text .= '</p><div class="codebox"><div class="incqbox"><h4>'.$lang_common['Code'].':</h4><div class="scrollbox" style="height: '.$height_str.'"><pre>'.$inside[$i].'</pre></div></div></div><p>';

with

$text .= '</p><div class="codebox"><div class="incqbox"><h4>'.$lang_common['Code'].':</h4><div class="scrollbox" style="height: '.$height_str.'"><pre>'.highlight_string($inside[$i],true).'</pre></div></div></div><p>';

This should work fine, but as I'm not on my dev machine atm, I didn't get the chance to test it.

Have fun smile

-- Bekko

Re: PHP Highlighting for code tags

Hey,

This doesn't seem to be working for me, just wondering if you could verify that it works on your dev machine please?

Thanks,
Danny smile

Re: PHP Highlighting for code tags

Hrmm, I see what's wrong tongue

punBB uses pun_htmlspecialchars on the code box after this gets parsed. I'll check where it can be done without having huge vulnerabilities smile

Re: PHP Highlighting for code tags

Meh, can't seem to get it to work :S Anyone has any ideas how to fix this?

Re: PHP Highlighting for code tags

here is a very tiny. unobtrusive, patch to highlight only php code, when the "code" blocks, contains the php open tag "<?php"

http://www.onfocus.cl/judas/pun-php-highlight.patch.gz