Translation update done using Pootle.
[phpmyadmin/crack.git] / main.php
blob495de91dd43245bdbea4719ee39328dfa54131aa
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 // Logout for advanced authentication
89 if ($cfg['Server']['auth_type'] != 'config') {
90 if ($cfg['ShowChgPassword']) {
91 if ($GLOBALS['cfg']['AjaxEnable']) {
92 $conditional_class = 'ajax';
93 } else {
94 $conditional_class = null;
96 PMA_printListItem(__('Change password'), 'li_change_password',
97 './user_password.php?' . $common_url_query, null, null, 'change_password_anchor', null, $conditional_class);
99 } // end if
100 if (PMA_MYSQL_MAJOR_VERSION < 2009) {
101 echo ' <li id="li_select_mysql_collation">';
102 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
103 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
104 . ' <label for="select_collation_connection">' . "\n"
105 . ' ' . __('MySQL connection collation') . "\n"
106 // put the doc link in the form so that it appears on the same line
107 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . ': ' . "\n"
108 . ' </label>' . "\n"
110 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
111 . ' <noscript><input type="submit" value="' . __('Go') . '" /></noscript>' . "\n"
112 . ' </form>' . "\n"
113 . ' </li>' . "\n";
114 } // not Drizzle
115 } // end of if ($server > 0)
116 echo '</ul>';
117 echo '</div>';
120 echo '<div class="group">';
121 echo '<h2>' . __('Appearance Settings') . '</h2>';
122 echo ' <ul>';
124 // Displays language selection combo
125 if (empty($cfg['Lang'])) {
126 echo '<li id="li_select_lang">';
127 require_once './libraries/display_select_lang.lib.php';
128 PMA_select_language();
129 echo '</li>';
132 // ThemeManager if available
134 if ($GLOBALS['cfg']['ThemeManager']) {
135 echo '<li id="li_select_theme">';
136 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
137 echo '</li>';
139 // see js/main_custom_color.js
140 echo '<li id="li_custom_color" class="hide">';
141 echo __('Background color') . ': ';
142 echo '<input type="submit" name="custom_color_choose" value="' . __('Choose...') . '" />';
143 echo '<form name="colorform" id="colorform" method="post" action="index.php" target="_parent">';
144 echo PMA_generate_common_hidden_inputs();
145 echo '<input type="hidden" id="custom_color" name="custom_color" value="" />';
146 echo '<input type="submit" name="custom_color_reset" value="' . __('Reset') . '" />';
147 echo '</form>';
148 echo '</li>';
150 echo '<li id="li_select_fontsize">';
151 echo PMA_Config::getFontsizeForm();
152 echo '</li>';
154 echo '</ul>';
156 // User preferences
158 echo '<ul>';
159 echo PMA_printListItem(__('More settings'), 'li_user_preferences',
160 './prefs_manage.php?' . $common_url_query);
161 echo '</ul>';
163 echo '</div>';
166 echo '</div>';
167 echo '<div id="main_pane_right">';
170 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
171 echo '<div class="group">';
172 echo '<h2>MySQL</h2>';
173 echo '<ul>' . "\n";
174 PMA_printListItem(__('Server') . ': ' . $server_info, 'li_server_info');
175 PMA_printListItem(__('Server version') . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_version');
176 PMA_printListItem(__('Protocol version') . ': ' . PMA_DBI_get_proto_info(),
177 'li_mysql_proto');
178 PMA_printListItem(__('User') . ': ' . htmlspecialchars($mysql_cur_user_and_host),
179 'li_user_info');
181 echo ' <li id="li_select_mysql_charset">';
182 echo ' ' . __('MySQL charset') . ': '
183 . ' <span xml:lang="en" dir="ltr">'
184 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
185 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
186 . ' </span>' . "\n"
187 . ' </li>' . "\n";
188 echo ' </ul>';
189 echo ' </div>';
192 if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
193 echo '<div class="group">';
194 echo '<h2>' . __('Web server') . '</h2>';
195 echo '<ul>';
196 if ($GLOBALS['cfg']['ShowServerInfo']) {
197 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
199 if ($server > 0) {
200 PMA_printListItem(__('MySQL client version') . ': ' . PMA_DBI_get_client_info(),
201 'li_mysql_client_version');
202 PMA_printListItem(__('PHP extension') . ': ' . $GLOBALS['cfg']['Server']['extension'],
203 'li_used_php_extension');
207 if ($cfg['ShowPhpInfo']) {
208 PMA_printListItem(__('Show PHP information'), 'li_phpinfo', './phpinfo.php?' . $common_url_query);
210 echo ' </ul>';
211 echo ' </div>';
214 echo '<div class="group">';
215 echo '<h2>phpMyAdmin</h2>';
216 echo '<ul>';
217 $class = null;
218 if ($GLOBALS['cfg']['VersionCheck']) {
219 $class = 'jsversioncheck';
221 PMA_printListItem(__('Version information') . ': ' . PMA_VERSION, 'li_pma_version', null, null, null, null, $class);
222 PMA_printListItem(__('Documentation'), 'li_pma_docs', 'Documentation.html', null, '_blank');
223 PMA_printListItem(__('Wiki'), 'li_pma_wiki', PMA_linkURL('http://wiki.phpmyadmin.net/'), null, '_blank');
225 // does not work if no target specified, don't know why
226 PMA_printListItem(__('Official Homepage'), 'li_pma_homepage', PMA_linkURL('http://www.phpMyAdmin.net/'), null, '_blank');
228 <li><bdo xml:lang="en" dir="ltr">
229 [<a href="changelog.php" target="_blank">ChangeLog</a>]
230 [<a href="<?php echo PMA_linkURL('http://phpmyadmin.git.sourceforge.net/git/gitweb-index.cgi'); ?>"
231 target="_blank">Git</a>]
232 [<a href="<?php echo PMA_linkURL('http://sourceforge.net/mail/?group_id=23067'); ?>"
233 target="_blank"><?php echo __('Mailing lists'); ?></a>]
234 </bdo>
235 </li>
236 </ul>
237 </div>
239 </div>
241 <?php
243 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
244 * full height of the inner divs
247 <br class="clearfloat" />
248 <br class="clearfloat" />
249 </div>
251 <?php
253 * Warning if using the default MySQL privileged account
255 if ($server != 0
256 && $cfg['Server']['user'] == 'root'
257 && $cfg['Server']['password'] == '') {
258 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);
262 * Nijel: As we try to handle charsets by ourself, mbstring overloads just
263 * break it, see bug 1063821.
265 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
266 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);
270 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
271 * to tell user something might be broken without it, see bug #1063149.
273 if (! @extension_loaded('mbstring')) {
274 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);
278 * Check whether session.gc_maxlifetime limits session validity.
280 $gc_time = (int)@ini_get('session.gc_maxlifetime');
281 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
282 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);
286 * Check whether LoginCookieValidity is limited by LoginCookieStore.
288 if ($GLOBALS['cfg']['LoginCookieStore'] != 0 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']) {
289 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);
293 * Check if user does not have defined blowfish secret and it is being used.
295 if (!empty($_SESSION['auto_blowfish_secret']) &&
296 empty($GLOBALS['cfg']['blowfish_secret'])) {
297 trigger_error(__('The configuration file now needs a secret passphrase (blowfish_secret).'), E_USER_WARNING);
301 * Check for existence of config directory which should not exist in
302 * production environment.
304 if (file_exists('./config')) {
305 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);
309 * Check whether relations are supported.
311 if ($server > 0) {
312 $cfgRelation = PMA_getRelationsParam();
313 if(!$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false) {
314 $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.'));
315 $message->addParam('<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $common_url_query . '">', false);
316 $message->addParam('</a>', false);
317 /* Show error if user has configured something, notice elsewhere */
318 if (!empty($cfg['Servers'][$server]['pmadb'])) {
319 $message->isError(true);
321 $message->display();
322 } // end if
326 * Show warning when javascript support is missing.
328 echo '<noscript>';
329 $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.'));
330 $message->isError(true);
331 $message->display();
332 echo '</noscript>';
335 * Warning about different MySQL library and server version
336 * (a difference on the third digit does not count).
337 * If someday there is a constant that we can check about mysqlnd, we can use it instead
338 * of strpos().
339 * If no default server is set, PMA_DBI_get_client_info() is not defined yet.
341 if (function_exists('PMA_DBI_get_client_info')) {
342 $_client_info = PMA_DBI_get_client_info();
343 if ($server > 0 && strpos($_client_info, 'mysqlnd') === false && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)) {
344 trigger_error(PMA_sanitize(sprintf(__('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
345 $_client_info,
346 substr(PMA_MYSQL_STR_VERSION, 0, strpos(PMA_MYSQL_STR_VERSION . '-', '-')))),
347 E_USER_NOTICE);
349 unset($_client_info);
353 * Warning about Suhosin
355 if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_value_length')) {
356 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);
360 * prints list item for main page
362 * @param string $name displayed text
363 * @param string $id id, used for css styles
364 * @param string $url make item as link with $url as target
365 * @param string $mysql_help_page display a link to MySQL's manual
366 * @param string $target special target for $url
367 * @param string $a_id id for the anchor, used for jQuery to hook in functions
368 * @param string $class class for the li element
369 * @param string $a_class class for the anchor element
371 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null, $a_id = null, $class = null, $a_class = null)
373 echo '<li id="' . $id . '"';
374 if (null !== $class) {
375 echo ' class="' . $class . '"';
377 echo '>';
378 if (null !== $url) {
379 echo '<a href="' . $url . '"';
380 if (null !== $target) {
381 echo ' target="' . $target . '"';
383 if (null != $a_id) {
384 echo ' id="' . $a_id .'"';
386 if (null != $a_class) {
387 echo ' class="' . $a_class .'"';
389 echo '>';
392 echo $name;
394 if (null !== $url) {
395 echo '</a>' . "\n";
397 if (null !== $mysql_help_page) {
398 echo PMA_showMySQLDocu('', $mysql_help_page);
400 echo '</li>';
404 * Displays the footer
406 require './libraries/footer.inc.php';