bug #1763343 [session] Behavior with session.auto_start enabled
[phpmyadmin/sankalp_k.git] / libraries / header.inc.php
blob2b166e1a8e11bfe4e8200e7d394cd4444d91fef6
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 */
8 /**
11 require_once './libraries/common.inc.php';
13 if (empty($GLOBALS['is_header_sent'])) {
15 /**
16 * Gets a core script and starts output buffering work
18 require_once './libraries/common.inc.php';
19 require_once './libraries/ob.lib.php';
20 PMA_outBufferPre();
22 // garvin: For re-usability, moved http-headers and stylesheets
23 // to a seperate file. It can now be included by header.inc.php,
24 // querywindow.php.
26 require_once './libraries/header_http.inc.php';
27 require_once './libraries/header_meta_style.inc.php';
29 // generate title
30 $title = str_replace(
31 array(
32 '@HTTP_HOST@',
33 '@SERVER@',
34 '@VERBOSE@',
35 '@VSERVER@',
36 '@DATABASE@',
37 '@TABLE@',
38 '@PHPMYADMIN@',
40 array(
41 PMA_getenv('HTTP_HOST') ? PMA_getenv('HTTP_HOST') : '',
42 isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : '',
43 isset($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : '',
44 !empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : (isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : ''),
45 $GLOBALS['db'],
46 $GLOBALS['table'],
47 'phpMyAdmin ' . PMA_VERSION,
49 !empty($GLOBALS['table']) ? $GLOBALS['cfg']['TitleTable'] :
50 (!empty($GLOBALS['db']) ? $GLOBALS['cfg']['TitleDatabase'] :
51 (!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
52 $GLOBALS['cfg']['TitleDefault']))
54 // here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
55 $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
57 <script type="text/javascript">
58 // <![CDATA[
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 PMA_sanitize(str_replace('\'', '\\\'', $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 noDropDbMsg = '<?php echo (!$is_superuser && !$GLOBALS['cfg']['AllowUserDropDatabase'])
73 ? 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="./js/functions.js" type="text/javascript"></script>
79 <?php
80 } elseif (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="./js/user_password.js" type="text/javascript"></script>
91 <?php
92 } elseif (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="./js/server_privileges.js" type="text/javascript"></script>
103 <script src="./js/functions.js" type="text/javascript"></script>
104 <?php
105 } elseif (isset($js_to_run) && $js_to_run == 'indexes.js') {
106 echo "\n";
108 // js index validation stuff
109 var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
110 var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
111 // ]]>
112 </script>
113 <script src="./js/indexes.js" type="text/javascript"></script>
114 <?php
115 } elseif (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
116 echo "\n";
118 // ]]>
119 </script>
120 <script src="./js/tbl_change.js" type="text/javascript"></script>
121 <?php
122 } else {
123 echo "\n";
125 // ]]>
126 </script>
127 <?php
129 echo "\n";
131 // Reloads the navigation frame via JavaScript if required
132 PMA_reloadNavigation();
134 <script src="./js/tooltip.js" type="text/javascript"></script>
135 <meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
136 <?php /* remove vertical scroll bar bug in ie */ ?>
137 <!--[if IE 6]>
138 <style type="text/css">
139 /* <![CDATA[ */
140 html {
141 overflow-y: scroll;
143 /* ]]> */
144 </style>
145 <![endif]-->
146 </head>
148 <body>
149 <div id="TooltipContainer" onmouseover="holdTooltip();" onmouseout="swapTooltip('default');"></div>
150 <?php
152 // Include possible custom headers
153 if (file_exists('./config.header.inc.php')) {
154 require './config.header.inc.php';
158 // message of "Cookies required" displayed for auth_type http or config
159 // note: here, the decoration won't work because without cookies,
160 // our standard CSS is not operational
161 if (empty($_COOKIE)) {
162 echo '<div class="notice">' . $GLOBALS['strCookiesRequired'] . '</div>' . "\n";
165 if (!defined('PMA_DISPLAY_HEADING')) {
166 define('PMA_DISPLAY_HEADING', 1);
170 * Display heading if needed. Design can be set in css file.
173 if (PMA_DISPLAY_HEADING) {
174 $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
175 ? $GLOBALS['cfg']['Server']['verbose']
176 : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
177 ? ''
178 : ':' . $GLOBALS['cfg']['Server']['port']
181 $item = '<a href="%1$s?%2$s" class="item">';
182 if ($GLOBALS['cfg']['NavigationBarIconic']) {
183 $separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png" width="5" height="9" alt="-" /></span>' . "\n";
184 $item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
185 } else {
186 $separator = ' <span class="separator"> - </span>' . "\n";
189 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
190 $item .= '%4$s: ';
192 $item .= '%3$s</a>' . "\n";
194 echo '<div id="serverinfo">' . "\n";
195 printf($item,
196 $GLOBALS['cfg']['DefaultTabServer'],
197 PMA_generate_common_url(),
198 htmlspecialchars($server_info),
199 $GLOBALS['strServer'],
200 's_host.png');
202 if (strlen($GLOBALS['db'])) {
204 echo $separator;
205 printf($item,
206 $GLOBALS['cfg']['DefaultTabDatabase'],
207 PMA_generate_common_url($GLOBALS['db']),
208 htmlspecialchars($GLOBALS['db']),
209 $GLOBALS['strDatabase'],
210 's_db.png');
212 if (strlen($GLOBALS['table'])) {
213 require_once './libraries/tbl_info.inc.php';
215 echo $separator;
216 printf($item,
217 $GLOBALS['cfg']['DefaultTabTable'],
218 PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
219 str_replace(' ', '&nbsp;', htmlspecialchars($GLOBALS['table'])),
220 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? $GLOBALS['strView'] : $GLOBALS['strTable']),
221 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png');
224 * Displays table comment
225 * @uses $show_comment from libraries/tbl_info.inc.php
226 * @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
228 if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
229 if (strstr($show_comment, '; InnoDB free')) {
230 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
232 echo '<span class="table_comment" id="span_table_comment">'
233 .'&quot;' . htmlspecialchars($show_comment)
234 .'&quot;</span>' . "\n";
235 } // end if
236 } else {
237 // no table selected, display database comment if present
239 * Settings for relations stuff
241 require_once './libraries/relation.lib.php';
242 $cfgRelation = PMA_getRelationsParam();
244 // Get additional information about tables for tooltip is done
245 // in libraries/db_info.inc.php only once
246 if ($cfgRelation['commwork']) {
247 $comment = PMA_getComments($GLOBALS['db']);
250 * Displays table comment
252 if (is_array($comment) && ! empty($comment)) {
253 echo '<span class="table_comment"'
254 .' id="span_table_comment">&quot;'
255 .htmlspecialchars(implode(' ', $comment))
256 .'&quot;</span>' . "\n";
257 } // end if
261 echo '</div>';
265 * Sets a variable to remember headers have been sent
267 $GLOBALS['is_header_sent'] = true;