diff --git a/interface/web/mail/lib/lang/en_mail_alias.lng b/interface/web/mail/lib/lang/en_mail_alias.lng
index 4023eb61c93b7dd08a09081b825a2a0a1c3ea29e..5a803daf0a427ecd9892359ae32c4c077c5464c7 100644
--- a/interface/web/mail/lib/lang/en_mail_alias.lng
+++ b/interface/web/mail/lib/lang/en_mail_alias.lng
@@ -8,4 +8,5 @@ $wb["email_error_isemail"] = 'Email address is invalid.';
$wb["email_error_unique"] = 'Duplicate Emailaddress.';
$wb["no_domain_perm"] = "You have no permission for this domain.";
$wb["destination_error_isemail"] = 'Destination Emailaddress is invalid.';
+$wb["limit_mailalias_txt"] = 'The max. number of email aliases for your account is reached.';
?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_blacklist.lng b/interface/web/mail/lib/lang/en_mail_blacklist.lng
index b967c3e30e69269a3728ed280efc09731be8cc93..c5c1467f4665bc0a194049ba2d0d58db05fbee92 100644
--- a/interface/web/mail/lib/lang/en_mail_blacklist.lng
+++ b/interface/web/mail/lib/lang/en_mail_blacklist.lng
@@ -7,4 +7,5 @@ $wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["source_error_notempty"] = 'Address is empty.';
$wb["type_txt"] = 'Type';
+$wb["limit_mailfilter_txt"] = 'The max. number of email filters for your account is reached.';
?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_domain.lng b/interface/web/mail/lib/lang/en_mail_domain.lng
index c8e79c1cc96e8abe893b75509ed0cf3d9c1a986b..49f823604cb6a528040de0c652bee20fd0b29e16 100644
--- a/interface/web/mail/lib/lang/en_mail_domain.lng
+++ b/interface/web/mail/lib/lang/en_mail_domain.lng
@@ -9,5 +9,6 @@ $wb["domain_error_empty"] = 'Domain is empty.';
$wb["domain_error_unique"] = 'Duplicate Domain.';
$wb["domain_error_regex"] = 'Invalid domain name.';
$wb["client_txt"] = 'Client';
+$wb["limit_maildomain_txt"] = 'The max. number of email domains for your account is reached.';
?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_domain_catchall.lng b/interface/web/mail/lib/lang/en_mail_domain_catchall.lng
index f93073b7026ef0c4a557b252f5d190b597321d29..d758301a20534c4dae828bbbe9d56d33cc9ec0fa 100644
--- a/interface/web/mail/lib/lang/en_mail_domain_catchall.lng
+++ b/interface/web/mail/lib/lang/en_mail_domain_catchall.lng
@@ -7,4 +7,5 @@ $wb["btn_cancel_txt"] = 'Cancel';
$wb["domain_error_unique"] = "There is already a Catchall record for this domain.";
$wb["no_domain_perm"] = "You have no permission for this domain.";
$wb["domain_error_regex"] = 'Invalid domain name od domain contains invalid characters.';
+$wb["limit_mailcatchall_txt"] = 'The max. number of email catchall accounts for your account is reached.';
?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_forward.lng b/interface/web/mail/lib/lang/en_mail_forward.lng
index 4f927b35918e8110eb071770a7139841a6f3edf2..e387f1bb31fd3905aa63ad129068439117a54e5b 100644
--- a/interface/web/mail/lib/lang/en_mail_forward.lng
+++ b/interface/web/mail/lib/lang/en_mail_forward.lng
@@ -1,7 +1,8 @@
-
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_transport.lng b/interface/web/mail/lib/lang/en_mail_transport.lng
index e454c00f4d559238cbae7dd88e26a1fd173cb396..530d1e20bf9dcd1de3eeb7da0c8e65266268aa93 100644
--- a/interface/web/mail/lib/lang/en_mail_transport.lng
+++ b/interface/web/mail/lib/lang/en_mail_transport.lng
@@ -6,4 +6,5 @@ $wb["sort_order_txt"] = 'Sort by';
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
+$wb["limit_mailrouting_txt"] = 'The max. number of routes for your account is reached.';
?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_whitelist.lng b/interface/web/mail/lib/lang/en_mail_whitelist.lng
index 4cf2fb59dbfb534659e5bbffc9badb44b1b9546a..1dbe3614978a99c9a604d839474af38680b1b4d7 100644
--- a/interface/web/mail/lib/lang/en_mail_whitelist.lng
+++ b/interface/web/mail/lib/lang/en_mail_whitelist.lng
@@ -7,4 +7,5 @@ $wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["source_error_notempty"] = 'Address is empty.';
$wb["type_txt"] = 'Type';
+$wb["limit_mailfilter_txt"] = 'The max. number of email filters for your account is reached.';
?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_alias_edit.php b/interface/web/mail/mail_alias_edit.php
index a7690621478b751d4dfb488c0436e21e1a039125..01fa4e0ff6bb81c53fc49325e7d2f8e248b08cf7 100644
--- a/interface/web/mail/mail_alias_edit.php
+++ b/interface/web/mail/mail_alias_edit.php
@@ -53,6 +53,28 @@ $app->load('tform_actions');
class page_action extends tform_actions {
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailalias 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.
+ if($client["limit_mailalias"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE sys_groupid = $client_group_id and type = 'alias'");
+ if($tmp["number"] >= $client["limit_mailalias"]) {
+ $app->error($app->tform->wordbook["limit_mailalias_txt"]);
+ }
+ }
+ }
+
+ parent::onShowNew();
+ }
+
function onShowEnd() {
global $app, $conf;
@@ -81,6 +103,23 @@ class page_action extends tform_actions {
// Check if Domain belongs to user
$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
+
+ // Check the client limits, if user is not the admin
+ if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailalias 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.
+ if($this->id == 0 && $client["limit_mailalias"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE sys_groupid = $client_group_id AND type = 'alias'");
+ if($tmp["number"] >= $client["limit_mailalias"]) {
+ $app->tform->errorMessage .= $app->tform->wordbook["limit_mailalias_txt"]." ";
+ }
+ unset($tmp);
+ }
+ } // end if user is not admin
+
// compose the email field
$this->dataRecord["source"] = $_POST["email_local_part"]."@".$_POST["email_domain"];
diff --git a/interface/web/mail/mail_blacklist_edit.php b/interface/web/mail/mail_blacklist_edit.php
index 5c741982418149bb95cf435d33b2f23275594b86..31dded5623e4b7f65ccdb53bf405339df3731548 100644
--- a/interface/web/mail/mail_blacklist_edit.php
+++ b/interface/web/mail/mail_blacklist_edit.php
@@ -53,6 +53,50 @@ $app->load('tform_actions');
class page_action extends tform_actions {
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailfilter 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.
+ if($client["limit_mailfilter"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(access_id) as number FROM mail_access WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_mailfilter"]) {
+ $app->error($app->tform->wordbook["limit_mailfilter_txt"]);
+ }
+ }
+ }
+
+ parent::onShowNew();
+ }
+
+ function onSubmit() {
+ global $app, $conf;
+
+ // Check the client limits, if user is not the admin
+ if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailfilter 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.
+ if($this->id == 0 && $client["limit_mailfilter"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(access_id) as number FROM mail_access WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_mailfilter"]) {
+ $app->tform->errorMessage .= $app->tform->wordbook["limit_mailfilter_txt"]." ";
+ }
+ unset($tmp);
+ }
+ } // end if user is not admin
+
+ parent::onSubmit();
+ }
+
}
$app->tform_actions = new page_action;
diff --git a/interface/web/mail/mail_domain_catchall_edit.php b/interface/web/mail/mail_domain_catchall_edit.php
index a40c5dcbfec6612950d30cf61355813a8a0c5247..5cded1ae703c612e4f971955787c4bd99aac2238 100644
--- a/interface/web/mail/mail_domain_catchall_edit.php
+++ b/interface/web/mail/mail_domain_catchall_edit.php
@@ -53,6 +53,28 @@ $app->load('tform_actions');
class page_action extends tform_actions {
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailcatchall 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.
+ if($client["limit_mailforward"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE sys_groupid = $client_group_id and type = 'catchall'");
+ if($tmp["number"] >= $client["limit_mailcatchall"]) {
+ $app->error($app->tform->wordbook["limit_mailcatchall_txt"]);
+ }
+ }
+ }
+
+ parent::onShowNew();
+ }
+
function onShowEnd() {
global $app, $conf;
@@ -81,6 +103,22 @@ class page_action extends tform_actions {
// Check if Domain belongs to user
$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
+
+ // Check the client limits, if user is not the admin
+ if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailcatchall 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.
+ if($this->id == 0 && $client["limit_mailcatchall"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE sys_groupid = $client_group_id AND type = 'catchall'");
+ if($tmp["number"] >= $client["limit_mailcatchall"]) {
+ $app->tform->errorMessage .= $app->tform->wordbook["limit_mailcatchall_txt"]." ";
+ }
+ unset($tmp);
+ }
+ } // end if user is not admin
// compose the email field
$this->dataRecord["source"] = "@".$_POST["email_domain"];
diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php
index f2709b593da7fc9a8ad4a6f2241fa60a286998f0..74481d5d58c1f87dec3f88568985f3748d97fdbb 100644
--- a/interface/web/mail/mail_domain_edit.php
+++ b/interface/web/mail/mail_domain_edit.php
@@ -52,7 +52,29 @@ $app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
-
+
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_maildomain 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 maildomain.
+ if($client["limit_maildomain"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM mail_domain WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_maildomain"]) {
+ $app->error($app->tform->wordbook["limit_maildomain_txt"]);
+ }
+ }
+ }
+
+ parent::onShowNew();
+ }
+
function onShowEnd() {
global $app, $conf;
@@ -74,13 +96,43 @@ class page_action extends tform_actions {
}
function onSubmit() {
- if($_SESSION["s"]["user"]["typ"] != 'admin') unset($this->dataRecord["client_group_id"]);
+ global $app, $conf;
+ if($_SESSION["s"]["user"]["typ"] != 'admin') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_maildomain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+ // When the record is updated
+ if($this->id > 0) {
+ // restore the server ID if the user is not admin and record is edited
+ $tmp = $app->db->queryOneRecord("SELECT server_id FROM mail_domain WHERE domain_id = ".intval($this->id));
+ $this->dataRecord["server_id"] = $tmp["server_id"];
+ unset($tmp);
+ // When the record is inserted
+ } else {
+ // set the server ID to the default mailserver of the client
+ $this->dataRecord["server_id"] = $client["default_mailserver"];
+
+ // Check if the user may add another mail_domain
+ if($client["limit_maildomain"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM mail_domain WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_maildomain"]) {
+ $app->error($app->tform->wordbook["limit_maildomain_txt"]);
+ }
+ }
+ }
+
+ // Clients may not set the client_group_id, so we unset them if user is not a admin
+ unset($this->dataRecord["client_group_id"]);
+ }
parent::onSubmit();
}
function onAfterInsert() {
global $app, $conf;
+ // make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
$client_group_id = intval($this->dataRecord["client_group_id"]);
$app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id WHERE domain_id = ".$this->id);
diff --git a/interface/web/mail/mail_forward_edit.php b/interface/web/mail/mail_forward_edit.php
index 5d6b8a7522ff3d73343407634de435eb61083315..9a7b2e9a7c9564269340ce0d053ed1b7ea8f1e05 100644
--- a/interface/web/mail/mail_forward_edit.php
+++ b/interface/web/mail/mail_forward_edit.php
@@ -53,6 +53,28 @@ $app->load('tform_actions');
class page_action extends tform_actions {
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailforward 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.
+ if($client["limit_mailforward"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE sys_groupid = $client_group_id and type = 'forward'");
+ if($tmp["number"] >= $client["limit_mailforward"]) {
+ $app->error($app->tform->wordbook["limit_mailforward_txt"]);
+ }
+ }
+ }
+
+ parent::onShowNew();
+ }
+
function onShowEnd() {
global $app, $conf;
@@ -79,6 +101,22 @@ class page_action extends tform_actions {
// Check if Domain belongs to user
$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
+
+ // Check the client limits, if user is not the admin
+ if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailforward 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.
+ if($this->id == 0 && $client["limit_mailforward"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE sys_groupid = $client_group_id AND type = 'forward'");
+ if($tmp["number"] >= $client["limit_mailforward"]) {
+ $app->tform->errorMessage .= $app->tform->wordbook["limit_mailforward_txt"]." ";
+ }
+ unset($tmp);
+ }
+ } // end if user is not admin
// compose the email field
$this->dataRecord["source"] = $_POST["email_local_part"]."@".$_POST["email_domain"];
diff --git a/interface/web/mail/mail_transport_edit.php b/interface/web/mail/mail_transport_edit.php
index 8bf03f3aa095cfef52bc7732531e6eaca65c8206..161321d31edc9c0cf383c5bbd8dfe6d0e79ae236 100644
--- a/interface/web/mail/mail_transport_edit.php
+++ b/interface/web/mail/mail_transport_edit.php
@@ -47,10 +47,60 @@ if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"]))
exit;
}
+
// Loading classes
$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailrouting 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.
+ if($client["limit_mailrouting"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(transport_id) as number FROM mail_transport WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_mailrouting"]) {
+ $app->error($app->tform->wordbook["limit_mailrouting_txt"]);
+ }
+ }
+ }
+
+ parent::onShowNew();
+ }
+
+ function onSubmit() {
+ global $app, $conf;
+
+ // Check the client limits, if user is not the admin
+ if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailrouting 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.
+ if($this->id == 0 && $client["limit_mailrouting"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(transport_id) as number FROM mail_transport WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_mailrouting"]) {
+ $app->tform->errorMessage .= $app->tform->wordbook["limit_mailrouting_txt"]." ";
+ }
+ unset($tmp);
+ }
+ } // end if user is not admin
+
+ parent::onSubmit();
+ }
+
+}
-// let tform_actions handle the page
-$app->tform_actions->onLoad();
+$page = new page_action;
+$page->onLoad();
?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php
index 2427dc34f87b626d5b965601e93c20a62593f6dc..d611e23acc85712d3f3facd00d20e4dad72b9e0f 100644
--- a/interface/web/mail/mail_user_edit.php
+++ b/interface/web/mail/mail_user_edit.php
@@ -104,46 +104,47 @@ class page_action extends tform_actions {
function onSubmit() {
global $app, $conf;
- // Get the limits of the client
- $client_group_id = $_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");
-
// Check if Domain belongs to user
$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
- // if its an insert
- if($this->id == 0) {
-
- // check for password
- if($_POST["password"] == '') {
- $app->tform->errorMessage .= $app->tform->wordbook["error_no_pwd"]." ";
- }
+
+ // if its an insert, check that the password is not empty
+ if($this->id == 0 && $_POST["password"] == '') {
+ $app->tform->errorMessage .= $app->tform->wordbook["error_no_pwd"]." ";
+ }
+
+ // Ccheck the client limits, if user is not the admin
+ if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
+ // Get the limits of the client
+ $client_group_id = $_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");
+
// Check if the user may add another mailbox.
- if($client["limit_mailbox"] >= 0) {
+ if($this->id == 0 && $client["limit_mailbox"] >= 0) {
$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE sys_groupid = $client_group_id");
if($tmp["number"] >= $client["limit_mailbox"]) {
$app->tform->errorMessage .= $app->tform->wordbook["limit_mailbox_txt"]." ";
}
unset($tmp);
}
- } // end if insert
-
- // Check the quota and adjust
- if($client["limit_mailquota"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT sum(quota) as mailquota FROM mail_user WHERE mailuser_id != ".intval($this->id)." AND sys_groupid = $client_group_id");
- $mailquota = $tmp["mailquota"] / 1024;
- $new_mailbox_quota = intval($this->dataRecord["quota"]);
- if($mailquota + $new_mailbox_quota > $client["limit_mailquota"]) {
- $max_free_quota = $client["limit_mailquota"] - $mailquota;
- $app->tform->errorMessage .= $app->tform->wordbook["limit_mailquota_txt"].": ".$max_free_quota." ";
- // Set the quota field to the max free space
- $this->dataRecord["quota"] = $max_free_quota;
+
+ // Check the quota and adjust
+ if($client["limit_mailquota"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT sum(quota) as mailquota FROM mail_user WHERE mailuser_id != ".intval($this->id)." AND sys_groupid = $client_group_id");
+ $mailquota = $tmp["mailquota"] / 1024;
+ $new_mailbox_quota = intval($this->dataRecord["quota"]);
+ if($mailquota + $new_mailbox_quota > $client["limit_mailquota"]) {
+ $max_free_quota = $client["limit_mailquota"] - $mailquota;
+ $app->tform->errorMessage .= $app->tform->wordbook["limit_mailquota_txt"].": ".$max_free_quota." ";
+ // Set the quota field to the max free space
+ $this->dataRecord["quota"] = $max_free_quota;
+ }
+ unset($tmp);
+ unset($tmp_quota);
}
- unset($tmp);
- unset($tmp_quota);
- }
+ } // end if user is not admin
// compose the email field
diff --git a/interface/web/mail/mail_whitelist_edit.php b/interface/web/mail/mail_whitelist_edit.php
index 97ec9d44e3b50e5bf9142912daad1da4118d75d3..32518e8aa52c5ecfc7ff2ccf6a0d7c306f7278d3 100644
--- a/interface/web/mail/mail_whitelist_edit.php
+++ b/interface/web/mail/mail_whitelist_edit.php
@@ -52,6 +52,50 @@ $app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
+
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailfilter 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.
+ if($client["limit_mailfilter"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(access_id) as number FROM mail_access WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_mailfilter"]) {
+ $app->error($app->tform->wordbook["limit_mailfilter_txt"]);
+ }
+ }
+ }
+
+ parent::onShowNew();
+ }
+
+ function onSubmit() {
+ global $app, $conf;
+
+ // Check the client limits, if user is not the admin
+ if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_mailfilter 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.
+ if($this->id == 0 && $client["limit_mailfilter"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(access_id) as number FROM mail_access WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_mailfilter"]) {
+ $app->tform->errorMessage .= $app->tform->wordbook["limit_mailfilter_txt"]." ";
+ }
+ unset($tmp);
+ }
+ } // end if user is not admin
+
+ parent::onSubmit();
+ }
}
diff --git a/interface/web/mail/spamfilter_blacklist_edit.php b/interface/web/mail/spamfilter_blacklist_edit.php
index 9c7661aec7cc57a5f1a096925d99241a0dfa14b3..99c098fe53efb3127cb26c89e0167878387d341e 100644
--- a/interface/web/mail/spamfilter_blacklist_edit.php
+++ b/interface/web/mail/spamfilter_blacklist_edit.php
@@ -52,7 +52,49 @@ $app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_spamfilter_wblist 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.
+ if($client["limit_limit_spamfilter_wblist"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(wblist_id) as number FROM spamfilter_wblist WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_spamfilter_wblist"]) {
+ $app->error($app->tform->wordbook["limit_spamfilter_wblist_txt"]);
+ }
+ }
+ }
+
+ parent::onShowNew();
+ }
+ function onSubmit() {
+ global $app, $conf;
+
+ // Check the client limits, if user is not the admin
+ if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_spamfilter_wblist 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.
+ if($this->id == 0 && $client["limit_spamfilter_wblist"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(wblist_id) as number FROM spamfilter_wblist WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_spamfilter_wblist"]) {
+ $app->tform->errorMessage .= $app->tform->wordbook["limit_spamfilter_wblist_txt"]." ";
+ }
+ unset($tmp);
+ }
+ } // end if user is not admin
+
+ parent::onSubmit();
+ }
}
$app->tform_actions = new page_action;
diff --git a/interface/web/mail/spamfilter_policy_edit.php b/interface/web/mail/spamfilter_policy_edit.php
index 01324d2287278c72f262454731616f60f4f50c73..d5d52d5fc79d81d60893ca0a2625ace10284aaf0 100644
--- a/interface/web/mail/spamfilter_policy_edit.php
+++ b/interface/web/mail/spamfilter_policy_edit.php
@@ -52,7 +52,49 @@ $app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_spamfilter_policy 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.
+ if($client["limit_limit_spamfilter_policy"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM spamfilter_policy WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_spamfilter_policy"]) {
+ $app->error($app->tform->wordbook["limit_spamfilter_policy_txt"]);
+ }
+ }
+ }
+
+ parent::onShowNew();
+ }
+ function onSubmit() {
+ global $app, $conf;
+
+ // Check the client limits, if user is not the admin
+ if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_spamfilter_policy 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.
+ if($this->id == 0 && $client["limit_spamfilter_policy"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM spamfilter_policy WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_spamfilter_policy"]) {
+ $app->tform->errorMessage .= $app->tform->wordbook["limit_spamfilter_policy_txt"]." ";
+ }
+ unset($tmp);
+ }
+ } // end if user is not admin
+
+ parent::onSubmit();
+ }
}
$app->tform_actions = new page_action;
diff --git a/interface/web/mail/spamfilter_users_edit.php b/interface/web/mail/spamfilter_users_edit.php
index c53f37283bdc8b9bd308f8106bf56df03eed1671..77050b5de260f4dbd3aaa6d277fb73a905f5039d 100644
--- a/interface/web/mail/spamfilter_users_edit.php
+++ b/interface/web/mail/spamfilter_users_edit.php
@@ -52,7 +52,49 @@ $app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_spamfilter_user 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.
+ if($client["limit_limit_spamfilter_user"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM spamfilter_users WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_spamfilter_user"]) {
+ $app->error($app->tform->wordbook["limit_spamfilter_user_txt"]);
+ }
+ }
+ }
+
+ parent::onShowNew();
+ }
+ function onSubmit() {
+ global $app, $conf;
+
+ // Check the client limits, if user is not the admin
+ if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_spamfilter_user 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.
+ if($this->id == 0 && $client["limit_spamfilter_user"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM spamfilter_users WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_spamfilter_user"]) {
+ $app->tform->errorMessage .= $app->tform->wordbook["limit_spamfilter_user_txt"]." ";
+ }
+ unset($tmp);
+ }
+ } // end if user is not admin
+
+ parent::onSubmit();
+ }
}
$app->tform_actions = new page_action;
diff --git a/interface/web/mail/spamfilter_whitelist_edit.php b/interface/web/mail/spamfilter_whitelist_edit.php
index b8c8bfa02293878ba7bd840dc1bd9fdf1a1d698c..b1f249651f06431cc961d47c8de027a55679c7c6 100644
--- a/interface/web/mail/spamfilter_whitelist_edit.php
+++ b/interface/web/mail/spamfilter_whitelist_edit.php
@@ -52,7 +52,49 @@ $app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_spamfilter_wblist 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.
+ if($client["limit_limit_spamfilter_wblist"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(wblist_id) as number FROM spamfilter_wblist WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_spamfilter_wblist"]) {
+ $app->error($app->tform->wordbook["limit_spamfilter_wblist_txt"]);
+ }
+ }
+ }
+
+ parent::onShowNew();
+ }
+ function onSubmit() {
+ global $app, $conf;
+
+ // Check the client limits, if user is not the admin
+ if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_spamfilter_wblist 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.
+ if($this->id == 0 && $client["limit_spamfilter_wblist"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(wblist_id) as number FROM spamfilter_wblist WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_spamfilter_wblist"]) {
+ $app->tform->errorMessage .= $app->tform->wordbook["limit_spamfilter_wblist_txt"]." ";
+ }
+ unset($tmp);
+ }
+ } // end if user is not admin
+
+ parent::onSubmit();
+ }
}
$app->tform_actions = new page_action;
diff --git a/interface/web/mail/templates/mail_domain_list.htm b/interface/web/mail/templates/mail_domain_list.htm
index d734e10eb11e9e2c9fee76b30d71888719551394..b4c0b6e25d85c76ab4b4dd9955d0f984280c9ac9 100644
--- a/interface/web/mail/templates/mail_domain_list.htm
+++ b/interface/web/mail/templates/mail_domain_list.htm
@@ -18,7 +18,7 @@