Do not use same function name in two contexts.
[phpmyadmin/crack.git] / main.php
blobcc41fca50d3088d9354ca639dcda2d3fe3594e3f
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 if ($cfg['ShowChgPassword']) {
90 PMA_printListItem($strChangePassword, 'li_change_password',
91 './user_password.php?' . $common_url_query);
94 $http_logout = ($cfg['Server']['auth_type'] == 'http')
95 ? '<a href="./Documentation.html#login_bug" target="documentation">'
96 . ($cfg['ReplaceHelpImg'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_info.png" width="11" height="11" alt="Info" />' : '(*)') . '</a>'
97 : '';
98 PMA_printListItem('<strong>' . $strLogout . '</strong> ' . $http_logout,
99 'li_log_out',
100 './index.php?' . $common_url_query . '&amp;old_usr=' . urlencode($PHP_AUTH_USER), null, '_parent');
101 } // end if
102 } // end of if ($server > 0)
104 echo '</ul>';
105 echo '</div>';
109 if ($server > 0) {
110 echo '<div class="group">';
111 echo '<h2>MySQL ' . $short_server_info . '</h2>';
112 echo '<ul>' . "\n";
114 if ($cfg['ShowCreateDb']) {
115 echo '<li id="li_create_database">';
116 require './libraries/display_create_database.lib.php';
117 echo '</li>' . "\n";
120 echo ' <li id="li_select_mysql_collation">';
121 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
122 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
123 . ' <label for="select_collation_connection">' . "\n"
124 . ' ' . $strMySQLConnectionCollation . ': ' . "\n"
125 . ' </label>' . "\n"
126 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
127 . ' <noscript><input type="submit" value="' . $strGo . '" /></noscript>' . "\n"
128 // put the doc link in the form so that it appears on the same line
129 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . "\n"
130 . ' </form>' . "\n"
131 . ' </li>' . "\n";
133 echo ' </ul>';
134 echo ' </div>';
137 echo '<div class="group">';
138 echo '<h2>' . $strInterface . '</h2>';
139 echo ' <ul>';
141 // Displays language selection combo
142 if (empty($cfg['Lang'])) {
143 echo '<li id="li_select_lang">';
144 require_once './libraries/display_select_lang.lib.php';
145 PMA_select_language();
146 echo '</li>';
149 // added by Michael Keck <mail_at_michaelkeck_dot_de>
150 // ThemeManager if available
152 if ($GLOBALS['cfg']['ThemeManager']) {
153 echo '<li id="li_select_theme">';
154 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
155 echo '</li>';
157 <script type="text/javascript">
158 //<![CDATA[
159 document.write('<li id="li_custom_color">');
160 document.write('<?php echo PMA_escapeJsString($strCustomColor) . ': '; ?>');
161 document.write('<img id="myRainbow" src="js/mooRainbow/images/rainbow.png" alt="[r]" width="16" height="16" />');
162 document.write('<form name="rainbowform" id="rainbowform" method="post" action="index.php" target="_parent">');
163 document.write('<?php echo PMA_generate_common_hidden_inputs(); ?>');
164 document.write('<input type="hidden" name="custom_color" />');
165 document.write('<input type="hidden" name="custom_color_rgb" />');
166 document.write('<input type="submit" name="custom_color_reset" value="<?php echo $strReset; ?>" />');
167 document.write('</form>');
168 document.write('</li>');
169 //]]>
170 </script>
171 <?php
173 echo '<li id="li_select_fontsize">';
174 echo PMA_Config::getFontsizeForm();
175 echo '</li>';
177 echo '</ul>';
178 echo '</div>';
181 echo '</div>';
182 echo '<div id="main_pane_right">';
185 if ($server > 0) {
186 echo '<div class="group">';
187 echo '<h2>MySQL</h2>';
188 echo '<ul>' . "\n";
189 PMA_printListItem($strServer . ': ' . $server_info, 'li_server_info');
190 PMA_printListItem($strServerVersion . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_version');
191 if ($GLOBALS['cfg']['ShowServerInfo']) {
192 PMA_printListItem($strProtocolVersion . ': ' . PMA_DBI_get_proto_info(),
193 'li_mysql_proto');
194 PMA_printListItem($strUser . ': ' . htmlspecialchars($mysql_cur_user_and_host),
195 'li_user_info');
198 echo ' <li id="li_select_mysql_charset">';
199 echo ' ' . $strMySQLCharset . ': '
200 . ' <span xml:lang="en" dir="ltr">'
201 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
202 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
203 . ' </span>' . "\n"
204 . ' </li>' . "\n";
205 echo ' </ul>';
206 echo ' </div>';
210 echo '<div class="group">';
211 echo '<h2>' . $strWebServer . '</h2>';
212 echo '<ul>';
213 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
215 if ($server > 0) {
216 PMA_printListItem($strMysqlClientVersion . ': ' . PMA_DBI_get_client_info(),
217 'li_mysql_client_version');
218 PMA_printListItem($strPHPExtension . ': ' . $GLOBALS['cfg']['Server']['extension'],
219 'li_used_php_extension');
222 if ($cfg['ShowPhpInfo']) {
223 PMA_printListItem($strShowPHPInfo, 'li_phpinfo', './phpinfo.php?' . $common_url_query);
225 echo ' </ul>';
226 echo ' </div>';
228 echo '<div class="group">';
229 echo '<h2>phpMyAdmin</h2>';
230 echo '<ul>';
231 PMA_printListItem($strVersionInformation . ': ' . PMA_VERSION, 'li_pma_version');
232 PMA_printListItem($strDocu, 'li_pma_docs', 'Documentation.html', null, '_blank');
233 PMA_printListItem($strWiki, 'li_pma_wiki', 'http://wiki.cihar.com', null, '_blank');
235 // does not work if no target specified, don't know why
236 PMA_printListItem($strHomepageOfficial, 'li_pma_homepage', 'http://www.phpMyAdmin.net/', null, '_blank');
238 <li><bdo xml:lang="en" dir="ltr">
239 [<a href="changelog.php" target="_blank">ChangeLog</a>]
240 [<a href="http://phpmyadmin.svn.sourceforge.net/viewvc/phpmyadmin/"
241 target="_blank">Subversion</a>]
242 [<a href="http://sourceforge.net/mail/?group_id=23067"
243 target="_blank">Lists</a>]
244 </bdo>
245 </li>
246 </ul>
247 </div>
249 </div>
251 <?php
253 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
254 * full height of the inner divs
257 <br class="clearfloat" />
258 <br class="clearfloat" />
259 </div>
261 <?php
263 * Warning if using the default MySQL privileged account
264 * modified: 2004-05-05 mkkeck
266 if ($server != 0
267 && $cfg['Server']['user'] == 'root'
268 && $cfg['Server']['password'] == '') {
269 trigger_error($strInsecureMySQL, E_USER_WARNING);
273 * Nijel: As we try to handle charsets by ourself, mbstring overloads just
274 * break it, see bug 1063821.
276 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
277 trigger_error($strMbOverloadWarning, E_USER_WARNING);
281 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
282 * to tell user something might be broken without it, see bug #1063149.
284 if (! @extension_loaded('mbstring')) {
285 trigger_error($strMbExtensionMissing, E_USER_WARNING);
289 * Check if user does not have defined blowfish secret and it is being used.
291 if (!empty($_SESSION['auto_blowfish_secret']) &&
292 empty($GLOBALS['cfg']['blowfish_secret'])) {
293 trigger_error($strSecretRequired, E_USER_WARNING);
297 * Warning about different MySQL library and server version
298 * (a difference on the third digit does not count).
299 * If someday there is a constant that we can check about mysqlnd, we can use it instead
300 * of strpos().
301 * If no default server is set, PMA_DBI_get_client_info() is not defined yet.
303 if (function_exists('PMA_DBI_get_client_info')) {
304 $_client_info = PMA_DBI_get_client_info();
305 if ($server > 0 && strpos($_client_info, 'mysqlnd') === false && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)) {
306 trigger_error(PMA_sanitize(sprintf($strMysqlLibDiffersServerVersion,
307 $_client_info,
308 substr(PMA_MYSQL_STR_VERSION, 0, strpos(PMA_MYSQL_STR_VERSION . '-', '-')))),
309 E_USER_NOTICE);
311 unset($_client_info);
315 * Warning about Suhosin
317 if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_value_length')) {
318 trigger_error(PMA_sanitize(sprintf($strSuhosin, '[a@./Documentation.html#faq1_38@_blank]', '[/a]')), E_USER_WARNING);
322 * prints list item for main page
324 * @param string $name displayed text
325 * @param string $id id, used for css styles
326 * @param string $url make item as link with $url as target
327 * @param string $mysql_help_page display a link to MySQL's manual
328 * @param string $target special target for $url
330 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null)
332 echo '<li id="' . $id . '">';
333 if (null !== $url) {
334 echo '<a href="' . $url . '"';
335 if (null !== $target) {
336 echo ' target="' . $target . '"';
338 echo '>';
341 echo $name;
343 if (null !== $url) {
344 echo '</a>' . "\n";
346 if (null !== $mysql_help_page) {
347 echo PMA_showMySQLDocu('', $mysql_help_page);
349 echo '</li>';
353 * Displays the footer
355 require_once './libraries/footer.inc.php';