bug #3452506 [edit] Unable to move tables with triggers
[phpmyadmin/madhuracj.git] / main.php
blob0b0de1a26c0881d357ad641ca0de843c872fe234
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.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 require './libraries/server_common.inc.php';
34 require './libraries/StorageEngine.class.php';
35 require './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 require_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) {
83 require_once './libraries/check_user_privileges.lib.php';
85 if (!PMA_DRIZZLE) {
86 // Logout for advanced authentication
87 if ($cfg['Server']['auth_type'] != 'config') {
88 if ($cfg['ShowChgPassword']) {
89 if ($GLOBALS['cfg']['AjaxEnable']) {
90 $conditional_class = 'ajax';
91 } else {
92 $conditional_class = null;
94 PMA_printListItem(__('Change password'), 'li_change_password',
95 './user_password.php?' . $common_url_query, null, null, 'change_password_anchor', null, $conditional_class);
97 } // end if
99 echo ' <li id="li_select_mysql_collation">';
100 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
101 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
102 . ' <label for="select_collation_connection">' . "\n"
103 . ' ' . __('MySQL connection collation') . "\n"
104 // put the doc link in the form so that it appears on the same line
105 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . ': ' . "\n"
106 . ' </label>' . "\n"
108 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
109 . ' <noscript><input type="submit" value="' . __('Go') . '" /></noscript>' . "\n"
110 . ' </form>' . "\n"
111 . ' </li>' . "\n";
112 } // not Drizzle
113 } // end of if ($server > 0)
114 echo '</ul>';
115 echo '</div>';
118 echo '<div class="group">';
119 echo '<h2>' . __('Appearance Settings') . '</h2>';
120 echo ' <ul>';
122 // Displays language selection combo
123 if (empty($cfg['Lang'])) {
124 echo '<li id="li_select_lang">';
125 require_once './libraries/display_select_lang.lib.php';
126 PMA_select_language();
127 echo '</li>';
130 // ThemeManager if available
132 if ($GLOBALS['cfg']['ThemeManager']) {
133 echo '<li id="li_select_theme">';
134 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
135 echo '</li>';
137 echo '<li id="li_select_fontsize">';
138 echo PMA_Config::getFontsizeForm();
139 echo '</li>';
141 echo '</ul>';
143 // User preferences
145 if ($server > 0) {
146 echo '<ul>';
147 echo PMA_printListItem(__('More settings'), 'li_user_preferences',
148 './prefs_manage.php?' . $common_url_query);
149 echo '</ul>';
152 echo '</div>';
155 echo '</div>';
156 echo '<div id="main_pane_right">';
159 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
160 echo '<div class="group">';
161 echo '<h2>MySQL</h2>';
162 echo '<ul>' . "\n";
163 PMA_printListItem(__('Server') . ': ' . $server_info, 'li_server_info');
164 PMA_printListItem(__('Server version') . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_version');
165 PMA_printListItem(__('Protocol version') . ': ' . PMA_DBI_get_proto_info(),
166 'li_mysql_proto');
167 PMA_printListItem(__('User') . ': ' . htmlspecialchars($mysql_cur_user_and_host),
168 'li_user_info');
170 echo ' <li id="li_select_mysql_charset">';
171 echo ' ' . __('MySQL charset') . ': '
172 . ' <span xml:lang="en" dir="ltr">'
173 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
174 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
175 . ' </span>' . "\n"
176 . ' </li>' . "\n";
177 echo ' </ul>';
178 echo ' </div>';
181 if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
182 echo '<div class="group">';
183 echo '<h2>' . __('Web server') . '</h2>';
184 echo '<ul>';
185 if ($GLOBALS['cfg']['ShowServerInfo']) {
186 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
188 if ($server > 0) {
189 PMA_printListItem(__('MySQL client version') . ': ' . PMA_DBI_get_client_info(),
190 'li_mysql_client_version');
191 PMA_printListItem(__('PHP extension') . ': ' . $GLOBALS['cfg']['Server']['extension'] . ' ' . PMA_showPHPDocu('book.' . $GLOBALS['cfg']['Server']['extension'] . '.php'),
192 'li_used_php_extension');
196 if ($cfg['ShowPhpInfo']) {
197 PMA_printListItem(__('Show PHP information'), 'li_phpinfo', './phpinfo.php?' . $common_url_query);
199 echo ' </ul>';
200 echo ' </div>';
203 echo '<div class="group pmagroup">';
204 echo '<h2>phpMyAdmin</h2>';
205 echo '<ul>';
206 $class = null;
207 // workaround for bug 3302733; some browsers don't like the situation
208 // where phpMyAdmin is called on a secure page but a part of the page
209 // (the version check) refers to a non-secure page
210 if ($GLOBALS['cfg']['VersionCheck'] && ! $GLOBALS['PMA_Config']->get('is_https')) {
211 $class = 'jsversioncheck';
213 PMA_printListItem(__('Version information') . ': ' . PMA_VERSION, 'li_pma_version', null, null, null, null, $class);
214 PMA_printListItem(__('Documentation'), 'li_pma_docs', 'Documentation.html', null, '_blank');
215 PMA_printListItem(__('Wiki'), 'li_pma_wiki', PMA_linkURL('http://wiki.phpmyadmin.net/'), null, '_blank');
217 // does not work if no target specified, don't know why
218 PMA_printListItem(__('Official Homepage'), 'li_pma_homepage', PMA_linkURL('http://www.phpMyAdmin.net/'), null, '_blank');
219 PMA_printListItem(__('Contribute'), 'li_pma_contribute', PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'), null, '_blank');
220 PMA_printListItem(__('Get support'), 'li_pma_support', PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'), null, '_blank');
221 PMA_printListItem(__('List of changes'), 'li_pma_changes', PMA_linkURL('changelog.php'), null, '_blank');
223 </ul>
224 </div>
226 </div>
228 <?php
230 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
231 * full height of the inner divs
234 <br class="clearfloat" />
235 <br class="clearfloat" />
236 </div>
238 <?php
240 * Warning if using the default MySQL privileged account
242 if ($server != 0
243 && $cfg['Server']['user'] == 'root'
244 && $cfg['Server']['password'] == '') {
245 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);
249 * Nijel: As we try to handle charsets by ourself, mbstring overloads just
250 * break it, see bug 1063821.
252 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
253 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);
257 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
258 * to tell user something might be broken without it, see bug #1063149.
260 if (! @extension_loaded('mbstring')) {
261 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);
265 * Check whether session.gc_maxlifetime limits session validity.
267 $gc_time = (int)@ini_get('session.gc_maxlifetime');
268 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
269 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);
273 * Check whether LoginCookieValidity is limited by LoginCookieStore.
275 if ($GLOBALS['cfg']['LoginCookieStore'] != 0 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']) {
276 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);
280 * Check if user does not have defined blowfish secret and it is being used.
282 if (!empty($_SESSION['auto_blowfish_secret']) &&
283 empty($GLOBALS['cfg']['blowfish_secret'])) {
284 trigger_error(__('The configuration file now needs a secret passphrase (blowfish_secret).'), E_USER_WARNING);
288 * Check for existence of config directory which should not exist in
289 * production environment.
291 if (file_exists('./config')) {
292 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);
296 * Check whether relations are supported.
298 if ($server > 0) {
299 $cfgRelation = PMA_getRelationsParam();
300 if(!$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false) {
301 $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.'));
302 $message->addParam('<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $common_url_query . '">', false);
303 $message->addParam('</a>', false);
304 /* Show error if user has configured something, notice elsewhere */
305 if (!empty($cfg['Servers'][$server]['pmadb'])) {
306 $message->isError(true);
308 $message->display();
309 } // end if
313 * Show notice when javascript support is missing.
315 echo '<noscript>';
316 $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.'));
317 $message->isError(true);
318 $message->display();
319 echo '</noscript>';
322 * Warning about different MySQL library and server version
323 * (a difference on the third digit does not count).
324 * If someday there is a constant that we can check about mysqlnd, we can use it instead
325 * of strpos().
326 * If no default server is set, PMA_DBI_get_client_info() is not defined yet.
328 if (function_exists('PMA_DBI_get_client_info')) {
329 $_client_info = PMA_DBI_get_client_info();
330 if ($server > 0 && strpos($_client_info, 'mysqlnd') === false && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)) {
331 trigger_error(PMA_sanitize(sprintf(__('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
332 $_client_info,
333 substr(PMA_MYSQL_STR_VERSION, 0, strpos(PMA_MYSQL_STR_VERSION . '-', '-')))),
334 E_USER_NOTICE);
336 unset($_client_info);
340 * Warning about Suhosin
342 if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_value_length')) {
343 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);
347 * Warning about incomplete translations.
349 * The data file is created while creating release by ./scripts/remove-incomplete-mo
351 if (file_exists('./libraries/language_stats.inc.php')) {
352 include('./libraries/language_stats.inc.php');
354 * This message is intentionally not translated, because we're
355 * handling incomplete translations here and focus on english
356 * speaking users.
358 if (isset($GLOBALS['language_stats'][$lang]) && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']) {
359 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);
364 * prints list item for main page
366 * @param string $name displayed text
367 * @param string $id id, used for css styles
368 * @param string $url make item as link with $url as target
369 * @param string $mysql_help_page display a link to MySQL's manual
370 * @param string $target special target for $url
371 * @param string $a_id id for the anchor, used for jQuery to hook in functions
372 * @param string $class class for the li element
373 * @param string $a_class class for the anchor element
375 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null, $a_id = null, $class = null, $a_class = null)
377 echo '<li id="' . $id . '"';
378 if (null !== $class) {
379 echo ' class="' . $class . '"';
381 echo '>';
382 if (null !== $url) {
383 echo '<a href="' . $url . '"';
384 if (null !== $target) {
385 echo ' target="' . $target . '"';
387 if (null != $a_id) {
388 echo ' id="' . $a_id .'"';
390 if (null != $a_class) {
391 echo ' class="' . $a_class .'"';
393 echo '>';
396 echo $name;
398 if (null !== $url) {
399 echo '</a>' . "\n";
401 if (null !== $mysql_help_page) {
402 echo PMA_showMySQLDocu('', $mysql_help_page);
404 echo '</li>';
408 * Displays the footer
410 require './libraries/footer.inc.php';