From 3fc28c0142bf8ab4e2cfae44931e2a51aadc4d51 Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Mon, 25 Feb 2013 13:51:37 -0500
Subject: [PATCH] - Added: remoting queries with a lot of results (e.g. email addresses or alias domains or dns rr) lead to non-functioning soap requests - added '#OFFSET#' AND '#LIMIT#' handling to the query - added automatic 'WHERE 1' if an empty array was given as query example: $result = $api->sites_web_domain_get('type' => 'vhost', '#OFFSET#' => 25, '#LIMIT#' => 50); to get the websites 26 to 75
---
interface/lib/classes/remoting.inc.php | 34 +++++++++++++++++++++++++++-------
1 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index 1bcc1c2..ed7c3ed 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -481,11 +481,21 @@
//* aliasy email
public function mail_alias_add($session_id, $client_id, $params)
{
+ global $app;
+
if (!$this->checkPerm($session_id, 'mail_alias_add'))
{
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
+
+ //* Check if there is no active mailbox with this address
+ $tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = '".$app->db->quote($params["source"])."'");
+ if($tmp['number'] > 0) {
+ $this->server->fault('duplicate','There is already a mailbox with this email address.');
+ }
+ unset($tmp);
+
$affected_rows = $this->insertQuery('../mail/form/mail_alias.tform.php', $client_id, $params);
return $affected_rows;
}
@@ -493,13 +503,23 @@
public function mail_alias_update($session_id, $client_id, $primary_id, $params)
{
- if (!$this->checkPerm($session_id, 'mail_alias_update'))
- {
- $this->server->fault('permission_denied','You do not have the permissions to access this function.');
- return false;
- }
- $affected_rows = $this->updateQuery('../mail/form/mail_alias.tform.php', $client_id, $primary_id, $params);
- return $affected_rows;
+ global $app;
+
+ if (!$this->checkPerm($session_id, 'mail_alias_update'))
+ {
+ $this->server->fault('permission_denied','You do not have the permissions to access this function.');
+ return false;
+ }
+
+ //* Check if there is no active mailbox with this address
+ $tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = '".$app->db->quote($params["source"])."'");
+ if($tmp['number'] > 0) {
+ $this->server->fault('duplicate','There is already a mailbox with this email address.');
+ }
+ unset($tmp);
+
+ $affected_rows = $this->updateQuery('../mail/form/mail_alias.tform.php', $client_id, $primary_id, $params);
+ return $affected_rows;
}
public function mail_alias_delete($session_id, $primary_id)
--
Gitblit v1.9.1