From e1358932d5f81e72b50b8a1cf22f4b4d1f0cff5f Mon Sep 17 00:00:00 2001
From: jmontoya <jmontoya@ispconfig3>
Date: Fri, 06 Aug 2010 05:59:56 -0400
Subject: [PATCH] Adding the remoting::mail_domain_get_by_domain function
---
interface/lib/classes/remoting.inc.php | 52 ++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 44 insertions(+), 8 deletions(-)
diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index 4bdccb8..9cd0510 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -2237,6 +2237,22 @@
}
}
+ 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 @@
/**
* 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
@@ -2325,11 +2339,33 @@
}
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;
--
Gitblit v1.9.1