Merge remote-tracking branch 'pootle/master' into QA_3_5
[phpmyadmin.git] / index.php
blobf94bdbf2c1a02424f5e09f15201312c027a475af
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * forms frameset
6 * or common.inc.php
7 * @package PhpMyAdmin
8 */
10 /**
11 * Gets core libraries and defines some variables
13 require_once './libraries/common.inc.php';
15 // free the session file, for the other frames to be loaded
16 session_write_close();
18 // Gets the host name
19 if (empty($HTTP_HOST)) {
20 if (PMA_getenv('HTTP_HOST')) {
21 $HTTP_HOST = PMA_getenv('HTTP_HOST');
22 } else {
23 $HTTP_HOST = '';
28 // purge querywindow history
29 $cfgRelation = PMA_getRelationsParam();
30 if ($GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork']) {
31 PMA_purgeHistory($GLOBALS['cfg']['Server']['user']);
33 unset($cfgRelation);
36 /**
37 * pass variables to child pages
39 $drops = array('lang', 'server', 'collation_connection',
40 'db', 'table');
42 foreach ($drops as $each_drop) {
43 if (array_key_exists($each_drop, $_GET)) {
44 unset($_GET[$each_drop]);
47 unset($drops, $each_drop);
49 if (! strlen($GLOBALS['db'])) {
50 $main_target = $GLOBALS['cfg']['DefaultTabServer'];
51 } elseif (! strlen($GLOBALS['table'])) {
52 $_GET['db'] = $GLOBALS['db'];
53 $main_target = $GLOBALS['cfg']['DefaultTabDatabase'];
54 } else {
55 $_GET['db'] = $GLOBALS['db'];
56 $_GET['table'] = $GLOBALS['table'];
57 $main_target = isset($GLOBALS['goto']) ? $GLOBALS['goto'] : $GLOBALS['cfg']['DefaultTabTable'];
60 $url_query = PMA_generate_common_url($_GET);
62 if (isset($GLOBALS['target']) && is_string($GLOBALS['target']) && !empty($GLOBALS['target']) && in_array($GLOBALS['target'], $goto_whitelist)) {
63 $main_target = $GLOBALS['target'];
66 $main_target .= $url_query;
68 $lang_iso_code = $GLOBALS['available_languages'][$GLOBALS['lang']][1];
71 // start output
72 require './libraries/header_http.inc.php';
74 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
75 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
76 <html xmlns="http://www.w3.org/1999/xhtml"
77 xml:lang="<?php echo $lang_iso_code; ?>"
78 lang="<?php echo $lang_iso_code; ?>"
79 dir="<?php echo $GLOBALS['text_dir']; ?>">
80 <head>
81 <link rel="icon" href="./favicon.ico" type="image/x-icon" />
82 <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
83 <title>phpMyAdmin <?php echo PMA_VERSION; ?> -
84 <?php echo htmlspecialchars($HTTP_HOST); ?></title>
85 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
86 <meta name="robots" content="noindex,nofollow" />
87 <script type="text/javascript">
88 // <![CDATA[
89 // definitions used in common.js
90 var common_query = '<?php echo PMA_escapeJsString(PMA_generate_common_url('', '', '&'));?>';
91 var opendb_url = '<?php echo PMA_escapeJsString($GLOBALS['cfg']['DefaultTabDatabase']); ?>';
92 var safari_browser = <?php echo PMA_USR_BROWSER_AGENT == 'SAFARI' ? 'true' : 'false' ?>;
93 var querywindow_height = <?php echo PMA_escapeJsString($GLOBALS['cfg']['QueryWindowHeight']); ?>;
94 var querywindow_width = <?php echo PMA_escapeJsString($GLOBALS['cfg']['QueryWindowWidth']); ?>;
95 var collation_connection = '<?php echo PMA_escapeJsString($GLOBALS['collation_connection']); ?>';
96 var lang = '<?php echo PMA_escapeJsString($GLOBALS['lang']); ?>';
97 var server = '<?php echo PMA_escapeJsString($GLOBALS['server']); ?>';
98 var table = '<?php echo PMA_escapeJsString($GLOBALS['table']); ?>';
99 var db = '<?php echo PMA_escapeJsString($GLOBALS['db']); ?>';
100 var token = '<?php echo PMA_escapeJsString($_SESSION[' PMA_token ']); ?>';
101 var text_dir = '<?php echo PMA_escapeJsString($GLOBALS['text_dir']); ?>';
102 var pma_absolute_uri = '<?php echo PMA_escapeJsString($GLOBALS['cfg']['PmaAbsoluteUri']); ?>';
103 var pma_text_default_tab = '<?php echo PMA_escapeJsString(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable'])); ?>';
104 var pma_text_left_default_tab = '<?php echo PMA_escapeJsString(PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable'])); ?>';
106 // for content and navigation frames
108 var frame_content = 0;
109 var frame_navigation = 0;
110 function getFrames() {
111 <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
112 frame_content = window.frames[1];
113 frame_navigation = window.frames[0];
114 <?php } else { ?>
115 frame_content = window.frames[0];
116 frame_navigation = window.frames[1];
117 <?php } ?>
119 var onloadCnt = 0;
120 var onLoadHandler = window.onload;
121 window.onload = function() {
122 if (onloadCnt == 0) {
123 if (typeof(onLoadHandler) == "function") {
124 onLoadHandler();
126 if (typeof(getFrames) != 'undefined' && typeof(getFrames) == 'function') {
127 getFrames();
129 onloadCnt++;
132 // ]]>
133 </script>
134 <?php
135 echo PMA_includeJS('jquery/jquery-1.6.2.js');
136 echo PMA_includeJS('update-location.js');
137 echo PMA_includeJS('common.js');
139 </head>
140 <frameset cols="<?php
141 if ($GLOBALS['text_dir'] === 'rtl') {
142 echo '*,';
144 echo $GLOBALS['cfg']['NaviWidth'];
145 if ($GLOBALS['text_dir'] === 'ltr') {
146 echo ',*';
148 ?>" rows="*" id="mainFrameset">
149 <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
150 <frame frameborder="0" id="frame_navigation"
151 src="navigation.php<?php echo $url_query; ?>"
152 name="frame_navigation" />
153 <?php } ?>
154 <frame frameborder="0" id="frame_content"
155 src="<?php echo $main_target; ?>"
156 name="frame_content" />
157 <?php if ($GLOBALS['text_dir'] === 'rtl') { ?>
158 <frame frameborder="0" id="frame_navigation"
159 src="navigation.php<?php echo $url_query; ?>"
160 name="frame_navigation" />
161 <?php } ?>
162 <noframes>
163 <body>
164 <p><?php echo __('phpMyAdmin is more friendly with a <b>frames-capable</b> browser.'); ?></p>
165 </body>
166 </noframes>
167 </frameset>
168 </html>