Merge remote-tracking branch 'origin/QA_4_4' into QA_4_4
[phpmyadmin.git] / setup / validate.php
blob3c070f29abe30f90708f24f3603d66e1c2c822fb
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Validation callback.
6 * @package PhpMyAdmin-Setup
7 */
9 /**
10 * Core libraries.
12 require './lib/common.inc.php';
14 $validators = array();
15 require './libraries/config/Validator.class.php';
17 header('Content-type: application/json');
19 $ids = isset($_POST['id']) ? $_POST['id'] : null;
20 $vids = explode(',', $ids);
21 $vals = isset($_POST['values']) ? $_POST['values'] : null;
22 $values = json_decode($vals);
23 if (!($values instanceof stdClass)) {
24 PMA_fatalError(__('Wrong data'));
26 $values = (array)$values;
27 $result = PMA_Validator::validate($GLOBALS['ConfigFile'], $vids, $values, true);
28 if ($result === false) {
29 $result = 'Wrong data or no validation for ' . $vids;
31 echo $result !== true ? json_encode($result) : '';