2.11.11.3 release
[phpmyadmin/arisferyanto.git] / main.php
blobc53ff8196d91d189434ecd46ae5c83e3b466a2b5
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 */
8 /**
9 * Don't display the page heading
11 if (!defined('PMA_DISPLAY_HEADING')) {
12 define('PMA_DISPLAY_HEADING', 0);
15 /**
16 * Gets some core libraries and displays a top message if required
18 require_once './libraries/common.inc.php';
20 // Handles some variables that may have been sent by the calling script
21 $GLOBALS['db'] = '';
22 $GLOBALS['table'] = '';
23 $show_query = '1';
24 require_once './libraries/header.inc.php';
26 // Any message to display?
27 if (! empty($message)) {
28 PMA_showMessage($message);
29 unset($message);
32 $common_url_query = PMA_generate_common_url('', '');
34 // this div is required for containing divs can be 50%
35 echo '<div id="maincontainer">' . "\n";
37 /**
38 * Displays the mysql server related links
40 if ($server > 0) {
42 require_once './libraries/check_user_privileges.lib.php';
43 // why this? a non-priv user should be able to change his
44 // password if the configuration permits
45 //$cfg['ShowChgPassword'] = $is_superuser = PMA_isSuperuser();
46 $is_superuser = PMA_isSuperuser();
48 if ($cfg['Server']['auth_type'] == 'config') {
49 $cfg['ShowChgPassword'] = false;
54 <div id="mysqlmaininformation">
55 <?php
56 if ($server > 0) {
57 // robbat2: Use the verbose name of the server instead of the hostname
58 // if a value is set
59 $server_info = '';
60 if (!empty($cfg['Server']['verbose'])) {
61 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
62 if ($GLOBALS['cfg']['ShowServerInfo']) {
63 $server_info .= ' (';
66 if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
67 $server_info .= PMA_DBI_get_host_info();
70 if (!empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
71 $server_info .= ')';
73 // loic1: skip this because it's not a so good idea to display sockets
74 // used to everybody
75 // if (!empty($cfg['Server']['socket']) && PMA_PHP_INT_VERSION >= 30010) {
76 // $server_info .= ':' . $cfg['Server']['socket'];
77 // }
78 $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
81 // should we add the port info here?
82 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
83 ? $GLOBALS['cfg']['Server']['verbose']
84 : $GLOBALS['cfg']['Server']['host']);
85 echo '<h1 xml:lang="en" dir="ltr">' . $short_server_info .'</h1>' . "\n";
86 unset($short_server_info);
87 } else {
88 // Case when no server selected
89 //echo '<h1 xml:lang="en" dir="ltr">MySQL</h1>' . "\n";
92 if ($server > 0) {
93 echo '<ul>' . "\n";
95 if ($GLOBALS['cfg']['ShowServerInfo']) {
96 PMA_printListItem($strServerVersion . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_info');
97 PMA_printListItem($strProtocolVersion . ': ' . PMA_DBI_get_proto_info(),
98 'li_mysql_proto');
99 /**
100 * @todo tweak the CSS to use same image as li_server_info
102 PMA_printListItem($strServer . ': ' . $server_info, 'li_server_info2');
103 PMA_printListItem($strUser . ': ' . htmlspecialchars($mysql_cur_user_and_host),
104 'li_user_info');
105 } else {
106 PMA_printListItem($strServerVersion . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_info');
107 PMA_printListItem($strServer . ': ' . $server_info, 'li_server_info2');
110 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
111 echo '<li id="li_select_mysql_charset">';
113 <form method="post" action="index.php" target="_parent">
114 <input type="hidden" name="server" value="<?php echo $server; ?>" />
115 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
116 <?php echo $strMySQLCharset;?>:
117 <select name="convcharset" xml:lang="en" dir="ltr"
118 onchange="this.form.submit();">
119 <?php
120 foreach ($cfg['AvailableCharsets'] as $tmpcharset) {
121 if ($convcharset == $tmpcharset) {
122 $selected = ' selected="selected"';
123 } else {
124 $selected = '';
126 echo ' '
127 . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
130 </select>
131 <noscript><input type="submit" value="<?php echo $strGo;?>" /></noscript>
132 </form>
133 </li>
134 <?php
135 } elseif (PMA_MYSQL_INT_VERSION >= 40100) {
136 echo ' <li id="li_select_mysql_charset">';
137 echo ' ' . $strMySQLCharset . ': '
138 . ' <strong xml:lang="en" dir="ltr">'
139 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
140 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
141 . ' </strong>' . "\n"
142 . ' </li>' . "\n"
143 . ' <li id="li_select_mysql_collation">';
144 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
145 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
146 . ' <label for="select_collation_connection">' . "\n"
147 . ' ' . $strMySQLConnectionCollation . ': ' . "\n"
148 . ' </label>' . "\n"
149 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
150 . ' <noscript><input type="submit" value="' . $strGo . '" /></noscript>' . "\n"
151 // put the doc link in the form so that it appears on the same line
152 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . "\n"
153 . ' </form>' . "\n"
154 . ' </li>' . "\n";
157 if ($cfg['ShowCreateDb']) {
158 echo '<li id="li_create_database">';
159 require './libraries/display_create_database.lib.php';
160 echo '</li>' . "\n";
163 PMA_printListItem($strMySQLShowStatus, 'li_mysql_status',
164 './server_status.php?' . $common_url_query);
165 PMA_printListItem($strMySQLShowVars, 'li_mysql_variables',
166 './server_variables.php?' . $common_url_query, 'show-variables');
167 PMA_printListItem($strProcesses, 'li_mysql_processes',
168 './server_processlist.php?' . $common_url_query, 'show-processlist');
170 if (PMA_MYSQL_INT_VERSION >= 40100) {
171 PMA_printListItem($strCharsetsAndCollations, 'li_mysql_collations',
172 './server_collations.php?' . $common_url_query);
175 PMA_printListItem($strStorageEngines, 'li_mysql_engines',
176 './server_engines.php?' . $common_url_query);
178 if ($is_reload_priv) {
179 PMA_printListItem($strReloadPrivileges, 'li_flush_privileges',
180 './server_privileges.php?flush_privileges=1&amp;' . $common_url_query, 'flush');
183 if ($is_superuser) {
184 PMA_printListItem($strPrivileges, 'li_mysql_privilegs',
185 './server_privileges.php?' . $common_url_query);
188 $binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', null, PMA_DBI_QUERY_STORE);
189 if ($binlogs) {
190 if (PMA_DBI_num_rows($binlogs) > 0) {
191 PMA_printListItem($strBinaryLog, 'li_mysql_binlogs',
192 './server_binlog.php?' . $common_url_query);
194 PMA_DBI_free_result($binlogs);
196 unset($binlogs);
198 PMA_printListItem($strDatabases, 'li_mysql_databases',
199 './server_databases.php?' . $common_url_query);
200 PMA_printListItem($strExport, 'li_export',
201 './server_export.php?' . $common_url_query);
202 PMA_printListItem($strImport, 'li_import',
203 './server_import.php?' . $common_url_query);
206 * Change password
208 * @todo ? needs another message
210 if ($cfg['ShowChgPassword']) {
211 PMA_printListItem($strChangePassword, 'li_change_password',
212 './user_password.php?' . $common_url_query);
213 } // end if
215 // Logout for advanced authentication
216 if ($cfg['Server']['auth_type'] != 'config') {
217 $http_logout = ($cfg['Server']['auth_type'] == 'http')
218 ? '<a href="./Documentation.html#login_bug" target="documentation">'
219 . ($cfg['ReplaceHelpImg'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_info.png" width="11" height="11" alt="Info" />' : '(*)') . '</a>'
220 : '';
221 PMA_printListItem('<strong>' . $strLogout . '</strong> ' . $http_logout,
222 'li_log_out',
223 './index.php?' . $common_url_query . '&amp;old_usr=' . urlencode($PHP_AUTH_USER), null, '_parent');
224 } // end if
226 echo '</ul>';
227 } // end of if ($server > 0)
229 </div>
230 <div id="pmamaininformation">
231 <?php
233 echo '<h1 xml:lang="en" dir="ltr">phpMyAdmin - ' . PMA_VERSION . '</h1>'
234 . "\n";
236 echo '<ul>' . "\n";
239 * Displays the MySQL servers choice form
241 if (!$cfg['LeftDisplayServers'] && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)) {
242 echo '<li id="li_select_server">';
243 require_once './libraries/select_server.lib.php';
244 PMA_select_server(true, true);
245 echo '</li>';
248 if ($server > 0) {
249 PMA_printListItem($strMysqlClientVersion . ': ' . PMA_DBI_get_client_info(),
250 'li_mysql_client_version');
251 PMA_printListItem($strUsedPhpExtensions . ': ' . $GLOBALS['cfg']['Server']['extension'],
252 'li_used_php_extension');
255 // Displays language selection combo
256 if (empty($cfg['Lang'])) {
257 echo '<li id="li_select_lang">';
258 require_once './libraries/display_select_lang.lib.php';
259 PMA_select_language();
260 echo '</li>';
264 if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding']
265 && $server != 0 && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
266 echo '<li id="li_select_charset">';
268 <form method="post" action="index.php" target="_parent">
269 <input type="hidden" name="server" value="<?php echo $server; ?>" />
270 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
271 <?php echo $strMySQLCharset;?>:
272 <select name="convcharset" xml:lang="en" dir="ltr"
273 onchange="this.form.submit();">
274 <?php
275 foreach ($cfg['AvailableCharsets'] AS $id => $tmpcharset) {
276 if ($convcharset == $tmpcharset) {
277 $selected = ' selected="selected"';
278 } else {
279 $selected = '';
281 echo ' '
282 . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
285 </select>
286 <noscript><input type="submit" value="<?php echo $strGo;?>" /></noscript>
287 </form>
288 </li>
289 <?php
292 // added by Michael Keck <mail_at_michaelkeck_dot_de>
293 // ThemeManager if available
295 if ($GLOBALS['cfg']['ThemeManager']) {
296 echo '<li id="li_select_theme">';
297 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
298 echo '</li>';
300 echo '<li id="li_select_fontsize">';
301 echo PMA_Config::getFontsizeForm();
302 echo '</li>';
303 PMA_printListItem($strPmaDocumentation, 'li_pma_docs', 'Documentation.html', null, '_blank');
304 PMA_printListItem($strPmaWiki, 'li_pma_docs2', 'http://wiki.phpmyadmin.net', null, '_blank');
306 if ($cfg['ShowPhpInfo']) {
307 PMA_printListItem($strShowPHPInfo, 'li_phpinfo', './phpinfo.php?' . $common_url_query);
310 // does not work if no target specified, don't know why
311 PMA_printListItem($strHomepageOfficial, 'li_pma_homepage', 'http://www.phpMyAdmin.net/', null, '_blank');
313 <li><bdo xml:lang="en" dir="ltr">
314 [<a href="changelog.php" target="_blank">ChangeLog</a>]
315 [<a href="http://phpmyadmin.svn.sourceforge.net/viewvc/phpmyadmin/"
316 target="_blank">Subversion</a>]
317 [<a href="http://sourceforge.net/mail/?group_id=23067"
318 target="_blank">Lists</a>]
319 </bdo>
320 </li>
321 </ul>
322 </div>
323 <?php
325 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
326 * full height of the inner divs
329 <br class="clearfloat" />
330 <br class="clearfloat" />
331 </div>
333 <?php
334 if (! empty($GLOBALS['PMA_errors']) && is_array($GLOBALS['PMA_errors'])) {
335 foreach ($GLOBALS['PMA_errors'] as $error) {
336 echo '<div class="error">' . $error . '</div>' . "\n";
341 * Warning if using the default MySQL privileged account
342 * modified: 2004-05-05 mkkeck
344 if ($server != 0
345 && $cfg['Server']['user'] == 'root'
346 && $cfg['Server']['password'] == '') {
347 echo '<div class="warning">' . $strInsecureMySQL . '</div>' . "\n";
351 * Warning for PHP 4.2.3
352 * modified: 2004-05-05 mkkeck
354 if (PMA_PHP_INT_VERSION == 40203 && @extension_loaded('mbstring')) {
355 echo '<div class="warning">' . $strPHP40203 . '</div>' . "\n";
359 * Nijel: As we try to handle charsets by ourself, mbstring overloads just
360 * break it, see bug 1063821.
362 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
363 echo '<div class="warning">' . $strMbOverloadWarning . '</div>' . "\n";
367 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
368 * to tell user something might be broken without it, see bug #1063149.
370 if ($GLOBALS['using_mb_charset'] && !@extension_loaded('mbstring')) {
371 echo '<div class="warning">' . $strMbExtensionMissing . '</div>' . "\n";
375 * Warning for old PHP version
377 if (PMA_PHP_INT_VERSION < 40200) {
378 echo '<div class="warning">' . sprintf($strUpgrade, 'PHP', '4.2.0') . '</div>' . "\n";
382 * Warning for old MySQL version
383 * modified: 2004-05-05 mkkeck
385 // not yet defined before the server choice
386 if (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION < 32332) {
387 echo '<div class="warning">' . sprintf($strUpgrade, 'MySQL', '3.23.32') . '</div>' . "\n";
391 * Warning about different MySQL library and server version
392 * (a difference on the third digit does not count)
394 if ($server > 0 && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)) {
395 echo '<div class="notice">'
396 . PMA_sanitize(sprintf($strMysqlLibDiffersServerVersion,
397 PMA_DBI_get_client_info(),
398 substr(PMA_MYSQL_STR_VERSION, 0, strpos(PMA_MYSQL_STR_VERSION . '-', '-'))))
399 . '</div>' . "\n";
403 * Warning about wrong controluser settings
405 if (defined('PMA_DBI_CONNECT_FAILED_CONTROLUSER')) {
406 echo '<div class="warning">' . $strControluserFailed . '</div>' . "\n";
410 * Warning about missing mcrypt extension
412 if (defined('PMA_WARN_FOR_MCRYPT')) {
413 echo '<div class="warning">' . PMA_sanitize(sprintf($strCantLoad, 'mcrypt')) . '</div>' . "\n";
417 * Warning about Suhosin
419 if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_value_length')) {
420 echo '<div class="warning">' . PMA_sanitize(sprintf($strSuhosin, '[a@./Documentation.html#faq1_38@_blank]', '[/a]')) . '</div>' . "\n";
424 * prints list item for main page
426 * @param string $name displayed text
427 * @param string $id id, used for css styles
428 * @param string $url make item as link with $url as target
429 * @param string $mysql_help_page display a link to MySQL's manual
430 * @param string $target special target for $url
432 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null)
434 echo '<li id="' . $id . '">';
435 if (null !== $url) {
436 echo '<a href="' . $url . '"';
437 if (null !== $target) {
438 echo ' target="' . $target . '"';
440 echo '>';
443 echo $name;
445 if (null !== $url) {
446 echo '</a>' . "\n";
448 if (null !== $mysql_help_page) {
449 echo PMA_showMySQLDocu('', $mysql_help_page);
451 echo '</li>';
455 * Displays the footer
457 require_once './libraries/footer.inc.php';