added PMA_getenv() as a wrapper to $_SERVER, $_ENV, getenv() and apache_getenv()
This commit is contained in:
@@ -545,6 +545,30 @@ function PMA_checkPageValidity(&$page, $whitelist)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* trys to find the value for the given environment vriable name
|
||||
*
|
||||
* searchs in $_SERVER, $_ENV than trys getenv() and apache_getenv()
|
||||
* in this order
|
||||
*
|
||||
* @param string $var_name variable name
|
||||
* @return string value of $var or empty string
|
||||
*/
|
||||
function PMA_getenv($var_name) {
|
||||
if (isset($_SERVER[$var_name])) {
|
||||
return $_SERVER[$var_name];
|
||||
} elseif (isset($_ENV[$var_name])) {
|
||||
return $_ENV[$var_name];
|
||||
} elseif (getenv($var_name)) {
|
||||
return getenv($var_name);
|
||||
} elseif (function_exists('apache_getenv')
|
||||
&& apache_getenv($var_name, true)) {
|
||||
return apache_getenv($var_name, true);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* include here only libraries which contain only function definitions
|
||||
* no code im main()!
|
||||
|
Reference in New Issue
Block a user