From 971c256a9f7c7a2b27e85903d57406eb63d90572 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Mon, 3 Mar 2003 12:03:05 +0000 Subject: [PATCH] PHP3 compatibility --- ChangeLog | 4 +++- libraries/common.lib.php3 | 26 +++++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d81efcb9..d7566d388 100755 --- a/ChangeLog +++ b/ChangeLog @@ -8,7 +8,9 @@ $Source$ 2003-03-03 Alexander M. Turek * tbl_replace_fields.php3: Bugfix: User was unable to insert values containing quotes. - * libraries/common.lib.php3: Avoid reloading the left frame twice. + * libraries/common.lib.php3: + - Avoid reloading the left frame twice; + - PHP3 compatibility. 2003-03-03 Marc Delisle * badwords.txt: bug 692874: "date" is not a reserved word diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index d171f79b5..3a579c318 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -541,15 +541,31 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} // work anyway, but display a big warning on the main.php3 // page. if (empty($cfg['PmaAbsoluteUri'])) { - $port_in_HTTP_HOST = (strpos($HTTP_SERVER_VARS['HTTP_HOST'], ':') > 0); - $cfg['PmaAbsoluteUri'] = ((!empty($HTTP_SERVER_VARS['HTTPS']) && strtolower($HTTP_SERVER_VARS['HTTPS']) != 'off') ? 'https' : 'http') . '://' - . $HTTP_SERVER_VARS['HTTP_HOST']; + if (!empty($_SERVER)) { + $SERVER_ARRAY = '_SERVER'; + } else if (!empty($HTTP_SERVER_VARS)) { + $SERVER_ARRAY = 'HTTP_SERVER_VARS'; + } else { + $SERVER_ARRAY = 'GLOBALS'; + } // end if + if (isset($$SERVER_ARRAY['HTTP_HOST'])) { + $HTTP_HOST = $$SERVER_ARRAY['HTTP_HOST']; + } + if (isset($$SERVER_ARRAY['HTTPS'])) { + $HTTPS = $$SERVER_ARRAY['HTTPS']; + } + if (isset($$SERVER_ARRAY['SERVER_PORT'])) { + $SERVER_PORT = $$SERVER_ARRAY['SERVER_PORT']; + } + $port_in_HTTP_HOST = (strpos($HTTP_HOST, ':') > 0); + $cfg['PmaAbsoluteUri'] = ((!empty($HTTPS) && strtolower($HTTPS) != 'off') ? 'https' : 'http') . '://' + . $HTTP_HOST; // if $cfg['PmaAbsoluteUri'] is empty and port == 80 or port == 443, do not add ":80" or ":443" // to the generated URL -> prevents a double password query in case of http authentication. - if (!(!$port_in_HTTP_HOST && !empty($HTTP_SERVER_VARS['SERVER_PORT']) && ($HTTP_SERVER_VARS['SERVER_PORT'] == 80 || $HTTP_SERVER_VARS['SERVER_PORT'] == 443))) { - $cfg['PmaAbsoluteUri'] .= ((!empty($HTTP_SERVER_VARS['SERVER_PORT']) && !$port_in_HTTP_HOST) ? ':' . $HTTP_SERVER_VARS['SERVER_PORT'] : ''); + if (!(!$port_in_HTTP_HOST && !empty($SERVER_PORT) && ($SERVER_PORT == 80 || $SERVER_PORT == 443))) { + $cfg['PmaAbsoluteUri'] .= ((!empty($SERVER_PORT) && !$port_in_HTTP_HOST) ? ':' . $SERVER_PORT : ''); } $cfg['PmaAbsoluteUri'] .= substr($PHP_SELF, 0, strrpos($PHP_SELF, '/') + 1);