diff --git a/index.php b/index.php index 8abffebb4..c3a3b6a8b 100644 --- a/index.php +++ b/index.php @@ -7,6 +7,7 @@ * @uses libraries/common.lib.php global fnctions * @uses libraries/select_theme.lib.php theme manager * @uses libraries/relation.lib.php table relations + * @uses $_SESSION['window_name_hash'] to set it * @uses $GLOBALS['strNoFrames'] * @uses $GLOBALS['cfg']['QueryHistoryDB'] * @uses $GLOBALS['cfg']['Server']['user'] @@ -16,8 +17,6 @@ * @uses $GLOBALS['collation_connection'] from $_REQUEST (grab_globals.lib.php) * or common.lib.php * @uses $GLOBALS['available_languages'] from common.lib.php (select_lang.lib.php) - * @uses $GLOBALS['cookie_path'] from common.lib.php - * @uses $GLOBALS['is_https'] from common.lib.php * @uses $GLOBALS['db'] * @uses $GLOBALS['charset'] * @uses $GLOBALS['lang'] @@ -27,7 +26,6 @@ * @uses PMA_purgeHistory() * @uses PMA_generate_common_url() * @uses PMA_VERSION - * @uses setcookie() * @uses session_write_close() * @uses time() * @uses getenv() @@ -39,11 +37,6 @@ */ require_once('./libraries/common.lib.php'); -setcookie('pma_lang', $lang, time() + 60*60*24*30, $cookie_path, '', $is_https); -if (isset($convcharset)) { - setcookie('pma_charset', $convcharset, time() + 60*60*24*30, $cookie_path, '', $is_https); -} - /** * Includes the ThemeManager if it hasn't been included yet */ @@ -56,24 +49,13 @@ $_SESSION['window_name_hash'] = time(); // free the session file, for the other frames to be loaded session_write_close(); -/** - * Saves collation_connection (coming from main.php) in a cookie - */ -// (from grab_globals) -// TODO: move into common.lib.php line #360 -if ( isset( $collation_connection ) ) { - setcookie( 'pma_collation_connection', $collation_connection, - time() + 60*60*24*30, $cookie_path, '', $is_https ); -} - - // Gets the host name // loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+ if (empty($HTTP_HOST)) { if (!empty($_ENV) && isset($_ENV['HTTP_HOST'])) { $HTTP_HOST = $_ENV['HTTP_HOST']; } - else if (@getenv('HTTP_HOST')) { + elseif (@getenv('HTTP_HOST')) { $HTTP_HOST = getenv('HTTP_HOST'); } else { @@ -87,42 +69,42 @@ $cfgRelation = PMA_getRelationsParam(); if ( $GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork'] ) { PMA_purgeHistory( $GLOBALS['cfg']['Server']['user'] ); } +unset( $cfgRelation ); + +/** + * pass variables to child pages + */ $drops = array( 'lang', 'server', 'convcharset', 'collation_connection', 'db', 'table' ); -$url_querys = array(); -// pass variables to child pages -foreach( $_GET as $key => $val ) { - if ( ! in_array( $key, $drops ) ) { - $url_querys[] = urlencode( $key ) . '=' . urlencode( $val ); +foreach( $drops as $each_drop ) { + if ( ! array_key_exists( $each_drop, $_GET ) ) { + unset( $_GET[$each_drop] ); } } -unset( $drops ); - -if ( count( $url_querys ) ) { - $url_query = implode( '&', $url_querys ) . '&'; -} else { - $url_query = ''; -} -unset( $url_querys ); +unset( $drops, $each_drop ); if ( empty( $GLOBALS['db'] ) ) { - $url_query .= PMA_generate_common_url(); $main_target = $GLOBALS['cfg']['DefaultTabServer']; } elseif ( empty( $GLOBALS['table'] ) ) { - $url_query .= PMA_generate_common_url( $GLOBALS['db'] ); + $_GET['db'] = $GLOBALS['db']; $main_target = $GLOBALS['cfg']['DefaultTabDatabase']; } else { - $url_query .= PMA_generate_common_url( $GLOBALS['db'], $GLOBALS['table'] ); + $_GET['db'] = $GLOBALS['db']; + $_GET['table'] = $GLOBALS['table']; $main_target = $GLOBALS['cfg']['DefaultTabTable']; } -if (!empty($GLOBALS['target']) && preg_match('@[a-z_]+\.php@', $GLOBALS['target']) && $GLOBALS['target'] != 'index.php') { +$url_query = PMA_generate_common_url( $_GET ); + +if ( ! empty( $GLOBALS['target'] ) + && preg_match( '@[a-z_]+\.php@', $GLOBALS['target'] ) + && $GLOBALS['target'] != 'index.php' ) { $main_target = $GLOBALS['target']; } -$main_target .= '?' . $url_query; +$main_target .= $url_query; $lang_iso_code = $GLOBALS['available_languages'][$GLOBALS['lang']][2]; @@ -139,11 +121,12 @@ header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
-