Translated using Weblate (Slovenian)
[phpmyadmin.git] / setup / validate.php
bloba44a3996a83a073e8826017656e47f55e8d4d288
1 <?php
2 /**
3 * Validation callback.
4 */
6 declare(strict_types=1);
8 use PhpMyAdmin\Config\Validator;
9 use PhpMyAdmin\Core;
11 if (! defined('ROOT_PATH')) {
12 // phpcs:disable PSR1.Files.SideEffects
13 define('ROOT_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR);
14 // phpcs:enable
17 // phpcs:disable PSR1.Files.SideEffects
18 define('PHPMYADMIN', true);
19 // phpcs:enable
21 require ROOT_PATH . 'setup/lib/common.inc.php';
24 Core::headerJSON();
26 $ids = isset($_POST['id']) && is_scalar($_POST['id']) ? (string) $_POST['id'] : '';
27 $vids = explode(',', $ids);
28 $vals = isset($_POST['values']) && is_scalar($_POST['values']) ? (string) $_POST['values'] : '';
29 $values = json_decode($vals);
30 if (! ($values instanceof stdClass)) {
31 Core::fatalError(__('Wrong data'));
34 $values = (array) $values;
35 $result = Validator::validate($GLOBALS['ConfigFile'], $vids, $values, true);
36 if ($result === false) {
37 $result = sprintf(
38 __('Wrong data or no validation for %s'),
39 implode(',', $vids)
43 echo $result !== true ? json_encode($result) : '';