Geeklog-Core / geeklog

Geeklog - The Secure CMS.
https://www.geeklog.net
24 stars 19 forks source link

Links Menu item does not work in some cases when URL Rewrite is enabled #999

Closed eSilverStrike closed 4 years ago

eSilverStrike commented 4 years ago

The Links Menu Item doesn't work in some cases when URL Rewrite is enabled (and URL Routing is not)

For some reason on geeklog.net the links menu item doesn't work and returns a Geeklog system message: Error for Anonymous users: You do not have sufficient access rights to view this category. Error for Admin: No such category exists.

The link is: https://www.geeklog.net/links/index.php

This works fine on a similar setup: My development machine that has apache and php 7.2 running

Looking into it further it looks like geeklog.net thinks the category id is "links" which it should be nothing. Note: this link below does work on Geeklog.net

https://www.geeklog.net/links/index.php/

So for some reason the URL class either when set the COM_setArgNames or COM_getArgument cannot handle and empty variable on some apache setups.

eSilverStrike commented 4 years ago

Ahh I hate dealing with the URL Class. Too many different server combinations and very hard to debug. This fix shouldn't hopefully affect anything else.

I added a check for Apache to work for PHP FastCGI. This check is needed if the url does not contain any variables (ie "/links/index.php") in FastCGI on Apache. If it contains variables then both work the same way.

On Apache that does not use FastCGI then none of the variables gets set ($_SERVER['PATH_INFO'], $_ENV['ORIG_PATH_INFO'], $_SERVER['ORIG_PATH_INFO']) .

With FastCGI then $_ENV['ORIG_PATH_INFO'] gets set which will equal $_SERVER['PATH_INFO']. If this is the case the no arguments will be set by the url class.