2.11.11.2 release
[phpmyadmin/madhuracj.git] / scripts / setup.php
blob49dd67bd18c32ba096814aeeb038e770a6c545b2
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * phpMyAdmin setup script
6 * PHP versions 4 and 5
8 * @category Setup
9 * @package phpMyAdmin-setup
10 * @author Michal Čihař <michal@cihar.com>
11 * @copyright 2006 Michal Čihař <michal@cihar.com>
12 * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
13 * @version $Id$
16 // Grab phpMyAdmin version and PMA_dl function
17 define('PMA_MINIMUM_COMMON', TRUE);
18 define('PMA_SETUP', TRUE);
19 chdir('..');
20 require_once './libraries/common.inc.php';
22 // Grab configuration defaults
23 // Do not use $PMA_Config, it interferes with the one in $_SESSION
24 // on servers with register_globals enabled
25 $PMA_Config_Setup = new PMA_Config();
27 // Script information
28 $script_info = 'phpMyAdmin ' . $PMA_Config_Setup->get('PMA_VERSION') . ' setup script by Michal Čihař <michal@cihar.com>';
29 $script_version = '$Id$';
31 // Grab action
32 if (isset($_POST['action'])) {
33 $action = $_POST['action'];
34 } else {
35 $action = '';
38 // Grab wanted CRLF type
39 if (isset($_POST['eoltype'])) {
40 $_SESSION['eoltype'] = $_POST['eoltype'];
41 } else {
42 if (PMA_USR_OS == 'Win') {
43 $_SESSION['eoltype'] = 'dos';
44 } else {
45 $_SESSION['eoltype'] = 'unix';
49 // Detect which CRLF to use
50 if ($_SESSION['eoltype'] == 'dos') {
51 $crlf = "\r\n";
52 } elseif ($_SESSION['eoltype'] == 'mac') {
53 $crlf = "\r";
54 } else {
55 $crlf = "\n";
58 if (!isset($_SESSION['configuration']) || $action == 'clear') {
59 // Create empty configuration
60 $_SESSION['configuration'] = array();
63 // We rely on Servers array to exist, so create it here
64 if (!isset($_SESSION['configuration']['Servers']) || !is_array($_SESSION['configuration']['Servers'])) {
65 $_SESSION['configuration']['Servers'] = array();
68 // Used later
69 $now = gmdate('D, d M Y H:i:s') . ' GMT';
71 // General header for no caching
72 header('Expires: ' . $now); // rfc2616 - Section 14.21
73 header('Last-Modified: ' . $now);
74 header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
75 header('Pragma: no-cache'); // HTTP/1.0
77 // whether to show html header?
78 if ($action != 'download') {
80 // Define the charset to be used
81 header('Content-Type: text/html; charset=utf-8');
83 // this needs to be echoed otherwise php with short tags complains
84 echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
86 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
87 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
88 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
89 <head>
90 <link rel="icon" href="../favicon.ico" type="image/x-icon" />
91 <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
92 <title>phpMyAdmin <?php echo $PMA_Config_Setup->get('PMA_VERSION'); ?> setup</title>
93 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
95 <script type="text/javascript">
96 //<![CDATA[
97 // show this window in top frame
98 if (top != self) {
99 window.top.location.href=location;
101 //]]>
102 </script>
103 <style type="text/css">
104 /* message boxes: warning, error, stolen from original theme */
105 div.notice {
106 color: #000000;
107 background-color: #FFFFDD;
109 h1.notice,
110 div.notice {
111 margin: 0.5em 0 0.5em 0;
112 border: 0.1em solid #FFD700;
113 background-image: url(../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/s_notice.png);
114 background-repeat: no-repeat;
115 background-position: 10px 50%;
116 padding: 10px 10px 10px 36px;
118 div.notice h1 {
119 border-bottom: 0.1em solid #FFD700;
120 font-weight: bold;
121 font-size: large;
122 text-align: left;
123 margin: 0 0 0.2em 0;
126 div.warning {
127 color: #CC0000;
128 background-color: #FFFFCC;
130 h1.warning,
131 div.warning {
132 margin: 0.5em 0 0.5em 0;
133 border: 0.1em solid #CC0000;
134 background-image: url(../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/s_warn.png);
135 background-repeat: no-repeat;
136 background-position: 10px 50%;
137 padding: 10px 10px 10px 36px;
139 div.warning h1 {
140 border-bottom: 0.1em solid #cc0000;
141 font-weight: bold;
142 text-align: left;
143 font-size: large;
144 margin: 0 0 0.2em 0;
147 div.error {
148 background-color: #FFFFCC;
149 color: #ff0000;
151 h1.error,
152 div.error {
153 margin: 0.5em 0 0.5em 0;
154 border: 0.1em solid #ff0000;
155 background-image: url(../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/s_error.png);
156 background-repeat: no-repeat;
157 background-position: 10px 50%;
158 padding: 10px 10px 10px 36px;
160 div.error h1 {
161 border-bottom: 0.1em solid #ff0000;
162 font-weight: bold;
163 text-align: left;
164 font-size: large;
165 margin: 0 0 0.2em 0;
168 fieldset.toolbar form.action {
169 display: block;
170 width: auto;
171 clear: none;
172 float: left;
173 margin: 0;
174 padding: 0;
175 border-right: 1px solid black;
177 fieldset.toolbar form.action input, fieldset.toolbar form.action select {
178 margin: 0.7em;
179 padding: 0.1em;
182 fieldset.toolbar {
183 display: block;
184 width: 100%;
185 background-color: #dddddd;
186 padding: 0;
188 fieldset.optbox {
189 padding: 0;
190 background-color: #FFFFDD;
192 div.buttons, div.opts, fieldset.optbox p, fieldset.overview div.row {
193 clear: both;
194 padding: 0.5em;
195 margin: 0;
196 background-color: white;
198 div.opts, fieldset.optbox p, fieldset.overview div.row {
199 border-bottom: 1px dotted black;
201 fieldset.overview {
202 display: block;
203 width: 100%;
204 padding: 0;
206 fieldset.optbox p {
207 background-color: #FFFFDD;
209 div.buttons {
210 background-color: #dddddd;
212 div.buttons input {
213 margin: 0 1em 0 1em;
215 div.buttons form {
216 display: inline;
217 margin: 0;
218 padding: 0;
220 input.save {
221 color: green;
222 font-weight: bolder;
224 input.cancel {
225 color: red;
226 font-weight: bolder;
228 div.desc, label.desc, fieldset.overview div.desc {
229 float: left;
230 width: 27em;
231 max-width: 60%;
233 code:before, code:after {
234 content: '"';
236 span.doc {
237 margin: 0 1em 0 1em;
239 span.doc a {
240 margin: 0 0.1em 0 0.1em;
242 span.doc a img {
243 border: none;
245 </style>
246 </head>
248 <body>
249 <h1>phpMyAdmin <?php echo $PMA_Config_Setup->get('PMA_VERSION'); ?> setup</h1>
250 <?php
251 } // end show html header
254 * Calculates numerical equivalent of phpMyAdmin version string
256 * @param string version
258 * @return mixed FALSE on failure, integer on success
260 function version_to_int($version) {
261 if (!preg_match('/^(\d+)\.(\d+)\.(\d+)((\.|-(pl|rc|dev|beta|alpha))(\d+)?)?$/', $version, $matches)) {
262 return FALSE;
264 if (!empty($matches[6])) {
265 switch ($matches[6]) {
266 case 'pl':
267 $added = 60;
268 break;
269 case 'rc':
270 $added = 30;
271 break;
272 case 'beta':
273 $added = 20;
274 break;
275 case 'alpha':
276 $added = 10;
277 break;
278 case 'dev':
279 $added = 0;
280 break;
281 default:
282 message('notice', 'Unknown version part: ' . htmlspecialchars($matches[5]));
283 $added = 0;
284 break;
286 } else {
287 $added = 50; // for final
289 if (!empty($matches[7])) {
290 $added = $added + $matches[7];
292 return $matches[1] * 1000000 + $matches[2] * 10000 + $matches[3] * 100 + $added;
296 * Returns link to documentation of some configuration directive
298 * @param string confguration directive name
300 * @return string HTML link to documentation
302 function get_cfg_doc($anchor) {
303 /* Link for wiki */
304 $wiki = $anchor;
305 if (strncmp($anchor, 'Servers_', 8) == 0) {
306 $wiki = substr($anchor, 8);
308 return
309 '<span class="doc">' .
310 '<a href="../Documentation.html#cfg_' . $anchor . '" target="pma_doc" class="doc">' .
311 '<img class="icon" src="../' . $GLOBALS['cfg']['ThemePath'] . '/original/img/b_help.png" width="11" height="11" alt="Documentation" title="Documentation" />' .
312 '</a>' .
313 '<a href="http://wiki.phpmyadmin.net/pma/Config#' . $wiki . '" target="pma_doc" class="doc">' .
314 '<img class="icon" src="../' . $GLOBALS['cfg']['ThemePath'] . '/original/img/b_info.png" width="11" height="11" alt="Wiki" title="Wiki" />' .
315 '</a>' .
316 '</span>'
321 * Displays message
323 * @param string type of message (notice/warning/error)
324 * @param string text of message
325 * @param title optional title of message
327 * @return nothing
329 function message($type, $text, $title = '') {
330 echo '<div class="' . $type . '">' . "\n";
331 if (!empty($title)) {
332 echo '<h1>';
333 echo $title;
334 echo '</h1>' . "\n";
336 echo $text . "\n";
337 echo '</div>' . "\n";
341 * Returns needed hidden input for forms.
343 * @return string HTML with hidden inputs
345 function get_hidden_inputs() {
346 return '<input type="hidden" name="token" value="' . $_SESSION[' PMA_token '] . '" />';
350 * Creates form for some action
352 * @param string action name
353 * @param string form title
354 * @param string optional additional inputs
356 * @return string HTML with form
358 function get_action($name, $title, $added = '', $enabled = TRUE) {
359 $ret = '';
360 $ret .= '<form class="action" method="post" action="">';
361 $ret .= get_hidden_inputs();
362 $ret .= '<input type="hidden" name="action" value="' . $name . '" />';
363 $ret .= $added;
364 $ret .= '<input type="submit" value="' . $title . '"';
365 if (!$enabled) {
366 $ret .= ' disabled="disabled"';
368 $ret .= ' />';
369 $ret .= '</form>';
370 $ret .= "\n";
371 return $ret;
375 * Creates form for going to some url
377 * @param string URL where to go
378 * @param string form title
379 * @param string optional array of parameters
381 * @return string HTML with form
383 function get_url_action($url, $title, $params = array()) {
384 $ret = '';
385 $ret .= '<form class="action" method="get" action="' . $url . '" target="_blank">';
386 $ret .= get_hidden_inputs();
387 foreach ($params as $key => $val) {
388 $ret .= '<input type="hidden" name="' . $key . '" value="' . $val . '" />';
390 $ret .= '<input type="submit" value="' . $title . '" />';
391 $ret .= '</form>';
392 $ret .= "\n";
393 return $ret;
397 * Terminates script and ends HTML
399 * @return nothing
401 function footer() {
402 echo '</body>';
403 echo '</html>';
404 exit;
408 * Creates string describing server authentication method
410 * @param array server configuration
412 * @return string authentication method description
414 function get_server_auth($val) {
415 global $PMA_Config_Setup;
417 if (isset($val['auth_type'])) {
418 $auth = $val['auth_type'];
419 } else {
420 $auth = $PMA_Config_Setup->default_server['auth_type'];
422 $ret = $auth;
423 if ($auth == 'config') {
424 if (isset($val['user'])) {
425 $ret .= ':' . $val['user'];
426 } else {
427 $ret .= ':' . $PMA_Config_Setup->default_server['user'];
430 return $ret;
434 * Creates nice string with server name
436 * @param array server configuration
437 * @param int optional server id
439 * @return string fancy server name
441 function get_server_name($val, $id = FALSE, $escape = true) {
442 if (!empty($val['verbose'])) {
443 $ret = $val['verbose'];
444 } else {
445 $ret = $val['host'];
447 $ret .= ' (' . get_server_auth($val) . ')';
448 if ($id !== FALSE) {
449 $ret .= ' [' . ($id + 1) . ']' ;
451 if ($escape) {
452 return htmlspecialchars($ret);
453 } else {
454 return $ret;
460 * Exports variable to PHP code, very limited version of var_export
462 * @param string data to export
464 * @see var_export
466 * @return string PHP code containing variable value
468 function PMA_var_export($input) {
469 global $crlf;
471 $output = '';
472 if (is_null($input)) {
473 $output .= 'NULL';
474 } elseif (is_array($input)) {
475 $output .= 'array (' . $crlf;
476 foreach($input as $key => $value) {
477 $output .= PMA_var_export($key) . ' => ' . PMA_var_export($value);
478 $output .= ',' . $crlf;
480 $output .= ')';
481 } elseif (is_string($input)) {
482 $output .= '\'' . addslashes($input) . '\'';
483 } elseif (is_int($input) || is_double($input)) {
484 $output .= (string) $input;
485 } elseif (is_bool($input)) {
486 $output .= $input ? 'true' : 'false';
487 } else {
488 die('Unknown type for PMA_var_export: ' . $input);
490 return $output;
494 * Creates configuration code for one variable
496 * @param string variable name
497 * @param mixed configuration
499 * @return string PHP code containing configuration
501 function get_cfg_val($name, $val) {
502 global $crlf;
504 $ret = '';
505 if (is_array($val)) {
506 $ret .= $crlf;
507 foreach ($val as $k => $v) {
508 if (!isset($type)) {
509 if (is_string($k)) {
510 $type = 'string';
511 } elseif (is_int($k)) {
512 $type = 'int';
513 $ret .= $name . ' = array(' . $crlf;
514 } else {
515 // Something unknown...
516 $ret .= $name. ' = ' . PMA_var_export($val) . ';' . $crlf;
517 break;
520 if ($type == 'string') {
521 $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
522 $ret .= get_cfg_val($name . "['$k']", $v);
523 } elseif ($type == 'int') {
524 $ret .= ' ' . PMA_var_export($v) . ',' . $crlf;
527 if (!isset($type)) {
528 /* Empty array */
529 $ret .= $name . ' = array();' . $crlf;
530 } elseif ($type == 'int') {
531 $ret .= ');' . $crlf;
533 $ret .= $crlf;
534 unset($type);
535 } else {
536 $ret .= $name . ' = ' . PMA_var_export($val) . ';' . $crlf;
538 return $ret;
542 * Creates configuration PHP code
544 * @param array configuration
546 * @return string PHP code containing configuration
548 function get_cfg_string($cfg) {
549 global $script_info, $script_version, $now, $crlf;
551 $c = $cfg;
552 $ret = "<?php$crlf/*$crlf * Generated configuration file$crlf * Generated by: $script_info$crlf * Version: $script_version$crlf * Date: " . $now . $crlf . ' */' . $crlf . $crlf;
554 if (count($c['Servers']) > 0) {
555 $ret .= "/* Servers configuration */$crlf\$i = 0;" . $crlf;
556 foreach ($c['Servers'] as $cnt => $srv) {
557 $ret .= $crlf . '/* Server ' . strtr(get_server_name($srv, $cnt, false), '*', '-') . " */$crlf\$i++;" . $crlf;
558 foreach ($srv as $key => $val) {
559 $key = preg_replace('/[^A-Za-z0-9_]/', '_', $key);
560 $ret .= get_cfg_val("\$cfg['Servers'][\$i]['$key']", $val);
563 $ret .= $crlf . '/* End of servers configuration */' . $crlf . $crlf;
565 unset($c['Servers']);
567 foreach ($c as $key => $val) {
568 $key = preg_replace('/[^A-Za-z0-9_]/', '_', $key);
569 $ret .= get_cfg_val("\$cfg['$key']", $val);
572 $ret .= '?>' . $crlf;
573 return $ret;
577 * Compresses server configuration to be indexed from 0 and contain no gaps
579 * @param array configuration
581 * @return nothing
583 function compress_servers(&$cfg) {
584 $ns = array();
585 foreach ($cfg['Servers'] as $val) {
586 if (!empty($val['host'])) {
587 $ns[] = $val;
590 $cfg['Servers'] = $ns;
594 * Grabs values from POST
596 * @param string list of values to grab, values are separated by ";",
597 * each can have defined type separated by ":", if no type
598 * is defined, string is assumed. Possible types: bool -
599 * boolean value, allow-deny - allow-deny rules, int -
600 * integer, tristate - "TRUE"/"FALSE" converted to bool,
601 * other strings are kept.
603 * @return array array with grabbed values
605 function grab_values($list)
607 $a = split(';', $list);
608 $res = array();
609 foreach ($a as $val) {
610 $v = split(':', $val);
611 if (!isset($v[1])) {
612 $v[1] = '';
614 switch($v[1]) {
615 case 'bool':
616 $res[$v[0]] = isset($_POST[$v[0]]);
617 break;
618 case 'allow-deny':
619 $res[$v[0]] = array();
620 if (isset($_POST[$v[0] . '_order']) && strlen($_POST[$v[0] . '_order']) > 0) {
621 $res[$v[0]]['order'] = $_POST[$v[0]];
622 } else {
623 $res[$v[0]]['order'] = '';
625 if (isset($_POST[$v[0] . '_rules']) && strlen($_POST[$v[0] . '_rules']) > 0) {
626 $res[$v[0]]['rules'] = split('|', $_POST[$v[0]]);
627 } else {
628 $res[$v[0]]['rules'] = array();
630 break;
631 case 'int':
632 if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) {
633 $res[$v[0]] = (int)$_POST[$v[0]];
635 break;
636 case 'tristate':
637 if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) {
638 $cur = $_POST[$v[0]];
639 if ($cur == 'TRUE') {
640 $res[$v[0]] = TRUE;
641 } elseif ($cur == 'FALSE') {
642 $res[$v[0]] = FALSE;
643 } else {
644 $res[$v[0]] = $cur;
647 break;
648 case 'string':
649 default:
650 if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) {
651 $res[$v[0]] = $_POST[$v[0]];
653 break;
656 return $res;
660 * Displays overview
662 * @param string title of oveview
663 * @param array list of values to display (each element is array of two
664 * values - name and value)
665 * @param string optional buttons to be displayed
667 * @return nothing
669 function show_overview($title, $list, $buttons = '') {
670 echo '<fieldset class="overview">' . "\n";
671 echo '<legend>' . $title . '</legend>' . "\n";
672 foreach ($list as $val) {
673 echo '<div class="row">';
674 echo '<div class="desc">';
675 echo $val[0];
676 echo '</div>';
677 echo '<div class="data">';
678 echo htmlspecialchars($val[1]);
679 echo '</div>';
680 echo '</div>' . "\n";
682 if (!empty($buttons)) {
683 echo '<div class="buttons">';
684 echo '<div class="desc">Actions:</div>';
685 echo $buttons;
686 echo '</div>' . "\n";
688 echo '</fieldset>' . "\n";
689 echo "\n";
693 * Displays configuration, fallback defaults are taken from global $PMA_Config_Setup
695 * @param array list of values to display (each element is array of two or
696 * three values - desription, name and optional type
697 * indicator). Type is determined by type of this parameter,
698 * array means select and array elements are items,
699 * 'password' means password input.
700 * @param string title of configuration
701 * @param string help string for this configuration
702 * @param array optional first level defaults
703 * @param string optional title for save button
704 * @param string optional prefix for documentation links
706 * @return nothing
708 function show_config_form($list, $legend, $help, $defaults = array(), $save = '', $prefix = '') {
709 global $PMA_Config_Setup;
711 if (empty($save)) {
712 $save = 'Update';
715 echo '<fieldset class="optbox">' . "\n";
716 echo '<legend>' . $legend . '</legend>' . "\n";
717 echo '<p>' . $help . '</p>' . "\n";
718 foreach ($list as $val) {
719 echo '<div class="opts">';
720 $type = 'text';
721 if (isset($val[3])) {
722 if (is_array($val[3])) {
723 $type = 'select';
724 } elseif (is_bool($val[3])) {
725 $type = 'check';
726 } elseif ($val[3] == 'password') {
727 $type = 'password';
730 switch ($type) {
731 case 'text':
732 case 'password':
733 echo '<label for="text_' . $val[1] . '" class="desc" title="' . $val[2] . '">' . $val[0] . get_cfg_doc($prefix . $val[1]) . '</label>';
734 echo '<input type="' . $type . '" name="' . $val[1] . '" id="text_' . $val[1] . '" title="' . $val[2] . '" size="50"';
735 if (isset($defaults[$val[1]])) {
736 echo ' value="' . htmlspecialchars($defaults[$val[1]]) . '"';
737 } else {
738 echo ' value="' . htmlspecialchars($PMA_Config_Setup->get($val[1])) . '"';
740 echo ' />';
741 break;
742 case 'check':
743 echo '<input type="checkbox" name="' . $val[1] . '" value="something" id="checkbox_' . $val[1] . '" title="' . $val[2] . '"';
744 if (isset($defaults[$val[1]])) {
745 if ($defaults[$val[1]]) {
746 echo ' checked="checked"';
748 } else {
749 if ($PMA_Config_Setup->get($val[1])) {
750 echo ' checked="checked"';
753 echo ' />';
754 echo '<label for="checkbox_' . $val[1] . '" title="' . $val[2] . '">' . $val[0] . get_cfg_doc($prefix . $val[1]) . '</label>';
755 break;
756 case 'select':
757 echo '<label for="select_' . $val[1] . '" class="desc" title="' . $val[2] . '">' . $val[0] . get_cfg_doc($prefix . $val[1]) . '</label>';
758 echo '<select name="' . $val[1] . '" id="select_' . $val[1] . '" ' . ' title="' . $val[2] . '">';
759 foreach ($val[3] as $opt) {
760 echo '<option value="' . $opt . '"';
761 if (isset($defaults[$val[1]])) {
762 if (is_bool($defaults[$val[1]])) {
763 if (($defaults[$val[1]] && $opt == 'TRUE') || (!$defaults[$val[1]] && $opt == 'FALSE')) {
764 echo ' selected="selected"';
766 } else {
767 if ($defaults[$val[1]] == $opt) {
768 echo ' selected="selected"';
771 } else {
772 $def_val = $PMA_Config_Setup->get($val[1]);
773 if (is_bool($val)) {
774 if (($def_val && $opt == 'TRUE') || (!$def_val && $opt == 'FALSE')) {
775 echo ' selected="selected"';
777 } else {
778 if ($def_val == $opt) {
779 echo ' selected="selected"';
782 unset($def_val);
784 echo '>' . $opt . '</option>';
786 echo '</select>';
787 break;
789 echo '</div>' . "\n";
791 echo '<div class="buttons">';
792 echo '<div class="desc">Actions:</div>';
793 echo '<input type="submit" name="submit_save" value="' . $save .'" class="save" />';
794 echo '<input type="submit" name="submit_ignore" value="Cancel" class="cancel" />';
795 echo '</div>' . "\n";
796 echo '</fieldset>' . "\n";
797 echo "\n";
801 * Shows security options configuration form
803 * @param array optional defaults
805 * @return nothing
807 function show_security_form($defaults = array()) {
809 <form method="post" action="">
810 <?php echo get_hidden_inputs();?>
811 <input type="hidden" name="action" value="feat_security_real" />
812 <?php
813 show_config_form(array(
814 array('Blowfish secret', 'blowfish_secret', 'Secret passphrase used for encrypting cookies'),
815 array('Force SSL connection', 'ForceSSL', 'Whether to force using secured connection while using phpMyAdmin', FALSE),
816 array('Show phpinfo output', 'ShowPhpInfo', 'Whether to allow users to see phpinfo() output', FALSE),
817 array('Show password change form', 'ShowChgPassword', 'Whether to show form for changing password, this does not limit ability to execute the same command directly', FALSE),
818 array('Allow login to any MySQL server', 'AllowArbitraryServer', 'If enabled user can enter any MySQL server in login form for cookie auth.', FALSE),
819 array('Recall user name', 'LoginCookieRecall', 'Whether to recall user name on log in prompt while using cookie auth.', TRUE),
820 array('Login cookie validity', 'LoginCookieValidity', 'How long is login valid without performing any action.'),
822 'Configure security features',
823 'Please note that phpMyAdmin is just a user interface and it\'s features do not limit MySQL.',
824 $defaults);
826 </form>
827 <?php
831 * Shows MySQL manual configuration form
833 * @param array optional defaults
835 * @return nothing
837 function show_manual_form($defaults = array()) {
839 <form method="post" action="">
840 <?php echo get_hidden_inputs();?>
841 <input type="hidden" name="action" value="feat_manual_real" />
842 <?php
843 show_config_form(array(
844 array('Type of MySQL documentation', 'MySQLManualType', 'These types are same as listed on MySQL download page', array('viewable', 'chapters', 'big', 'none')),
845 array('Base URL of MySQL documentation', 'MySQLManualBase', 'Where is MySQL documentation placed, this is usually top level directory.'),
847 'Configure MySQL manual links',
848 'If you have local copy of MySQL documentation, you might want to use it in documentation links. Otherwise use <code>viewable</code> type and <code>http://dev.mysql.com/doc/refman</code> as manual base URL.',
849 $defaults);
851 </form>
852 <?php
856 * Shows charset options configuration form
858 * @param array optional defaults
860 * @return nothing
862 function show_charset_form($defaults = array()) {
863 global $PMA_Config_Setup;
865 <form method="post" action="">
866 <?php echo get_hidden_inputs();?>
867 <input type="hidden" name="action" value="feat_charset_real" />
868 <?php
869 show_config_form(array(
870 array('Allow charset conversion', 'AllowAnywhereRecoding', 'If you want to use such functions.', FALSE),
871 array('Default charset', 'DefaultCharset', 'Default charset for conversion.', $PMA_Config_Setup->get('AvailableCharsets')),
872 array('Recoding engine', 'RecodingEngine', 'PHP can contain iconv and/or recode, select which one to use or keep autodetection.', array('auto', 'iconv', 'recode')),
873 array('Extra params for iconv', 'IconvExtraParams', 'Iconv can get some extra parameters for conversion see man iconv_open.'),
875 'Configure charset conversions',
876 'phpMyAdmin can perform charset conversions so that you can import and export in any charset you want.',
877 $defaults);
879 </form>
880 <?php
884 * Shows PHP extensions configuration form
886 * @param array optional defaults
888 * @return nothing
890 function show_extensions_form($defaults = array()) {
892 <form method="post" action="">
893 <?php echo get_hidden_inputs();?>
894 <input type="hidden" name="action" value="feat_extensions_real" />
895 <?php
896 show_config_form(array(
897 array('GD 2 is available', 'GD2Available', 'Whether you have GD 2 or newer installed', array('auto', 'yes', 'no')),
899 'Configure extensions',
900 'phpMyAdmin can use several extensions, however here are configured only those that didn\'t fit elsewhere. MySQL extension is configured within server, charset conversion one on separate charsets page.',
901 $defaults);
903 </form>
904 <?php
908 * Shows MIME/relation/history configuration form
910 * @param array optional defaults
912 * @return nothing
914 function show_relation_form($defaults = array()) {
915 global $PMA_Config_Setup;
917 <form method="post" action="">
918 <?php echo get_hidden_inputs();?>
919 <input type="hidden" name="action" value="feat_relation_real" />
920 <?php
921 show_config_form(array(
922 array('Permanent query history', 'QueryHistoryDB', 'Store history into database.', FALSE),
923 array('Maximal history size', 'QueryHistoryMax', 'How many queries are kept in history.'),
924 array('Use MIME transformations', 'BrowseMIME', 'Use MIME transformations while browsing.', TRUE),
925 array('PDF default page size', 'PDFDefaultPageSize', 'Default page size for PDF, you can change this while creating page.', $PMA_Config_Setup->get('PDFPageSizes')),
927 'Configure MIME/relation/history',
928 'phpMyAdmin can provide additional features like MIME transformation, internal relations, permanent history and PDF pages generation. You have to configure the database and tables that will store this information on the server page. Behaviour of those functions is configured here.',
929 $defaults);
931 </form>
932 <?php
936 * Shows upload/save configuration form
938 * @param array optional defaults
940 * @return nothing
942 function show_upload_form($defaults = array()) {
944 <form method="post" action="">
945 <?php echo get_hidden_inputs();?>
946 <input type="hidden" name="action" value="feat_upload_real" />
947 <?php
948 show_config_form(array(
949 array('Upload directory', 'UploadDir', 'Directory on server where you can upload files for import'),
950 array('Save directory', 'SaveDir', 'Directory where exports can be saved on server'),
952 'Configure upload/save directories',
953 'Enter directories, either absolute path or relative to phpMyAdmin top level directory.',
954 $defaults);
956 </form>
957 <?php
961 * Shows server configuration form
963 * @param array optional defaults
965 * @return nothing
967 function show_server_form($defaults = array(), $number = FALSE) {
969 <form method="post" action="">
970 <?php echo get_hidden_inputs();?>
971 <input type="hidden" name="action" value="addserver_real" />
972 <?php
973 if (!($number === FALSE)) {
974 echo '<input type="hidden" name="server" value="' . $number . '" />';
976 $hi = array ('bookmarktable', 'relation', 'table_info', 'table_coords', 'pdf_pages', 'column_info', 'designer_coords', 'history');
977 foreach ($hi as $k) {
978 if (isset($defaults[$k]) && is_string($defaults[$k]) && strlen($defaults[$k]) > 0) {
979 echo '<input type="hidden" name="' . $k . '" value="' . htmlspecialchars($defaults[$k]) . '" />';
982 if (isset($defaults['AllowDeny'])) {
983 if (isset($defaults['AllowDeny']['order']) && is_string($defaults['AllowDeny']['order']) && strlen($defaults['AllowDeny']['order']) > 0) {
984 echo '<input type="hidden" name="AllowDeny_rules" value="' . htmlspecialchars($defaults['AllowDeny']['order']) . '" />';
986 if (isset($defaults['AllowDeny']['rules']) && is_array($defaults['AllowDeny']['rules']) && count($defaults['AllowDeny']['rules']) > 0) {
987 echo '<input type="hidden" name="AllowDeny_rules" value="' . htmlspecialchars(implode('|', $defaults['AllowDeny']['rules'])) . '" />';
990 show_config_form(array(
991 array('Server hostname', 'host', 'Hostname where MySQL server is running'),
992 array('Server port', 'port', 'Port on which MySQL server is listening, leave empty for default'),
993 array('Server socket', 'socket', 'Socket on which MySQL server is listening, leave empty for default'),
994 array('Connection type', 'connect_type', 'How to connect to server, keep tcp if unsure', array('tcp', 'socket')),
995 array('PHP extension to use', 'extension', 'What PHP extension to use, use mysqli if supported', array('mysql', 'mysqli')),
996 array('Compress connection', 'compress', 'Whether to compress connection to MySQL server', FALSE),
997 array('Authentication type', 'auth_type', 'Authentication method to use', array('cookie', 'http', 'config', 'signon')),
998 array('User for config auth', 'user', 'Leave empty if not using config auth'),
999 array('Password for config auth', 'password', 'Leave empty if not using config auth', 'password'),
1000 array('Only database to show', 'only_db', 'Limit listing of databases in left frame to this one'),
1001 array('Verbose name of this server', 'verbose', 'Name to display in server selection'),
1002 array('phpMyAdmin control user', 'controluser', 'User which phpMyAdmin can use for various actions'),
1003 array('phpMyAdmin control user password', 'controlpass', 'Password for user which phpMyAdmin can use for various actions', 'password'),
1004 array('phpMyAdmin database for advanced features', 'pmadb', 'phpMyAdmin will allow much more when you enable this. Table names are filled in automatically.'),
1005 array('Session name for signon auth', 'SignonSession', 'Leave empty if not using signon auth'),
1006 array('Login URL for signon auth', 'SignonURL', 'Leave empty if not using signon auth'),
1007 array('Logout URL', 'LogoutURL', 'Where to redirect user after logout'),
1009 'Configure server',
1010 ($number === FALSE) ? 'Enter new server connection parameters.' : 'Editing server ' . get_server_name($defaults, $number),
1011 $defaults, $number === FALSE ? 'Add' : '', 'Servers_');
1013 </form>
1014 <?php
1018 * Shows left frame configuration form
1020 * @param array optional defaults
1022 * @return nothing
1024 function show_left_form($defaults = array()) {
1026 <form method="post" action="">
1027 <?php echo get_hidden_inputs();?>
1028 <input type="hidden" name="action" value="lay_navigation_real" />
1029 <?php
1030 show_config_form(array(
1031 array('Use light version', 'LeftFrameLight', 'Disable this if you want to see all databases at one time.', TRUE),
1032 array('Display databases in tree', 'LeftFrameDBTree', 'Whether to display databases in tree (determined by separator defined lower)', TRUE),
1033 array('Databases tree separator', 'LeftFrameDBSeparator', 'String that separates databases into different tree level'),
1034 array('Table tree separator', 'LeftFrameTableSeparator', 'String that separates tables into different tree level'),
1035 array('Maximum table tree nesting', 'LeftFrameTableLevel', 'Maximum number of children in table tree'),
1036 array('Show logo', 'LeftDisplayLogo', 'Whether to show logo in left frame', TRUE),
1037 array('Display servers selection', 'LeftDisplayServers', 'Whether to show server selection in left frame', FALSE),
1038 array('Display servers as list', 'DisplayServersList', 'Whether to show server listing as list instead of drop down', FALSE),
1039 array('Display databases as list', 'DisplayDatabasesList', 'Whether to show database listing in navigation as list instead of drop down', array('auto', 'yes', 'no')),
1040 array('Enable pointer highlighting', 'LeftPointerEnable', 'Whether you want to highlight server under mouse', TRUE),
1042 'Configure navigation frame',
1043 'Customize the appears of the navigation frame.',
1044 $defaults);
1046 </form>
1047 <?php
1051 * Shows tabs configuration form
1053 * @param array optional defaults
1055 * @return nothing
1057 function show_tabs_form($defaults = array()) {
1059 <form method="post" action="">
1060 <?php echo get_hidden_inputs();?>
1061 <input type="hidden" name="action" value="lay_tabs_real" />
1062 <?php
1063 show_config_form(array(
1064 array('Default tab for server', 'DefaultTabServer', 'Tab that is displayed when entering server', array('main.php', 'server_databases.php', 'server_status.php', 'server_variables.php', 'server_privileges.php', 'server_processlist.php')),
1065 array('Default tab for database', 'DefaultTabDatabase', 'Tab that is displayed when entering database', array('db_structure.php', 'db_sql.php', 'db_search.php', 'db_operations.php')),
1066 array('Default tab for table', 'DefaultTabTable', 'Tab that is displayed when entering table', array('tbl_structure.php', 'sql.php', 'tbl_sql.php', 'tbl_select.php', 'tbl_change.php')),
1067 array('Use lighter tabs', 'LightTabs', 'If you want simpler tabs enable this', FALSE),
1069 'Configure tabs',
1070 'Choose how you want tabs to work.',
1071 $defaults);
1073 </form>
1074 <?php
1078 * Shows icons configuration form
1080 * @param array optional defaults
1082 * @return nothing
1084 function show_icons_form($defaults = array()) {
1086 <form method="post" action="">
1087 <?php echo get_hidden_inputs();?>
1088 <input type="hidden" name="action" value="lay_icons_real" />
1089 <?php
1090 show_config_form(array(
1091 array('Icons on errors', 'ErrorIconic', 'Whether to use icons in error messages.', TRUE),
1092 array('Icons on main page', 'MainPageIconic', 'Whether to use icons on main page.', TRUE),
1093 array('Icons as help links', 'ReplaceHelpImg', 'Whether to use icons as help links.', TRUE),
1094 array('Navigation with icons', 'NavigationBarIconic', 'Whether to display navigation (eg. tabs) with icons.', array('TRUE', 'FALSE', 'both')),
1095 array('Properties pages with icons', 'PropertiesIconic', 'Whether to display properties (eg. table lists and structure) with icons.', array('TRUE', 'FALSE', 'both')),
1097 'Configure icons',
1098 'Select whether you prefer text or icons. Both means that text and icons will be displayed.',
1099 $defaults);
1101 </form>
1102 <?php
1106 * Shows browsing configuration form
1108 * @param array optional defaults
1110 * @return nothing
1112 function show_browse_form($defaults = array()) {
1114 <form method="post" action="">
1115 <?php echo get_hidden_inputs();?>
1116 <input type="hidden" name="action" value="lay_browse_real" />
1117 <?php
1118 show_config_form(array(
1119 array('Display of values', 'DefaultDisplay', 'How to list values while browsing', array('horizontal', 'vertical', 'horizontalflipped')),
1120 array('Hightlight pointer', 'BrowsePointerEnable', 'Whether to highlight row under mouse.', TRUE),
1121 array('Use row marker', 'BrowseMarkerEnable', 'Whether to highlight selected row.', TRUE),
1122 array('Action buttons on left', 'ModifyDeleteAtLeft', 'Show action buttons on left side of listing?', TRUE),
1123 array('Action buttons on right', 'ModifyDeleteAtRight', 'Show action buttons on right side of listing?', FALSE),
1124 array('Repeat heading', 'RepeatCells', 'After how many rows heading should be repeated.'),
1126 'Configure browsing',
1127 'Select desired browsing look and feel.',
1128 $defaults);
1130 </form>
1131 <?php
1135 * Shows editing options configuration form
1137 * @param array optional defaults
1139 * @return nothing
1141 function show_edit_form($defaults = array()) {
1143 <form method="post" action="">
1144 <?php echo get_hidden_inputs();?>
1145 <input type="hidden" name="action" value="lay_edit_real" />
1146 <?php
1147 show_config_form(array(
1148 array('Display of properties while editing', 'DefaultPropDisplay', 'How to list properties (table structure or values) while editing', array('horizontal', 'vertical')),
1149 array('Number of inserted rows', 'InsertRows', 'How many rows can be inserted at once'),
1150 array('Move using Ctrl+arrows', 'CtrlArrowsMoving', 'Whether to enable moving using Ctrl+Arrows', TRUE),
1151 array('Autoselect text in textarea', 'TextareaAutoSelect', 'Whether to automatically select text in textarea on focus.', TRUE),
1152 array('Textarea columns', 'TextareaCols', 'Number of columns in textarea while editing TEXT fields'),
1153 array('Textarea rows', 'TextareaRows', 'Number of rows in textarea while editing TEXT fields'),
1154 array('Double textarea for LONGTEXT', 'LongtextDoubleTextarea', 'Whether to double textarea size for LONGTEXT fields', TRUE),
1155 array('Edit CHAR fields in textarea', 'CharEditing', 'Whether to edit CHAR fields in textarea', array('input', 'textarea')),
1156 array('CHAR textarea columns', 'CharTextareaCols', 'Number of columns in textarea while editing CHAR fields (must be enabled above)'),
1157 array('CHAR textarea rows', 'CharTextareaRows', 'Number of rows in textarea while editing CHAR fields (must be enabled above)'),
1159 'Configure editing',
1160 'Select desired editing look and feel.',
1161 $defaults);
1163 </form>
1164 <?php
1168 * Shows query window configuration form
1170 * @param array optional defaults
1172 * @return nothing
1174 function show_window_form($defaults = array()) {
1176 <form method="post" action="">
1177 <?php echo get_hidden_inputs();?>
1178 <input type="hidden" name="action" value="lay_window_real" />
1179 <?php
1180 show_config_form(array(
1181 array('Edit SQL in window', 'EditInWindow', 'Whether edit links will edit in query window.', TRUE),
1182 array('Query window height', 'QueryWindowHeight', 'Height of query window'),
1183 array('Query window width', 'QueryWindowWidth', 'Width of query window'),
1184 array('Default tab', 'QueryWindowDefTab', 'Default tab on query window', array('sql', 'files', 'history', 'full')),
1186 'Configure query window',
1187 'Select desired query window look and feel.',
1188 $defaults);
1190 </form>
1191 <?php
1195 * Creates selection with servers
1197 * @param array configuraion
1199 * @return string HTML for server selection
1201 function get_server_selection($cfg) {
1202 if (count($cfg['Servers']) == 0) {
1203 return '';
1205 $ret = '<select name="server">';
1206 foreach ($cfg['Servers'] as $key => $val) {
1207 $ret .= '<option value="' . $key . '">' . get_server_name($val, $key) . '</option>';
1209 $ret .= '</select>';
1210 return $ret;
1214 * Loads configuration from file
1216 * @param string filename
1218 * @return mixed FALSE on failure, new config array on success
1220 function load_config($config_file) {
1221 if (file_exists($config_file)) {
1222 $success_apply_user_config = FALSE;
1223 $old_error_reporting = error_reporting(0);
1224 if (function_exists('file_get_contents')) {
1225 $success_apply_user_config = eval('?>' . trim(file_get_contents($config_file)));
1226 } else {
1227 $success_apply_user_config =
1228 eval('?>' . trim(implode("\n", file($config_file))));
1230 error_reporting($old_error_reporting);
1231 unset($old_error_reporting);
1232 if ($success_apply_user_config === FALSE) {
1233 message('error', 'Error while parsing configuration file!');
1234 } elseif (!isset($cfg) || count($cfg) == 0) {
1235 message('error', 'Config file seems to contain no configuration!');
1236 } else {
1237 // This must be set
1238 if (!isset($cfg['Servers'])) {
1239 $cfg['Servers'] = array();
1241 message('notice', 'Configuration loaded');
1242 compress_servers($cfg);
1243 return $cfg;
1245 } else {
1246 message('error', 'Configuration file not found!');
1248 return FALSE;
1251 if ($action != 'download') {
1252 // Check whether we can write to configuration
1253 $fail_dir = FALSE;
1254 $fail_dir = $fail_dir || !is_dir('./config/');
1255 $fail_dir = $fail_dir || !is_writable('./config/');
1256 $fail_dir = $fail_dir || (file_exists('./config/config.inc.php') && !is_writable('./config/config.inc.php'));
1257 $config = @fopen('./config/config.inc.php', 'a');
1258 $fail_dir = $fail_dir || ($config === FALSE);
1259 @fclose($config);
1263 * @var boolean whether to show configuration overview
1265 $show_info = FALSE;
1267 // Do the main work depending on selected action
1268 switch ($action) {
1269 case 'download':
1270 header('Content-Type: text/plain');
1271 header('Content-Disposition: attachment; filename="config.inc.php"');
1273 echo get_cfg_string($_SESSION['configuration']);
1274 exit;
1275 break;
1276 case 'display':
1277 echo '<form method="none" action=""><textarea name="config" cols="50" rows="20" id="textconfig" wrap="off">' . "\n";
1278 echo htmlspecialchars(get_cfg_string($_SESSION['configuration']));
1279 echo '</textarea></form>' . "\n";
1281 <script type="text/javascript">
1282 //<![CDATA[
1283 var bodyWidth=null; var bodyHeight=null;
1284 if (document.getElementById('textconfig')) {
1285 bodyWidth = self.innerWidth;
1286 bodyHeight = self.innerHeight;
1287 if(!bodyWidth && !bodyHeight){
1288 if (document.compatMode && document.compatMode == "BackCompat") {
1289 bodyWidth = document.body.clientWidth;
1290 bodyHeight = document.body.clientHeight;
1291 } else if (document.compatMode && document.compatMode == "CSS1Compat") {
1292 bodyWidth = document.documentElement.clientWidth;
1293 bodyHeight = document.documentElement.clientHeight;
1296 document.getElementById('textconfig').style.width=(bodyWidth-50) + 'px';
1297 document.getElementById('textconfig').style.height=(bodyHeight-100) + 'px';
1299 //]]>
1300 </script>
1301 <?php
1302 break;
1303 case 'save':
1304 $config = @fopen('./config/config.inc.php', 'w');
1305 if ($config === FALSE) {
1306 message('error', 'Could not open config file for writing! Bad permissions?');
1307 break;
1309 $s = get_cfg_string($_SESSION['configuration']);
1310 $r = fwrite($config, $s);
1311 if (!$r || $r != strlen($s)) {
1312 message('error', 'Could not write to config file! Not enough space?');
1313 break;
1314 } else {
1315 message('notice', 'Configuration saved to file config/config.inc.php in phpMyAdmin top level directory, copy it to top level one and delete directory config to use it.', 'File saved');
1317 unset($r, $s);
1318 fclose($config);
1319 break;
1320 case 'load':
1321 if ($fail_dir) {
1322 message('error', 'Reading of configuration disabled because of permissions.');
1323 break;
1325 $new_cfg = load_config('./config/config.inc.php');
1326 if (!($new_cfg === FALSE)) {
1327 $_SESSION['configuration'] = $new_cfg;
1329 $show_info = TRUE;
1330 break;
1332 case 'addserver_real':
1333 if (isset($_POST['submit_save'])) {
1334 $new_server = grab_values('host;extension;port;socket;connect_type;compress:bool;controluser;controlpass;auth_type;user;password;only_db;verbose;pmadb;bookmarktable;relation;table_info;table_coords;pdf_pages;column_info;designer_coords;history;AllowDeny:allow-deny;SignonSession;SignonURL;LogoutURL');
1335 $err = FALSE;
1336 if (empty($new_server['host'])) {
1337 message('error', 'Empty hostname!');
1338 $err = TRUE;
1340 if ($new_server['auth_type'] == 'config' && empty($new_server['user'])) {
1341 message('error', 'Empty username while using config authentication method!');
1342 $err = TRUE;
1344 if ($new_server['auth_type'] == 'signon' && empty($new_server['SignonSession'])) {
1345 message('error', 'Empty signon session name while using signon authentication method!');
1346 $err = TRUE;
1348 if ($new_server['auth_type'] == 'signon' && empty($new_server['SignonURL'])) {
1349 message('error', 'Empty signon URL while using signon authentication method!');
1350 $err = TRUE;
1352 if (isset($new_server['pmadb']) && strlen($new_server['pmadb'])) {
1353 // Just use defaults, should be okay for most users
1354 $pmadb = array();
1355 $pmadb['bookmarktable'] = 'pma_bookmark';
1356 $pmadb['relation'] = 'pma_relation';
1357 $pmadb['table_info'] = 'pma_table_info';
1358 $pmadb['table_coords'] = 'pma_table_coords';
1359 $pmadb['pdf_pages'] = 'pma_pdf_pages';
1360 $pmadb['column_info'] = 'pma_column_info';
1361 $pmadb['designer_coords'] = 'pma_designer_coords';
1362 $pmadb['history'] = 'pma_history';
1364 $new_server = array_merge($pmadb, $new_server);
1365 unset($pmadb);
1366 if (empty($new_server['controluser'])) {
1367 message('error', 'Empty phpMyAdmin control user while using pmadb!');
1368 $err = TRUE;
1370 if (empty($new_server['controlpass'])) {
1371 message('error', 'Empty phpMyAdmin control user password while using pmadb!');
1372 $err = TRUE;
1374 /* Check whether we can connect as control user */
1375 if (!empty($new_server['controluser']) && !empty($new_server['controlpass'])) {
1376 if ($new_server['extension'] == 'mysql') {
1377 $socket = empty($new_server['socket']) || $new_server['connect_type'] == 'tcp' ? '' : ':' . $new_server['socket'];
1378 $port = empty($new_server['port']) || $new_server['connect_type'] == 'socket' ? '' : ':' . $new_server['port'];
1379 $conn = @mysql_connect($new_server['host'] . $socket . $port, $new_server['controluser'], $new_server['controlpass']);
1380 if ($conn === FALSE) {
1381 message('error', 'Could not connect as control user!');
1382 $err = TRUE;
1383 } else {
1384 mysql_close($conn);
1386 } else {
1387 $socket = empty($new_server['socket']) || $new_server['connect_type'] == 'tcp' ? NULL : $new_server['socket'];
1388 $port = empty($new_server['port']) || $new_server['connect_type'] == 'socket' ? NULL : $new_server['port'];
1389 $conn = @mysqli_connect($new_server['host'], $new_server['controluser'], $new_server['controlpass'], NULL, $port, $socket);
1390 if ($conn === FALSE) {
1391 message('error', 'Could not connect as control user!');
1392 $err = TRUE;
1393 } else {
1394 mysqli_close($conn);
1398 } else {
1399 message('warning', 'You didn\'t set phpMyAdmin database, so you can not use all phpMyAdmin features.');
1401 if ($new_server['auth_type'] == 'config') {
1402 message('warning', 'Remember to protect your installation while using config authentication method!');
1403 } else {
1404 // Not needed:
1405 unset($new_server['user']);
1406 unset($new_server['password']);
1408 if ($err) {
1409 show_server_form($new_server, isset($_POST['server']) ? $_POST['server'] : FALSE);
1410 } else {
1411 if (isset($_POST['server'])) {
1412 $_SESSION['configuration']['Servers'][$_POST['server']] = $new_server;
1413 message('notice', 'Changed server ' . get_server_name($new_server, $_POST['server']));
1414 } else {
1415 $_SESSION['configuration']['Servers'][] = $new_server;
1416 message('notice', 'New server added');
1418 $show_info = TRUE;
1419 if ($new_server['auth_type'] == 'cookie' && empty($_SESSION['configuration']['blowfish_secret'])) {
1420 message('notice', 'You did not have configured blowfish secret and you want to use cookie authentication so I generated blowfish secret for you. It is used to encrypt cookies.', 'Blowfish secret generated');
1421 $_SESSION['configuration']['blowfish_secret'] = uniqid('', TRUE);
1424 unset($new_server);
1425 } else {
1426 $show_info = TRUE;
1428 break;
1429 case 'addserver':
1430 if (count($_SESSION['configuration']['Servers']) == 0) {
1431 // First server will use defaults as in config.default.php
1432 $defaults = $PMA_Config_Setup->default_server;
1433 unset($defaults['AllowDeny']); // Ignore this for now
1434 } else {
1435 $defaults = array();
1438 // Guess MySQL extension to use, prefer mysqli
1439 if (!function_exists('mysql_get_client_info')) {
1440 PMA_dl('mysql');
1442 if (!function_exists('mysqli_get_client_info')) {
1443 PMA_dl('mysqli');
1445 if (function_exists('mysqli_get_client_info')) {
1446 $defaults['extension'] = 'mysqli';
1447 } elseif (function_exists('mysql_get_client_info')) {
1448 $defaults['extension'] = 'mysql';
1449 } else {
1450 message('warning', 'Could not load either mysql or mysqli extension, you might not be able to use phpMyAdmin! Check your PHP configuration.');
1452 if (isset($defaults['extension'])) {
1453 message('notice', 'Autodetected MySQL extension to use: ' . $defaults['extension']);
1456 // Display form
1457 show_server_form($defaults);
1458 break;
1459 case 'editserver':
1460 if (!isset($_POST['server'])) {
1461 footer();
1463 show_server_form($_SESSION['configuration']['Servers'][$_POST['server']], $_POST['server']);
1464 break;
1465 case 'deleteserver':
1466 if (!isset($_POST['server'])) {
1467 footer();
1469 message('notice', 'Deleted server ' . get_server_name($_SESSION['configuration']['Servers'][$_POST['server']], $_POST['server']));
1470 unset($_SESSION['configuration']['Servers'][$_POST['server']]);
1471 compress_servers($_SESSION['configuration']);
1472 $show_info = TRUE;
1473 break;
1474 case 'servers':
1475 if (count($_SESSION['configuration']['Servers']) == 0) {
1476 message('notice', 'No servers defined, so none can be shown');
1477 } else {
1478 foreach ($_SESSION['configuration']['Servers'] as $i => $srv) {
1479 $data = array();
1480 if (!empty($srv['verbose'])) {
1481 $data[] = array('Verbose name', $srv['verbose']);
1483 $data[] = array('Host', $srv['host']);
1484 $data[] = array('MySQL extension', isset($srv['extension']) ? $srv['extension'] : $PMA_Config_Setup->default_server['extension']);
1485 $data[] = array('Authentication type', get_server_auth($srv));
1486 $data[] = array('phpMyAdmin advanced features', empty($srv['pmadb']) || empty($srv['controluser']) || empty($srv['controlpass']) ? 'disabled' : 'enabled, db: ' . $srv['pmadb'] . ', user: ' . $srv['controluser']);
1487 $buttons =
1488 get_action('deleteserver', 'Delete', '<input type="hidden" name="server" value="' . $i . '" />') .
1489 get_action('editserver', 'Edit', '<input type="hidden" name="server" value="' . $i . '" />');
1490 show_overview('Server ' . get_server_name($srv, $i), $data, $buttons);
1493 break;
1495 case 'feat_upload_real':
1496 if (isset($_POST['submit_save'])) {
1497 $dirs = grab_values('UploadDir;SaveDir');
1498 $err = FALSE;
1499 if (!empty($dirs['UploadDir']) && !is_dir($dirs['UploadDir'])) {
1500 message('error', 'Upload directory ' . htmlspecialchars($dirs['UploadDir']) . ' does not exist!');
1501 $err = TRUE;
1503 if (!empty($dirs['SaveDir']) && !is_dir($dirs['SaveDir'])) {
1504 message('error', 'Save directory ' . htmlspecialchars($dirs['SaveDir']) . ' does not exist!');
1505 $err = TRUE;
1507 if ($err) {
1508 show_upload_form($dirs);
1509 } else {
1510 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $dirs);
1511 message('notice', 'Configuration changed');
1512 $show_info = TRUE;
1514 } else {
1515 $show_info = TRUE;
1517 break;
1518 case 'feat_upload':
1519 show_upload_form($_SESSION['configuration']);
1520 break;
1522 case 'feat_security_real':
1523 if (isset($_POST['submit_save'])) {
1524 $vals = grab_values('blowfish_secret;ForceSSL:bool;ShowPhpInfo:bool;ShowChgPassword:bool;AllowArbitraryServer:bool;LoginCookieRecall:book;LoginCookieValidity:int');
1525 $err = FALSE;
1526 if (empty($vals['blowfish_secret'])) {
1527 message('warning', 'Blowfish secret is empty, you will not be able to use cookie authentication.');
1529 if ($vals['AllowArbitraryServer']) {
1530 message('warning', 'Arbitrary server connection might be dangerous as it might allow access to internal servers that are not reachable from outside.');
1532 if (isset($vals['LoginCookieValidity']) && $vals['LoginCookieValidity'] < 1) {
1533 message('error', 'Invalid cookie validity time');
1534 $err = TRUE;
1536 if ($err) {
1537 show_security_form($vals);
1538 } else {
1539 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1540 message('notice', 'Configuration changed');
1541 $show_info = TRUE;
1543 } else {
1544 $show_info = TRUE;
1546 break;
1547 case 'feat_security':
1548 show_security_form($_SESSION['configuration']);
1549 break;
1551 case 'feat_manual_real':
1552 if (isset($_POST['submit_save'])) {
1553 $vals = grab_values('MySQLManualBase;MySQLManualType');
1554 $err = FALSE;
1555 if ($vals['MySQLManualType'] != 'none' && empty($vals['MySQLManualBase'])) {
1556 message('error', 'You need to set manual base URL or choose type \'none\'.');
1557 $err = TRUE;
1559 if ($err) {
1560 show_manual_form($vals);
1561 } else {
1562 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1563 message('notice', 'Configuration changed');
1564 $show_info = TRUE;
1566 } else {
1567 $show_info = TRUE;
1569 break;
1570 case 'feat_manual':
1571 show_manual_form($_SESSION['configuration']);
1572 break;
1574 case 'feat_charset_real':
1575 if (isset($_POST['submit_save'])) {
1576 $vals = grab_values('AllowAnywhereRecoding:bool;DefaultCharset;RecodingEngine;IconvExtraParams');
1577 $err = FALSE;
1578 if ($err) {
1579 show_charset_form($vals);
1580 } else {
1581 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1582 message('notice', 'Configuration changed');
1583 $show_info = TRUE;
1585 } else {
1586 $show_info = TRUE;
1588 break;
1589 case 'feat_charset':
1590 $d = $_SESSION['configuration'];
1591 if (!isset($d['RecodingEngine'])) {
1592 if (@extension_loaded('iconv')) {
1593 $d['RecodingEngine'] = 'iconv';
1594 } elseif (@extension_loaded('recode')) {
1595 $d['RecodingEngine'] = 'recode';
1596 } else {
1597 PMA_dl('iconv');
1598 if (!@extension_loaded('iconv')) {
1599 PMA_dl('recode');
1600 if (!@extension_loaded('recode')) {
1601 message('warning', 'Neither recode nor iconv could be loaded so charset conversion will most likely not work.');
1602 } else {
1603 $d['RecodingEngine'] = 'recode';
1605 } else {
1606 $d['RecodingEngine'] = 'iconv';
1609 if (isset($d['RecodingEngine'])) {
1610 message('notice', 'Autodetected recoding engine: ' . $d['RecodingEngine']);
1613 show_charset_form($d);
1614 unset($d);
1615 break;
1617 case 'feat_extensions_real':
1618 if (isset($_POST['submit_save'])) {
1619 $vals = grab_values('GD2Available');
1620 $err = FALSE;
1621 if ($err) {
1622 show_extensions_form($vals);
1623 } else {
1624 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1625 message('notice', 'Configuration changed');
1626 $show_info = TRUE;
1628 } else {
1629 $show_info = TRUE;
1631 break;
1632 case 'feat_extensions':
1633 $d = $_SESSION['configuration'];
1634 if (!@extension_loaded('mbstring')) {
1635 PMA_dl('mbstring');
1637 if (!@extension_loaded('mbstring')) {
1638 message('warning', 'Could not load <code>mbstring</code> extension, which is required for work with multibyte strings like UTF-8 ones. Please consider installing it.');
1640 if (!isset($d['GD2Available'])) {
1641 if (PMA_IS_GD2 == 1) {
1642 message('notice', 'GD 2 or newer found.');
1643 $d['GD2Available'] = 'yes';
1644 } else {
1645 message('warning', 'GD 2 or newer is not present.');
1646 $d['GD2Available'] = 'no';
1649 show_extensions_form($d);
1650 unset($d);
1651 break;
1653 case 'feat_relation_real':
1654 if (isset($_POST['submit_save'])) {
1655 $vals = grab_values('QueryHistoryDB:bool;QueryHistoryMax:int;BrowseMIME:bool;PDFDefaultPageSize');
1656 $err = FALSE;
1657 if (isset($vals['QueryHistoryMax']) && $vals['QueryHistoryMax'] < 1) {
1658 message('error', 'Invalid value for query maximum history size!');
1659 $err = TRUE;
1661 if ($err) {
1662 show_relation_form($vals);
1663 } else {
1664 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1665 message('notice', 'Configuration changed');
1666 $show_info = TRUE;
1668 } else {
1669 $show_info = TRUE;
1671 break;
1672 case 'feat_relation':
1673 show_relation_form($_SESSION['configuration']);
1674 break;
1676 case 'lay_navigation_real':
1677 if (isset($_POST['submit_save'])) {
1678 $vals = grab_values('LeftFrameLight:bool;LeftFrameDBTree:bool;LeftFrameDBSeparator;LeftFrameTableSeparator;LeftFrameTableLevel:int;LeftDisplayLogo:bool;LeftDisplayServers:bool;DisplayServersList:bool;DisplayDatabasesList;LeftPointerEnable:bool');
1679 $err = FALSE;
1680 if (isset($vals['DisplayDatabasesList'])) {
1681 if ($vals['DisplayDatabasesList'] == 'yes') {
1682 $vals['DisplayDatabasesList'] = true;
1683 } elseif ($vals['DisplayDatabasesList'] == 'no') {
1684 $vals['DisplayDatabasesList'] = false;
1687 if (isset($vals['LeftFrameTableLevel']) && $vals['LeftFrameTableLevel'] < 1) {
1688 message('error', 'Invalid value for maximum table nesting level!');
1689 $err = TRUE;
1691 if ($err) {
1692 show_left_form($vals);
1693 } else {
1694 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1695 message('notice', 'Configuration changed');
1696 $show_info = TRUE;
1698 } else {
1699 $show_info = TRUE;
1701 break;
1702 case 'lay_navigation':
1703 show_left_form($_SESSION['configuration']);
1704 break;
1706 case 'lay_tabs_real':
1707 if (isset($_POST['submit_save'])) {
1708 $vals = grab_values('DefaultTabServer;DefaultTabDatabase;DefaultTabTable;LightTabs:bool');
1709 $err = FALSE;
1710 if ($err) {
1711 show_tabs_form($vals);
1712 } else {
1713 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1714 message('notice', 'Configuration changed');
1715 $show_info = TRUE;
1717 } else {
1718 $show_info = TRUE;
1720 break;
1721 case 'lay_tabs':
1722 show_tabs_form($_SESSION['configuration']);
1723 break;
1725 case 'lay_icons_real':
1726 if (isset($_POST['submit_save'])) {
1727 $vals = grab_values('ErrorIconic:bool;MainPageIconic:bool;ReplaceHelpImg:bool;NavigationBarIconic:tristate;PropertiesIconic:tristate');
1728 $err = FALSE;
1729 if ($err) {
1730 show_icons_form($vals);
1731 } else {
1732 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1733 message('notice', 'Configuration changed');
1734 $show_info = TRUE;
1736 } else {
1737 $show_info = TRUE;
1739 break;
1740 case 'lay_icons':
1741 show_icons_form($_SESSION['configuration']);
1742 break;
1744 case 'lay_browse_real':
1745 if (isset($_POST['submit_save'])) {
1746 $vals = grab_values('BrowsePointerEnable:bool;BrowseMarkerEnable:bool;ModifyDeleteAtRight:bool;ModifyDeleteAtLeft:bool;RepeatCells:int;DefaultDisplay');
1747 $err = FALSE;
1748 if (isset($vals['RepeatCells']) && $vals['RepeatCells'] < 1) {
1749 message('error', 'Invalid value for header repeating!');
1750 $err = TRUE;
1752 if (!$vals['ModifyDeleteAtLeft'] && !$vals['ModifyDeleteAtRight']) {
1753 message('error', 'No action buttons enabled!');
1754 $err = TRUE;
1756 if ($err) {
1757 show_browse_form($vals);
1758 } else {
1759 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1760 message('notice', 'Configuration changed');
1761 $show_info = TRUE;
1763 } else {
1764 $show_info = TRUE;
1766 break;
1767 case 'lay_browse':
1768 show_browse_form($_SESSION['configuration']);
1769 break;
1771 case 'lay_edit_real':
1772 if (isset($_POST['submit_save'])) {
1773 $vals = grab_values('TextareaCols:int;TextareaRows:int;LongtextDoubleTextarea:bool;TextareaAutoSelect:bool;CharEditing;CharTextareaCols:int;CharTextareaRows:int;CtrlArrowsMoving:bool;DefaultPropDisplay;InsertRows:int');
1774 $err = FALSE;
1775 if (isset($vals['TextareaCols']) && $vals['TextareaCols'] < 1) {
1776 message('error', 'Invalid value for textarea columns!');
1777 $err = TRUE;
1779 if (isset($vals['TextareaRows']) && $vals['TextareaRows'] < 1) {
1780 message('error', 'Invalid value for textarea rows!');
1781 $err = TRUE;
1783 if (isset($vals['CharTextareaCols']) && $vals['CharTextareaCols'] < 1) {
1784 message('error', 'Invalid value for CHAR textarea columns!');
1785 $err = TRUE;
1787 if (isset($vals['CharTextareaRows']) && $vals['CharTextareaRows'] < 1) {
1788 message('error', 'Invalid value for CHAR textarea rows!');
1789 $err = TRUE;
1791 if (isset($vals['InsertRows']) && $vals['InsertRows'] < 1) {
1792 message('error', 'Invalid value for inserted rows count!');
1793 $err = TRUE;
1795 if ($err) {
1796 show_edit_form($vals);
1797 } else {
1798 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1799 message('notice', 'Configuration changed');
1800 $show_info = TRUE;
1802 } else {
1803 $show_info = TRUE;
1805 break;
1806 case 'lay_edit':
1807 show_edit_form($_SESSION['configuration']);
1808 break;
1810 case 'lay_window_real':
1811 if (isset($_POST['submit_save'])) {
1812 $vals = grab_values('EditInWindow:bool;QueryWindowHeight:int;QueryWindowWidth:int;QueryWindowDefTab');
1813 $err = FALSE;
1814 if (isset($vals['QueryWindowWidth']) && $vals['QueryWindowWidth'] < 1) {
1815 message('error', 'Invalid value for query window width!');
1816 $err = TRUE;
1818 if (isset($vals['QueryWindowHeight']) && $vals['QueryWindowHeight'] < 1) {
1819 message('error', 'Invalid value for query window height');
1820 $err = TRUE;
1822 if ($err) {
1823 show_window_form($vals);
1824 } else {
1825 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1826 message('notice', 'Configuration changed');
1827 $show_info = TRUE;
1829 } else {
1830 $show_info = TRUE;
1832 break;
1833 case 'lay_window':
1834 show_window_form($_SESSION['configuration']);
1835 break;
1837 /* Template for new actions:
1838 case 'blah_real':
1839 if (isset($_POST['submit_save'])) {
1840 $vals = grab_values('value1:bool;value2');
1841 $err = FALSE;
1842 if (somechekcfails) {
1843 message('error', 'Invalid value for blah!');
1844 $err = TRUE;
1846 if ($err) {
1847 show_blah_form($vals);
1848 } else {
1849 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1850 message('notice', 'Configuration changed');
1851 $show_info = TRUE;
1853 } else {
1854 $show_info = TRUE;
1856 break;
1857 case 'blah':
1858 show_blah_form($_SESSION['configuration']);
1859 break;
1861 case 'versioncheck': // Check for latest available version
1862 PMA_dl('curl');
1863 $url = 'http://phpmyadmin.net/home_page/version.php';
1864 $data = '';
1865 $f = @fopen($url, 'r');
1866 if ($f === FALSE) {
1867 if (!function_exists('curl_init')) {
1868 message('error', 'Neither URL wrappers nor CURL are available. Version check is not possible.');
1869 break;
1871 } else {
1872 $data = fread($f, 20);
1873 fclose($f);
1875 if (empty($data) && function_exists('curl_init')) {
1876 $ch = curl_init($url);
1877 curl_setopt($ch, CURLOPT_HEADER, FALSE);
1878 curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
1879 $data = curl_exec($ch);
1880 curl_close($ch);
1882 if (empty($data)) {
1883 message('error', 'Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.');
1884 break;
1887 /* Format: version\ndate\n(download\n)* */
1888 $data_list = split("\n", $data);
1890 if (count($data_list) > 0) {
1891 $version = $data_list[0];
1892 } else {
1893 $version = '';
1896 $version_upstream = version_to_int($version);
1897 if ($version_upstream === FALSE) {
1898 message('error', 'Got invalid version string from server.');
1899 break;
1902 $version_local = version_to_int($PMA_Config_Setup->get('PMA_VERSION'));
1903 if ($version_local === FALSE) {
1904 message('error', 'Unparsable version string.');
1905 break;
1908 if ($version_upstream > $version_local) {
1909 message('notice', 'New version of phpMyAdmin is available, you should consider upgrade. New version is ' . htmlspecialchars($version) . '.');
1910 } else {
1911 if ($version_local % 100 == 0) {
1912 message('notice', 'You are using subversion version, run <code>svn update</code> :-). However latest released version is ' . htmlspecialchars($version) . '.');
1913 } else {
1914 message('notice', 'No newer stable version is available.');
1917 break;
1919 case 'seteol':
1920 $_SESSION['eoltype'] = $_POST['neweol'];
1921 message('notice', 'End of line format changed.');
1922 case 'clear': // Actual clearing is done on beginning of this script
1923 case 'main':
1924 $show_info = TRUE;
1925 break;
1927 case '':
1928 message('notice', 'You want to configure phpMyAdmin using web interface. Please note that this only allows basic setup, please read <a href="../Documentation.html#config">documentation</a> to see full description of all configuration directives.', 'Welcome');
1930 if ($PMA_Config_Setup->get('PMA_PHP_INT_VERSION') < 40100) {
1931 message('warning', 'Please upgrade to PHP 4.1.0, it is required for phpMyAdmin.', 'Too old PHP');
1934 if ($fail_dir) {
1935 message('warning', 'Please create web server writable folder config in phpMyAdmin toplevel directory as described in <a href="../Documentation.html#setup_script">documentation</a>. Otherwise you will be only able to download or display it.', 'Can not load or save configuration');
1938 if (empty($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') {
1939 if (empty($_SERVER['REQUEST_URI']) || empty($_SERVER['HTTP_HOST'])) {
1940 $redir = '';
1941 } else {
1942 $redir = ' If your server is also configured to accept HTTPS request'
1943 . ' follow <a href="https://'
1944 . htmlspecialchars($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])
1945 . '">this link</a> to use secure connection.';
1947 message('warning', 'You are not using secure connection, all data (including sensitive, like passwords) are transfered unencrypted!' . $redir, 'Not secure connection');
1949 break;
1952 // Should we show information?
1953 if ($show_info) {
1954 $servers = 'none';
1955 $servers_text = 'Servers';
1956 if (count($_SESSION['configuration']['Servers']) == 0) {
1957 message('warning', 'No servers defined, you probably want to add one.');
1958 } else {
1959 $servers = '';
1960 $servers_text = 'Servers (' . count($_SESSION['configuration']['Servers']) . ')';
1962 $sep = '';
1963 foreach ($_SESSION['configuration']['Servers'] as $key => $val) {
1964 $servers .= $sep;
1965 $sep = ', ';
1966 $servers .= get_server_name($val, $key);
1968 unset($sep);
1970 show_overview('Current configuration overview',
1971 array(
1972 array($servers_text, $servers),
1973 array('SQL files upload', empty($_SESSION['configuration']['UploadDir']) ? 'disabled' : 'enabled'),
1974 array('Exported files on server', empty($_SESSION['configuration']['SaveDir']) ? 'disabled' : 'enabled'),
1975 array('Charset conversion', isset($_SESSION['configuration']['AllowAnywhereRecoding']) && $_SESSION['configuration']['AllowAnywhereRecoding'] ? 'enabled' : 'disabled'),
1977 unset($servers_text, $servers);
1980 // And finally display all actions:
1981 echo '<p>Available global actions (please note that these will delete any changes you could have done above):</p>';
1983 echo '<fieldset class="toolbar"><legend>Servers</legend>' . "\n";
1984 echo get_action('addserver', 'Add');
1985 $servers = get_server_selection($_SESSION['configuration']);
1986 if (!empty($servers)) {
1987 echo get_action('servers', 'List');
1988 echo get_action('deleteserver', 'Delete', $servers);
1989 echo get_action('editserver', 'Edit', $servers);
1991 echo '</fieldset>' . "\n\n";
1993 echo '<fieldset class="toolbar"><legend>Layout</legend>' . "\n";
1994 echo get_action('lay_navigation', 'Navigation frame');
1995 echo get_action('lay_tabs', 'Tabs');
1996 echo get_action('lay_icons', 'Icons');
1997 echo get_action('lay_browse', 'Browsing');
1998 echo get_action('lay_edit', 'Editing');
1999 echo get_action('lay_window', 'Query window');
2000 echo '</fieldset>' . "\n\n";
2002 echo '<fieldset class="toolbar"><legend>Features</legend>' . "\n";
2003 echo get_action('feat_upload', 'Upload/Download');
2004 echo get_action('feat_security', 'Security');
2005 echo get_action('feat_manual', 'MySQL manual');
2006 echo get_action('feat_charset', 'Charsets');
2007 echo get_action('feat_extensions', 'Extensions');
2008 echo get_action('feat_relation', 'MIME/Relation/History');
2009 echo '</fieldset>' . "\n\n";
2011 echo '<fieldset class="toolbar"><legend>Configuration</legend>' . "\n";
2012 echo get_action('main', 'Overview');
2013 echo get_action('display', 'Display');
2014 echo get_action('download', 'Download');
2015 echo get_action('save', 'Save', '', !$fail_dir);
2016 echo get_action('load', 'Load', '', !$fail_dir);
2017 echo get_action('clear', 'Clear');
2018 echo get_action('seteol', 'Change end of line',
2019 '<select name="neweol">' .
2020 '<option value="unix" ' . ($_SESSION['eoltype'] == 'unix' ? ' selected="selected"' : '') . '>UNIX/Linux (\\n)</option>' .
2021 '<option value="dos" ' . ($_SESSION['eoltype'] == 'dos' ? ' selected="selected"' : '') . '>DOS/Windows (\\r\\n)</option>' .
2022 '<option value="mac" ' . ($_SESSION['eoltype'] == 'mac' ? ' selected="selected"' : '') . '>Macintosh (\\r)</option>' . '
2023 </select>');
2024 echo '</fieldset>' . "\n\n";
2026 echo '<fieldset class="toolbar"><legend>Other actions</legend>' . "\n";
2027 echo get_action('versioncheck', 'Check for latest version');
2028 echo get_url_action('http://www.phpmyadmin.net/', 'Go to homepage');
2029 echo get_url_action('https://sourceforge.net/donate/index.php', 'Donate to phpMyAdmin', array('group_id' => 23067));
2030 echo '</fieldset>' . "\n\n";
2032 footer();