SimplePortal

Development => Bugs => Fixed or Bogus Bugs => Topic started by: ccbtimewiz on November 25, 2009, 09:01:10 PM

Title: Username highlight ignores BBcode or HTML
Post 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
Title: Re: Username highlight ignores BBcode or HTML
Post by: Nathaniel on November 25, 2009, 09:08:59 PM
Thank you for the bugreport.

Added to the Project tracker: http://simpleportal.net/index.php?issue=322.0
Title: Re: Username highlight ignores BBcode or HTML
Post by: ccbtimewiz on October 02, 2010, 11:38:54 PM
Bumped:

http://simpleportal.net/index.php?issue=322.com2597#com1084
Title: Re: Username highlight ignores BBcode or HTML
Post by: AngelinaBelle on October 04, 2010, 10:01:55 AM
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?
 
Title: Re: Username highlight ignores BBcode or HTML
Post by: ccbtimewiz on October 04, 2010, 01:26:27 PM
Yes, with the latest version, as to why I bumped this
Title: Re: Username highlight ignores BBcode or HTML
Post by: AngelinaBelle on October 05, 2010, 11:16:39 AM
in Subs-Portal.php:
Code: [Select]
$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:
Code: [Select]
$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
Code: [Select]
$pattern = '~(?<!://)(' . $name . ')+(\s+|\W+|$)~';
$replacement='<span class="shoutbox_me">$1</span>$2';
or if that would also cause problems...
 
Title: Re: Username highlight ignores BBcode or HTML
Post by: ccbtimewiz on October 05, 2010, 04:38:59 PM
Or just getting rid of the name highlight all together?
Title: Re: Username highlight ignores BBcode or HTML
Post by: AngelinaBelle on October 05, 2010, 07:54:34 PM
That would certainly be easiest for now.  I'm no pregexp expert.
SimplePortal 2.3.8 © 2008-2024, SimplePortal