Commit b1d81817 authored by Marius Burkard's avatar Marius Burkard

- get rid of SoapFault dependency when using json/rest remoting endpoint

parent 35869ae9
......@@ -115,11 +115,17 @@ class ISPConfigJSONHandler {
try {
$this->_return_json('ok', '', call_user_func_array(array($this->classes[$class_name], $method), $params));
} catch(SoapFault $e) {
} catch(ISPConfigRemoteException $e) {
$this->_return_json('remote_fault', $e->getMessage());
}
}
}
?>
if(!class_exists('ISPConfigRemoteException')) {
class ISPConfigRemoteException extends Exception {
public function __construct($code = '', $message = '') {
parent::__construct($message . ' (' . $code . ')', 0);
}
}
}
\ No newline at end of file
......@@ -52,7 +52,7 @@ class remoting_admin extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'admin_record_permissions')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
......@@ -62,7 +62,7 @@ class remoting_admin extends remoting {
// check if userid is valid
$check = $app->db->queryOneRecord('SELECT userid FROM sys_user WHERE userid = ?', $app->functions->intval($value));
if(!$check || !$check['userid']) {
throw new SoapFault('invalid parameters', $value . ' is no valid sys_userid.');
throw new ISPConfigRemoteException('invalid parameters', $value . ' is no valid sys_userid.');
return false;
}
$permissions[$key] = $app->functions->intval($value);
......@@ -71,7 +71,7 @@ class remoting_admin extends remoting {
// check if groupid is valid
$check = $app->db->queryOneRecord('SELECT groupid FROM sys_group WHERE groupid = ?', $app->functions->intval($value));
if(!$check || !$check['groupid']) {
throw new SoapFault('invalid parameters', $value . ' is no valid sys_groupid.');
throw new ISPConfigRemoteException('invalid parameters', $value . ' is no valid sys_groupid.');
return false;
}
$permissions[$key] = $app->functions->intval($value);
......@@ -81,7 +81,7 @@ class remoting_admin extends remoting {
// check if permissions are valid
$value = strtolower($value);
if(!preg_match('/^[riud]+$/', $value)) {
throw new SoapFault('invalid parameters', $value . ' is no valid permission string.');
throw new ISPConfigRemoteException('invalid parameters', $value . ' is no valid permission string.');
return false;
}
......@@ -95,7 +95,7 @@ class remoting_admin extends remoting {
break;
default:
throw new SoapFault('invalid parameters', 'Only sys_userid, sys_groupid, sys_perm_user and sys_perm_group parameters can be changed with this function.');
throw new ISPConfigRemoteException('invalid parameters', 'Only sys_userid, sys_groupid, sys_perm_user and sys_perm_group parameters can be changed with this function.');
break;
}
}
......@@ -113,7 +113,7 @@ class remoting_admin extends remoting {
public function system_config_set($session_id, $section, $key, $value) {
global $app;
if(!$this->checkPerm($session_id, 'system_config_set')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if ($section != '' && $key != '') {
......@@ -123,7 +123,7 @@ class remoting_admin extends remoting {
$system_config_str = $app->ini_parser->get_ini_string($system_config_array);
return $app->db->datalogUpdate('sys_ini', array("config" => $system_config_str), 'sysini_id', 1);
} else {
throw new SoapFault('invalid_function_parameter', 'Invalid function parameter.');
throw new ISPConfigRemoteException('invalid_function_parameter', 'Invalid function parameter.');
return false;
}
}
......@@ -138,7 +138,7 @@ class remoting_admin extends remoting {
public function system_config_get($session_id, $section, $key) {
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.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if ($section != '') {
......@@ -152,7 +152,7 @@ class remoting_admin extends remoting {
else return false;
}
} else {
throw new SoapFault('invalid_function_parameter', 'Invalid function parameter.');
throw new ISPConfigRemoteException('invalid_function_parameter', 'Invalid function parameter.');
return false;
}
}
......@@ -165,13 +165,13 @@ class remoting_admin extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'config_value_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
// validate fields
if($group == '' || $name == '') {
throw new SoapFault('field_empty_error', 'Group and name parameter may not be empty.');
throw new ISPConfigRemoteException('field_empty_error', 'Group and name parameter may not be empty.');
return false;
}
......@@ -184,18 +184,18 @@ class remoting_admin extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'config_value_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
// validate fields
if($group == '' || $name == '' || $value == '') {
throw new SoapFault('field_empty_error', 'Group, name, and value parameter may not be empty.');
throw new ISPConfigRemoteException('field_empty_error', 'Group, name, and value parameter may not be empty.');
return false;
}
if(is_array($app->db->queryOneRecord('SELECT * FROM sys_config WHERE `group` = ? AND `name` = ?', $group, $name))) {
throw new SoapFault('record_unique_error', 'Group plus name field combination is not unique.');
throw new ISPConfigRemoteException('record_unique_error', 'Group plus name field combination is not unique.');
return false;
}
......@@ -208,18 +208,18 @@ class remoting_admin extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'config_value_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
// validate fields
if($group == '' || $name == '' || $value == '') {
throw new SoapFault('field_empty_error', 'Group, name, and value parameter may not be empty.');
throw new ISPConfigRemoteException('field_empty_error', 'Group, name, and value parameter may not be empty.');
return false;
}
if(!is_array($app->db->queryOneRecord('SELECT * FROM sys_config WHERE `group` = ? AND `name` = ?', $group, $name))) {
throw new SoapFault('record_nonexist_error', 'There is no record with this group plus name field combination.');
throw new ISPConfigRemoteException('record_nonexist_error', 'There is no record with this group plus name field combination.');
return false;
}
......@@ -232,13 +232,13 @@ class remoting_admin extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'config_value_replace')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
// validate fields
if($group == '' || $name == '' || $value == '') {
throw new SoapFault('field_empty_error', 'Group, name, and value parameter may not be empty.');
throw new ISPConfigRemoteException('field_empty_error', 'Group, name, and value parameter may not be empty.');
return false;
}
......@@ -255,18 +255,18 @@ class remoting_admin extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'config_value_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
// validate fields
if($group == '' || $name == '') {
throw new SoapFault('field_empty_error', 'Group and name parameter may not be empty.');
throw new ISPConfigRemoteException('field_empty_error', 'Group and name parameter may not be empty.');
return false;
}
if(!is_array($app->db->queryOneRecord('SELECT * FROM sys_config WHERE `group` = ? AND `name` = ?', $group, $name))) {
throw new SoapFault('record_nonexist_error', 'There is no record with this group plus name field combination.');
throw new ISPConfigRemoteException('record_nonexist_error', 'There is no record with this group plus name field combination.');
return false;
}
......
......@@ -40,7 +40,7 @@ class remoting_aps extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_aps_update_package_list')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
......@@ -60,7 +60,7 @@ class remoting_aps extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_aps_available_packages_list')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
......@@ -82,7 +82,7 @@ class remoting_aps extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_aps_get_package_details')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
......@@ -98,14 +98,14 @@ class remoting_aps extends remoting {
// Make sure an integer ID is given
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
throw new SoapFault('package_error', 'The given Package ID is not valid.');
throw new ISPConfigRemoteException('package_error', 'The given Package ID is not valid.');
return false;
}
// Get package details
$details = $gui->getPackageDetails($primary_id);
if (isset($details['error'])) {
throw new SoapFault('package_error', $details['error']);
throw new ISPConfigRemoteException('package_error', $details['error']);
return false;
}
......@@ -121,7 +121,7 @@ class remoting_aps extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_aps_get_package_file')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
......@@ -137,14 +137,14 @@ class remoting_aps extends remoting {
// Make sure an integer ID is given
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
throw new SoapFault('package_error', 'The given Package ID is not valid.');
throw new ISPConfigRemoteException('package_error', 'The given Package ID is not valid.');
return false;
}
// Get package details
$details = $gui->getPackageDetails($primary_id);
if (isset($details['error'])) {
throw new SoapFault('package_error', $details['error']);
throw new ISPConfigRemoteException('package_error', $details['error']);
return false;
}
......@@ -155,7 +155,7 @@ class remoting_aps extends remoting {
foreach ($details['Screenshots'] as $screen) { if (basename($screen['ScreenPath']) == $filename) { $found = true; break; } }
if (!$found) {
throw new SoapFault('package_error', 'File not found in package.');
throw new ISPConfigRemoteException('package_error', 'File not found in package.');
return false;
}
......@@ -167,7 +167,7 @@ class remoting_aps extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_aps_get_package_details')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
......@@ -183,14 +183,14 @@ class remoting_aps extends remoting {
// Make sure an integer ID is given
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
throw new SoapFault('package_error', 'The given Package ID is not valid.');
throw new ISPConfigRemoteException('package_error', 'The given Package ID is not valid.');
return false;
}
// Get package settings
$settings = $gui->getPackageSettings($primary_id);
if (isset($settings['error'])) {
throw new SoapFault('package_error', $settings['error']);
throw new ISPConfigRemoteException('package_error', $settings['error']);
return false;
}
......@@ -205,7 +205,7 @@ class remoting_aps extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_aps_change_package_status')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
......@@ -215,12 +215,12 @@ class remoting_aps extends remoting {
// Make sure an integer ID is given
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
throw new SoapFault('package_error', 'The given Package ID is not valid.');
throw new ISPConfigRemoteException('package_error', 'The given Package ID is not valid.');
return false;
}
if(!isset($params['package_status']) || (($params['package_status'] != PACKAGE_ENABLED) && ($params['package_status'] != PACKAGE_LOCKED))) {
throw new SoapFault('package_error', 'Wrong new status: '.$params['package_status']);
throw new ISPConfigRemoteException('package_error', 'Wrong new status: '.$params['package_status']);
return false;
}
......@@ -235,7 +235,7 @@ class remoting_aps extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_aps_install_package')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
......@@ -251,25 +251,25 @@ class remoting_aps extends remoting {
// Make sure an integer ID is given
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
throw new SoapFault('package_error', 'The given Package ID is not valid.');
throw new ISPConfigRemoteException('package_error', 'The given Package ID is not valid.');
return false;
}
// Get package details
$details = $gui->getPackageDetails($primary_id);
if (isset($details['error'])) {
throw new SoapFault('package_error', $details['error']);
throw new ISPConfigRemoteException('package_error', $details['error']);
return false;
}
$settings = $gui->getPackageSettings($primary_id);
if (isset($settings['error'])) {
throw new SoapFault('package_error', $settings['error']);
throw new ISPConfigRemoteException('package_error', $settings['error']);
return false;
}
// Check given Site/VHostDomain
if (!isset($params['main_domain'])) {
throw new SoapFault('invalid parameters', 'No valid domain given.');
throw new ISPConfigRemoteException('invalid parameters', 'No valid domain given.');
return false;
}
......@@ -284,7 +284,7 @@ class remoting_aps extends remoting {
}
if (!$domain) {
throw new SoapFault('invalid parameters', 'No valid domain given.');
throw new ISPConfigRemoteException('invalid parameters', 'No valid domain given.');
return false;
}
......@@ -295,7 +295,7 @@ class remoting_aps extends remoting {
return $gui->createPackageInstance($result['input'], $primary_id);
}
throw new SoapFault('invalid parameters', implode('<br />', $result['error']));
throw new ISPConfigRemoteException('invalid parameters', implode('<br />', $result['error']));
return false;
}
......@@ -304,7 +304,7 @@ class remoting_aps extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_aps_instance_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
......@@ -318,7 +318,7 @@ class remoting_aps extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_aps_instance_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
......@@ -332,7 +332,7 @@ class remoting_aps extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_aps_instance_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
......@@ -344,7 +344,7 @@ class remoting_aps extends remoting {
$result = $app->db->queryOneRecord($sql, $primary_id);
if (!$result) {
throw new SoapFault('instance_error', 'No valid instance id given.');
throw new ISPConfigRemoteException('instance_error', 'No valid instance id given.');
return false;
}
......
This diff is collapsed.
......@@ -47,7 +47,7 @@ class remoting_domains extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'domains_domain_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
......@@ -59,7 +59,7 @@ class remoting_domains extends remoting {
public function domains_domain_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'domains_domain_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
return $this->insertQuery('../client/form/domain.tform.php', $client_id, $params);
......@@ -69,7 +69,7 @@ class remoting_domains extends remoting {
public function domains_domain_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'domains_domain_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../client/form/domain.tform.php', $primary_id);
......@@ -82,7 +82,7 @@ class remoting_domains extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'domains_get_all_by_user')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$group_id = $app->functions->intval($group_id);
......
This diff is collapsed.
......@@ -38,7 +38,7 @@ class remoting_monitor extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'monitor_jobqueue_count')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
......
......@@ -52,7 +52,7 @@ class remoting_server extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'server_get_serverid_by_ip')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$sql = "SELECT server_id FROM server_ip WHERE ip_address = ?";
......@@ -66,7 +66,7 @@ class remoting_server extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'server_ip_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
......@@ -78,7 +78,7 @@ class remoting_server extends remoting {
public function server_ip_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'server_ip_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
return $this->insertQuery('../admin/form/server_ip.tform.php', $client_id, $params);
......@@ -88,7 +88,7 @@ class remoting_server extends remoting {
public function server_ip_update($session_id, $client_id, $ip_id, $params)
{
if(!$this->checkPerm($session_id, 'server_ip_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../admin/form/server_ip.tform.php', $client_id, $ip_id, $params);
......@@ -99,7 +99,7 @@ class remoting_server extends remoting {
public function server_ip_delete($session_id, $ip_id)
{
if(!$this->checkPerm($session_id, 'server_ip_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../admin/form/server_ip.tform.php', $ip_id);
......@@ -118,7 +118,7 @@ class remoting_server extends remoting {
public function server_get($session_id, $server_id = null, $section ='') {
global $app;
if(!$this->checkPerm($session_id, 'server_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (!empty($session_id)) {
......@@ -155,7 +155,7 @@ class remoting_server extends remoting {
public function server_config_set($session_id, $server_id, $section, $key, $value) {
global $app;
if(!$this->checkPerm($session_id, 'server_config_set')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (!empty($server_id) && $server_id > 0 && $section != '' && $key != '') {
......@@ -165,7 +165,7 @@ class remoting_server extends remoting {
$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
return $app->db->datalogUpdate('server', array("config" => $server_config_str), 'server_id', $server_id);
} else {
throw new SoapFault('invalid_function_parameter', 'Invalid function parameter.');
throw new ISPConfigRemoteException('invalid_function_parameter', 'Invalid function parameter.');
return false;
}
}
......@@ -180,7 +180,7 @@ class remoting_server extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'server_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (!empty($session_id)) {
......@@ -202,7 +202,7 @@ class remoting_server extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'server_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
}
if (!empty($session_id) && !empty($server_name)) {
$sql = "SELECT server_id FROM server WHERE server_name = ?";
......@@ -223,7 +223,7 @@ class remoting_server extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'server_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
}
if (!empty($session_id) && !empty($server_id)) {
$sql = "SELECT * FROM server WHERE server_id = ?";
......@@ -249,7 +249,7 @@ class remoting_server extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'server_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
}
if (!empty($session_id)) {
if($server_id == 0) $ispc_app_version = array('ispc_app_version' => ISPC_APP_VERSION);
......@@ -269,7 +269,7 @@ class remoting_server extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'server_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
}
if (!empty($session_id) && !empty($server_id) && !empty($php)) {
$php_versions = array();
......
......@@ -206,7 +206,7 @@ class remoting {
fwrite($authlog_handle, $authlog ."\n");
fclose($authlog_handle);
throw new SoapFault($error['faultcode'], $error['faultstring']);
throw new ISPConfigRemoteException($error['faultcode'], $error['faultstring']);
return false;
} else {
// User login right, so attempts can be deleted
......@@ -231,7 +231,7 @@ class remoting {
global $app;
if(empty($session_id)) {
throw new SoapFault('session_id_empty', 'The SessionID is empty.');
throw new ISPConfigRemoteException('session_id_empty', 'The SessionID is empty.');
return false;
}
......@@ -265,14 +265,14 @@ class remoting {
//* Stop on error while preparing the sql query
if($app->remoting_lib->errorMessage != '') {
throw new SoapFault('data_processing_error', $app->remoting_lib->errorMessage);
throw new ISPConfigRemoteException('data_processing_error', $app->remoting_lib->errorMessage);
return false;
}
//* Execute the SQL query
$app->db->query($sql);
if($app->db->errorMessage != '') {
throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql);
throw new ISPConfigRemoteException('database_error', $app->db->errorMessage . ' '.$sql);
return false;
}
if ( isset($params['_primary_id'] ))
......@@ -283,7 +283,7 @@ class remoting {
//* Stop on error while executing the sql query
if($app->remoting_lib->errorMessage != '') {
throw new SoapFault('data_processing_error', $app->remoting_lib->errorMessage);
throw new ISPConfigRemoteException('data_processing_error', $app->remoting_lib->errorMessage);
return false;
}
......@@ -294,7 +294,7 @@ class remoting {
/*
if($app->db->errorMessage != '') {
throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql);
throw new ISPConfigRemoteException('database_error', $app->db->errorMessage . ' '.$sql);
return false;
}
*/
......@@ -345,7 +345,7 @@ class remoting {
//* Get the SQL query
$sql = $app->remoting_lib->getSQL($params, 'INSERT', 0);
if($app->remoting_lib->errorMessage != '') {
throw new SoapFault('data_processing_error', $app->remoting_lib->errorMessage);
throw new ISPConfigRemoteException('data_processing_error', $app->remoting_lib->errorMessage);
return false;
}
$app->log('Executed insertQueryPrepare', LOGLEVEL_DEBUG);
......@@ -361,7 +361,7 @@ class remoting {
$app->db->query($sql);
if($app->db->errorMessage != '') {
throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql);
throw new ISPConfigRemoteException('database_error', $app->db->errorMessage . ' '.$sql);
return false;
}
......@@ -421,9 +421,9 @@ class remoting {
//* Get the SQL query
$sql = $app->remoting_lib->getSQL($params, 'UPDATE', $primary_id);
// throw new SoapFault('debug', $sql);
// throw new ISPConfigRemoteException('debug', $sql);
if($app->remoting_lib->errorMessage != '') {
throw new SoapFault('data_processing_error', $app->remoting_lib->errorMessage);
throw new ISPConfigRemoteException('data_processing_error', $app->remoting_lib->errorMessage);
return false;
}
......@@ -446,7 +446,7 @@ class remoting {
$app->db->query($sql);
if($app->db->errorMessage != '') {
throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql);
throw new ISPConfigRemoteException('database_error', $app->db->errorMessage . ' '.$sql);
return false;
}
......@@ -492,7 +492,7 @@ class remoting {
$affected_rows = $app->db->affectedRows();
if($app->db->errorMessage != '') {
throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql);
throw new ISPConfigRemoteException('database_error', $app->db->errorMessage . ' '.$sql);
return false;
}
......@@ -543,7 +543,7 @@ class remoting {
global $app;
if(empty($session_id)) {
throw new SoapFault('session_id_empty', 'The SessionID is empty.');
throw new ISPConfigRemoteException('session_id_empty', 'The SessionID is empty.');
return false;
}
......@@ -552,7 +552,7 @@ class remoting {
if($session['remote_userid'] > 0) {
return $session;
} else {
throw new SoapFault('session_does_not_exist', 'The Session is expired or does not exist.');
throw new ISPConfigRemoteException('session_does_not_exist', 'The Session is expired or does not exist.');
return false;
}
}
......@@ -560,7 +560,7 @@ class remoting {
public function server_get($session_id, $server_id = null, $section ='') {
global $app;
if(!$this->checkPerm($session_id, 'server_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (!empty($session_id)) {
......@@ -594,7 +594,7 @@ class remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'server_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (!empty($session_id)) {
......@@ -617,7 +617,7 @@ class remoting {
public function get_function_list($session_id)
{
if(!$this->checkPerm($session_id, 'get_function_list')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');