diff --git a/interface/lib/classes/remote.d/mail.inc.php b/interface/lib/classes/remote.d/mail.inc.php index dfbad2759581518228cdd5f3805c6421ace0e652..2d26b1969f95227916efca86e6a341ae27c896a1 100644 --- a/interface/lib/classes/remote.d/mail.inc.php +++ b/interface/lib/classes/remote.d/mail.inc.php @@ -223,7 +223,7 @@ class remoting_mail extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - + // Email addresses must always be lower case $params['email'] = strtolower($params['email']); @@ -331,17 +331,17 @@ class remoting_mail extends remoting { // $app->plugin->raiseEvent('mail:mail_user_filter:on_after_delete',$this); return $affected_rows; } - + // 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.'); return false; } - + $params = array(); if ($site_id != null) { $params[] = $site_id; @@ -350,47 +350,47 @@ class remoting_mail extends remoting { else { $sql = "SELECT * FROM mail_backup"; } - + $result = $app->db->queryAllRecords($sql, true, $params); return $result; } - + // 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.'); return false; } - + //*Set variables $backup_record = $app->db->queryOneRecord("SELECT * FROM `mail_backup` WHERE `backup_id`=?", $primary_id); $server_id = $backup_record['server_id']; - + //*Set default action state $action_state = "pending"; $tstamp = time(); - + //* Basic validation of variables if ($server_id <= 0) { throw new SoapFault('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"); 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"); return false; } - + //* Save the record if ($app->db->query("INSERT INTO `sys_remoteaction` SET `server_id` = ?, `tstamp` = ?, `action_type` = ?, `action_param` = ?, `action_state` = ?", $server_id, $tstamp, $action_type, $primary_id, $action_state)) { return true; @@ -666,7 +666,55 @@ class remoting_mail extends remoting { $affected_rows = $this->deleteQuery('../mail/form/mail_relay_recipient.tform.php', $primary_id); return $affected_rows; } - + + //* add relay domain + public function mail_relay_domain_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'mail_relay_add')) + { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/mail_relay_domain.tform.php', $client_id, $params); + return $affected_rows; + } + + public function mail_relay_domain_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'mail_relay_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_relay_domain.tform.php', $primary_id); + return $affected_rows; + } + + public function mail_relay_domain_get($session_id, $primary_id) + { + 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.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_relay_domain.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + public function mail_relay_domain_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'mail_relay_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_relay_domain.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + //* Get spamfilter whitelist details public function mail_spamfilter_whitelist_get($session_id, $primary_id) { @@ -1117,12 +1165,12 @@ class remoting_mail extends remoting { { global $app; $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.'); return false; } - + return $app->quota_lib->get_mailquota_data($client_id, false); } diff --git a/interface/web/mail/lib/remote.conf.php b/interface/web/mail/lib/remote.conf.php index 3060a8b4cc7be87c3e15f75f015822eac8bec2a4..38f57fcf19b715a94b7f6b89493118f2b142150f 100644 --- a/interface/web/mail/lib/remote.conf.php +++ b/interface/web/mail/lib/remote.conf.php @@ -9,6 +9,7 @@ $function_list['mail_forward_get,mail_forward_add,mail_forward_update,mail_forwa $function_list['mail_catchall_get,mail_catchall_add,mail_catchall_update,mail_catchall_delete'] = 'Mail catchall functions'; $function_list['mail_transport_get,mail_transport_add,mail_transport_update,mail_transport_delete'] = 'Mail transport functions'; $function_list['mail_relay_get,mail_relay_add,mail_relay_update,mail_relay_delete'] = 'Mail relay functions'; +$function_list['mail_relay_domain_add,mail_relay_domain_delete,mail_relay_domain_get,mail_relay_domain_update'] = 'Mail relay domain functions'; $function_list['mail_whitelist_get,mail_whitelist_add,mail_whitelist_update,mail_whitelist_delete'] = 'Mail whitelist functions'; $function_list['mail_blacklist_get,mail_blacklist_add,mail_blacklist_update,mail_blacklist_delete'] = 'Mail blacklist functions'; $function_list['mail_spamfilter_user_get,mail_spamfilter_user_add,mail_spamfilter_user_update,mail_spamfilter_user_delete'] = 'Mail spamfilter user functions'; diff --git a/remoting_client/API-docs/mail_relay_domain_add.html b/remoting_client/API-docs/mail_relay_domain_add.html new file mode 100644 index 0000000000000000000000000000000000000000..cb2beb5ec6359f1fe8c7af8405e4ea84f6feda1a --- /dev/null +++ b/remoting_client/API-docs/mail_relay_domain_add.html @@ -0,0 +1,32 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

mail_relay_domain_add($session_id, $client_id, $params);

+
+

Description:

+

Adds a new relay domain.


+

Input Variables:

+

$session_id, $client_id, $params

+

Parameters (in $params):

+

server_id  (int(11))

+

source  (varchar(255))

+

active  (enum('n','y'))

+

access  (varchar(255))

+

Output:

+

Returns the ID of the newly added record

+ +
+ + diff --git a/remoting_client/API-docs/mail_relay_domain_delete.html b/remoting_client/API-docs/mail_relay_domain_delete.html new file mode 100644 index 0000000000000000000000000000000000000000..c2af410d904c03ed7977c2743d58e7319c1df612 --- /dev/null +++ b/remoting_client/API-docs/mail_relay_domain_delete.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

mail_domain_delete($session_id, $primary_id);

+
+

Description:

+

Deletes a mail domain.


+

Input Variables:

+

$session_id, $primary_id

+

Parameters (in $params):

+

None

+

Output:

+

Returns the number of deleted records.

+ +
+ + diff --git a/remoting_client/API-docs/mail_relay_domain_get.html b/remoting_client/API-docs/mail_relay_domain_get.html new file mode 100644 index 0000000000000000000000000000000000000000..e9e03d80d6b9e4683bae9dfd7d5ed59f5f2f0f34 --- /dev/null +++ b/remoting_client/API-docs/mail_relay_domain_get.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

mail_relay_domain_get($session_id, $primary_id);

+
+

Description:

+

Retrieves information about a relay domain.


+

Input Variables:

+

$session_id, $primary_id

+

Parameters (in $params):

+

None

+

Output:

+

Returns all fields and values of the chosen relay domain.

+ +
+ + diff --git a/remoting_client/API-docs/mail_relay_domain_update.html b/remoting_client/API-docs/mail_relay_domain_update.html new file mode 100644 index 0000000000000000000000000000000000000000..d755f5781dbb43cfa31f4b963fba3b4e045b2e1a --- /dev/null +++ b/remoting_client/API-docs/mail_relay_domain_update.html @@ -0,0 +1,32 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

mail_relay_domain_update($session_id, $client_id, $primary_id, $params);

+
+Description: +

Updates a relay domain.


+Input Variables: +

$session_id, $client_id, $primary_id, $params

+Parameters (in $params): +

server_id  (int(11))

+

source  (varchar(255))

+

active  (enum('n','y'))

+

access  (varchar(255))

+Output: +

Returns the number of affected rows.

+ +
+ + diff --git a/remoting_client/examples/mail_relay_domain_add.php b/remoting_client/examples/mail_relay_domain_add.php new file mode 100644 index 0000000000000000000000000000000000000000..06f82b0e007fb8a601a9c8e30e85c1150a1b1c62 --- /dev/null +++ b/remoting_client/examples/mail_relay_domain_add.php @@ -0,0 +1,40 @@ + $soap_location, + 'uri' => $soap_uri, + 'trace' => 1, + 'exceptions' => 1)); + + +try { + if($session_id = $client->login($username, $password)) { + echo 'Logged successfull. Session ID:'.$session_id.'
'; + } + + //* Set the function parameters. + $client_id = 1; + $params = array( + 'server_id' => 1, + 'domain' => 'test.tld', + 'active' => 'y', + 'access' => 'OK' + ); + + $relay_domain_id = $client->mail_relay_domain_add($session_id, $client_id, $params); + + echo "Relay domain ID: ".$relay_domain_id."
"; + + if($client->logout($session_id)) { + echo 'Logged out.
'; + } + + +} catch (SoapFault $e) { + echo $client->__getLastResponse(); + die('SOAP Error: '.$e->getMessage()); +} + +?> diff --git a/remoting_client/examples/mail_relay_domain_delete.php b/remoting_client/examples/mail_relay_domain_delete.php new file mode 100644 index 0000000000000000000000000000000000000000..60dd49c4afcc7a7b77efd0c74079c91a8a1cee69 --- /dev/null +++ b/remoting_client/examples/mail_relay_domain_delete.php @@ -0,0 +1,34 @@ + $soap_location, + 'uri' => $soap_uri, + 'trace' => 1, + 'exceptions' => 1)); + + +try { + if($session_id = $client->login($username, $password)) { + echo 'Logged successfull. Session ID:'.$session_id.'
'; + } + + //* Set the function parameters. + $mail_relay_domain_id = 3; + + $affected_rows = $client->mail_relay_domain_delete($session_id, $mail_relay_domain_id); + + echo "Number of records that have been deleted: ".$affected_rows."
"; + + if($client->logout($session_id)) { + echo 'Logged out.
'; + } + + +} catch (SoapFault $e) { + echo $client->__getLastResponse(); + die('SOAP Error: '.$e->getMessage()); +} + +?> diff --git a/remoting_client/examples/mail_relay_domain_get.php b/remoting_client/examples/mail_relay_domain_get.php new file mode 100644 index 0000000000000000000000000000000000000000..509a1993ed593ff502b41b9ae6cbb32e3eda6d82 --- /dev/null +++ b/remoting_client/examples/mail_relay_domain_get.php @@ -0,0 +1,34 @@ + $soap_location, + 'uri' => $soap_uri, + 'trace' => 1, + 'exceptions' => 1)); + + +try { + if($session_id = $client->login($username, $password)) { + echo 'Logged successfull. Session ID:'.$session_id.'
'; + } + + //* Set the function parameters. + $relay_domain_id = 1; + + // Lookup by primary key, gets back a single record. + $relay_domain = $client->mail_relay_domain_get($session_id, $relay_domain_id); + print_r($relay_domain); + + if($client->logout($session_id)) { + echo 'Logged out.
'; + } + + +} catch (SoapFault $e) { + echo $client->__getLastResponse(); + die('SOAP Error: '.$e->getMessage()); +} + +?> diff --git a/remoting_client/examples/mail_relay_domain_update.php b/remoting_client/examples/mail_relay_domain_update.php new file mode 100644 index 0000000000000000000000000000000000000000..7c42946474e2e580426b4039f15acd05409366d4 --- /dev/null +++ b/remoting_client/examples/mail_relay_domain_update.php @@ -0,0 +1,41 @@ + $soap_location, + 'uri' => $soap_uri, + 'trace' => 1, + 'exceptions' => 1)); + + +try { + if($session_id = $client->login($username, $password)) { + echo 'Logged successfull. Session ID:'.$session_id.'
'; + } + + //* Set the function parameters. + $client_id = 1; + $primary_id = 1; + $params = array( + 'server_id' => 1, + 'domain' => 'test.tld', + 'active' => 'y', + 'access' => 'OK' + ); + + $affected_rows = $client->mail_relay_domain_update($session_id, $client_id, $primary_id, $params); + + echo "Affected Rows: ".$affected_rows."
"; + + if($client->logout($session_id)) { + echo 'Logged out.
'; + } + + +} catch (SoapFault $e) { + echo $client->__getLastResponse(); + die('SOAP Error: '.$e->getMessage()); +} + +?>