From ed4890000eb6b7bda9e4e7bb88bd29215d4d6498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Tue, 26 Feb 2002 21:40:20 +0000 Subject: [PATCH] If $cfgPmaAbsoluteUri is empty the script now tries to guess it --- ChangeLog | 9 +++++++-- libraries/common.lib.php3 | 25 ++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79c7e03c5..438cd6e54 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,13 @@ phpMyAdmin - Changelog $Id$ $Source$ +2002-02-26 Loïc Chapeaux + * main.php3, lines 11-15; libraries/grab_globals.lib.php3; + libraries/auth/cookie.auth.lib.php3: fixed bug #522887 - Using + SSL -> cookies are unsecure. + * libraries/common.lib.php3, lines 146-164: if $cfgPmaAbsoluteUri is empty + the script now tries to guess it. + 2002-02-25 Loïc Chapeaux * lang/japanese-*: updated thanks to Yukihiro Kawada aka "luc" . @@ -12,8 +19,6 @@ $Source$ to Purodha B Blissenbach . * libraries/auth/*: patch #522671 - Add charset when asking for auth, thanks to "nijel". - * main.php3, lines 11-15; libraries/auth/cookie.auth.lib.php3: fixed bug - #522887 Using SSL -> cookies are unsecure. 2002-02-24 Loïc Chapeaux * lang/german.inc.php3: updated thanks to Alexander M. Turek. diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index bc6d72e8e..b11d9d683 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -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 .= '/'; }