Correctly handle unix timestamp (RFE #1440386).
[phpmyadmin/crack.git] / main.php
blob240b4dc3ce1514b7d58b8cda7d3318014dc3bece
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 /**
6 * Don't display the page heading
7 */
8 if (!defined('PMA_DISPLAY_HEADING')) {
9 define('PMA_DISPLAY_HEADING', 0);
12 /**
13 * Gets some core libraries and displays a top message if required
15 require_once './libraries/common.lib.php';
17 // Handles some variables that may have been sent by the calling script
18 if (isset($db)) {
19 unset($db);
21 if (isset($table)) {
22 unset($table);
24 $show_query = '1';
25 require_once './libraries/header.inc.php';
27 // Any message to display?
28 if (! empty($message)) {
29 PMA_showMessage($message);
30 unset($message);
33 $common_url_query = PMA_generate_common_url('', '');
35 // this div is required for containing divs can be 50%
36 echo '<div id="maincontainer">' . "\n";
38 /**
39 * Displays the mysql server related links
41 if ($server > 0) {
43 require_once './libraries/check_user_privileges.lib.php';
44 // why this? a non-priv user should be able to change his
45 // password if the configuration permits
46 //$cfg['ShowChgPassword'] = $is_superuser = PMA_isSuperuser();
47 $is_superuser = PMA_isSuperuser();
49 if ($cfg['Server']['auth_type'] == 'config') {
50 $cfg['ShowChgPassword'] = false;
55 <div id="mysqlmaininformation">
56 <?php
57 if ($server > 0) {
58 // robbat2: Use the verbose name of the server instead of the hostname
59 // if a value is set
60 $server_info = '';
61 if (!empty($cfg['Server']['verbose'])) {
62 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
63 if ($GLOBALS['cfg']['ShowServerInfo']) {
64 $server_info .= ' (';
67 if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
68 $server_info .= PMA_DBI_get_host_info();
71 if (!empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
72 $server_info .= ')';
74 // loic1: skip this because it's not a so good idea to display sockets
75 // used to everybody
76 // if (!empty($cfg['Server']['socket']) && PMA_PHP_INT_VERSION >= 30010) {
77 // $server_info .= ':' . $cfg['Server']['socket'];
78 // }
79 $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
82 // should we add the port info here?
83 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
84 ? $GLOBALS['cfg']['Server']['verbose']
85 : $GLOBALS['cfg']['Server']['host']);
86 echo '<h1 xml:lang="en" dir="ltr">' . $short_server_info .'</h1>' . "\n";
87 unset($short_server_info);
88 } else {
89 // Case when no server selected
90 //echo '<h1 xml:lang="en" dir="ltr">MySQL</h1>' . "\n";
93 if ($server > 0) {
94 echo '<ul>' . "\n";
96 if ($GLOBALS['cfg']['ShowServerInfo']) {
97 PMA_printListItem($strServerVersion . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_info');
98 PMA_printListItem($strProtocolVersion . ': ' . PMA_DBI_get_proto_info(),
99 'li_mysql_proto');
100 PMA_printListItem($strServer . ': ' . $server_info, 'li_server_info');
101 PMA_printListItem($strUser . ': ' . htmlspecialchars($mysql_cur_user_and_host),
102 'li_user_info');
103 } else {
104 PMA_printListItem($strServerVersion . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_info');
105 PMA_printListItem($strServer . ': ' . $server_info, 'li_server_info');
108 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
109 echo '<li id="li_select_mysql_charset">';
111 <form method="post" action="index.php" target="_parent">
112 <input type="hidden" name="server" value="<?php echo $server; ?>" />
113 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
114 <?php echo $strMySQLCharset;?>:
115 <select name="convcharset" xml:lang="en" dir="ltr"
116 onchange="this.form.submit();">
117 <?php
118 foreach ($cfg['AvailableCharsets'] as $tmpcharset) {
119 if ($convcharset == $tmpcharset) {
120 $selected = ' selected="selected"';
121 } else {
122 $selected = '';
124 echo ' '
125 . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
128 </select>
129 <noscript><input type="submit" value="<?php echo $strGo;?>" /></noscript>
130 </form>
131 </li>
132 <?php
133 } elseif (PMA_MYSQL_INT_VERSION >= 40100) {
134 echo ' <li id="li_select_mysql_charset">';
135 echo ' ' . $strMySQLCharset . ': '
136 . ' <strong xml:lang="en" dir="ltr">'
137 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
138 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
139 . ' </strong>' . "\n"
140 . ' </li>' . "\n"
141 . ' <li id="li_select_mysql_collation">';
142 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
143 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
144 . ' <label for="select_collation_connection">' . "\n"
145 . ' ' . $strMySQLConnectionCollation . ': ' . "\n"
146 . ' </label>' . "\n"
147 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
148 . ' <noscript><input type="submit" value="' . $strGo . '" /></noscript>' . "\n"
149 // put the doc link in the form so that it appears on the same line
150 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . "\n"
151 . ' </form>' . "\n"
152 . ' </li>' . "\n";
155 if ($cfg['ShowCreateDb']) {
156 echo '<li id="li_create_database">';
157 require './libraries/display_create_database.lib.php';
158 echo '</li>' . "\n";
161 PMA_printListItem($strMySQLShowStatus, 'li_mysql_status',
162 './server_status.php?' . $common_url_query);
163 PMA_printListItem($strMySQLShowVars, 'li_mysql_variables',
164 './server_variables.php?' . $common_url_query, 'show-variables');
165 PMA_printListItem($strProcesses, 'li_mysql_processes',
166 './server_processlist.php?' . $common_url_query, 'show-processlist');
168 if (PMA_MYSQL_INT_VERSION >= 40100) {
169 PMA_printListItem($strCharsetsAndCollations, 'li_mysql_collations',
170 './server_collations.php?' . $common_url_query);
173 PMA_printListItem($strStorageEngines, 'li_mysql_engines',
174 './server_engines.php?' . $common_url_query);
176 if ($is_reload_priv) {
177 PMA_printListItem($strReloadPrivileges, 'li_flush_privileges',
178 './server_privileges.php?flush_privileges=1&amp;' . $common_url_query, 'flush');
181 if ($is_superuser) {
182 PMA_printListItem($strPrivileges, 'li_mysql_privilegs',
183 './server_privileges.php?' . $common_url_query);
186 $binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', null, PMA_DBI_QUERY_STORE);
187 if ($binlogs) {
188 if (PMA_DBI_num_rows($binlogs) > 0) {
189 PMA_printListItem($strBinaryLog, 'li_mysql_binlogs',
190 './server_binlog.php?' . $common_url_query);
192 PMA_DBI_free_result($binlogs);
194 unset($binlogs);
196 PMA_printListItem($strDatabases, 'li_mysql_databases',
197 './server_databases.php?' . $common_url_query);
198 PMA_printListItem($strExport, 'li_export',
199 './server_export.php?' . $common_url_query);
200 PMA_printListItem($strImport, 'li_import',
201 './server_import.php?' . $common_url_query);
204 * Change password
206 * @todo ? needs another message
208 if ($cfg['ShowChgPassword']) {
209 PMA_printListItem($strChangePassword, 'li_change_password',
210 './user_password.php?' . $common_url_query);
211 } // end if
213 // Logout for advanced authentication
214 if ($cfg['Server']['auth_type'] != 'config') {
215 $http_logout = ($cfg['Server']['auth_type'] == 'http')
216 ? '<a href="./Documentation.html#login_bug" target="documentation">'
217 . ($cfg['ReplaceHelpImg'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_info.png" width="11" height="11" alt="Info" />' : '(*)') . '</a>'
218 : '';
219 PMA_printListItem('<strong>' . $strLogout . '</strong> ' . $http_logout,
220 'li_log_out',
221 './index.php?' . $common_url_query . '&amp;old_usr=' . urlencode($PHP_AUTH_USER), null, '_parent');
222 } // end if
224 echo '</ul>';
225 } // end of if ($server > 0)
227 </div>
228 <div id="pmamaininformation">
229 <?php
231 echo '<h1 xml:lang="en" dir="ltr">phpMyAdmin - ' . PMA_VERSION . '</h1>'
232 . "\n";
234 echo '<ul>' . "\n";
237 * Displays the MySQL servers choice form
239 if (!$cfg['LeftDisplayServers'] && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)) {
240 echo '<li id="li_select_server">';
241 require_once './libraries/select_server.lib.php';
242 PMA_select_server(true, true);
243 echo '</li>';
246 if ($server > 0) {
247 PMA_printListItem($strMysqlClientVersion . ': ' . PMA_DBI_get_client_info(),
248 'li_mysql_client_version');
249 PMA_printListItem($strUsedPhpExtensions . ': ' . $GLOBALS['cfg']['Server']['extension'],
250 'li_used_php_extension');
253 // Displays language selection combo
254 if (empty($cfg['Lang'])) {
255 echo '<li id="li_select_lang">';
256 require_once './libraries/display_select_lang.lib.php';
257 PMA_select_language();
258 echo '</li>';
262 if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding']
263 && $server != 0 && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
264 echo '<li id="li_select_charset">';
266 <form method="post" action="index.php" target="_parent">
267 <input type="hidden" name="server" value="<?php echo $server; ?>" />
268 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
269 <?php echo $strMySQLCharset;?>:
270 <select name="convcharset" xml:lang="en" dir="ltr"
271 onchange="this.form.submit();">
272 <?php
273 foreach ($cfg['AvailableCharsets'] AS $id => $tmpcharset) {
274 if ($convcharset == $tmpcharset) {
275 $selected = ' selected="selected"';
276 } else {
277 $selected = '';
279 echo ' '
280 . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
283 </select>
284 <noscript><input type="submit" value="<?php echo $strGo;?>" /></noscript>
285 </form>
286 </li>
287 <?php
290 // added by Michael Keck <mail_at_michaelkeck_dot_de>
291 // ThemeManager if available
293 if ($GLOBALS['cfg']['ThemeManager']) {
294 echo '<li id="li_select_theme">';
295 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
296 echo '</li>';
298 echo '<li id="li_select_fontsize">';
299 echo PMA_Config::getFontsizeForm();
300 echo '</li>';
301 PMA_printListItem($strPmaDocumentation, 'li_pma_docs', 'Documentation.html');
302 PMA_printListItem($strPmaWiki, 'li_pma_docs', 'http://wiki.cihar.com');
304 if ($cfg['ShowPhpInfo']) {
305 PMA_printListItem($strShowPHPInfo, 'li_phpinfo', './phpinfo.php?' . $common_url_query);
308 // does not work if no target specified, don't know why
309 PMA_printListItem($strHomepageOfficial, 'li_pma_homepage', 'http://www.phpMyAdmin.net/', null, '_blank');
311 <li><bdo xml:lang="en" dir="ltr">
312 [<a href="changelog.php" target="_blank">ChangeLog</a>]
313 [<a href="http://svn.sourceforge.net/viewvc/phpmyadmin/"
314 target="_blank">Subversion</a>]
315 [<a href="http://sourceforge.net/mail/?group_id=23067"
316 target="_blank">Lists</a>]
317 </bdo>
318 </li>
319 </ul>
320 </div>
321 <?php
323 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
324 * full height of the inner divs
327 <br class="clearfloat" />
328 <br class="clearfloat" />
329 </div>
331 <?php
332 if (! empty($GLOBALS['PMA_errors']) && is_array($GLOBALS['PMA_errors'])) {
333 foreach ($GLOBALS['PMA_errors'] as $error) {
334 echo '<div class="error">' . $error . '</div>' . "\n";
339 * Removed the "empty $cfg['PmaAbsoluteUri']" warning on 2005-08-23
340 * See https://sourceforge.net/tracker/index.php?func=detail&aid=1257134&group_id=23067&atid=377411
344 * Warning if using the default MySQL privileged account
345 * modified: 2004-05-05 mkkeck
347 if ($server != 0
348 && $cfg['Server']['user'] == 'root'
349 && $cfg['Server']['password'] == '') {
350 echo '<div class="warning">' . $strInsecureMySQL . '</div>' . "\n";
354 * Warning for PHP 4.2.3
355 * modified: 2004-05-05 mkkeck
358 if (PMA_PHP_INT_VERSION == 40203 && @extension_loaded('mbstring')) {
359 echo '<div class="warning">' . $strPHP40203 . '</div>' . "\n";
363 * Nijel: As we try to hadle charsets by ourself, mbstring overloads just
364 * break it, see bug 1063821.
367 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
368 echo '<div class="warning">' . $strMbOverloadWarning . '</div>' . "\n";
372 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
373 * to tell user something might be broken without it, see bug #1063149.
375 if ($GLOBALS['using_mb_charset'] && !@extension_loaded('mbstring')) {
376 echo '<div class="warning">' . $strMbExtensionMissing . '</div>' . "\n";
380 * Warning for old PHP version
381 * modified: 2004-05-05 mkkeck
384 if (PMA_PHP_INT_VERSION < 40100) {
385 echo '<div class="warning">' . sprintf($strUpgrade, 'PHP', '4.1.0') . '</div>' . "\n";
389 * Warning for old MySQL version
390 * modified: 2004-05-05 mkkeck
392 // not yet defined before the server choice
393 if (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION < 32332) {
394 echo '<div class="warning">' . sprintf($strUpgrade, 'MySQL', '3.23.32') . '</div>' . "\n";
398 * prints list item for main page
400 * @param string $name displayed text
401 * @param string $id id, used for css styles
402 * @param string $url make item as link with $url as target
403 * @param string $mysql_help_page display a link to MySQL's manual
404 * @param string $target special target for $url
406 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null)
408 echo '<li id="' . $id . '">';
409 if (null !== $url) {
410 echo '<a href="' . $url . '"';
411 if (null !== $target) {
412 echo ' target="' . $target . '"';
414 echo '>';
417 echo $name;
419 if (null !== $url) {
420 echo '</a>' . "\n";
422 if (null !== $mysql_help_page) {
423 echo PMA_showMySQLDocu('', $mysql_help_page);
425 echo '</li>';
429 * Displays the footer
431 require_once './libraries/footer.inc.php';