- moved setting of cookies from index.php into common.lib.php
- revised the parameter passing code - make use of new functionality of PMA_generate_common_url()
This commit is contained in:
65
index.php
65
index.php
@@ -7,6 +7,7 @@
|
|||||||
* @uses libraries/common.lib.php global fnctions
|
* @uses libraries/common.lib.php global fnctions
|
||||||
* @uses libraries/select_theme.lib.php theme manager
|
* @uses libraries/select_theme.lib.php theme manager
|
||||||
* @uses libraries/relation.lib.php table relations
|
* @uses libraries/relation.lib.php table relations
|
||||||
|
* @uses $_SESSION['window_name_hash'] to set it
|
||||||
* @uses $GLOBALS['strNoFrames']
|
* @uses $GLOBALS['strNoFrames']
|
||||||
* @uses $GLOBALS['cfg']['QueryHistoryDB']
|
* @uses $GLOBALS['cfg']['QueryHistoryDB']
|
||||||
* @uses $GLOBALS['cfg']['Server']['user']
|
* @uses $GLOBALS['cfg']['Server']['user']
|
||||||
@@ -16,8 +17,6 @@
|
|||||||
* @uses $GLOBALS['collation_connection'] from $_REQUEST (grab_globals.lib.php)
|
* @uses $GLOBALS['collation_connection'] from $_REQUEST (grab_globals.lib.php)
|
||||||
* or common.lib.php
|
* or common.lib.php
|
||||||
* @uses $GLOBALS['available_languages'] from common.lib.php (select_lang.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['db']
|
||||||
* @uses $GLOBALS['charset']
|
* @uses $GLOBALS['charset']
|
||||||
* @uses $GLOBALS['lang']
|
* @uses $GLOBALS['lang']
|
||||||
@@ -27,7 +26,6 @@
|
|||||||
* @uses PMA_purgeHistory()
|
* @uses PMA_purgeHistory()
|
||||||
* @uses PMA_generate_common_url()
|
* @uses PMA_generate_common_url()
|
||||||
* @uses PMA_VERSION
|
* @uses PMA_VERSION
|
||||||
* @uses setcookie()
|
|
||||||
* @uses session_write_close()
|
* @uses session_write_close()
|
||||||
* @uses time()
|
* @uses time()
|
||||||
* @uses getenv()
|
* @uses getenv()
|
||||||
@@ -39,11 +37,6 @@
|
|||||||
*/
|
*/
|
||||||
require_once('./libraries/common.lib.php');
|
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
|
* Includes the ThemeManager if it hasn't been included yet
|
||||||
*/
|
*/
|
||||||
@@ -56,17 +49,6 @@ $_SESSION['window_name_hash'] = time();
|
|||||||
// free the session file, for the other frames to be loaded
|
// free the session file, for the other frames to be loaded
|
||||||
session_write_close();
|
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
|
// Gets the host name
|
||||||
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
|
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
|
||||||
if (empty($HTTP_HOST)) {
|
if (empty($HTTP_HOST)) {
|
||||||
@@ -87,42 +69,42 @@ $cfgRelation = PMA_getRelationsParam();
|
|||||||
if ( $GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork'] ) {
|
if ( $GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork'] ) {
|
||||||
PMA_purgeHistory( $GLOBALS['cfg']['Server']['user'] );
|
PMA_purgeHistory( $GLOBALS['cfg']['Server']['user'] );
|
||||||
}
|
}
|
||||||
|
unset( $cfgRelation );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pass variables to child pages
|
||||||
|
*/
|
||||||
$drops = array( 'lang', 'server', 'convcharset', 'collation_connection',
|
$drops = array( 'lang', 'server', 'convcharset', 'collation_connection',
|
||||||
'db', 'table' );
|
'db', 'table' );
|
||||||
|
|
||||||
$url_querys = array();
|
foreach( $drops as $each_drop ) {
|
||||||
// pass variables to child pages
|
if ( ! array_key_exists( $each_drop, $_GET ) ) {
|
||||||
foreach( $_GET as $key => $val ) {
|
unset( $_GET[$each_drop] );
|
||||||
if ( ! in_array( $key, $drops ) ) {
|
|
||||||
$url_querys[] = urlencode( $key ) . '=' . urlencode( $val );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset( $drops );
|
unset( $drops, $each_drop );
|
||||||
|
|
||||||
if ( count( $url_querys ) ) {
|
|
||||||
$url_query = implode( '&', $url_querys ) . '&';
|
|
||||||
} else {
|
|
||||||
$url_query = '';
|
|
||||||
}
|
|
||||||
unset( $url_querys );
|
|
||||||
|
|
||||||
if ( empty( $GLOBALS['db'] ) ) {
|
if ( empty( $GLOBALS['db'] ) ) {
|
||||||
$url_query .= PMA_generate_common_url();
|
|
||||||
$main_target = $GLOBALS['cfg']['DefaultTabServer'];
|
$main_target = $GLOBALS['cfg']['DefaultTabServer'];
|
||||||
} elseif ( empty( $GLOBALS['table'] ) ) {
|
} elseif ( empty( $GLOBALS['table'] ) ) {
|
||||||
$url_query .= PMA_generate_common_url( $GLOBALS['db'] );
|
$_GET['db'] = $GLOBALS['db'];
|
||||||
$main_target = $GLOBALS['cfg']['DefaultTabDatabase'];
|
$main_target = $GLOBALS['cfg']['DefaultTabDatabase'];
|
||||||
} else {
|
} else {
|
||||||
$url_query .= PMA_generate_common_url( $GLOBALS['db'], $GLOBALS['table'] );
|
$_GET['db'] = $GLOBALS['db'];
|
||||||
|
$_GET['table'] = $GLOBALS['table'];
|
||||||
$main_target = $GLOBALS['cfg']['DefaultTabTable'];
|
$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 = $GLOBALS['target'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$main_target .= '?' . $url_query;
|
$main_target .= $url_query;
|
||||||
|
|
||||||
$lang_iso_code = $GLOBALS['available_languages'][$GLOBALS['lang']][2];
|
$lang_iso_code = $GLOBALS['available_languages'][$GLOBALS['lang']][2];
|
||||||
|
|
||||||
@@ -139,7 +121,8 @@ header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
|
|||||||
<head>
|
<head>
|
||||||
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
|
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
|
||||||
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
|
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
|
||||||
<title>phpMyAdmin <?php echo PMA_VERSION; ?> - <?php echo htmlspecialchars($HTTP_HOST); ?></title>
|
<title>phpMyAdmin <?php echo PMA_VERSION; ?> -
|
||||||
|
<?php echo htmlspecialchars($HTTP_HOST); ?></title>
|
||||||
<meta http-equiv="Content-Type"
|
<meta http-equiv="Content-Type"
|
||||||
content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
|
content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
|
||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
@@ -158,12 +141,12 @@ header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
|
|||||||
var pma_absolute_uri = '<?php echo $GLOBALS['cfg']['PmaAbsoluteUri']; ?>';
|
var pma_absolute_uri = '<?php echo $GLOBALS['cfg']['PmaAbsoluteUri']; ?>';
|
||||||
// ]]>
|
// ]]>
|
||||||
</script>
|
</script>
|
||||||
<script src="./js/querywindow.js" type="text/javascript"
|
<script src="./js/querywindow.js" type="text/javascript" language="javascript">
|
||||||
language="javascript"></script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<frameset cols="<?php echo $GLOBALS['cfg']['LeftWidth']; ?>,*" rows="*" id="mainFrameset">
|
<frameset cols="<?php echo $GLOBALS['cfg']['LeftWidth']; ?>,*" rows="*" id="mainFrameset">
|
||||||
<frame frameborder="0" id="leftFrame"
|
<frame frameborder="0" id="leftFrame"
|
||||||
src="left.php?<?php echo $url_query; ?>"
|
src="left.php<?php echo $url_query; ?>"
|
||||||
name="nav<?php echo $_SESSION['window_name_hash']; ?>" />
|
name="nav<?php echo $_SESSION['window_name_hash']; ?>" />
|
||||||
<frame frameborder="0" id="rightFrame"
|
<frame frameborder="0" id="rightFrame"
|
||||||
src="<?php echo $main_target; ?>"
|
src="<?php echo $main_target; ?>"
|
||||||
|
Reference in New Issue
Block a user