bug #965548, displaying README and LICENSE
[phpmyadmin/crack.git] / header.inc.php
blob61fa4a6e8ba44d0283102bf43625681d6d947d3d
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']) && isset($_SERVER['HTTP_HOST']) ? $_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; ?>';
65 document.write('<style type="text/css">');
66 document.write('img.lightbulb { cursor: pointer; }');
67 document.write('<\/style>');
69 <?php
70 // Add some javascript instructions if required
71 if (isset($js_to_run) && $js_to_run == 'functions.js') {
72 echo "\n";
74 // js form validation stuff
75 var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
76 var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
77 var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>';
78 var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
79 var confirmMsgDropDB = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDropDatabaseStrongWarning']) : ''); ?>';
80 //-->
81 </script>
82 <script src="libraries/functions.js" type="text/javascript" language="javascript"></script>
83 <?php
84 } else if (isset($js_to_run) && $js_to_run == 'user_password.js') {
85 echo "\n";
87 // js form validation stuff
88 var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
89 var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
90 var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
91 var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
92 //-->
93 </script>
94 <script src="libraries/user_password.js" type="text/javascript" language="javascript"></script>
95 <?php
96 } else if (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
97 echo "\n";
99 // js form validation stuff
100 var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
101 var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
102 var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
103 var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
104 //-->
105 </script>
106 <script src="libraries/server_privileges.js" type="text/javascript" language="javascript"></script>
107 <?php
108 } else if (isset($js_to_run) && $js_to_run == 'indexes.js') {
109 echo "\n";
111 // js index validation stuff
112 var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
113 var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
114 //-->
115 </script>
116 <script src="libraries/indexes.js" type="text/javascript" language="javascript"></script>
117 <?php
118 } else if (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
119 echo "\n";
121 //-->
122 </script>
123 <script src="libraries/tbl_change.js" type="text/javascript" language="javascript"></script>
124 <?php
125 } else {
126 echo "\n";
128 //-->
129 </script>
130 <?php
132 echo "\n";
134 // Reloads the navigation frame via JavaScript if required
135 PMA_reloadNavigation();
137 <meta name="OBGZip" content="<?php echo ($cfg['OBGzip'] ? 'true' : 'false'); ?>" />
138 </head>
141 <?php
142 if ($GLOBALS['cfg']['RightBgImage'] != '') {
143 $bkg_img = ' background="' . $GLOBALS['cfg']['RightBgImage'] . '"';
144 } else {
145 $bkg_img = '';
148 <body bgcolor="<?php echo $GLOBALS['cfg']['RightBgColor'] . '"' . $bkg_img; ?>>
149 <div id="TooltipContainer" name="TooltipContainer" onmouseover="holdTooltip();" onmouseout="swapTooltip('default');"></div>
150 <?php
151 include('./config.header.inc.php');
153 if (!defined('PMA_DISPLAY_HEADING')) {
154 define('PMA_DISPLAY_HEADING', 1);
158 * Display heading if needed. Design can be set in css file.
161 if (PMA_DISPLAY_HEADING) {
162 echo '<table border="0" cellpadding="0" cellspacing="0" id="serverinfo">' . "\n"
163 . ' <tr>' . "\n";
164 $header_url_qry = '?' . PMA_generate_common_url();
165 $server_info = (!empty($cfg['Server']['verbose'])
166 ? $cfg['Server']['verbose']
167 : $server_info = $cfg['Server']['host'] . (empty($cfg['Server']['port'])
168 ? ''
169 : ':' . $cfg['Server']['port']
172 echo ' '
173 . '<td class="serverinfo">' . $GLOBALS['strServer'] . ':&nbsp;'
174 . '<a href="' . $GLOBALS['cfg']['DefaultTabServer'] . '?' . PMA_generate_common_url() . '">';
175 if ($GLOBALS['cfg']['MainPageIconic']) {
176 echo '<img src="' . $GLOBALS['pmaThemeImage'] . 's_host.png" width="16" height="16" border="0" alt="' . htmlspecialchars($server_info) . '" />';
178 echo htmlspecialchars($server_info) . '</a>' . "\n"
179 . '</td>' . "\n\n";
181 if (!empty($GLOBALS['db'])) {
182 echo ' '
183 . '<td class="serverinfo"><div></div></td>' . "\n" . ' '
184 . '<td class="serverinfo">' . $GLOBALS['strDatabase'] . ':&nbsp;'
185 . '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($GLOBALS['db']) . '">';
186 if ($GLOBALS['cfg']['MainPageIconic']) {
187 echo '<img src="' . $GLOBALS['pmaThemeImage'] . 's_db.png" width="16" height="16" border="0" alt="' . htmlspecialchars($GLOBALS['db']) . '" />';
189 echo htmlspecialchars($GLOBALS['db']) . '</a>' . "\n"
190 . '</td>' . "\n\n";
192 if (!empty($GLOBALS['table'])) {
193 if (PMA_MYSQL_INT_VERSION >= 50000) {
194 require_once('./tbl_properties_table_info.php');
195 } else {
196 $tbl_is_view = FALSE;
198 echo ' '
199 . '<td class="serverinfo"><div></div></td>' . "\n" . ' '
200 . '<td class="serverinfo">' . (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? $GLOBALS['strView'] : $GLOBALS['strTable']) . ':&nbsp;'
201 . '<a href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']) . '">';
202 if ($GLOBALS['cfg']['MainPageIconic']) {
203 echo '<img src="' . $GLOBALS['pmaThemeImage'] . (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png" width="16" height="16" border="0" alt="' . htmlspecialchars($GLOBALS['table']) . '" />';
205 echo htmlspecialchars($GLOBALS['table']) . '</a>' . "\n"
206 . '</td>' . "\n\n";
209 echo ' </tr>' . "\n" . '</table>';
212 * Sets a variable to remember headers have been sent
214 $GLOBALS['is_header_sent'] = TRUE;