Merge remote branch 'origin/master'
[phpmyadmin-themes.git] / index.php
blob16e13d028b5d01a95e4587b3aff8f6f67d2b1f0b
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 <script src="./js/jquery/jquery-1.4.2.js" type="text/javascript"></script>
156 <script src="./js/update-location.js" type="text/javascript"></script>
157 <script src="./js/common.js" type="text/javascript"></script>
158 </head>
159 <frameset cols="<?php
160 if ($GLOBALS['text_dir'] === 'rtl') {
161 echo '*,';
163 echo $GLOBALS['cfg']['NaviWidth'];
164 if ($GLOBALS['text_dir'] === 'ltr') {
165 echo ',*';
167 ?>" rows="*" id="mainFrameset">
168 <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
169 <frame frameborder="0" id="frame_navigation"
170 src="navigation.php<?php echo $url_query; ?>"
171 name="frame_navigation" />
172 <?php } ?>
173 <frame frameborder="0" id="frame_content"
174 src="<?php echo $main_target; ?>"
175 name="frame_content" />
176 <?php if ($GLOBALS['text_dir'] === 'rtl') { ?>
177 <frame frameborder="0" id="frame_navigation"
178 src="navigation.php<?php echo $url_query; ?>"
179 name="frame_navigation" />
180 <?php } ?>
181 <noframes>
182 <body>
183 <p><?php echo __('phpMyAdmin is more friendly with a <b>frames-capable</b> browser.'); ?></p>
184 </body>
185 </noframes>
186 </frameset>
187 </html>