Skip to content
......@@ -153,10 +153,10 @@ class listform_tpl_generator {
}
function lng_add($lang, $listDef, $module = '') {
global $go_api, $go_info, $conf;
global $app, $conf;
if($module == '') {
$lng_file = "lib/lang/".$conf["language"]."_".$listDef['name']."_list.lng";
$lng_file = "lib/lang/".$app->functions->check_language($conf["language"])."_".$listDef['name']."_list.lng";
} else {
$lng_file = '../'.$module."/lib/lang/en_".$listDef['name']."_list.lng";
}
......
......@@ -124,17 +124,35 @@ class plugin {
$tmp_event = $sub_events[2];
if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG);
$tmpresult = $this->callPluginEvent($tmp_event, $data, $return_data);
if($return_data == true && $tmpresult) $result .= $tmpresult;
if($return_data == true && $tmpresult) {
if(is_array($tmpresult) && (!$result || is_array($result))) {
$result = array_merge($result, $tmpresult);
} elseif(!is_array($tmpresult)) {
$result .= $tmpresult;
}
}
$tmp_event = $sub_events[0].':'.$sub_events[2];
if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG);
$tmpresult = $this->callPluginEvent($tmp_event, $data, $return_data);
if($return_data == true && $tmpresult) $result .= $tmpresult;
if($return_data == true && $tmpresult) {
if(is_array($tmpresult) && (!$result || is_array($result))) {
$result = array_merge($result, $tmpresult);
} elseif(!is_array($tmpresult)) {
$result .= $tmpresult;
}
}
$tmp_event = $sub_events[0].':'.$sub_events[1].':'.$sub_events[2];
if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG);
$tmpresult = $this->callPluginEvent($tmp_event, $data, $return_data);
if($return_data == true && $tmpresult) $result .= $tmpresult;
if($return_data == true && $tmpresult) {
if(is_array($tmpresult) && (!$result || is_array($result))) {
$result = array_merge($result, $tmpresult);
} elseif(!is_array($tmpresult)) {
$result .= $tmpresult;
}
}
/*$sub_events = array_reverse($sub_events);
$tmp_event = '';
......@@ -147,7 +165,13 @@ class plugin {
} else {
if($this->debug) $app->log("Called Event '$sub_events[0]'", LOGLEVEL_DEBUG);
$tmpresult = $this->callPluginEvent($sub_events[0], $data, $return_data);
if($return_data == true && $tmpresult) $result .= $tmpresult;
if($return_data == true && $tmpresult) {
if(is_array($tmpresult) && (!$result || is_array($result))) {
$result = array_merge($result, $tmpresult);
} elseif(!is_array($tmpresult)) {
$result .= $tmpresult;
}
}
}
}
......@@ -187,7 +211,13 @@ class plugin {
// call_user_method($function_name,$app->loaded_plugins[$plugin_name],$event_name,$data);
$tmpresult = call_user_func(array($app->loaded_plugins[$plugin_name], $function_name), $event_name, $data);
if($return_data == true && $tmpresult) $result .= $tmpresult;
if($return_data == true && $tmpresult) {
if(is_array($tmpresult) && (!$result || is_array($result))) {
$result = array_merge($result, $tmpresult);
} elseif(!is_array($tmpresult)) {
$result .= $tmpresult;
}
}
}
}
......
......@@ -45,7 +45,7 @@ class plugin_backuplist extends plugin_base {
$listTpl->newTemplate('templates/web_backup_list.htm');
//* Loading language file
$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_backup_list.lng";
$lng_file = "lib/lang/".$app->functions->check_language($_SESSION["s"]["language"])."_web_backup_list.lng";
include $lng_file;
$listTpl->setVar($wb);
......
......@@ -46,7 +46,7 @@ class plugin_backuplist_mail extends plugin_base {
$listTpl->newTemplate('templates/mail_user_backup_list.htm');
//* Loading language file
$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_mail_backup_list.lng";
$lng_file = "lib/lang/".$app->functions->check_language($_SESSION["s"]["language"])."_mail_backup_list.lng";
include($lng_file);
$listTpl->setVar($wb);
......
......@@ -18,7 +18,7 @@ class plugin_directive_snippets extends plugin_base
$listTpl->newTemplate('templates/web_directive_snippets.htm');
//* Loading language file
$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_directive_snippets.lng";
$lng_file = "lib/lang/".$app->functions->check_language($_SESSION["s"]["language"])."_web_directive_snippets.lng";
include $lng_file;
$listTpl->setVar($wb);
......
......@@ -120,7 +120,7 @@ class plugin_listview extends plugin_base {
}
// Loading language field
$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->listform->listDef['name']."_list.lng";
$lng_file = "lib/lang/".$app->functions->check_language($_SESSION["s"]["language"])."_".$app->listform->listDef['name']."_list.lng";
include $lng_file;
$listTpl->setVar($wb);
......
......@@ -43,11 +43,11 @@ class plugin_system_config_dns_ca extends plugin_base {
$pluginTpl = new tpl;
$pluginTpl->newTemplate('templates/system_config_dns_ca_edit.htm');
include 'lib/lang/'.$_SESSION['s']['language'].'_system_config.lng';
include 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_system_config.lng';
$pluginTpl->setVar($wb);
if(isset($_GET['action']) && ($_GET['action'] == 'edit') && $_GET['id'] > 0) {
$ca_id = $app->functions->intval($_GET['id']);
if(isset($_GET['action']) && ($_GET['action'] == 'edit') && $ca_id > 0) {
$pluginTpl->setVar('edit_record', 1);
$ca_id = intval($_GET['id']);
$rec = $app->db->queryOneRecord("SELECT * FROM dns_ssl_ca WHERE id = ?", $ca_id);
$pluginTpl->setVar('id', $rec['id']);
$pluginTpl->setVar('ca_name', $rec['ca_name']);
......@@ -56,16 +56,15 @@ class plugin_system_config_dns_ca extends plugin_base {
$pluginTpl->setVar('ca_critical', $rec['ca_critical']);
$pluginTpl->setVar('ca_iodef', $rec['ca_iodef']);
$pluginTpl->setVar('active', $rec['active']);
} elseif(isset($_GET['action']) && ($_GET['action'] == 'save') && $_GET['id'] > 0) {
} elseif(isset($_GET['action']) && ($_GET['action'] == 'save') && $ca_id > 0) {
$pluginTpl->setVar('edit_record', 0);
$ca_id = intval($_GET['id']);
$pluginTpl->setVar('id', $ca_id);
$pluginTpl->setVar('ca_name', $_POST['ca_name']);
$pluginTpl->setVar('ca_issue', $_POST['ca_issue']);
$pluginTpl->setVar('ca_wildcard', $_POST['ca_wildcard']);
$pluginTpl->setVar('ca_critical', $_POST['ca_critical']);
$pluginTpl->setVar('ca_iodef', $_POST['ca_iodef']);
$pluginTpl->setVar('active', $_POST['active']);
$pluginTpl->setVar('ca_name', $app->functions->htmlentities($_POST['ca_name']));
$pluginTpl->setVar('ca_issue', $app->functions->htmlentities($_POST['ca_issue']));
$pluginTpl->setVar('ca_wildcard', $app->functions->htmlentities($_POST['ca_wildcard']));
$pluginTpl->setVar('ca_critical', $app->functions->htmlentities($_POST['ca_critical']));
$pluginTpl->setVar('ca_iodef', $app->functions->htmlentities($_POST['ca_iodef']));
$pluginTpl->setVar('active', $app->functions->htmlentities($_POST['active']));
} else {
$pluginTpl->setVar('edit_record', 0);
}
......@@ -77,10 +76,10 @@ class plugin_system_config_dns_ca extends plugin_base {
function onUpdate() {
global $app;
$id = intval($_GET['id']);
$ca_id = $app->functions->intval($_GET['id']);
if(isset($_GET['action']) && $_GET['action'] == 'save') {
if($id > 0) {
$app->db->query("UPDATE dns_ssl_ca SET ca_name = ?, ca_issue = ?, ca_wildcard = ?, ca_iodef = ?, active = ? WHERE id = ?", $_POST['ca_name'], $_POST['ca_issue'], $_POST['ca_wildcard'], $_POST['ca_iodef'], $_POST['active'], $_GET['id']);
if($ca_id > 0) {
$app->db->query("UPDATE dns_ssl_ca SET ca_name = ?, ca_issue = ?, ca_wildcard = ?, ca_iodef = ?, active = ? WHERE id = ?", $_POST['ca_name'], $_POST['ca_issue'], $_POST['ca_wildcard'], $_POST['ca_iodef'], $_POST['active'], $ca_id);
} else {
$app->db->query("INSERT INTO (sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, ca_name, ca_issue, ca_wildcard, ca_iodef, active) VALUES(1, 1, 'riud', 'riud', '', ?, ?, ?, ?, ?", $_POST['ca_name'], $_POST['ca_issue'], $_POST['ca_wildcard'], $_POST['ca_iodef'], $_POST['active']);
}
......
......@@ -44,7 +44,7 @@ class plugin_system_config_dns_ca_list extends plugin_base {
$listTpl->newTemplate('templates/system_config_dns_ca_list.htm');
//* Loading language file
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_system_config.lng';
$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_system_config.lng';
include $lng_file;
$listTpl->setVar($wb);
if($_SESSION['s']['user']['typ'] == 'admin') {
......
......@@ -54,19 +54,19 @@ class quota_lib {
if($used_ratio >= 1) $sites[$i]['display_colour'] = '#cc0000';
if($sites[$i]['used'] > 1024) {
$sites[$i]['used'] = round($sites[$i]['used'] / 1024, 2).' MB';
$sites[$i]['used'] = round($sites[$i]['used'] / 1024, 1).' MB';
} else {
if ($sites[$i]['used'] != '') $sites[$i]['used'] .= ' KB';
}
if($sites[$i]['soft'] > 1024) {
$sites[$i]['soft'] = round($sites[$i]['soft'] / 1024, 2).' MB';
$sites[$i]['soft'] = round($sites[$i]['soft'] / 1024, 1).' MB';
} else {
$sites[$i]['soft'] .= ' KB';
}
if($sites[$i]['hard'] > 1024) {
$sites[$i]['hard'] = round($sites[$i]['hard'] / 1024, 2).' MB';
$sites[$i]['hard'] = round($sites[$i]['hard'] / 1024, 1).' MB';
} else {
$sites[$i]['hard'] .= ' KB';
}
......@@ -268,14 +268,14 @@ class quota_lib {
if($emails[$i]['quota'] == 0){
$emails[$i]['quota'] = $app->lng('unlimited');
} else {
$emails[$i]['quota'] = round($emails[$i]['quota'] / 1048576, 4).' MB';
$emails[$i]['quota'] = round($emails[$i]['quota'] / 1048576, 1).' MB';
}
if($emails[$i]['used'] < 1544000) {
$emails[$i]['used'] = round($emails[$i]['used'] / 1024, 4).' KB';
$emails[$i]['used'] = round($emails[$i]['used'] / 1024, 1).' KB';
} else {
$emails[$i]['used'] = round($emails[$i]['used'] / 1048576, 4).' MB';
$emails[$i]['used'] = round($emails[$i]['used'] / 1048576, 1).' MB';
}
}
}
......@@ -334,9 +334,9 @@ class quota_lib {
if($databases[$i]['used'] < 1544000) {
$databases[$i]['used'] = round($databases[$i]['used'] / 1024, 4).' KB';
$databases[$i]['used'] = round($databases[$i]['used'] / 1024, 1).' KB';
} else {
$databases[$i]['used'] = round($databases[$i]['used'] / 1048576, 4).' MB';
$databases[$i]['used'] = round($databases[$i]['used'] / 1048576, 1).' MB';
}
}
}
......
......@@ -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,10 +152,169 @@ 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;
}
}
// config_value_* functions ---------------------------------------------------------------------------------------
//* Get config_value details
public function config_value_get($session_id, $group, $name)
{
global $app;
if(!$this->checkPerm($session_id, 'config_value_get')) {
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
// validate fields
if($group == '' || $name == '') {
throw new ISPConfigRemoteException('field_empty_error', 'Group and name parameter may not be empty.');
return false;
}
return $app->db->queryOneRecord('SELECT * FROM sys_config WHERE `group` = ? AND `name` = ?', $group, $name);
}
//* Add a config_value record
public function config_value_add($session_id, $group, $name, $value)
{
global $app;
if(!$this->checkPerm($session_id, 'config_value_add')) {
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 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 ISPConfigRemoteException('record_unique_error', 'Group plus name field combination is not unique.');
return false;
}
return $app->db->query('INSERT INTO sys_config (`group`,`name`,`value`) VALUES (?,?,?)',$group,$name,$value);
}
//* Update config_value record
public function config_value_update($session_id, $group, $name, $value)
{
global $app;
if(!$this->checkPerm($session_id, 'config_value_update')) {
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 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 ISPConfigRemoteException('record_nonexist_error', 'There is no record with this group plus name field combination.');
return false;
}
return $app->db->query('UPDATE sys_config SET `value` = ? WHERE `group` = ? AND `name` = ?',$value,$group,$name);
}
//* Replace config_value record
public function config_value_replace($session_id, $group, $name, $value)
{
global $app;
if(!$this->checkPerm($session_id, 'config_value_replace')) {
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 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))) {
return $app->db->query('UPDATE sys_config SET `value` = ? WHERE `group` = ? AND `name` = ?',$value,$group,$name);
} else {
return $app->db->query('INSERT INTO sys_config (`group`,`name`,`value`) VALUES (?,?,?)',$group,$name,$value);
}
}
//* Delete config_value record
public function config_value_delete($session_id, $group, $name)
{
global $app;
if(!$this->checkPerm($session_id, 'config_value_delete')) {
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
// validate fields
if($group == '' || $name == '') {
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 ISPConfigRemoteException('record_nonexist_error', 'There is no record with this group plus name field combination.');
return false;
}
return $app->db->query('DELETE FROM sys_config WHERE `group` = ? AND `name` = ?',$group,$name);
}
// Get datalog information with tstamp >=
public function sys_datalog_get_by_tstamp($session_id, $tstamp)
{
global $app;
if(!$this->checkPerm($session_id, 'server_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$tstamp = $app->functions->intval($tstamp);
if($tstamp > 0) {
$rec = $app->db->queryAllRecords("SELECT datalog_id, server_id, dbtable, dbidx, action, tstamp, user, data, status, error FROM sys_datalog WHERE tstamp >= ? ORDER BY datalog_id DESC", $tstamp);
return $rec;
}
}
// Get datalog information by datalog_id
public function sys_datalog_get($session_id, $datalog_id, $newer = false)
{
global $app;
if(!$this->checkPerm($session_id, 'server_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$tstamp = $app->functions->intval($tstamp);
if($datalog_id > 0 && $newer === true) {
$rec = $app->db->queryAllRecords("SELECT datalog_id, server_id, dbtable, dbidx, action, tstamp, user, data, status, error FROM sys_datalog WHERE datalog_id >= ? ORDER BY datalog_id DESC", $datalog_id);
return $rec;
} elseif ($datalog_id > 0) {
$rec = $app->db->queryAllRecords("SELECT datalog_id, server_id, dbtable, dbidx, action, tstamp, user, data, status, error FROM sys_datalog WHERE datalog_id = ? ORDER BY datalog_id DESC", $datalog_id);
return $rec;
} else {
throw new SoapFault('invalid_datalog_id', 'The ID passed to the function must be > 0');
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;
}
......
......@@ -53,7 +53,7 @@ class remoting_client extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'client_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');
......@@ -98,7 +98,7 @@ class remoting_client extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'client_get_id')) {
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;
}
......@@ -108,7 +108,7 @@ class remoting_client extends remoting {
if(isset($rec['client_id'])) {
return $app->functions->intval($rec['client_id']);
} else {
throw new SoapFault('no_client_found', 'There is no sysuser account for this client ID.');
throw new ISPConfigRemoteException('no_client_found', 'There is no sysuser account for this client ID.');
return false;
}
......@@ -119,7 +119,7 @@ class remoting_client extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'client_get_emailcontact')) {
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;
}
......@@ -130,7 +130,7 @@ class remoting_client extends remoting {
if(is_array($rec)) {
return $rec;
} else {
throw new SoapFault('no_client_found', 'There is no client with this client ID.');
throw new ISPConfigRemoteException('no_client_found', 'There is no client with this client ID.');
return false;
}
}
......@@ -139,7 +139,7 @@ class remoting_client extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'client_get_id')) {
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;
}
......@@ -149,7 +149,7 @@ class remoting_client extends remoting {
if(isset($rec['groupid'])) {
return $app->functions->intval($rec['groupid']);
} else {
throw new SoapFault('no_group_found', 'There is no group for this client ID.');
throw new ISPConfigRemoteException('no_group_found', 'There is no group for this client ID.');
return false;
}
......@@ -162,7 +162,7 @@ class remoting_client extends remoting {
if (!$this->checkPerm($session_id, 'client_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;
}
if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
......@@ -174,7 +174,7 @@ class remoting_client extends remoting {
// Selected client is not a reseller. REMOVING PARENT_CLIENT_ID!!!
$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.');
throw new ISPConfigRemoteException('Invalid reseller', 'Reseller cannot be client of another reseller.');
return false;
}
}
......@@ -191,7 +191,7 @@ class remoting_client extends remoting {
if (!$this->checkPerm($session_id, 'client_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;
}
......@@ -208,12 +208,12 @@ class remoting_client extends remoting {
// check if this one is reseller
$check = $app->db->queryOneRecord('SELECT `limit_client` FROM `client` WHERE `client_id` = ?', intval($params['parent_client_id']));
if($check['limit_client'] == 0) {
throw new SoapFault('Invalid reseller', 'Selected client is not a reseller.');
throw new ISPConfigRemoteException('Invalid reseller', 'Selected client is not a reseller.');
return false;
}
if(isset($params['limit_client']) && $params['limit_client'] != 0) {
throw new SoapFault('Invalid reseller', 'Reseller cannot be client of another reseller.');
throw new ISPConfigRemoteException('Invalid reseller', 'Reseller cannot be client of another reseller.');
return false;
}
}
......@@ -251,7 +251,7 @@ class remoting_client extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'client_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;
}
......@@ -259,7 +259,7 @@ class remoting_client extends remoting {
$sql = "SELECT * FROM `client_template_assigned` WHERE `client_id` = ?";
return $app->db->queryOneRecord($sql, $client_id);
} else {
throw new SoapFault('The ID must be an integer.');
throw new ISPConfigRemoteException('The ID must be an integer.');
return array();
}
}
......@@ -289,7 +289,7 @@ class remoting_client extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'client_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;
}
......@@ -297,13 +297,13 @@ class remoting_client extends remoting {
// check if client exists
$check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ?', $client_id);
if(!$check) {
throw new SoapFault('Invalid client');
throw new ISPConfigRemoteException('Invalid client');
return false;
}
// check if template exists
$check = $app->db->queryOneRecord('SELECT `template_id` FROM `client_template` WHERE `template_id` = ?', $template_id);
if(!$check) {
throw new SoapFault('Invalid template');
throw new ISPConfigRemoteException('Invalid template');
return false;
}
......@@ -318,7 +318,7 @@ class remoting_client extends remoting {
return $insert_id;
} else {
throw new SoapFault('The IDs must be of type integer.');
throw new ISPConfigRemoteException('The IDs must be of type integer.');
return false;
}
}
......@@ -327,7 +327,7 @@ class remoting_client extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'client_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;
}
......@@ -335,13 +335,13 @@ class remoting_client extends remoting {
// check if client exists
$check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ?', $client_id);
if(!$check) {
throw new SoapFault('Invalid client');
throw new ISPConfigRemoteException('Invalid client');
return false;
}
// check if template exists
$check = $app->db->queryOneRecord('SELECT `assigned_template_id` FROM `client_template_assigned` WHERE `client_id` = ? AND `client_template_id` = ?', $client_id, $assigned_template_id);
if(!$check) {
throw new SoapFault('Invalid template');
throw new ISPConfigRemoteException('Invalid template');
return false;
}
......@@ -356,7 +356,7 @@ class remoting_client extends remoting {
return $affected_rows;
} else {
throw new SoapFault('The IDs must be of type integer.');
throw new ISPConfigRemoteException('The IDs must be of type integer.');
return false;
}
}
......@@ -367,7 +367,7 @@ class remoting_client extends remoting {
if (!$this->checkPerm($session_id, 'client_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/client.tform.php', $client_id);
......@@ -384,7 +384,7 @@ class remoting_client extends remoting {
global $app, $conf;
if(!$this->checkPerm($session_id, 'client_delete_everything')) {
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;
}
......@@ -404,7 +404,7 @@ class remoting_client extends remoting {
$app->db->query("DELETE FROM sys_user WHERE client_id = ?", $client_id);
//* Delete all records (sub-clients, mail, web, etc....) of this client.
$tables = 'cron,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic,domain,mail_mailinglist,client';
$tables = 'cron,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic,domain,client';
$tables_array = explode(',', $tables);
$client_group_id = $app->functions->intval($client_group['groupid']);
if($client_group_id > 1) {
......@@ -440,7 +440,7 @@ class remoting_client extends remoting {
}
if (!$this->checkPerm($session_id, 'client_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/client.tform.php', $client_id);
......@@ -460,14 +460,14 @@ class remoting_client extends remoting {
public function client_get_by_username($session_id, $username) {
global $app;
if(!$this->checkPerm($session_id, 'client_get_by_username')) {
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;
}
$rec = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE username = ?", $username);
if (isset($rec)) {
return $rec;
} else {
throw new SoapFault('no_client_found', 'There is no user account for this user name.');
throw new ISPConfigRemoteException('no_client_found', 'There is no user account for this user name.');
return false;
}
}
......@@ -475,12 +475,12 @@ class remoting_client extends remoting {
public function client_get_by_customer_no($session_id, $customer_no) {
global $app;
if(!$this->checkPerm($session_id, 'client_get_by_customer_no')) {
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;
}
$customer_no = trim($customer_no);
if($customer_no == '') {
throw new SoapFault('permission_denied', 'There was no customer number specified.');
throw new ISPConfigRemoteException('permission_denied', 'There was no customer number specified.');
return false;
}
$customer_no = $app->db->quote($customer_no);
......@@ -488,7 +488,7 @@ class remoting_client extends remoting {
if (isset($rec)) {
return $rec;
} else {
throw new SoapFault('no_client_found', 'There is no user account for this customer number.');
throw new ISPConfigRemoteException('no_client_found', 'There is no user account for this customer number.');
return false;
}
}
......@@ -501,7 +501,7 @@ class remoting_client extends remoting {
public function client_get_all($session_id) {
global $app;
if(!$this->checkPerm($session_id, 'client_get_all')) {
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;
}
$result = $app->db->queryAllRecords("SELECT client_id FROM client WHERE 1");
......@@ -529,7 +529,7 @@ class remoting_client extends remoting {
$app->uses('auth');
if(!$this->checkPerm($session_id, 'client_change_password')) {
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;
}
......@@ -542,7 +542,7 @@ class remoting_client extends remoting {
$app->db->query($sql, $new_password, $client_id);
return true;
} else {
throw new SoapFault('no_client_found', 'There is no user account for this client_id');
throw new ISPConfigRemoteException('no_client_found', 'There is no user account for this client_id');
return false;
}
}
......@@ -555,7 +555,7 @@ class remoting_client extends remoting {
public function client_templates_get_all($session_id) {
global $app;
if(!$this->checkPerm($session_id, 'client_templates_get_all')) {
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 * FROM client_template";
......@@ -568,17 +568,17 @@ class remoting_client extends remoting {
//* Check permissions
if(!$this->checkPerm($session_id, 'client_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;
}
//* Check username and password
if(!preg_match("/^[\w\.\-\_\@]{1,128}$/", $username)) {
throw new SoapFault('user_regex_error', 'Username contains invalid characters.');
throw new ISPConfigRemoteException('user_regex_error', 'Username contains invalid characters.');
return false;
}
if(!preg_match("/^.{1,64}$/i", $password)) {
throw new SoapFault('password_length_error', 'Invalid password length or no password provided.');
throw new ISPConfigRemoteException('password_length_error', 'Invalid password length or no password provided.');
return false;
}
......@@ -588,7 +588,7 @@ class remoting_client extends remoting {
//* too many failedlogins
if($alreadyfailed['times'] > 5) {
throw new SoapFault('error_user_too_many_logins', 'Too many failed logins.');
throw new ISPConfigRemoteException('error_user_too_many_logins', 'Too many failed logins.');
return false;
}
......@@ -659,7 +659,7 @@ class remoting_client extends remoting {
'language' => $user['language'],
'country' => 'de');
} else {
throw new SoapFault('login_failed', 'Login failed.');
throw new ISPConfigRemoteException('login_failed', 'Login failed.');
}
}
......@@ -678,6 +678,27 @@ class remoting_client extends remoting {
return $returnval;
}
public function client_get_by_groupid($session_id, $group_id)
{
global $app;
if(!$this->checkPerm($session_id, 'client_get_id')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$group_id = $app->functions->intval($group_id);
$rec = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $group_id);
if(isset($rec['client_id'])) {
$client_id = $app->functions->intval($rec['client_id']);
return $this->client_get($session_id, $client_id);
} else {
throw new SoapFault('no_group_found', 'There is no client for this group ID.');
return false;
}
}
}
?>
......@@ -42,11 +42,10 @@ class remoting_dns extends remoting {
// DNS Function --------------------------------------------------------------------------------------------------
//* Create Zone with Template
public function dns_templatezone_add($session_id, $client_id, $template_id, $domain, $ip, $ns1, $ns2, $email)
{
public function dns_templatezone_add($session_id, $client_id, $template_id, $domain, $ip, $ns1, $ns2, $email) {
global $app, $conf;
if(!$this->checkPerm($session_id, 'dns_templatezone_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;
}
......@@ -180,18 +179,17 @@ class remoting_dns extends remoting {
return $dns_soa_id;
exit;
} else {
throw new SoapFault('permission_denied', $error);
throw new ISPConfigRemoteException('permission_denied', $error);
}
}
//* Get record details
public function dns_zone_get($session_id, $primary_id)
{
public function dns_zone_get($session_id, $primary_id) {
global $app;
if(!$this->checkPerm($session_id, 'dns_zone_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');
......@@ -199,21 +197,33 @@ class remoting_dns extends remoting {
return $app->remoting_lib->getDataRecord($primary_id);
}
//* Get slave zone details
public function dns_slave_get($session_id, $primary_id) {
global $app;
if(!$this->checkPerm($session_id, 'dns_zone_get')) {
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../dns/form/dns_slave.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
//* Add a slave zone
public function dns_slave_add($session_id, $client_id, $params)
{
public function dns_slave_add($session_id, $client_id, $params) {
if(!$this->checkPerm($session_id, 'dns_zone_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('../dns/form/dns_slave.tform.php', $client_id, $params);
}
//* Update a slave zone
public function dns_slave_update($session_id, $client_id, $primary_id, $params)
{
public function dns_slave_update($session_id, $client_id, $primary_id, $params) {
if(!$this->checkPerm($session_id, 'dns_zone_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('../dns/form/dns_slave.tform.php', $client_id, $primary_id, $params);
......@@ -221,27 +231,25 @@ class remoting_dns extends remoting {
}
//* Delete a slave zone
public function dns_slave_delete($session_id, $primary_id)
{
public function dns_slave_delete($session_id, $primary_id) {
if(!$this->checkPerm($session_id, 'dns_zone_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;
}
return $this->deleteQuery('../dns/form/dns_slave.tform.php', $primary_id);
}
//* Get record id by origin
public function dns_zone_get_id($session_id, $origin)
{
public function dns_zone_get_id($session_id, $origin) {
global $app;
if(!$this->checkPerm($session_id, 'dns_zone_get_id')) {
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(!preg_match('/^([a-z0-9][a-z0-9\-]+[a-z0-9]|[a-z0-9]{2})(\.[a-z]{2,63})+$/i', $origin)){
throw new SoapFault('no_domain_found', 'Invalid domain name.');
throw new ISPConfigRemoteException('no_domain_found', 'Invalid domain name.');
return false;
}
......@@ -249,26 +257,24 @@ class remoting_dns extends remoting {
if(isset($rec['id'])) {
return $app->functions->intval($rec['id']);
} else {
throw new SoapFault('no_domain_found', 'There is no domain ID with informed domain name.');
throw new ISPConfigRemoteException('no_domain_found', 'There is no domain ID with informed domain name.');
return false;
}
}
//* Add a record
public function dns_zone_add($session_id, $client_id, $params)
{
public function dns_zone_add($session_id, $client_id, $params) {
if(!$this->checkPerm($session_id, 'dns_zone_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('../dns/form/dns_soa.tform.php', $client_id, $params);
}
//* Update a record
public function dns_zone_update($session_id, $client_id, $primary_id, $params)
{
public function dns_zone_update($session_id, $client_id, $primary_id, $params) {
if(!$this->checkPerm($session_id, 'dns_zone_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('../dns/form/dns_soa.tform.php', $client_id, $primary_id, $params);
......@@ -276,10 +282,9 @@ class remoting_dns extends remoting {
}
//* Delete a record
public function dns_zone_delete($session_id, $primary_id)
{
public function dns_zone_delete($session_id, $primary_id) {
if(!$this->checkPerm($session_id, 'dns_zone_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('../dns/form/dns_soa.tform.php', $primary_id);
......@@ -288,563 +293,312 @@ class remoting_dns extends remoting {
// ----------------------------------------------------------------------------------------------------------------
//* Get record details
public function dns_aaaa_get($session_id, $primary_id)
{
private function dns_rr_get($session_id, $primary_id, $rr_type = 'A') {
global $app;
if(!$this->checkPerm($session_id, 'dns_aaaa_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
$rr_type = strtolower($rr_type);
if(!preg_match('/^[a-z]+$/', $rr_type)) {
throw new ISPConfigRemoteException('permission denied', 'Invalid rr type');
}
if(!$this->checkPerm($session_id, 'dns_' . $rr_type . '_get')) {
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../dns/form/dns_aaaa.tform.php');
$app->remoting_lib->loadFormDef('../dns/form/dns_' . $rr_type . '.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
//* Add a record
public function dns_aaaa_add($session_id, $client_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_aaaa_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
private function dns_rr_add($session_id, $client_id, $params, $update_serial=false, $rr_type = 'A') {
$rr_type = strtolower($rr_type);
if(!preg_match('/^[a-z]+$/', $rr_type)) {
throw new ISPConfigRemoteException('permission denied', 'Invalid rr type');
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $this->insertQuery('../dns/form/dns_aaaa.tform.php', $client_id, $params);
if(!$this->checkPerm($session_id, 'dns_' . $rr_type . '_add')) {
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
}
if($update_serial) {
$this->increase_serial($session_id, $client_id, $params);
}
return $this->insertQuery('../dns/form/dns_' . $rr_type . '.tform.php', $client_id, $params);
}
//* Update a record
public function dns_aaaa_update($session_id, $client_id, $primary_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_aaaa_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
private function dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial=false, $rr_type = 'A') {
$rr_type = strtolower($rr_type);
if(!preg_match('/^[a-z]+$/', $rr_type)) {
throw new ISPConfigRemoteException('permission denied', 'Invalid rr type');
}
if(!$this->checkPerm($session_id, 'dns_' . $rr_type . '_update')) {
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../dns/form/dns_aaaa.tform.php', $client_id, $primary_id, $params);
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
$affected_rows = $this->updateQuery('../dns/form/dns_' . $rr_type . '.tform.php', $client_id, $primary_id, $params);
if($update_serial) {
$this->increase_serial($session_id, $client_id, $params);
}
return $affected_rows;
}
//* Delete a record
public function dns_aaaa_delete($session_id, $primary_id, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_aaaa_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
private function dns_rr_delete($session_id, $primary_id, $update_serial=false, $rr_type = 'A') {
$rr_type = strtolower($rr_type);
if(!preg_match('/^[a-z]+$/', $rr_type)) {
throw new ISPConfigRemoteException('permission denied', 'Invalid rr type');
}
if(!$this->checkPerm($session_id, 'dns_' . $rr_type . '_delete')) {
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
}
if($update_serial) {
$this->increase_serial($session_id, 0, array('dns_rr_id' => $primary_id));
}
$affected_rows = $this->deleteQuery('../dns/form/dns_aaaa.tform.php', $primary_id);
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
$affected_rows = $this->deleteQuery('../dns/form/dns_' . $rr_type . '.tform.php', $primary_id);
return $affected_rows;
}
// ----------------------------------------------------------------------------------------------------------------
//* Get record details
public function dns_aaaa_get($session_id, $primary_id) {
return $this->dns_rr_get($session_id, $primary_id, 'AAAA');
}
//* Add a record
public function dns_aaaa_add($session_id, $client_id, $params, $update_serial=false) {
return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'AAAA');
}
//* Update a record
public function dns_aaaa_update($session_id, $client_id, $primary_id, $params, $update_serial=false) {
return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'AAAA');
}
//* Delete a record
public function dns_aaaa_delete($session_id, $primary_id, $update_serial=false) {
return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'AAAA');
}
// ----------------------------------------------------------------------------------------------------------------
//* Get record details
public function dns_a_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'dns_a_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../dns/form/dns_a.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
public function dns_a_get($session_id, $primary_id) {
return $this->dns_rr_get($session_id, $primary_id, 'A');
}
//* Add a record
public function dns_a_add($session_id, $client_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_a_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $this->insertQuery('../dns/form/dns_a.tform.php', $client_id, $params);
public function dns_a_add($session_id, $client_id, $params, $update_serial=false) {
return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'A');
}
//* Update a record
public function dns_a_update($session_id, $client_id, $primary_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_a_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
$affected_rows = $this->updateQuery('../dns/form/dns_a.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
public function dns_a_update($session_id, $client_id, $primary_id, $params, $update_serial=false) {
return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'A');
}
//* Delete a record
public function dns_a_delete($session_id, $primary_id, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_a_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../dns/form/dns_a.tform.php', $primary_id);
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $affected_rows;
public function dns_a_delete($session_id, $primary_id, $update_serial=false) {
return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'A');
}
// ----------------------------------------------------------------------------------------------------------------
//* Get record details
public function dns_alias_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'dns_alias_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../dns/form/dns_alias.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
public function dns_alias_get($session_id, $primary_id) {
return $this->dns_rr_get($session_id, $primary_id, 'ALIAS');
}
//* Add a record
public function dns_alias_add($session_id, $client_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_alias_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $this->insertQuery('../dns/form/dns_alias.tform.php', $client_id, $params);
public function dns_alias_add($session_id, $client_id, $params, $update_serial=false) {
return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'ALIAS');
}
//* Update a record
public function dns_alias_update($session_id, $client_id, $primary_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_alias_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
$affected_rows = $this->updateQuery('../dns/form/dns_alias.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
public function dns_alias_update($session_id, $client_id, $primary_id, $params, $update_serial=false) {
return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'ALIAS');
}
//* Delete a record
public function dns_alias_delete($session_id, $primary_id, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_alias_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../dns/form/dns_alias.tform.php', $primary_id);
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $affected_rows;
public function dns_alias_delete($session_id, $primary_id, $update_serial=false) {
return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'ALIAS');
}
// ----------------------------------------------------------------------------------------------------------------
//* Get record details
public function dns_cname_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'dns_cname_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../dns/form/dns_cname.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
public function dns_cname_get($session_id, $primary_id) {
return $this->dns_rr_get($session_id, $primary_id, 'CNAME');
}
//* Add a record
public function dns_cname_add($session_id, $client_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_cname_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $this->insertQuery('../dns/form/dns_cname.tform.php', $client_id, $params);
public function dns_cname_add($session_id, $client_id, $params, $update_serial=false) {
return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'CNAME');
}
//* Update a record
public function dns_cname_update($session_id, $client_id, $primary_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_cname_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
$affected_rows = $this->updateQuery('../dns/form/dns_cname.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
public function dns_cname_update($session_id, $client_id, $primary_id, $params, $update_serial=false) {
return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'CNAME');
}
//* Delete a record
public function dns_cname_delete($session_id, $primary_id, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_cname_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../dns/form/dns_cname.tform.php', $primary_id);
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $affected_rows;
public function dns_cname_delete($session_id, $primary_id, $update_serial=false) {
return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'CNAME');
}
// ----------------------------------------------------------------------------------------------------------------
//* Get record details
public function dns_hinfo_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'dns_hinfo_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../dns/form/dns_hinfo.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
public function dns_hinfo_get($session_id, $primary_id) {
return $this->dns_rr_get($session_id, $primary_id, 'HINFO');
}
//* Add a record
public function dns_hinfo_add($session_id, $client_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_hinfo_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $this->insertQuery('../dns/form/dns_hinfo.tform.php', $client_id, $params);
public function dns_hinfo_add($session_id, $client_id, $params, $update_serial=false) {
return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'HINFO');
}
//* Update a record
public function dns_hinfo_update($session_id, $client_id, $primary_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_hinfo_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
$affected_rows = $this->updateQuery('../dns/form/dns_hinfo.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
public function dns_hinfo_update($session_id, $client_id, $primary_id, $params, $update_serial=false) {
return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'HINFO');
}
//* Delete a record
public function dns_hinfo_delete($session_id, $primary_id, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_hinfo_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../dns/form/dns_hinfo.tform.php', $primary_id);
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $affected_rows;
public function dns_hinfo_delete($session_id, $primary_id, $update_serial=false) {
return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'HINFO');
}
// ----------------------------------------------------------------------------------------------------------------
//* Get record details
public function dns_mx_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'dns_mx_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../dns/form/dns_mx.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
public function dns_mx_get($session_id, $primary_id) {
return $this->dns_rr_get($session_id, $primary_id, 'MX');
}
//* Add a record
public function dns_mx_add($session_id, $client_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_mx_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $this->insertQuery('../dns/form/dns_mx.tform.php', $client_id, $params);
public function dns_mx_add($session_id, $client_id, $params, $update_serial=false) {
return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'MX');
}
//* Update a record
public function dns_mx_update($session_id, $client_id, $primary_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_mx_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
$affected_rows = $this->updateQuery('../dns/form/dns_mx.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
public function dns_mx_update($session_id, $client_id, $primary_id, $params, $update_serial=false) {
return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'MX');
}
//* Delete a record
public function dns_mx_delete($session_id, $primary_id, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_mx_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../dns/form/dns_mx.tform.php', $primary_id);
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $affected_rows;
public function dns_mx_delete($session_id, $primary_id, $update_serial=false) {
return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'MX');
}
// ----------------------------------------------------------------------------------------------------------------
//* Get record details
public function dns_ns_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'dns_ns_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../dns/form/dns_ns.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
public function dns_ns_get($session_id, $primary_id) {
return $this->dns_rr_get($session_id, $primary_id, 'NS');
}
//* Add a record
public function dns_ns_add($session_id, $client_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_ns_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $this->insertQuery('../dns/form/dns_ns.tform.php', $client_id, $params);
public function dns_ns_add($session_id, $client_id, $params, $update_serial=false) {
return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'NS');
}
//* Update a record
public function dns_ns_update($session_id, $client_id, $primary_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_ns_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
$affected_rows = $this->updateQuery('../dns/form/dns_ns.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
public function dns_ns_update($session_id, $client_id, $primary_id, $params, $update_serial=false) {
return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'NS');
}
//* Delete a record
public function dns_ns_delete($session_id, $primary_id, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_ns_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../dns/form/dns_ns.tform.php', $primary_id);
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $affected_rows;
public function dns_ns_delete($session_id, $primary_id, $update_serial=false) {
return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'NS');
}
// ----------------------------------------------------------------------------------------------------------------
//* Get record details
public function dns_ptr_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'dns_ptr_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../dns/form/dns_ptr.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
public function dns_ptr_get($session_id, $primary_id) {
return $this->dns_rr_get($session_id, $primary_id, 'PTR');
}
//* Add a record
public function dns_ptr_add($session_id, $client_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_ptr_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $this->insertQuery('../dns/form/dns_ptr.tform.php', $client_id, $params);
public function dns_ptr_add($session_id, $client_id, $params, $update_serial=false) {
return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'PTR');
}
//* Update a record
public function dns_ptr_update($session_id, $client_id, $primary_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_ptr_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
$affected_rows = $this->updateQuery('../dns/form/dns_ptr.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
public function dns_ptr_update($session_id, $client_id, $primary_id, $params, $update_serial=false) {
return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'PTR');
}
//* Delete a record
public function dns_ptr_delete($session_id, $primary_id, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_ptr_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../dns/form/dns_ptr.tform.php', $primary_id);
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $affected_rows;
public function dns_ptr_delete($session_id, $primary_id, $update_serial=false) {
return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'PTR');
}
// ----------------------------------------------------------------------------------------------------------------
//* Get record details
public function dns_rp_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'dns_rp_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../dns/form/dns_rp.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
public function dns_rp_get($session_id, $primary_id) {
return $this->dns_rr_get($session_id, $primary_id, 'RP');
}
//* Add a record
public function dns_rp_add($session_id, $client_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_rp_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $this->insertQuery('../dns/form/dns_rp.tform.php', $client_id, $params);
public function dns_rp_add($session_id, $client_id, $params, $update_serial=false) {
return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'RP');
}
//* Update a record
public function dns_rp_update($session_id, $client_id, $primary_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_rp_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
$affected_rows = $this->updateQuery('../dns/form/dns_rp.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
public function dns_rp_update($session_id, $client_id, $primary_id, $params, $update_serial=false) {
return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'RP');
}
//* Delete a record
public function dns_rp_delete($session_id, $primary_id, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_rp_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../dns/form/dns_rp.tform.php', $primary_id);
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $affected_rows;
public function dns_rp_delete($session_id, $primary_id, $update_serial=false) {
return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'RP');
}
// ----------------------------------------------------------------------------------------------------------------
//* Get record details
public function dns_srv_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'dns_srv_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../dns/form/dns_srv.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
public function dns_srv_get($session_id, $primary_id) {
return $this->dns_rr_get($session_id, $primary_id, 'SRV');
}
//* Add a record
public function dns_srv_add($session_id, $client_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_srv_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $this->insertQuery('../dns/form/dns_srv.tform.php', $client_id, $params);
public function dns_srv_add($session_id, $client_id, $params, $update_serial=false) {
return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'SRV');
}
//* Update a record
public function dns_srv_update($session_id, $client_id, $primary_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_srv_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
$affected_rows = $this->updateQuery('../dns/form/dns_srv.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
public function dns_srv_update($session_id, $client_id, $primary_id, $params, $update_serial=false) {
return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'SRV');
}
//* Delete a record
public function dns_srv_delete($session_id, $primary_id, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_srv_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../dns/form/dns_srv.tform.php', $primary_id);
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $affected_rows;
public function dns_srv_delete($session_id, $primary_id, $update_serial=false) {
return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'SRV');
}
// ----------------------------------------------------------------------------------------------------------------
//* Get record details
public function dns_txt_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'dns_txt_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../dns/form/dns_txt.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
public function dns_txt_get($session_id, $primary_id) {
return $this->dns_rr_get($session_id, $primary_id, 'TXT');
}
//* Add a record
public function dns_txt_add($session_id, $client_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_txt_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $this->insertQuery('../dns/form/dns_txt.tform.php', $client_id, $params);
public function dns_txt_add($session_id, $client_id, $params, $update_serial=false) {
return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'TXT');
}
//* Update a record
public function dns_txt_update($session_id, $client_id, $primary_id, $params, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_txt_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
$affected_rows = $this->updateQuery('../dns/form/dns_txt.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
public function dns_txt_update($session_id, $client_id, $primary_id, $params, $update_serial=false) {
return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'TXT');
}
//* Delete a record
public function dns_txt_delete($session_id, $primary_id, $update_serial=false)
{
if(!$this->checkPerm($session_id, 'dns_txt_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../dns/form/dns_txt.tform.php', $primary_id);
if($update_serial) $this->increase_serial($session_id, $client_id, $params);
return $affected_rows;
public function dns_txt_delete($session_id, $primary_id, $update_serial=false) {
return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'TXT');
}
/**
......@@ -856,7 +610,7 @@ class remoting_dns extends remoting {
public function dns_zone_get_by_user($session_id, $client_id, $server_id) {
global $app;
if(!$this->checkPerm($session_id, 'dns_zone_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($client_id) && !empty($server_id)) {
......@@ -880,7 +634,7 @@ class remoting_dns extends remoting {
public function dns_rr_get_all_by_zone($session_id, $zone_id) {
global $app;
if(!$this->checkPerm($session_id, 'dns_zone_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;
}
$sql = "SELECT * FROM dns_rr WHERE zone = ?";
......@@ -898,7 +652,7 @@ class remoting_dns extends remoting {
public function dns_zone_set_status($session_id, $primary_id, $status) {
global $app;
if(!$this->checkPerm($session_id, 'dns_zone_set_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;
}
if(in_array($status, array('active', 'inactive'))) {
......@@ -912,12 +666,18 @@ class remoting_dns extends remoting {
$result = $app->db->affectedRows();
return $result;
} else {
throw new SoapFault('status_undefined', 'The status is not available');
throw new ISPConfigRemoteException('status_undefined', 'The status is not available');
return false;
}
}
private function increase_serial($session_id, $client_id, $params) {
global $app;
if(!isset($params['zone']) && isset($params['dns_rr_id'])) {
$tmp = $app->db->queryOneRecord('SELECT zone FROM dns_rr WHERE id = ?',$params['dns_rr_id']);
$params['zone'] = $tmp['zone'];
unset($tmp);
}
$soa = $this->dns_zone_get($session_id, $params['zone']);
$serial=$soa['serial'];
$serial_date = intval(substr($serial, 0, 8));
......@@ -938,5 +698,3 @@ class remoting_dns extends remoting {
$this->dns_zone_update($session_id, $client_id, $soa['id'], $soa);
}
}
?>
......@@ -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,17 +59,27 @@ 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);
}
//* Update a record
public function domains_domain_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'domains_domain_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
return $this->updateQuery('../client/form/domain.tform.php', $client_id, $primary_id, $params);
}
//* Delete a record
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 +92,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);
......
......@@ -45,7 +45,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_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');
......@@ -57,7 +57,7 @@ class remoting_mail extends remoting {
public function mail_domain_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'mail_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;
}
$primary_id = $this->insertQuery('../mail/form/mail_domain.tform.php', $client_id, $params);
......@@ -68,7 +68,7 @@ class remoting_mail extends remoting {
public function mail_domain_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'mail_domain_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('../mail/form/mail_domain.tform.php', $client_id, $primary_id, $params);
......@@ -79,7 +79,7 @@ class remoting_mail extends remoting {
public function mail_domain_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'mail_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('../mail/form/mail_domain.tform.php', $primary_id);
......@@ -92,7 +92,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_aliasdomain_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');
......@@ -105,7 +105,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_aliasdomain_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;
}
$affected_rows = $this->insertQuery('../mail/form/mail_aliasdomain.tform.php', $client_id, $params);
......@@ -117,7 +117,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_aliasdomain_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('../mail/form/mail_aliasdomain.tform.php', $client_id, $primary_id, $params);
......@@ -128,67 +128,20 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_aliasdomain_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('../mail/form/mail_aliasdomain.tform.php', $primary_id);
return $affected_rows;
}
//* Get mail mailinglist details
public function mail_mailinglist_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'mail_mailinglist_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../mail/form/mail_mailinglist.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
//* Add a mail mailinglist
public function mail_mailinglist_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'mail_mailinglist_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$primary_id = $this->insertQuery('../mail/form/mail_mailinglist.tform.php', $client_id, $params);
return $primary_id;
}
//* Update a mail mailinglist
public function mail_mailinglist_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'mail_mailinglist_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../mail/form/mail_mailinglist.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
}
//* Delete a mail mailinglist
public function mail_mailinglist_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'mail_mailinglist_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../mail/form/mail_mailinglist.tform.php', $primary_id);
return $affected_rows;
}
//* Get mail user details
public function mail_user_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'mail_user_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');
......@@ -202,7 +155,7 @@ class remoting_mail extends remoting {
global $app;
if (!$this->checkPerm($session_id, 'mail_user_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;
}
......@@ -210,7 +163,7 @@ class remoting_mail extends remoting {
$email_parts = explode('@', $params['email']);
$tmp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = ?", $email_parts[1]);
if($tmp['domain'] != $email_parts[1]) {
throw new SoapFault('mail_domain_does_not_exist', 'Mail domain - '.$email_parts[1].' - does not exist.');
throw new ISPConfigRemoteException('mail_domain_does_not_exist', 'Mail domain - '.$email_parts[1].' - does not exist.');
return false;
}
......@@ -219,8 +172,8 @@ class remoting_mail extends remoting {
if (!isset($params['gid'])) $params['gid'] = -1;
if (!isset($params['maildir_format'])) $params['maildir_format'] = 'maildir';
$affected_rows = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params);
return $affected_rows;
$mailuser_id = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params);
return $mailuser_id;
}
//* Update mail user
......@@ -230,7 +183,7 @@ class remoting_mail extends remoting {
if (!$this->checkPerm($session_id, 'mail_user_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;
}
......@@ -238,7 +191,7 @@ class remoting_mail extends remoting {
$email_parts = explode('@', $params['email']);
$tmp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = ?", $email_parts[1]);
if($tmp['domain'] != $email_parts[1]) {
throw new SoapFault('mail_domain_does_not_exist', 'Mail domain - '.$email_parts[1].' - does not exist.');
throw new ISPConfigRemoteException('mail_domain_does_not_exist', 'Mail domain - '.$email_parts[1].' - does not exist.');
return false;
}
......@@ -252,7 +205,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_user_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('../mail/form/mail_user.tform.php', $primary_id);
......@@ -265,7 +218,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_user_filter_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');
......@@ -277,7 +230,7 @@ class remoting_mail extends remoting {
{
global $app;
if (!$this->checkPerm($session_id, 'mail_user_filter_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;
}
$affected_rows = $this->insertQuery('../mail/form/mail_user_filter.tform.php', $client_id, $params, 'mail:mail_user_filter:on_after_insert');
......@@ -290,7 +243,7 @@ class remoting_mail extends remoting {
global $app;
if (!$this->checkPerm($session_id, 'mail_user_filter_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('../mail/form/mail_user_filter.tform.php', $client_id, $primary_id, $params, 'mail:mail_user_filter:on_after_update');
......@@ -303,7 +256,7 @@ class remoting_mail extends remoting {
global $app;
if (!$this->checkPerm($session_id, 'mail_user_filter_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('../mail/form/mail_user_filter.tform.php', $primary_id, 'mail:mail_user_filter:on_after_delete');
......@@ -311,13 +264,13 @@ class remoting_mail extends remoting {
return $affected_rows;
}
// Mail backup list function by Dominik Müller, info@profi-webdesign.net
// Mail backup list function by Dominik M�ller, info@profi-webdesign.net
public function mail_user_backup_list($session_id, $primary_id = null)
{
global $app;
if(!$this->checkPerm($session_id, 'mail_user_backup')) {
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;
}
......@@ -334,13 +287,13 @@ class remoting_mail extends remoting {
return $result;
}
// Mail backup restore/download functions by Dominik Müller, info@profi-webdesign.net
// Mail backup restore/download functions by Dominik M�ller, info@profi-webdesign.net
public function mail_user_backup($session_id, $primary_id, $action_type)
{
global $app;
if(!$this->checkPerm($session_id, 'mail_user_backup')) {
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;
}
......@@ -354,19 +307,19 @@ class remoting_mail extends remoting {
//* Basic validation of variables
if ($server_id <= 0) {
throw new SoapFault('invalid_backup_id', "Invalid or non existant backup_id $primary_id");
throw new ISPConfigRemoteException('invalid_backup_id', "Invalid or non existant backup_id $primary_id");
return false;
}
if (/*$action_type != 'backup_download_mail' and*/ $action_type != 'backup_restore_mail' and $action_type != 'backup_delete_mail') {
throw new SoapFault('invalid_action', "Invalid action_type $action_type");
throw new ISPConfigRemoteException('invalid_action', "Invalid action_type $action_type");
return false;
}
//* Validate instance
$instance_record = $app->db->queryOneRecord("SELECT * FROM `sys_remoteaction` WHERE `action_param`=? and `action_type`=? and `action_state`='pending'", $primary_id, $action_type);
if ($instance_record['action_id'] >= 1) {
throw new SoapFault('duplicate_action', "There is already a pending $action_type action");
throw new ISPConfigRemoteException('duplicate_action', "There is already a pending $action_type action");
return false;
}
......@@ -384,7 +337,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_alias_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');
......@@ -399,14 +352,14 @@ class remoting_mail extends remoting {
if (!$this->checkPerm($session_id, 'mail_alias_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;
}
//* Check if there is no active mailbox with this address
$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = ?", $params["source"]);
if($tmp['number'] > 0) {
throw new SoapFault('duplicate', 'There is already a mailbox with this email address.');
throw new ISPConfigRemoteException('duplicate', 'There is already a mailbox with this email address.');
}
unset($tmp);
......@@ -421,14 +374,14 @@ class remoting_mail extends remoting {
if (!$this->checkPerm($session_id, 'mail_alias_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;
}
//* Check if there is no active mailbox with this address
$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = ?", $params["source"]);
if($tmp['number'] > 0) {
throw new SoapFault('duplicate', 'There is already a mailbox with this email address.');
throw new ISPConfigRemoteException('duplicate', 'There is already a mailbox with this email address.');
}
unset($tmp);
......@@ -440,7 +393,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_alias_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('../mail/form/mail_alias.tform.php', $primary_id);
......@@ -453,7 +406,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_forward_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');
......@@ -466,7 +419,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_forward_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;
}
$affected_rows = $this->insertQuery('../mail/form/mail_forward.tform.php', $client_id, $params);
......@@ -478,7 +431,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_forward_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('../mail/form/mail_forward.tform.php', $client_id, $primary_id, $params);
......@@ -490,7 +443,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_forward_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('../mail/form/mail_forward.tform.php', $primary_id);
......@@ -503,7 +456,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_catchall_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');
......@@ -516,7 +469,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_catchall_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;
}
$affected_rows = $this->insertQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $params);
......@@ -527,7 +480,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_catchall_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('../mail/form/mail_domain_catchall.tform.php', $client_id, $primary_id, $params);
......@@ -538,7 +491,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_catchall_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('../mail/form/mail_domain_catchall.tform.php', $primary_id);
......@@ -551,7 +504,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_transport_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');
......@@ -564,7 +517,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_transport_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;
}
$affected_rows = $this->insertQuery('../mail/form/mail_transport.tform.php', $client_id, $params);
......@@ -576,7 +529,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_transport_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('../mail/form/mail_transport.tform.php', $client_id, $primary_id, $params);
......@@ -588,7 +541,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_transport_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('../mail/form/mail_transport.tform.php', $primary_id);
......@@ -601,7 +554,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_relay_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');
......@@ -615,7 +568,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_relay_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;
}
$affected_rows = $this->insertQuery('../mail/form/mail_relay_recipient.tform.php', $client_id, $params);
......@@ -627,7 +580,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_relay_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('../mail/form/mail_relay_recipient.tform.php', $client_id, $primary_id, $params);
......@@ -639,7 +592,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_relay_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('../mail/form/mail_relay_recipient.tform.php', $primary_id);
......@@ -652,7 +605,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_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');
......@@ -665,7 +618,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_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;
}
$affected_rows = $this->insertQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $params);
......@@ -677,7 +630,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_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('../mail/form/spamfilter_whitelist.tform.php', $client_id, $primary_id, $params);
......@@ -689,7 +642,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_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('../mail/form/spamfilter_whitelist.tform.php', $primary_id);
......@@ -702,7 +655,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_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');
......@@ -715,7 +668,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_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;
}
$affected_rows = $this->insertQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $params);
......@@ -727,7 +680,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_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('../mail/form/spamfilter_blacklist.tform.php', $client_id, $primary_id, $params);
......@@ -739,7 +692,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_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('../mail/form/spamfilter_blacklist.tform.php', $primary_id);
......@@ -752,7 +705,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_spamfilter_user_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');
......@@ -765,7 +718,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_spamfilter_user_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;
}
$affected_rows = $this->insertQuery('../mail/form/spamfilter_users.tform.php', $client_id, $params);
......@@ -777,7 +730,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_spamfilter_user_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('../mail/form/spamfilter_users.tform.php', $client_id, $primary_id, $params);
......@@ -789,7 +742,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_spamfilter_user_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('../mail/form/spamfilter_users.tform.php', $primary_id);
......@@ -802,7 +755,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_policy_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');
......@@ -815,7 +768,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_policy_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;
}
$affected_rows = $this->insertQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $params);
......@@ -827,7 +780,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_policy_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('../mail/form/spamfilter_policy.tform.php', $client_id, $primary_id, $params);
......@@ -839,7 +792,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_policy_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('../mail/form/spamfilter_policy.tform.php', $primary_id);
......@@ -852,7 +805,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_fetchmail_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');
......@@ -865,7 +818,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_fetchmail_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;
}
$affected_rows = $this->insertQuery('../mail/form/mail_get.tform.php', $client_id, $params);
......@@ -877,7 +830,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_fetchmail_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('../mail/form/mail_get.tform.php', $client_id, $primary_id, $params);
......@@ -889,7 +842,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_fetchmail_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('../mail/form/mail_get.tform.php', $primary_id);
......@@ -902,7 +855,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_whitelist_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');
......@@ -915,7 +868,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_whitelist_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;
}
$affected_rows = $this->insertQuery('../mail/form/mail_whitelist.tform.php', $client_id, $params);
......@@ -927,7 +880,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_whitelist_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('../mail/form/mail_whitelist.tform.php', $client_id, $primary_id, $params);
......@@ -939,7 +892,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_whitelist_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('../mail/form/mail_whitelist.tform.php', $primary_id);
......@@ -952,7 +905,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_blacklist_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');
......@@ -965,7 +918,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_blacklist_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;
}
$affected_rows = $this->insertQuery('../mail/form/mail_blacklist.tform.php', $client_id, $params);
......@@ -977,7 +930,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_blacklist_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('../mail/form/mail_blacklist.tform.php', $client_id, $primary_id, $params);
......@@ -989,7 +942,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_blacklist_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('../mail/form/mail_blacklist.tform.php', $primary_id);
......@@ -1002,7 +955,7 @@ class remoting_mail extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'mail_filter_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');
......@@ -1015,7 +968,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_filter_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;
}
$affected_rows = $this->insertQuery('../mail/form/mail_content_filter.tform.php', $client_id, $params);
......@@ -1027,7 +980,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_filter_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('../mail/form/mail_content_filter.tform.php', $client_id, $primary_id, $params);
......@@ -1039,7 +992,7 @@ class remoting_mail extends remoting {
{
if (!$this->checkPerm($session_id, 'mail_filter_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('../mail/form/mail_content_filter.tform.php', $primary_id);
......@@ -1058,7 +1011,7 @@ class remoting_mail extends remoting {
public function mail_domain_get_by_domain($session_id, $domain) {
global $app;
if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) {
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($domain)) {
......@@ -1072,7 +1025,7 @@ class remoting_mail extends remoting {
public function mail_domain_set_status($session_id, $primary_id, $status) {
global $app;
if(!$this->checkPerm($session_id, 'mail_domain_set_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;
}
if(in_array($status, array('active', 'inactive'))) {
......@@ -1086,7 +1039,7 @@ class remoting_mail extends remoting {
$result = $app->db->affectedRows();
return $result;
} else {
throw new SoapFault('status_undefined', 'The status is not available');
throw new ISPConfigRemoteException('status_undefined', 'The status is not available');
return false;
}
}
......@@ -1098,179 +1051,12 @@ class remoting_mail extends remoting {
$app->uses('quota_lib');
if(!$this->checkPerm($session_id, 'mailquota_get_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;
}
return $app->quota_lib->get_mailquota_data($client_id, false);
}
//** xmpp functions -----------------------------------------------------------------------------------
public function xmpp_domain_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'xmpp_domain_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../mail/form/xmpp_domain.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
public function xmpp_domain_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'xmpp_domain_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$primary_id = $this->insertQuery('../mail/form/xmpp_domain.tform.php', $client_id, $params);
return $primary_id;
}
public function xmpp_domain_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'xmpp_domain_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../mail/form/xmpp_domain.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
}
public function xmpp_domain_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'xmpp_domain_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../mail/form/xmpp_domain.tform.php', $primary_id);
return $affected_rows;
}
public function xmpp_user_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'xmpp_user_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../mail/form/xmpp_user.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
public function xmpp_user_add($session_id, $client_id, $params){
global $app;
if (!$this->checkPerm($session_id, 'xmpp_user_add')){
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$jid_parts = explode('@', $params['jid']);
$tmp = $app->db->queryOneRecord("SELECT domain FROM xmpp_domain WHERE domain = ?", $jid_parts[1]);
if($tmp['domain'] != $jid_parts[1]) {
throw new SoapFault('xmpp_domain_does_not_exist', 'XMPP domain - '.$jid_parts[1].' - does not exist.');
return false;
}
$affected_rows = $this->insertQuery('../mail/form/xmpp_user.tform.php', $client_id, $params);
return $affected_rows;
}
public function xmpp_user_update($session_id, $client_id, $primary_id, $params)
{
global $app;
if (!$this->checkPerm($session_id, 'xmpp_user_update'))
{
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$jid_parts = explode('@', $jid_parts['jid']);
$tmp = $app->db->queryOneRecord("SELECT domain FROM xmpp_domain WHERE domain = ?", $jid_parts[1]);
if($tmp['domain'] != $jid_parts[1]) {
throw new SoapFault('xmpp_domain_does_not_exist', 'Mail domain - '.$jid_parts[1].' - does not exist.');
return false;
}
$affected_rows = $this->updateQuery('../mail/form/xmpp_user.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
}
public function xmpp_user_delete($session_id, $primary_id)
{
if (!$this->checkPerm($session_id, 'xmpp_user_delete'))
{
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../mail/form/xmpp_user.tform.php', $primary_id);
return $affected_rows;
}
public function xmpp_domain_get_by_domain($session_id, $domain) {
global $app;
if(!$this->checkPerm($session_id, 'xmpp_domain_get_by_domain')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (!empty($domain)) {
$sql = "SELECT * FROM xmpp_domain WHERE domain = ?";
$result = $app->db->queryAllRecords($sql, $domain);
return $result;
}
return false;
}
public function xmpp_domain_set_status($session_id, $primary_id, $status) {
global $app;
if(!$this->checkPerm($session_id, 'xmpp_domain_set_status')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if(in_array($status, array('active', 'inactive'))) {
if ($status == 'active') {
$status = 'y';
} else {
$status = 'n';
}
$sql = "UPDATE xmpp_domain SET active = ? WHERE domain_id = ?";
$app->db->query($sql, $status, $primary_id);
$result = $app->db->affectedRows();
return $result;
} else {
throw new SoapFault('status_undefined', 'The status is not available');
return false;
}
}
public function xmpp_user_set_status($session_id, $primary_id, $status) {
global $app;
if(!$this->checkPerm($session_id, 'xmpp_user_set_status')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if(in_array($status, array('active', 'inactive'))) {
if ($status == 'active') {
$status = 'y';
} else {
$status = 'n';
}
$sql = "UPDATE xmpp_user SET active = ? WHERE xmppuser_id = ?";
$app->db->query($sql, $status, $primary_id);
$result = $app->db->affectedRows();
return $result;
} else {
throw new SoapFault('status_undefined', 'The status is not available');
return false;
}
}
}
?>
......@@ -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;
}
......
<?php
/*
Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--UPDATED 08.2009--
Full SOAP support for ISPConfig 3.1.4 b
Updated by Arkadiusz Roch & Artur Edelman
Copyright (c) Tri-Plex technology
--UPDATED 08.2013--
Migrated into new remote classes system
by Marius Cramer <m.cramer@pixcept.de>
*/
class remoting_openvz extends remoting {
//* Functions for virtual machine management
//* Get OpenVZ OStemplate details
public function openvz_ostemplate_get($session_id, $ostemplate_id)
{
global $app;
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../vm/form/openvz_ostemplate.tform.php');
return $app->remoting_lib->getDataRecord($ostemplate_id);
}
//* Add a openvz ostemplate record
public function openvz_ostemplate_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
return $this->insertQuery('../vm/form/openvz_ostemplate.tform.php', $client_id, $params);
}
//* Update openvz ostemplate record
public function openvz_ostemplate_update($session_id, $client_id, $ostemplate_id, $params)
{
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../vm/form/openvz_ostemplate.tform.php', $client_id, $ostemplate_id, $params);
return $affected_rows;
}
//* Delete openvz ostemplate record
public function openvz_ostemplate_delete($session_id, $ostemplate_id)
{
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../vm/form/openvz_ostemplate.tform.php', $ostemplate_id);
return $affected_rows;
}
//* Get OpenVZ template details
public function openvz_template_get($session_id, $template_id)
{
global $app;
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../vm/form/openvz_template.tform.php');
return $app->remoting_lib->getDataRecord($template_id);
}
//* Add a openvz template record
public function openvz_template_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
return $this->insertQuery('../vm/form/openvz_template.tform.php', $client_id, $params);
}
//* Update openvz template record
public function openvz_template_update($session_id, $client_id, $template_id, $params)
{
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../vm/form/openvz_template.tform.php', $client_id, $template_id, $params);
return $affected_rows;
}
//* Delete openvz template record
public function openvz_template_delete($session_id, $template_id)
{
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../vm/form/openvz_template.tform.php', $template_id);
return $affected_rows;
}
//* Get OpenVZ ip details
public function openvz_ip_get($session_id, $ip_id)
{
global $app;
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../vm/form/openvz_ip.tform.php');
return $app->remoting_lib->getDataRecord($ip_id);
}
//* Get OpenVZ a free IP address
public function openvz_get_free_ip($session_id, $server_id = 0)
{
global $app;
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$server_id = $app->functions->intval($server_id);
if($server_id > 0) {
$tmp = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 AND server_id = ? LIMIT 0,1", $server_id);
} else {
$tmp = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 LIMIT 0,1");
}
if(count($tmp) > 0) {
return $tmp;
} else {
throw new SoapFault('no_free_ip', 'There is no free IP available.');
}
}
//* Add a openvz ip record
public function openvz_ip_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
return $this->insertQuery('../vm/form/openvz_ip.tform.php', $client_id, $params);
}
//* Update openvz ip record
public function openvz_ip_update($session_id, $client_id, $ip_id, $params)
{
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../vm/form/openvz_ip.tform.php', $client_id, $ip_id, $params);
return $affected_rows;
}
//* Delete openvz ip record
public function openvz_ip_delete($session_id, $ip_id)
{
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../vm/form/openvz_ip.tform.php', $ip_id);
return $affected_rows;
}
//* Get OpenVZ vm details
public function openvz_vm_get($session_id, $vm_id)
{
global $app;
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php');
return $app->remoting_lib->getDataRecord($vm_id);
}
//* Get OpenVZ list
public function openvz_vm_get_by_client($session_id, $client_id)
{
global $app;
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (!empty($client_id)) {
$client_id = $app->functions->intval($client_id);
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client_id);
$sql = "SELECT * FROM openvz_vm WHERE sys_groupid = ?";
$result = $app->db->queryAllRecords($sql, $tmp['groupid']);
return $result;
}
return false;
}
//* Add a openvz vm record
public function openvz_vm_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
return $this->insertQuery('../vm/form/openvz_vm.tform.php', $client_id, $params);
}
//* Add a openvz vm record from template
public function openvz_vm_add_from_template($session_id, $client_id, $ostemplate_id, $template_id, $override_params = array())
{
global $app;
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$template_id = $app->functions->intval($template_id);
$ostemplate_id = $app->functions->intval($ostemplate_id);
//* Verify parameters
if($template_id == 0) {
throw new SoapFault('template_id_error', 'Template ID must be > 0.');
return false;
}
if($ostemplate_id == 0) {
throw new SoapFault('ostemplate_id_error', 'OSTemplate ID must be > 0.');
return false;
}
// Verify if template and ostemplate exist
$tmp = $app->db->queryOneRecord("SELECT template_id FROM openvz_template WHERE template_id = ?", $template_id);
if(!is_array($tmp)) {
throw new SoapFault('template_id_error', 'Template does not exist.');
return false;
}
$tmp = $app->db->queryOneRecord("SELECT ostemplate_id FROM openvz_ostemplate WHERE ostemplate_id = ?", $ostemplate_id);
if(!is_array($tmp)) {
throw new SoapFault('ostemplate_id_error', 'OSTemplate does not exist.');
return false;
}
//* Get the template
$vtpl = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = ?", $template_id);
//* Get the IP address and server_id
if($override_params['server_id'] > 0) {
$vmip = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 AND server_id = ? LIMIT 0,1", $override_params['server_id']);
} else {
$vmip = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 LIMIT 0,1");
}
if(!is_array($vmip)) {
throw new SoapFault('vm_ip_error', 'Unable to get a free VM IP.');
return false;
}
//* Build the $params array
$params = array();
$params['server_id'] = $vmip['server_id'];
$params['ostemplate_id'] = $ostemplate_id;
$params['template_id'] = $template_id;
$params['ip_address'] = $vmip['ip_address'];
$params['hostname'] = (isset($override_params['hostname']))?$override_params['hostname']:$vtpl['hostname'];
$params['vm_password'] = (isset($override_params['vm_password']))?$override_params['vm_password']:$app->auth->get_random_password(10);
$params['start_boot'] = (isset($override_params['start_boot']))?$override_params['start_boot']:'y';
$params['active'] = (isset($override_params['active']))?$override_params['active']:'y';
$params['active_until_date'] = (isset($override_params['active_until_date']))?$override_params['active_until_date']:null;
$params['description'] = (isset($override_params['description']))?$override_params['description']:'';
//* The next params get filled with pseudo values, as the get replaced
//* by the openvz event plugin anyway with values from the template
$params['veid'] = 1;
$params['diskspace'] = 1;
$params['ram'] = 1;
$params['ram_burst'] = 1;
$params['cpu_units'] = 1;
$params['cpu_num'] = 1;
$params['cpu_limit'] = 1;
$params['io_priority'] = 1;
$params['nameserver'] = '8.8.8.8 8.8.4.4';
$params['create_dns'] = 'n';
$params['capability'] = '';
return $this->insertQuery('../vm/form/openvz_vm.tform.php', $client_id, $params, 'vm:openvz_vm:on_after_insert');
}
//* Update openvz vm record
public function openvz_vm_update($session_id, $client_id, $vm_id, $params)
{
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../vm/form/openvz_vm.tform.php', $client_id, $vm_id, $params, 'vm:openvz_vm:on_after_update');
return $affected_rows;
}
//* Delete openvz vm record
public function openvz_vm_delete($session_id, $vm_id)
{
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../vm/form/openvz_vm.tform.php', $vm_id, 'vm:openvz_vm:on_after_delete');
return $affected_rows;
}
//* Start VM
public function openvz_vm_start($session_id, $vm_id)
{
global $app;
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php');
$vm = $app->remoting_lib->getDataRecord($vm_id);
if(!is_array($vm)) {
throw new SoapFault('action_pending', 'No VM with this ID available.');
return false;
}
if($vm['active'] == 'n') {
throw new SoapFault('action_pending', 'VM is not in active state.');
return false;
}
$action = 'openvz_start_vm';
$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction
WHERE server_id = ?
AND action_type = ?
AND action_param = ?
AND action_state = 'pending'", $vm['server_id'], $action, $vm['veid']);
if($tmp['actions'] > 0) {
throw new SoapFault('action_pending', 'There is already a action pending for this VM.');
return false;
} else {
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
"VALUES (?, ?, ?, ?, 'pending', '')";
$app->db->query($sql, (int)$vm['server_id'], time(), $action, $vm['veid']);
}
}
//* Stop VM
public function openvz_vm_stop($session_id, $vm_id)
{
global $app;
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php');
$vm = $app->remoting_lib->getDataRecord($vm_id);
if(!is_array($vm)) {
throw new SoapFault('action_pending', 'No VM with this ID available.');
return false;
}
if($vm['active'] == 'n') {
throw new SoapFault('action_pending', 'VM is not in active state.');
return false;
}
$action = 'openvz_stop_vm';
$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction
WHERE server_id = ?
AND action_type = ?
AND action_param = ?
AND action_state = 'pending'", $vm['server_id'], $action, $vm['veid']);
if($tmp['actions'] > 0) {
throw new SoapFault('action_pending', 'There is already a action pending for this VM.');
return false;
} else {
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
"VALUES (?, ?, ?, ?, 'pending', '')";
$app->db->query($sql, (int)$vm['server_id'], time(), $action, $vm['veid']);
}
}
//* Restart VM
public function openvz_vm_restart($session_id, $vm_id)
{
global $app;
if(!$this->checkPerm($session_id, 'vm_openvz')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php');
$vm = $app->remoting_lib->getDataRecord($vm_id);
if(!is_array($vm)) {
throw new SoapFault('action_pending', 'No VM with this ID available.');
return false;
}
if($vm['active'] == 'n') {
throw new SoapFault('action_pending', 'VM is not in active state.');
return false;
}
$action = 'openvz_restart_vm';
$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction
WHERE server_id = ?
AND action_type = ?
AND action_param = ?
AND action_state = 'pending'", $vm['server_id'], $action, $vm['veid']);
if($tmp['actions'] > 0) {
throw new SoapFault('action_pending', 'There is already a action pending for this VM.');
return false;
} else {
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
"VALUES (?, ?, ?, ?, 'pending', '')";
$app->db->query($sql, (int)$vm['server_id'], time(), $action, $vm['veid']);
}
}
}
?>
......@@ -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,8 +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.');
return false;
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 = ?";
......@@ -224,13 +223,23 @@ 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.');
return false;
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
}
if (!empty($session_id) && !empty($server_id)) {
$sql = "SELECT mail_server, web_server, dns_server, file_server, db_server, vserver_server, proxy_server, firewall_server, xmpp_server, mirror_server_id FROM server WHERE server_id = ?";
$sql = "SELECT * FROM server WHERE server_id = ?";
$all = $app->db->queryOneRecord($sql, $server_id);
return $all;
if(empty($all)) return false;
$func = array();
foreach($all as $key => $value) {
if($key === 'mirror_server_id' || substr($key, -7) === '_server') {
if(is_numeric($value)) {
$func[$key] = $value;
}
}
}
return $func;
} else {
return false;
}
......@@ -240,8 +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.');
return false;
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);
......@@ -261,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();
......@@ -269,7 +277,7 @@ class remoting_server extends remoting {
$web_config[$server_id] = $app->getconf->get_server_config($server_id, 'web');
$server_type = !empty($web_config[$server_id]['server_type']) ? $web_config[$server_id]['server_type'] : 'apache';
if ($php === 'php-fpm' || ($php === 'hhvm' && $server_type === 'nginx')) {
if ($php === 'php-fpm') {
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0)", $server_id);
foreach ($php_records as $php_record) {
$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
......
......@@ -47,7 +47,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_cron_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_sites extends remoting {
public function sites_cron_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_cron_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('../sites/form/cron.tform.php', $client_id, $params);
......@@ -69,7 +69,7 @@ class remoting_sites extends remoting {
public function sites_cron_update($session_id, $client_id, $cron_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_cron_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('../sites/form/cron.tform.php', $client_id, $cron_id, $params);
......@@ -80,7 +80,7 @@ class remoting_sites extends remoting {
public function sites_cron_delete($session_id, $cron_id)
{
if(!$this->checkPerm($session_id, 'sites_cron_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('../sites/form/cron.tform.php', $cron_id);
......@@ -95,7 +95,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_database_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');
......@@ -110,14 +110,14 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_database_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;
}
//* Check for duplicates
$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = ? AND server_id = ?", $params['database_name'], $params["server_id"]);
if($tmp['dbnum'] > 0) {
throw new SoapFault('database_name_error_unique', 'There is already a database with that name on the same server.');
throw new ISPConfigRemoteException('database_name_error_unique', 'There is already a database with that name on the same server.');
return false;
}
......@@ -151,7 +151,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_database_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;
}
......@@ -183,7 +183,7 @@ class remoting_sites extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'sites_database_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;
}
......@@ -202,7 +202,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_database_user_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');
......@@ -214,7 +214,7 @@ class remoting_sites extends remoting {
public function sites_database_user_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_database_user_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;
}
......@@ -227,7 +227,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_database_user_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;
}
$app->uses('remoting_lib');
......@@ -257,7 +257,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_database_user_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;
}
......@@ -285,7 +285,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_ftp_user_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');
......@@ -297,7 +297,7 @@ class remoting_sites extends remoting {
public function sites_ftp_user_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_ftp_user_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('../sites/form/ftp_user.tform.php', $client_id, $params);
......@@ -307,7 +307,7 @@ class remoting_sites extends remoting {
public function sites_ftp_user_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_ftp_user_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('../sites/form/ftp_user.tform.php', $client_id, $primary_id, $params);
......@@ -318,7 +318,7 @@ class remoting_sites extends remoting {
public function sites_ftp_user_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'sites_ftp_user_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('../sites/form/ftp_user.tform.php', $primary_id);
......@@ -331,7 +331,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_ftp_user_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;
}
......@@ -353,7 +353,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_shell_user_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');
......@@ -365,7 +365,7 @@ class remoting_sites extends remoting {
public function sites_shell_user_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_shell_user_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('../sites/form/shell_user.tform.php', $client_id, $params);
......@@ -375,7 +375,7 @@ class remoting_sites extends remoting {
public function sites_shell_user_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_shell_user_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('../sites/form/shell_user.tform.php', $client_id, $primary_id, $params);
......@@ -386,7 +386,7 @@ class remoting_sites extends remoting {
public function sites_shell_user_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'sites_shell_user_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('../sites/form/shell_user.tform.php', $primary_id);
......@@ -401,7 +401,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_web_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');
......@@ -414,7 +414,7 @@ class remoting_sites extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'sites_web_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;
}
......@@ -445,7 +445,7 @@ class remoting_sites extends remoting {
public function sites_web_domain_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_domain_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;
}
......@@ -465,7 +465,7 @@ class remoting_sites extends remoting {
public function sites_web_domain_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'sites_web_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('../sites/form/web_vhost_domain.tform.php', $primary_id);
......@@ -480,7 +480,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_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');
......@@ -493,7 +493,7 @@ class remoting_sites extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_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;
}
......@@ -517,7 +517,7 @@ class remoting_sites extends remoting {
public function sites_web_vhost_aliasdomain_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_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;
}
......@@ -537,7 +537,7 @@ class remoting_sites extends remoting {
public function sites_web_vhost_aliasdomain_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_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('../sites/form/web_vhost_domain.tform.php', $primary_id);
......@@ -552,7 +552,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_web_subdomain_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');
......@@ -565,7 +565,7 @@ class remoting_sites extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'sites_web_subdomain_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;
}
......@@ -589,7 +589,7 @@ class remoting_sites extends remoting {
public function sites_web_vhost_subdomain_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_subdomain_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;
}
......@@ -609,7 +609,7 @@ class remoting_sites extends remoting {
public function sites_web_vhost_subdomain_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'sites_web_subdomain_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('../sites/form/web_vhost_domain.tform.php', $primary_id);
......@@ -624,7 +624,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_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');
......@@ -636,7 +636,7 @@ class remoting_sites extends remoting {
public function sites_web_aliasdomain_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_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('../sites/form/web_childdomain.tform.php', $client_id, $params);
......@@ -646,7 +646,7 @@ class remoting_sites extends remoting {
public function sites_web_aliasdomain_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_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('../sites/form/web_childdomain.tform.php', $client_id, $primary_id, $params);
......@@ -657,7 +657,7 @@ class remoting_sites extends remoting {
public function sites_web_aliasdomain_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_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('../sites/form/web_childdomain.tform.php', $primary_id);
......@@ -672,7 +672,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_web_subdomain_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');
......@@ -684,7 +684,7 @@ class remoting_sites extends remoting {
public function sites_web_subdomain_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_subdomain_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('../sites/form/web_childdomain.tform.php', $client_id, $params);
......@@ -694,7 +694,7 @@ class remoting_sites extends remoting {
public function sites_web_subdomain_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_subdomain_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('../sites/form/web_childdomain.tform.php', $client_id, $primary_id, $params);
......@@ -705,7 +705,7 @@ class remoting_sites extends remoting {
public function sites_web_subdomain_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'sites_web_subdomain_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('../sites/form/web_childdomain.tform.php', $primary_id);
......@@ -720,7 +720,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_web_folder_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');
......@@ -732,7 +732,7 @@ class remoting_sites extends remoting {
public function sites_web_folder_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_folder_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('../sites/form/web_folder.tform.php', $client_id, $params);
......@@ -742,7 +742,7 @@ class remoting_sites extends remoting {
public function sites_web_folder_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_folder_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('../sites/form/web_folder.tform.php', $client_id, $primary_id, $params);
......@@ -754,7 +754,7 @@ class remoting_sites extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'sites_web_folder_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;
}
......@@ -778,7 +778,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_web_folder_user_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');
......@@ -790,7 +790,7 @@ class remoting_sites extends remoting {
public function sites_web_folder_user_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_folder_user_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('../sites/form/web_folder_user.tform.php', $client_id, $params);
......@@ -800,7 +800,7 @@ class remoting_sites extends remoting {
public function sites_web_folder_user_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_folder_user_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('../sites/form/web_folder_user.tform.php', $client_id, $primary_id, $params);
......@@ -811,7 +811,7 @@ class remoting_sites extends remoting {
public function sites_web_folder_user_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'sites_web_folder_user_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('../sites/form/web_folder_user.tform.php', $primary_id);
......@@ -831,7 +831,7 @@ class remoting_sites extends remoting {
public function client_get_sites_by_user($session_id, $sys_userid, $sys_groupid) {
global $app;
if(!$this->checkPerm($session_id, 'client_get_sites_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;
}
$sys_userid = $app->functions->intval($sys_userid);
......@@ -846,7 +846,7 @@ class remoting_sites extends remoting {
if(isset($result)) {
return $result;
} else {
throw new SoapFault('no_client_found', 'There is no site for this user');
throw new ISPConfigRemoteException('no_client_found', 'There is no site for this user');
return false;
}
}
......@@ -864,7 +864,7 @@ class remoting_sites extends remoting {
public function sites_web_domain_set_status($session_id, $primary_id, $status) {
global $app;
if(!$this->checkPerm($session_id, 'sites_web_domain_set_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;
}
if(in_array($status, array('active', 'inactive'))) {
......@@ -880,7 +880,7 @@ class remoting_sites extends remoting {
$affected_rows = $this->updateQuery('../sites/form/web_vhost_domain.tform.php', 0, $primary_id, $params);
return $affected_rows;
} else {
throw new SoapFault('status_undefined', 'The status is not available');
throw new ISPConfigRemoteException('status_undefined', 'The status is not available');
return false;
}
}
......@@ -893,7 +893,7 @@ class remoting_sites extends remoting {
{
global $app;
if(!$this->checkPerm($session_id, 'sites_database_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;
}
$client_id = $app->functions->intval($client_id);
......@@ -908,7 +908,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_web_domain_backup')) {
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;
}
......@@ -922,7 +922,7 @@ class remoting_sites extends remoting {
global $app;
if(!$this->checkPerm($session_id, 'sites_web_domain_backup')) {
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;
}
......@@ -936,19 +936,19 @@ class remoting_sites extends remoting {
//* Basic validation of variables
if ($server_id <= 0) {
throw new SoapFault('invalid_backup_id', "Invalid or non existant backup_id $primary_id");
throw new ISPConfigRemoteException('invalid_backup_id', "Invalid or non existant backup_id $primary_id");
return false;
}
if ($action_type != 'backup_download' and $action_type != 'backup_restore' and $action_type != 'backup_delete') {
throw new SoapFault('invalid_action', "Invalid action_type $action_type");
throw new ISPConfigRemoteException('invalid_action', "Invalid action_type $action_type");
return false;
}
//* Validate instance
$instance_record = $app->db->queryOneRecord("SELECT * FROM `sys_remoteaction` WHERE `action_param`= ? and `action_type`= ? and `action_state`= ?", $primary_id, $action_type, 'pending');
if ($instance_record['action_id'] >= 1) {
throw new SoapFault('duplicate_action', "There is already a pending $action_type action");
throw new ISPConfigRemoteException('duplicate_action', "There is already a pending $action_type action");
return false;
}
......@@ -967,7 +967,7 @@ class remoting_sites extends remoting {
$app->uses('quota_lib');
if(!$this->checkPerm($session_id, 'quota_get_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;
}
......@@ -980,7 +980,7 @@ class remoting_sites extends remoting {
$app->uses('quota_lib');
if(!$this->checkPerm($session_id, 'trafficquota_get_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;
}
if ($client_id != null)
......@@ -995,7 +995,7 @@ class remoting_sites extends remoting {
$app->uses('quota_lib');
if(!$this->checkPerm($session_id, 'trafficquota_get_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;
}
if ($client_id != null)
......@@ -1010,7 +1010,7 @@ class remoting_sites extends remoting {
$app->uses('quota_lib');
if(!$this->checkPerm($session_id, 'databasequota_get_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;
}
......
......@@ -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;
}
......@@ -407,7 +407,7 @@ class remoting {
$app->remoting_lib->loadFormDef($formdef_file);
//* get old record and merge with params, so only new values have to be set in $params
$old_rec = $app->remoting_lib->getDataRecord($primary_id);
$old_rec = $app->remoting_lib->getDataRecord($primary_id, $client_id);
foreach ($app->remoting_lib->formDef['fields'] as $fieldName => $fieldConf)
{
......@@ -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.');
return false;
}
return $this->_methods;
......