Commit e1358932 authored by jmontoya's avatar jmontoya

Adding the remoting::mail_domain_get_by_domain function

parent e2b8a5b3
......@@ -2237,6 +2237,22 @@ class remoting {
}
}
public function mail_domain_get_by_domain($session_id, $domain) {
global $app;
if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (!empty($domain_id)) {
$domain = $app->db->quote($domain);
$sql = "SELECT * FROM mail_domain WHERE domain = $domain";
$result = $app->db->queryAllRecords($sql);
return $result;
}
return false;
}
/**
* Get a list of functions
......@@ -2289,25 +2305,23 @@ class remoting {
/**
* Get all DNS zone by user
*@author Julio Montoya <gugli100@gmail.com> BeezNest 2010
*/
/*
I will update this function
*/
public function dns_zone_get_by_user($session_id, $client_id, $server_id) {
global $app;
if(!$this->checkPerm($session_id, 'dns_zone_get')) {
//$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
//return false;
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (!empty($client_id) && !empty($server_id)) {
$server_id = intval($server_id);
$client_id = intval($client_id);
$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";
$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";
$result = $app->db->queryAllRecords($sql);
return $result;
}
return false;
}
*/
/**
* Changes DNS zone status
......@@ -2323,13 +2337,35 @@ class remoting {
$this->server->fault('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 dns_soa SET active = '$status' WHERE id = ".intval($primary_id);
$app->db->query($sql);
$result = $app->db->affectedRows();
return $result;
} else {
$this->server->fault('status_undefined', 'The status is not available');
return false;
}
}
public function mail_domain_set_status($session_id, $primary_id, $status) {
global $app;
if(!$this->checkPerm($session_id, 'mail_domain_set_status')) {
$this->server->fault('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 dns_soa SET active = '$status' WHERE id = ".intval($primary_id);
$sql = "UPDATE mail_domain SET active = '$status' WHERE id = ".intval($primary_id);
$app->db->query($sql);
$result = $app->db->affectedRows();
return $result;
......
......@@ -34,7 +34,7 @@
*/
$function_list = array();
$function_list['mail_domain_get,mail_domain_add,mail_domain_update,mail_domain_delete'] = 'Mail domain functions';
$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';
$function_list['mail_user_get,mail_user_add,mail_user_update,mail_user_delete'] = 'Mail user functions';
$function_list['mail_alias_get,mail_alias_add,mail_alias_update,mail_alias_delete'] = 'Mail alias functions';
$function_list['mail_forward_get,mail_forward_add,mail_forward_update,mail_forward_delete'] = 'Mail forward functions';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment