Translation update done using Pootle.
[phpmyadmin/crack.git] / main.php
blobe678d884570be45265433d73127270700dc01f39
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 define('PMA_COLORPICKER', true);
12 require_once './libraries/common.inc.php';
14 $GLOBALS['js_include'][] = 'colorpicker/js/colorpicker.js';
15 //$GLOBALS['js_include'][] = 'main_custom_color.js';
16 $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
17 $GLOBALS['js_include'][] = 'jquery/jquery.sprintf.js';
19 // Handles some variables that may have been sent by the calling script
20 $GLOBALS['db'] = '';
21 $GLOBALS['table'] = '';
22 $show_query = '1';
23 require_once './libraries/header.inc.php';
25 // Any message to display?
26 if (! empty($message)) {
27 PMA_showMessage($message);
28 unset($message);
31 $common_url_query = PMA_generate_common_url('', '');
33 // when $server > 0, a server has been chosen so we can display
34 // all MySQL-related information
35 if ($server > 0) {
36 require './libraries/server_common.inc.php';
37 require './libraries/StorageEngine.class.php';
38 require './libraries/server_links.inc.php';
40 // Use the verbose name of the server instead of the hostname
41 // if a value is set
42 $server_info = '';
43 if (! empty($cfg['Server']['verbose'])) {
44 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
45 if ($GLOBALS['cfg']['ShowServerInfo']) {
46 $server_info .= ' (';
49 if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
50 $server_info .= PMA_DBI_get_host_info();
52 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
53 $server_info .= ')';
55 $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
57 // should we add the port info here?
58 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
59 ? $GLOBALS['cfg']['Server']['verbose']
60 : $GLOBALS['cfg']['Server']['host']);
63 echo '<div id="maincontainer">' . "\n";
64 echo '<div id="main_pane_left">';
65 if ($server > 0
66 || (! $cfg['LeftDisplayServers'] && count($cfg['Servers']) > 1)) {
67 echo '<div class="group">';
68 echo '<h2>' . __('General Settings') . '</h2>';
69 echo '<ul>';
71 /**
72 * Displays the MySQL servers choice form
74 if (! $cfg['LeftDisplayServers']
75 && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)) {
76 echo '<li id="li_select_server">';
77 require_once './libraries/select_server.lib.php';
78 PMA_select_server(true, true);
79 echo '</li>';
82 /**
83 * Displays the mysql server related links
85 if ($server > 0) {
86 require_once './libraries/check_user_privileges.lib.php';
88 if (!PMA_DRIZZLE) {
89 // Logout for advanced authentication
90 if ($cfg['Server']['auth_type'] != 'config') {
91 if ($cfg['ShowChgPassword']) {
92 if ($GLOBALS['cfg']['AjaxEnable']) {
93 $conditional_class = 'ajax';
94 } else {
95 $conditional_class = null;
97 PMA_printListItem(__('Change password'), 'li_change_password',
98 './user_password.php?' . $common_url_query, null, null, 'change_password_anchor', null, $conditional_class);
100 } // end if
102 echo ' <li id="li_select_mysql_collation">';
103 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
104 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
105 . ' <label for="select_collation_connection">' . "\n"
106 . ' ' . __('MySQL connection collation') . "\n"
107 // put the doc link in the form so that it appears on the same line
108 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . ': ' . "\n"
109 . ' </label>' . "\n"
111 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
112 . ' <noscript><input type="submit" value="' . __('Go') . '" /></noscript>' . "\n"
113 . ' </form>' . "\n"
114 . ' </li>' . "\n";
115 } // not Drizzle
116 } // end of if ($server > 0)
117 echo '</ul>';
118 echo '</div>';
121 echo '<div class="group">';
122 echo '<h2>' . __('Appearance Settings') . '</h2>';
123 echo ' <ul>';
125 // Displays language selection combo
126 if (empty($cfg['Lang'])) {
127 echo '<li id="li_select_lang">';
128 require_once './libraries/display_select_lang.lib.php';
129 PMA_select_language();
130 echo '</li>';
133 // ThemeManager if available
135 if ($GLOBALS['cfg']['ThemeManager']) {
136 echo '<li id="li_select_theme">';
137 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
138 echo '</li>';
140 // see js/main_custom_color.js
142 * deactivated for 3.4.0-rc1
143 echo '<li id="li_custom_color" class="hide">';
144 echo __('Background color') . ': ';
145 echo '<input type="submit" name="custom_color_choose" value="' . __('Choose...') . '" />';
146 echo '<form name="colorform" id="colorform" method="post" action="index.php" target="_parent">';
147 echo PMA_generate_common_hidden_inputs();
148 echo '<input type="hidden" id="custom_color" name="custom_color" value="" />';
149 echo '<input type="submit" name="custom_color_reset" value="' . __('Reset') . '" />';
150 echo '</form>';
151 echo '</li>';
154 echo '<li id="li_select_fontsize">';
155 echo PMA_Config::getFontsizeForm();
156 echo '</li>';
158 echo '</ul>';
160 // User preferences
162 echo '<ul>';
163 echo PMA_printListItem(__('More settings'), 'li_user_preferences',
164 './prefs_manage.php?' . $common_url_query);
165 echo '</ul>';
167 echo '</div>';
170 echo '</div>';
171 echo '<div id="main_pane_right">';
174 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
175 echo '<div class="group">';
176 echo '<h2>MySQL</h2>';
177 echo '<ul>' . "\n";
178 PMA_printListItem(__('Server') . ': ' . $server_info, 'li_server_info');
179 PMA_printListItem(__('Server version') . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_version');
180 PMA_printListItem(__('Protocol version') . ': ' . PMA_DBI_get_proto_info(),
181 'li_mysql_proto');
182 PMA_printListItem(__('User') . ': ' . htmlspecialchars($mysql_cur_user_and_host),
183 'li_user_info');
185 echo ' <li id="li_select_mysql_charset">';
186 echo ' ' . __('MySQL charset') . ': '
187 . ' <span xml:lang="en" dir="ltr">'
188 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
189 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
190 . ' </span>' . "\n"
191 . ' </li>' . "\n";
192 echo ' </ul>';
193 echo ' </div>';
196 if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
197 echo '<div class="group">';
198 echo '<h2>' . __('Web server') . '</h2>';
199 echo '<ul>';
200 if ($GLOBALS['cfg']['ShowServerInfo']) {
201 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
203 if ($server > 0) {
204 PMA_printListItem(__('MySQL client version') . ': ' . PMA_DBI_get_client_info(),
205 'li_mysql_client_version');
206 PMA_printListItem(__('PHP extension') . ': ' . $GLOBALS['cfg']['Server']['extension'] . ' ' . PMA_showPHPDocu('book.' . $GLOBALS['cfg']['Server']['extension'] . '.php'),
207 'li_used_php_extension');
211 if ($cfg['ShowPhpInfo']) {
212 PMA_printListItem(__('Show PHP information'), 'li_phpinfo', './phpinfo.php?' . $common_url_query);
214 echo ' </ul>';
215 echo ' </div>';
218 echo '<div class="group pmagroup">';
219 echo '<h2>phpMyAdmin</h2>';
220 echo '<ul>';
221 $class = null;
222 if ($GLOBALS['cfg']['VersionCheck']) {
223 $class = 'jsversioncheck';
225 PMA_printListItem(__('Version information') . ': ' . PMA_VERSION, 'li_pma_version', null, null, null, null, $class);
226 PMA_printListItem(__('Documentation'), 'li_pma_docs', 'Documentation.html', null, '_blank');
227 PMA_printListItem(__('Wiki'), 'li_pma_wiki', PMA_linkURL('http://wiki.phpmyadmin.net/'), null, '_blank');
229 // does not work if no target specified, don't know why
230 PMA_printListItem(__('Official Homepage'), 'li_pma_homepage', PMA_linkURL('http://www.phpMyAdmin.net/'), null, '_blank');
231 PMA_printListItem(__('Contribute'), 'li_pma_contribute', PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'), null, '_blank');
232 PMA_printListItem(__('Get support'), 'li_pma_support', PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'), null, '_blank');
233 PMA_printListItem(__('List of changes'), 'li_pma_changes', PMA_linkURL('changelog.php'), null, '_blank');
235 </ul>
236 </div>
238 </div>
240 <?php
242 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
243 * full height of the inner divs
246 <br class="clearfloat" />
247 <br class="clearfloat" />
248 </div>
250 <?php
252 * Warning if using the default MySQL privileged account
254 if ($server != 0
255 && $cfg['Server']['user'] == 'root'
256 && $cfg['Server']['password'] == '') {
257 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);
261 * Nijel: As we try to handle charsets by ourself, mbstring overloads just
262 * break it, see bug 1063821.
264 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
265 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);
269 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
270 * to tell user something might be broken without it, see bug #1063149.
272 if (! @extension_loaded('mbstring')) {
273 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);
277 * Check whether session.gc_maxlifetime limits session validity.
279 $gc_time = (int)@ini_get('session.gc_maxlifetime');
280 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
281 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);
285 * Check whether LoginCookieValidity is limited by LoginCookieStore.
287 if ($GLOBALS['cfg']['LoginCookieStore'] != 0 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']) {
288 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);
292 * Check if user does not have defined blowfish secret and it is being used.
294 if (!empty($_SESSION['auto_blowfish_secret']) &&
295 empty($GLOBALS['cfg']['blowfish_secret'])) {
296 trigger_error(__('The configuration file now needs a secret passphrase (blowfish_secret).'), E_USER_WARNING);
300 * Check for existence of config directory which should not exist in
301 * production environment.
303 if (file_exists('./config')) {
304 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);
308 * Check whether relations are supported.
310 if ($server > 0) {
311 $cfgRelation = PMA_getRelationsParam();
312 if(!$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false) {
313 $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.'));
314 $message->addParam('<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $common_url_query . '">', false);
315 $message->addParam('</a>', false);
316 /* Show error if user has configured something, notice elsewhere */
317 if (!empty($cfg['Servers'][$server]['pmadb'])) {
318 $message->isError(true);
320 $message->display();
321 } // end if
325 * Show warning when javascript support is missing.
327 echo '<noscript>';
328 $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.'));
329 $message->isError(true);
330 $message->display();
331 echo '</noscript>';
334 * Warning about different MySQL library and server version
335 * (a difference on the third digit does not count).
336 * If someday there is a constant that we can check about mysqlnd, we can use it instead
337 * of strpos().
338 * If no default server is set, PMA_DBI_get_client_info() is not defined yet.
340 if (function_exists('PMA_DBI_get_client_info')) {
341 $_client_info = PMA_DBI_get_client_info();
342 if ($server > 0 && strpos($_client_info, 'mysqlnd') === false && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)) {
343 trigger_error(PMA_sanitize(sprintf(__('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
344 $_client_info,
345 substr(PMA_MYSQL_STR_VERSION, 0, strpos(PMA_MYSQL_STR_VERSION . '-', '-')))),
346 E_USER_NOTICE);
348 unset($_client_info);
352 * Warning about Suhosin
354 if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_value_length')) {
355 trigger_error(PMA_sanitize(sprintf(__('Server running with Suhosin. Please refer to %sdocumentation%s for possible issues.'), '[a@./Documentation.html#faq1_38@_blank]', '[/a]')), E_USER_WARNING);
359 * Warning about incomplete translations.
361 * The data file is created while creating release by ./scripts/remove-incomplete-mo
363 if (file_exists('./libraries/language_stats.inc.php')) {
364 include('./libraries/language_stats.inc.php');
366 * This message is intentionally not translated, because we're
367 * handling incomplete translations here and focus on english
368 * speaking users.
370 if (isset($GLOBALS['language_stats'][$lang]) && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']) {
371 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">contributing</a>.', E_USER_NOTICE);
376 * prints list item for main page
378 * @param string $name displayed text
379 * @param string $id id, used for css styles
380 * @param string $url make item as link with $url as target
381 * @param string $mysql_help_page display a link to MySQL's manual
382 * @param string $target special target for $url
383 * @param string $a_id id for the anchor, used for jQuery to hook in functions
384 * @param string $class class for the li element
385 * @param string $a_class class for the anchor element
387 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null, $a_id = null, $class = null, $a_class = null)
389 echo '<li id="' . $id . '"';
390 if (null !== $class) {
391 echo ' class="' . $class . '"';
393 echo '>';
394 if (null !== $url) {
395 echo '<a href="' . $url . '"';
396 if (null !== $target) {
397 echo ' target="' . $target . '"';
399 if (null != $a_id) {
400 echo ' id="' . $a_id .'"';
402 if (null != $a_class) {
403 echo ' class="' . $a_class .'"';
405 echo '>';
408 echo $name;
410 if (null !== $url) {
411 echo '</a>' . "\n";
413 if (null !== $mysql_help_page) {
414 echo PMA_showMySQLDocu('', $mysql_help_page);
416 echo '</li>';
420 * Displays the footer
422 require './libraries/footer.inc.php';