$cfg['PmaAbsoluteUri'] autodetection did not work as expected if php was in CGI mode.

This commit is contained in:
Alexander M. Turek
2003-03-03 12:24:51 +00:00
parent 971c256a9f
commit 93f73a0250
2 changed files with 18 additions and 2 deletions

View File

@@ -10,7 +10,9 @@ $Source$
containing quotes.
* libraries/common.lib.php3:
- Avoid reloading the left frame twice;
- PHP3 compatibility.
- PHP3 compatibility;
- $cfg['PmaAbsoluteUri'] autodetection did not work as expected if php was
in CGI mode.
2003-03-03 Marc Delisle <lem9@users.sourceforge.net>
* badwords.txt: bug 692874: "date" is not a reserved word

View File

@@ -557,6 +557,12 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
if (isset($$SERVER_ARRAY['SERVER_PORT'])) {
$SERVER_PORT = $$SERVER_ARRAY['SERVER_PORT'];
}
if (isset($$SERVER_ARRAY['REQUEST_URI'])) {
$REQUEST_URI = $$SERVER_ARRAY['REQUEST_URI'];
}
if (isset($$SERVER_ARRAY['PATH_INFO'])) {
$PATH_INFO = $$SERVER_ARRAY['PATH_INFO'];
}
$port_in_HTTP_HOST = (strpos($HTTP_HOST, ':') > 0);
$cfg['PmaAbsoluteUri'] = ((!empty($HTTPS) && strtolower($HTTPS) != 'off') ? 'https' : 'http') . '://'
. $HTTP_HOST;
@@ -568,7 +574,15 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$cfg['PmaAbsoluteUri'] .= ((!empty($SERVER_PORT) && !$port_in_HTTP_HOST) ? ':' . $SERVER_PORT : '');
}
$cfg['PmaAbsoluteUri'] .= substr($PHP_SELF, 0, strrpos($PHP_SELF, '/') + 1);
// rabus: if php is in CGI mode, $PHP_SELF often contains the path to the CGI executable.
// This is why we try to get the path from $REQUEST_URI or $PATH_INFO first.
if (isset($REQUEST_URI)) {
$cfg['PmaAbsoluteUri'] .= substr($REQUEST_URI, 0, strrpos($REQUEST_URI, '/') + 1);
} else if (isset($PATH_INFO)) {
$cfg['PmaAbsoluteUri'] .= substr($PATH_INFO, 0, strrpos($PATH_INFO, '/') + 1);
} else {
$cfg['PmaAbsoluteUri'] .= substr($PHP_SELF, 0, strrpos($PHP_SELF, '/') + 1);
}
// We display the warning by default, but not if it is disabled thru
// via the $cfg['PmaAbsoluteUri_DisableWarning'] variable.