| @@ -0,0 +1,78 @@ | |||||
| <?php | |||||
| /* | |||||
| PHP por David Ramos García, Open6Hosting <dramos@open6hosting.com> | |||||
| 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; | |||||
| } | |||||
| } | |||||
| ?> | |||||
| @@ -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_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_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_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["apache_directives_txt"] = 'Apache Directives'; | ||||
| $wb["domain_error_empty"] = 'Domain is empty.'; | $wb["domain_error_empty"] = 'Domain is empty.'; | ||||
| $wb["domain_error_unique"] = 'There is already a website or sub / aliasdomain with this domain name.'; | $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['globalsearch_suggestions_text_txt'] = "Suggestions"; | ||||
| $wb['limit_database_user_txt'] = "The max. number of database users is reached."; | $wb['limit_database_user_txt'] = "The max. number of database users is reached."; | ||||
| $wb['database_password_error_empty'] = 'Database password is empty.'; | $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.'; | |||||
| ?> | ?> | ||||
| @@ -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_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_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_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['apache_directives_txt'] = 'Directivas de Apache'; | ||||
| $wb['domain_error_empty'] = 'El dominio está vacío.'; | $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.'; | $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['globalsearch_suggestions_text_txt'] = 'Sugerencias'; | ||||
| $wb['limit_database_user_txt'] = 'The max. number of database users is reached.'; | $wb['limit_database_user_txt'] = 'The max. number of database users is reached.'; | ||||
| $wb['database_password_error_empty'] = 'Database password is empty.'; | $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.'; | |||||
| ?> | ?> | ||||
| @@ -8,6 +8,9 @@ SQL y expresiones regulares por Pablo Sarria Pérez, Open6Hosting <pablo@sarriap | |||||
| require_once '../../lib/config.inc.php'; | require_once '../../lib/config.inc.php'; | ||||
| require_once '../../lib/app.inc.php'; | require_once '../../lib/app.inc.php'; | ||||
| //INICIO---CLASE PARA LOS LIMITES-------------------------------------------------------------------------------------------- | |||||
| require_once 'clases/limites.inc.php'; | |||||
| //FIN------CLASE PARA LOS LIMITES-------------------------------------------------------------------------------------------- | |||||
| //require 'pdf_o6h.php'; | //require 'pdf_o6h.php'; | ||||
| //Variable para cargar los distintos formularios. | //Variable para cargar los distintos formularios. | ||||
| @@ -1436,6 +1439,16 @@ print "<pre>IP6 WEB ";print_r($this->ip6_servidor_web);print "</pre>\n";*/ | |||||
| if($this->servidoresActivados()){ | if($this->servidoresActivados()){ | ||||
| return; | 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)){ | if($this->existeDominio($fields)){ | ||||
| return; | return; | ||||
| } | } | ||||