Translation update done using Pootle.
[phpmyadmin/crack.git] / main.php
blob48e98fc4cffccc9b990f091912368ab6e7f8cd16
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';
18 // Handles some variables that may have been sent by the calling script
19 $GLOBALS['db'] = '';
20 $GLOBALS['table'] = '';
21 $show_query = '1';
22 require_once './libraries/header.inc.php';
24 // Any message to display?
25 if (! empty($message)) {
26 PMA_showMessage($message);
27 unset($message);
30 $common_url_query = PMA_generate_common_url('', '');
32 // when $server > 0, a server has been chosen so we can display
33 // all MySQL-related information
34 if ($server > 0) {
35 require './libraries/server_common.inc.php';
36 require './libraries/StorageEngine.class.php';
37 require './libraries/server_links.inc.php';
39 // Use the verbose name of the server instead of the hostname
40 // if a value is set
41 $server_info = '';
42 if (! empty($cfg['Server']['verbose'])) {
43 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
44 if ($GLOBALS['cfg']['ShowServerInfo']) {
45 $server_info .= ' (';
48 if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
49 $server_info .= PMA_DBI_get_host_info();
51 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
52 $server_info .= ')';
54 $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
56 // should we add the port info here?
57 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
58 ? $GLOBALS['cfg']['Server']['verbose']
59 : $GLOBALS['cfg']['Server']['host']);
62 echo '<div id="maincontainer">' . "\n";
63 echo '<div id="main_pane_left">';
64 if ($server > 0
65 || (! $cfg['LeftDisplayServers'] && count($cfg['Servers']) > 1)) {
66 echo '<div class="group">';
67 echo '<h2>' . __('General Settings') . '</h2>';
68 echo '<ul>';
70 /**
71 * Displays the MySQL servers choice form
73 if (! $cfg['LeftDisplayServers']
74 && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)) {
75 echo '<li id="li_select_server">';
76 require_once './libraries/select_server.lib.php';
77 PMA_select_server(true, true);
78 echo '</li>';
81 /**
82 * Displays the mysql server related links
84 if ($server > 0) {
85 require_once './libraries/check_user_privileges.lib.php';
87 // Logout for advanced authentication
88 if ($cfg['Server']['auth_type'] != 'config') {
89 if ($cfg['ShowChgPassword']) {
90 PMA_printListItem(__('Change password'), 'li_change_password',
91 './user_password.php?' . $common_url_query, null, null, 'change_password_anchor');
93 } // end if
94 if (PMA_MYSQL_MAJOR_VERSION < 2009) {
95 echo ' <li id="li_select_mysql_collation">';
96 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
97 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
98 . ' <label for="select_collation_connection">' . "\n"
99 . ' ' . __('MySQL connection collation') . "\n"
100 // put the doc link in the form so that it appears on the same line
101 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . ': ' . "\n"
102 . ' </label>' . "\n"
104 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
105 . ' <noscript><input type="submit" value="' . __('Go') . '" /></noscript>' . "\n"
106 . ' </form>' . "\n"
107 . ' </li>' . "\n";
108 } // not Drizzle
109 } // end of if ($server > 0)
110 echo '</ul>';
111 echo '</div>';
114 echo '<div class="group">';
115 echo '<h2>' . __('Appearance Settings') . '</h2>';
116 echo ' <ul>';
118 // Displays language selection combo
119 if (empty($cfg['Lang'])) {
120 echo '<li id="li_select_lang">';
121 require_once './libraries/display_select_lang.lib.php';
122 PMA_select_language();
123 echo '</li>';
126 // ThemeManager if available
128 if ($GLOBALS['cfg']['ThemeManager']) {
129 echo '<li id="li_select_theme">';
130 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
131 echo '</li>';
133 // see js/main_custom_color.js
134 echo '<li id="li_custom_color" class="hide">';
135 echo __('Background color') . ': ';
136 echo '<input type="submit" name="custom_color_choose" value="' . __('Choose...') . '" />';
137 echo '<form name="colorform" id="colorform" method="post" action="index.php" target="_parent">';
138 echo PMA_generate_common_hidden_inputs();
139 echo '<input type="hidden" id="custom_color" name="custom_color" value="" />';
140 echo '<input type="submit" name="custom_color_reset" value="' . __('Reset') . '" />';
141 echo '</form>';
142 echo '</li>';
144 echo '<li id="li_select_fontsize">';
145 echo PMA_Config::getFontsizeForm();
146 echo '</li>';
148 echo '</ul>';
150 // User preferences
152 echo '<ul>';
153 echo PMA_printListItem(__('More settings'), 'li_user_preferences',
154 './prefs_manage.php?' . $common_url_query);
155 echo '</ul>';
157 echo '</div>';
160 echo '</div>';
161 echo '<div id="main_pane_right">';
164 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
165 echo '<div class="group">';
166 echo '<h2>MySQL</h2>';
167 echo '<ul>' . "\n";
168 PMA_printListItem(__('Server') . ': ' . $server_info, 'li_server_info');
169 PMA_printListItem(__('Server version') . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_version');
170 PMA_printListItem(__('Protocol version') . ': ' . PMA_DBI_get_proto_info(),
171 'li_mysql_proto');
172 PMA_printListItem(__('User') . ': ' . htmlspecialchars($mysql_cur_user_and_host),
173 'li_user_info');
175 echo ' <li id="li_select_mysql_charset">';
176 echo ' ' . __('MySQL charset') . ': '
177 . ' <span xml:lang="en" dir="ltr">'
178 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
179 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
180 . ' </span>' . "\n"
181 . ' </li>' . "\n";
182 echo ' </ul>';
183 echo ' </div>';
186 if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
187 echo '<div class="group">';
188 echo '<h2>' . __('Web server') . '</h2>';
189 echo '<ul>';
190 if ($GLOBALS['cfg']['ShowServerInfo']) {
191 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
193 if ($server > 0) {
194 PMA_printListItem(__('MySQL client version') . ': ' . PMA_DBI_get_client_info(),
195 'li_mysql_client_version');
196 PMA_printListItem(__('PHP extension') . ': ' . $GLOBALS['cfg']['Server']['extension'],
197 'li_used_php_extension');
201 if ($cfg['ShowPhpInfo']) {
202 PMA_printListItem(__('Show PHP information'), 'li_phpinfo', './phpinfo.php?' . $common_url_query);
204 echo ' </ul>';
205 echo ' </div>';
208 echo '<div class="group">';
209 echo '<h2>phpMyAdmin</h2>';
210 echo '<ul>';
211 PMA_printListItem(__('Version information') . ': ' . PMA_VERSION, 'li_pma_version');
212 PMA_printListItem(__('Documentation'), 'li_pma_docs', 'Documentation.html', null, '_blank');
213 PMA_printListItem(__('Wiki'), 'li_pma_wiki', 'http://wiki.phpmyadmin.net', null, '_blank');
215 // does not work if no target specified, don't know why
216 PMA_printListItem(__('Official Homepage'), 'li_pma_homepage', 'http://www.phpMyAdmin.net/', null, '_blank');
218 <li><bdo xml:lang="en" dir="ltr">
219 [<a href="changelog.php" target="_blank">ChangeLog</a>]
220 [<a href="http://phpmyadmin.git.sourceforge.net/git/gitweb-index.cgi"
221 target="_blank">Git</a>]
222 [<a href="http://sourceforge.net/mail/?group_id=23067"
223 target="_blank"><?php echo __('Mailing lists'); ?></a>]
224 </bdo>
225 </li>
226 </ul>
227 </div>
229 </div>
231 <?php
233 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
234 * full height of the inner divs
237 <br class="clearfloat" />
238 <br class="clearfloat" />
239 </div>
241 <?php
243 * Warning if using the default MySQL privileged account
245 if ($server != 0
246 && $cfg['Server']['user'] == 'root'
247 && $cfg['Server']['password'] == '') {
248 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);
252 * Nijel: As we try to handle charsets by ourself, mbstring overloads just
253 * break it, see bug 1063821.
255 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
256 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);
260 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
261 * to tell user something might be broken without it, see bug #1063149.
263 if (! @extension_loaded('mbstring')) {
264 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);
268 * Check whether session.gc_maxlifetime limits session validity.
270 $gc_time = (int)@ini_get('session.gc_maxlifetime');
271 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
272 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);
276 * Check whether LoginCookieValidity is limited by LoginCookieStore.
278 if ($GLOBALS['cfg']['LoginCookieStore'] != 0 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']) {
279 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);
283 * Check if user does not have defined blowfish secret and it is being used.
285 if (!empty($_SESSION['auto_blowfish_secret']) &&
286 empty($GLOBALS['cfg']['blowfish_secret'])) {
287 trigger_error(__('The configuration file now needs a secret passphrase (blowfish_secret).'), E_USER_WARNING);
291 * Check for existence of config directory which should not exist in
292 * production environment.
294 if (file_exists('./config')) {
295 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);
299 * Check whether relations are supported.
301 if ($server > 0) {
302 $cfgRelation = PMA_getRelationsParam();
303 if(!$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false) {
304 $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.'));
305 $message->addParam('<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $common_url_query . '">', false);
306 $message->addParam('</a>', false);
307 /* Show error if user has configured something, notice elsewhere */
308 if (!empty($cfg['Servers'][$server]['pmadb'])) {
309 $message->isError(true);
311 $message->display();
312 } // end if
316 * Show warning when javascript support is missing.
318 echo '<noscript>';
319 $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.'));
320 $message->isError(true);
321 $message->display();
322 echo '</noscript>';
325 * Warning about different MySQL library and server version
326 * (a difference on the third digit does not count).
327 * If someday there is a constant that we can check about mysqlnd, we can use it instead
328 * of strpos().
329 * If no default server is set, PMA_DBI_get_client_info() is not defined yet.
331 if (function_exists('PMA_DBI_get_client_info')) {
332 $_client_info = PMA_DBI_get_client_info();
333 if ($server > 0 && strpos($_client_info, 'mysqlnd') === false && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)) {
334 trigger_error(PMA_sanitize(sprintf(__('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
335 $_client_info,
336 substr(PMA_MYSQL_STR_VERSION, 0, strpos(PMA_MYSQL_STR_VERSION . '-', '-')))),
337 E_USER_NOTICE);
339 unset($_client_info);
343 * Warning about Suhosin
345 if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_value_length')) {
346 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);
350 * prints list item for main page
352 * @param string $name displayed text
353 * @param string $id id, used for css styles
354 * @param string $url make item as link with $url as target
355 * @param string $mysql_help_page display a link to MySQL's manual
356 * @param string $target special target for $url
357 * @param string $a_id id for the anchor, used for jQuery to hook in functions
359 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null, $a_id = null)
361 echo '<li id="' . $id . '">';
362 if (null !== $url) {
363 echo '<a href="' . $url . '"';
364 if (null !== $target) {
365 echo ' target="' . $target . '"';
367 if (null != $a_id) {
368 echo ' id="' . $a_id .'"';
370 echo '>';
373 echo $name;
375 if (null !== $url) {
376 echo '</a>' . "\n";
378 if (null !== $mysql_help_page) {
379 echo PMA_showMySQLDocu('', $mysql_help_page);
381 echo '</li>';
385 * Displays the footer
387 require './libraries/footer.inc.php';