1

Topic: Smileys and site integration bug

This bug causes the parse_message function to write the scr= path to any smiley incorrectly, when the function is used on a website that has the forums integrated.

This should fix it:

include/parser.php line 366:

        $text = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($smiley_text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="img/smilies/'.$smiley_img[$i].'" width="15" height="15" alt="'.substr($smiley_img[$i], 0, strrpos($smiley_img[$i], '.')).'" />$2', $text);

should be:

        $text = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($smiley_text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="' . PUN_ROOT . 'img/smilies/'.$smiley_img[$i].'" width="15" height="15" alt="'.substr($smiley_img[$i], 0, strrpos($smiley_img[$i], '.')).'" />$2', $text);

Re: Smileys and site integration bug

What if PUN_ROOT is not relative from an external link, e.g. you are using PUN_ROOT to include PunBB from a different subdomain?

3

Re: Smileys and site integration bug

It would still work I suppose, because PUN_ROOT would point to the correct subdomain, and it would parse the smiley links to be from that subdomain... Or do I not understand this correctly?

Re: Smileys and site integration bug

No, it wouldn't
Say I have forums.punbb.org and punbb.org
forums.punbb.org is in /home/rickard/forum/ and punbb.org is in /home/rickard/site/
forums.punbb.org has the PunBB install. If I try and integrate it with punbb.org, PUN_ROOT would be ../forum/, which would screw everything up tongue

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

Re: Smileys and site integration bug

Now, you could use o_base_url to make it an absolute path instead wink

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

6

Re: Smileys and site integration bug

You could also set PUN_ROOT in the site integration file, like I do. Like this:

define('PUN_ROOT', '/home/account/forums/');
require_once '/home/account/forums/' . 'include/common.php';
require_once '/home/account/forums/' . 'include/parser.php';

Well, as it is now, it screws up the smileys when I use the parse_message() function on the site. So I modified it, and it works. I thought it would be useful if this fix was also done in the official version.

Re: Smileys and site integration bug

Erm, using PUN_ROOT like that wouldn't work tongue
If I was on forums.punbb.org, the URL would become forums.punbb.org/home/account/forums/[insert rest of URL here]

o_base_url would work tongue

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

8

Re: Smileys and site integration bug

guess you're right wink

Re: Smileys and site integration bug

thanks for the info, my integration is fixed tongue