Skip to content

Commit b72e5ec

Browse files
WebsliceTill Brehm
authored andcommitted
Feature/add api example system config get
1 parent 2cc5f03 commit b72e5ec

File tree

4 files changed

+81
-4
lines changed

4 files changed

+81
-4
lines changed

interface/lib/classes/remote.d/admin.inc.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,10 @@ public function system_config_set($session_id, $section, $key, $value) {
131131
/**
132132
Get the values of the system configuration
133133
@param int session id
134-
@param string section of the config field in the table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc
135-
@param string key of the option that you want to set
136-
@param string option value that you want to set
134+
@param string section of the config field in the table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc
135+
@param string|null key of the option that you want to get
137136
*/
138-
public function system_config_get($session_id, $section, $key) {
137+
public function system_config_get($session_id, $section, $key = null) {
139138
global $app;
140139
if(!$this->checkPerm($session_id, 'system_config_get')) {
141140
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');

remoting_client/API-docs/navigation.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ <h3>S</h3>
245245
<p><a href="sites_web_subdomain_delete.html" target="content">sites_web_subdomain_delete</a></p>
246246
<p><a href="sites_web_subdomain_get.html" target="content">sites_web_subdomain_get</a></p>
247247
<p><a href="sites_web_subdomain_update.html" target="content">sites_web_subdomain_update</a></p>
248+
<p><a href="system_config_get.html" target="content">system_config_get</a></p>
248249

249250
<p><a href=""></a></p>
250251
<p></p>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2+
<html><head><title>ISPCOnfig 3 remote API documentation</title>
3+
4+
5+
6+
7+
8+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
9+
<link rel="stylesheet" type="text/css" href="definitionen.css">
10+
<style type="text/css">
11+
</style></head>
12+
13+
<body>
14+
<div style="padding:40px">
15+
<h1>system_config_get(<span class="var">$session_id</span>, <span class="var">$section</span>, <span class="var">$key</span> ='');</h1>
16+
<br>
17+
<b>Description: </b>
18+
<p class="margin"> Returns system config by section and optional key</p><br>
19+
<b>Input Variables: </b>
20+
<p class="margin"> <span class="var">$session_id</span>, <span class="var">$section</span>, <span class="var">$key</span> =''</p>
21+
<b>Parameters (in <span class="var">$params</span>): </b>
22+
<p class="margin"> None.</p>
23+
<b>Output: </b>
24+
<p class="margin"> Returns an array with the system config's section values, or a string with the value if a specific config key was requested.</p>
25+
<!--<b>Output:</b>
26+
<p style="margin-left:100px">Gives a record of </p> -->
27+
</div>
28+
29+
</body></html>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
require 'soap_config.php';
4+
5+
$context = stream_context_create([
6+
'ssl' => [
7+
// set some SSL/TLS specific options
8+
'verify_peer' => false,
9+
'verify_peer_name' => false,
10+
'allow_self_signed' => true
11+
]
12+
]);
13+
14+
15+
$client = new SoapClient(null, array('location' => $soap_location,
16+
'uri' => $soap_uri,
17+
'trace' => 1,
18+
'exceptions' => 1,
19+
'stream_context' => $context));
20+
21+
22+
try {
23+
if($session_id = $client->login($username, $password)) {
24+
echo 'Logged successfull. Session ID:'.$session_id.'<br />';
25+
}
26+
27+
//* Set the function parameters.
28+
$server_id = 1;
29+
30+
$result = $client->system_config_get($session_id, 'misc');
31+
print_r($result);
32+
echo "<br>";
33+
34+
$result = $client->system_config_get($session_id, 'misc', 'maintenance_mode');
35+
print_r($result);
36+
echo "<br>";
37+
38+
if($client->logout($session_id)) {
39+
echo 'Logged out.<br />';
40+
}
41+
42+
43+
} catch (SoapFault $e) {
44+
echo $client->__getLastResponse();
45+
die('SOAP Error: '.$e->getMessage());
46+
}
47+
48+
?>

0 commit comments

Comments
 (0)