Translation update done using Pootle.
[phpmyadmin/madhuracj.git] / main.php
blobe9184820854f7ab723766e614d9b1befad75a32f
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package PhpMyAdmin
6 */
8 /**
9 * Gets some core libraries and displays a top message if required
11 require_once './libraries/common.inc.php';
13 $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.16.custom.js';
14 $GLOBALS['js_include'][] = 'jquery/jquery.sprintf.js';
16 // Handles some variables that may have been sent by the calling script
17 $GLOBALS['db'] = '';
18 $GLOBALS['table'] = '';
19 $show_query = '1';
20 require_once './libraries/header.inc.php';
22 // Any message to display?
23 if (! empty($message)) {
24 PMA_showMessage($message);
25 unset($message);
28 $common_url_query = PMA_generate_common_url('', '');
30 // when $server > 0, a server has been chosen so we can display
31 // all MySQL-related information
32 if ($server > 0) {
33 include './libraries/server_common.inc.php';
34 include './libraries/StorageEngine.class.php';
35 include './libraries/server_links.inc.php';
37 // Use the verbose name of the server instead of the hostname
38 // if a value is set
39 $server_info = '';
40 if (! empty($cfg['Server']['verbose'])) {
41 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
42 if ($GLOBALS['cfg']['ShowServerInfo']) {
43 $server_info .= ' (';
46 if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
47 $server_info .= PMA_DBI_get_host_info();
49 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
50 $server_info .= ')';
52 $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
54 // should we add the port info here?
55 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
56 ? $GLOBALS['cfg']['Server']['verbose']
57 : $GLOBALS['cfg']['Server']['host']);
60 echo '<div id="maincontainer">' . "\n";
61 echo '<div id="main_pane_left">';
62 if ($server > 0
63 || (! $cfg['LeftDisplayServers'] && count($cfg['Servers']) > 1)) {
64 echo '<div class="group">';
65 echo '<h2>' . __('General Settings') . '</h2>';
66 echo '<ul>';
68 /**
69 * Displays the MySQL servers choice form
71 if (! $cfg['LeftDisplayServers']
72 && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)) {
73 echo '<li id="li_select_server">';
74 include_once './libraries/select_server.lib.php';
75 PMA_select_server(true, true);
76 echo '</li>';
79 /**
80 * Displays the mysql server related links
82 if ($server > 0 && !PMA_DRIZZLE) {
83 include_once './libraries/check_user_privileges.lib.php';
85 // Logout for advanced authentication
86 if ($cfg['Server']['auth_type'] != 'config') {
87 if ($cfg['ShowChgPassword']) {
88 if ($GLOBALS['cfg']['AjaxEnable']) {
89 $conditional_class = 'ajax';
90 } else {
91 $conditional_class = null;
93 PMA_printListItem(
94 __('Change password'),
95 'li_change_password',
96 './user_password.php?' . $common_url_query,
97 null,
98 null,
99 'change_password_anchor',
100 null,
101 $conditional_class
104 } // end if
105 echo ' <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 . ' ' . __('Server connection collation') . "\n"
110 // put the doc link in the form so that it appears on the same line
111 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . ': ' . "\n"
112 . ' </label>' . "\n"
114 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
115 . ' <noscript><input type="submit" value="' . __('Go') . '" /></noscript>' . "\n"
116 . ' </form>' . "\n"
117 . ' </li>' . "\n";
118 } // end of if ($server > 0 && !PMA_DRIZZLE)
119 echo '</ul>';
120 echo '</div>';
123 echo '<div class="group">';
124 echo '<h2>' . __('Appearance Settings') . '</h2>';
125 echo ' <ul>';
127 // Displays language selection combo
128 if (empty($cfg['Lang'])) {
129 echo '<li id="li_select_lang">';
130 include_once './libraries/display_select_lang.lib.php';
131 PMA_select_language();
132 echo '</li>';
135 // ThemeManager if available
137 if ($GLOBALS['cfg']['ThemeManager']) {
138 echo '<li id="li_select_theme">';
139 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
140 echo '</li>';
142 echo '<li id="li_select_fontsize">';
143 echo PMA_Config::getFontsizeForm();
144 echo '</li>';
146 echo '</ul>';
148 // User preferences
150 if ($server > 0) {
151 echo '<ul>';
152 echo PMA_printListItem(
153 __('More settings'),
154 'li_user_preferences',
155 './prefs_manage.php?' . $common_url_query
157 echo '</ul>';
160 echo '</div>';
163 echo '</div>';
164 echo '<div id="main_pane_right">';
167 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
168 echo '<div class="group">';
169 echo '<h2>' . __('Database server') . '</h2>';
170 echo '<ul>' . "\n";
171 PMA_printListItem(__('Server') . ': ' . $server_info, 'li_server_info');
172 PMA_printListItem(__('Software') . ': ' . PMA_getServerType(), 'li_server_type');
173 PMA_printListItem(__('Software version') . ': ' . PMA_MYSQL_STR_VERSION . ' - ' . PMA_MYSQL_VERSION_COMMENT, 'li_server_version');
174 PMA_printListItem(
175 __('Protocol version') . ': ' . PMA_DBI_get_proto_info(),
176 'li_mysql_proto'
178 PMA_printListItem(
179 __('User') . ': ' . htmlspecialchars($mysql_cur_user_and_host),
180 'li_user_info'
183 echo ' <li id="li_select_mysql_charset">';
184 echo ' ' . __('Server charset') . ': '
185 . ' <span xml:lang="en" dir="ltr">'
186 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']] . "\n"
187 . ' (' . $mysql_charset_map['utf-8'] . ')' . "\n"
188 . ' </span>' . "\n"
189 . ' </li>' . "\n";
190 echo ' </ul>';
191 echo ' </div>';
194 if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
195 echo '<div class="group">';
196 echo '<h2>' . __('Web server') . '</h2>';
197 echo '<ul>';
198 if ($GLOBALS['cfg']['ShowServerInfo']) {
199 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
201 if ($server > 0) {
202 $client_version_str = PMA_DBI_get_client_info();
203 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)
204 && in_array($GLOBALS['cfg']['Server']['extension'], array('mysql', 'mysqli'))
206 $client_version_str = 'libmysql - ' . $client_version_str;
208 PMA_printListItem(
209 __('Database client version') . ': ' . $client_version_str,
210 'li_mysql_client_version'
212 PMA_printListItem(
213 __('PHP extension') . ': ' . $GLOBALS['cfg']['Server']['extension']. ' '
214 . PMA_showPHPDocu('book.' . $GLOBALS['cfg']['Server']['extension'] . '.php'),
215 'li_used_php_extension'
220 if ($cfg['ShowPhpInfo']) {
221 PMA_printListItem(__('Show PHP information'), 'li_phpinfo', './phpinfo.php?' . $common_url_query);
223 echo ' </ul>';
224 echo ' </div>';
227 echo '<div class="group pmagroup">';
228 echo '<h2>phpMyAdmin</h2>';
229 echo '<ul>';
230 $class = null;
231 // workaround for bug 3302733; some browsers don't like the situation
232 // where phpMyAdmin is called on a secure page but a part of the page
233 // (the version check) refers to a non-secure page
234 if ($GLOBALS['cfg']['VersionCheck'] && ! $GLOBALS['PMA_Config']->get('is_https')) {
235 $class = 'jsversioncheck';
237 PMA_printListItem(__('Version information') . ': ' . PMA_VERSION, 'li_pma_version', null, null, null, null, $class);
238 PMA_printListItem(__('Documentation'), 'li_pma_docs', 'Documentation.html', null, '_blank');
239 PMA_printListItem(__('Wiki'), 'li_pma_wiki', PMA_linkURL('http://wiki.phpmyadmin.net/'), null, '_blank');
241 // does not work if no target specified, don't know why
242 PMA_printListItem(__('Official Homepage'), 'li_pma_homepage', PMA_linkURL('http://www.phpMyAdmin.net/'), null, '_blank');
243 PMA_printListItem(__('Contribute'), 'li_pma_contribute', PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'), null, '_blank');
244 PMA_printListItem(__('Get support'), 'li_pma_support', PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'), null, '_blank');
245 PMA_printListItem(__('List of changes'), 'li_pma_changes', PMA_linkURL('changelog.php'), null, '_blank');
247 </ul>
248 </div>
250 </div>
252 <?php
254 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
255 * full height of the inner divs
258 <br class="clearfloat" />
259 <br class="clearfloat" />
260 </div>
262 <?php
264 * Warning if using the default MySQL privileged account
266 if ($server != 0
267 && $cfg['Server']['user'] == 'root'
268 && $cfg['Server']['password'] == '') {
269 trigger_error(__('Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user \'root\'.'), 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(__('You have enabled mbstring.func_overload in your PHP configuration. This option is incompatible with phpMyAdmin and might cause some data to be corrupted!'), 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 (! @extension_loaded('mbstring')) {
285 trigger_error(__('The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results.'), E_USER_WARNING);
289 * Check whether session.gc_maxlifetime limits session validity.
291 $gc_time = (int)@ini_get('session.gc_maxlifetime');
292 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
293 trigger_error(PMA_Message::decodeBB(__('Your PHP parameter [a@http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime@]session.gc_maxlifetime[/a] is lower that cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.')), E_USER_WARNING);
297 * Check whether LoginCookieValidity is limited by LoginCookieStore.
299 if ($GLOBALS['cfg']['LoginCookieStore'] != 0 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']) {
300 trigger_error(PMA_Message::decodeBB(__('Login cookie store is lower than cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.')), E_USER_WARNING);
304 * Check if user does not have defined blowfish secret and it is being used.
306 if (!empty($_SESSION['auto_blowfish_secret']) &&
307 empty($GLOBALS['cfg']['blowfish_secret'])) {
308 trigger_error(__('The configuration file now needs a secret passphrase (blowfish_secret).'), E_USER_WARNING);
312 * Check for existence of config directory which should not exist in
313 * production environment.
315 if (file_exists('./config')) {
316 trigger_error(__('Directory [code]config[/code], which is used by the setup script, still exists in your phpMyAdmin directory. You should remove it once phpMyAdmin has been configured.'), E_USER_WARNING);
319 if ($server > 0) {
320 $cfgRelation = PMA_getRelationsParam();
321 if (! $cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false) {
322 $message = PMA_Message::notice(__('The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. To find out why click %shere%s.'));
323 $message->addParam('<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $common_url_query . '">', false);
324 $message->addParam('</a>', false);
325 /* Show error if user has configured something, notice elsewhere */
326 if (!empty($cfg['Servers'][$server]['pmadb'])) {
327 $message->isError(true);
329 $message->display();
330 } // end if
334 * Show notice when javascript support is missing.
336 echo '<noscript>';
337 $message = PMA_Message::notice(__('Javascript support is missing or disabled in your browser, some phpMyAdmin functionality will be missing. For example navigation frame will not refresh automatically.'));
338 $message->isError(true);
339 $message->display();
340 echo '</noscript>';
343 * Warning about different MySQL library and server version
344 * (a difference on the third digit does not count).
345 * If someday there is a constant that we can check about mysqlnd, we can use it instead
346 * of strpos().
347 * If no default server is set, PMA_DBI_get_client_info() is not defined yet.
348 * Drizzle can speak MySQL protocol, so don't warn about version mismatch for Drizzle servers.
350 if (function_exists('PMA_DBI_get_client_info') && !PMA_DRIZZLE) {
351 $_client_info = PMA_DBI_get_client_info();
352 if ($server > 0 && strpos($_client_info, 'mysqlnd') === false && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)) {
353 trigger_error(
354 PMA_sanitize(
355 sprintf(
356 __('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
357 $_client_info,
358 substr(
359 PMA_MYSQL_STR_VERSION,
361 strpos(PMA_MYSQL_STR_VERSION . '-', '-')
365 E_USER_NOTICE
368 unset($_client_info);
372 * Warning about Suhosin
374 if ($cfg['SuhosinDisableWarning'] == false
375 && @ini_get('suhosin.request.max_value_length')
377 trigger_error(
378 PMA_sanitize(
379 sprintf(
380 __('Server running with Suhosin. Please refer to %sdocumentation%s for possible issues.'),
381 '[a@./Documentation.html#faq1_38@_blank]',
382 '[/a]'
385 E_USER_WARNING
390 * Warning about mcrypt.
392 if (!function_exists('mcrypt_encrypt') && !$GLOBALS['cfg']['McryptDisableWarning']) {
393 PMA_warnMissingExtension('mcrypt');
397 * Warning about incomplete translations.
399 * The data file is created while creating release by ./scripts/remove-incomplete-mo
401 if (file_exists('./libraries/language_stats.inc.php')) {
402 include './libraries/language_stats.inc.php';
404 * This message is intentionally not translated, because we're
405 * handling incomplete translations here and focus on english
406 * speaking users.
408 if (isset($GLOBALS['language_stats'][$lang]) && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']) {
409 trigger_error('You are using an incomplete translation, please help to make it better by <a href="http://www.phpmyadmin.net/home_page/improve.php#translate" target="_blank">contributing</a>.', E_USER_NOTICE);
414 * prints list item for main page
416 * @param string $name displayed text
417 * @param string $id id, used for css styles
418 * @param string $url make item as link with $url as target
419 * @param string $mysql_help_page display a link to MySQL's manual
420 * @param string $target special target for $url
421 * @param string $a_id id for the anchor, used for jQuery to hook in functions
422 * @param string $class class for the li element
423 * @param string $a_class class for the anchor element
425 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null, $a_id = null, $class = null, $a_class = null)
427 echo '<li id="' . $id . '"';
428 if (null !== $class) {
429 echo ' class="' . $class . '"';
431 echo '>';
432 if (null !== $url) {
433 echo '<a href="' . $url . '"';
434 if (null !== $target) {
435 echo ' target="' . $target . '"';
437 if (null != $a_id) {
438 echo ' id="' . $a_id .'"';
440 if (null != $a_class) {
441 echo ' class="' . $a_class .'"';
443 echo '>';
446 echo $name;
448 if (null !== $url) {
449 echo '</a>' . "\n";
451 if (null !== $mysql_help_page) {
452 echo PMA_showMySQLDocu('', $mysql_help_page);
454 echo '</li>';
458 * Displays the footer
460 require './libraries/footer.inc.php';