From 473e72ccbbfc42f0d529b8fb7129da33d48b468a Mon Sep 17 00:00:00 2001 From: Webslice Date: Tue, 24 Mar 2020 15:30:49 +0100 Subject: [PATCH 1/4] Allow empty key for api call system_config_get --- interface/lib/classes/remote.d/admin.inc.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/interface/lib/classes/remote.d/admin.inc.php b/interface/lib/classes/remote.d/admin.inc.php index 793f9ed339..1aad1750c9 100644 --- a/interface/lib/classes/remote.d/admin.inc.php +++ b/interface/lib/classes/remote.d/admin.inc.php @@ -132,10 +132,9 @@ class remoting_admin extends remoting { Get the values of the system configuration @param int session id @param string section of the config field in the table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc - @param string key of the option that you want to set - @param string option value that you want to set + @param string|null key of the option that you want to set */ - public function system_config_get($session_id, $section, $key) { + public function system_config_get($session_id, $section, $key = null) { global $app; if(!$this->checkPerm($session_id, 'system_config_get')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); -- GitLab From bf1cba026ee78bb8417b5e254bffd6444f04c668 Mon Sep 17 00:00:00 2001 From: Webslice Date: Tue, 24 Mar 2020 15:31:05 +0100 Subject: [PATCH 2/4] Add remoting client example for system_config_get --- .../examples/system_config_get.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 remoting_client/examples/system_config_get.php diff --git a/remoting_client/examples/system_config_get.php b/remoting_client/examples/system_config_get.php new file mode 100644 index 0000000000..f5d3d47f7b --- /dev/null +++ b/remoting_client/examples/system_config_get.php @@ -0,0 +1,48 @@ + [ + // set some SSL/TLS specific options + 'verify_peer' => false, + 'verify_peer_name' => false, + 'allow_self_signed' => true + ] +]); + + +$client = new SoapClient(null, array('location' => $soap_location, + 'uri' => $soap_uri, + 'trace' => 1, + 'exceptions' => 1, + 'stream_context' => $context)); + + +try { + if($session_id = $client->login($username, $password)) { + echo 'Logged successfull. Session ID:'.$session_id.'
'; + } + + //* Set the function parameters. + $server_id = 1; + + $result = $client->system_config_get($session_id, 'misc'); + print_r($result); + echo "
"; + + $result = $client->system_config_get($session_id, 'misc', 'maintenance_mode'); + print_r($result); + echo "
"; + + if($client->logout($session_id)) { + echo 'Logged out.
'; + } + + +} catch (SoapFault $e) { + echo $client->__getLastResponse(); + die('SOAP Error: '.$e->getMessage()); +} + +?> -- GitLab From e3cc4d914f63a276abec6e5f0e05f13e32fd7fbe Mon Sep 17 00:00:00 2001 From: Webslice Date: Tue, 24 Mar 2020 16:20:41 +0100 Subject: [PATCH 3/4] Fix typo in docheader --- interface/lib/classes/remote.d/admin.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/lib/classes/remote.d/admin.inc.php b/interface/lib/classes/remote.d/admin.inc.php index 1aad1750c9..479b991b7b 100644 --- a/interface/lib/classes/remote.d/admin.inc.php +++ b/interface/lib/classes/remote.d/admin.inc.php @@ -131,8 +131,8 @@ class remoting_admin extends remoting { /** Get the values of the system configuration @param int session id - @param string section of the config field in the table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc - @param string|null key of the option that you want to set + @param string section of the config field in the table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc + @param string|null key of the option that you want to get */ public function system_config_get($session_id, $section, $key = null) { global $app; -- GitLab From 43b5b5c408438fd40cf6e8d30e3f2532c97c263f Mon Sep 17 00:00:00 2001 From: Webslice Date: Tue, 24 Mar 2020 16:21:02 +0100 Subject: [PATCH 4/4] Add system_config_get to api docs --- remoting_client/API-docs/navigation.html | 1 + .../API-docs/system_config_get.html | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 remoting_client/API-docs/system_config_get.html diff --git a/remoting_client/API-docs/navigation.html b/remoting_client/API-docs/navigation.html index 5168122f28..d8c296801b 100644 --- a/remoting_client/API-docs/navigation.html +++ b/remoting_client/API-docs/navigation.html @@ -245,6 +245,7 @@

sites_web_subdomain_delete

sites_web_subdomain_get

sites_web_subdomain_update

+

system_config_get

diff --git a/remoting_client/API-docs/system_config_get.html b/remoting_client/API-docs/system_config_get.html new file mode 100644 index 0000000000..7d73c974a3 --- /dev/null +++ b/remoting_client/API-docs/system_config_get.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

system_config_get($session_id, $section, $key ='');

+
+Description: +

Returns system config by section and optional key


+Input Variables: +

$session_id, $section, $key =''

+Parameters (in $params): +

None.

+Output: +

Returns an array with the system config's section values, or a string with the value if a specific config key was requested.

+ +
+ + -- GitLab