Documentation for distributing phpMyAdmin in README.VENDOR.
[phpmyadmin/crack.git] / main.php
blobf44362be0f87650d7d9d9005076241e87f0e5750
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 */
8 /**
9 * Gets some core libraries and displays a top message if required
11 define('PMA_MOORAINBOW', true);
12 require_once './libraries/common.inc.php';
13 $GLOBALS['js_include'][] = 'mootools.js';
14 $GLOBALS['js_include'][] = 'mooRainbow/mooRainbow.js';
15 $GLOBALS['js_include'][] = 'mootools-domready-rainbow.js';
17 // Handles some variables that may have been sent by the calling script
18 $GLOBALS['db'] = '';
19 $GLOBALS['table'] = '';
20 $show_query = '1';
21 require_once './libraries/header.inc.php';
23 // Any message to display?
24 if (! empty($message)) {
25 PMA_showMessage($message);
26 unset($message);
29 $common_url_query = PMA_generate_common_url('', '');
31 // when $server > 0, a server has been chosen so we can display
32 // all MySQL-related information
33 if ($server > 0) {
34 require './libraries/server_common.inc.php';
35 require './libraries/StorageEngine.class.php';
36 require './libraries/server_links.inc.php';
38 // Use the verbose name of the server instead of the hostname
39 // if a value is set
40 $server_info = '';
41 if (! empty($cfg['Server']['verbose'])) {
42 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
43 if ($GLOBALS['cfg']['ShowServerInfo']) {
44 $server_info .= ' (';
47 if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
48 $server_info .= PMA_DBI_get_host_info();
50 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
51 $server_info .= ')';
53 $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
55 // should we add the port info here?
56 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
57 ? $GLOBALS['cfg']['Server']['verbose']
58 : $GLOBALS['cfg']['Server']['host']);
61 echo '<div id="maincontainer">' . "\n";
62 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>' . $strActions . '</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 PMA_printListItem($strChangePassword, 'li_change_password',
90 './user_password.php?' . $common_url_query);
92 $http_logout = ($cfg['Server']['auth_type'] == 'http')
93 ? '<a href="./Documentation.html#login_bug" target="documentation">'
94 . ($cfg['ReplaceHelpImg'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_info.png" width="11" height="11" alt="Info" />' : '(*)') . '</a>'
95 : '';
96 PMA_printListItem('<strong>' . $strLogout . '</strong> ' . $http_logout,
97 'li_log_out',
98 './index.php?' . $common_url_query . '&amp;old_usr=' . urlencode($PHP_AUTH_USER), null, '_parent');
99 } // end if
100 } // end of if ($server > 0)
102 echo '</ul>';
103 echo '</div>';
107 if ($server > 0) {
108 echo '<div class="group">';
109 echo '<h2>MySQL ' . $short_server_info . '</h2>';
110 echo '<ul>' . "\n";
112 if ($cfg['ShowCreateDb']) {
113 echo '<li id="li_create_database">';
114 require './libraries/display_create_database.lib.php';
115 echo '</li>' . "\n";
118 echo ' <li id="li_select_mysql_collation">';
119 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
120 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
121 . ' <label for="select_collation_connection">' . "\n"
122 . ' ' . $strMySQLConnectionCollation . ': ' . "\n"
123 . ' </label>' . "\n"
124 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
125 . ' <noscript><input type="submit" value="' . $strGo . '" /></noscript>' . "\n"
126 // put the doc link in the form so that it appears on the same line
127 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . "\n"
128 . ' </form>' . "\n"
129 . ' </li>' . "\n";
131 echo ' </ul>';
132 echo ' </div>';
135 echo '<div class="group">';
136 echo '<h2>' . $strInterface . '</h2>';
137 echo ' <ul>';
139 // Displays language selection combo
140 if (empty($cfg['Lang'])) {
141 echo '<li id="li_select_lang">';
142 require_once './libraries/display_select_lang.lib.php';
143 PMA_select_language();
144 echo '</li>';
147 // added by Michael Keck <mail_at_michaelkeck_dot_de>
148 // ThemeManager if available
150 if ($GLOBALS['cfg']['ThemeManager']) {
151 echo '<li id="li_select_theme">';
152 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
153 echo '</li>';
155 <script type="text/javascript">
156 //<![CDATA[
157 document.write('<li id="li_custom_color">');
158 document.write('<?php echo $strCustomColor . ': '; ?>');
159 document.write('<img id="myRainbow" src="js/mooRainbow/images/rainbow.png" alt="[r]" width="16" height="16" />');
160 document.write('<form name="rainbowform" id="rainbowform" method="post" action="index.php" target="_parent">');
161 document.write('<?php echo PMA_generate_common_hidden_inputs(); ?>');
162 document.write('<input type="hidden" name="custom_color" />');
163 document.write('<input type="hidden" name="custom_color_rgb" />');
164 document.write('<input type="submit" name="custom_color_reset" value="<?php echo $strReset; ?>" />');
165 document.write('</form>');
166 document.write('</li>');
167 //]]>
168 </script>
169 <?php
171 echo '<li id="li_select_fontsize">';
172 echo PMA_Config::getFontsizeForm();
173 echo '</li>';
175 echo '</ul>';
176 echo '</div>';
179 echo '</div>';
180 echo '<div id="main_pane_right">';
183 if ($server > 0) {
184 echo '<div class="group">';
185 echo '<h2>MySQL</h2>';
186 echo '<ul>' . "\n";
187 PMA_printListItem($strServer . ': ' . $server_info, 'li_server_info');
188 PMA_printListItem($strServerVersion . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_version');
189 if ($GLOBALS['cfg']['ShowServerInfo']) {
190 PMA_printListItem($strProtocolVersion . ': ' . PMA_DBI_get_proto_info(),
191 'li_mysql_proto');
192 PMA_printListItem($strUser . ': ' . htmlspecialchars($mysql_cur_user_and_host),
193 'li_user_info');
196 echo ' <li id="li_select_mysql_charset">';
197 echo ' ' . $strMySQLCharset . ': '
198 . ' <span xml:lang="en" dir="ltr">'
199 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
200 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
201 . ' </span>' . "\n"
202 . ' </li>' . "\n";
203 echo ' </ul>';
204 echo ' </div>';
208 echo '<div class="group">';
209 echo '<h2>' . $strWebServer . '</h2>';
210 echo '<ul>';
211 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
213 if ($server > 0) {
214 PMA_printListItem($strMysqlClientVersion . ': ' . PMA_DBI_get_client_info(),
215 'li_mysql_client_version');
216 PMA_printListItem($strPHPExtension . ': ' . $GLOBALS['cfg']['Server']['extension'],
217 'li_used_php_extension');
220 if ($cfg['ShowPhpInfo']) {
221 PMA_printListItem($strShowPHPInfo, 'li_phpinfo', './phpinfo.php?' . $common_url_query);
223 echo ' </ul>';
224 echo ' </div>';
226 echo '<div class="group">';
227 echo '<h2>phpMyAdmin</h2>';
228 echo '<ul>';
229 PMA_printListItem($strVersionInformation . ': ' . PMA_VERSION, 'li_pma_version');
230 PMA_printListItem($strDocu, 'li_pma_docs', 'Documentation.html', null, '_blank');
231 PMA_printListItem($strWiki, 'li_pma_wiki', 'http://wiki.cihar.com', null, '_blank');
233 // does not work if no target specified, don't know why
234 PMA_printListItem($strHomepageOfficial, 'li_pma_homepage', 'http://www.phpMyAdmin.net/', null, '_blank');
236 <li><bdo xml:lang="en" dir="ltr">
237 [<a href="changelog.php" target="_blank">ChangeLog</a>]
238 [<a href="http://phpmyadmin.svn.sourceforge.net/viewvc/phpmyadmin/"
239 target="_blank">Subversion</a>]
240 [<a href="http://sourceforge.net/mail/?group_id=23067"
241 target="_blank">Lists</a>]
242 </bdo>
243 </li>
244 </ul>
245 </div>
247 </div>
249 <?php
251 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
252 * full height of the inner divs
255 <br class="clearfloat" />
256 <br class="clearfloat" />
257 </div>
259 <?php
261 * Warning if using the default MySQL privileged account
262 * modified: 2004-05-05 mkkeck
264 if ($server != 0
265 && $cfg['Server']['user'] == 'root'
266 && $cfg['Server']['password'] == '') {
267 trigger_error($strInsecureMySQL, E_USER_WARNING);
271 * Nijel: As we try to handle charsets by ourself, mbstring overloads just
272 * break it, see bug 1063821.
274 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
275 trigger_error($strMbOverloadWarning, E_USER_WARNING);
279 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
280 * to tell user something might be broken without it, see bug #1063149.
282 if (! @extension_loaded('mbstring')) {
283 trigger_error($strMbExtensionMissing, E_USER_WARNING);
287 * Warning about different MySQL library and server version
288 * (a difference on the third digit does not count).
289 * If someday there is a constant that we can check about mysqlnd, we can use it instead
290 * of strpos().
291 * If no default server is set, PMA_DBI_get_client_info() is not defined yet.
293 if (function_exists('PMA_DBI_get_client_info')) {
294 $_client_info = PMA_DBI_get_client_info();
295 if ($server > 0 && strpos($_client_info, 'mysqlnd') === false && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)) {
296 trigger_error(PMA_sanitize(sprintf($strMysqlLibDiffersServerVersion,
297 $_client_info,
298 substr(PMA_MYSQL_STR_VERSION, 0, strpos(PMA_MYSQL_STR_VERSION . '-', '-')))),
299 E_USER_NOTICE);
301 unset($_client_info);
305 * Warning about Suhosin
307 if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_value_length')) {
308 trigger_error(PMA_sanitize(sprintf($strSuhosin, '[a@./Documentation.html#faq1_38@_blank]', '[/a]')), E_USER_WARNING);
312 * prints list item for main page
314 * @param string $name displayed text
315 * @param string $id id, used for css styles
316 * @param string $url make item as link with $url as target
317 * @param string $mysql_help_page display a link to MySQL's manual
318 * @param string $target special target for $url
320 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null)
322 echo '<li id="' . $id . '">';
323 if (null !== $url) {
324 echo '<a href="' . $url . '"';
325 if (null !== $target) {
326 echo ' target="' . $target . '"';
328 echo '>';
331 echo $name;
333 if (null !== $url) {
334 echo '</a>' . "\n";
336 if (null !== $mysql_help_page) {
337 echo PMA_showMySQLDocu('', $mysql_help_page);
339 echo '</li>';
343 * Displays the footer
345 require_once './libraries/footer.inc.php';