MyBB Community Forums

Full Version: Do Not Parse Smilies in IMG or URL tags
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok, I've been having issues on a board that I "support" (I offer advice to the owner, but I'm just a normal member... got him to convert to MyBB though).

We have the :/ smiley, and in ANY url that smiley screwballs it.

What I propose:
  • Parse for non-tagged urls first, and add the tags
  • Ignore any smiley or MyCode that appears inside URL and IMG tags. Like the way CODE and PHP tags don't get parsed.

I'm quite tired of seeing
http(SMILEY)/
Instead of my URLs. He has disabled that smiley for the moment, but we would like to be able to turn it back on, so I'll be modding the parser myself for his board, and if I get enough positive feedback, I'll post the code changes as an "Idea" on the tracker.
A quick fix to this would be to change the "Text to replace" from :/ to =/ or something similar. Maybe even :\. Then post a message to your users notifying them of the change.
Yes, but the parser should still be fixed. We had both :\ and :/ and the faces are even correct direction based on which code you use. We've just disabled the :/ for now till I fix the parser.
(2009-12-20, 07:06 PM)ralgith Wrote: [ -> ]Yes, but the parser should still be fixed. We had both :\ and :/ and the faces are even correct direction based on which code you use. We've just disabled the :/ for now till I fix the parser.

Oh I see. Good luck with the fix.
It shouldn't be to hard to fix this.
(2009-12-21, 10:42 PM)Jammerx2 Wrote: [ -> ]It shouldn't be to hard to fix this.

It should be fairly trivial actually. I just haven't had the time yet.
is that fix success? Wink
Like I mentioned, I've not had the time yet. Between the holidays and my Mom burning her house down a few weeks ago, I've been busy.
(2009-12-28, 06:01 PM)ralgith Wrote: [ -> ]Like I mentioned, I've not had the time yet. Between the holidays and my Mom burning her house down a few weeks ago, I've been busy.

I'm very sorry to hear that, i hope all is well. I also support this suggestion. I hate it when i say something and Confused gets in it...
Ok, step 1 to correct this is to fix the regex that is supposed to fix it for URLs! (Already a part of the core code, just broken)

NOTE: This is for the smiley parser, as I've just brushed the surface and noticed this bug.

At or around line 400 of inc/class_parser.php search for:
preg_match_all("#\[(url(=[^\]]*])?\].*?\[\/url\]|quote=([^\]]*)?\])#i", $message, $bad_matches, PREG_PATTERN_ORDER);

Change to:
preg_match_all("#\[(url(=[^\]]*])?\].*?\[\/url\]|quote=([^\]]*)?\])#si", $message, $bad_matches, PREG_PATTERN_ORDER);

All I did was add the s flag to make it treat the entire $message as a single line (ignore line breaks) so that it would parser properly.

I'll do more work on this when I have free time.