1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
<?php
/**
* Validation callback.
*
* @package phpMyAdmin-setup
* @author Piotr Przybylski <piotrprz@gmail.com>
* @copyright Copyright (c) 2008, Piotr Przybylski <piotrprz@gmail.com>
* @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
* @version $Id$
*/
/**
* Core libraries.
*/
require './lib/common.inc.php';
$validators = array();
require './setup/lib/validate.lib.php';
header('Content-type: application/json');
$ids = isset($_POST['id']) ? $_POST['id'] : null;
$vids = explode(',', $ids);
$vals = isset($_POST['values']) ? $_POST['values'] : null;
$values = json_decode($vals);
if (!($values instanceof stdClass)) {
die('Wrong data');
}
$values = (array)$values;
$result = validate($vids, $values, true);
if ($result === false) {
$result = 'Wrong data or no validation for ' . $vids;
}
echo $result !== true ? json_encode($result) : '';
?>
|