MyBB Community Forums
[Pushed] Editor loads smiley images relatively - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Development (https://community.mybb.com/forum-161.html)
+--- Forum: MyBB 1.8 Development (https://community.mybb.com/forum-165.html)
+---- Forum: 1.8 Bugs and Issues (https://community.mybb.com/forum-157.html)
+----- Forum: Pushed (https://community.mybb.com/forum-183.html)
+----- Thread: [Pushed] Editor loads smiley images relatively (/thread-157880.html)



Editor loads smiley images relatively - Firestryke31 - 2014-08-21

Normally this would not be a problem. However I'm building a forum where I've kind of beaten MyBB's URL structure into submission via mod_rewrite and it kind of breaks things being loaded relatively when the page tries to load images from example.com/custompage/addthing/images/smilies/smile.gif (which is not correct). Loading the images from {$mybb->settings['bburl']}/images/smilies/smile.gif (or whatever the JS equivalent is) would fix this due to being an absolute URL.

If for whatever reason this won't be done I'm going to have fun trying to figure out how to hack around this...

On an unrelated note, the means by which I had to do this URL beating is horrible and fragile and belongs on TDWTF but was the only way I could think of to globally format the links for MyBB because there isn't really any other way.


RE: Editor loads smiley images relatively - Lennart Sauter - 2014-08-22

+ one with this issue, embedding MyBB into 3rd party sites is difficult here.


RE: Editor loads smiley images relatively - Euan T - 2014-08-22

Also note loading relatively means the CDN settings aren't used. 1.8 has a new variable under $mybb->asset_url to handle this which should be used.


RE: Editor loads smiley images relatively - Euan T - 2014-08-22

Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/1291

Thanks for contributing to MyBB!

Regards,
The MyBB Group


RE: Editor loads smiley images relatively - Firestryke31 - 2014-08-22

Does the [Pushed] prefix mean the issue was pushed to github, or the fix? Confused because I thought to add it, then thought better of it...


RE: Editor loads smiley images relatively - Eldenroot - 2014-08-22

just pushed, not fixed... but feel free to pull a fix


RE: Editor loads smiley images relatively - Firestryke31 - 2014-08-22

Oh I just meant for the title. I haven't the foggiest where to start with fixing SCeditor...


RE: Editor loads smiley images relatively - doylecc - 2014-08-22

SCEditor is using $dropdownsmilies, $moresmilies and $hiddensmilies, so I'd say changing


if($i < $mybb->settings['smilieinsertertot'])
{
$dropdownsmilies .= '"'.$find.'": "'.$image.'",';
}
else
{
$moresmilies .= '"'.$find.'": "'.$image.'",';
}
for($j = 1; $j < $finds_count; ++$j)
{
$find = htmlspecialchars_uni($finds[$j]);
$hiddensmilies .= '"'.$find.'": "'.$image.'",';
}

to

if($i < $mybb->settings['smilieinsertertot'])
{
	$dropdownsmilies .= '"'.$find.'": "'.$mybb->asset_url.'/'.$image.'",';
}
else
{
	$moresmilies .= '"'.$find.'": "'.$mybb->asset_url.'/'.$image.'",';
}
for($j = 1; $j < $finds_count; ++$j)
{
	$find = htmlspecialchars_uni($finds[$j]);
	$hiddensmilies .= '"'.$find.'": "'.$mybb->asset_url.'/'.$image.'",';
}


in functions.php should give the absolute URL for the smilies.


RE: Editor loads smiley images relatively - Euan T - 2014-08-25

Would be better to use the get_asset_url() function in that case as it handles things such as links to external sites.


RE: Editor loads smiley images relatively - Euan T - 2014-10-05

Fixed in #1492.