From d3dca7d9d7bc1c096f0c7bf4c0ddead07b1b2cac Mon Sep 17 00:00:00 2001 From: David Ramos Date: Tue, 2 Jan 2018 14:22:43 +0100 Subject: [PATCH] =?UTF-8?q?Versi=C3=B3n=20v1.2.=20Mejora=20de=20los=20mens?= =?UTF-8?q?ajes=20de=20error=20para=20DNS=20y=20Sitio=20Web.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- clases/limites.inc.php | 200 ----------------------------------------- new_service_webdns.php | 13 --- 2 files changed, 213 deletions(-) delete mode 100644 clases/limites.inc.php diff --git a/clases/limites.inc.php b/clases/limites.inc.php deleted file mode 100644 index 5828709..0000000 --- a/clases/limites.inc.php +++ /dev/null @@ -1,200 +0,0 @@ - - -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'; - -global $app; -$app->uses('tform,tform_actions'); -$app->load('tform_actions'); - - -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, parent_client_id - 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 $revendedor; - public $revendedor_grupos; - public $revendedor_grupo_def; - - public function getRevendedor(){ - global $app, $conf; - - $tmpReseller = $app->db->queryOneRecord( - "SELECT userid, groups, default_group - FROM sys_user - WHERE client_id = ?", $this->cliente['parent_client_id']); - - $this->revendedor = $tmpReseller['userid']; - $this->revendedor_grupos = $tmpReseller['groups']; - $this->revendedor_grupo_def = $tmpReseller['default_group']; - } - - public function limClienteDns(){ - global $app, $conf; - //Si el cliente esta vacío es admin. - if($this->cliente){ - //echo(' Usuario grupo es ' .$this->cliente_grupo_id); - 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 true; - } - } - //* If the client belongs to a reseller, we will check against the reseller Limit too - if($this->cliente['parent_client_id'] != 0) { - //* first we need to know the groups of this reseller - $this->getRevendedor(); - //echo(' Valores '.$this->revendedor . ' otro ' . $this->revendedor_grupos . ' y otro ' .$this->revendedor_grupo_def); - //echo(' El cliente es ' . $this->cliente['parent_client_id']); - $reseller = $app->db->queryOneRecord( - "SELECT limit_dns_zone as number, contact_firstname FROM client WHERE client_id = ?", $this->cliente['parent_client_id']); - //echo(' Cliente Reventa limites DNS ' . $reseller['number']); - // Check if the user may add another item - if($reseller['number'] >= 0) { - $tmpCliente = $app->db->queryOneRecord( - "SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", $this->cliente_grupo_id); - - $tmpReventa = $app->db->queryOneRecord( - "SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", $this->revendedor_grupo_def); - - $totalCreado = $tmpCliente['number'] + $tmpReventa['number']; - //echo(' Total creado ' . $totalCreado . ' el array ' . print_r($reseller). ' Y ' . $reseller['number']); - if($totalCreado >= $reseller['number']) { - $app->error($reseller['contact_firstname'] . '. ' . $app->tform->wordbook["limit_dns_zone_txt"]); - return true; - } - /* $tmp = $app->db->queryOneRecord( - "SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", explode(',', $this->revendedor_grupos)); - echo(' El temp registros en dns_soa usando grupo reseller ' .$tmp['number']);*/ - /* $sumaTotal = 0; - $todosLosGrupos = explode(',', $this->revendedor_grupos); - foreach($todosLosGrupos as $grupos) { - $tmpReventaALL = $app->db->queryOneRecord( - "SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", $grupos); - $sql = "SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ". $grupos; - echo(' Valores ' . $tmpReventaALL['number']); - $sumaTotal =+ $tmpReventaALL['number']; - echo($sumaTotal); - - }*/ - /*if($tmp['number'] >= $reseller['number']) { - $app->error($app->tform->wordbook["limit_dns_zone_txt"]); - return true; - }*/ - } - } - 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; - } - } - //* If the client belongs to a reseller, we will check against the reseller Limit too - if($this->cliente['parent_client_id'] != 0) { - //* first we need to know the groups of this reseller - $this->getRevendedor(); - - $reseller = $app->db->queryOneRecord( - "SELECT limit_web_domain as number, contact_firstname FROM client WHERE client_id = ?", $this->cliente['parent_client_id']); - //echo(' Cliente Reventa limites DNS ' . $reseller['number']); - // Check if the user may add another item - if($reseller['number'] >= 0) { - $tmpCliente = $app->db->queryOneRecord( - "SELECT count(domain_id) as number FROM web_domain - WHERE sys_groupid = ? and type = 'vhost'", $this->cliente_grupo_id); - - $tmpReventa = $app->db->queryOneRecord( - "SELECT count(domain_id) as number FROM web_domain - WHERE sys_groupid = ? and type = 'vhost'", $this->revendedor_grupo_def); - - $totalCreado = $tmpCliente['number'] + $tmpReventa['number']; - - if($totalCreado >= $reseller['number']) { - $app->error($reseller['contact_firstname'] . '. ' . $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 true; - } - } - - //* If the client belongs to a reseller, we will check against the reseller Limit too - if($this->cliente['parent_client_id'] != 0) { - //* first we need to know the groups of this reseller - $this->getRevendedor(); - - $reseller = $app->db->queryOneRecord( - "SELECT limit_database as number, contact_firstname FROM client WHERE client_id = ?", $this->cliente['parent_client_id']); - //echo(' Cliente Reventa limites DNS ' . $reseller['number']); - // Check if the user may add another item - if($reseller['number'] >= 0) { - $tmpCliente = $app->db->queryOneRecord( - "SELECT count(database_id) as number - FROM web_database WHERE sys_groupid = ?", $this->cliente_grupo_id); - - $tmpReventa = $app->db->queryOneRecord( - "SELECT count(database_id) as number - FROM web_database WHERE sys_groupid = ?", $this->revendedor_grupo_def); - - $totalCreado = $tmpCliente['number'] + $tmpReventa['number']; - - if($totalCreado >= $reseller['number']) { - $app->error($reseller['contact_firstname'] . '. ' . $app->tform->wordbook["limit_database_txt"]); - return true; - } - } - } - return false; - } - } - -} - -?> \ No newline at end of file diff --git a/new_service_webdns.php b/new_service_webdns.php index d213582..966f92f 100755 --- a/new_service_webdns.php +++ b/new_service_webdns.php @@ -8,9 +8,6 @@ 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; }