From 42feed2cca1cc949975d6fcac77f6a87ed525959 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Fri, 25 Nov 2005 10:25:27 +0000 Subject: [PATCH] use PMA_sendHeaderLocation() and new functionality of PMA_generate_common_url() --- ChangeLog | 2 ++ libraries/auth/cookie.auth.lib.php | 52 +++++++----------------------- 2 files changed, 13 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e42c8f49..8a9499b0f 100755 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,8 @@ $Source$ - add SID only if set - check for url params already exist or not (wether & . SID or ? . SID) - respect arg_separator.input from php.ini + * libraries/auth/cookie.auth.lib.php: use PMA_sendHeaderLocation() + and new functionality of PMA_generate_common_url() 2005-11-25 Michal Čihař * Documentation.html, config.footer.inc.php(deleted), diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php index 281963a07..45a251833 100644 --- a/libraries/auth/cookie.auth.lib.php +++ b/libraries/auth/cookie.auth.lib.php @@ -146,7 +146,7 @@ echo sprintf( $GLOBALS['strWelcome'], echo '

' . $GLOBALS['strError'] . '

' . "\n"; echo $conn_error . '
' . "\n"; } - + // Displays the languages form if (empty($cfg['Lang'])) { echo "\n"; @@ -459,53 +459,23 @@ function PMA_auth_set_user() } } - // loic1: workaround against a IIS 5.0 bug - // lem9: here, PMA_sendHeaderLocation() has not yet been defined, - // so use the workaround - if (empty($GLOBALS['SERVER_SOFTWARE'])) { - if (isset($_SERVER) && !empty($_SERVER['SERVER_SOFTWARE'])) { - $GLOBALS['SERVER_SOFTWARE'] = $_SERVER['SERVER_SOFTWARE']; - } - } // end if - // URL where to go: $redirect_url = $cfg['PmaAbsoluteUri'] . 'index.php'; - $separator = '?'; - + // any parameters to pass? - $params = PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', - isset($GLOBALS['table']) ? $GLOBALS['table'] : '', '&'); - if (!empty($params)) { - $redirect_url .= $separator . $params; - $separator = '&'; + $url_params = array(); + if ( ! empty($GLOBALS['target']) ) { + $url_params['db'] = $GLOBALS['db']; + } + if ( ! empty($GLOBALS['target']) ) { + $url_params['table'] = $GLOBALS['table']; } - unset($params); - // any target to pass? - if (!empty($GLOBALS['target'])) { - $redirect_url .= $separator . 'target=' . urlencode($GLOBALS['target']). - $separator = '&'; - } - - // any seesion id to pass? - $sid = '' . SID; - if (!empty($sid)) { - $redirect_url .= $separator . $sid; - $separator = '&'; - } - unset($sid); - - // cleanup - unset($separtor); - - // And finally redirect - if (!empty($GLOBALS['SERVER_SOFTWARE']) && $GLOBALS['SERVER_SOFTWARE'] == 'Microsoft-IIS/5.0') { - header('Refresh: 0; url=' . $redirect_url); - } - else { - header('Location: ' . $redirect_url); + if ( ! empty($GLOBALS['target']) ) { + $url_params['target'] = $GLOBALS['target']; } + PMA_sendHeaderLocation( $redirect_url . PMA_generate_common_url( $url_params, '&' ) ); exit(); } // end if