SimplePortal
Development => Bugs => Fixed or Bogus Bugs => Topic started by: ccbtimewiz on November 25, 2009, 09:01:10 PM
-
So, I'm playing around with the shoutbox and I found an issue. See, my username on this specific SMF 2.0 RC2 forum with SP 2.3.1 is "c". Just the letter "c". When someone uses an emoticon or such, it parses HTML code with the "c" in "src" highlighted.
See: http://img204.imageshack.us/img204/2066/11252009205703.png
-
Thank you for the bugreport.
Added to the Project tracker: http://simpleportal.net/index.php?issue=322.0
-
Bumped:
http://simpleportal.net/index.php?issue=322.com2597#com1084
-
According the the bugtracker
http://simpleportal.net/index.php?issue=322.0 (http://simpleportal.net/index.php?issue=322.0)
This problem was reported in version 2.3.1 and fixed in version 2.3.2
Are you still having this problem?
-
Yes, with the latest version, as to why I bumped this
-
in Subs-Portal.php:
$shouts[$shout['id']]['text'] = preg_replace('~(^|\s+|\W+)(' . preg_quote($user_info['name'], '~') . ')+(\s+|\W+|$)~', '$1<span class="shoutbox_me">$2</span>$3', $shout['text']);
This is the culprit -- if the username is identical to the domain name, this rule will match the domain name.
For example: $name = 'name';
$site_name = $name . '.org';
$smiley_tag = '<img src="http://'. $site_name . '/Smileys/default/cheesy.gif" />';
$subject = 'hello <b>' . $name . '</b>' . $smiley_tag ;
$pattern='~(^|\s+|\W+)(' . preg_quote( $name ,'~') . ')+(\s+|\W+|$)~';
$replacement='$1<span class="shoutbox_me">$2</span>$3';
echo '<br />before: ', htmlspecialchars($subject);
echo '<br /> after: ', htmlspecialchars( preg_replace( $pattern, $replacement, $subject ) );
I wonder if this can be replaced with something like
$pattern = '~(?<!://)(' . $name . ')+(\s+|\W+|$)~';
$replacement='<span class="shoutbox_me">$1</span>$2';
or if that would also cause problems...
-
Or just getting rid of the name highlight all together?
-
That would certainly be easiest for now. I'm no pregexp expert.