Rev Author Line No. Line
250 kaklik 1 <?php
2 /* $Id: index.php,v 2.33.2.2 2006/04/20 14:14:19 nijel Exp $ */
3 // vim: expandtab sw=4 ts=4 sts=4:
4 /**
5 * forms frameset
6 *
7 * @uses libraries/common.lib.php global fnctions
8 * @uses libraries/relation.lib.php table relations
9 * @uses $GLOBALS['strNoFrames']
10 * @uses $GLOBALS['cfg']['QueryHistoryDB']
11 * @uses $GLOBALS['cfg']['Server']['user']
12 * @uses $GLOBALS['cfg']['DefaultTabServer'] as src for the mainframe
13 * @uses $GLOBALS['cfg']['DefaultTabDatabase'] as src for the mainframe
14 * @uses $GLOBALS['cfg']['LeftWidth'] for left frame width
15 * @uses $GLOBALS['collation_connection'] from $_REQUEST (grab_globals.lib.php)
16 * or common.lib.php
17 * @uses $GLOBALS['available_languages'] from common.lib.php (select_lang.lib.php)
18 * @uses $GLOBALS['db']
19 * @uses $GLOBALS['charset']
20 * @uses $GLOBALS['lang']
21 * @uses $GLOBALS['text_dir']
22 * @uses $_ENV['HTTP_HOST']
23 * @uses PMA_getRelationsParam()
24 * @uses PMA_purgeHistory()
25 * @uses PMA_generate_common_url()
26 * @uses PMA_VERSION
27 * @uses session_write_close()
28 * @uses time()
29 * @uses PMA_getenv()
30 * @uses header() to send charset
31 */
32  
33 /**
34 * Gets core libraries and defines some variables
35 */
36 require_once('./libraries/common.lib.php');
37  
38 /**
39 * Includes the ThemeManager if it hasn't been included yet
40 */
41 require_once('./libraries/relation.lib.php');
42  
43 // free the session file, for the other frames to be loaded
44 session_write_close();
45  
46 // Gets the host name
47 // loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
48 if (empty($HTTP_HOST)) {
49 if (PMA_getenv('HTTP_HOST')) {
50 $HTTP_HOST = PMA_getenv('HTTP_HOST');
51 } else {
52 $HTTP_HOST = '';
53 }
54 }
55  
56  
57 // purge querywindow history
58 $cfgRelation = PMA_getRelationsParam();
59 if ( $GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork'] ) {
60 PMA_purgeHistory( $GLOBALS['cfg']['Server']['user'] );
61 }
62 unset( $cfgRelation );
63  
64  
65 /**
66 * pass variables to child pages
67 */
68 $drops = array( 'lang', 'server', 'convcharset', 'collation_connection',
69 'db', 'table' );
70  
71 foreach ( $drops as $each_drop ) {
72 if ( ! array_key_exists( $each_drop, $_GET ) ) {
73 unset( $_GET[$each_drop] );
74 }
75 }
76 unset( $drops, $each_drop );
77  
78 if ( ! isset($GLOBALS['db']) || ! strlen($GLOBALS['db']) ) {
79 $main_target = $GLOBALS['cfg']['DefaultTabServer'];
80 } elseif ( ! isset($GLOBALS['table']) || ! strlen($GLOBALS['table']) ) {
81 $_GET['db'] = $GLOBALS['db'];
82 $main_target = $GLOBALS['cfg']['DefaultTabDatabase'];
83 } else {
84 $_GET['db'] = $GLOBALS['db'];
85 $_GET['table'] = $GLOBALS['table'];
86 $main_target = $GLOBALS['cfg']['DefaultTabTable'];
87 }
88  
89 $url_query = PMA_generate_common_url( $_GET );
90  
91 if (!empty($GLOBALS['target']) && in_array($GLOBALS['target'], $goto_whitelist)) {
92 $main_target = $GLOBALS['target'];
93 }
94  
95 $main_target .= $url_query;
96  
97 $lang_iso_code = $GLOBALS['available_languages'][$GLOBALS['lang']][2];
98  
99  
100 // start output
101 header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
102 ?>
103 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
104 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
105 <html xmlns="http://www.w3.org/1999/xhtml"
106 xml:lang="<?php echo $lang_iso_code; ?>"
107 lang="<?php echo $lang_iso_code; ?>"
108 dir="<?php echo $GLOBALS['text_dir']; ?>">
109 <head>
110 <link rel="icon" href="./favicon.ico" type="image/x-icon" />
111 <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
112 <title>phpMyAdmin <?php echo PMA_VERSION; ?> -
113 <?php echo htmlspecialchars($HTTP_HOST); ?></title>
114 <meta http-equiv="Content-Type"
115 content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
116 <script type="text/javascript" language="javascript">
117 // <![CDATA[
118 // definitions used in querywindow.js
119 var common_query = '<?php echo PMA_generate_common_url('', '', '&');?>';
120 var opendb_url = '<?php echo $GLOBALS['cfg']['DefaultTabDatabase']; ?>';
121 var safari_browser = <?php echo PMA_USR_BROWSER_AGENT == 'SAFARI' ? 'true' : 'false' ?>;
122 var querywindow_height = <?php echo $GLOBALS['cfg']['QueryWindowHeight']; ?>;
123 var querywindow_width = <?php echo $GLOBALS['cfg']['QueryWindowWidth']; ?>;
124 var collation_connection = '<?php echo $GLOBALS['collation_connection']; ?>';
125 var lang = '<?php echo $GLOBALS['lang']; ?>';
126 var server = '<?php echo $GLOBALS['server']; ?>';
127 var table = '<?php echo $GLOBALS['table']; ?>';
128 var db = '<?php echo $GLOBALS['db']; ?>';
129 var text_dir = '<?php echo $GLOBALS['text_dir']; ?>';
130 var pma_absolute_uri = '<?php echo $GLOBALS['cfg']['PmaAbsoluteUri']; ?>';
131 // ]]>
132 </script>
133 <script src="./js/querywindow.js" type="text/javascript" language="javascript">
134 </script>
135 </head>
136 <frameset cols="<?php
137 if ($GLOBALS['text_dir'] === 'rtl') {
138 echo '*,';
139 }
140 echo $GLOBALS['cfg']['LeftWidth'];
141 if ($GLOBALS['text_dir'] === 'ltr') {
142 echo ',*';
143 }
144 ?>" rows="*" id="mainFrameset">
145 <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
146 <frame frameborder="0" id="frame_navigation"
147 src="left.php<?php echo $url_query; ?>"
148 name="frame_navigation" />
149 <?php } ?>
150 <frame frameborder="0" id="frame_content"
151 src="<?php echo $main_target; ?>"
152 name="frame_content" />
153 <?php if ($GLOBALS['text_dir'] === 'rtl') { ?>
154 <frame frameborder="0" id="frame_navigation"
155 src="left.php<?php echo $url_query; ?>"
156 name="frame_navigation" />
157 <?php } ?>
158 <noframes>
159 <body>
160 <p><?php echo $GLOBALS['strNoFrames']; ?></p>
161 </body>
162 </noframes>
163 </frameset>
164 </html>