replaced $_SERVER with getenv()
This commit is contained in:
@@ -6,7 +6,12 @@ $Id$
|
||||
$Source$
|
||||
|
||||
2006-03-06 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
||||
* libraries/Config.class.php: replaced $_SERVER with getenv()
|
||||
* libraries/Config.class.php, libraries/select_lang.lib.php,
|
||||
libraries/footer.inc.php, libraries/ip_allow_deny.lib.php,
|
||||
libraries/common.lib.php, libraries/header.inc.php,
|
||||
libraries/grab_globals.lib.php, libraries/auth/cookie.auth.lib.php,
|
||||
libraries/auth/http.auth.lib.php, libraries/fpdf/fdpf.php:
|
||||
replaced $_SERVER with getenv()
|
||||
|
||||
2006-03-04 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* lang/swedish: Update, thanks to Björn T. Hallberg - bjornth.
|
||||
|
@@ -19,9 +19,9 @@ $current_time = time();
|
||||
// Uses faster mcrypt library if available
|
||||
// (Note: mcrypt.lib.php needs $cookie_path and $is_https)
|
||||
if (function_exists('mcrypt_encrypt') || PMA_dl('mcrypt')) {
|
||||
require_once('./libraries/mcrypt.lib.php');
|
||||
require_once './libraries/mcrypt.lib.php';
|
||||
} else {
|
||||
require_once('./libraries/blowfish.php');
|
||||
require_once './libraries/blowfish.php';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +101,7 @@ function PMA_auth()
|
||||
|
||||
/* HTML header */
|
||||
$page_title = 'phpMyAdmin ' . PMA_VERSION;
|
||||
require('./libraries/header_meta_style.inc.php');
|
||||
require './libraries/header_meta_style.inc.php';
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
//<![CDATA[
|
||||
@@ -115,7 +115,7 @@ if (top != self) {
|
||||
|
||||
<body class="loginform">
|
||||
|
||||
<?php require('./libraries/header_custom.inc.php'); ?>
|
||||
<?php require './libraries/header_custom.inc.php'; ?>
|
||||
|
||||
<a href="http://www.phpmyadmin.net" target="_blank" class="logo"><?php
|
||||
$logo_image = $GLOBALS['pmaThemeImage'] . 'logo_right.png';
|
||||
@@ -143,8 +143,8 @@ echo sprintf( $GLOBALS['strWelcome'],
|
||||
// Displays the languages form
|
||||
if (empty($cfg['Lang'])) {
|
||||
echo "\n";
|
||||
require_once('./libraries/display_select_lang.lib.php');
|
||||
PMA_select_language(TRUE);
|
||||
require_once './libraries/display_select_lang.lib.php';
|
||||
PMA_select_language(true);
|
||||
}
|
||||
echo "\n\n";
|
||||
|
||||
@@ -156,7 +156,7 @@ echo sprintf( $GLOBALS['strWelcome'],
|
||||
<?php echo $GLOBALS['strSecretRequired']; ?>
|
||||
</div>
|
||||
<?php
|
||||
require('./libraries/footer_custom.inc.php');
|
||||
require './libraries/footer_custom.inc.php';
|
||||
echo ' </body>' . "\n"
|
||||
. '</html>';
|
||||
exit();
|
||||
@@ -196,8 +196,8 @@ echo sprintf( $GLOBALS['strWelcome'],
|
||||
?>
|
||||
>
|
||||
<?php
|
||||
require_once('./libraries/select_server.lib.php');
|
||||
PMA_select_server(FALSE, FALSE);
|
||||
require_once './libraries/select_server.lib.php';
|
||||
PMA_select_server(false, false);
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@@ -247,7 +247,7 @@ if (uname.value == '') {
|
||||
//-->
|
||||
</script>
|
||||
|
||||
<?php require('./libraries/footer_custom.inc.php'); ?>
|
||||
<?php require './libraries/footer_custom.inc.php'; ?>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -255,7 +255,7 @@ if (uname.value == '') {
|
||||
<?php
|
||||
exit();
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
} // end of the 'PMA_auth()' function
|
||||
|
||||
|
||||
@@ -285,13 +285,13 @@ function PMA_auth_check()
|
||||
|
||||
// avoid an error in mcrypt
|
||||
if (empty($GLOBALS['cfg']['blowfish_secret'])) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialization
|
||||
$PHP_AUTH_USER = $PHP_AUTH_PW = '';
|
||||
$from_cookie = FALSE;
|
||||
$from_form = FALSE;
|
||||
$from_cookie = false;
|
||||
$from_form = false;
|
||||
|
||||
// The user wants to be logged out -> delete password cookie
|
||||
if (!empty($old_usr)) {
|
||||
@@ -305,7 +305,7 @@ function PMA_auth_check()
|
||||
if ($GLOBALS['cfg']['AllowArbitraryServer']) {
|
||||
$pma_auth_server = $pma_servername;
|
||||
}
|
||||
$from_form = TRUE;
|
||||
$from_form = true;
|
||||
}
|
||||
|
||||
// At the end, try to set the $PHP_AUTH_USER & $PHP_AUTH_PW variables
|
||||
@@ -316,17 +316,17 @@ function PMA_auth_check()
|
||||
// servername
|
||||
if (!empty($pma_cookie_servername)) {
|
||||
$pma_auth_server = $pma_cookie_servername;
|
||||
$from_cookie = TRUE;
|
||||
$from_cookie = true;
|
||||
} elseif (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_servername-' . $server])) {
|
||||
$pma_auth_server = $_COOKIE['pma_cookie_servername-' . $server];
|
||||
$from_cookie = TRUE;
|
||||
$from_cookie = true;
|
||||
}
|
||||
}
|
||||
|
||||
// username
|
||||
if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_username-' . $server])) {
|
||||
$PHP_AUTH_USER = $_COOKIE['pma_cookie_username-' . $server];
|
||||
$from_cookie = TRUE;
|
||||
$from_cookie = true;
|
||||
}
|
||||
$decrypted_user = PMA_blowfish_decrypt($PHP_AUTH_USER, $GLOBALS['cfg']['blowfish_secret']);
|
||||
if (!empty($decrypted_user)) {
|
||||
@@ -344,10 +344,10 @@ function PMA_auth_check()
|
||||
// alerting users with a error after "much" time has passed,
|
||||
// for example next morning.
|
||||
if ($decrypted_time > $GLOBALS['current_time'] - ($GLOBALS['cfg']['LoginCookieValidity'] * 4)) {
|
||||
$GLOBALS['no_activity'] = TRUE;
|
||||
$GLOBALS['no_activity'] = true;
|
||||
PMA_auth_fails();
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// password
|
||||
@@ -356,7 +356,7 @@ function PMA_auth_check()
|
||||
} elseif (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_password-' . $server])) {
|
||||
$PHP_AUTH_PW = $_COOKIE['pma_cookie_password-' . $server];
|
||||
} else {
|
||||
$from_cookie = FALSE;
|
||||
$from_cookie = false;
|
||||
}
|
||||
$PHP_AUTH_PW = PMA_blowfish_decrypt($PHP_AUTH_PW, $GLOBALS['cfg']['blowfish_secret'] . $decrypted_time);
|
||||
|
||||
@@ -367,12 +367,12 @@ function PMA_auth_check()
|
||||
|
||||
// Returns whether we get authentication settings or not
|
||||
if (!$from_cookie && !$from_form) {
|
||||
return FALSE;
|
||||
return false;
|
||||
} elseif ($from_cookie) {
|
||||
return TRUE;
|
||||
return true;
|
||||
} else {
|
||||
// we don't need to strip here, it is done in grab_globals
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
} // end of the 'PMA_auth_check()' function
|
||||
|
||||
@@ -412,13 +412,13 @@ function PMA_auth_set_user()
|
||||
} // end for
|
||||
} // end if
|
||||
|
||||
$pma_server_changed = FALSE;
|
||||
$pma_server_changed = false;
|
||||
if ($GLOBALS['cfg']['AllowArbitraryServer']
|
||||
&& isset($pma_auth_server) && !empty($pma_auth_server)
|
||||
&& ($cfg['Server']['host'] != $pma_auth_server)
|
||||
) {
|
||||
$cfg['Server']['host'] = $pma_auth_server;
|
||||
$pma_server_changed = TRUE;
|
||||
$pma_server_changed = true;
|
||||
}
|
||||
$cfg['Server']['user'] = $PHP_AUTH_USER;
|
||||
$cfg['Server']['password'] = $PHP_AUTH_PW;
|
||||
@@ -481,7 +481,7 @@ function PMA_auth_set_user()
|
||||
exit();
|
||||
} // end if
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
} // end of the 'PMA_auth_set_user()' function
|
||||
|
||||
|
||||
@@ -494,7 +494,7 @@ function PMA_auth_set_user()
|
||||
*/
|
||||
function PMA_auth_fails()
|
||||
{
|
||||
global $conn_error, $server;
|
||||
global $conn_error, $server;
|
||||
|
||||
// Deletes password cookie and displays the login form
|
||||
setcookie('pma_cookie_password-' . $server, '', 0, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
|
||||
@@ -504,8 +504,8 @@ global $conn_error, $server;
|
||||
} elseif (isset($GLOBALS['no_activity']) && $GLOBALS['no_activity']) {
|
||||
$conn_error = sprintf($GLOBALS['strNoActivity'], $GLOBALS['cfg']['LoginCookieValidity']);
|
||||
// Remember where we got timeout to return on same place
|
||||
if (isset($_SERVER['SCRIPT_NAME'])) {
|
||||
$GLOBALS['target'] = basename($_SERVER['SCRIPT_NAME']);
|
||||
if (getenv('SCRIPT_NAME')) {
|
||||
$GLOBALS['target'] = basename(getenv('SCRIPT_NAME'));
|
||||
}
|
||||
} elseif (PMA_DBI_getError()) {
|
||||
$conn_error = PMA_sanitize(PMA_DBI_getError());
|
||||
@@ -517,7 +517,7 @@ global $conn_error, $server;
|
||||
|
||||
PMA_auth();
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
} // end of the 'PMA_auth_fails()' function
|
||||
|
||||
?>
|
||||
|
@@ -29,11 +29,11 @@ function PMA_auth() {
|
||||
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
|
||||
/* HTML header */
|
||||
$page_title = $GLOBALS['strAccessDenied'];
|
||||
require('./libraries/header_meta_style.inc.php');
|
||||
require './libraries/header_meta_style.inc.php';
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<?php require('./libraries/header_custom.inc.php'); ?>
|
||||
<?php require './libraries/header_custom.inc.php'; ?>
|
||||
|
||||
<br /><br />
|
||||
<center>
|
||||
@@ -42,7 +42,7 @@ function PMA_auth() {
|
||||
<br />
|
||||
<div class="warning"><?php echo $GLOBALS['strWrongUser']; ?></div>
|
||||
|
||||
<?php require('./libraries/footer_custom.inc.php'); ?>
|
||||
<?php require './libraries/footer_custom.inc.php'; ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -79,23 +79,19 @@ function PMA_auth_check()
|
||||
// 'register_globals' and the 'variables_order' directives
|
||||
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
|
||||
if (empty($PHP_AUTH_USER)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
$PHP_AUTH_USER = $_SERVER['PHP_AUTH_USER'];
|
||||
}
|
||||
if (getenv('PHP_AUTH_USER')) {
|
||||
$PHP_AUTH_USER = getenv('PHP_AUTH_USER');
|
||||
} elseif (getenv('REMOTE_USER')) {
|
||||
// CGI, might be encoded, see bellow
|
||||
elseif (@getenv('REMOTE_USER')) {
|
||||
$PHP_AUTH_USER = getenv('REMOTE_USER');
|
||||
}
|
||||
} elseif (getenv('AUTH_USER')) {
|
||||
// WebSite Professional
|
||||
elseif (@getenv('AUTH_USER')) {
|
||||
$PHP_AUTH_USER = getenv('AUTH_USER');
|
||||
}
|
||||
} elseif (getenv('HTTP_AUTHORIZATION')) {
|
||||
// IIS, might be encoded, see bellow
|
||||
elseif (@getenv('HTTP_AUTHORIZATION')) {
|
||||
$PHP_AUTH_USER = getenv('HTTP_AUTHORIZATION');
|
||||
}
|
||||
} elseif (getenv('Authorization')) {
|
||||
// FastCGI, might be encoded, see bellow
|
||||
elseif (@getenv('Authorization')) {
|
||||
$PHP_AUTH_USER = getenv('Authorization');
|
||||
}
|
||||
}
|
||||
@@ -103,8 +99,8 @@ function PMA_auth_check()
|
||||
// 'register_globals' and the 'variables_order' directives
|
||||
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
|
||||
if (empty($PHP_AUTH_PW)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['PHP_AUTH_PW'])) {
|
||||
$PHP_AUTH_PW = $_SERVER['PHP_AUTH_PW'];
|
||||
if (getenv('PHP_AUTH_PW')) {
|
||||
$PHP_AUTH_PW = getenv('PHP_AUTH_PW');
|
||||
}
|
||||
// Apache/CGI
|
||||
elseif (@getenv('REMOTE_PASSWORD')) {
|
||||
@@ -119,7 +115,7 @@ function PMA_auth_check()
|
||||
// Decode possibly encoded information (used by IIS/CGI/FastCGI)
|
||||
if (strcmp(substr($PHP_AUTH_USER, 0, 6), 'Basic ') == 0) {
|
||||
$usr_pass = base64_decode(substr($PHP_AUTH_USER, 6));
|
||||
if (!empty($usr_pass) && strpos($usr_pass, ':') !== FALSE) {
|
||||
if (!empty($usr_pass) && strpos($usr_pass, ':') !== false) {
|
||||
list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', $usr_pass);
|
||||
}
|
||||
unset($usr_pass);
|
||||
@@ -133,9 +129,9 @@ function PMA_auth_check()
|
||||
|
||||
// Returns whether we get authentication settings or not
|
||||
if (empty($PHP_AUTH_USER)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
} else {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
} // end of the 'PMA_auth_check()' function
|
||||
|
||||
@@ -175,7 +171,7 @@ function PMA_auth_set_user()
|
||||
$cfg['Server']['user'] = $PHP_AUTH_USER;
|
||||
$cfg['Server']['password'] = $PHP_AUTH_PW;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
} // end of the 'PMA_auth_set_user()' function
|
||||
|
||||
|
||||
@@ -190,7 +186,7 @@ function PMA_auth_fails()
|
||||
{
|
||||
PMA_auth();
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
} // end of the 'PMA_auth_fails()' function
|
||||
|
||||
?>
|
||||
|
@@ -1867,7 +1867,7 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
|
||||
} elseif (!empty($tab['active'])
|
||||
|| (isset($GLOBALS['active_page'])
|
||||
&& $GLOBALS['active_page'] == $tab['link'])
|
||||
|| basename($_SERVER['PHP_SELF']) == $tab['link'])
|
||||
|| basename(getenv('PHP_SELF')) == $tab['link'])
|
||||
{
|
||||
$tab['class'] = 'active';
|
||||
}
|
||||
@@ -2579,7 +2579,7 @@ if (isset($_POST['usesubform'])) {
|
||||
$_POST = $subform;
|
||||
$_REQUEST = $subform;
|
||||
if (isset($_POST['redirect'])
|
||||
&& $_POST['redirect'] != basename($_SERVER['PHP_SELF'])) {
|
||||
&& $_POST['redirect'] != basename(getenv('PHP_SELF'))) {
|
||||
$__redirect = $_POST['redirect'];
|
||||
unset($_POST['redirect']);
|
||||
} // end if (isset($_POST['redirect']))
|
||||
|
@@ -80,13 +80,13 @@ if (!isset($GLOBALS['checked_special'])) {
|
||||
$GLOBALS['checked_special'] = FALSE;
|
||||
}
|
||||
|
||||
if (isset($_SERVER['SCRIPT_NAME']) && empty($_POST) && !$GLOBALS['checked_special']) {
|
||||
if (getenv('SCRIPT_NAME') && empty($_POST) && !$GLOBALS['checked_special']) {
|
||||
echo '<div id="selflink" class="print_ignore">' . "\n";
|
||||
$url_params['target'] = basename($_SERVER['SCRIPT_NAME']);
|
||||
$url_params['target'] = basename(getenv('SCRIPT_NAME'));
|
||||
echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"'
|
||||
. ' title="' . $GLOBALS['strOpenNewWindow'] . '" target="_blank">';
|
||||
/*
|
||||
echo '<a href="index.php?target=' . basename($_SERVER['SCRIPT_NAME']);
|
||||
echo '<a href="index.php?target=' . basename(getenv('SCRIPT_NAME'));
|
||||
$url = PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', isset($GLOBALS['table']) ? $GLOBALS['table'] : '');
|
||||
if (!empty($url)) {
|
||||
echo '&' . $url;
|
||||
|
@@ -1019,7 +1019,7 @@ function Output($name='',$dest='')
|
||||
//Send to standard output
|
||||
// lem9
|
||||
//if(isset($HTTP_SERVER_VARS['SERVER_NAME']))
|
||||
if(isset($_SERVER['SERVER_NAME']))
|
||||
if(getenv('SERVER_NAME'))
|
||||
{
|
||||
//We send to a browser
|
||||
Header('Content-Type: application/pdf');
|
||||
@@ -1034,7 +1034,7 @@ function Output($name='',$dest='')
|
||||
//Download file
|
||||
// lem9
|
||||
//if(isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']) and strpos($HTTP_SERVER_VARS['HTTP_USER_AGENT'],'MSIE'))
|
||||
if(isset($_SERVER['HTTP_USER_AGENT']) and strpos($_SERVER['HTTP_USER_AGENT'],'MSIE'))
|
||||
if(getenv('HTTP_USER_AGENT') and strpos(getenv('HTTP_USER_AGENT'), 'MSIE'))
|
||||
Header('Content-Type: application/force-download');
|
||||
else
|
||||
Header('Content-Type: application/octet-stream');
|
||||
@@ -1619,7 +1619,7 @@ function _out($s)
|
||||
//Handle special IE contype request
|
||||
// lem9
|
||||
//if(isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']) and $HTTP_SERVER_VARS['HTTP_USER_AGENT']=='contype')
|
||||
if(isset($_SERVER['HTTP_USER_AGENT']) and $_SERVER['HTTP_USER_AGENT']=='contype')
|
||||
if(getenv('HTTP_USER_AGENT') == 'contype')
|
||||
{
|
||||
Header('Content-Type: application/pdf');
|
||||
exit;
|
||||
|
@@ -82,39 +82,38 @@ $_import_blacklist = array(
|
||||
//'/^PMA_.*$/i', // other PMA variables
|
||||
);
|
||||
|
||||
if ( ! empty( $_GET ) ) {
|
||||
if (! empty($_GET)) {
|
||||
PMA_gpc_extract($_GET, $GLOBALS);
|
||||
}
|
||||
|
||||
if ( ! empty( $_POST ) ) {
|
||||
if (! empty($_POST)) {
|
||||
PMA_gpc_extract($_POST, $GLOBALS);
|
||||
}
|
||||
|
||||
if ( ! empty( $_FILES ) ) {
|
||||
foreach ( $_FILES AS $name => $value ) {
|
||||
if (! empty($_FILES)) {
|
||||
foreach ($_FILES as $name => $value) {
|
||||
$$name = $value['tmp_name'];
|
||||
${$name . '_name'} = $value['name'];
|
||||
}
|
||||
unset( $name, $value );
|
||||
unset($name, $value);
|
||||
}
|
||||
|
||||
if ( ! empty( $_SERVER ) ) {
|
||||
$server_vars = array('PHP_SELF', 'HTTP_ACCEPT_LANGUAGE', 'HTTP_AUTHORIZATION');
|
||||
foreach ( $server_vars as $current ) {
|
||||
/**
|
||||
* globalize some environment variables
|
||||
*/
|
||||
$server_vars = array('PHP_SELF', 'HTTP_ACCEPT_LANGUAGE', 'HTTP_AUTHORIZATION');
|
||||
foreach ($server_vars as $current) {
|
||||
// its not important HOW we detect html tags
|
||||
// its more important to prevent XSS
|
||||
// so its not important if we result in an invalid string,
|
||||
// its even better than a XSS capable string
|
||||
if ( isset( $_SERVER[$current] ) && false === strpos($_SERVER[$current], '<') ) {
|
||||
$$current = $_SERVER[$current];
|
||||
if (getenv($current) && false === strpos(getenv($current), '<')) {
|
||||
$$current = getenv($current);
|
||||
// already importet by register_globals?
|
||||
} elseif ( ! isset( $$current ) || false !== strpos($$current, '<') ) {
|
||||
} elseif (! isset($$current) || false !== strpos($$current, '<')) {
|
||||
$$current = '';
|
||||
}
|
||||
}
|
||||
unset( $server_vars, $current );
|
||||
} // end if
|
||||
|
||||
unset( $_import_blacklist );
|
||||
}
|
||||
unset($server_vars, $current, $_import_blacklist);
|
||||
|
||||
?>
|
||||
|
@@ -2,15 +2,15 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once './libraries/common.lib.php';
|
||||
|
||||
if (empty($GLOBALS['is_header_sent'])) {
|
||||
|
||||
/**
|
||||
* Gets a core script and starts output buffering work
|
||||
*/
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/ob.lib.php');
|
||||
require_once './libraries/common.lib.php';
|
||||
require_once './libraries/ob.lib.php';
|
||||
if ($GLOBALS['cfg']['OBGzip']) {
|
||||
$GLOBALS['ob_mode'] = PMA_outBufferModeGet();
|
||||
if ($GLOBALS['ob_mode']) {
|
||||
@@ -22,8 +22,8 @@ if (empty($GLOBALS['is_header_sent'])) {
|
||||
// to a seperate file. It can now be included by header.inc.php,
|
||||
// querywindow.php.
|
||||
|
||||
require_once('./libraries/header_http.inc.php');
|
||||
require_once('./libraries/header_meta_style.inc.php');
|
||||
require_once './libraries/header_http.inc.php';
|
||||
require_once './libraries/header_meta_style.inc.php';
|
||||
|
||||
// generate title
|
||||
$title = str_replace(
|
||||
@@ -37,7 +37,7 @@ if (empty($GLOBALS['is_header_sent'])) {
|
||||
'@PHPMYADMIN@',
|
||||
),
|
||||
array(
|
||||
isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '',
|
||||
getenv('HTTP_HOST') ? getenv('HTTP_HOST') : '',
|
||||
isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : '',
|
||||
isset($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : '',
|
||||
!empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : (isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : ''),
|
||||
@@ -137,7 +137,7 @@ if (empty($GLOBALS['is_header_sent'])) {
|
||||
<?php
|
||||
|
||||
// Include possible custom headers
|
||||
require_once('./libraries/header_custom.inc.php');
|
||||
require_once './libraries/header_custom.inc.php';
|
||||
|
||||
if (!defined('PMA_DISPLAY_HEADING')) {
|
||||
define('PMA_DISPLAY_HEADING', 1);
|
||||
@@ -187,7 +187,7 @@ if (empty($GLOBALS['is_header_sent'])) {
|
||||
's_db.png' );
|
||||
|
||||
if (isset($GLOBALS['table']) && strlen($GLOBALS['table'])) {
|
||||
require_once('./libraries/tbl_properties_table_info.inc.php');
|
||||
require_once './libraries/tbl_properties_table_info.inc.php';
|
||||
|
||||
echo $separator;
|
||||
printf( $item,
|
||||
@@ -215,7 +215,7 @@ if (empty($GLOBALS['is_header_sent'])) {
|
||||
/**
|
||||
* Settings for relations stuff
|
||||
*/
|
||||
require_once('./libraries/relation.lib.php');
|
||||
require_once './libraries/relation.lib.php';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
// Get additional information about tables for tooltip is done
|
||||
@@ -241,6 +241,6 @@ if (empty($GLOBALS['is_header_sent'])) {
|
||||
/**
|
||||
* Sets a variable to remember headers have been sent
|
||||
*/
|
||||
$GLOBALS['is_header_sent'] = TRUE;
|
||||
$GLOBALS['is_header_sent'] = true;
|
||||
}
|
||||
?>
|
||||
|
@@ -22,78 +22,30 @@ function PMA_getIp()
|
||||
global $HTTP_VIA, $HTTP_X_COMING_FROM, $HTTP_COMING_FROM;
|
||||
|
||||
// Get some server/environment variables values
|
||||
if (empty($REMOTE_ADDR)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['REMOTE_ADDR'])) {
|
||||
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
|
||||
} elseif (!empty($_ENV) && isset($_ENV['REMOTE_ADDR'])) {
|
||||
$REMOTE_ADDR = $_ENV['REMOTE_ADDR'];
|
||||
} elseif (@getenv('REMOTE_ADDR')) {
|
||||
if (empty($REMOTE_ADDR) && getenv('REMOTE_ADDR')) {
|
||||
$REMOTE_ADDR = getenv('REMOTE_ADDR');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_X_FORWARDED_FOR)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$HTTP_X_FORWARDED_FOR = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
} elseif (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED_FOR'])) {
|
||||
$HTTP_X_FORWARDED_FOR = $_ENV['HTTP_X_FORWARDED_FOR'];
|
||||
} elseif (@getenv('HTTP_X_FORWARDED_FOR')) {
|
||||
if (empty($HTTP_X_FORWARDED_FOR) && getenv('HTTP_X_FORWARDED_FOR')) {
|
||||
$HTTP_X_FORWARDED_FOR = getenv('HTTP_X_FORWARDED_FOR');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_X_FORWARDED)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_X_FORWARDED'])) {
|
||||
$HTTP_X_FORWARDED = $_SERVER['HTTP_X_FORWARDED'];
|
||||
} elseif (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED'])) {
|
||||
$HTTP_X_FORWARDED = $_ENV['HTTP_X_FORWARDED'];
|
||||
} elseif (@getenv('HTTP_X_FORWARDED')) {
|
||||
if (empty($HTTP_X_FORWARDED) && getenv('HTTP_X_FORWARDED')) {
|
||||
$HTTP_X_FORWARDED = getenv('HTTP_X_FORWARDED');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_FORWARDED_FOR)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_FORWARDED_FOR'])) {
|
||||
$HTTP_FORWARDED_FOR = $_SERVER['HTTP_FORWARDED_FOR'];
|
||||
} elseif (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED_FOR'])) {
|
||||
$HTTP_FORWARDED_FOR = $_ENV['HTTP_FORWARDED_FOR'];
|
||||
} elseif (@getenv('HTTP_FORWARDED_FOR')) {
|
||||
if (empty($HTTP_FORWARDED_FOR) && getenv('HTTP_FORWARDED_FOR')) {
|
||||
$HTTP_FORWARDED_FOR = getenv('HTTP_FORWARDED_FOR');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_FORWARDED)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_FORWARDED'])) {
|
||||
$HTTP_FORWARDED = $_SERVER['HTTP_FORWARDED'];
|
||||
} elseif (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED'])) {
|
||||
$HTTP_FORWARDED = $_ENV['HTTP_FORWARDED'];
|
||||
} elseif (@getenv('HTTP_FORWARDED')) {
|
||||
if (empty($HTTP_FORWARDED) && getenv('HTTP_FORWARDED')) {
|
||||
$HTTP_FORWARDED = getenv('HTTP_FORWARDED');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_VIA)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_VIA'])) {
|
||||
$HTTP_VIA = $_SERVER['HTTP_VIA'];
|
||||
} elseif (!empty($_ENV) && isset($_ENV['HTTP_VIA'])) {
|
||||
$HTTP_VIA = $_ENV['HTTP_VIA'];
|
||||
} elseif (@getenv('HTTP_VIA')) {
|
||||
if (empty($HTTP_VIA) && getenv('HTTP_VIA')) {
|
||||
$HTTP_VIA = getenv('HTTP_VIA');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_X_COMING_FROM)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_X_COMING_FROM'])) {
|
||||
$HTTP_X_COMING_FROM = $_SERVER['HTTP_X_COMING_FROM'];
|
||||
} elseif (!empty($_ENV) && isset($_ENV['HTTP_X_COMING_FROM'])) {
|
||||
$HTTP_X_COMING_FROM = $_ENV['HTTP_X_COMING_FROM'];
|
||||
} elseif (@getenv('HTTP_X_COMING_FROM')) {
|
||||
if (empty($HTTP_X_COMING_FROM) && getenv('HTTP_X_COMING_FROM')) {
|
||||
$HTTP_X_COMING_FROM = getenv('HTTP_X_COMING_FROM');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_COMING_FROM)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_COMING_FROM'])) {
|
||||
$HTTP_COMING_FROM = $_SERVER['HTTP_COMING_FROM'];
|
||||
} elseif (!empty($_ENV) && isset($_ENV['HTTP_COMING_FROM'])) {
|
||||
$HTTP_COMING_FROM = $_ENV['HTTP_COMING_FROM'];
|
||||
} elseif (@getenv('HTTP_COMING_FROM')) {
|
||||
if (empty($HTTP_COMING_FROM) && getenv('HTTP_COMING_FROM')) {
|
||||
$HTTP_COMING_FROM = getenv('HTTP_COMING_FROM');
|
||||
}
|
||||
} // end if
|
||||
|
||||
// Gets the default ip sent by the user
|
||||
if (!empty($REMOTE_ADDR)) {
|
||||
@@ -118,7 +70,7 @@ function PMA_getIp()
|
||||
$proxy_ip = $HTTP_COMING_FROM;
|
||||
} // end if... elseif...
|
||||
|
||||
// Returns the true IP if it has been found, else FALSE
|
||||
// Returns the true IP if it has been found, else false
|
||||
if (empty($proxy_ip)) {
|
||||
// True IP without proxy
|
||||
return $direct_ip;
|
||||
@@ -130,7 +82,7 @@ function PMA_getIp()
|
||||
} else {
|
||||
// Can't define IP: there is a proxy but we don't have
|
||||
// information about the true IP
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
} // end if... else...
|
||||
} // end of the 'PMA_getIp()' function
|
||||
@@ -159,7 +111,7 @@ function PMA_getIp()
|
||||
*/
|
||||
function PMA_ipMaskTest($testRange, $ipToTest)
|
||||
{
|
||||
$result = TRUE;
|
||||
$result = true;
|
||||
|
||||
if (preg_match('|([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/([0-9]+)|', $testRange, $regs)) {
|
||||
// performs a mask match
|
||||
@@ -175,9 +127,9 @@ function PMA_ipMaskTest($testRange, $ipToTest)
|
||||
} // end for
|
||||
|
||||
if (($maskl & $rangel) == ($maskl & $ipl)) {
|
||||
return TRUE;
|
||||
return true;
|
||||
} else {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// range based
|
||||
@@ -189,11 +141,11 @@ function PMA_ipMaskTest($testRange, $ipToTest)
|
||||
if (preg_match('|\[([0-9]+)\-([0-9]+)\]|', $maskocts[$i], $regs)) {
|
||||
if (($ipocts[$i] > $regs[2])
|
||||
|| ($ipocts[$i] < $regs[1])) {
|
||||
$result = FALSE;
|
||||
$result = false;
|
||||
} // end if
|
||||
} else {
|
||||
if ($maskocts[$i] <> $ipocts[$i]) {
|
||||
$result = FALSE;
|
||||
$result = false;
|
||||
} // end if
|
||||
} // end if/else
|
||||
} //end for
|
||||
@@ -221,7 +173,7 @@ function PMA_allowDeny($type)
|
||||
// Grabs true IP of the user and returns if it can't be found
|
||||
$remote_ip = PMA_getIp();
|
||||
if (empty($remote_ip)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// copy username
|
||||
@@ -237,13 +189,13 @@ function PMA_allowDeny($type)
|
||||
);
|
||||
|
||||
// Provide some useful shortcuts if server gives us address:
|
||||
if (isset($_SERVER['SERVER_ADDR'])) {
|
||||
$shortcuts['localnetA'] = $_SERVER['SERVER_ADDR'] . '/8';
|
||||
$shortcuts['localnetB'] = $_SERVER['SERVER_ADDR'] . '/16';
|
||||
$shortcuts['localnetC'] = $_SERVER['SERVER_ADDR'] . '/24';
|
||||
if (getenv('SERVER_ADDR')) {
|
||||
$shortcuts['localnetA'] = getenv('SERVER_ADDR') . '/8';
|
||||
$shortcuts['localnetB'] = getenv('SERVER_ADDR') . '/16';
|
||||
$shortcuts['localnetC'] = getenv('SERVER_ADDR') . '/24';
|
||||
}
|
||||
|
||||
foreach ($rules AS $rule) {
|
||||
foreach ($rules as $rule) {
|
||||
// extract rule data
|
||||
$rule_data = explode(' ', $rule);
|
||||
|
||||
@@ -275,11 +227,11 @@ function PMA_allowDeny($type)
|
||||
|
||||
// Do the actual matching now
|
||||
if (PMA_ipMaskTest($rule_data[2], $remote_ip)) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
} // end while
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
} // end of the "PMA_AllowDeny()" function
|
||||
|
||||
?>
|
||||
|
@@ -53,8 +53,8 @@ function PMA_langCheck()
|
||||
}
|
||||
|
||||
// try to findout user's language by checking its HTTP_ACCEPT_LANGUAGE variable
|
||||
if (! empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) {
|
||||
if (getenv('HTTP_ACCEPT_LANGUAGE')) {
|
||||
foreach (explode(',', getenv('HTTP_ACCEPT_LANGUAGE')) as $lang) {
|
||||
if (PMA_langDetect($lang, 1)) {
|
||||
return true;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ function PMA_langCheck()
|
||||
}
|
||||
|
||||
// try to findout user's language by checking its HTTP_USER_AGENT variable
|
||||
if (PMA_langDetect($_SERVER['HTTP_USER_AGENT'], 2)) {
|
||||
if (PMA_langDetect(getenv('HTTP_USER_AGENT'), 2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ if (! PMA_langCheck()) {
|
||||
|
||||
// Defines the associated filename and load the translation
|
||||
$lang_file = $lang_path . $available_languages[$GLOBALS['lang']][1] . '.inc.php';
|
||||
require_once($lang_file);
|
||||
require_once $lang_file;
|
||||
|
||||
// now, that we have loaded the language strings we can send the errors
|
||||
if ($lang_failed_cfg) {
|
||||
|
Reference in New Issue
Block a user