Typo.
[phpmyadmin/last10db.git] / main.php
blobe0d5c883135052fbd781b231247bf9398e38aac4
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 $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
75 // should we add the port info here?
76 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
77 ? $GLOBALS['cfg']['Server']['verbose']
78 : $GLOBALS['cfg']['Server']['host']);
79 echo '<h1 xml:lang="en" dir="ltr">' . $short_server_info .'</h1>' . "\n";
80 unset($short_server_info);
83 if ($server > 0) {
84 echo '<ul>' . "\n";
86 if ($GLOBALS['cfg']['ShowServerInfo']) {
87 PMA_printListItem($strServerVersion . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_version');
88 PMA_printListItem($strProtocolVersion . ': ' . PMA_DBI_get_proto_info(),
89 'li_mysql_proto');
90 PMA_printListItem($strServer . ': ' . $server_info, 'li_server_info');
91 PMA_printListItem($strUser . ': ' . htmlspecialchars($mysql_cur_user_and_host),
92 'li_user_info');
93 } else {
94 PMA_printListItem($strServerVersion . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_version');
95 PMA_printListItem($strServer . ': ' . $server_info, 'li_server_info');
98 echo ' <li id="li_select_mysql_charset">';
99 echo ' ' . $strMySQLCharset . ': '
100 . ' <strong xml:lang="en" dir="ltr">'
101 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
102 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
103 . ' </strong>' . "\n"
104 . ' </li>' . "\n"
105 . ' <li id="li_select_mysql_collation">';
106 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
107 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
108 . ' <label for="select_collation_connection">' . "\n"
109 . ' ' . $strMySQLConnectionCollation . ': ' . "\n"
110 . ' </label>' . "\n"
111 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
112 . ' <noscript><input type="submit" value="' . $strGo . '" /></noscript>' . "\n"
113 // put the doc link in the form so that it appears on the same line
114 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . "\n"
115 . ' </form>' . "\n"
116 . ' </li>' . "\n";
118 if ($cfg['ShowCreateDb']) {
119 echo '<li id="li_create_database">';
120 require './libraries/display_create_database.lib.php';
121 echo '</li>' . "\n";
124 PMA_printListItem($strMySQLShowStatus, 'li_mysql_status',
125 './server_status.php?' . $common_url_query);
126 PMA_printListItem($strMySQLShowVars, 'li_mysql_variables',
127 './server_variables.php?' . $common_url_query, 'show-variables');
128 PMA_printListItem($strProcesses, 'li_mysql_processes',
129 './server_processlist.php?' . $common_url_query, 'show-processlist');
130 PMA_printListItem($strCharsetsAndCollations, 'li_mysql_collations',
131 './server_collations.php?' . $common_url_query);
132 PMA_printListItem($strStorageEngines, 'li_mysql_engines',
133 './server_engines.php?' . $common_url_query);
135 if ($is_reload_priv) {
136 PMA_printListItem($strReloadPrivileges, 'li_flush_privileges',
137 './server_privileges.php?flush_privileges=1&amp;' . $common_url_query, 'flush');
140 if ($is_superuser) {
141 PMA_printListItem($strPrivileges, 'li_mysql_privilegs',
142 './server_privileges.php?' . $common_url_query);
145 $binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', null, PMA_DBI_QUERY_STORE);
146 if ($binlogs) {
147 if (PMA_DBI_num_rows($binlogs) > 0) {
148 PMA_printListItem($strBinaryLog, 'li_mysql_binlogs',
149 './server_binlog.php?' . $common_url_query);
151 PMA_DBI_free_result($binlogs);
153 unset($binlogs);
155 PMA_printListItem($strDatabases, 'li_mysql_databases',
156 './server_databases.php?' . $common_url_query);
157 PMA_printListItem($strExport, 'li_export',
158 './server_export.php?' . $common_url_query);
159 PMA_printListItem($strImport, 'li_import',
160 './server_import.php?' . $common_url_query);
163 * Change password
165 * @todo ? needs another message
167 if ($cfg['ShowChgPassword']) {
168 PMA_printListItem($strChangePassword, 'li_change_password',
169 './user_password.php?' . $common_url_query);
170 } // end if
172 // Logout for advanced authentication
173 if ($cfg['Server']['auth_type'] != 'config') {
174 $http_logout = ($cfg['Server']['auth_type'] == 'http')
175 ? '<a href="./Documentation.html#login_bug" target="documentation">'
176 . ($cfg['ReplaceHelpImg'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_info.png" width="11" height="11" alt="Info" />' : '(*)') . '</a>'
177 : '';
178 PMA_printListItem('<strong>' . $strLogout . '</strong> ' . $http_logout,
179 'li_log_out',
180 './index.php?' . $common_url_query . '&amp;old_usr=' . urlencode($PHP_AUTH_USER), null, '_parent');
181 } // end if
183 echo '</ul>';
184 } // end of if ($server > 0)
186 </div>
187 <div id="pmamaininformation">
188 <?php
190 echo '<h1 xml:lang="en" dir="ltr">phpMyAdmin - ' . PMA_VERSION . '</h1>'
191 . "\n";
193 echo '<ul>' . "\n";
196 * Displays the MySQL servers choice form
198 if (!$cfg['LeftDisplayServers'] && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)) {
199 echo '<li id="li_select_server">';
200 require_once './libraries/select_server.lib.php';
201 PMA_select_server(true, true);
202 echo '</li>';
205 if ($server > 0) {
206 PMA_printListItem($strMysqlClientVersion . ': ' . PMA_DBI_get_client_info(),
207 'li_mysql_client_version');
208 PMA_printListItem($strUsedPhpExtensions . ': ' . $GLOBALS['cfg']['Server']['extension'],
209 'li_used_php_extension');
212 // Displays language selection combo
213 if (empty($cfg['Lang'])) {
214 echo '<li id="li_select_lang">';
215 require_once './libraries/display_select_lang.lib.php';
216 PMA_select_language();
217 echo '</li>';
220 // added by Michael Keck <mail_at_michaelkeck_dot_de>
221 // ThemeManager if available
223 if ($GLOBALS['cfg']['ThemeManager']) {
224 echo '<li id="li_select_theme">';
225 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
226 echo '</li>';
228 echo '<li id="li_select_fontsize">';
229 echo PMA_Config::getFontsizeForm();
230 echo '</li>';
231 PMA_printListItem($strPmaDocumentation, 'li_pma_docs', 'Documentation.html', null, '_blank');
232 PMA_printListItem($strPmaWiki, 'li_pma_wiki', 'http://wiki.cihar.com', null, '_blank');
234 if ($cfg['ShowPhpInfo']) {
235 PMA_printListItem($strShowPHPInfo, 'li_phpinfo', './phpinfo.php?' . $common_url_query);
238 // does not work if no target specified, don't know why
239 PMA_printListItem($strHomepageOfficial, 'li_pma_homepage', 'http://www.phpMyAdmin.net/', null, '_blank');
241 <li><bdo xml:lang="en" dir="ltr">
242 [<a href="changelog.php" target="_blank">ChangeLog</a>]
243 [<a href="http://phpmyadmin.svn.sourceforge.net/viewvc/phpmyadmin/"
244 target="_blank">Subversion</a>]
245 [<a href="http://sourceforge.net/mail/?group_id=23067"
246 target="_blank">Lists</a>]
247 </bdo>
248 </li>
249 </ul>
250 </div>
251 <?php
253 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
254 * full height of the inner divs
257 <br class="clearfloat" />
258 <br class="clearfloat" />
259 </div>
261 <?php
263 * Warning if using the default MySQL privileged account
264 * modified: 2004-05-05 mkkeck
266 if ($server != 0
267 && $cfg['Server']['user'] == 'root'
268 && $cfg['Server']['password'] == '') {
269 trigger_error($strInsecureMySQL, E_USER_WARNING);
273 * Nijel: As we try to handle charsets by ourself, mbstring overloads just
274 * break it, see bug 1063821.
276 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
277 trigger_error($strMbOverloadWarning, E_USER_WARNING);
281 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
282 * to tell user something might be broken without it, see bug #1063149.
284 if ($GLOBALS['using_mb_charset'] && !@extension_loaded('mbstring')) {
285 trigger_error($strMbExtensionMissing, E_USER_WARNING);
289 * Warning about different MySQL library and server version
290 * (a difference on the third digit does not count).
291 * If someday there is a constant that we can check about mysqlnd, we can use it instead
292 * of strpos().
294 $_client_info = PMA_DBI_get_client_info();
295 if ($server > 0 && strpos($_client_info, 'mysqlnd') === false && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)) {
296 trigger_error(PMA_sanitize(sprintf($strMysqlLibDiffersServerVersion,
297 $_client_info,
298 substr(PMA_MYSQL_STR_VERSION, 0, strpos(PMA_MYSQL_STR_VERSION . '-', '-')))),
299 E_USER_NOTICE);
301 unset($_client_info);
304 * prints list item for main page
306 * @param string $name displayed text
307 * @param string $id id, used for css styles
308 * @param string $url make item as link with $url as target
309 * @param string $mysql_help_page display a link to MySQL's manual
310 * @param string $target special target for $url
312 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null)
314 echo '<li id="' . $id . '">';
315 if (null !== $url) {
316 echo '<a href="' . $url . '"';
317 if (null !== $target) {
318 echo ' target="' . $target . '"';
320 echo '>';
323 echo $name;
325 if (null !== $url) {
326 echo '</a>' . "\n";
328 if (null !== $mysql_help_page) {
329 echo PMA_showMySQLDocu('', $mysql_help_page);
331 echo '</li>';
335 * Displays the footer
337 require_once './libraries/footer.inc.php';