Commit 3cebc3a5 authored by tbrehm's avatar tbrehm
Browse files

Fixed: FS#776 - Client's limits do not apply for it's own client

Improved client and reseller limit checks
parent 95188035
......@@ -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', '<img src="'.$this->_conf['app_logo'].'">');
......
......@@ -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;
}
}
......
......@@ -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"]);
}
}
......
......@@ -137,6 +137,13 @@ if($_POST['create'] == 1) {
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'];
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -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"]);
}
}
......
......@@ -57,17 +57,11 @@ class page_action extends tform_actions {
// we will check only users, not admins