config.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Front controller for config view / download and clear
  5. *
  6. * @package PhpMyAdmin-Setup
  7. */
  8. /**
  9. * Core libraries.
  10. */
  11. require './lib/common.inc.php';
  12. require_once './libraries/config/Form.class.php';
  13. require_once './libraries/config/FormDisplay.class.php';
  14. require_once './setup/lib/ConfigGenerator.class.php';
  15. require './libraries/config/setup.forms.php';
  16. $form_display = new FormDisplay();
  17. $form_display->registerForm('_config.php', $forms['_config.php']);
  18. $form_display->save('_config.php');
  19. if (isset($_POST['eol'])) {
  20. $_SESSION['eol'] = ($_POST['eol'] == 'unix') ? 'unix' : 'win';
  21. }
  22. if (PMA_ifSetOr($_POST['submit_clear'], '')) {
  23. //
  24. // Clear current config and return to main page
  25. //
  26. ConfigFile::getInstance()->resetConfigData();
  27. // drop post data
  28. header('HTTP/1.1 303 See Other');
  29. header('Location: index.php');
  30. exit;
  31. } elseif (PMA_ifSetOr($_POST['submit_download'], '')) {
  32. //
  33. // Output generated config file
  34. //
  35. PMA_downloadHeader('config.inc.php', 'text/plain');
  36. echo ConfigGenerator::getConfigFile();
  37. exit;
  38. } else {
  39. //
  40. // Show generated config file in a <textarea>
  41. //
  42. header('HTTP/1.1 303 See Other');
  43. header('Location: index.php?page=config');
  44. exit;
  45. }
  46. ?>