Skip to content

Commit d3544f2

Browse files
author
Florian Schaal
committed
Merge branch 'stable-3.1' of http://git.ispconfig.org/ispconfig/ispconfig3 into stable-3.1
2 parents 7be3c95 + 86bfbd4 commit d3544f2

File tree

15 files changed

+152
-121
lines changed

15 files changed

+152
-121
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function update_record_permissions($tablename, $index_field, $index_value
5252
global $app;
5353

5454
if(!$this->checkPerm($session_id, 'admin_record_permissions')) {
55-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
55+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
5656
return false;
5757
}
5858

@@ -62,7 +62,7 @@ public function update_record_permissions($tablename, $index_field, $index_value
6262
// check if userid is valid
6363
$check = $app->db->queryOneRecord('SELECT userid FROM sys_user WHERE userid = ?', $app->functions->intval($value));
6464
if(!$check || !$check['userid']) {
65-
$this->server->fault('invalid parameters', $value . ' is no valid sys_userid.');
65+
throw new SoapFault('invalid parameters', $value . ' is no valid sys_userid.');
6666
return false;
6767
}
6868
$permissions[$key] = $app->functions->intval($value);
@@ -71,7 +71,7 @@ public function update_record_permissions($tablename, $index_field, $index_value
7171
// check if groupid is valid
7272
$check = $app->db->queryOneRecord('SELECT groupid FROM sys_group WHERE groupid = ?', $app->functions->intval($value));
7373
if(!$check || !$check['groupid']) {
74-
$this->server->fault('invalid parameters', $value . ' is no valid sys_groupid.');
74+
throw new SoapFault('invalid parameters', $value . ' is no valid sys_groupid.');
7575
return false;
7676
}
7777
$permissions[$key] = $app->functions->intval($value);
@@ -81,7 +81,7 @@ public function update_record_permissions($tablename, $index_field, $index_value
8181
// check if permissions are valid
8282
$value = strtolower($value);
8383
if(!preg_match('/^[riud]+$/', $value)) {
84-
$this->server->fault('invalid parameters', $value . ' is no valid permission string.');
84+
throw new SoapFault('invalid parameters', $value . ' is no valid permission string.');
8585
return false;
8686
}
8787

@@ -95,7 +95,7 @@ public function update_record_permissions($tablename, $index_field, $index_value
9595

9696
break;
9797
default:
98-
$this->server->fault('invalid parameters', 'Only sys_userid, sys_groupid, sys_perm_user and sys_perm_group parameters can be changed with this function.');
98+
throw new SoapFault('invalid parameters', 'Only sys_userid, sys_groupid, sys_perm_user and sys_perm_group parameters can be changed with this function.');
9999
break;
100100
}
101101
}

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

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function sites_aps_update_package_list($session_id)
4040
global $app;
4141

4242
if(!$this->checkPerm($session_id, 'sites_aps_update_package_list')) {
43-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
43+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
4444
return false;
4545
}
4646

@@ -60,7 +60,7 @@ public function sites_aps_available_packages_list($session_id, $params = array()
6060
global $app;
6161

6262
if(!$this->checkPerm($session_id, 'sites_aps_available_packages_list')) {
63-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
63+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
6464
return false;
6565
}
6666

@@ -82,7 +82,7 @@ public function sites_aps_get_package_details($session_id, $primary_id)
8282
global $app;
8383

8484
if(!$this->checkPerm($session_id, 'sites_aps_get_package_details')) {
85-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
85+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
8686
return false;
8787
}
8888

@@ -98,14 +98,14 @@ public function sites_aps_get_package_details($session_id, $primary_id)
9898

9999
// Make sure an integer ID is given
100100
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
101-
$this->server->fault('package_error', 'The given Package ID is not valid.');
101+
throw new SoapFault('package_error', 'The given Package ID is not valid.');
102102
return false;
103103
}
104104

105105
// Get package details
106106
$details = $gui->getPackageDetails($primary_id);
107107
if (isset($details['error'])) {
108-
$this->server->fault('package_error', $details['error']);
108+
throw new SoapFault('package_error', $details['error']);
109109
return false;
110110
}
111111

@@ -121,7 +121,7 @@ public function sites_aps_get_package_file($session_id, $primary_id, $filename)
121121
global $app;
122122

123123
if(!$this->checkPerm($session_id, 'sites_aps_get_package_file')) {
124-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
124+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
125125
return false;
126126
}
127127

@@ -137,14 +137,14 @@ public function sites_aps_get_package_file($session_id, $primary_id, $filename)
137137

138138
// Make sure an integer ID is given
139139
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
140-
$this->server->fault('package_error', 'The given Package ID is not valid.');
140+
throw new SoapFault('package_error', 'The given Package ID is not valid.');
141141
return false;
142142
}
143143

144144
// Get package details
145145
$details = $gui->getPackageDetails($primary_id);
146146
if (isset($details['error'])) {
147-
$this->server->fault('package_error', $details['error']);
147+
throw new SoapFault('package_error', $details['error']);
148148
return false;
149149
}
150150

@@ -155,7 +155,7 @@ public function sites_aps_get_package_file($session_id, $primary_id, $filename)
155155
foreach ($details['Screenshots'] as $screen) { if (basename($screen['ScreenPath']) == $filename) { $found = true; break; } }
156156

157157
if (!$found) {
158-
$this->server->fault('package_error', 'File not found in package.');
158+
throw new SoapFault('package_error', 'File not found in package.');
159159
return false;
160160
}
161161

@@ -167,7 +167,7 @@ public function sites_aps_get_package_settings($session_id, $primary_id)
167167
global $app;
168168

169169
if(!$this->checkPerm($session_id, 'sites_aps_get_package_details')) {
170-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
170+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
171171
return false;
172172
}
173173

@@ -183,14 +183,14 @@ public function sites_aps_get_package_settings($session_id, $primary_id)
183183

184184
// Make sure an integer ID is given
185185
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
186-
$this->server->fault('package_error', 'The given Package ID is not valid.');
186+
throw new SoapFault('package_error', 'The given Package ID is not valid.');
187187
return false;
188188
}
189189

190190
// Get package settings
191191
$settings = $gui->getPackageSettings($primary_id);
192192
if (isset($settings['error'])) {
193-
$this->server->fault('package_error', $settings['error']);
193+
throw new SoapFault('package_error', $settings['error']);
194194
return false;
195195
}
196196

@@ -205,7 +205,7 @@ public function sites_aps_change_package_status($session_id, $primary_id, $param
205205
global $app;
206206

207207
if(!$this->checkPerm($session_id, 'sites_aps_change_package_status')) {
208-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
208+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
209209
return false;
210210
}
211211

@@ -215,12 +215,12 @@ public function sites_aps_change_package_status($session_id, $primary_id, $param
215215

216216
// Make sure an integer ID is given
217217
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
218-
$this->server->fault('package_error', 'The given Package ID is not valid.');
218+
throw new SoapFault('package_error', 'The given Package ID is not valid.');
219219
return false;
220220
}
221221

222222
if(!isset($params['package_status']) || (($params['package_status'] != PACKAGE_ENABLED) && ($params['package_status'] != PACKAGE_LOCKED))) {
223-
$this->server->fault('package_error', 'Wrong new status: '.$params['package_status']);
223+
throw new SoapFault('package_error', 'Wrong new status: '.$params['package_status']);
224224
return false;
225225
}
226226

@@ -235,7 +235,7 @@ public function sites_aps_install_package($session_id, $primary_id, $params)
235235
global $app;
236236

237237
if(!$this->checkPerm($session_id, 'sites_aps_install_package')) {
238-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
238+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
239239
return false;
240240
}
241241

@@ -251,25 +251,25 @@ public function sites_aps_install_package($session_id, $primary_id, $params)
251251

252252
// Make sure an integer ID is given
253253
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
254-
$this->server->fault('package_error', 'The given Package ID is not valid.');
254+
throw new SoapFault('package_error', 'The given Package ID is not valid.');
255255
return false;
256256
}
257257

258258
// Get package details
259259
$details = $gui->getPackageDetails($primary_id);
260260
if (isset($details['error'])) {
261-
$this->server->fault('package_error', $details['error']);
261+
throw new SoapFault('package_error', $details['error']);
262262
return false;
263263
}
264264
$settings = $gui->getPackageSettings($primary_id);
265265
if (isset($settings['error'])) {
266-
$this->server->fault('package_error', $settings['error']);
266+
throw new SoapFault('package_error', $settings['error']);
267267
return false;
268268
}
269269

270270
// Check given Site/VHostDomain
271271
if (!isset($params['main_domain'])) {
272-
$this->server->fault('invalid parameters', 'No valid domain given.');
272+
throw new SoapFault('invalid parameters', 'No valid domain given.');
273273
return false;
274274
}
275275

@@ -284,7 +284,7 @@ public function sites_aps_install_package($session_id, $primary_id, $params)
284284
}
285285

286286
if (!$domain) {
287-
$this->server->fault('invalid parameters', 'No valid domain given.');
287+
throw new SoapFault('invalid parameters', 'No valid domain given.');
288288
return false;
289289
}
290290

@@ -295,7 +295,7 @@ public function sites_aps_install_package($session_id, $primary_id, $params)
295295
return $gui->createPackageInstance($result['input'], $primary_id);
296296
}
297297

298-
$this->server->fault('invalid parameters', implode('<br />', $result['error']));
298+
throw new SoapFault('invalid parameters', implode('<br />', $result['error']));
299299
return false;
300300
}
301301

@@ -304,7 +304,7 @@ public function sites_aps_instance_get($session_id, $primary_id)
304304
global $app;
305305

306306
if(!$this->checkPerm($session_id, 'sites_aps_instance_get')) {
307-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
307+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
308308
return false;
309309
}
310310

@@ -318,7 +318,7 @@ public function sites_aps_instance_settings_get($session_id, $primary_id)
318318
global $app;
319319

320320
if(!$this->checkPerm($session_id, 'sites_aps_instance_get')) {
321-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
321+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
322322
return false;
323323
}
324324

@@ -332,7 +332,7 @@ public function sites_aps_instance_delete($session_id, $primary_id, $params = ar
332332
global $app;
333333

334334
if(!$this->checkPerm($session_id, 'sites_aps_instance_delete')) {
335-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
335+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
336336
return false;
337337
}
338338

@@ -344,7 +344,7 @@ public function sites_aps_instance_delete($session_id, $primary_id, $params = ar
344344
$result = $app->db->queryOneRecord($sql, $primary_id);
345345

346346
if (!$result) {
347-
$this->server->fault('instance_error', 'No valid instance id given.');
347+
throw new SoapFault('instance_error', 'No valid instance id given.');
348348
return false;
349349
}
350350

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

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,10 @@ public function client_add($session_id, $reseller_id, $params)
171171
// check if this one is reseller
172172
$check = $app->db->queryOneRecord('SELECT `limit_client` FROM `client` WHERE `client_id` = ?', intval($params['parent_client_id']));
173173
if($check['limit_client'] == 0) {
174-
$this->server->fault('Invalid reseller', 'Selected client is not a reseller.');
175-
return false;
176-
}
177-
178-
if(isset($params['limit_client']) && $params['limit_client'] != 0) {
179-
$this->server->fault('Invalid reseller', 'Reseller cannot be client of another reseller.');
174+
// Selected client is not a reseller. REMOVING PARENT_CLIENT_ID!!!
175+
$params['parent_client_id'] = 0;
176+
} elseif(isset($params['limit_client']) && $params['limit_client'] != 0) {
177+
throw new SoapFault('Invalid reseller', 'Reseller cannot be client of another reseller.');
180178
return false;
181179
}
182180
}
@@ -210,12 +208,12 @@ public function client_update($session_id, $client_id, $reseller_id, $params)
210208
// check if this one is reseller
211209
$check = $app->db->queryOneRecord('SELECT `limit_client` FROM `client` WHERE `client_id` = ?', intval($params['parent_client_id']));
212210
if($check['limit_client'] == 0) {
213-
$this->server->fault('Invalid reseller', 'Selected client is not a reseller.');
211+
throw new SoapFault('Invalid reseller', 'Selected client is not a reseller.');
214212
return false;
215213
}
216214

217215
if(isset($params['limit_client']) && $params['limit_client'] != 0) {
218-
$this->server->fault('Invalid reseller', 'Reseller cannot be client of another reseller.');
216+
throw new SoapFault('Invalid reseller', 'Reseller cannot be client of another reseller.');
219217
return false;
220218
}
221219
}
@@ -253,15 +251,15 @@ public function client_template_additional_get($session_id, $client_id) {
253251
global $app;
254252

255253
if(!$this->checkPerm($session_id, 'client_get')) {
256-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
254+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
257255
return false;
258256
}
259257

260258
if(@is_numeric($client_id)) {
261259
$sql = "SELECT * FROM `client_template_assigned` WHERE `client_id` = ?";
262260
return $app->db->queryOneRecord($sql, $client_id);
263261
} else {
264-
$this->server->fault('The ID must be an integer.');
262+
throw new SoapFault('The ID must be an integer.');
265263
return array();
266264
}
267265
}
@@ -291,21 +289,21 @@ public function client_template_additional_add($session_id, $client_id, $templat
291289
global $app;
292290

293291
if(!$this->checkPerm($session_id, 'client_update')) {
294-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
292+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
295293
return false;
296294
}
297295

298296
if(@is_numeric($client_id) && @is_numeric($template_id)) {
299297
// check if client exists
300298
$check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ?', $client_id);
301299
if(!$check) {
302-
$this->server->fault('Invalid client');
300+
throw new SoapFault('Invalid client');
303301
return false;
304302
}
305303
// check if template exists
306304
$check = $app->db->queryOneRecord('SELECT `template_id` FROM `client_template` WHERE `template_id` = ?', $template_id);
307305
if(!$check) {
308-
$this->server->fault('Invalid template');
306+
throw new SoapFault('Invalid template');
309307
return false;
310308
}
311309

@@ -320,7 +318,7 @@ public function client_template_additional_add($session_id, $client_id, $templat
320318

321319
return $insert_id;
322320
} else {
323-
$this->server->fault('The IDs must be of type integer.');
321+
throw new SoapFault('The IDs must be of type integer.');
324322
return false;
325323
}
326324
}
@@ -329,21 +327,21 @@ public function client_template_additional_delete($session_id, $client_id, $assi
329327
global $app;
330328

331329
if(!$this->checkPerm($session_id, 'client_update')) {
332-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
330+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
333331
return false;
334332
}
335333

336334
if(@is_numeric($client_id) && @is_numeric($template_id)) {
337335
// check if client exists
338336
$check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ?', $client_id);
339337
if(!$check) {
340-
$this->server->fault('Invalid client');
338+
throw new SoapFault('Invalid client');
341339
return false;
342340
}
343341
// check if template exists
344342
$check = $app->db->queryOneRecord('SELECT `assigned_template_id` FROM `client_template_assigned` WHERE `assigned_template_id` = ?', $assigned_template_id);
345343
if(!$check) {
346-
$this->server->fault('Invalid template');
344+
throw new SoapFault('Invalid template');
347345
return false;
348346
}
349347

@@ -358,7 +356,7 @@ public function client_template_additional_delete($session_id, $client_id, $assi
358356

359357
return $affected_rows;
360358
} else {
361-
$this->server->fault('The IDs must be of type integer.');
359+
throw new SoapFault('The IDs must be of type integer.');
362360
return false;
363361
}
364362
}

0 commit comments

Comments
 (0)