From f7ec00b2f8ba3efc5bdeacef9c813f8a826ae3be Mon Sep 17 00:00:00 2001
From: Patrick Anders <p.anders@timmehosting.de>
Date: Wed, 10 Dec 2014 08:44:26 -0500
Subject: [PATCH] add Spdy option - http://en.wikipedia.org/wiki/SPDY
---
interface/web/mail/mail_user_edit.php | 42 +++++++++++++++++++++++++++++++++++++-----
1 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php
index 8166b58..ddc0ceb 100644
--- a/interface/web/mail/mail_user_edit.php
+++ b/interface/web/mail/mail_user_edit.php
@@ -153,7 +153,7 @@
if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
// Get the limits of the client
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
- $client = $app->db->queryOneRecord("SELECT limit_mailbox, limit_mailquota FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+ $client = $app->db->queryOneRecord("SELECT limit_mailbox, limit_mailquota, parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
// Check if the user may add another mailbox.
@@ -179,7 +179,28 @@
unset($tmp);
unset($tmp_quota);
}
-
+
+ if($client['parent_client_id'] > 0) {
+ // Get the limits of the reseller
+ $reseller = $app->db->queryOneRecord("SELECT limit_mailquota, limit_maildomain FROM client WHERE client_id = ".$client['parent_client_id']);
+
+ //* Check the website quota of the client
+ if(isset($_POST["quota"]) && $reseller["limit_mailquota"] >= 0 && $app->functions->intval($this->dataRecord["quota"]) * 1024 * 1024 != $this->oldDataRecord['quota']) {
+ $tmp = $app->db->queryOneRecord("SELECT sum(quota) as mailquota FROM mail_user, sys_group, client WHERE mail_user.sys_groupid=sys_group.groupid AND sys_group.client_id=client.client_id AND ".$client['parent_client_id']." IN (client.parent_client_id, client.client_id) AND mailuser_id != ".$app->functions->intval($this->id));
+
+ $mailquota = $tmp["mailquota"] / 1024 / 1024;
+ $new_mailbox_quota = $app->functions->intval($this->dataRecord["quota"]);
+ if(($mailquota + $new_mailbox_quota > $reseller["limit_mailquota"]) || ($new_mailbox_quota == 0 && $reseller["limit_mailquota"] != -1)) {
+ $max_free_quota = $reseller["limit_mailquota"] - $mailquota;
+ if($max_free_quota < 0) $max_free_quota = 0;
+ $app->tform->errorMessage .= $app->tform->lng("limit_mailquota_txt").": ".$max_free_quota."<br>";
+ // Set the quota field to the max free space
+ $this->dataRecord["quota"] = $max_free_quota;
+ }
+ unset($tmp);
+ unset($tmp_quota);
+ }
+ }
} // end if user is not admin
@@ -204,9 +225,11 @@
$maildir = str_replace("[localpart]", strtolower($_POST["email_local_part"]), $maildir);
$this->dataRecord["maildir"] = $maildir;
$this->dataRecord["homedir"] = $mail_config["homedir_path"];
- $this->dataRecord["uid"] = $mail_config["mailuser_uid"];
- $this->dataRecord["gid"] = $mail_config["mailuser_gid"];
-
+
+ // Will be overwritten by mail_plugin
+ $this->dataRecord['uid'] = -1;
+ $this->dataRecord['gid'] = -1;
+
//* Check if there is no alias or forward with this address
$tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE active = 'y' AND source = '".$app->db->quote($this->dataRecord["email"])."'");
if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_alias_or_forward_txt")."<br>";
@@ -320,6 +343,15 @@
} // end if email addess changed
+ //* Change backup options when user mail backup options have been changed
+ if(isset($this->dataRecord['backup_interval']) && ($this->dataRecord['backup_interval'] != $this->oldDataRecord['backup_interval'] || $this->dataRecord['backup_copies'] != $this->oldDataRecord['backup_copies'])) {
+ $backup_interval = $app->db->quote($this->dataRecord['backup_interval']);
+ $backup_copies = $app->functions->intval($this->dataRecord['backup_copies']);
+ $app->db->datalogUpdate('mail_user', "backup_interval = '$backup_interval', backup_copies = '$backup_copies'", 'mailuser_id', $rec['mailuser_id']);
+ unset($backup_copies);
+ unset($backup_interval);
+ } // end if backup options changed
+
}
}
--
Gitblit v1.9.1