Closed Woody14619 closed 8 years ago
I couldn't affirm your problem. $GLOBALS["PHORUM"]["http_path"]
comes from "General Settings" in the admin panel. It seems, that your value is wrong. Please check your settings.
Sorry, but you're frankly wrong on this.
The value $GLOBALS["PHORUM"]["http_path"]
is not set anywhere. What is being set via the "General Settings" panel is the longer $GLOBALS["PHORUM"]["DATA"]["URL"]["HTTP_PATH"]
. Several modules, including smiley, call on the prior instead of the latter, and wind up with a blank string.
Don't take my word for it. Pull the active zip and try it yourself. The first smiley you make will not resolve properly and give you a broken image link, unless you put /phorum as the root of your site, so that /mods/smiley/images resolves properly.
I "fixed" it in my install by adding a simple $GLOBALS["PHORUM"]["HTTP_PATH"] = $PHORUM['http_path']
under the longer line liked above in common.php. I filed the bug figuring you folks would like to know about.
Hi Woody14619,
I'm talking about the 5.2 branch.
common.php calls the function phorum_db_load_settings from include/db/mysql.php to load the Phorum settings in the $PHORUM array.
HTTP Path on the General Settings panel must contain the base url of your Phorum installation like http://www.woody14619.com/phorum.
Please check this value.
Btw: if $GLOBALS["PHORUM"]["http_path"]
wouldn't be set probably, my own forum wouldn't work either...
I did check that.. It was the first thing I did. I've been a programmer and site admin for over two decades. This is not a settings issue. The setting is correct in my site config page. This is all on a basic 5.2.20 install, directly unzipped from the main phorum site. I just did a clean install, out of box, and can guarantee you this is broken. I'm not trying to troll you... I'm trying to inform you that I just installed this, and it's broken. Again, I fixed this on my own site, but wanted to alert folks here about it.
When I checked the generated html on the broken smiley images, it showed them as "/mods/simleys/images/foo.gif" The base site for phorum on my site (as properly shown in the config) is "http://mysite/phorum" The line of code in smiletslib.php that builds that is:
$prefix = $GLOBALS["PHORUM"]["http_path"] . "/" . $modinfo["prefix"];
So that should show up as http://mysite/phorum/mods/smileys/images/foo.gif. I bet if you look at your site running phorum, all smiley link references are "/mod/smileys/...", with no site name starter.
If that line is changed to this it works fine:
$prefix = $PHORUM["http_path"] . "/" . $modinfo["prefix"];
It seems that many modules use $PHORUM["http_path"]
directly. You can find the roughly 25 places $GLOBALS["http_path"]
is used in the tree with this command:
grep -i http_path
find .| grep \$GLOBALS
You will note that nowhere is this being set!
The code that uses this variable is only in 3 modules: bbcode, smiley, and the editor. This is very limited to part of help system (lang/smileys.php, lang/bbcode.php ), smiley insertion (smileylib.php), the bbcode color picker (js_color picker_v2.php), and a couple of lines that are overridden in the editor (editor_tools.php). Everything else uses $PHORUM["http_path"]
which is populated properly in common.php.
If you really don't believe me, please, try this very very simple test:
Again, the vast majority of code (over 45 places) use $PHORUM["http_path"]
, which is why it still "mainly works" despite the $GLOBALS version not being populated. And in almost all cases, if your main top-level site is the phorum (or you vlink in, like phorum.mysite.net/ -> /var/www/phorum), this all works fine. This only breaks when you place the forum in a sub-folder of a site, which apparently is not common practice.
@Woody14619: which php version do you use? I guess thats a change in PHPs handling of globals somewhere again. You know that $PHORUM['http_path'] and $GLOBALS['PHORUM']['http_path'] is actually the same? You don't have to set the $GLOBALS variables separately, its just the GLOBAL variant.
Several instances of bbcode.php and the smileys plugin are calling for:
$GLOBALS["PHORUM"]["http_path"]
Unfortunately in common.php, that's now being set as:
$GLOBALS["PHORUM"]["DATA"]["URL"]["HTTP_PATH"] = $PHORUM['http_path'];
That's causing lots of things to break when trying to create links back to the main site page and/or links for images (in the case of smiley plugin). A quick search/replace would fix this, as would adding back the path name at the less-structured place. Small bug, but one that would be frustrating to first time users that do a quick setup and find several small things busted. :)