Great hack; I customized it pretty heavily to add support for private messages, message preview, and to respect bbcode-disabled flags. I also think that this will work no matter what font is currently in use, and it will never generate non-XHTML-compliant output (even when tags are badly overlapped).
[high]* Edgewize clicks install because without Erwin, I'd never have started!
[/high]
I put the following a file called hack_me.php:
(NOTE: had to mangle the color tags to get it to post right. replace Xcolor with color in six places!)
Code:
<?php
if (THIS_SCRIPT == 'newreply' && !isset($bbcode) && isset($pagetext))
$pagetext = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '$1* '.$postinfo['username'].' $3', $pagetext);
elseif (THIS_SCRIPT == 'private' && !isset($bbcode) && isset($pagetext))
$pagetext = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '$1* '.$pm['fromusername'].' $3', $pagetext);
elseif (isset($bbcode) && $dobbcode && is_array($GLOBALS['post']))
$bbcode = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '[Xcolor=#008811]$1* '.$GLOBALS['post']['username'].' $3[/Xcolor]', $bbcode);
elseif (isset($bbcode) && $dobbcode && $GLOBALS['previewpost'])
$bbcode = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '[Xcolor=#008811]$1* '.$GLOBALS['bbuserinfo']['username'].' $3[/Xcolor]', $bbcode);
elseif (isset($bbcode) && $dobbcode && isset($GLOBALS['fromuserinfo']))
$bbcode = preg_replace('#^(([ \t]|\[[a-z]+[^\]]*\])*)/me[ \t](.*)$#Uim', '[Xcolor=#008811]$1* '.$GLOBALS['fromuserinfo']['username'].' $3[/Xcolor]', $bbcode);
?>
Then added the line
Code:
@include('hack_me.php');
in the following places:
Code:
includes/functions_bbcodeparse.php around line 323, immediately after:
global $DB_site, $vboptions, $bbuserinfo, $templatecache, $smiliecache;
global $html_allowed;
newreply.php around line 96, immediately after
$pagetext = trim(strip_quotes($pagetext));
private.php around line 1156, immediately after
$pagetext = trim($pagetext);
(Note: to change the color, change the three color tags in hack_me.php)
First post, baby! And hello Erwin, I totally forgot that you post here as well as at EV1servers