From 3cebc3a5fc5a6e76b80f712fc4f7a48c2c92d61e Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Fri, 10 Jul 2009 07:33:29 -0400
Subject: [PATCH] Fixed: FS#776 - Client's limits do not apply for it's own client Improved client and reseller limit checks
---
interface/web/mail/spamfilter_policy_edit.php | 16 -
interface/web/sites/web_aliasdomain_edit.php | 16 -
interface/lib/classes/tform.inc.php | 57 ++++++++
interface/web/mail/spamfilter_users_edit.php | 16 -
interface/web/mail/mail_domain_edit.php | 16 -
interface/web/mail/mail_user_edit.php | 16 -
interface/web/sites/web_domain_edit.php | 16 -
interface/web/sites/cron_edit.php | 16 -
interface/web/sites/database_edit.php | 16 -
interface/web/mail/mail_blacklist_edit.php | 16 -
interface/web/sites/ftp_user_edit.php | 16 -
interface/web/mail/mail_transport_edit.php | 16 -
interface/web/mail/mail_alias_edit.php | 16 -
interface/web/mail/spamfilter_whitelist_edit.php | 16 -
interface/web/dns/dns_wizard.php | 7 +
interface/web/mail/mail_forward_edit.php | 16 -
interface/web/sites/shell_user_edit.php | 16 -
interface/web/mail/mail_whitelist_edit.php | 16 -
interface/web/sites/web_subdomain_edit.php | 16 -
interface/web/mail/mail_get_edit.php | 16 -
interface/web/mail/spamfilter_blacklist_edit.php | 16 -
interface/lib/app.inc.php | 6
interface/web/dns/dns_soa_edit.php | 16 -
interface/web/mail/mail_domain_catchall_edit.php | 16 -
24 files changed, 174 insertions(+), 232 deletions(-)
diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php
index f534e25..e70922a 100644
--- a/interface/lib/app.inc.php
+++ b/interface/lib/app.inc.php
@@ -186,7 +186,11 @@
public function tpl_defaults()
{
$this->tpl->setVar('app_title', $this->_conf['app_title']);
- $this->tpl->setVar('app_version', $this->_conf['app_version']);
+ if(isset($_SESSION['s']['user'])) {
+ $this->tpl->setVar('app_version', $this->_conf['app_version']);
+ } else {
+ $this->tpl->setVar('app_version', '');
+ }
$this->tpl->setVar('app_link', $this->_conf['app_link']);
if(isset($this->_conf['app_logo']) && $this->_conf['app_logo'] != '' && @is_file($this->_conf['app_logo'])){
$this->tpl->setVar('app_logo', '<img src="'.$this->_conf['app_logo'].'">');
diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 33103a0..ec37de2 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -1148,6 +1148,63 @@
}
}
+
+ function checkClientLimit($limit_name,$sql_where = '') {
+ global $app;
+
+ $check_passed = true;
+ $limit_name = $app->db->quote($limit_name);
+ if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
+
+ // Get the limits of the client that is currently logged in
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT $limit_name as number, 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 item
+ if($client["number"] >= 0) {
+ $sql = "SELECT count(".$this->formDef['db_table_idx'].") as number FROM ".$this->formDef['db_table']." WHERE ".$this->getAuthSQL('u');
+ if($sql_where != '') $sql .= ' and '.$sql_where;
+ $tmp = $app->db->queryOneRecord($sql);
+ if($tmp["number"] >= $client["number"]) $check_passed = false;
+ }
+
+ return $check_passed;
+ }
+
+ function checkResellerLimit($limit_name,$sql_where = '') {
+ global $app;
+
+ $check_passed = true;
+ $limit_name = $app->db->quote($limit_name);
+ if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
+
+ // Get the limits of the client that is currently logged in
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+ //* If the client belongs to a reseller, we will check against the reseller Limit too
+ if($client['parent_client_id'] != 0) {
+
+ //* first we need to know the groups of this reseller
+ $tmp = $app->db->queryOneRecord("SELECT userid, groups FROM sys_user WHERE client_id = ".$client['parent_client_id']);
+ $reseller_groups = $tmp["groups"];
+ $reseller_userid = $tmp["userid"];
+
+ // Get the limits of the reseller of the logged in client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $reseller = $app->db->queryOneRecord("SELECT $limit_name as number FROM client WHERE client_id = ".$client['parent_client_id']);
+
+ // Check if the user may add another item
+ if($reseller["number"] >= 0) {
+ $sql = "SELECT count(".$this->formDef['db_table_idx'].") as number FROM ".$this->formDef['db_table']." WHERE (sys_groupid IN (".$reseller_groups.") or sys_userid = ".$reseller_userid.")";
+ if($sql_where != '') $sql .= ' and '.$sql_where;
+ $tmp = $app->db->queryOneRecord($sql);
+ if($tmp["number"] >= $reseller["number"]) $check_passed = false;
+ }
+ }
+
+ return $check_passed;
+ }
}
diff --git a/interface/web/dns/dns_soa_edit.php b/interface/web/dns/dns_soa_edit.php
index 47a8d3e..3f120db 100644
--- a/interface/web/dns/dns_soa_edit.php
+++ b/interface/web/dns/dns_soa_edit.php
@@ -55,17 +55,11 @@
// 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_dns_zone 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_dns_zone"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_soa WHERE sys_groupid = $client_group_id");
- if($tmp["number"] >= $client["limit_dns_zone"]) {
- $app->error($app->tform->wordbook["limit_dns_zone_txt"]);
- }
+ if(!$app->tform->checkClientLimit('limit_dns_zone')) {
+ $app->error($app->tform->wordbook["limit_dns_zone_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_dns_zone')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_dns_zone_txt"]);
}
}
diff --git a/interface/web/dns/dns_wizard.php b/interface/web/dns/dns_wizard.php
index 1107f72..a683d22 100644
--- a/interface/web/dns/dns_wizard.php
+++ b/interface/web/dns/dns_wizard.php
@@ -137,6 +137,13 @@
if(isset($_POST['ns2']) && $_POST['ns2'] == '') $error .= $app->lng('error_ns2_empty').'<br />';
if(isset($_POST['email']) && $_POST['email'] == '') $error .= $app->lng('error_email_empty').'<br />';
+ if(!$app->tform->checkClientLimit('limit_dns_zone')) {
+ $error .= $app->tform->wordbook["limit_dns_zone_txt"];
+ }
+ if(!$app->tform->checkResellerLimit('limit_dns_zone')) {
+ $error .= $app->tform->wordbook["limit_dns_zone_txt"];
+ }
+
// replace template placeholders
$tpl_content = $template_record['template'];
diff --git a/interface/web/mail/mail_alias_edit.php b/interface/web/mail/mail_alias_edit.php
index 65c05c9..a46896f 100644
--- a/interface/web/mail/mail_alias_edit.php
+++ b/interface/web/mail/mail_alias_edit.php
@@ -55,17 +55,11 @@
// 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"]);
- }
+ if(!$app->tform->checkClientLimit('limit_mailalias',"type = 'alias'")) {
+ $app->error($app->tform->wordbook["limit_mailalias_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_mailalias',"type = 'alias'")) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_mailalias_txt"]);
}
}
diff --git a/interface/web/mail/mail_blacklist_edit.php b/interface/web/mail/mail_blacklist_edit.php
index 558c29d..b2f4f67 100644
--- a/interface/web/mail/mail_blacklist_edit.php
+++ b/interface/web/mail/mail_blacklist_edit.php
@@ -55,17 +55,11 @@
// 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"]);
- }
+ if(!$app->tform->checkClientLimit('limit_mailfilter')) {
+ $app->error($app->tform->wordbook["limit_mailfilter_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_mailfilter')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_mailfilter_txt"]);
}
}
diff --git a/interface/web/mail/mail_domain_catchall_edit.php b/interface/web/mail/mail_domain_catchall_edit.php
index eebc7e4..c3338cc 100644
--- a/interface/web/mail/mail_domain_catchall_edit.php
+++ b/interface/web/mail/mail_domain_catchall_edit.php
@@ -55,17 +55,11 @@
// 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_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->error($app->tform->wordbook["limit_mailcatchall_txt"]);
- }
+ if(!$app->tform->checkClientLimit('limit_mailcatchall',"type = 'catchall'")) {
+ $app->error($app->tform->wordbook["limit_mailcatchall_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_mailcatchall',"type = 'catchall'")) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_mailcatchall_txt"]);
}
}
diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php
index e5df386..94f2a36 100644
--- a/interface/web/mail/mail_domain_edit.php
+++ b/interface/web/mail/mail_domain_edit.php
@@ -55,17 +55,11 @@
// 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"]);
- }
+ if(!$app->tform->checkClientLimit('limit_maildomain')) {
+ $app->error($app->tform->wordbook["limit_maildomain_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_maildomain')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_maildomain_txt"]);
}
}
diff --git a/interface/web/mail/mail_forward_edit.php b/interface/web/mail/mail_forward_edit.php
index efc83da..1f3c8db 100644
--- a/interface/web/mail/mail_forward_edit.php
+++ b/interface/web/mail/mail_forward_edit.php
@@ -55,17 +55,11 @@
// 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"]);
- }
+ if(!$app->tform->checkClientLimit('limit_mailforward',"type = 'forward'")) {
+ $app->error($app->tform->wordbook["limit_mailforward_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_mailforward',"type = 'forward'")) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_mailforward_txt"]);
}
}
diff --git a/interface/web/mail/mail_get_edit.php b/interface/web/mail/mail_get_edit.php
index ec9aeb9..5bc512a 100644
--- a/interface/web/mail/mail_get_edit.php
+++ b/interface/web/mail/mail_get_edit.php
@@ -55,17 +55,11 @@
// 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_fetchmail 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 transport.
- if($client["limit_fetchmail"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT count(mailget_id) as number FROM mail_get WHERE sys_groupid = $client_group_id");
- if($tmp["number"] >= $client["limit_fetchmail"]) {
- $app->error($app->tform->wordbook["limit_fetchmail_txt"]);
- }
+ if(!$app->tform->checkClientLimit('limit_fetchmail')) {
+ $app->error($app->tform->wordbook["limit_fetchmail_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_fetchmail')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_fetchmail_txt"]);
}
}
diff --git a/interface/web/mail/mail_transport_edit.php b/interface/web/mail/mail_transport_edit.php
index 6ab58fb..58b06dc 100644
--- a/interface/web/mail/mail_transport_edit.php
+++ b/interface/web/mail/mail_transport_edit.php
@@ -56,17 +56,11 @@
// 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 transport.
- 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"]);
- }
+ if(!$app->tform->checkClientLimit('limit_mailrouting')) {
+ $app->error($app->tform->wordbook["limit_mailrouting_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_mailrouting')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_mailrouting_txt"]);
}
}
diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php
index f46a1a5..52228a8 100644
--- a/interface/web/mail/mail_user_edit.php
+++ b/interface/web/mail/mail_user_edit.php
@@ -56,17 +56,11 @@
// 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_mailbox 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) {
- $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->error($app->tform->wordbook["limit_mailbox_txt"]);
- }
+ if(!$app->tform->checkClientLimit('limit_mailbox')) {
+ $app->error($app->tform->wordbook["limit_mailbox_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_mailbox')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_mailbox_txt"]);
}
}
diff --git a/interface/web/mail/mail_whitelist_edit.php b/interface/web/mail/mail_whitelist_edit.php
index c4fd8c2..a377729 100644
--- a/interface/web/mail/mail_whitelist_edit.php
+++ b/interface/web/mail/mail_whitelist_edit.php
@@ -55,17 +55,11 @@
// 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"]);
- }
+ if(!$app->tform->checkClientLimit('limit_mailfilter')) {
+ $app->error($app->tform->wordbook["limit_mailfilter_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_mailfilter')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_mailfilter_txt"]);
}
}
diff --git a/interface/web/mail/spamfilter_blacklist_edit.php b/interface/web/mail/spamfilter_blacklist_edit.php
index a75af75..b6c45dd 100644
--- a/interface/web/mail/spamfilter_blacklist_edit.php
+++ b/interface/web/mail/spamfilter_blacklist_edit.php
@@ -54,17 +54,11 @@
// 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_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->lng("limit_spamfilter_wblist_txt"));
- }
+ if(!$app->tform->checkClientLimit('limit_spamfilter_wblist')) {
+ $app->error($app->tform->wordbook["limit_spamfilter_wblist_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_spamfilter_wblist')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_spamfilter_wblist_txt"]);
}
}
diff --git a/interface/web/mail/spamfilter_policy_edit.php b/interface/web/mail/spamfilter_policy_edit.php
index 03b569b..abc28e9 100644
--- a/interface/web/mail/spamfilter_policy_edit.php
+++ b/interface/web/mail/spamfilter_policy_edit.php
@@ -54,17 +54,11 @@
// 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"]);
- }
+ if(!$app->tform->checkClientLimit('limit_spamfilter_policy')) {
+ $app->error($app->tform->wordbook["limit_spamfilter_policy_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_spamfilter_policy')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_spamfilter_policy_txt"]);
}
}
diff --git a/interface/web/mail/spamfilter_users_edit.php b/interface/web/mail/spamfilter_users_edit.php
index f76f909..02cebbf 100644
--- a/interface/web/mail/spamfilter_users_edit.php
+++ b/interface/web/mail/spamfilter_users_edit.php
@@ -54,17 +54,11 @@
// 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"]);
- }
+ if(!$app->tform->checkClientLimit('limit_spamfilter_user')) {
+ $app->error($app->tform->wordbook["limit_spamfilter_user_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_spamfilter_user')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_spamfilter_user_txt"]);
}
}
diff --git a/interface/web/mail/spamfilter_whitelist_edit.php b/interface/web/mail/spamfilter_whitelist_edit.php
index b6762af..c4bba0e 100644
--- a/interface/web/mail/spamfilter_whitelist_edit.php
+++ b/interface/web/mail/spamfilter_whitelist_edit.php
@@ -54,17 +54,11 @@
// 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_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->lng("limit_spamfilter_wblist_txt"));
- }
+ if(!$app->tform->checkClientLimit('limit_spamfilter_wblist')) {
+ $app->error($app->tform->wordbook["limit_spamfilter_wblist_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_spamfilter_wblist')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_spamfilter_wblist_txt"]);
}
}
diff --git a/interface/web/sites/cron_edit.php b/interface/web/sites/cron_edit.php
index 1f0a025..a3244f0 100644
--- a/interface/web/sites/cron_edit.php
+++ b/interface/web/sites/cron_edit.php
@@ -56,17 +56,11 @@
// 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_cron 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 cron job.
- if($client["limit_cron"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM cron WHERE sys_groupid = $client_group_id");
- if($tmp["number"] >= $client["limit_cron"]) {
- $app->error($app->tform->wordbook["limit_cron_txt"]);
- }
+ if(!$app->tform->checkClientLimit('limit_cron')) {
+ $app->error($app->tform->wordbook["limit_cron_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_cron')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_cron_txt"]);
}
}
diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php
index 9e1430b..088e37a 100644
--- a/interface/web/sites/database_edit.php
+++ b/interface/web/sites/database_edit.php
@@ -56,17 +56,11 @@
// 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_database 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 database.
- if($client["limit_database"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT count(database_id) as number FROM web_database WHERE sys_groupid = $client_group_id");
- if($tmp["number"] >= $client["limit_database"]) {
- $app->error($app->tform->wordbook["limit_database_txt"]);
- }
+ if(!$app->tform->checkClientLimit('limit_database')) {
+ $app->error($app->tform->wordbook["limit_database_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_database')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_database_txt"]);
}
}
diff --git a/interface/web/sites/ftp_user_edit.php b/interface/web/sites/ftp_user_edit.php
index b8b089e..511ac90 100644
--- a/interface/web/sites/ftp_user_edit.php
+++ b/interface/web/sites/ftp_user_edit.php
@@ -56,17 +56,11 @@
// 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_ftp_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 ftp user.
- if($client["limit_ftp_user"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT count(ftp_user_id) as number FROM ftp_user WHERE sys_groupid = $client_group_id");
- if($tmp["number"] >= $client["limit_ftp_user"]) {
- $app->error($app->tform->wordbook["limit_ftp_user_txt"]);
- }
+ if(!$app->tform->checkClientLimit('limit_ftp_user')) {
+ $app->error($app->tform->wordbook["limit_ftp_user_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_ftp_user')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_ftp_user_txt"]);
}
}
diff --git a/interface/web/sites/shell_user_edit.php b/interface/web/sites/shell_user_edit.php
index 2778294..422c8a1 100644
--- a/interface/web/sites/shell_user_edit.php
+++ b/interface/web/sites/shell_user_edit.php
@@ -56,17 +56,11 @@
// 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_shell_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 shell user.
- if($client["limit_shell_user"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT count(shell_user_id) as number FROM shell_user WHERE sys_groupid = $client_group_id");
- if($tmp["number"] >= $client["limit_shell_user"]) {
- $app->error($app->tform->wordbook["limit_shell_user_txt"]);
- }
+ if(!$app->tform->checkClientLimit('limit_shell_user')) {
+ $app->error($app->tform->wordbook["limit_shell_user_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_shell_user')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_shell_user_txt"]);
}
}
diff --git a/interface/web/sites/web_aliasdomain_edit.php b/interface/web/sites/web_aliasdomain_edit.php
index 0f86b62..1fdd8fe 100644
--- a/interface/web/sites/web_aliasdomain_edit.php
+++ b/interface/web/sites/web_aliasdomain_edit.php
@@ -57,17 +57,11 @@
// 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_web_aliasdomain 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_web_aliasdomain"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $client_group_id and type = 'alias'");
- if($tmp["number"] >= $client["limit_web_aliasdomain"]) {
- $app->error($app->tform->wordbook["limit_web_aliasdomain_txt"]);
- }
+ if(!$app->tform->checkClientLimit('limit_web_aliasdomain',"type = 'alias'")) {
+ $app->error($app->tform->wordbook["limit_web_aliasdomain_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_web_aliasdomain',"type = 'alias'")) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_web_aliasdomain_txt"]);
}
}
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index 7ef49aa..7ad4dcc 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -55,17 +55,11 @@
// 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_web_domain 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 website.
- if($client["limit_web_domain"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $client_group_id and type = 'vhost'");
- if($tmp["number"] >= $client["limit_web_domain"]) {
- $app->error($app->tform->wordbook["limit_web_domain_txt"]);
- }
+ if(!$app->tform->checkClientLimit('limit_web_domain',"type = 'vhost'")) {
+ $app->error($app->tform->wordbook["limit_web_domain_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_web_domain',"type = 'vhost'")) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_web_domain_txt"]);
}
}
diff --git a/interface/web/sites/web_subdomain_edit.php b/interface/web/sites/web_subdomain_edit.php
index 3dd2f64..2858e34 100644
--- a/interface/web/sites/web_subdomain_edit.php
+++ b/interface/web/sites/web_subdomain_edit.php
@@ -57,17 +57,11 @@
// 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_web_subdomain 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_web_subdomain"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $client_group_id and type = 'subdomain'");
- if($tmp["number"] >= $client["limit_web_subdomain"]) {
- $app->error($app->tform->wordbook["limit_web_subdomain_txt"]);
- }
+ if(!$app->tform->checkClientLimit('limit_web_subdomain',"type = 'subdomain'")) {
+ $app->error($app->tform->wordbook["limit_web_subdomain_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_web_subdomain',"type = 'subdomain'")) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_web_subdomain_txt"]);
}
}
--
Gitblit v1.9.1