PDA

View Full Version : 1.5beta 1 - $PHP_SELF in functions.php doesn't work


eon
12-22-2005, 07:21 PM
When you want to generate an "admin_main_menu" the function "eval_addon_admin_workspace_menu" use $PHP_SELF to generate the begin of the link (example: /admin/index.php).
But it can't find $PHP_SELF, so it gives the error:
Notice: Undefined variable: PHP_SELF in C:\webroot\pixelpost_1-5_beta1\includes\functions.php on line 455

Now the url of the link will be (see sourcecode):
<a href='?view=NEWITEM'>NEWITEM</a>
but this is what you want:
<a href='/admin/index.php?view=NEWITEM'>NEWITEM</a>

I think it is not a problem because the browser is correcting this (Firefox does).

GeoS
12-22-2005, 09:00 PM
We shouldnt use global variables but only system or enviroment arrays with such variables.
This should solve a lot of problems in the future (i.e. register globals set to OFF in PHP.INI).

se.nsuo.us
03-14-2006, 05:14 AM
Change line echo "<a href='".$PHP_SELF."?view=".strtolower($funcs['menu_name'])."'>".$funcs['menu_name']."</a>";
to
echo "<a href='".$_SERVER['PHP_SELF']."?view=".strtolower($funcs['menu_name'])."'>".$funcs['menu_name']."</a>";

but I feel we would be better off with hard coding index.php like
echo "<a href='"index.php?view=".strtolower($funcs['menu_name'])."'>".$funcs['menu_name']."</a>";

GeoS
03-14-2006, 04:16 PM
Fixed on CVS.