diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php index f534e254ff252047017a5ab1f08a2e29bcf79abe..e70922a35339b0ee40eff8cb0fd059607aa26440 100644 --- a/interface/lib/app.inc.php +++ b/interface/lib/app.inc.php @@ -186,7 +186,11 @@ class app { 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', ''); diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php index 33103a0128ea874c87d2db27d7632735edb2dae5..ec37de22272696f19499e0c9d0a58b1c4104274b 100644 --- a/interface/lib/classes/tform.inc.php +++ b/interface/lib/classes/tform.inc.php @@ -1148,6 +1148,63 @@ class tform { } } + + 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 47a8d3e1f145b22b8d70e7a895d733a9f9f25abc..3f120db26f7784c146c99112bcf7c539e2542c26 100644 --- a/interface/web/dns/dns_soa_edit.php +++ b/interface/web/dns/dns_soa_edit.php @@ -55,17 +55,11 @@ class page_action extends tform_actions { // 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 1107f724fcae496b89f699d3c1c0b8bfc90b7403..a683d22d286c9560112d8a5295e1c7993c40ddad 100644 --- a/interface/web/dns/dns_wizard.php +++ b/interface/web/dns/dns_wizard.php @@ -137,6 +137,13 @@ if($_POST['create'] == 1) { if(isset($_POST['ns2']) && $_POST['ns2'] == '') $error .= $app->lng('error_ns2_empty').'
'; if(isset($_POST['email']) && $_POST['email'] == '') $error .= $app->lng('error_email_empty').'
'; + 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 65c05c95e9d7fe17ca7d22c19cb42a3214c452fd..a46896f6cfe463cab2a60dcf93b8846b96ab1afa 100644 --- a/interface/web/mail/mail_alias_edit.php +++ b/interface/web/mail/mail_alias_edit.php @@ -55,17 +55,11 @@ class page_action extends tform_actions { // 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 558c29d33d19f94c156bb244fdd89d5f66dbf6f8..b2f4f6761a22204ef9f2cc8bdd7624261721fa58 100644 --- a/interface/web/mail/mail_blacklist_edit.php +++ b/interface/web/mail/mail_blacklist_edit.php @@ -55,17 +55,11 @@ class page_action extends tform_actions { // 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 eebc7e42c5fcd5dcf7b31d30d2556eac913233cb..c3338cc31984afcd6c4635351624627d46702dbb 100644 --- a/interface/web/mail/mail_domain_catchall_edit.php +++ b/interface/web/mail/mail_domain_catchall_edit.php @@ -55,17 +55,11 @@ class page_action extends tform_actions { // 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 e5df3869a90192f0b4612266b865c60e4b3f7a83..94f2a36fe09e3fed9991e8461bab8184ad0d8951 100644 --- a/interface/web/mail/mail_domain_edit.php +++ b/interface/web/mail/mail_domain_edit.php @@ -55,17 +55,11 @@ class page_action extends tform_actions { // 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 efc83da8182c7dbe0340edb39105463efed04533..1f3c8db4b18a25893ecef2ba49c17848c55c7e52 100644 --- a/interface/web/mail/mail_forward_edit.php +++ b/interface/web/mail/mail_forward_edit.php @@ -55,17 +55,11 @@ class page_action extends tform_actions { // 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 ec9aeb9c5f5900da1ef2de88075250eaeb302fec..5bc512a75214c1907988a59c137a54ffcb81f02c 100644 --- a/interface/web/mail/mail_get_edit.php +++ b/interface/web/mail/mail_get_edit.php @@ -55,17 +55,11 @@ class page_action extends tform_actions { // 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 6ab58fb9374b05be7aba1069d1bcf5f17d6f0a9c..58b06dc2e327edc367d08dfd4fcfd4838a898cb6 100644 --- a/interface/web/mail/mail_transport_edit.php +++ b/interface/web/mail/mail_transport_edit.php @@ -56,17 +56,11 @@ class page_action extends tform_actions { // 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 f46a1a505d98aa74da5db1014a4a9bd11d0b9c66..52228a8065bcc77e4293ccd3fd434f81abfba6b4 100644 --- a/interface/web/mail/mail_user_edit.php +++ b/interface/web/mail/mail_user_edit.php @@ -56,17 +56,11 @@ class page_action extends tform_actions { // 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 c4fd8c259c9bd57f57ed802a5505f3d8f4d39d54..a377729d2d848cb93c54da173b0cc1a5749fc902 100644 --- a/interface/web/mail/mail_whitelist_edit.php +++ b/interface/web/mail/mail_whitelist_edit.php @@ -55,17 +55,11 @@ class page_action extends tform_actions { // 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 a75af7539577b3a8ecc168f7439209faf6006867..b6c45dd98ef4880cf5be9d5d644e2e26995cb5ab 100644 --- a/interface/web/mail/spamfilter_blacklist_edit.php +++ b/interface/web/mail/spamfilter_blacklist_edit.php @@ -54,17 +54,11 @@ class page_action extends tform_actions { // 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 03b569bd0a633234240e137f2be8a07ad4dc1c79..abc28e9e7c12ffb853eccaf0cf65c0d0cb03b63e 100644 --- a/interface/web/mail/spamfilter_policy_edit.php +++ b/interface/web/mail/spamfilter_policy_edit.php @@ -54,17 +54,11 @@ class page_action extends tform_actions { // 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 f76f909c93cceef9163c1f133b05c39026e687f0..02cebbf40aa92417ce24ca4f7fd4859e2e8a2eb7 100644 --- a/interface/web/mail/spamfilter_users_edit.php +++ b/interface/web/mail/spamfilter_users_edit.php @@ -54,17 +54,11 @@ class page_action extends tform_actions { // 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 b6762af77a7d8ec18036bf838b5fd3c469b123c8..c4bba0e8a028aa995e6565652ca641e77c1c9afc 100644 --- a/interface/web/mail/spamfilter_whitelist_edit.php +++ b/interface/web/mail/spamfilter_whitelist_edit.php @@ -54,17 +54,11 @@ class page_action extends tform_actions { // 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 1f0a025b50d4dbcd08a32990dc1e30fcd9803f3b..a3244f0ebf4f87908dcd0476b79d4a5dde1aac46 100644 --- a/interface/web/sites/cron_edit.php +++ b/interface/web/sites/cron_edit.php @@ -56,17 +56,11 @@ class page_action extends tform_actions { // 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 9e1430bea19c6edff55eeb1e7b0e2e11f5785731..088e37a3b6c9f3cdeff442e3ed8b8a5be6b1ef0e 100644 --- a/interface/web/sites/database_edit.php +++ b/interface/web/sites/database_edit.php @@ -56,17 +56,11 @@ class page_action extends tform_actions { // 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 b8b089ef825688e16f5f860fbaa52288cb32d408..511ac907195a3e73b5a62504f437163d3f0ceed0 100644 --- a/interface/web/sites/ftp_user_edit.php +++ b/interface/web/sites/ftp_user_edit.php @@ -56,17 +56,11 @@ class page_action extends tform_actions { // 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 2778294d986fda4af8e898fcca7f889099a537a6..422c8a1b5e7a5dcda8c7e535472afdf4528ec864 100644 --- a/interface/web/sites/shell_user_edit.php +++ b/interface/web/sites/shell_user_edit.php @@ -56,17 +56,11 @@ class page_action extends tform_actions { // 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 0f86b62f9cbe0a6bfbd1e063687d14ff0fc417c4..1fdd8fef097fd5b66e0e145b8b358472f115358d 100644 --- a/interface/web/sites/web_aliasdomain_edit.php +++ b/interface/web/sites/web_aliasdomain_edit.php @@ -57,17 +57,11 @@ class page_action extends tform_actions { // 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 7ef49aa2d30a75efcf636f4da42c86f65f1d6ea4..7ad4dcc64ac5d1f6d26710b576582540e3ccfa8e 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -55,17 +55,11 @@ class page_action extends tform_actions { // 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 3dd2f64bdaa4071ff8d2e4d10ef601e67009acee..2858e34b8f583ef9ba302bfcd65f38f972318f35 100644 --- a/interface/web/sites/web_subdomain_edit.php +++ b/interface/web/sites/web_subdomain_edit.php @@ -57,17 +57,11 @@ class page_action extends tform_actions { // 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"]); } }