diff --git a/clases/limites.inc.php b/clases/limites.inc.php new file mode 100644 index 0000000..290ee3b --- /dev/null +++ b/clases/limites.inc.php @@ -0,0 +1,78 @@ + + +Clase para el control de los límites de los usuarios con el módulo WebDNS. + +2017, All rights reserved. +*/ + +require_once '../../lib/app.inc.php'; + +class limites { + + public $cliente; + public $cliente_grupo_id; + + public function __construct($cliente_group_id){ + global $app, $conf; + $this->cliente = $client = $app->db->queryOneRecord( + "SELECT limit_dns_zone, limit_web_domain, limit_database FROM sys_group, client + WHERE sys_group.client_id = client.client_id + and sys_group.groupid = ?", $cliente_group_id); + + $this->cliente_grupo_id = $cliente_group_id; + } + + public function limClienteDns(){ + global $app, $conf; + //Si el cliente esta vacío es admin. + if($this->cliente){ + if($this->cliente["limit_dns_zone"] >= 0) { + $tmp = $app->db->queryOneRecord( + "SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", $this->cliente_grupo_id); + if($tmp["number"] >= $this->cliente["limit_dns_zone"]) { + $app->error($app->tform->wordbook["limit_dns_zone_txt"]); + } + } + } + return false; + } + + public function limClienteWebDominio(){ + global $app, $conf; + //Si el cliente esta vacío es admin. + if($this->cliente){ + if($this->cliente["limit_web_domain"] >= 0) { + $tmp = $app->db->queryOneRecord( + "SELECT count(domain_id) as number FROM web_domain + WHERE sys_groupid = ? and type = 'vhost'", $this->cliente_grupo_id); + + if($tmp["number"] >= $this->cliente["limit_web_domain"]) { + $app->error($app->tform->wordbook["limit_web_domain_txt"]); + return true; + } + } + } + return false; + } + + public function limClienteDB(){ + global $app, $conf; + //Si el cliente esta vacío es admin. + if($this->cliente){ + if($this->cliente["limit_database"] >= 0) { + $tmp = $app->db->queryOneRecord( + "SELECT count(database_id) as number + FROM web_database WHERE sys_groupid = ?", $this->cliente_grupo_id); + if($tmp["number"] >= $this->cliente["limit_database"]) { + $app->error($app->tform->wordbook["limit_database_txt"]); + } + } + } + return false; + } + +} + +?> \ No newline at end of file diff --git a/lib/lang/en_new_service_webdns.lng b/lib/lang/en_new_service_webdns.lng index 737f06e..89bff60 100755 --- a/lib/lang/en_new_service_webdns.lng +++ b/lib/lang/en_new_service_webdns.lng @@ -86,6 +86,8 @@ $wb["client_txt"] = 'Client'; $wb["limit_web_domain_txt"] = 'The max. number of web domains for your account is reached.'; $wb["limit_web_aliasdomain_txt"] = 'The max. number of aliasdomains for your account is reached.'; $wb["limit_web_subdomain_txt"] = 'The max. number of web subdomains for your account is reached.'; +$wb["limit_database_txt"] = 'The max. number of databases is reached.'; +$wb["limit_dns_zone_txt"] = 'The max. number of DNS zones for your account is reached.'; $wb["apache_directives_txt"] = 'Apache Directives'; $wb["domain_error_empty"] = 'Domain is empty.'; $wb["domain_error_unique"] = 'There is already a website or sub / aliasdomain with this domain name.'; @@ -210,4 +212,5 @@ $wb['globalsearch_searchfield_watermark_txt'] = "Search"; $wb['globalsearch_suggestions_text_txt'] = "Suggestions"; $wb['limit_database_user_txt'] = "The max. number of database users is reached."; $wb['database_password_error_empty'] = 'Database password is empty.'; +$wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account is reached.'; ?> \ No newline at end of file diff --git a/lib/lang/es_new_service_webdns.lng b/lib/lang/es_new_service_webdns.lng index 6da279c..d262973 100755 --- a/lib/lang/es_new_service_webdns.lng +++ b/lib/lang/es_new_service_webdns.lng @@ -84,6 +84,8 @@ $wb['client_txt'] = 'Cliente'; $wb['limit_web_domain_txt'] = 'Se ha alcanzado el número máximo de dominios web de esta cuenta'; $wb['limit_web_aliasdomain_txt'] = 'Se ha alcanzado el número máximo de alias de dominios de esta cuenta'; $wb['limit_web_subdomain_txt'] = 'Se ha alcanzado el número máximo de subdominios web de esta cuenta'; +$wb['limit_database_txt'] = 'Ha alcanzado el número máx. de bases de dato.'; +$wb['limit_dns_zone_txt'] = 'Ha alcanzado el número máx. de zonas DNS permitidos para su cuenta.'; $wb['apache_directives_txt'] = 'Directivas de Apache'; $wb['domain_error_empty'] = 'El dominio está vacío.'; $wb['domain_error_unique'] = 'Ya existe un sitio web o sub/aliasdominio con este nombre de dominio.'; @@ -210,4 +212,5 @@ $wb['globalsearch_searchfield_watermark_txt'] = 'Buscar'; $wb['globalsearch_suggestions_text_txt'] = 'Sugerencias'; $wb['limit_database_user_txt'] = 'The max. number of database users is reached.'; $wb['database_password_error_empty'] = 'Database password is empty.'; +$wb['limit_dns_record_txt'] = 'Ha alcanzado el número máx. de registros DNS permitidos para su cuenta.'; ?> diff --git a/new_service_webdns.php b/new_service_webdns.php index df97d58..6171ff0 100755 --- a/new_service_webdns.php +++ b/new_service_webdns.php @@ -8,6 +8,9 @@ SQL y expresiones regulares por Pablo Sarria Pérez, Open6Hosting IP6 WEB ";print_r($this->ip6_servidor_web);print "\n";*/ if($this->servidoresActivados()){ return; } +//------INICIO LIMITES-------------------------------------------------------------------------------------------------- + $limitado = new limites($this->cli_grupo_id); + $tieneLimitesDNS = $limitado->limClienteDns(); + $tieneLimitesWeb = $limitado->limClienteWebDominio(); + $tieneLimitesDB = $limitado->limClienteDB(); + + if($tieneLimitesDNS || $tieneLimitesWeb || $tieneLimitesDB){ + return; + } +//------FIN LIMITES----------------------------------------------------------------------------------------------------- if($this->existeDominio($fields)){ return; }