Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin...
[phpmyadmin/alexukf.git] / index.php
blob5d197586ca26635f9293aac3bc28b06c1a96ea97
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * forms frameset
6 * @uses $GLOBALS['cfg']['QueryHistoryDB']
7 * @uses $GLOBALS['cfg']['Server']['user']
8 * @uses $GLOBALS['cfg']['DefaultTabServer'] as src for the mainframe
9 * @uses $GLOBALS['cfg']['DefaultTabDatabase'] as src for the mainframe
10 * @uses $GLOBALS['cfg']['NaviWidth'] for navi frame width
11 * @uses $GLOBALS['collation_connection'] from $_REQUEST (grab_globals.lib.php)
12 * or common.inc.php
13 * @uses $GLOBALS['available_languages'] from common.inc.php (select_lang.lib.php)
14 * @uses $GLOBALS['db']
15 * @uses $GLOBALS['charset']
16 * @uses $GLOBALS['lang']
17 * @uses $GLOBALS['text_dir']
18 * @uses $_ENV['HTTP_HOST']
19 * @uses PMA_getRelationsParam()
20 * @uses PMA_purgeHistory()
21 * @uses PMA_generate_common_url()
22 * @uses PMA_VERSION
23 * @uses session_write_close()
24 * @uses time()
25 * @uses PMA_getenv()
26 * @uses header() to send charset
27 * @package phpMyAdmin
30 /**
31 * Gets core libraries and defines some variables
33 require_once './libraries/common.inc.php';
35 // free the session file, for the other frames to be loaded
36 session_write_close();
38 // Gets the host name
39 if (empty($HTTP_HOST)) {
40 if (PMA_getenv('HTTP_HOST')) {
41 $HTTP_HOST = PMA_getenv('HTTP_HOST');
42 } else {
43 $HTTP_HOST = '';
48 // purge querywindow history
49 $cfgRelation = PMA_getRelationsParam();
50 if ($GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork']) {
51 PMA_purgeHistory($GLOBALS['cfg']['Server']['user']);
53 unset($cfgRelation);
56 /**
57 * pass variables to child pages
59 $drops = array('lang', 'server', 'collation_connection',
60 'db', 'table');
62 foreach ($drops as $each_drop) {
63 if (array_key_exists($each_drop, $_GET)) {
64 unset($_GET[$each_drop]);
67 unset($drops, $each_drop);
69 if (! strlen($GLOBALS['db'])) {
70 $main_target = $GLOBALS['cfg']['DefaultTabServer'];
71 } elseif (! strlen($GLOBALS['table'])) {
72 $_GET['db'] = $GLOBALS['db'];
73 $main_target = $GLOBALS['cfg']['DefaultTabDatabase'];
74 } else {
75 $_GET['db'] = $GLOBALS['db'];
76 $_GET['table'] = $GLOBALS['table'];
77 $main_target = $GLOBALS['cfg']['DefaultTabTable'];
80 $url_query = PMA_generate_common_url($_GET);
82 if (isset($GLOBALS['target']) && is_string($GLOBALS['target']) && !empty($GLOBALS['target']) && in_array($GLOBALS['target'], $goto_whitelist)) {
83 $main_target = $GLOBALS['target'];
86 $main_target .= $url_query;
88 $lang_iso_code = $GLOBALS['available_languages'][$GLOBALS['lang']][1];
91 // start output
92 header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
94 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
95 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
96 <html xmlns="http://www.w3.org/1999/xhtml"
97 xml:lang="<?php echo $lang_iso_code; ?>"
98 lang="<?php echo $lang_iso_code; ?>"
99 dir="<?php echo $GLOBALS['text_dir']; ?>">
100 <head>
101 <link rel="icon" href="./favicon.ico" type="image/x-icon" />
102 <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
103 <title>phpMyAdmin <?php echo PMA_VERSION; ?> -
104 <?php echo htmlspecialchars($HTTP_HOST); ?></title>
105 <meta http-equiv="Content-Type"
106 content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
107 <meta name="robots" content="noindex,nofollow" />
108 <script type="text/javascript">
109 // <![CDATA[
110 // definitions used in common.js
111 var common_query = '<?php echo PMA_escapeJsString(PMA_generate_common_url('', '', '&'));?>';
112 var opendb_url = '<?php echo PMA_escapeJsString($GLOBALS['cfg']['DefaultTabDatabase']); ?>';
113 var safari_browser = <?php echo PMA_USR_BROWSER_AGENT == 'SAFARI' ? 'true' : 'false' ?>;
114 var querywindow_height = <?php echo PMA_escapeJsString($GLOBALS['cfg']['QueryWindowHeight']); ?>;
115 var querywindow_width = <?php echo PMA_escapeJsString($GLOBALS['cfg']['QueryWindowWidth']); ?>;
116 var collation_connection = '<?php echo PMA_escapeJsString($GLOBALS['collation_connection']); ?>';
117 var lang = '<?php echo PMA_escapeJsString($GLOBALS['lang']); ?>';
118 var server = '<?php echo PMA_escapeJsString($GLOBALS['server']); ?>';
119 var table = '<?php echo PMA_escapeJsString($GLOBALS['table']); ?>';
120 var db = '<?php echo PMA_escapeJsString($GLOBALS['db']); ?>';
121 var token = '<?php echo PMA_escapeJsString($_SESSION[' PMA_token ']); ?>';
122 var text_dir = '<?php echo PMA_escapeJsString($GLOBALS['text_dir']); ?>';
123 var pma_absolute_uri = '<?php echo PMA_escapeJsString($GLOBALS['cfg']['PmaAbsoluteUri']); ?>';
124 var pma_text_default_tab = '<?php echo PMA_escapeJsString(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable'])); ?>';
125 var pma_text_left_default_tab = '<?php echo PMA_escapeJsString(PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable'])); ?>';
127 // for content and navigation frames
129 var frame_content = 0;
130 var frame_navigation = 0;
131 function getFrames() {
132 <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
133 frame_content = window.frames[1];
134 frame_navigation = window.frames[0];
135 <?php } else { ?>
136 frame_content = window.frames[0];
137 frame_navigation = window.frames[1];
138 <?php } ?>
140 var onloadCnt = 0;
141 var onLoadHandler = window.onload;
142 window.onload = function() {
143 if (onloadCnt == 0) {
144 if (typeof(onLoadHandler) == "function") {
145 onLoadHandler();
147 if (typeof(getFrames) != 'undefined' && typeof(getFrames) == 'function') {
148 getFrames();
150 onloadCnt++;
153 // ]]>
154 </script>
155 <?php
156 echo PMA_includeJS('jquery/jquery-1.4.4.js');
157 echo PMA_includeJS('update-location.js');
158 echo PMA_includeJS('common.js');
160 </head>
161 <frameset cols="<?php
162 if ($GLOBALS['text_dir'] === 'rtl') {
163 echo '*,';
165 echo $GLOBALS['cfg']['NaviWidth'];
166 if ($GLOBALS['text_dir'] === 'ltr') {
167 echo ',*';
169 ?>" rows="*" id="mainFrameset">
170 <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
171 <frame frameborder="0" id="frame_navigation"
172 src="navigation.php<?php echo $url_query; ?>"
173 name="frame_navigation" />
174 <?php } ?>
175 <frame frameborder="0" id="frame_content"
176 src="<?php echo $main_target; ?>"
177 name="frame_content" />
178 <?php if ($GLOBALS['text_dir'] === 'rtl') { ?>
179 <frame frameborder="0" id="frame_navigation"
180 src="navigation.php<?php echo $url_query; ?>"
181 name="frame_navigation" />
182 <?php } ?>
183 <noframes>
184 <body>
185 <p><?php echo __('phpMyAdmin is more friendly with a <b>frames-capable</b> browser.'); ?></p>
186 </body>
187 </noframes>
188 </frameset>
189 </html>