Fix for the Open in New Window in Patient/Client->Patients search gui, take 2.
[openemr.git] / phpmyadmin / scripts / setup.php
blob2f3d09d45ff24550074c554c01319dfc195df667
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 $ret .= get_cfg_val($name . "['$k']", $v);
522 } elseif ($type == 'int') {
523 $ret .= ' ' . PMA_var_export($v) . ',' . $crlf;
526 if (!isset($type)) {
527 /* Empty array */
528 $ret .= $name . ' = array();' . $crlf;
529 } elseif ($type == 'int') {
530 $ret .= ');' . $crlf;
532 $ret .= $crlf;
533 unset($type);
534 } else {
535 $ret .= $name . ' = ' . PMA_var_export($val) . ';' . $crlf;
537 return $ret;
541 * Creates configuration PHP code
543 * @param array configuration
545 * @return string PHP code containing configuration
547 function get_cfg_string($cfg) {
548 global $script_info, $script_version, $now, $crlf;
550 $c = $cfg;
551 $ret = "<?php$crlf/*$crlf * Generated configuration file$crlf * Generated by: $script_info$crlf * Version: $script_version$crlf * Date: " . $now . $crlf . ' */' . $crlf . $crlf;
553 if (count($c['Servers']) > 0) {
554 $ret .= "/* Servers configuration */$crlf\$i = 0;" . $crlf;
555 foreach ($c['Servers'] as $cnt => $srv) {
556 $ret .= $crlf . '/* Server ' . strtr(get_server_name($srv, $cnt, false), '*', '-') . " */$crlf\$i++;" . $crlf;
557 foreach ($srv as $key => $val) {
558 $key = preg_replace('/[^A-Za-z0-9_]/', '_', $key);
559 $ret .= get_cfg_val("\$cfg['Servers'][\$i]['$key']", $val);
562 $ret .= $crlf . '/* End of servers configuration */' . $crlf . $crlf;
564 unset($c['Servers']);
566 foreach ($c as $key => $val) {
567 $key = preg_replace('/[^A-Za-z0-9_]/', '_', $key);
568 $ret .= get_cfg_val("\$cfg['$key']", $val);
571 $ret .= '?>' . $crlf;
572 return $ret;
576 * Compresses server configuration to be indexed from 0 and contain no gaps
578 * @param array configuration
580 * @return nothing
582 function compress_servers(&$cfg) {
583 $ns = array();
584 foreach ($cfg['Servers'] as $val) {
585 if (!empty($val['host'])) {
586 $ns[] = $val;
589 $cfg['Servers'] = $ns;
593 * Grabs values from POST
595 * @param string list of values to grab, values are separated by ";",
596 * each can have defined type separated by ":", if no type
597 * is defined, string is assumed. Possible types: bool -
598 * boolean value, allow-deny - allow-deny rules, int -
599 * integer, tristate - "TRUE"/"FALSE" converted to bool,
600 * other strings are kept.
602 * @return array array with grabbed values
604 function grab_values($list)
606 $a = split(';', $list);
607 $res = array();
608 foreach ($a as $val) {
609 $v = split(':', $val);
610 if (!isset($v[1])) {
611 $v[1] = '';
613 switch($v[1]) {
614 case 'bool':
615 $res[$v[0]] = isset($_POST[$v[0]]);
616 break;
617 case 'allow-deny':
618 $res[$v[0]] = array();
619 if (isset($_POST[$v[0] . '_order']) && strlen($_POST[$v[0] . '_order']) > 0) {
620 $res[$v[0]]['order'] = $_POST[$v[0]];
621 } else {
622 $res[$v[0]]['order'] = '';
624 if (isset($_POST[$v[0] . '_rules']) && strlen($_POST[$v[0] . '_rules']) > 0) {
625 $res[$v[0]]['rules'] = split('|', $_POST[$v[0]]);
626 } else {
627 $res[$v[0]]['rules'] = array();
629 break;
630 case 'int':
631 if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) {
632 $res[$v[0]] = (int)$_POST[$v[0]];
634 break;
635 case 'tristate':
636 if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) {
637 $cur = $_POST[$v[0]];
638 if ($cur == 'TRUE') {
639 $res[$v[0]] = TRUE;
640 } elseif ($cur == 'FALSE') {
641 $res[$v[0]] = FALSE;
642 } else {
643 $res[$v[0]] = $cur;
646 break;
647 case 'string':
648 default:
649 if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) {
650 $res[$v[0]] = $_POST[$v[0]];
652 break;
655 return $res;
659 * Displays overview
661 * @param string title of oveview
662 * @param array list of values to display (each element is array of two
663 * values - name and value)
664 * @param string optional buttons to be displayed
666 * @return nothing
668 function show_overview($title, $list, $buttons = '') {
669 echo '<fieldset class="overview">' . "\n";
670 echo '<legend>' . $title . '</legend>' . "\n";
671 foreach ($list as $val) {
672 echo '<div class="row">';
673 echo '<div class="desc">';
674 echo $val[0];
675 echo '</div>';
676 echo '<div class="data">';
677 echo htmlspecialchars($val[1]);
678 echo '</div>';
679 echo '</div>' . "\n";
681 if (!empty($buttons)) {
682 echo '<div class="buttons">';
683 echo '<div class="desc">Actions:</div>';
684 echo $buttons;
685 echo '</div>' . "\n";
687 echo '</fieldset>' . "\n";
688 echo "\n";
692 * Displays configuration, fallback defaults are taken from global $PMA_Config_Setup
694 * @param array list of values to display (each element is array of two or
695 * three values - desription, name and optional type
696 * indicator). Type is determined by type of this parameter,
697 * array means select and array elements are items,
698 * 'password' means password input.
699 * @param string title of configuration
700 * @param string help string for this configuration
701 * @param array optional first level defaults
702 * @param string optional title for save button
703 * @param string optional prefix for documentation links
705 * @return nothing
707 function show_config_form($list, $legend, $help, $defaults = array(), $save = '', $prefix = '') {
708 global $PMA_Config_Setup;
710 if (empty($save)) {
711 $save = 'Update';
714 echo '<fieldset class="optbox">' . "\n";
715 echo '<legend>' . $legend . '</legend>' . "\n";
716 echo '<p>' . $help . '</p>' . "\n";
717 foreach ($list as $val) {
718 echo '<div class="opts">';
719 $type = 'text';
720 if (isset($val[3])) {
721 if (is_array($val[3])) {
722 $type = 'select';
723 } elseif (is_bool($val[3])) {
724 $type = 'check';
725 } elseif ($val[3] == 'password') {
726 $type = 'password';
729 switch ($type) {
730 case 'text':
731 case 'password':
732 echo '<label for="text_' . $val[1] . '" class="desc" title="' . $val[2] . '">' . $val[0] . get_cfg_doc($prefix . $val[1]) . '</label>';
733 echo '<input type="' . $type . '" name="' . $val[1] . '" id="text_' . $val[1] . '" title="' . $val[2] . '" size="50"';
734 if (isset($defaults[$val[1]])) {
735 echo ' value="' . htmlspecialchars($defaults[$val[1]]) . '"';
736 } else {
737 echo ' value="' . htmlspecialchars($PMA_Config_Setup->get($val[1])) . '"';
739 echo ' />';
740 break;
741 case 'check':
742 echo '<input type="checkbox" name="' . $val[1] . '" value="something" id="checkbox_' . $val[1] . '" title="' . $val[2] . '"';
743 if (isset($defaults[$val[1]])) {
744 if ($defaults[$val[1]]) {
745 echo ' checked="checked"';
747 } else {
748 if ($PMA_Config_Setup->get($val[1])) {
749 echo ' checked="checked"';
752 echo ' />';
753 echo '<label for="checkbox_' . $val[1] . '" title="' . $val[2] . '">' . $val[0] . get_cfg_doc($prefix . $val[1]) . '</label>';
754 break;
755 case 'select':
756 echo '<label for="select_' . $val[1] . '" class="desc" title="' . $val[2] . '">' . $val[0] . get_cfg_doc($prefix . $val[1]) . '</label>';
757 echo '<select name="' . $val[1] . '" id="select_' . $val[1] . '" ' . ' title="' . $val[2] . '">';
758 foreach ($val[3] as $opt) {
759 echo '<option value="' . $opt . '"';
760 if (isset($defaults[$val[1]])) {
761 if (is_bool($defaults[$val[1]])) {
762 if (($defaults[$val[1]] && $opt == 'TRUE') || (!$defaults[$val[1]] && $opt == 'FALSE')) {
763 echo ' selected="selected"';
765 } else {
766 if ($defaults[$val[1]] == $opt) {
767 echo ' selected="selected"';
770 } else {
771 $def_val = $PMA_Config_Setup->get($val[1]);
772 if (is_bool($val)) {
773 if (($def_val && $opt == 'TRUE') || (!$def_val && $opt == 'FALSE')) {
774 echo ' selected="selected"';
776 } else {
777 if ($def_val == $opt) {
778 echo ' selected="selected"';
781 unset($def_val);
783 echo '>' . $opt . '</option>';
785 echo '</select>';
786 break;
788 echo '</div>' . "\n";
790 echo '<div class="buttons">';
791 echo '<div class="desc">Actions:</div>';
792 echo '<input type="submit" name="submit_save" value="' . $save .'" class="save" />';
793 echo '<input type="submit" name="submit_ignore" value="Cancel" class="cancel" />';
794 echo '</div>' . "\n";
795 echo '</fieldset>' . "\n";
796 echo "\n";
800 * Shows security options configuration form
802 * @param array optional defaults
804 * @return nothing
806 function show_security_form($defaults = array()) {
808 <form method="post" action="">
809 <?php echo get_hidden_inputs();?>
810 <input type="hidden" name="action" value="feat_security_real" />
811 <?php
812 show_config_form(array(
813 array('Blowfish secret', 'blowfish_secret', 'Secret passphrase used for encrypting cookies'),
814 array('Force SSL connection', 'ForceSSL', 'Whether to force using secured connection while using phpMyAdmin', FALSE),
815 array('Show phpinfo output', 'ShowPhpInfo', 'Whether to allow users to see phpinfo() output', FALSE),
816 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),
817 array('Allow login to any MySQL server', 'AllowArbitraryServer', 'If enabled user can enter any MySQL server in login form for cookie auth.', FALSE),
818 array('Recall user name', 'LoginCookieRecall', 'Whether to recall user name on log in prompt while using cookie auth.', TRUE),
819 array('Login cookie validity', 'LoginCookieValidity', 'How long is login valid without performing any action.'),
821 'Configure security features',
822 'Please note that phpMyAdmin is just a user interface and it\'s features do not limit MySQL.',
823 $defaults);
825 </form>
826 <?php
830 * Shows MySQL manual configuration form
832 * @param array optional defaults
834 * @return nothing
836 function show_manual_form($defaults = array()) {
838 <form method="post" action="">
839 <?php echo get_hidden_inputs();?>
840 <input type="hidden" name="action" value="feat_manual_real" />
841 <?php
842 show_config_form(array(
843 array('Type of MySQL documentation', 'MySQLManualType', 'These types are same as listed on MySQL download page', array('viewable', 'chapters', 'big', 'none')),
844 array('Base URL of MySQL documentation', 'MySQLManualBase', 'Where is MySQL documentation placed, this is usually top level directory.'),
846 'Configure MySQL manual links',
847 '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.',
848 $defaults);
850 </form>
851 <?php
855 * Shows charset options configuration form
857 * @param array optional defaults
859 * @return nothing
861 function show_charset_form($defaults = array()) {
862 global $PMA_Config_Setup;
864 <form method="post" action="">
865 <?php echo get_hidden_inputs();?>
866 <input type="hidden" name="action" value="feat_charset_real" />
867 <?php
868 show_config_form(array(
869 array('Allow charset conversion', 'AllowAnywhereRecoding', 'If you want to use such functions.', FALSE),
870 array('Default charset', 'DefaultCharset', 'Default charset for conversion.', $PMA_Config_Setup->get('AvailableCharsets')),
871 array('Recoding engine', 'RecodingEngine', 'PHP can contain iconv and/or recode, select which one to use or keep autodetection.', array('auto', 'iconv', 'recode')),
872 array('Extra params for iconv', 'IconvExtraParams', 'Iconv can get some extra parameters for conversion see man iconv_open.'),
874 'Configure charset conversions',
875 'phpMyAdmin can perform charset conversions so that you can import and export in any charset you want.',
876 $defaults);
878 </form>
879 <?php
883 * Shows PHP extensions configuration form
885 * @param array optional defaults
887 * @return nothing
889 function show_extensions_form($defaults = array()) {
891 <form method="post" action="">
892 <?php echo get_hidden_inputs();?>
893 <input type="hidden" name="action" value="feat_extensions_real" />
894 <?php
895 show_config_form(array(
896 array('GD 2 is available', 'GD2Available', 'Whether you have GD 2 or newer installed', array('auto', 'yes', 'no')),
898 'Configure extensions',
899 '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.',
900 $defaults);
902 </form>
903 <?php
907 * Shows MIME/relation/history configuration form
909 * @param array optional defaults
911 * @return nothing
913 function show_relation_form($defaults = array()) {
914 global $PMA_Config_Setup;
916 <form method="post" action="">
917 <?php echo get_hidden_inputs();?>
918 <input type="hidden" name="action" value="feat_relation_real" />
919 <?php
920 show_config_form(array(
921 array('Permanent query history', 'QueryHistoryDB', 'Store history into database.', FALSE),
922 array('Maximal history size', 'QueryHistoryMax', 'How many queries are kept in history.'),
923 array('Use MIME transformations', 'BrowseMIME', 'Use MIME transformations while browsing.', TRUE),
924 array('PDF default page size', 'PDFDefaultPageSize', 'Default page size for PDF, you can change this while creating page.', $PMA_Config_Setup->get('PDFPageSizes')),
926 'Configure MIME/relation/history',
927 '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.',
928 $defaults);
930 </form>
931 <?php
935 * Shows upload/save configuration form
937 * @param array optional defaults
939 * @return nothing
941 function show_upload_form($defaults = array()) {
943 <form method="post" action="">
944 <?php echo get_hidden_inputs();?>
945 <input type="hidden" name="action" value="feat_upload_real" />
946 <?php
947 show_config_form(array(
948 array('Upload directory', 'UploadDir', 'Directory on server where you can upload files for import'),
949 array('Save directory', 'SaveDir', 'Directory where exports can be saved on server'),
951 'Configure upload/save directories',
952 'Enter directories, either absolute path or relative to phpMyAdmin top level directory.',
953 $defaults);
955 </form>
956 <?php
960 * Shows server configuration form
962 * @param array optional defaults
964 * @return nothing
966 function show_server_form($defaults = array(), $number = FALSE) {
968 <form method="post" action="">
969 <?php echo get_hidden_inputs();?>
970 <input type="hidden" name="action" value="addserver_real" />
971 <?php
972 if (!($number === FALSE)) {
973 echo '<input type="hidden" name="server" value="' . $number . '" />';
975 $hi = array ('bookmarktable', 'relation', 'table_info', 'table_coords', 'pdf_pages', 'column_info', 'designer_coords', 'history');
976 foreach ($hi as $k) {
977 if (isset($defaults[$k]) && is_string($defaults[$k]) && strlen($defaults[$k]) > 0) {
978 echo '<input type="hidden" name="' . $k . '" value="' . htmlspecialchars($defaults[$k]) . '" />';
981 if (isset($defaults['AllowDeny'])) {
982 if (isset($defaults['AllowDeny']['order']) && is_string($defaults['AllowDeny']['order']) && strlen($defaults['AllowDeny']['order']) > 0) {
983 echo '<input type="hidden" name="AllowDeny_rules" value="' . htmlspecialchars($defaults['AllowDeny']['order']) . '" />';
985 if (isset($defaults['AllowDeny']['rules']) && is_array($defaults['AllowDeny']['rules']) && count($defaults['AllowDeny']['rules']) > 0) {
986 echo '<input type="hidden" name="AllowDeny_rules" value="' . htmlspecialchars(implode('|', $defaults['AllowDeny']['rules'])) . '" />';
989 show_config_form(array(
990 array('Server hostname', 'host', 'Hostname where MySQL server is running'),
991 array('Server port', 'port', 'Port on which MySQL server is listening, leave empty for default'),
992 array('Server socket', 'socket', 'Socket on which MySQL server is listening, leave empty for default'),
993 array('Connection type', 'connect_type', 'How to connect to server, keep tcp if unsure', array('tcp', 'socket')),
994 array('PHP extension to use', 'extension', 'What PHP extension to use, use mysqli if supported', array('mysql', 'mysqli')),
995 array('Compress connection', 'compress', 'Whether to compress connection to MySQL server', FALSE),
996 array('Authentication type', 'auth_type', 'Authentication method to use', array('cookie', 'http', 'config', 'signon')),
997 array('User for config auth', 'user', 'Leave empty if not using config auth'),
998 array('Password for config auth', 'password', 'Leave empty if not using config auth', 'password'),
999 array('Only database to show', 'only_db', 'Limit listing of databases in left frame to this one'),
1000 array('Verbose name of this server', 'verbose', 'Name to display in server selection'),
1001 array('phpMyAdmin control user', 'controluser', 'User which phpMyAdmin can use for various actions'),
1002 array('phpMyAdmin control user password', 'controlpass', 'Password for user which phpMyAdmin can use for various actions', 'password'),
1003 array('phpMyAdmin database for advanced features', 'pmadb', 'phpMyAdmin will allow much more when you enable this. Table names are filled in automatically.'),
1004 array('Session name for signon auth', 'SignonSession', 'Leave empty if not using signon auth'),
1005 array('Login URL for signon auth', 'SignonURL', 'Leave empty if not using signon auth'),
1006 array('Logout URL', 'LogoutURL', 'Where to redirect user after logout'),
1008 'Configure server',
1009 ($number === FALSE) ? 'Enter new server connection parameters.' : 'Editing server ' . get_server_name($defaults, $number),
1010 $defaults, $number === FALSE ? 'Add' : '', 'Servers_');
1012 </form>
1013 <?php
1017 * Shows left frame configuration form
1019 * @param array optional defaults
1021 * @return nothing
1023 function show_left_form($defaults = array()) {
1025 <form method="post" action="">
1026 <?php echo get_hidden_inputs();?>
1027 <input type="hidden" name="action" value="lay_navigation_real" />
1028 <?php
1029 show_config_form(array(
1030 array('Use light version', 'LeftFrameLight', 'Disable this if you want to see all databases at one time.', TRUE),
1031 array('Display databases in tree', 'LeftFrameDBTree', 'Whether to display databases in tree (determined by separator defined lower)', TRUE),
1032 array('Databases tree separator', 'LeftFrameDBSeparator', 'String that separates databases into different tree level'),
1033 array('Table tree separator', 'LeftFrameTableSeparator', 'String that separates tables into different tree level'),
1034 array('Maximum table tree nesting', 'LeftFrameTableLevel', 'Maximum number of children in table tree'),
1035 array('Show logo', 'LeftDisplayLogo', 'Whether to show logo in left frame', TRUE),
1036 array('Display servers selection', 'LeftDisplayServers', 'Whether to show server selection in left frame', FALSE),
1037 array('Display servers as list', 'DisplayServersList', 'Whether to show server listing as list instead of drop down', FALSE),
1038 array('Display databases as list', 'DisplayDatabasesList', 'Whether to show database listing in navigation as list instead of drop down', array('auto', 'yes', 'no')),
1039 array('Enable pointer highlighting', 'LeftPointerEnable', 'Whether you want to highlight server under mouse', TRUE),
1041 'Configure navigation frame',
1042 'Customize the appears of the navigation frame.',
1043 $defaults);
1045 </form>
1046 <?php
1050 * Shows tabs configuration form
1052 * @param array optional defaults
1054 * @return nothing
1056 function show_tabs_form($defaults = array()) {
1058 <form method="post" action="">
1059 <?php echo get_hidden_inputs();?>
1060 <input type="hidden" name="action" value="lay_tabs_real" />
1061 <?php
1062 show_config_form(array(
1063 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')),
1064 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')),
1065 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')),
1066 array('Use lighter tabs', 'LightTabs', 'If you want simpler tabs enable this', FALSE),
1068 'Configure tabs',
1069 'Choose how you want tabs to work.',
1070 $defaults);
1072 </form>
1073 <?php
1077 * Shows icons configuration form
1079 * @param array optional defaults
1081 * @return nothing
1083 function show_icons_form($defaults = array()) {
1085 <form method="post" action="">
1086 <?php echo get_hidden_inputs();?>
1087 <input type="hidden" name="action" value="lay_icons_real" />
1088 <?php
1089 show_config_form(array(
1090 array('Icons on errors', 'ErrorIconic', 'Whether to use icons in error messages.', TRUE),
1091 array('Icons on main page', 'MainPageIconic', 'Whether to use icons on main page.', TRUE),
1092 array('Icons as help links', 'ReplaceHelpImg', 'Whether to use icons as help links.', TRUE),
1093 array('Navigation with icons', 'NavigationBarIconic', 'Whether to display navigation (eg. tabs) with icons.', array('TRUE', 'FALSE', 'both')),
1094 array('Properties pages with icons', 'PropertiesIconic', 'Whether to display properties (eg. table lists and structure) with icons.', array('TRUE', 'FALSE', 'both')),
1096 'Configure icons',
1097 'Select whether you prefer text or icons. Both means that text and icons will be displayed.',
1098 $defaults);
1100 </form>
1101 <?php
1105 * Shows browsing configuration form
1107 * @param array optional defaults
1109 * @return nothing
1111 function show_browse_form($defaults = array()) {
1113 <form method="post" action="">
1114 <?php echo get_hidden_inputs();?>
1115 <input type="hidden" name="action" value="lay_browse_real" />
1116 <?php
1117 show_config_form(array(
1118 array('Display of values', 'DefaultDisplay', 'How to list values while browsing', array('horizontal', 'vertical', 'horizontalflipped')),
1119 array('Hightlight pointer', 'BrowsePointerEnable', 'Whether to highlight row under mouse.', TRUE),
1120 array('Use row marker', 'BrowseMarkerEnable', 'Whether to highlight selected row.', TRUE),
1121 array('Action buttons on left', 'ModifyDeleteAtLeft', 'Show action buttons on left side of listing?', TRUE),
1122 array('Action buttons on right', 'ModifyDeleteAtRight', 'Show action buttons on right side of listing?', FALSE),
1123 array('Repeat heading', 'RepeatCells', 'After how many rows heading should be repeated.'),
1125 'Configure browsing',
1126 'Select desired browsing look and feel.',
1127 $defaults);
1129 </form>
1130 <?php
1134 * Shows editing options configuration form
1136 * @param array optional defaults
1138 * @return nothing
1140 function show_edit_form($defaults = array()) {
1142 <form method="post" action="">
1143 <?php echo get_hidden_inputs();?>
1144 <input type="hidden" name="action" value="lay_edit_real" />
1145 <?php
1146 show_config_form(array(
1147 array('Display of properties while editing', 'DefaultPropDisplay', 'How to list properties (table structure or values) while editing', array('horizontal', 'vertical')),
1148 array('Number of inserted rows', 'InsertRows', 'How many rows can be inserted at once'),
1149 array('Move using Ctrl+arrows', 'CtrlArrowsMoving', 'Whether to enable moving using Ctrl+Arrows', TRUE),
1150 array('Autoselect text in textarea', 'TextareaAutoSelect', 'Whether to automatically select text in textarea on focus.', TRUE),
1151 array('Textarea columns', 'TextareaCols', 'Number of columns in textarea while editing TEXT fields'),
1152 array('Textarea rows', 'TextareaRows', 'Number of rows in textarea while editing TEXT fields'),
1153 array('Double textarea for LONGTEXT', 'LongtextDoubleTextarea', 'Whether to double textarea size for LONGTEXT fields', TRUE),
1154 array('Edit CHAR fields in textarea', 'CharEditing', 'Whether to edit CHAR fields in textarea', array('input', 'textarea')),
1155 array('CHAR textarea columns', 'CharTextareaCols', 'Number of columns in textarea while editing CHAR fields (must be enabled above)'),
1156 array('CHAR textarea rows', 'CharTextareaRows', 'Number of rows in textarea while editing CHAR fields (must be enabled above)'),
1158 'Configure editing',
1159 'Select desired editing look and feel.',
1160 $defaults);
1162 </form>
1163 <?php
1167 * Shows query window configuration form
1169 * @param array optional defaults
1171 * @return nothing
1173 function show_window_form($defaults = array()) {
1175 <form method="post" action="">
1176 <?php echo get_hidden_inputs();?>
1177 <input type="hidden" name="action" value="lay_window_real" />
1178 <?php
1179 show_config_form(array(
1180 array('Edit SQL in window', 'EditInWindow', 'Whether edit links will edit in query window.', TRUE),
1181 array('Query window height', 'QueryWindowHeight', 'Height of query window'),
1182 array('Query window width', 'QueryWindowWidth', 'Width of query window'),
1183 array('Default tab', 'QueryWindowDefTab', 'Default tab on query window', array('sql', 'files', 'history', 'full')),
1185 'Configure query window',
1186 'Select desired query window look and feel.',
1187 $defaults);
1189 </form>
1190 <?php
1194 * Creates selection with servers
1196 * @param array configuraion
1198 * @return string HTML for server selection
1200 function get_server_selection($cfg) {
1201 if (count($cfg['Servers']) == 0) {
1202 return '';
1204 $ret = '<select name="server">';
1205 foreach ($cfg['Servers'] as $key => $val) {
1206 $ret .= '<option value="' . $key . '">' . get_server_name($val, $key) . '</option>';
1208 $ret .= '</select>';
1209 return $ret;
1213 * Loads configuration from file
1215 * @param string filename
1217 * @return mixed FALSE on failure, new config array on success
1219 function load_config($config_file) {
1220 if (file_exists($config_file)) {
1221 $success_apply_user_config = FALSE;
1222 $old_error_reporting = error_reporting(0);
1223 if (function_exists('file_get_contents')) {
1224 $success_apply_user_config = eval('?>' . trim(file_get_contents($config_file)));
1225 } else {
1226 $success_apply_user_config =
1227 eval('?>' . trim(implode("\n", file($config_file))));
1229 error_reporting($old_error_reporting);
1230 unset($old_error_reporting);
1231 if ($success_apply_user_config === FALSE) {
1232 message('error', 'Error while parsing configuration file!');
1233 } elseif (!isset($cfg) || count($cfg) == 0) {
1234 message('error', 'Config file seems to contain no configuration!');
1235 } else {
1236 // This must be set
1237 if (!isset($cfg['Servers'])) {
1238 $cfg['Servers'] = array();
1240 message('notice', 'Configuration loaded');
1241 compress_servers($cfg);
1242 return $cfg;
1244 } else {
1245 message('error', 'Configuration file not found!');
1247 return FALSE;
1250 if ($action != 'download') {
1251 // Check whether we can write to configuration
1252 $fail_dir = FALSE;
1253 $fail_dir = $fail_dir || !is_dir('./config/');
1254 $fail_dir = $fail_dir || !is_writable('./config/');
1255 $fail_dir = $fail_dir || (file_exists('./config/config.inc.php') && !is_writable('./config/config.inc.php'));
1256 $config = @fopen('./config/config.inc.php', 'a');
1257 $fail_dir = $fail_dir || ($config === FALSE);
1258 @fclose($config);
1262 * @var boolean whether to show configuration overview
1264 $show_info = FALSE;
1266 // Do the main work depending on selected action
1267 switch ($action) {
1268 case 'download':
1269 header('Content-Type: text/plain');
1270 header('Content-Disposition: attachment; filename="config.inc.php"');
1272 echo get_cfg_string($_SESSION['configuration']);
1273 exit;
1274 break;
1275 case 'display':
1276 echo '<form method="none" action=""><textarea name="config" cols="50" rows="20" id="textconfig" wrap="off">' . "\n";
1277 echo htmlspecialchars(get_cfg_string($_SESSION['configuration']));
1278 echo '</textarea></form>' . "\n";
1280 <script type="text/javascript">
1281 //<![CDATA[
1282 var bodyWidth=null; var bodyHeight=null;
1283 if (document.getElementById('textconfig')) {
1284 bodyWidth = self.innerWidth;
1285 bodyHeight = self.innerHeight;
1286 if(!bodyWidth && !bodyHeight){
1287 if (document.compatMode && document.compatMode == "BackCompat") {
1288 bodyWidth = document.body.clientWidth;
1289 bodyHeight = document.body.clientHeight;
1290 } else if (document.compatMode && document.compatMode == "CSS1Compat") {
1291 bodyWidth = document.documentElement.clientWidth;
1292 bodyHeight = document.documentElement.clientHeight;
1295 document.getElementById('textconfig').style.width=(bodyWidth-50) + 'px';
1296 document.getElementById('textconfig').style.height=(bodyHeight-100) + 'px';
1298 //]]>
1299 </script>
1300 <?php
1301 break;
1302 case 'save':
1303 $config = @fopen('./config/config.inc.php', 'w');
1304 if ($config === FALSE) {
1305 message('error', 'Could not open config file for writing! Bad permissions?');
1306 break;
1308 $s = get_cfg_string($_SESSION['configuration']);
1309 $r = fwrite($config, $s);
1310 if (!$r || $r != strlen($s)) {
1311 message('error', 'Could not write to config file! Not enough space?');
1312 break;
1313 } else {
1314 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');
1316 unset($r, $s);
1317 fclose($config);
1318 break;
1319 case 'load':
1320 if ($fail_dir) {
1321 message('error', 'Reading of configuration disabled because of permissions.');
1322 break;
1324 $new_cfg = load_config('./config/config.inc.php');
1325 if (!($new_cfg === FALSE)) {
1326 $_SESSION['configuration'] = $new_cfg;
1328 $show_info = TRUE;
1329 break;
1331 case 'addserver_real':
1332 if (isset($_POST['submit_save'])) {
1333 $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');
1334 $err = FALSE;
1335 if (empty($new_server['host'])) {
1336 message('error', 'Empty hostname!');
1337 $err = TRUE;
1339 if ($new_server['auth_type'] == 'config' && empty($new_server['user'])) {
1340 message('error', 'Empty username while using config authentication method!');
1341 $err = TRUE;
1343 if ($new_server['auth_type'] == 'signon' && empty($new_server['SignonSession'])) {
1344 message('error', 'Empty signon session name while using signon authentication method!');
1345 $err = TRUE;
1347 if ($new_server['auth_type'] == 'signon' && empty($new_server['SignonURL'])) {
1348 message('error', 'Empty signon URL while using signon authentication method!');
1349 $err = TRUE;
1351 if (isset($new_server['pmadb']) && strlen($new_server['pmadb'])) {
1352 // Just use defaults, should be okay for most users
1353 $pmadb = array();
1354 $pmadb['bookmarktable'] = 'pma_bookmark';
1355 $pmadb['relation'] = 'pma_relation';
1356 $pmadb['table_info'] = 'pma_table_info';
1357 $pmadb['table_coords'] = 'pma_table_coords';
1358 $pmadb['pdf_pages'] = 'pma_pdf_pages';
1359 $pmadb['column_info'] = 'pma_column_info';
1360 $pmadb['designer_coords'] = 'pma_designer_coords';
1361 $pmadb['history'] = 'pma_history';
1363 $new_server = array_merge($pmadb, $new_server);
1364 unset($pmadb);
1365 if (empty($new_server['controluser'])) {
1366 message('error', 'Empty phpMyAdmin control user while using pmadb!');
1367 $err = TRUE;
1369 if (empty($new_server['controlpass'])) {
1370 message('error', 'Empty phpMyAdmin control user password while using pmadb!');
1371 $err = TRUE;
1373 /* Check whether we can connect as control user */
1374 if (!empty($new_server['controluser']) && !empty($new_server['controlpass'])) {
1375 if ($new_server['extension'] == 'mysql') {
1376 $socket = empty($new_server['socket']) || $new_server['connect_type'] == 'tcp' ? '' : ':' . $new_server['socket'];
1377 $port = empty($new_server['port']) || $new_server['connect_type'] == 'socket' ? '' : ':' . $new_server['port'];
1378 $conn = @mysql_connect($new_server['host'] . $socket . $port, $new_server['controluser'], $new_server['controlpass']);
1379 if ($conn === FALSE) {
1380 message('error', 'Could not connect as control user!');
1381 $err = TRUE;
1382 } else {
1383 mysql_close($conn);
1385 } else {
1386 $socket = empty($new_server['socket']) || $new_server['connect_type'] == 'tcp' ? NULL : $new_server['socket'];
1387 $port = empty($new_server['port']) || $new_server['connect_type'] == 'socket' ? NULL : $new_server['port'];
1388 $conn = @mysqli_connect($new_server['host'], $new_server['controluser'], $new_server['controlpass'], NULL, $port, $socket);
1389 if ($conn === FALSE) {
1390 message('error', 'Could not connect as control user!');
1391 $err = TRUE;
1392 } else {
1393 mysqli_close($conn);
1397 } else {
1398 message('warning', 'You didn\'t set phpMyAdmin database, so you can not use all phpMyAdmin features.');
1400 if ($new_server['auth_type'] == 'config') {
1401 message('warning', 'Remember to protect your installation while using config authentication method!');
1402 } else {
1403 // Not needed:
1404 unset($new_server['user']);
1405 unset($new_server['password']);
1407 if ($err) {
1408 show_server_form($new_server, isset($_POST['server']) ? $_POST['server'] : FALSE);
1409 } else {
1410 if (isset($_POST['server'])) {
1411 $_SESSION['configuration']['Servers'][$_POST['server']] = $new_server;
1412 message('notice', 'Changed server ' . get_server_name($new_server, $_POST['server']));
1413 } else {
1414 $_SESSION['configuration']['Servers'][] = $new_server;
1415 message('notice', 'New server added');
1417 $show_info = TRUE;
1418 if ($new_server['auth_type'] == 'cookie' && empty($_SESSION['configuration']['blowfish_secret'])) {
1419 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');
1420 $_SESSION['configuration']['blowfish_secret'] = uniqid('', TRUE);
1423 unset($new_server);
1424 } else {
1425 $show_info = TRUE;
1427 break;
1428 case 'addserver':
1429 if (count($_SESSION['configuration']['Servers']) == 0) {
1430 // First server will use defaults as in config.default.php
1431 $defaults = $PMA_Config_Setup->default_server;
1432 unset($defaults['AllowDeny']); // Ignore this for now
1433 } else {
1434 $defaults = array();
1437 // Guess MySQL extension to use, prefer mysqli
1438 if (!function_exists('mysql_get_client_info')) {
1439 PMA_dl('mysql');
1441 if (!function_exists('mysqli_get_client_info')) {
1442 PMA_dl('mysqli');
1444 if (function_exists('mysqli_get_client_info')) {
1445 $defaults['extension'] = 'mysqli';
1446 } elseif (function_exists('mysql_get_client_info')) {
1447 $defaults['extension'] = 'mysql';
1448 } else {
1449 message('warning', 'Could not load either mysql or mysqli extension, you might not be able to use phpMyAdmin! Check your PHP configuration.');
1451 if (isset($defaults['extension'])) {
1452 message('notice', 'Autodetected MySQL extension to use: ' . $defaults['extension']);
1455 // Display form
1456 show_server_form($defaults);
1457 break;
1458 case 'editserver':
1459 if (!isset($_POST['server'])) {
1460 footer();
1462 show_server_form($_SESSION['configuration']['Servers'][$_POST['server']], $_POST['server']);
1463 break;
1464 case 'deleteserver':
1465 if (!isset($_POST['server'])) {
1466 footer();
1468 message('notice', 'Deleted server ' . get_server_name($_SESSION['configuration']['Servers'][$_POST['server']], $_POST['server']));
1469 unset($_SESSION['configuration']['Servers'][$_POST['server']]);
1470 compress_servers($_SESSION['configuration']);
1471 $show_info = TRUE;
1472 break;
1473 case 'servers':
1474 if (count($_SESSION['configuration']['Servers']) == 0) {
1475 message('notice', 'No servers defined, so none can be shown');
1476 } else {
1477 foreach ($_SESSION['configuration']['Servers'] as $i => $srv) {
1478 $data = array();
1479 if (!empty($srv['verbose'])) {
1480 $data[] = array('Verbose name', $srv['verbose']);
1482 $data[] = array('Host', $srv['host']);
1483 $data[] = array('MySQL extension', isset($srv['extension']) ? $srv['extension'] : $PMA_Config_Setup->default_server['extension']);
1484 $data[] = array('Authentication type', get_server_auth($srv));
1485 $data[] = array('phpMyAdmin advanced features', empty($srv['pmadb']) || empty($srv['controluser']) || empty($srv['controlpass']) ? 'disabled' : 'enabled, db: ' . $srv['pmadb'] . ', user: ' . $srv['controluser']);
1486 $buttons =
1487 get_action('deleteserver', 'Delete', '<input type="hidden" name="server" value="' . $i . '" />') .
1488 get_action('editserver', 'Edit', '<input type="hidden" name="server" value="' . $i . '" />');
1489 show_overview('Server ' . get_server_name($srv, $i), $data, $buttons);
1492 break;
1494 case 'feat_upload_real':
1495 if (isset($_POST['submit_save'])) {
1496 $dirs = grab_values('UploadDir;SaveDir');
1497 $err = FALSE;
1498 if (!empty($dirs['UploadDir']) && !is_dir($dirs['UploadDir'])) {
1499 message('error', 'Upload directory ' . htmlspecialchars($dirs['UploadDir']) . ' does not exist!');
1500 $err = TRUE;
1502 if (!empty($dirs['SaveDir']) && !is_dir($dirs['SaveDir'])) {
1503 message('error', 'Save directory ' . htmlspecialchars($dirs['SaveDir']) . ' does not exist!');
1504 $err = TRUE;
1506 if ($err) {
1507 show_upload_form($dirs);
1508 } else {
1509 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $dirs);
1510 message('notice', 'Configuration changed');
1511 $show_info = TRUE;
1513 } else {
1514 $show_info = TRUE;
1516 break;
1517 case 'feat_upload':
1518 show_upload_form($_SESSION['configuration']);
1519 break;
1521 case 'feat_security_real':
1522 if (isset($_POST['submit_save'])) {
1523 $vals = grab_values('blowfish_secret;ForceSSL:bool;ShowPhpInfo:bool;ShowChgPassword:bool;AllowArbitraryServer:bool;LoginCookieRecall:book;LoginCookieValidity:int');
1524 $err = FALSE;
1525 if (empty($vals['blowfish_secret'])) {
1526 message('warning', 'Blowfish secret is empty, you will not be able to use cookie authentication.');
1528 if ($vals['AllowArbitraryServer']) {
1529 message('warning', 'Arbitrary server connection might be dangerous as it might allow access to internal servers that are not reachable from outside.');
1531 if (isset($vals['LoginCookieValidity']) && $vals['LoginCookieValidity'] < 1) {
1532 message('error', 'Invalid cookie validity time');
1533 $err = TRUE;
1535 if ($err) {
1536 show_security_form($vals);
1537 } else {
1538 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1539 message('notice', 'Configuration changed');
1540 $show_info = TRUE;
1542 } else {
1543 $show_info = TRUE;
1545 break;
1546 case 'feat_security':
1547 show_security_form($_SESSION['configuration']);
1548 break;
1550 case 'feat_manual_real':
1551 if (isset($_POST['submit_save'])) {
1552 $vals = grab_values('MySQLManualBase;MySQLManualType');
1553 $err = FALSE;
1554 if ($vals['MySQLManualType'] != 'none' && empty($vals['MySQLManualBase'])) {
1555 message('error', 'You need to set manual base URL or choose type \'none\'.');
1556 $err = TRUE;
1558 if ($err) {
1559 show_manual_form($vals);
1560 } else {
1561 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1562 message('notice', 'Configuration changed');
1563 $show_info = TRUE;
1565 } else {
1566 $show_info = TRUE;
1568 break;
1569 case 'feat_manual':
1570 show_manual_form($_SESSION['configuration']);
1571 break;
1573 case 'feat_charset_real':
1574 if (isset($_POST['submit_save'])) {
1575 $vals = grab_values('AllowAnywhereRecoding:bool;DefaultCharset;RecodingEngine;IconvExtraParams');
1576 $err = FALSE;
1577 if ($err) {
1578 show_charset_form($vals);
1579 } else {
1580 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1581 message('notice', 'Configuration changed');
1582 $show_info = TRUE;
1584 } else {
1585 $show_info = TRUE;
1587 break;
1588 case 'feat_charset':
1589 $d = $_SESSION['configuration'];
1590 if (!isset($d['RecodingEngine'])) {
1591 if (@extension_loaded('iconv')) {
1592 $d['RecodingEngine'] = 'iconv';
1593 } elseif (@extension_loaded('recode')) {
1594 $d['RecodingEngine'] = 'recode';
1595 } else {
1596 PMA_dl('iconv');
1597 if (!@extension_loaded('iconv')) {
1598 PMA_dl('recode');
1599 if (!@extension_loaded('recode')) {
1600 message('warning', 'Neither recode nor iconv could be loaded so charset conversion will most likely not work.');
1601 } else {
1602 $d['RecodingEngine'] = 'recode';
1604 } else {
1605 $d['RecodingEngine'] = 'iconv';
1608 if (isset($d['RecodingEngine'])) {
1609 message('notice', 'Autodetected recoding engine: ' . $d['RecodingEngine']);
1612 show_charset_form($d);
1613 unset($d);
1614 break;
1616 case 'feat_extensions_real':
1617 if (isset($_POST['submit_save'])) {
1618 $vals = grab_values('GD2Available');
1619 $err = FALSE;
1620 if ($err) {
1621 show_extensions_form($vals);
1622 } else {
1623 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1624 message('notice', 'Configuration changed');
1625 $show_info = TRUE;
1627 } else {
1628 $show_info = TRUE;
1630 break;
1631 case 'feat_extensions':
1632 $d = $_SESSION['configuration'];
1633 if (!@extension_loaded('mbstring')) {
1634 PMA_dl('mbstring');
1636 if (!@extension_loaded('mbstring')) {
1637 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.');
1639 if (!isset($d['GD2Available'])) {
1640 if (PMA_IS_GD2 == 1) {
1641 message('notice', 'GD 2 or newer found.');
1642 $d['GD2Available'] = 'yes';
1643 } else {
1644 message('warning', 'GD 2 or newer is not present.');
1645 $d['GD2Available'] = 'no';
1648 show_extensions_form($d);
1649 unset($d);
1650 break;
1652 case 'feat_relation_real':
1653 if (isset($_POST['submit_save'])) {
1654 $vals = grab_values('QueryHistoryDB:bool;QueryHistoryMax:int;BrowseMIME:bool;PDFDefaultPageSize');
1655 $err = FALSE;
1656 if (isset($vals['QueryHistoryMax']) && $vals['QueryHistoryMax'] < 1) {
1657 message('error', 'Invalid value for query maximum history size!');
1658 $err = TRUE;
1660 if ($err) {
1661 show_relation_form($vals);
1662 } else {
1663 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1664 message('notice', 'Configuration changed');
1665 $show_info = TRUE;
1667 } else {
1668 $show_info = TRUE;
1670 break;
1671 case 'feat_relation':
1672 show_relation_form($_SESSION['configuration']);
1673 break;
1675 case 'lay_navigation_real':
1676 if (isset($_POST['submit_save'])) {
1677 $vals = grab_values('LeftFrameLight:bool;LeftFrameDBTree:bool;LeftFrameDBSeparator;LeftFrameTableSeparator;LeftFrameTableLevel:int;LeftDisplayLogo:bool;LeftDisplayServers:bool;DisplayServersList:bool;DisplayDatabasesList;LeftPointerEnable:bool');
1678 $err = FALSE;
1679 if (isset($vals['DisplayDatabasesList'])) {
1680 if ($vals['DisplayDatabasesList'] == 'yes') {
1681 $vals['DisplayDatabasesList'] = true;
1682 } elseif ($vals['DisplayDatabasesList'] == 'no') {
1683 $vals['DisplayDatabasesList'] = false;
1686 if (isset($vals['LeftFrameTableLevel']) && $vals['LeftFrameTableLevel'] < 1) {
1687 message('error', 'Invalid value for maximum table nesting level!');
1688 $err = TRUE;
1690 if ($err) {
1691 show_left_form($vals);
1692 } else {
1693 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1694 message('notice', 'Configuration changed');
1695 $show_info = TRUE;
1697 } else {
1698 $show_info = TRUE;
1700 break;
1701 case 'lay_navigation':
1702 show_left_form($_SESSION['configuration']);
1703 break;
1705 case 'lay_tabs_real':
1706 if (isset($_POST['submit_save'])) {
1707 $vals = grab_values('DefaultTabServer;DefaultTabDatabase;DefaultTabTable;LightTabs:bool');
1708 $err = FALSE;
1709 if ($err) {
1710 show_tabs_form($vals);
1711 } else {
1712 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1713 message('notice', 'Configuration changed');
1714 $show_info = TRUE;
1716 } else {
1717 $show_info = TRUE;
1719 break;
1720 case 'lay_tabs':
1721 show_tabs_form($_SESSION['configuration']);
1722 break;
1724 case 'lay_icons_real':
1725 if (isset($_POST['submit_save'])) {
1726 $vals = grab_values('ErrorIconic:bool;MainPageIconic:bool;ReplaceHelpImg:bool;NavigationBarIconic:tristate;PropertiesIconic:tristate');
1727 $err = FALSE;
1728 if ($err) {
1729 show_icons_form($vals);
1730 } else {
1731 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1732 message('notice', 'Configuration changed');
1733 $show_info = TRUE;
1735 } else {
1736 $show_info = TRUE;
1738 break;
1739 case 'lay_icons':
1740 show_icons_form($_SESSION['configuration']);
1741 break;
1743 case 'lay_browse_real':
1744 if (isset($_POST['submit_save'])) {
1745 $vals = grab_values('BrowsePointerEnable:bool;BrowseMarkerEnable:bool;ModifyDeleteAtRight:bool;ModifyDeleteAtLeft:bool;RepeatCells:int;DefaultDisplay');
1746 $err = FALSE;
1747 if (isset($vals['RepeatCells']) && $vals['RepeatCells'] < 1) {
1748 message('error', 'Invalid value for header repeating!');
1749 $err = TRUE;
1751 if (!$vals['ModifyDeleteAtLeft'] && !$vals['ModifyDeleteAtRight']) {
1752 message('error', 'No action buttons enabled!');
1753 $err = TRUE;
1755 if ($err) {
1756 show_browse_form($vals);
1757 } else {
1758 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1759 message('notice', 'Configuration changed');
1760 $show_info = TRUE;
1762 } else {
1763 $show_info = TRUE;
1765 break;
1766 case 'lay_browse':
1767 show_browse_form($_SESSION['configuration']);
1768 break;
1770 case 'lay_edit_real':
1771 if (isset($_POST['submit_save'])) {
1772 $vals = grab_values('TextareaCols:int;TextareaRows:int;LongtextDoubleTextarea:bool;TextareaAutoSelect:bool;CharEditing;CharTextareaCols:int;CharTextareaRows:int;CtrlArrowsMoving:bool;DefaultPropDisplay;InsertRows:int');
1773 $err = FALSE;
1774 if (isset($vals['TextareaCols']) && $vals['TextareaCols'] < 1) {
1775 message('error', 'Invalid value for textarea columns!');
1776 $err = TRUE;
1778 if (isset($vals['TextareaRows']) && $vals['TextareaRows'] < 1) {
1779 message('error', 'Invalid value for textarea rows!');
1780 $err = TRUE;
1782 if (isset($vals['CharTextareaCols']) && $vals['CharTextareaCols'] < 1) {
1783 message('error', 'Invalid value for CHAR textarea columns!');
1784 $err = TRUE;
1786 if (isset($vals['CharTextareaRows']) && $vals['CharTextareaRows'] < 1) {
1787 message('error', 'Invalid value for CHAR textarea rows!');
1788 $err = TRUE;
1790 if (isset($vals['InsertRows']) && $vals['InsertRows'] < 1) {
1791 message('error', 'Invalid value for inserted rows count!');
1792 $err = TRUE;
1794 if ($err) {
1795 show_edit_form($vals);
1796 } else {
1797 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1798 message('notice', 'Configuration changed');
1799 $show_info = TRUE;
1801 } else {
1802 $show_info = TRUE;
1804 break;
1805 case 'lay_edit':
1806 show_edit_form($_SESSION['configuration']);
1807 break;
1809 case 'lay_window_real':
1810 if (isset($_POST['submit_save'])) {
1811 $vals = grab_values('EditInWindow:bool;QueryWindowHeight:int;QueryWindowWidth:int;QueryWindowDefTab');
1812 $err = FALSE;
1813 if (isset($vals['QueryWindowWidth']) && $vals['QueryWindowWidth'] < 1) {
1814 message('error', 'Invalid value for query window width!');
1815 $err = TRUE;
1817 if (isset($vals['QueryWindowHeight']) && $vals['QueryWindowHeight'] < 1) {
1818 message('error', 'Invalid value for query window height');
1819 $err = TRUE;
1821 if ($err) {
1822 show_window_form($vals);
1823 } else {
1824 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1825 message('notice', 'Configuration changed');
1826 $show_info = TRUE;
1828 } else {
1829 $show_info = TRUE;
1831 break;
1832 case 'lay_window':
1833 show_window_form($_SESSION['configuration']);
1834 break;
1836 /* Template for new actions:
1837 case 'blah_real':
1838 if (isset($_POST['submit_save'])) {
1839 $vals = grab_values('value1:bool;value2');
1840 $err = FALSE;
1841 if (somechekcfails) {
1842 message('error', 'Invalid value for blah!');
1843 $err = TRUE;
1845 if ($err) {
1846 show_blah_form($vals);
1847 } else {
1848 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
1849 message('notice', 'Configuration changed');
1850 $show_info = TRUE;
1852 } else {
1853 $show_info = TRUE;
1855 break;
1856 case 'blah':
1857 show_blah_form($_SESSION['configuration']);
1858 break;
1860 case 'versioncheck': // Check for latest available version
1861 PMA_dl('curl');
1862 $url = 'http://phpmyadmin.net/home_page/version.php';
1863 $data = '';
1864 $f = @fopen($url, 'r');
1865 if ($f === FALSE) {
1866 if (!function_exists('curl_init')) {
1867 message('error', 'Neither URL wrappers nor CURL are available. Version check is not possible.');
1868 break;
1870 } else {
1871 $data = fread($f, 20);
1872 fclose($f);
1874 if (empty($data) && function_exists('curl_init')) {
1875 $ch = curl_init($url);
1876 curl_setopt($ch, CURLOPT_HEADER, FALSE);
1877 curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
1878 $data = curl_exec($ch);
1879 curl_close($ch);
1881 if (empty($data)) {
1882 message('error', 'Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.');
1883 break;
1886 /* Format: version\ndate\n(download\n)* */
1887 $data_list = split("\n", $data);
1889 if (count($data_list) > 0) {
1890 $version = $data_list[0];
1891 } else {
1892 $version = '';
1895 $version_upstream = version_to_int($version);
1896 if ($version_upstream === FALSE) {
1897 message('error', 'Got invalid version string from server.');
1898 break;
1901 $version_local = version_to_int($PMA_Config_Setup->get('PMA_VERSION'));
1902 if ($version_local === FALSE) {
1903 message('error', 'Unparsable version string.');
1904 break;
1907 if ($version_upstream > $version_local) {
1908 message('notice', 'New version of phpMyAdmin is available, you should consider upgrade. New version is ' . htmlspecialchars($version) . '.');
1909 } else {
1910 if ($version_local % 100 == 0) {
1911 message('notice', 'You are using subversion version, run <code>svn update</code> :-). However latest released version is ' . htmlspecialchars($version) . '.');
1912 } else {
1913 message('notice', 'No newer stable version is available.');
1916 break;
1918 case 'seteol':
1919 $_SESSION['eoltype'] = $_POST['neweol'];
1920 message('notice', 'End of line format changed.');
1921 case 'clear': // Actual clearing is done on beginning of this script
1922 case 'main':
1923 $show_info = TRUE;
1924 break;
1926 case '':
1927 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');
1929 if ($PMA_Config_Setup->get('PMA_PHP_INT_VERSION') < 40100) {
1930 message('warning', 'Please upgrade to PHP 4.1.0, it is required for phpMyAdmin.', 'Too old PHP');
1933 if ($fail_dir) {
1934 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');
1937 if (empty($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') {
1938 if (empty($_SERVER['REQUEST_URI']) || empty($_SERVER['HTTP_HOST'])) {
1939 $redir = '';
1940 } else {
1941 $redir = ' If your server is also configured to accept HTTPS request'
1942 . ' follow <a href="https://'
1943 . htmlspecialchars($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])
1944 . '">this link</a> to use secure connection.';
1946 message('warning', 'You are not using secure connection, all data (including sensitive, like passwords) are transfered unencrypted!' . $redir, 'Not secure connection');
1948 break;
1951 // Should we show information?
1952 if ($show_info) {
1953 $servers = 'none';
1954 $servers_text = 'Servers';
1955 if (count($_SESSION['configuration']['Servers']) == 0) {
1956 message('warning', 'No servers defined, you probably want to add one.');
1957 } else {
1958 $servers = '';
1959 $servers_text = 'Servers (' . count($_SESSION['configuration']['Servers']) . ')';
1961 $sep = '';
1962 foreach ($_SESSION['configuration']['Servers'] as $key => $val) {
1963 $servers .= $sep;
1964 $sep = ', ';
1965 $servers .= get_server_name($val, $key);
1967 unset($sep);
1969 show_overview('Current configuration overview',
1970 array(
1971 array($servers_text, $servers),
1972 array('SQL files upload', empty($_SESSION['configuration']['UploadDir']) ? 'disabled' : 'enabled'),
1973 array('Exported files on server', empty($_SESSION['configuration']['SaveDir']) ? 'disabled' : 'enabled'),
1974 array('Charset conversion', isset($_SESSION['configuration']['AllowAnywhereRecoding']) && $_SESSION['configuration']['AllowAnywhereRecoding'] ? 'enabled' : 'disabled'),
1976 unset($servers_text, $servers);
1979 // And finally display all actions:
1980 echo '<p>Available global actions (please note that these will delete any changes you could have done above):</p>';
1982 echo '<fieldset class="toolbar"><legend>Servers</legend>' . "\n";
1983 echo get_action('addserver', 'Add');
1984 $servers = get_server_selection($_SESSION['configuration']);
1985 if (!empty($servers)) {
1986 echo get_action('servers', 'List');
1987 echo get_action('deleteserver', 'Delete', $servers);
1988 echo get_action('editserver', 'Edit', $servers);
1990 echo '</fieldset>' . "\n\n";
1992 echo '<fieldset class="toolbar"><legend>Layout</legend>' . "\n";
1993 echo get_action('lay_navigation', 'Navigation frame');
1994 echo get_action('lay_tabs', 'Tabs');
1995 echo get_action('lay_icons', 'Icons');
1996 echo get_action('lay_browse', 'Browsing');
1997 echo get_action('lay_edit', 'Editing');
1998 echo get_action('lay_window', 'Query window');
1999 echo '</fieldset>' . "\n\n";
2001 echo '<fieldset class="toolbar"><legend>Features</legend>' . "\n";
2002 echo get_action('feat_upload', 'Upload/Download');
2003 echo get_action('feat_security', 'Security');
2004 echo get_action('feat_manual', 'MySQL manual');
2005 echo get_action('feat_charset', 'Charsets');
2006 echo get_action('feat_extensions', 'Extensions');
2007 echo get_action('feat_relation', 'MIME/Relation/History');
2008 echo '</fieldset>' . "\n\n";
2010 echo '<fieldset class="toolbar"><legend>Configuration</legend>' . "\n";
2011 echo get_action('main', 'Overview');
2012 echo get_action('display', 'Display');
2013 echo get_action('download', 'Download');
2014 echo get_action('save', 'Save', '', !$fail_dir);
2015 echo get_action('load', 'Load', '', !$fail_dir);
2016 echo get_action('clear', 'Clear');
2017 echo get_action('seteol', 'Change end of line',
2018 '<select name="neweol">' .
2019 '<option value="unix" ' . ($_SESSION['eoltype'] == 'unix' ? ' selected="selected"' : '') . '>UNIX/Linux (\\n)</option>' .
2020 '<option value="dos" ' . ($_SESSION['eoltype'] == 'dos' ? ' selected="selected"' : '') . '>DOS/Windows (\\r\\n)</option>' .
2021 '<option value="mac" ' . ($_SESSION['eoltype'] == 'mac' ? ' selected="selected"' : '') . '>Macintosh (\\r)</option>' . '
2022 </select>');
2023 echo '</fieldset>' . "\n\n";
2025 echo '<fieldset class="toolbar"><legend>Other actions</legend>' . "\n";
2026 echo get_action('versioncheck', 'Check for latest version');
2027 echo get_url_action('http://www.phpmyadmin.net/', 'Go to homepage');
2028 echo get_url_action('https://sourceforge.net/donate/index.php', 'Donate to phpMyAdmin', array('group_id' => 23067));
2029 echo '</fieldset>' . "\n\n";
2031 footer();