make selection of config-services downloadable as json e.g. for config-services script
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user