Edit setting trough the API

This commit is contained in:
Diego Najar 2019-05-12 11:50:08 +02:00
parent 749cf37fa8
commit 801c2ba9e9
1 changed files with 26 additions and 0 deletions

View File

@ -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/<key>
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.'
);
}
}