fixed not initilized variable in getCookiePath();

use new PMA_getenv();
This commit is contained in:
Sebastian Mendel
2006-04-11 14:04:19 +00:00
parent 0e1f1c0997
commit f365bb5d04

View File

@@ -130,8 +130,8 @@ class PMA_Config
*/ */
function checkClient() function checkClient()
{ {
if (getenv('HTTP_USER_AGENT')) { if (PMA_getenv('HTTP_USER_AGENT')) {
$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT'); $HTTP_USER_AGENT = PMA_getenv('HTTP_USER_AGENT');
} elseif (!isset($HTTP_USER_AGENT)) { } elseif (!isset($HTTP_USER_AGENT)) {
$HTTP_USER_AGENT = ''; $HTTP_USER_AGENT = '';
} }
@@ -231,11 +231,11 @@ class PMA_Config
*/ */
function checkWebServer() function checkWebServer()
{ {
if (getenv('SERVER_SOFTWARE') if (PMA_getenv('SERVER_SOFTWARE')
// some versions return Microsoft-IIS, some Microsoft/IIS // some versions return Microsoft-IIS, some Microsoft/IIS
// we could use a preg_match() but it's slower // we could use a preg_match() but it's slower
&& stristr(getenv('SERVER_SOFTWARE'), 'Microsoft') && stristr(PMA_getenv('SERVER_SOFTWARE'), 'Microsoft')
&& stristr(getenv('SERVER_SOFTWARE'), 'IIS')) { && stristr(PMA_getenv('SERVER_SOFTWARE'), 'IIS')) {
$this->set('PMA_IS_IIS', 1); $this->set('PMA_IS_IIS', 1);
} else { } else {
$this->set('PMA_IS_IIS', 0); $this->set('PMA_IS_IIS', 0);
@@ -513,51 +513,51 @@ class PMA_Config
$url = array(); $url = array();
// At first we try to parse REQUEST_URI, it might contain full URI // At first we try to parse REQUEST_URI, it might contain full URI
if (getenv('REQUEST_URI')) { if (PMA_getenv('REQUEST_URI')) {
$url = parse_url(getenv('REQUEST_URI')); $url = parse_url(PMA_getenv('REQUEST_URI'));
} }
// If we don't have scheme, we didn't have full URL so we need to // If we don't have scheme, we didn't have full URL so we need to
// dig deeper // dig deeper
if (empty($url['scheme'])) { if (empty($url['scheme'])) {
// Scheme // Scheme
if (getenv('HTTP_SCHEME')) { if (PMA_getenv('HTTP_SCHEME')) {
$url['scheme'] = getenv('HTTP_SCHEME'); $url['scheme'] = PMA_getenv('HTTP_SCHEME');
} else { } else {
$url['scheme'] = $url['scheme'] =
getenv('HTTPS') && strtolower(getenv('HTTPS')) != 'off' PMA_getenv('HTTPS') && strtolower(PMA_getenv('HTTPS')) != 'off'
? 'https' ? 'https'
: 'http'; : 'http';
} }
// Host and port // Host and port
if (getenv('HTTP_HOST')) { if (PMA_getenv('HTTP_HOST')) {
if (strpos(getenv('HTTP_HOST'), ':') !== false) { if (strpos(PMA_getenv('HTTP_HOST'), ':') !== false) {
list($url['host'], $url['port']) = list($url['host'], $url['port']) =
explode(':', getenv('HTTP_HOST')); explode(':', PMA_getenv('HTTP_HOST'));
} else { } else {
$url['host'] = getenv('HTTP_HOST'); $url['host'] = PMA_getenv('HTTP_HOST');
} }
} elseif (getenv('SERVER_NAME')) { } elseif (PMA_getenv('SERVER_NAME')) {
$url['host'] = getenv('SERVER_NAME'); $url['host'] = PMA_getenv('SERVER_NAME');
} else { } else {
$this->error_pma_uri = true; $this->error_pma_uri = true;
return false; return false;
} }
// If we didn't set port yet... // If we didn't set port yet...
if (empty($url['port']) && getenv('SERVER_PORT')) { if (empty($url['port']) && PMA_getenv('SERVER_PORT')) {
$url['port'] = getenv('SERVER_PORT'); $url['port'] = PMA_getenv('SERVER_PORT');
} }
// And finally the path could be already set from REQUEST_URI // And finally the path could be already set from REQUEST_URI
if (empty($url['path'])) { if (empty($url['path'])) {
if (getenv('PATH_INFO')) { if (PMA_getenv('PATH_INFO')) {
$path = parse_url(getenv('PATH_INFO')); $path = parse_url(PMA_getenv('PATH_INFO'));
} else { } else {
// PHP_SELF in CGI often points to cgi executable, so use it // PHP_SELF in CGI often points to cgi executable, so use it
// as last choice // as last choice
$path = parse_url(getenv('PHP_SELF')); $path = parse_url(PMA_getenv('PHP_SELF'));
} }
$url['path'] = $path['path']; $url['path'] = $path['path'];
} }
@@ -627,7 +627,7 @@ class PMA_Config
if (substr($pma_absolute_uri, 0, 7) != 'http://' if (substr($pma_absolute_uri, 0, 7) != 'http://'
&& substr($pma_absolute_uri, 0, 8) != 'https://') { && substr($pma_absolute_uri, 0, 8) != 'https://') {
$pma_absolute_uri = $pma_absolute_uri =
(getenv('HTTPS') && strtolower(getenv('HTTPS')) != 'off' (PMA_getenv('HTTPS') && strtolower(PMA_getenv('HTTPS')) != 'off'
? 'https' ? 'https'
: 'http') : 'http')
. ':' . (substr($pma_absolute_uri, 0, 2) == '//' ? '' : '//') . ':' . (substr($pma_absolute_uri, 0, 2) == '//' ? '' : '//')
@@ -703,19 +703,19 @@ class PMA_Config
$url = array(); $url = array();
// At first we try to parse REQUEST_URI, it might contain full URI // At first we try to parse REQUEST_URI, it might contain full URI
if (getenv('REQUEST_URI')) { if (PMA_getenv('REQUEST_URI')) {
$url = parse_url(getenv('REQUEST_URI')); $url = parse_url(PMA_getenv('REQUEST_URI'));
} }
// If we don't have scheme, we didn't have full URL so we need to // If we don't have scheme, we didn't have full URL so we need to
// dig deeper // dig deeper
if (empty($url['scheme'])) { if (empty($url['scheme'])) {
// Scheme // Scheme
if (getenv('HTTP_SCHEME')) { if (PMA_getenv('HTTP_SCHEME')) {
$url['scheme'] = getenv('HTTP_SCHEME'); $url['scheme'] = PMA_getenv('HTTP_SCHEME');
} else { } else {
$url['scheme'] = $url['scheme'] =
getenv('HTTPS') && strtolower(getenv('HTTPS')) != 'off' PMA_getenv('HTTPS') && strtolower(PMA_getenv('HTTPS')) != 'off'
? 'https' ? 'https'
: 'http'; : 'http';
} }
@@ -750,23 +750,28 @@ class PMA_Config
return $cookie_path; return $cookie_path;
} }
if (getenv('REQUEST_URI')) { $url = '';
$url = parse_url(getenv('REQUEST_URI'));
if (PMA_PMA_getenv('REQUEST_URI')) {
$url = PMA_getenv('REQUEST_URI');
} }
// If we don't have path // If we don't have path
if (empty($url['path'])) { if (empty($url)) {
if (getenv('PATH_INFO')) { if (PMA_getenv('PATH_INFO')) {
$url = parse_url(getenv('PATH_INFO')); $url = PMA_getenv('PATH_INFO');
} elseif (getenv('PHP_SELF')) { } elseif (PMA_getenv('PHP_SELF')) {
// PHP_SELF in CGI often points to cgi executable, so use it // PHP_SELF in CGI often points to cgi executable, so use it
// as last choice // as last choice
$url = parse_url(getenv('PHP_SELF')); $url = PMA_getenv('PHP_SELF');
} elseif (PMA_getenv('SCRIPT_NAME')) {
$url = PMA_getenv('PHP_SELF');
} }
} }
$cookie_path = substr($url['path'], 0, strrpos($url['path'], '/')) $url = parse_url($url);
. '/';
$cookie_path = substr($url['path'], 0, strrpos($url['path'], '/')) . '/';
return $cookie_path; return $cookie_path;
} }