diff --git a/sysutils/smart/src/opnsense/mvc/app/controllers/OPNsense/Smart/Api/ServiceController.php b/sysutils/smart/src/opnsense/mvc/app/controllers/OPNsense/Smart/Api/ServiceController.php index 324a6e111..874ba272f 100644 --- a/sysutils/smart/src/opnsense/mvc/app/controllers/OPNsense/Smart/Api/ServiceController.php +++ b/sysutils/smart/src/opnsense/mvc/app/controllers/OPNsense/Smart/Api/ServiceController.php @@ -57,7 +57,7 @@ class ServiceController extends ApiControllerBase if ($this->request->isPost()) { $device = $this->request->getPost('device'); $type = $this->request->getPost('type'); - $json = $this->request->getPost('json'); + $mode = empty($this->request->getPost('json')) ? "info" : "info_json"; if (!in_array($device, $this->getDevices())) { return array("message" => "Invalid device name"); @@ -71,13 +71,10 @@ class ServiceController extends ApiControllerBase $backend = new Backend(); - $params = array("info", $type, "/dev/" . $device); - if ($json != NULL) { - $params[0] = "info_json"; - } + $params = array($mode, $type, "/dev/" . $device); $output = $backend->configdpRun("smart", $params); - if ($json != NULL) { + if ($mode == 'info_json') { $output = json_decode($output, true); }