validate.php 727 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Validation callback.
  5. *
  6. * @package PhpMyAdmin-Setup
  7. */
  8. /**
  9. * Core libraries.
  10. */
  11. require './lib/common.inc.php';
  12. $validators = array();
  13. require './libraries/config/Validator.class.php';
  14. header('Content-type: application/json');
  15. $vids = explode(',', filter_input(INPUT_POST, 'id'));
  16. $values = json_decode(filter_input(INPUT_POST, 'values'));
  17. if (!($values instanceof stdClass)) {
  18. PMA_fatalError(__('Wrong data'));
  19. }
  20. $values = (array)$values;
  21. $result = PMA_Validator::validate($GLOBALS['ConfigFile'], $vids, $values, true);
  22. if ($result === false) {
  23. $result = 'Wrong data or no validation for ' . $vids;
  24. }
  25. echo $result !== true ? json_encode($result) : '';
  26. ?>