Skip to content

Commit e135893

Browse files
author
jmontoya
committed
Adding the remoting::mail_domain_get_by_domain function
1 parent e2b8a5b commit e135893

File tree

2 files changed

+45
-9
lines changed

2 files changed

+45
-9
lines changed

interface/lib/classes/remoting.inc.php

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,6 +2237,22 @@ public function client_change_password($session_id, $client_id, $new_password) {
22372237
}
22382238
}
22392239

2240+
public function mail_domain_get_by_domain($session_id, $domain) {
2241+
global $app;
2242+
if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) {
2243+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
2244+
return false;
2245+
}
2246+
if (!empty($domain_id)) {
2247+
$domain = $app->db->quote($domain);
2248+
$sql = "SELECT * FROM mail_domain WHERE domain = $domain";
2249+
$result = $app->db->queryAllRecords($sql);
2250+
return $result;
2251+
}
2252+
return false;
2253+
}
2254+
2255+
22402256

22412257
/**
22422258
* Get a list of functions
@@ -2289,25 +2305,23 @@ public function client_templates_get_all($session_id) {
22892305
/**
22902306
* Get all DNS zone by user
22912307
*@author Julio Montoya <gugli100@gmail.com> BeezNest 2010
2292-
*/
2293-
/*
2294-
I will update this function
2308+
*/
22952309
public function dns_zone_get_by_user($session_id, $client_id, $server_id) {
22962310
global $app;
22972311
if(!$this->checkPerm($session_id, 'dns_zone_get')) {
2298-
//$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
2299-
//return false;
2312+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
2313+
return false;
23002314
}
23012315
if (!empty($client_id) && !empty($server_id)) {
23022316
$server_id = intval($server_id);
23032317
$client_id = intval($client_id);
2304-
$sql = "SELECT id, origin FROM dns_soa d INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = '$client_id' AND server_id = $server_id";
2318+
$sql = "SELECT id, origin FROM dns_soa d INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id AND server_id = $server_id";
23052319
$result = $app->db->queryAllRecords($sql);
23062320
return $result;
23072321
}
23082322
return false;
23092323
}
2310-
*/
2324+
23112325

23122326
/**
23132327
* Changes DNS zone status
@@ -2323,13 +2337,35 @@ public function dns_zone_set_status($session_id, $primary_id, $status) {
23232337
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
23242338
return false;
23252339
}
2340+
if(in_array($status, array('active', 'inactive'))) {
2341+
if ($status == 'active') {
2342+
$status = 'Y';
2343+
} else {
2344+
$status = 'N';
2345+
}
2346+
$sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".intval($primary_id);
2347+
$app->db->query($sql);
2348+
$result = $app->db->affectedRows();
2349+
return $result;
2350+
} else {
2351+
$this->server->fault('status_undefined', 'The status is not available');
2352+
return false;
2353+
}
2354+
}
2355+
2356+
public function mail_domain_set_status($session_id, $primary_id, $status) {
2357+
global $app;
2358+
if(!$this->checkPerm($session_id, 'mail_domain_set_status')) {
2359+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
2360+
return false;
2361+
}
23262362
if(in_array($status, array('active', 'inactive'))) {
23272363
if ($status == 'active') {
23282364
$status = 'y';
23292365
} else {
23302366
$status = 'n';
23312367
}
2332-
$sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".intval($primary_id);
2368+
$sql = "UPDATE mail_domain SET active = '$status' WHERE id = ".intval($primary_id);
23332369
$app->db->query($sql);
23342370
$result = $app->db->affectedRows();
23352371
return $result;

interface/web/admin/form/remote_user.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*/
3535

3636
$function_list = array();
37-
$function_list['mail_domain_get,mail_domain_add,mail_domain_update,mail_domain_delete'] = 'Mail domain functions';
37+
$function_list['mail_domain_get,mail_domain_add,mail_domain_update,mail_domain_delete,mail_domain_set_status,mail_domain_get_by_domain'] = 'Mail domain functions';
3838
$function_list['mail_user_get,mail_user_add,mail_user_update,mail_user_delete'] = 'Mail user functions';
3939
$function_list['mail_alias_get,mail_alias_add,mail_alias_update,mail_alias_delete'] = 'Mail alias functions';
4040
$function_list['mail_forward_get,mail_forward_add,mail_forward_update,mail_forward_delete'] = 'Mail forward functions';

0 commit comments

Comments
 (0)