Installer Class missing array variable check
[openemr.git] / phpmyadmin / libraries / header.inc.php
blob8239d17cb5df97d2c0949786b40eee6cc52c7b9b
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 */
7 if (! defined('PHPMYADMIN')) {
8 exit;
11 /**
14 require_once './libraries/common.inc.php';
16 if (empty($GLOBALS['is_header_sent'])) {
18 /**
19 * Gets a core script and starts output buffering work
21 require_once './libraries/common.inc.php';
22 require_once './libraries/ob.lib.php';
23 PMA_outBufferPre();
25 // garvin: For re-usability, moved http-headers and stylesheets
26 // to a seperate file. It can now be included by header.inc.php,
27 // querywindow.php.
29 require_once './libraries/header_http.inc.php';
30 require_once './libraries/header_meta_style.inc.php';
32 // Cross-framing protection
33 if ( false === $GLOBALS['cfg']['AllowThirdPartyFraming']) {
35 <script type="text/javascript">
36 try {
37 // can't access this if on a different domain
38 var topdomain = top.document.domain;
39 // double-check just for sure
40 if (topdomain != self.document.domain) {
41 alert("Redirecting...");
42 top.location.replace(self.document.URL.substring(0, self.document.URL.lastIndexOf("/")+1));
45 catch(e) {
46 alert("Redirecting... (error: " + e);
47 top.location.replace(self.document.URL.substring(0, self.document.URL.lastIndexOf("/")+1));
50 </script>
51 <?php
53 // generate title
54 $title = str_replace(
55 array(
56 '@HTTP_HOST@',
57 '@SERVER@',
58 '@VERBOSE@',
59 '@VSERVER@',
60 '@DATABASE@',
61 '@TABLE@',
62 '@PHPMYADMIN@',
64 array(
65 PMA_getenv('HTTP_HOST') ? PMA_getenv('HTTP_HOST') : '',
66 isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : '',
67 isset($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : '',
68 !empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : (isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : ''),
69 $GLOBALS['db'],
70 $GLOBALS['table'],
71 'phpMyAdmin ' . PMA_VERSION,
73 !empty($GLOBALS['table']) ? $GLOBALS['cfg']['TitleTable'] :
74 (!empty($GLOBALS['db']) ? $GLOBALS['cfg']['TitleDatabase'] :
75 (!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
76 $GLOBALS['cfg']['TitleDefault']))
78 // here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
79 $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
81 <script type="text/javascript">
82 // <![CDATA[
83 // Updates the title of the frameset if possible (ns4 does not allow this)
84 if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
85 && typeof(parent.document.title) == 'string') {
86 parent.document.title = '<?php echo PMA_sanitize(str_replace('\'', '\\\'', $title)); ?>';
88 <?php
89 // Add some javascript instructions if required
90 if (isset($js_to_run) && $js_to_run == 'functions.js') {
91 echo "\n";
93 // js form validation stuff
94 var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
95 var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
96 var noDropDbMsg = '<?php echo (!$is_superuser && !$GLOBALS['cfg']['AllowUserDropDatabase'])
97 ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''; ?>';
98 var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
99 var confirmMsgDropDB = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDropDatabaseStrongWarning']) : ''); ?>';
100 // ]]>
101 </script>
102 <script src="./js/functions.js" type="text/javascript"></script>
103 <?php
104 } elseif (isset($js_to_run) && $js_to_run == 'user_password.js') {
105 echo "\n";
107 // js form validation stuff
108 var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
109 var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
110 var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
111 var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
112 // ]]>
113 </script>
114 <script src="./js/user_password.js" type="text/javascript"></script>
115 <?php
116 } elseif (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
117 echo "\n";
119 // js form validation stuff
120 var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
121 var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
122 var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
123 var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
124 // ]]>
125 </script>
126 <script src="./js/server_privileges.js" type="text/javascript"></script>
127 <script src="./js/functions.js" type="text/javascript"></script>
128 <?php
129 } elseif (isset($js_to_run) && $js_to_run == 'indexes.js') {
130 echo "\n";
132 // js index validation stuff
133 var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
134 var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
135 // ]]>
136 </script>
137 <script src="./js/indexes.js" type="text/javascript"></script>
138 <?php
139 } elseif (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
140 echo "\n";
142 // ]]>
143 </script>
144 <script src="./js/tbl_change.js" type="text/javascript"></script>
145 <?php
146 } else {
147 echo "\n";
149 // ]]>
150 </script>
151 <?php
153 echo "\n";
155 // Reloads the navigation frame via JavaScript if required
156 PMA_reloadNavigation();
158 <script src="./js/tooltip.js" type="text/javascript"></script>
159 <meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
160 <?php /* remove vertical scroll bar bug in ie */ ?>
161 <!--[if IE 6]>
162 <style type="text/css">
163 /* <![CDATA[ */
164 html {
165 overflow-y: scroll;
167 /* ]]> */
168 </style>
169 <![endif]-->
170 </head>
172 <body>
173 <div id="TooltipContainer" onmouseover="holdTooltip();" onmouseout="swapTooltip('default');"></div>
174 <?php
176 // Include possible custom headers
177 if (file_exists('./config.header.inc.php')) {
178 require './config.header.inc.php';
182 // message of "Cookies required" displayed for auth_type http or config
183 // note: here, the decoration won't work because without cookies,
184 // our standard CSS is not operational
185 if (empty($_COOKIE)) {
186 echo '<div class="notice">' . $GLOBALS['strCookiesRequired'] . '</div>' . "\n";
189 if (!defined('PMA_DISPLAY_HEADING')) {
190 define('PMA_DISPLAY_HEADING', 1);
194 * Display heading if needed. Design can be set in css file.
197 if (PMA_DISPLAY_HEADING) {
198 $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
199 ? $GLOBALS['cfg']['Server']['verbose']
200 : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
201 ? ''
202 : ':' . $GLOBALS['cfg']['Server']['port']
205 $item = '<a href="%1$s?%2$s" class="item">';
206 if ($GLOBALS['cfg']['NavigationBarIconic']) {
207 $separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png" width="5" height="9" alt="-" /></span>' . "\n";
208 $item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
209 } else {
210 $separator = ' <span class="separator"> - </span>' . "\n";
213 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
214 $item .= '%4$s: ';
216 $item .= '%3$s</a>' . "\n";
218 echo '<div id="serverinfo">' . "\n";
219 printf($item,
220 $GLOBALS['cfg']['DefaultTabServer'],
221 PMA_generate_common_url(),
222 htmlspecialchars($server_info),
223 $GLOBALS['strServer'],
224 's_host.png');
226 if (strlen($GLOBALS['db'])) {
228 echo $separator;
229 printf($item,
230 $GLOBALS['cfg']['DefaultTabDatabase'],
231 PMA_generate_common_url($GLOBALS['db']),
232 htmlspecialchars($GLOBALS['db']),
233 $GLOBALS['strDatabase'],
234 's_db.png');
236 if (strlen($GLOBALS['table'])) {
237 require_once './libraries/tbl_info.inc.php';
239 echo $separator;
240 printf($item,
241 $GLOBALS['cfg']['DefaultTabTable'],
242 PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
243 str_replace(' ', '&nbsp;', htmlspecialchars($GLOBALS['table'])),
244 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? $GLOBALS['strView'] : $GLOBALS['strTable']),
245 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png');
248 * Displays table comment
249 * @uses $show_comment from libraries/tbl_info.inc.php
250 * @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
252 if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
253 if (strstr($show_comment, '; InnoDB free')) {
254 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
256 echo '<span class="table_comment" id="span_table_comment">'
257 .'&quot;' . htmlspecialchars($show_comment)
258 .'&quot;</span>' . "\n";
259 } // end if
260 } else {
261 // no table selected, display database comment if present
263 * Settings for relations stuff
265 require_once './libraries/relation.lib.php';
266 $cfgRelation = PMA_getRelationsParam();
268 // Get additional information about tables for tooltip is done
269 // in libraries/db_info.inc.php only once
270 if ($cfgRelation['commwork']) {
271 $comment = PMA_getComments($GLOBALS['db']);
274 * Displays table comment
276 if (is_array($comment) && ! empty($comment)) {
277 echo '<span class="table_comment"'
278 .' id="span_table_comment">&quot;'
279 .htmlspecialchars(implode(' ', $comment))
280 .'&quot;</span>' . "\n";
281 } // end if
285 echo '</div>';
289 * Sets a variable to remember headers have been sent
291 $GLOBALS['is_header_sent'] = true;