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