From 2b504938ecd2a47bb63df8e83201fd67624432f7 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Mon, 11 Nov 2019 19:16:05 +0100 Subject: [PATCH] include get settings --- 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 f7cb4583..5d986caf 100644 --- a/bl-plugins/api/plugin.php +++ b/bl-plugins/api/plugin.php @@ -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