diff --git a/lib/Froxlor/Ajax/Ajax.php b/lib/Froxlor/Ajax/Ajax.php index 200e64d5..d6f8b3ab 100644 --- a/lib/Froxlor/Ajax/Ajax.php +++ b/lib/Froxlor/Ajax/Ajax.php @@ -80,6 +80,8 @@ class Ajax return $this->editApiKey(); case 'getConfigDetails': return $this->getConfigDetails(); + case 'getConfigJsonExport': + return $this->getConfigJsonExport(); default: return $this->errorResponse('Action not found!'); } @@ -324,4 +326,19 @@ class Ajax } return $this->errorResponse('Not allowed', 403); } + + /** + * download JSON export of config-selection + */ + private function getConfigJsonExport() + { + if (isset($this->userinfo['adminsession']) && $this->userinfo['adminsession'] == 1 && $this->userinfo['change_serversettings'] == 1) { + $params = $_GET; + unset($params['action']); + unset($params['finish']); + header('Content-disposition: attachment; filename=froxlor-config-' . time() . '.json'); + return $this->jsonResponse($params); + } + return $this->errorResponse('Not allowed', 403); + } } diff --git a/templates/Froxlor/settings/configuration.html.twig b/templates/Froxlor/settings/configuration.html.twig index e8e5cc5a..2d29a5d6 100644 --- a/templates/Froxlor/settings/configuration.html.twig +++ b/templates/Froxlor/settings/configuration.html.twig @@ -104,7 +104,9 @@ {{ lng('admin.configfiles.recommendednote') }}