file_echo.php 859 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * "Echo" service to allow force downloading of exported charts (png or svg)
  5. * and server status monitor settings
  6. *
  7. * @package PhpMyAdmin
  8. */
  9. define('PMA_MINIMUM_COMMON', true);
  10. require_once 'libraries/common.inc.php';
  11. if (isset($_REQUEST['monitorconfig'])) {
  12. /* For monitor chart config export */
  13. PMA_downloadHeader('monitor.cfg', 'application/json; charset=UTF-8');
  14. header('X-Content-Type-Options: nosniff');
  15. echo urldecode($_REQUEST['monitorconfig']);
  16. } else if (isset($_REQUEST['import'])) {
  17. /* For monitor chart config import */
  18. header('Content-Type: application/json; charset=UTF-8');
  19. header('X-Content-Type-Options: nosniff');
  20. if (!file_exists($_FILES['file']['tmp_name'])) {
  21. exit();
  22. }
  23. echo file_get_contents($_FILES['file']['tmp_name']);
  24. }
  25. ?>