Refresh .po files
[phpmyadmin/madhuracj.git] / libraries / header.inc.php
blob80763e78b1fcac1da31bd832cc73b9818182566c
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin
6 */
7 if (! defined('PHPMYADMIN')) {
8 exit;
11 require_once './libraries/common.inc.php';
12 require_once './libraries/RecentTable.class.php';
15 /**
16 * Add recently used table and reload the navigation.
18 * @param string $db Database name where the table is located.
19 * @param string $table The table name
21 function PMA_addRecentTable($db, $table) {
22 $tmp_result = PMA_RecentTable::getInstance()->add($db, $table);
23 if ($tmp_result === true) {
24 echo '<span class="hide" id="update_recent_tables"></span>';
25 } else {
26 $error = $tmp_result;
27 $error->display();
31 /**
32 * This is not an Ajax request so we need to generate all this output.
34 if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
36 if (empty($GLOBALS['is_header_sent'])) {
38 /**
39 * Gets a core script and starts output buffering work
41 require_once './libraries/ob.lib.php';
42 PMA_outBufferPre();
44 // if database storage for user preferences is transient, offer to load
45 // exported settings from localStorage (detection will be done in JavaScript)
46 $userprefs_offer_import = $GLOBALS['PMA_Config']->get('user_preferences') == 'session'
47 && ! isset($_SESSION['userprefs_autoload']);
48 if ($userprefs_offer_import) {
49 $GLOBALS['js_include'][] = 'config.js';
52 // For re-usability, moved http-headers and stylesheets
53 // to a seperate file. It can now be included by header.inc.php,
54 // querywindow.php.
56 require_once './libraries/header_http.inc.php';
57 require_once './libraries/header_meta_style.inc.php';
58 require_once './libraries/header_scripts.inc.php';
60 <meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
61 <?php /* remove vertical scroll bar bug in ie */ ?>
62 <!--[if IE 6]>
63 <style type="text/css">
64 /* <![CDATA[ */
65 html {
66 overflow-y: scroll;
68 /* ]]> */
69 </style>
70 <![endif]-->
71 </head>
73 <body>
74 <?php
76 // Include possible custom headers
77 if (file_exists(CUSTOM_HEADER_FILE)) {
78 require CUSTOM_HEADER_FILE;
82 // message of "Cookies required" displayed for auth_type http or config
83 // note: here, the decoration won't work because without cookies,
84 // our standard CSS is not operational
85 if (empty($_COOKIE)) {
86 PMA_Message::notice(__('Cookies must be enabled past this point.'))->display();
89 // offer to load user preferences from localStorage
90 if ($userprefs_offer_import) {
91 require_once './libraries/user_preferences.lib.php';
92 PMA_userprefs_autoload_header();
95 if (!defined('PMA_DISPLAY_HEADING')) {
96 define('PMA_DISPLAY_HEADING', 1);
99 /**
100 * Display heading if needed. Design can be set in css file.
103 if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) {
104 $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
105 ? $GLOBALS['cfg']['Server']['verbose']
106 : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
107 ? ''
108 : ':' . $GLOBALS['cfg']['Server']['port']
111 $item = '<a href="%1$s?%2$s" class="item">';
112 if ($GLOBALS['cfg']['NavigationBarIconic']) {
113 $separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_' . $GLOBALS['text_dir'] . '.png" width="5" height="9" alt="-" /></span>' . "\n";
114 $item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
115 } else {
116 $separator = ' <span class="separator"> - </span>' . "\n";
119 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
120 $item .= '%4$s: ';
122 $item .= '%3$s</a>' . "\n";
124 echo '<div id="serverinfo">' . "\n";
125 printf($item,
126 $GLOBALS['cfg']['DefaultTabServer'],
127 PMA_generate_common_url(),
128 htmlspecialchars($server_info),
129 __('Server'),
130 's_host.png');
132 if (strlen($GLOBALS['db'])) {
134 echo $separator;
135 printf($item,
136 $GLOBALS['cfg']['DefaultTabDatabase'],
137 PMA_generate_common_url($GLOBALS['db']),
138 htmlspecialchars($GLOBALS['db']),
139 __('Database'),
140 's_db.png');
141 // if the table is being dropped, $_REQUEST['purge'] is set
142 // (it always contains "1")
143 // so do not display the table name in upper div
144 if (strlen($GLOBALS['table']) && ! (isset($_REQUEST['purge']))) {
145 require_once './libraries/tbl_info.inc.php';
147 echo $separator;
148 printf($item,
149 $GLOBALS['cfg']['DefaultTabTable'],
150 PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
151 str_replace(' ', '&nbsp;', htmlspecialchars($GLOBALS['table'])),
152 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? __('View') : __('Table')),
153 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png');
156 * Displays table comment
158 if (!empty($show_comment) && ! isset($GLOBALS['avoid_show_comment'])) {
159 if (strstr($show_comment, '; InnoDB free')) {
160 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
162 echo '<span class="table_comment" id="span_table_comment">'
163 .'&quot;' . htmlspecialchars($show_comment)
164 .'&quot;</span>' . "\n";
165 } // end if
167 // add recently used table and reload the navigation
168 if ($GLOBALS['cfg']['LeftRecentTable'] > 0) {
169 PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
171 } else {
172 // no table selected, display database comment if present
174 * Settings for relations stuff
176 require_once './libraries/relation.lib.php';
177 $cfgRelation = PMA_getRelationsParam();
179 // Get additional information about tables for tooltip is done
180 // in libraries/db_info.inc.php only once
181 if ($cfgRelation['commwork']) {
182 $comment = PMA_getDbComment($GLOBALS['db']);
184 * Displays table comment
186 if (! empty($comment)) {
187 echo '<span class="table_comment"'
188 . ' id="span_table_comment">&quot;'
189 . htmlspecialchars($comment)
190 . '&quot;</span>' . "\n";
191 } // end if
196 echo '</div>';
199 * Sets a variable to remember headers have been sent
201 $GLOBALS['is_header_sent'] = true;
202 } //end if(!$GLOBALS['is_ajax_request'])
203 else {
204 if (empty($GLOBALS['is_header_sent'])) {
205 require_once './libraries/header_http.inc.php';
206 $GLOBALS['is_header_sent'] = true;