If $cfgPmaAbsoluteUri is empty the script now tries to guess it

This commit is contained in:
Loïc Chapeaux
2002-02-26 21:40:20 +00:00
parent 3f064f4ce7
commit ed4890000e
2 changed files with 29 additions and 5 deletions

View File

@@ -143,9 +143,28 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
$cfgLeftFrameLight = TRUE;
}
// Adds a trailing slash et the end of the phpMyAdmin uri if it does not
// exist
if ($cfgPmaAbsoluteUri != '' && substr($cfgPmaAbsoluteUri, -1) != '/') {
// If $cfgPmaAbsoluteUri is empty, tries to guess it
if (empty($cfgPmaAbsoluteUri)) {
if (!empty($_SERVER)) {
$HTTPS = (isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : '');
$SERVER_NAME = (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '');
$SERVER_PORT = (isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : '');
$SCRIPT_NAME = (isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '');
} else if (!empty($HTTP_SERVER_VARS)) {
$HTTPS = (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : '');
$SERVER_NAME = (isset($HTTP_SERVER_VARS['SERVER_NAME']) ? $HTTP_SERVER_VARS['SERVER_NAME'] : '');
$SERVER_PORT = (isset($HTTP_SERVER_VARS['SERVER_PORT']) ? $HTTP_SERVER_VARS['SERVER_PORT'] : '');
$SCRIPT_NAME = (isset($HTTP_SERVER_VARS['SCRIPT_NAME']) ? $HTTP_SERVER_VARS['SCRIPT_NAME'] : '');
} // end if... else if
if (!empty($SERVER_NAME) && !empty($SCRIPT_NAME)) {
$cfgPmaAbsoluteUri = (!empty($HTTPS) ? 'https' : 'http') . '://'
. $SERVER_NAME . (!empty($SERVER_PORT) ? ':' . $SERVER_PORT : '')
. substr($SCRIPT_NAME, 0, strrpos($SCRIPT_NAME, '/')+1);
} // end if
} // end if
// Else adds a trailing slash et the end of the phpMyAdmin uri if it does
// not exist
else if (substr($cfgPmaAbsoluteUri, -1) != '/') {
$cfgPmaAbsoluteUri .= '/';
}