Merge remote-tracking branch 'origin/QA_4_5' into QA_4_5
[phpmyadmin.git] / setup / validate.php
blob5759042aa5a9a808ca49201dc0c635f48ad2b6e7
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) : '';