firmware: pass argument, why not...

This commit is contained in:
Franco Fichtner 2017-07-10 08:42:36 +02:00
parent 5daf7785e6
commit f83f556a61
2 changed files with 9 additions and 8 deletions

View File

@ -176,15 +176,16 @@ class FirmwareController extends ApiControllerBase
return $response;
}
if (empty($version)) {
// sanitize package name
$filter = new \Phalcon\Filter();
$filter->add('version', function ($value) {
return preg_replace('/[^0-9a-zA-Z\.]/', '', $value);
});
$version = $filter->sanitize($version, 'version');
if ($version == 'update') {
$backend->configdRun('firmware changelog fetch');
} else {
// sanitize package name
$filter = new \Phalcon\Filter();
$filter->add('version', function ($value) {
return preg_replace('/[^0-9a-zA-Z\.]/', '', $value);
});
$version = $filter->sanitize($version, 'version');
$text = trim($backend->configdRun(sprintf('firmware changelog text %s', $version)));
$html = trim($backend->configdRun(sprintf('firmware changelog html %s', $version)));
if (!empty($text)) {

View File

@ -485,7 +485,7 @@ POSSIBILITY OF SUCH DAMAGE.
$('#checkupdate_maj').click(function () {
$("#checkupdate_progress").addClass("fa fa-spinner fa-pulse");
// empty call refreshes changelogs in the background
ajaxCall('/api/core/firmware/changelog/', {}, function () {
ajaxCall('/api/core/firmware/changelog/update', {}, function () {
$("#checkupdate_progress").removeClass("fa fa-spinner fa-pulse");
BootstrapDialog.show({
type:BootstrapDialog.TYPE_WARNING,