Codoforum related discussions
Smileys are broken in 4.9

On my site when users click the smile smiley button to insert a GIF smiley, it shows up in the "live preview", but in the actual post it's broken.

The img src is eg index.php?u=/sites/default/assets/img/smileys/wink.gif but I get a 404 error.

Now a test to see if they work here: smilesmilesmile

On my site when users click the :) smiley button to insert a GIF smiley, it shows up in the "live preview", but in the actual post it's broken. The img src is eg `index.php?u=/sites/default/assets/img/smileys/wink.gif` but I get a 404 error. Now a test to see if they work here: :S (wasntme) x(

Which they do - and I can see that they use the pretty URL, which my site also uses. When open the img src in a new tab and edit out the index.php?u= I see the correct image.

Thanks for your help!

Which they do - and I can see that they use the pretty URL, which my site also uses. When open the img src in a new tab and edit out the `index.php?u=` I see the correct image. Thanks for your help!

Hi,

Have you enabled url rewriting for SEF urls?

Hi, Have you enabled url rewriting for SEF urls?
Necessity is the mother of all inventions!

Thanks @admin - yes I have - so other URLs are in the form /user/profile, not index?u=- for some reason the smileys still use the u?= URLs.

Thanks @admin - yes I have - so other URLs are in the form `/user/profile`, not `index?u=`- for some reason the smileys still use the `u?=` URLs.

Hi,

Yes, you are right. It is a bug. We will fix it.

If you want a quick fix, you can make the following change:
Open sys/Ext/Html.php

Around line 320, replace

 //convert absolute path back to relative url
 $val = str_replace(RURI, "CODOF_RURI_" . UID . "_", $val);
 $val = str_replace(DURI, "CODOF_DURI_" . UID . "_", $val);

with

if (strpos($val, "/smileys/") === false) {
    //convert absolute path back to relative url
    $val = str_replace(RURI, "CODOF_RURI_" . UID . "_", $val);
    $val = str_replace(DURI, "CODOF_DURI_" . UID . "_", $val);
}
Hi, Yes, you are right. It is a bug. We will fix it. If you want a quick fix, you can make the following change: Open sys/Ext/Html.php Around line 320, replace ``` //convert absolute path back to relative url $val = str_replace(RURI, "CODOF_RURI_" . UID . "_", $val); $val = str_replace(DURI, "CODOF_DURI_" . UID . "_", $val); ``` with ``` if (strpos($val, "/smileys/") === false) { //convert absolute path back to relative url $val = str_replace(RURI, "CODOF_RURI_" . UID . "_", $val); $val = str_replace(DURI, "CODOF_DURI_" . UID . "_", $val); } ```
Necessity is the mother of all inventions!
edited Apr 2 '20 at 10:25 am

Thanks @admin! That worked well. It fixes new topics/replies but not old ones... but I can live with that.

Thank you again!

Thanks @admin! That worked well. It fixes new topics/replies but not old ones... but I can live with that. Thank you again!
63
5
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft