Rev Author Line No. Line
250 kaklik 1 <?php
2 /* $Id: header.inc.php,v 2.6 2006/01/17 17:02:30 cybot_tm Exp $ */
3 // vim: expandtab sw=4 ts=4 sts=4:
4  
5 require_once('./libraries/common.lib.php');
6  
7 if (empty($GLOBALS['is_header_sent'])) {
8  
9 /**
10 * Gets a core script and starts output buffering work
11 */
12 require_once('./libraries/common.lib.php');
13 require_once('./libraries/ob.lib.php');
14 if ($GLOBALS['cfg']['OBGzip']) {
15 $GLOBALS['ob_mode'] = PMA_outBufferModeGet();
16 if ($GLOBALS['ob_mode']) {
17 PMA_outBufferPre($GLOBALS['ob_mode']);
18 }
19 }
20  
21 // garvin: For re-usability, moved http-headers and stylesheets
22 // to a seperate file. It can now be included by header.inc.php,
23 // querywindow.php.
24  
25 require_once('./libraries/header_http.inc.php');
26 require_once('./libraries/header_meta_style.inc.php');
27  
28 // generate title
29 $title = '';
30 if ($cfg['ShowHttpHostTitle']) {
31 $title .= (empty($GLOBALS['cfg']['SetHttpHostTitle']) && isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $GLOBALS['cfg']['SetHttpHostTitle']) . ' / ';
32 }
33 if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) {
34 $title.=str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['host']);
35 }
36 if (isset($GLOBALS['db'])) {
37 $title .= ' / ' . str_replace('\'', '\\\'', $GLOBALS['db']);
38 }
39 if (isset($GLOBALS['table'])) {
40 $title .= (empty($title) ? '' : ' ') . ' / ' . str_replace('\'', '\\\'', $GLOBALS['table']);
41 }
42 $title .= ' | phpMyAdmin ' . PMA_VERSION;
43 ?>
44 <script type="text/javascript" language="javascript">
45 <!--
46 // Updates the title of the frameset if possible (ns4 does not allow this)
47 if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
48 && typeof(parent.document.title) == 'string') {
49 parent.document.title = '<?php echo PMA_sanitize($title); ?>';
50 }
51 <?php
52 // Add some javascript instructions if required
53 if (isset($js_to_run) && $js_to_run == 'functions.js') {
54 echo "\n";
55 ?>
56 // js form validation stuff
57 var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
58 var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
59 var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>';
60 var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
61 var confirmMsgDropDB = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDropDatabaseStrongWarning']) : ''); ?>';
62 //-->
63 </script>
64 <script src="./js/functions.js" type="text/javascript" language="javascript"></script>
65 <?php
66 } elseif (isset($js_to_run) && $js_to_run == 'user_password.js') {
67 echo "\n";
68 ?>
69 // js form validation stuff
70 var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
71 var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
72 var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
73 var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
74 //-->
75 </script>
76 <script src="./js/user_password.js" type="text/javascript" language="javascript"></script>
77 <?php
78 } elseif (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
79 echo "\n";
80 ?>
81 // js form validation stuff
82 var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
83 var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
84 var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
85 var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
86 //-->
87 </script>
88 <script src="./js/server_privileges.js" type="text/javascript" language="javascript"></script>
89 <script src="./js/functions.js" type="text/javascript" language="javascript"></script>
90 <?php
91 } elseif (isset($js_to_run) && $js_to_run == 'indexes.js') {
92 echo "\n";
93 ?>
94 // js index validation stuff
95 var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
96 var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
97 //-->
98 </script>
99 <script src="./js/indexes.js" type="text/javascript" language="javascript"></script>
100 <?php
101 } elseif (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
102 echo "\n";
103 ?>
104 //-->
105 </script>
106 <script src="./js/tbl_change.js" type="text/javascript" language="javascript"></script>
107 <?php
108 } else {
109 echo "\n";
110 ?>
111 //-->
112 </script>
113 <?php
114 }
115 echo "\n";
116  
117 // Reloads the navigation frame via JavaScript if required
118 PMA_reloadNavigation();
119 ?>
120 <script src="./js/tooltip.js" type="text/javascript"
121 language="javascript"></script>
122 <meta name="OBGZip" content="<?php echo ($cfg['OBGzip'] ? 'true' : 'false'); ?>" />
123 </head>
124  
125 <body>
126 <div id="TooltipContainer" onmouseover="holdTooltip();" onmouseout="swapTooltip('default');"></div>
127 <?php
128  
129 // Include possible custom headers
130 require_once('./libraries/header_custom.inc.php');
131  
132 if (!defined('PMA_DISPLAY_HEADING')) {
133 define('PMA_DISPLAY_HEADING', 1);
134 }
135  
136 /**
137 * Display heading if needed. Design can be set in css file.
138 */
139  
140 if (PMA_DISPLAY_HEADING) {
141 $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
142 ? $GLOBALS['cfg']['Server']['verbose']
143 : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
144 ? ''
145 : ':' . $GLOBALS['cfg']['Server']['port']
146 )
147 );
148 $item = '<a href="%1$s?%2$s" class="item">';
149 if ( $GLOBALS['cfg']['NavigationBarIconic'] ) {
150 $separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png" width="5" height="9" alt="-" /></span>' . "\n";
151 $item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
152 } else {
153 $separator = ' <span class="separator"> - </span>' . "\n";
154 }
155  
156 if ( $GLOBALS['cfg']['NavigationBarIconic'] !== true ) {
157 $item .= '%4$s: ';
158 }
159 $item .= '%3$s</a>' . "\n";
160  
161 echo '<div id="serverinfo">' . "\n";
162 printf( $item,
163 $GLOBALS['cfg']['DefaultTabServer'],
164 PMA_generate_common_url(),
165 htmlspecialchars($server_info),
166 $GLOBALS['strServer'],
167 's_host.png' );
168  
169 if (isset($GLOBALS['db']) && strlen($GLOBALS['db'])) {
170  
171 echo $separator;
172 printf( $item,
173 $GLOBALS['cfg']['DefaultTabDatabase'],
174 PMA_generate_common_url($GLOBALS['db']),
175 htmlspecialchars($GLOBALS['db']),
176 $GLOBALS['strDatabase'],
177 's_db.png' );
178  
179 if (isset($GLOBALS['table']) && strlen($GLOBALS['table'])) {
180 require_once('./libraries/tbl_properties_table_info.inc.php');
181  
182 echo $separator;
183 printf( $item,
184 $GLOBALS['cfg']['DefaultTabTable'],
185 PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
186 htmlspecialchars($GLOBALS['table']),
187 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? $GLOBALS['strView'] : $GLOBALS['strTable']),
188 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png' );
189  
190 /**
191 * Displays table comment
192 * @uses $show_comment from libraries/tbl_properties_table_info.inc.php
193 * @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
194 */
195 if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
196 if (strstr($show_comment, '; InnoDB free')) {
197 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
198 }
199 echo '<span class="table_comment" id="span_table_comment">'
200 .'&quot;' . htmlspecialchars($show_comment)
201 .'&quot;</span>' . "\n";
202 } // end if
203 } else {
204 // no table selected, display database comment if present
205 /**
206 * Settings for relations stuff
207 */
208 require_once('./libraries/relation.lib.php');
209 $cfgRelation = PMA_getRelationsParam();
210  
211 // Get additional information about tables for tooltip is done
212 // in libraries/db_details_db_info.inc.php only once
213 if ($cfgRelation['commwork']) {
214 $comment = PMA_getComments( $GLOBALS['db'] );
215  
216 /**
217 * Displays table comment
218 */
219 if ( is_array( $comment ) ) {
220 echo '<span class="table_comment"'
221 .' id="span_table_comment">&quot;'
222 .htmlspecialchars(implode(' ', $comment))
223 .'&quot;</span>' . "\n";
224 } // end if
225 }
226 }
227 }
228 echo '</div>';
229  
230 }
231 /**
232 * Sets a variable to remember headers have been sent
233 */
234 $GLOBALS['is_header_sent'] = TRUE;
235 }
236 ?>