Commit d3544f25 authored by Florian Schaal's avatar Florian Schaal
Browse files

Merge branch 'stable-3.1' of http://git.ispconfig.org/ispconfig/ispconfig3 into stable-3.1

parents 7be3c952 86bfbd4a
...@@ -52,7 +52,7 @@ class remoting_admin extends remoting { ...@@ -52,7 +52,7 @@ class remoting_admin extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'admin_record_permissions')) { if(!$this->checkPerm($session_id, 'admin_record_permissions')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -62,7 +62,7 @@ class remoting_admin extends remoting { ...@@ -62,7 +62,7 @@ class remoting_admin extends remoting {
// check if userid is valid // check if userid is valid
$check = $app->db->queryOneRecord('SELECT userid FROM sys_user WHERE userid = ?', $app->functions->intval($value)); $check = $app->db->queryOneRecord('SELECT userid FROM sys_user WHERE userid = ?', $app->functions->intval($value));
if(!$check || !$check['userid']) { if(!$check || !$check['userid']) {
$this->server->fault('invalid parameters', $value . ' is no valid sys_userid.'); throw new SoapFault('invalid parameters', $value . ' is no valid sys_userid.');
return false; return false;
} }
$permissions[$key] = $app->functions->intval($value); $permissions[$key] = $app->functions->intval($value);
...@@ -71,7 +71,7 @@ class remoting_admin extends remoting { ...@@ -71,7 +71,7 @@ class remoting_admin extends remoting {
// check if groupid is valid // check if groupid is valid
$check = $app->db->queryOneRecord('SELECT groupid FROM sys_group WHERE groupid = ?', $app->functions->intval($value)); $check = $app->db->queryOneRecord('SELECT groupid FROM sys_group WHERE groupid = ?', $app->functions->intval($value));
if(!$check || !$check['groupid']) { if(!$check || !$check['groupid']) {
$this->server->fault('invalid parameters', $value . ' is no valid sys_groupid.'); throw new SoapFault('invalid parameters', $value . ' is no valid sys_groupid.');
return false; return false;
} }
$permissions[$key] = $app->functions->intval($value); $permissions[$key] = $app->functions->intval($value);
...@@ -81,7 +81,7 @@ class remoting_admin extends remoting { ...@@ -81,7 +81,7 @@ class remoting_admin extends remoting {
// check if permissions are valid // check if permissions are valid
$value = strtolower($value); $value = strtolower($value);
if(!preg_match('/^[riud]+$/', $value)) { if(!preg_match('/^[riud]+$/', $value)) {
$this->server->fault('invalid parameters', $value . ' is no valid permission string.'); throw new SoapFault('invalid parameters', $value . ' is no valid permission string.');
return false; return false;
} }
...@@ -95,7 +95,7 @@ class remoting_admin extends remoting { ...@@ -95,7 +95,7 @@ class remoting_admin extends remoting {
break; break;
default: default:
$this->server->fault('invalid parameters', 'Only sys_userid, sys_groupid, sys_perm_user and sys_perm_group parameters can be changed with this function.'); throw new SoapFault('invalid parameters', 'Only sys_userid, sys_groupid, sys_perm_user and sys_perm_group parameters can be changed with this function.');
break; break;
} }
} }
......
...@@ -40,7 +40,7 @@ class remoting_aps extends remoting { ...@@ -40,7 +40,7 @@ class remoting_aps extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'sites_aps_update_package_list')) { if(!$this->checkPerm($session_id, 'sites_aps_update_package_list')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -60,7 +60,7 @@ class remoting_aps extends remoting { ...@@ -60,7 +60,7 @@ class remoting_aps extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'sites_aps_available_packages_list')) { if(!$this->checkPerm($session_id, 'sites_aps_available_packages_list')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -82,7 +82,7 @@ class remoting_aps extends remoting { ...@@ -82,7 +82,7 @@ class remoting_aps extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'sites_aps_get_package_details')) { if(!$this->checkPerm($session_id, 'sites_aps_get_package_details')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -98,14 +98,14 @@ class remoting_aps extends remoting { ...@@ -98,14 +98,14 @@ class remoting_aps extends remoting {
// Make sure an integer ID is given // Make sure an integer ID is given
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
$this->server->fault('package_error', 'The given Package ID is not valid.'); throw new SoapFault('package_error', 'The given Package ID is not valid.');
return false; return false;
} }
// Get package details // Get package details
$details = $gui->getPackageDetails($primary_id); $details = $gui->getPackageDetails($primary_id);
if (isset($details['error'])) { if (isset($details['error'])) {
$this->server->fault('package_error', $details['error']); throw new SoapFault('package_error', $details['error']);
return false; return false;
} }
...@@ -121,7 +121,7 @@ class remoting_aps extends remoting { ...@@ -121,7 +121,7 @@ class remoting_aps extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'sites_aps_get_package_file')) { if(!$this->checkPerm($session_id, 'sites_aps_get_package_file')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -137,14 +137,14 @@ class remoting_aps extends remoting { ...@@ -137,14 +137,14 @@ class remoting_aps extends remoting {
// Make sure an integer ID is given // Make sure an integer ID is given
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
$this->server->fault('package_error', 'The given Package ID is not valid.'); throw new SoapFault('package_error', 'The given Package ID is not valid.');
return false; return false;
} }
// Get package details // Get package details
$details = $gui->getPackageDetails($primary_id); $details = $gui->getPackageDetails($primary_id);
if (isset($details['error'])) { if (isset($details['error'])) {
$this->server->fault('package_error', $details['error']); throw new SoapFault('package_error', $details['error']);
return false; return false;
} }
...@@ -155,7 +155,7 @@ class remoting_aps extends remoting { ...@@ -155,7 +155,7 @@ class remoting_aps extends remoting {
foreach ($details['Screenshots'] as $screen) { if (basename($screen['ScreenPath']) == $filename) { $found = true; break; } } foreach ($details['Screenshots'] as $screen) { if (basename($screen['ScreenPath']) == $filename) { $found = true; break; } }
if (!$found) { if (!$found) {
$this->server->fault('package_error', 'File not found in package.'); throw new SoapFault('package_error', 'File not found in package.');
return false; return false;
} }
...@@ -167,7 +167,7 @@ class remoting_aps extends remoting { ...@@ -167,7 +167,7 @@ class remoting_aps extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'sites_aps_get_package_details')) { if(!$this->checkPerm($session_id, 'sites_aps_get_package_details')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -183,14 +183,14 @@ class remoting_aps extends remoting { ...@@ -183,14 +183,14 @@ class remoting_aps extends remoting {
// Make sure an integer ID is given // Make sure an integer ID is given
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
$this->server->fault('package_error', 'The given Package ID is not valid.'); throw new SoapFault('package_error', 'The given Package ID is not valid.');
return false; return false;
} }
// Get package settings // Get package settings
$settings = $gui->getPackageSettings($primary_id); $settings = $gui->getPackageSettings($primary_id);
if (isset($settings['error'])) { if (isset($settings['error'])) {
$this->server->fault('package_error', $settings['error']); throw new SoapFault('package_error', $settings['error']);
return false; return false;
} }
...@@ -205,7 +205,7 @@ class remoting_aps extends remoting { ...@@ -205,7 +205,7 @@ class remoting_aps extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'sites_aps_change_package_status')) { if(!$this->checkPerm($session_id, 'sites_aps_change_package_status')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -215,12 +215,12 @@ class remoting_aps extends remoting { ...@@ -215,12 +215,12 @@ class remoting_aps extends remoting {
// Make sure an integer ID is given // Make sure an integer ID is given
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
$this->server->fault('package_error', 'The given Package ID is not valid.'); throw new SoapFault('package_error', 'The given Package ID is not valid.');
return false; return false;
} }
if(!isset($params['package_status']) || (($params['package_status'] != PACKAGE_ENABLED) && ($params['package_status'] != PACKAGE_LOCKED))) { if(!isset($params['package_status']) || (($params['package_status'] != PACKAGE_ENABLED) && ($params['package_status'] != PACKAGE_LOCKED))) {
$this->server->fault('package_error', 'Wrong new status: '.$params['package_status']); throw new SoapFault('package_error', 'Wrong new status: '.$params['package_status']);
return false; return false;
} }
...@@ -235,7 +235,7 @@ class remoting_aps extends remoting { ...@@ -235,7 +235,7 @@ class remoting_aps extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'sites_aps_install_package')) { if(!$this->checkPerm($session_id, 'sites_aps_install_package')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -251,25 +251,25 @@ class remoting_aps extends remoting { ...@@ -251,25 +251,25 @@ class remoting_aps extends remoting {
// Make sure an integer ID is given // Make sure an integer ID is given
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
$this->server->fault('package_error', 'The given Package ID is not valid.'); throw new SoapFault('package_error', 'The given Package ID is not valid.');
return false; return false;
} }
// Get package details // Get package details
$details = $gui->getPackageDetails($primary_id); $details = $gui->getPackageDetails($primary_id);
if (isset($details['error'])) { if (isset($details['error'])) {
$this->server->fault('package_error', $details['error']); throw new SoapFault('package_error', $details['error']);
return false; return false;
} }
$settings = $gui->getPackageSettings($primary_id); $settings = $gui->getPackageSettings($primary_id);
if (isset($settings['error'])) { if (isset($settings['error'])) {
$this->server->fault('package_error', $settings['error']); throw new SoapFault('package_error', $settings['error']);
return false; return false;
} }
// Check given Site/VHostDomain // Check given Site/VHostDomain
if (!isset($params['main_domain'])) { if (!isset($params['main_domain'])) {
$this->server->fault('invalid parameters', 'No valid domain given.'); throw new SoapFault('invalid parameters', 'No valid domain given.');
return false; return false;
} }
...@@ -284,7 +284,7 @@ class remoting_aps extends remoting { ...@@ -284,7 +284,7 @@ class remoting_aps extends remoting {
} }
if (!$domain) { if (!$domain) {
$this->server->fault('invalid parameters', 'No valid domain given.'); throw new SoapFault('invalid parameters', 'No valid domain given.');
return false; return false;
} }
...@@ -295,7 +295,7 @@ class remoting_aps extends remoting { ...@@ -295,7 +295,7 @@ class remoting_aps extends remoting {
return $gui->createPackageInstance($result['input'], $primary_id); return $gui->createPackageInstance($result['input'], $primary_id);
} }
$this->server->fault('invalid parameters', implode('<br />', $result['error'])); throw new SoapFault('invalid parameters', implode('<br />', $result['error']));
return false; return false;
} }
...@@ -304,7 +304,7 @@ class remoting_aps extends remoting { ...@@ -304,7 +304,7 @@ class remoting_aps extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'sites_aps_instance_get')) { if(!$this->checkPerm($session_id, 'sites_aps_instance_get')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -318,7 +318,7 @@ class remoting_aps extends remoting { ...@@ -318,7 +318,7 @@ class remoting_aps extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'sites_aps_instance_get')) { if(!$this->checkPerm($session_id, 'sites_aps_instance_get')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -332,7 +332,7 @@ class remoting_aps extends remoting { ...@@ -332,7 +332,7 @@ class remoting_aps extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'sites_aps_instance_delete')) { if(!$this->checkPerm($session_id, 'sites_aps_instance_delete')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -344,7 +344,7 @@ class remoting_aps extends remoting { ...@@ -344,7 +344,7 @@ class remoting_aps extends remoting {
$result = $app->db->queryOneRecord($sql, $primary_id); $result = $app->db->queryOneRecord($sql, $primary_id);
if (!$result) { if (!$result) {
$this->server->fault('instance_error', 'No valid instance id given.'); throw new SoapFault('instance_error', 'No valid instance id given.');
return false; return false;
} }
......
...@@ -171,12 +171,10 @@ class remoting_client extends remoting { ...@@ -171,12 +171,10 @@ class remoting_client extends remoting {
// check if this one is reseller // check if this one is reseller
$check = $app->db->queryOneRecord('SELECT `limit_client` FROM `client` WHERE `client_id` = ?', intval($params['parent_client_id'])); $check = $app->db->queryOneRecord('SELECT `limit_client` FROM `client` WHERE `client_id` = ?', intval($params['parent_client_id']));
if($check['limit_client'] == 0) { if($check['limit_client'] == 0) {
$this->server->fault('Invalid reseller', 'Selected client is not a reseller.'); // Selected client is not a reseller. REMOVING PARENT_CLIENT_ID!!!
return false; $params['parent_client_id'] = 0;
} } elseif(isset($params['limit_client']) && $params['limit_client'] != 0) {
throw new SoapFault('Invalid reseller', 'Reseller cannot be client of another reseller.');
if(isset($params['limit_client']) && $params['limit_client'] != 0) {
$this->server->fault('Invalid reseller', 'Reseller cannot be client of another reseller.');
return false; return false;
} }
} }
...@@ -210,12 +208,12 @@ class remoting_client extends remoting { ...@@ -210,12 +208,12 @@ class remoting_client extends remoting {
// check if this one is reseller // check if this one is reseller
$check = $app->db->queryOneRecord('SELECT `limit_client` FROM `client` WHERE `client_id` = ?', intval($params['parent_client_id'])); $check = $app->db->queryOneRecord('SELECT `limit_client` FROM `client` WHERE `client_id` = ?', intval($params['parent_client_id']));
if($check['limit_client'] == 0) { if($check['limit_client'] == 0) {
$this->server->fault('Invalid reseller', 'Selected client is not a reseller.'); throw new SoapFault('Invalid reseller', 'Selected client is not a reseller.');
return false; return false;
} }
if(isset($params['limit_client']) && $params['limit_client'] != 0) { if(isset($params['limit_client']) && $params['limit_client'] != 0) {
$this->server->fault('Invalid reseller', 'Reseller cannot be client of another reseller.'); throw new SoapFault('Invalid reseller', 'Reseller cannot be client of another reseller.');
return false; return false;
} }
} }
...@@ -253,7 +251,7 @@ class remoting_client extends remoting { ...@@ -253,7 +251,7 @@ class remoting_client extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'client_get')) { if(!$this->checkPerm($session_id, 'client_get')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -261,7 +259,7 @@ class remoting_client extends remoting { ...@@ -261,7 +259,7 @@ class remoting_client extends remoting {
$sql = "SELECT * FROM `client_template_assigned` WHERE `client_id` = ?"; $sql = "SELECT * FROM `client_template_assigned` WHERE `client_id` = ?";
return $app->db->queryOneRecord($sql, $client_id); return $app->db->queryOneRecord($sql, $client_id);
} else { } else {
$this->server->fault('The ID must be an integer.'); throw new SoapFault('The ID must be an integer.');
return array(); return array();
} }
} }
...@@ -291,7 +289,7 @@ class remoting_client extends remoting { ...@@ -291,7 +289,7 @@ class remoting_client extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'client_update')) { if(!$this->checkPerm($session_id, 'client_update')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -299,13 +297,13 @@ class remoting_client extends remoting { ...@@ -299,13 +297,13 @@ class remoting_client extends remoting {
// check if client exists // check if client exists
$check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ?', $client_id); $check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ?', $client_id);
if(!$check) { if(!$check) {
$this->server->fault('Invalid client'); throw new SoapFault('Invalid client');
return false; return false;
} }
// check if template exists // check if template exists
$check = $app->db->queryOneRecord('SELECT `template_id` FROM `client_template` WHERE `template_id` = ?', $template_id); $check = $app->db->queryOneRecord('SELECT `template_id` FROM `client_template` WHERE `template_id` = ?', $template_id);
if(!$check) { if(!$check) {
$this->server->fault('Invalid template'); throw new SoapFault('Invalid template');
return false; return false;
} }
...@@ -320,7 +318,7 @@ class remoting_client extends remoting { ...@@ -320,7 +318,7 @@ class remoting_client extends remoting {
return $insert_id; return $insert_id;
} else { } else {
$this->server->fault('The IDs must be of type integer.'); throw new SoapFault('The IDs must be of type integer.');
return false; return false;
} }
} }
...@@ -329,7 +327,7 @@ class remoting_client extends remoting { ...@@ -329,7 +327,7 @@ class remoting_client extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'client_update')) { if(!$this->checkPerm($session_id, 'client_update')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -337,13 +335,13 @@ class remoting_client extends remoting { ...@@ -337,13 +335,13 @@ class remoting_client extends remoting {
// check if client exists // check if client exists
$check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ?', $client_id); $check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ?', $client_id);
if(!$check) { if(!$check) {
$this->server->fault('Invalid client'); throw new SoapFault('Invalid client');
return false; return false;
} }
// check if template exists // check if template exists
$check = $app->db->queryOneRecord('SELECT `assigned_template_id` FROM `client_template_assigned` WHERE `assigned_template_id` = ?', $assigned_template_id); $check = $app->db->queryOneRecord('SELECT `assigned_template_id` FROM `client_template_assigned` WHERE `assigned_template_id` = ?', $assigned_template_id);
if(!$check) { if(!$check) {
$this->server->fault('Invalid template'); throw new SoapFault('Invalid template');
return false; return false;
} }
...@@ -358,7 +356,7 @@ class remoting_client extends remoting { ...@@ -358,7 +356,7 @@ class remoting_client extends remoting {
return $affected_rows; return $affected_rows;
} else { } else {
$this->server->fault('The IDs must be of type integer.'); throw new SoapFault('The IDs must be of type integer.');
return false; return false;
} }
} }
......
...@@ -316,7 +316,7 @@ class remoting_mail extends remoting { ...@@ -316,7 +316,7 @@ class remoting_mail extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'mail_user_backup')) { if(!$this->checkPerm($session_id, 'mail_user_backup')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
...@@ -339,7 +339,7 @@ class remoting_mail extends remoting { ...@@ -339,7 +339,7 @@ class remoting_mail extends remoting {
global $app; global $app;
if(!$this->checkPerm($session_id, 'mail_user_backup')) {