From 801c2ba9e9381c7bf635b1ecca01b00c4c0bde8a Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sun, 12 May 2019 11:50:08 +0200 Subject: [PATCH] Edit setting trough the API --- bl-plugins/api/plugin.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/bl-plugins/api/plugin.php b/bl-plugins/api/plugin.php index b8dd418f..1106f091 100644 --- a/bl-plugins/api/plugin.php +++ b/bl-plugins/api/plugin.php @@ -138,6 +138,10 @@ class pluginAPI extends Plugin { $pageKey = $parameters[1]; $data = $this->editPage($pageKey, $inputs); } + // (PUT) /api/settings + elseif ( ($method==='PUT') && ($parameters[0]==='settings') && empty($parameters[1]) && $writePermissions ) { + $data = $this->editSettings($inputs); + } // (DELETE) /api/pages/ elseif ( ($method==='DELETE') && ($parameters[0]==='pages') && !empty($parameters[1]) && $writePermissions ) { $pageKey = $parameters[1]; @@ -483,4 +487,26 @@ class pluginAPI extends Plugin { ); } + /* + | Edit the settings + | You can edit any field defined in the class site.class.php variable $dbFields + | + | @args array + | + | @return array + */ + private function editSettings($args) + { + if (editSettings($args)) { + return array( + 'status'=>'0', + 'message'=>'Settings edited.' + ); + } + return array( + 'status'=>'1', + 'message'=>'Error trying to edit the settings.' + ); + } + } \ No newline at end of file