Permalink
Browse files

Better fix for empty $_SERVER['PHP_SELF']

  • Loading branch information...
1 parent 34d78fc commit 75d30c7d94f9c8904fa333b838a515051f630df8 @acidvertigo acidvertigo committed Aug 16, 2011
Showing with 8 additions and 2 deletions.
  1. +4 −1 catalog/admin/includes/functions/html_output.php
  2. +4 −1 catalog/includes/functions/html_output.php
@@ -16,7 +16,10 @@ function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL') {
$page = tep_output_string($page);
if ($page == '') {
- $page = basename($HTTP_SERVER_VARS['PHP_SELF']);
+ $PHP_SELF = $_SERVER['PHP_SELF'];
+ if ( empty($PHP_SELF) )
+ $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
+ $page = basename($_SERVER['PHP_SELF']);
}
if ($connection == 'NONSSL') {
$link = HTTP_SERVER . DIR_WS_ADMIN;
@@ -18,7 +18,10 @@ function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $ad
$page = tep_output_string($page);
if (!tep_not_null($page)) {
- $page = basename($HTTP_SERVER_VARS['PHP_SELF']);
+ $PHP_SELF = $_SERVER['PHP_SELF'];
+ if ( empty($PHP_SELF) )
+ $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
+ $page = basename($_SERVER['PHP_SELF']);
}
if ($connection == 'NONSSL') {

0 comments on commit 75d30c7

Please sign in to comment.