include get settings

This commit is contained in:
Diego Najar 2019-11-11 19:16:05 +01:00
parent c7c8998367
commit 2b504938ec
1 changed files with 26 additions and 0 deletions

View File

@ -121,6 +121,11 @@ class pluginAPI extends Plugin {
}
}
// Clean inputs
// ------------------------------------------------------------
unset($inputs['token']);
unset($inputs['authentication']);
// ENDPOINTS
// ------------------------------------------------------------
@ -147,6 +152,10 @@ class pluginAPI extends Plugin {
elseif ( ($method==='POST') && ($parameters[0]==='pages') && empty($parameters[1]) && $writePermissions ) {
$data = $this->createPage($inputs);
}
// (GET) /api/settings
elseif ( ($method==='GET') && ($parameters[0]==='settings') && empty($parameters[1]) && $writePermissions ) {
$data = $this->getSettings();
}
// (PUT) /api/settings
elseif ( ($method==='PUT') && ($parameters[0]==='settings') && empty($parameters[1]) && $writePermissions ) {
$data = $this->editSettings($inputs);
@ -509,6 +518,23 @@ class pluginAPI extends Plugin {
);
}
/*
| Get the settings
|
| @args array
|
| @return array
*/
private function getSettings()
{
global $site;
return array(
'status'=>'0',
'message'=>'Settings.',
'data'=>$site->get()
);
}
/*
| Edit the settings
| You can edit any field defined in the class site.class.php variable $dbFields