Fix left frame reloading after dropping table (bug #1034531).
[phpmyadmin/crack.git] / header.inc.php
blob242242c77b9b1156445de0b061bebffb02ec4ff4
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 if (empty($GLOBALS['is_header_sent'])) {
7 /**
8 * Gets a core script and starts output buffering work
9 */
10 require_once('./libraries/common.lib.php');
11 require_once('./libraries/ob.lib.php');
12 if ($GLOBALS['cfg']['OBGzip']) {
13 $GLOBALS['ob_mode'] = PMA_outBufferModeGet();
14 if ($GLOBALS['ob_mode']) {
15 PMA_outBufferPre($GLOBALS['ob_mode']);
19 // garvin: For re-usability, moved http-headers and stylesheets
20 // to a seperate file. It can now be included by header.inc.php,
21 // queryframe.php, querywindow.php.
23 require_once('./libraries/header_http.inc.php');
24 require_once('./libraries/header_meta_style.inc.php');
25 /* replaced 2004-05-05 by Michael Keck (mkkeck)
26 $title = '';
27 if (isset($GLOBALS['db'])) {
28 $title .= str_replace('\'', '\\\'', $GLOBALS['db']);
30 if (isset($GLOBALS['table'])) {
31 $title .= (empty($title) ? '' : '.') . str_replace('\'', '\\\'', $GLOBALS['table']);
33 if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) {
34 $title .= (empty($title) ? 'phpMyAdmin ' : ' ')
35 . sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ? str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['verbose'])));
37 $title .= (empty($title) ? '' : ' - ') . 'phpMyAdmin ' . PMA_VERSION;
39 /* the new one
40 * 2004-05-05: replaced by Michael Keck (mkkeck)
42 $title = '';
43 if ($cfg['ShowHttpHostTitle']) {
44 $title .= (empty($GLOBALS['cfg']['SetHttpHostTitle']) ? $_SERVER['HTTP_HOST'] : $GLOBALS['cfg']['SetHttpHostTitle']) . ' >> ';
46 if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) {
47 $title.=str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['host']);
49 if (isset($GLOBALS['db'])) {
50 $title .= ' >> ' . str_replace('\'', '\\\'', $GLOBALS['db']);
52 if (isset($GLOBALS['table'])) {
53 $title .= (empty($title) ? '' : ' ') . ' >> ' . str_replace('\'', '\\\'', $GLOBALS['table']);
55 $title .= ' | phpMyAdmin ' . PMA_VERSION;
57 <script type="text/javascript" language="javascript">
58 <!--
59 // Updates the title of the frameset if possible (ns4 does not allow this)
60 if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
61 && typeof(parent.document.title) == 'string') {
62 parent.document.title = '<?php echo $title; ?>';
64 <?php
65 // Add some javascript instructions if required
66 if (isset($js_to_run) && $js_to_run == 'functions.js') {
67 echo "\n";
69 // js form validation stuff
70 var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
71 var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
72 var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
73 var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>';
74 var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
75 var confirmMsgDropDB = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDropDatabaseStrongWarning']) : ''); ?>';
76 //-->
77 </script>
78 <script src="libraries/functions.js" type="text/javascript" language="javascript"></script>
79 <?php
80 } else if (isset($js_to_run) && $js_to_run == 'user_password.js') {
81 echo "\n";
83 // js form validation stuff
84 var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
85 var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
86 var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
87 var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
88 //-->
89 </script>
90 <script src="libraries/user_password.js" type="text/javascript" language="javascript"></script>
91 <?php
92 } else if (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
93 echo "\n";
95 // js form validation stuff
96 var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
97 var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
98 var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
99 var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
100 //-->
101 </script>
102 <script src="libraries/server_privileges.js" type="text/javascript" language="javascript"></script>
103 <?php
104 } else if (isset($js_to_run) && $js_to_run == 'indexes.js') {
105 echo "\n";
107 // js index validation stuff
108 var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
109 var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
110 var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
111 //-->
112 </script>
113 <script src="libraries/indexes.js" type="text/javascript" language="javascript"></script>
114 <?php
115 } else if (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
116 echo "\n";
118 //-->
119 </script>
120 <script src="libraries/tbl_change.js" type="text/javascript" language="javascript"></script>
121 <?php
122 } else {
123 echo "\n";
125 //-->
126 </script>
127 <?php
129 echo "\n";
131 <meta name="OBGZip" content="<?php echo ($cfg['OBGzip'] ? 'true' : 'false'); ?>" />
132 </head>
135 <?php
136 if ($GLOBALS['cfg']['RightBgImage'] != '') {
137 $bkg_img = ' background="' . $GLOBALS['cfg']['RightBgImage'] . '"';
138 } else {
139 $bkg_img = '';
142 <body bgcolor="<?php echo $GLOBALS['cfg']['RightBgColor'] . '"' . $bkg_img; ?>>
143 <?php
144 include('./config.header.inc.php');
146 if (!defined('PMA_DISPLAY_HEADING')) {
147 define('PMA_DISPLAY_HEADING', 1);
151 * Display heading if needed. Design can be set in css file.
154 if (PMA_DISPLAY_HEADING) {
155 echo '<table border="0" cellpadding="0" cellspacing="0" id="serverinfo">' . "\n"
156 . ' <tr>' . "\n";
157 $header_url_qry = '?' . PMA_generate_common_url();
158 $server_info = (!empty($cfg['Server']['verbose'])
159 ? $cfg['Server']['verbose']
160 : $server_info = $cfg['Server']['host'] . (empty($cfg['Server']['port'])
161 ? ''
162 : ':' . $cfg['Server']['port']
165 echo ' '
166 . '<td class="serverinfo">' . $GLOBALS['strServer'] . ':&nbsp;'
167 . '<a href="' . $GLOBALS['cfg']['DefaultTabServer'] . '?' . PMA_generate_common_url() . '">';
168 if ($GLOBALS['cfg']['MainPageIconic']) {
169 echo '<img src="' . $GLOBALS['pmaThemeImage'] . 's_host.png" width="16" height="16" border="0" alt="' . htmlspecialchars($server_info) . '" />';
171 echo htmlspecialchars($server_info) . '</a>' . "\n"
172 . '</td>' . "\n\n";
174 if (!empty($GLOBALS['db'])) {
175 echo ' '
176 . '<td class="serverinfo"><div></div></td>' . "\n" . ' '
177 . '<td class="serverinfo">' . $GLOBALS['strDatabase'] . ':&nbsp;'
178 . '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($GLOBALS['db']) . '">';
179 if ($GLOBALS['cfg']['MainPageIconic']) {
180 echo '<img src="' . $GLOBALS['pmaThemeImage'] . 's_db.png" width="16" height="16" border="0" alt="' . htmlspecialchars($GLOBALS['db']) . '" />';
182 echo htmlspecialchars($GLOBALS['db']) . '</a>' . "\n"
183 . '</td>' . "\n\n";
185 if (!empty($GLOBALS['table'])) {
186 echo ' '
187 . '<td class="serverinfo"><div></div></td>' . "\n" . ' '
188 . '<td class="serverinfo">' . $GLOBALS['strTable'] . ':&nbsp;'
189 . '<a href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']) . '">';
190 if ($GLOBALS['cfg']['MainPageIconic']) {
191 echo '<img src="' . $GLOBALS['pmaThemeImage'] . 's_tbl.png" width="16" height="16" border="0" alt="' . htmlspecialchars($GLOBALS['table']) . '" />';
193 echo htmlspecialchars($GLOBALS['table']) . '</a>' . "\n"
194 . '</td>' . "\n\n";
197 echo ' </tr>' . "\n" . '</table>';
200 * Sets a variable to remember headers have been sent
202 $GLOBALS['is_header_sent'] = TRUE;