config.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. use PhpMyAdmin\Setup\ConfigGenerator;
  9. use PhpMyAdmin\Config\Forms\Setup\ConfigForm;
  10. use PhpMyAdmin\Core;
  11. use PhpMyAdmin\Url;
  12. use PhpMyAdmin\Response;
  13. /**
  14. * Core libraries.
  15. */
  16. require './lib/common.inc.php';
  17. $form_display = new ConfigForm($GLOBALS['ConfigFile']);
  18. $form_display->save('Config');
  19. $response = Response::getInstance();
  20. if (isset($_POST['eol'])) {
  21. $_SESSION['eol'] = ($_POST['eol'] == 'unix') ? 'unix' : 'win';
  22. }
  23. if (Core::ifSetOr($_POST['submit_clear'], '')) {
  24. //
  25. // Clear current config and return to main page
  26. //
  27. $GLOBALS['ConfigFile']->resetConfigData();
  28. // drop post data
  29. $response->generateHeader303('index.php' . Url::getCommonRaw());
  30. exit;
  31. } elseif (Core::ifSetOr($_POST['submit_download'], '')) {
  32. //
  33. // Output generated config file
  34. //
  35. Core::downloadHeader('config.inc.php', 'text/plain');
  36. $response->disable();
  37. echo ConfigGenerator::getConfigFile($GLOBALS['ConfigFile']);
  38. exit;
  39. } else {
  40. //
  41. // Show generated config file in a <textarea>
  42. //
  43. $response->generateHeader303('index.php' . Url::getCommonRaw(array('page' => 'config')));
  44. exit;
  45. }