CAICP/system/json/index.php
2018-11-22 21:02:44 +03:00

31 lines
1.1 KiB
PHP

<?php
header('Content-Type: application/json');
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
$filtered_widget = filter_input(INPUT_GET, 'widget', FILTER_SANITIZE_STRING);
$filtered_param = preg_replace('/[^a-zA-Z0-9]+/',
'',
filter_input(INPUT_GET,
'param',
FILTER_SANITIZE_STRING)
);
if ($filtered_widget !== '') {
if ($filtered_param !== '') {
echo shell_exec(sprintf('../scripts/json_api_nix.sh %s %s',
$filtered_widget,
$filtered_param
)
);
} else {
echo shell_exec(sprintf('../scripts/json_api_nix.sh %s',
$filtered_widget
)
);
}
} else {
echo '{}';
}