Skip to content

Commit 54c57f3

Browse files
author
Demian
committed
add mail_relay_domain_add function to remote api. #6399
1 parent 39bf4b2 commit 54c57f3

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

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

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public function mail_user_add($session_id, $client_id, $params){
223223
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
224224
return false;
225225
}
226-
226+
227227
// Email addresses must always be lower case
228228
$params['email'] = strtolower($params['email']);
229229

@@ -331,17 +331,17 @@ public function mail_user_filter_delete($session_id, $primary_id)
331331
// $app->plugin->raiseEvent('mail:mail_user_filter:on_after_delete',$this);
332332
return $affected_rows;
333333
}
334-
334+
335335
// Mail backup list function by Dominik Müller, info@profi-webdesign.net
336336
public function mail_user_backup_list($session_id, $primary_id = null)
337337
{
338338
global $app;
339-
339+
340340
if(!$this->checkPerm($session_id, 'mail_user_backup')) {
341341
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
342342
return false;
343343
}
344-
344+
345345
$params = array();
346346
if ($site_id != null) {
347347
$params[] = $site_id;
@@ -350,47 +350,47 @@ public function mail_user_backup_list($session_id, $primary_id = null)
350350
else {
351351
$sql = "SELECT * FROM mail_backup";
352352
}
353-
353+
354354
$result = $app->db->queryAllRecords($sql, true, $params);
355355
return $result;
356356
}
357-
357+
358358
// Mail backup restore/download functions by Dominik Müller, info@profi-webdesign.net
359359
public function mail_user_backup($session_id, $primary_id, $action_type)
360360
{
361361
global $app;
362-
362+
363363
if(!$this->checkPerm($session_id, 'mail_user_backup')) {
364364
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
365365
return false;
366366
}
367-
367+
368368
//*Set variables
369369
$backup_record = $app->db->queryOneRecord("SELECT * FROM `mail_backup` WHERE `backup_id`=?", $primary_id);
370370
$server_id = $backup_record['server_id'];
371-
371+
372372
//*Set default action state
373373
$action_state = "pending";
374374
$tstamp = time();
375-
375+
376376
//* Basic validation of variables
377377
if ($server_id <= 0) {
378378
throw new SoapFault('invalid_backup_id', "Invalid or non existant backup_id $primary_id");
379379
return false;
380380
}
381-
381+
382382
if (/*$action_type != 'backup_download_mail' and*/ $action_type != 'backup_restore_mail' and $action_type != 'backup_delete_mail') {
383383
throw new SoapFault('invalid_action', "Invalid action_type $action_type");
384384
return false;
385385
}
386-
386+
387387
//* Validate instance
388388
$instance_record = $app->db->queryOneRecord("SELECT * FROM `sys_remoteaction` WHERE `action_param`=? and `action_type`=? and `action_state`='pending'", $primary_id, $action_type);
389389
if ($instance_record['action_id'] >= 1) {
390390
throw new SoapFault('duplicate_action', "There is already a pending $action_type action");
391391
return false;
392392
}
393-
393+
394394
//* Save the record
395395
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)) {
396396
return true;
@@ -666,7 +666,19 @@ public function mail_relay_recipient_delete($session_id, $primary_id)
666666
$affected_rows = $this->deleteQuery('../mail/form/mail_relay_recipient.tform.php', $primary_id);
667667
return $affected_rows;
668668
}
669-
669+
670+
//* add relay domain
671+
public function mail_relay_domain_add($session_id, $client_id, $params)
672+
{
673+
if(!$this->checkPerm($session_id, 'mail_relay_add'))
674+
{
675+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
676+
return false;
677+
}
678+
$affected_rows = $this->insertQuery('../mail/form/mail_relay_domain.tform.php', $client_id, $params);
679+
return $affected_rows;
680+
}
681+
670682
//* Get spamfilter whitelist details
671683
public function mail_spamfilter_whitelist_get($session_id, $primary_id)
672684
{
@@ -1117,12 +1129,12 @@ public function mailquota_get_by_user($session_id, $client_id)
11171129
{
11181130
global $app;
11191131
$app->uses('quota_lib');
1120-
1132+
11211133
if(!$this->checkPerm($session_id, 'mailquota_get_by_user')) {
11221134
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
11231135
return false;
11241136
}
1125-
1137+
11261138
return $app->quota_lib->get_mailquota_data($client_id, false);
11271139
}
11281140

interface/web/mail/lib/remote.conf.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
$function_list['mail_catchall_get,mail_catchall_add,mail_catchall_update,mail_catchall_delete'] = 'Mail catchall functions';
1010
$function_list['mail_transport_get,mail_transport_add,mail_transport_update,mail_transport_delete'] = 'Mail transport functions';
1111
$function_list['mail_relay_get,mail_relay_add,mail_relay_update,mail_relay_delete'] = 'Mail relay functions';
12+
$function_list['mail_relay_domain_add'] = 'Mail relay domain functions';
1213
$function_list['mail_whitelist_get,mail_whitelist_add,mail_whitelist_update,mail_whitelist_delete'] = 'Mail whitelist functions';
1314
$function_list['mail_blacklist_get,mail_blacklist_add,mail_blacklist_update,mail_blacklist_delete'] = 'Mail blacklist functions';
1415
$function_list['mail_spamfilter_user_get,mail_spamfilter_user_add,mail_spamfilter_user_update,mail_spamfilter_user_delete'] = 'Mail spamfilter user functions';

0 commit comments

Comments
 (0)