devilbox/.devilbox/www/htdocs/vendor/phpmyadmin-4.8.4/setup/validate.php

37 lines
845 B
PHP
Raw Normal View History

2016-10-22 14:57:10 +00:00
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Validation callback.
*
* @package PhpMyAdmin-Setup
*/
2018-04-14 09:18:00 +00:00
use PhpMyAdmin\Config\Validator;
use PhpMyAdmin\Core;
2016-10-22 14:57:10 +00:00
/**
* Core libraries.
*/
require './lib/common.inc.php';
$validators = array();
2018-04-14 09:18:00 +00:00
Core::headerJSON();
2016-10-22 14:57:10 +00:00
2018-04-14 09:18:00 +00:00
$ids = Core::isValid($_POST['id'], 'scalar') ? $_POST['id'] : null;
2016-10-22 14:57:10 +00:00
$vids = explode(',', $ids);
2018-04-14 09:18:00 +00:00
$vals = Core::isValid($_POST['values'], 'scalar') ? $_POST['values'] : null;
2016-10-22 14:57:10 +00:00
$values = json_decode($vals);
if (!($values instanceof stdClass)) {
2018-04-14 09:18:00 +00:00
Core::fatalError(__('Wrong data'));
2016-10-22 14:57:10 +00:00
}
$values = (array)$values;
2018-04-14 09:18:00 +00:00
$result = Validator::validate($GLOBALS['ConfigFile'], $vids, $values, true);
2016-10-22 14:57:10 +00:00
if ($result === false) {
$result = sprintf(
__('Wrong data or no validation for %s'),
implode(',', $vids)
);
}
echo $result !== true ? json_encode($result) : '';