forked from phpmyadmin/phpmyadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
171 lines (154 loc) · 6.03 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
/* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4:
/**
* forms frameset
*
* @uses libraries/common.lib.php global fnctions
* @uses libraries/select_theme.lib.php theme manager
* @uses libraries/relation.lib.php table relations
* @uses $GLOBALS['strNoFrames']
* @uses $GLOBALS['cfg']['QueryHistoryDB']
* @uses $GLOBALS['cfg']['Server']['user']
* @uses $GLOBALS['cfg']['DefaultTabServer'] as src for the mainframe
* @uses $GLOBALS['cfg']['DefaultTabDatabase'] as src for the mainframe
* @uses $GLOBALS['cfg']['LeftWidth'] for left frame width
* @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']
* @uses $GLOBALS['text_dir']
* @uses $_ENV['HTTP_HOST']
* @uses PMA_getRelationsParam()
* @uses PMA_purgeHistory()
* @uses PMA_generate_common_url()
* @uses PMA_VERSION
* @uses setcookie()
* @uses session_write_close()
* @uses time()
* @uses getenv()
* @uses header() to send charset
*/
/**
* Gets core libraries and defines some variables
*/
require_once('./libraries/common.lib.php');
/**
* Includes the ThemeManager if it hasn't been included yet
*/
require_once('./libraries/select_theme.lib.php');
require_once('./libraries/relation.lib.php');
// hash for the window names, against window hijacking
$_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')) {
$HTTP_HOST = getenv('HTTP_HOST');
}
else {
$HTTP_HOST = '';
}
}
// purge querywindow history
$cfgRelation = PMA_getRelationsParam();
if ( $GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork'] ) {
PMA_purgeHistory( $GLOBALS['cfg']['Server']['user'] );
}
$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 );
}
}
unset( $drops );
if ( count( $url_querys ) ) {
$url_query = implode( '&', $url_querys ) . '&';
} else {
$url_query = '';
}
unset( $url_querys );
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'] );
$main_target = $GLOBALS['cfg']['DefaultTabDatabase'];
} else {
$url_query .= PMA_generate_common_url( $GLOBALS['db'], $GLOBALS['table'] );
$main_target = $GLOBALS['cfg']['DefaultTabTable'];
}
if (!empty($GLOBALS['target']) && preg_match('@[a-z_]+\.php@', $GLOBALS['target']) && $GLOBALS['target'] != 'index.php') {
$main_target = $GLOBALS['target'];
}
$main_target .= '?' . $url_query;
$lang_iso_code = $GLOBALS['available_languages'][$GLOBALS['lang']][2];
// start output
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="<?php echo $lang_iso_code; ?>"
lang="<?php echo $lang_iso_code; ?>"
dir="<?php echo $GLOBALS['text_dir']; ?>">
<head>
<link rel="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>
<meta http-equiv="Content-Type"
content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
<script type="text/javascript" language="javascript">
//<![CDATA[
// definitions used in querywindow.js
var common_query = '<?php echo PMA_generate_common_url('','','&');?>';
var opendb_url = '<?php echo $GLOBALS['cfg']['DefaultTabDatabase']; ?>';
var safari_browser = <?php echo PMA_USR_BROWSER_AGENT != 'SAFARI' ? 'true' : 'false' ?>;
var querywindow_height = <?php echo $GLOBALS['cfg']['QueryWindowHeight']; ?>;
var querywindow_width = <?php echo $GLOBALS['cfg']['QueryWindowWidth']; ?>;
var collation_connection = '<?php echo $GLOBALS['collation_connection']; ?>';
var lang = '<?php echo $GLOBALS['lang']; ?>';
var server = '<?php echo $GLOBALS['server']; ?>';
var table = '<?php echo $GLOBALS['table']; ?>';
var db = '<?php echo $GLOBALS['db']; ?>';
var pma_absolute_uri = '<?php echo $GLOBALS['cfg']['PmaAbsoluteUri']; ?>';
//]]>
</script>
<script src="./js/querywindow.js" type="text/javascript"
language="javascript"></script>
</head>
<frameset cols="<?php echo $GLOBALS['cfg']['LeftWidth']; ?>,*" rows="*" id="mainFrameset">
<frame frameborder="0" id="leftFrame"
src="left.php?<?php echo $url_query; ?>"
name="nav<?php echo $_SESSION['window_name_hash']; ?>" />
<frame frameborder="0" id="rightFrame"
src="<?php echo $main_target; ?>"
name="phpmain<?php echo $_SESSION['window_name_hash']; ?>" />
<noframes>
<body>
<p><?php echo $GLOBALS['strNoFrames']; ?></p>
</body>
</noframes>
</frameset>
</html>