From f2384f6ba8408c52a1573b450ecc19f6ac871ef4 Mon Sep 17 00:00:00 2001 From: David Ramos Date: Wed, 3 Jan 2018 13:26:30 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Versi=C3=B3n=20v2.0.=20Control=20total=20de?= =?UTF-8?q?=20las=20limitaciones=20para=20usuarios=20y=20revendedores.=20S?= =?UTF-8?q?olo=20para=20admin.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- clases/limites.inc.php | 118 ++++++++++++++++++++++++++++++----------- 1 file changed, 88 insertions(+), 30 deletions(-) diff --git a/clases/limites.inc.php b/clases/limites.inc.php index 5828709..634cbf4 100644 --- a/clases/limites.inc.php +++ b/clases/limites.inc.php @@ -22,10 +22,10 @@ class limites { 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); + "SELECT limit_dns_zone, limit_web_domain, limit_database, parent_client_id, client.client_id, client.contact_name + 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; } @@ -44,7 +44,31 @@ class limites { $this->revendedor = $tmpReseller['userid']; $this->revendedor_grupos = $tmpReseller['groups']; - $this->revendedor_grupo_def = $tmpReseller['default_group']; + $this->revendedor_grupo_def = $tmpReseller['default_group']; + } + + public $esReventa; + public $todosLosGrupos; + //public $gruposDelReventa; + + public function esRevendedor(){ + global $app, $conf; + //PARA SABER QUIEN ES UN RESELLER + //SELECT client_id, company_name, limit_client FROM client WHERE limit_client > 0 OR limit_client = -1 + $this->esReventa = $app->db->queryOneRecord( + "SELECT client_id, limit_client, contact_name + FROM client + WHERE limit_client > 0 OR limit_client = -1 AND client_id = ?", $this->cliente['client_id']); + + //El campo contact_name es obligatorio. Si viene vacío no es reventa. + if($this->esReventa['contact_name'] != ''){ + //Capturo los grupos que tiene este reventa + $gruposDelReventa = $app->db->queryOneRecord( + "SELECT client_id, groups FROM sys_user WHERE client_id = ?", $this->cliente['client_id']); + + $this->todosLosGrupos = explode(',', $gruposDelReventa['groups']); + + } } public function limClienteDns(){ @@ -55,11 +79,13 @@ class limites { 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 @@ -67,7 +93,7 @@ class limites { //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']); + "SELECT limit_dns_zone as number, contact_name 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) { @@ -78,31 +104,29 @@ class limites { "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"]); + $app->error($reseller['contact_name'] . '. ' . $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; - }*/ } } + + $this->esRevendedor(); + + $sumaTotal = 0; + foreach($this->todosLosGrupos as $grupos) { + $tmpReventaALL = $app->db->queryOneRecord( + "SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", $grupos); + + $sumaTotal += $tmpReventaALL['number']; + } + + if($sumaTotal >= $this->cliente["limit_dns_zone"]) { + $app->error($this->esReventa['contact_name'] . '. ' . $app->tform->wordbook["limit_dns_zone_txt"]); + return true; + } + return false; } } @@ -127,7 +151,7 @@ class limites { $this->getRevendedor(); $reseller = $app->db->queryOneRecord( - "SELECT limit_web_domain as number, contact_firstname FROM client WHERE client_id = ?", $this->cliente['parent_client_id']); + "SELECT limit_web_domain as number, contact_name 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) { @@ -142,11 +166,28 @@ class limites { $totalCreado = $tmpCliente['number'] + $tmpReventa['number']; if($totalCreado >= $reseller['number']) { - $app->error($reseller['contact_firstname'] . '. ' . $app->tform->wordbook["limit_web_domain_txt"]); + $app->error($reseller['contact_name'] . '. ' . $app->tform->wordbook["limit_web_domain_txt"]); return true; } } } + + $this->esRevendedor(); + + $sumaTotal = 0; + foreach($this->todosLosGrupos as $grupos) { + $tmpReventaALL = $app->db->queryOneRecord( + "SELECT count(domain_id) as number FROM web_domain + WHERE sys_groupid = ? and type = 'vhost'", $grupos); + + $sumaTotal += $tmpReventaALL['number']; + } + + if($sumaTotal >= $this->cliente["limit_web_domain"]) { + $app->error($this->esReventa['contact_name'] . '. ' . $app->tform->wordbook["limit_web_domain_txt"]); + return true; + } + return false; } } @@ -171,7 +212,7 @@ class limites { $this->getRevendedor(); $reseller = $app->db->queryOneRecord( - "SELECT limit_database as number, contact_firstname FROM client WHERE client_id = ?", $this->cliente['parent_client_id']); + "SELECT limit_database as number, contact_name 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) { @@ -186,11 +227,28 @@ class limites { $totalCreado = $tmpCliente['number'] + $tmpReventa['number']; if($totalCreado >= $reseller['number']) { - $app->error($reseller['contact_firstname'] . '. ' . $app->tform->wordbook["limit_database_txt"]); + $app->error($reseller['contact_name'] . '. ' . $app->tform->wordbook["limit_database_txt"]); return true; } } } + + $this->esRevendedor(); + + $sumaTotal = 0; + foreach($this->todosLosGrupos as $grupos) { + $tmpReventaALL = $app->db->queryOneRecord( + "SELECT count(database_id) as number + FROM web_database WHERE sys_groupid = ?", $grupos); + + $sumaTotal += $tmpReventaALL['number']; + } + + if($sumaTotal >= $this->cliente["limit_database"]) { + $app->error($this->esReventa['contact_name'] . '. ' . $app->tform->wordbook["limit_database_txt"]); + return true; + } + return false; } } From 37e29b219616705cc03efdd591c74af4fadfbda9 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 5 Jan 2018 12:32:58 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Versi=C3=B3n=20v2.0.=20Mejora=20de=20la=20d?= =?UTF-8?q?etecci=C3=B3n=20de=20los=20servidores=20por=20defecto.=20Compro?= =?UTF-8?q?baci=C3=B3n=20de=20la=20correcta=20instalaci=C3=B3n=20de=20la?= =?UTF-8?q?=20plantilla=20dns=20para=20webdns.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- clases/limites.inc.php | 78 +++++++++++++++--------------- lib/lang/en_new_service_webdns.lng | 2 + lib/lang/es_new_service_webdns.lng | 2 + new_service_webdns.php | 77 +++++++++++++++++++++-------- 4 files changed, 100 insertions(+), 59 deletions(-) diff --git a/clases/limites.inc.php b/clases/limites.inc.php index 634cbf4..3ad7989 100644 --- a/clases/limites.inc.php +++ b/clases/limites.inc.php @@ -56,7 +56,7 @@ class limites { //PARA SABER QUIEN ES UN RESELLER //SELECT client_id, company_name, limit_client FROM client WHERE limit_client > 0 OR limit_client = -1 $this->esReventa = $app->db->queryOneRecord( - "SELECT client_id, limit_client, contact_name + "SELECT client_id, limit_client, contact_name, limit_dns_zone FROM client WHERE limit_client > 0 OR limit_client = -1 AND client_id = ?", $this->cliente['client_id']); @@ -114,19 +114,21 @@ class limites { $this->esRevendedor(); - $sumaTotal = 0; - foreach($this->todosLosGrupos as $grupos) { - $tmpReventaALL = $app->db->queryOneRecord( - "SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", $grupos); - - $sumaTotal += $tmpReventaALL['number']; - } + if($this->esReventa){ + + $sumaTotal = 0; + foreach($this->todosLosGrupos as $grupos) { + $tmpReventaALL = $app->db->queryOneRecord( + "SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", $grupos); + + $sumaTotal += $tmpReventaALL['number']; + } - if($sumaTotal >= $this->cliente["limit_dns_zone"]) { - $app->error($this->esReventa['contact_name'] . '. ' . $app->tform->wordbook["limit_dns_zone_txt"]); - return true; + if($sumaTotal >= $this->cliente["limit_dns_zone"]) { + $app->error($this->esReventa['contact_name'] . '. ' . $app->tform->wordbook["limit_dns_zone_txt"]); + return true; + } } - return false; } } @@ -173,21 +175,21 @@ class limites { } $this->esRevendedor(); + if($this->esReventa){ + $sumaTotal = 0; + foreach($this->todosLosGrupos as $grupos) { + $tmpReventaALL = $app->db->queryOneRecord( + "SELECT count(domain_id) as number FROM web_domain + WHERE sys_groupid = ? and type = 'vhost'", $grupos); + + $sumaTotal += $tmpReventaALL['number']; + } - $sumaTotal = 0; - foreach($this->todosLosGrupos as $grupos) { - $tmpReventaALL = $app->db->queryOneRecord( - "SELECT count(domain_id) as number FROM web_domain - WHERE sys_groupid = ? and type = 'vhost'", $grupos); - - $sumaTotal += $tmpReventaALL['number']; - } - - if($sumaTotal >= $this->cliente["limit_web_domain"]) { - $app->error($this->esReventa['contact_name'] . '. ' . $app->tform->wordbook["limit_web_domain_txt"]); - return true; + if($sumaTotal >= $this->cliente["limit_web_domain"]) { + $app->error($this->esReventa['contact_name'] . '. ' . $app->tform->wordbook["limit_web_domain_txt"]); + return true; + } } - return false; } } @@ -234,21 +236,21 @@ class limites { } $this->esRevendedor(); + if($this->esReventa){ + $sumaTotal = 0; + foreach($this->todosLosGrupos as $grupos) { + $tmpReventaALL = $app->db->queryOneRecord( + "SELECT count(database_id) as number + FROM web_database WHERE sys_groupid = ?", $grupos); + + $sumaTotal += $tmpReventaALL['number']; + } - $sumaTotal = 0; - foreach($this->todosLosGrupos as $grupos) { - $tmpReventaALL = $app->db->queryOneRecord( - "SELECT count(database_id) as number - FROM web_database WHERE sys_groupid = ?", $grupos); - - $sumaTotal += $tmpReventaALL['number']; - } - - if($sumaTotal >= $this->cliente["limit_database"]) { - $app->error($this->esReventa['contact_name'] . '. ' . $app->tform->wordbook["limit_database_txt"]); - return true; + if($sumaTotal >= $this->cliente["limit_database"]) { + $app->error($this->esReventa['contact_name'] . '. ' . $app->tform->wordbook["limit_database_txt"]); + return true; + } } - return false; } } diff --git a/lib/lang/en_new_service_webdns.lng b/lib/lang/en_new_service_webdns.lng index 3cc30b3..73cfeb8 100755 --- a/lib/lang/en_new_service_webdns.lng +++ b/lib/lang/en_new_service_webdns.lng @@ -187,9 +187,11 @@ $wb['error_dominio_mas_puntos'] = 'El dominio no es correcto, hay 3 puntos o má $wb['error_dominio_www'] = 'El dominio no es correcto. No escriba "www" antes del dominio.'; $wb['error_no_existe_dominio_padre'] = 'El dominio padre para este subdominio, no existe.'; $wb['error_no_ip'] = 'Necesita añadir en la configuración '; +$wb['error_no_servidor_default'] = 'Necesita configurar un servidor por defecto para '; $wb['error_subdominio_existe'] = 'Este subdominio existe.'; $wb['error_sitio_web_existe'] = 'El dominio que intenta crear ya tiene sitio web.'; $wb['error_activado_servidor'] = 'Necesita activar en la configuración del servidor '; +$wb['error_plantilla_webdns'] = 'Necesita la plantilla dns para webdns.'; $wb["database_user_txt"] = 'Database user'; $wb["database_password_txt"] = 'Database password'; $wb["password_strength_txt"] = 'Password strength'; diff --git a/lib/lang/es_new_service_webdns.lng b/lib/lang/es_new_service_webdns.lng index fc14fcc..db33cef 100755 --- a/lib/lang/es_new_service_webdns.lng +++ b/lib/lang/es_new_service_webdns.lng @@ -187,9 +187,11 @@ $wb['error_dominio_mas_puntos'] = 'El dominio no es correcto, hay 3 puntos o má $wb['error_dominio_www'] = 'El dominio no es correcto. No escriba "www" antes del dominio.'; $wb['error_no_existe_dominio_padre'] = 'El dominio padre para este subdominio, no existe.'; $wb['error_no_ip'] = 'Necesita añadir en la configuración '; +$wb['error_no_servidor_default'] = 'Necesita configurar un servidor por defecto para '; $wb['error_subdominio_existe'] = 'Este subdominio existe.'; $wb['error_sitio_web_existe'] = 'El dominio que intenta crear ya tiene sitio web.'; $wb['error_activado_servidor'] = 'Necesita activar en la configuración del servidor '; +$wb['error_plantilla_webdns'] = 'Necesita la plantilla dns para webdns.'; $wb['database_user_txt'] = 'Usuario de la base de datos'; $wb['database_password_txt'] = 'Contraseña de la base de datos'; $wb['password_strength_txt'] = 'Fortaleza de la contraseña'; diff --git a/new_service_webdns.php b/new_service_webdns.php index d213582..59be745 100755 --- a/new_service_webdns.php +++ b/new_service_webdns.php @@ -572,13 +572,15 @@ class page_action extends tform_actions { //Captura de los distintos ids del cliente y usuario de sistema. //combinando un query a las dos tablas sys_group y sys_user que comparten el client_id. + //print "
Seleccionado: "; print_r($fields['client_group_id']); print "
\n"; if($fields['client_group_id']==0) { - //En la tabla sys_user el userid 1 es admin. No esta en sys_group. - $this->cli_id = 1; + + //En la tabla sys_user el client_id 0 es admin. En sys_group este valor es 0 + $this->cli_id = 0; //En la tabla dns_soa y dns_rr se guarda el valor 0 en sys_groupid cuando es admin. $this->cli_grupo_id = 0; - $this->sys_usuario_id = $this->cli_id; - $this->sys_grupo_id = $this->cli_grupo_id; + $this->sys_usuario_id = 1;//$this->cli_id; + $this->sys_grupo_id = 0;//$this->cli_grupo_id; }else{ $client = $app->db->queryOneRecord( 'SELECT sys_user.sys_userid, sys_user.sys_groupid, sys_user.default_group, sys_user.client_id @@ -589,7 +591,10 @@ class page_action extends tform_actions { $this->cli_grupo_id = $client['default_group']; $this->sys_usuario_id = $client['sys_userid']; $this->sys_grupo_id = $client['sys_groupid']; - } + } + //print "
Valores : "; print_r($this->cli_id); print "
\n"; + //print "Valores " . $this->cli_id . ' ' . $this->cli_grupo_id . ' ' . $this->sys_usuario_id . ' ' . $this->sys_grupo_id; + } //Crear subdominio @@ -788,17 +793,32 @@ class page_action extends tform_actions { $global_config_sitio = $app->getconf->get_global_config('sites'); $global_config_dns = $app->getconf->get_global_config('dns'); + if(!$global_config_dns['default_dnsserver']) { + $app->tform->errorMessage = $app->tform->wordbook['error_no_servidor_default']. 'DNS.'; + $this->onError(); + return true; + } else if(!$global_config_sitio['default_webserver']) { + $app->tform->errorMessage = $app->tform->wordbook['error_no_servidor_default']. 'WEB.'; + $this->onError(); + return true; + } else if(!$global_config_sitio['default_dbserver']) { + $app->tform->errorMessage = $app->tform->wordbook['error_no_servidor_default']. 'DB.'; + $this->onError(); + return true; + } + //print "
WEB SERVER por defecto ";print_r($global_config_sitio);print "
\n"; //print "
DNS SERVER por defecto ";print_r($global_config_dns);print "
\n"; //El cliente 1 es admin. //Recupero los servidores asignados por defecto y se los asigno a admin o al usuario //que no tenga asignado ninguno. - if($this->cli_id == 1) { + if($this->cli_id == 0) { $this->dns_serv = $global_config_dns['default_dnsserver'];//1; $this->web_serv = $global_config_sitio['default_webserver'];//1; $this->bbdd_serv = $global_config_sitio['default_dbserver'];//1; $this->ftp_serv = $global_config_sitio['default_webserver'];//1; + //print "
tieneServidorIPs el cli_id "; print_r($this->cli_id . ' el servidor ' . $this->dns_serv); print "
\n"; }else{ $servidores = $app->db->queryOneRecord( "SELECT client_id, dns_servers, web_servers, db_servers FROM client @@ -835,7 +855,7 @@ class page_action extends tform_actions { //El cliente 1 es admin //Captura de las ips del servidor dns - if($this->cli_id == 1){ + if($this->cli_id == 0){ //Compruebo si hay datos para el client_id 0 y si no existe pruebo con el 1. //Alguno de los dos tiene que existir por configuración de ispconfig. $this->ip4_servidor_dns = $app->db->queryOneRecord( @@ -899,7 +919,7 @@ class page_action extends tform_actions { } //Captura de las ips del servidor web - if($this->cli_id == 1){ + if($this->cli_id == 0){ //Compruebo si hay datos para el client_id 0 y si no existe pruebo con el 1. //Alguno de los dos tiene que existir por configuración de ispconfig. $this->ip4_servidor_web = $app->db->queryOneRecord( @@ -909,7 +929,7 @@ class page_action extends tform_actions { 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "0" AND server_id = "'.$this->web_serv.'" AND ip_type="IPv6"'); - if(!$this->ip4_servidor_web){ + /*if(!$this->ip4_servidor_web){ $this->ip4_servidor_web = $app->db->queryOneRecord( 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "1" AND server_id = "'.$this->web_serv.'" AND ip_type="IPv4"'); @@ -918,7 +938,7 @@ class page_action extends tform_actions { $this->ip6_servidor_web = $app->db->queryOneRecord( 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "1" AND server_id = "'.$this->web_serv.'" AND ip_type="IPv6"'); - } + }*/ }else{//Comprobamos si el cliente tiene servidor asignado $this->ip4_servidor_web = $app->db->queryOneRecord( 'SELECT ip_type, ip_address @@ -935,26 +955,26 @@ class page_action extends tform_actions { 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "0" AND server_id = "'.$this->web_serv.'" AND ip_type="IPv4"'); - if(!$this->ip4_servidor_web){ + /*if(!$this->ip4_servidor_web){ $this->ip4_servidor_web = $app->db->queryOneRecord( 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "1" AND server_id = "'.$this->web_serv.'" AND ip_type="IPv4"'); - } + }*/ } if(!$this->ip6_servidor_web){ $this->ip6_servidor_web = $app->db->queryOneRecord( 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "0" AND server_id = "'.$this->web_serv.'" AND ip_type="IPv6"'); - if(!$this->ip6_servidor_web){ + /*if(!$this->ip6_servidor_web){ $this->ip6_servidor_web = $app->db->queryOneRecord( 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "1" AND server_id = "'.$this->web_serv.'" AND ip_type="IPv6"'); - } + }*/ } } //Captura de las ips del servidor bbdd - if($this->cli_id == 1){ + if($this->cli_id == 0){ //Compruebo si hay datos para el client_id 0 y si no existe pruebo con el 1. //Alguno de los dos tiene que existir por configuración de ispconfig. $this->ip4_servidor_bbdd = $app->db->queryOneRecord( @@ -964,7 +984,7 @@ class page_action extends tform_actions { 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "0" AND server_id = "'.$this->bbdd_serv.'" AND ip_type="IPv6"'); - if(!$this->ip4_servidor_bbdd){ + /*if(!$this->ip4_servidor_bbdd){ $this->ip4_servidor_bbdd = $app->db->queryOneRecord( 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "1" AND server_id = "'.$this->bbdd_serv.'" AND ip_type="IPv4"'); @@ -973,7 +993,7 @@ class page_action extends tform_actions { $this->ip6_servidor_bbdd = $app->db->queryOneRecord( 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "1" AND server_id = "'.$this->bbdd_serv.'" AND ip_type="IPv6"'); - } + }*/ }else{//Comprobamos si el cliente tiene servidor asignado $this->ip4_servidor_bbdd = $app->db->queryOneRecord( 'SELECT ip_type, ip_address @@ -993,22 +1013,22 @@ class page_action extends tform_actions { 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "0" AND server_id = "'.$this->bbdd_serv.'" AND ip_type="IPv4"'); - if(!$this->ip4_servidor_bbdd){ + /*if(!$this->ip4_servidor_bbdd){ $this->ip4_servidor_bbdd = $app->db->queryOneRecord( 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "1" AND server_id = "'.$this->bbdd_serv.'" AND ip_type="IPv4"'); - } + }*/ } if(!$this->ip6_servidor_bbdd){ $this->ip6_servidor_bbdd = $app->db->queryOneRecord( 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "0" AND server_id = "'.$this->bbdd_serv.'" AND ip_type="IPv6"'); - if(!$this->ip6_servidor_bbdd){ + /*if(!$this->ip6_servidor_bbdd){ $this->ip6_servidor_bbdd = $app->db->queryOneRecord( 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "1" AND server_id = "'.$this->bbdd_serv.'" AND ip_type="IPv6"'); - } + }*/ } } //para el servidor ftp no se hacen comprobaciones @@ -1184,6 +1204,17 @@ class page_action extends tform_actions { //} return false; } + + //Comprobación de que tenemos instalada nuestra plantilla + function plantillaWebDNS(){ + global $app; + + if(!$app->db->queryOneRecord("SELECT name FROM dns_template WHERE name = 'webdns'")) { + $app->tform->errorMessage = $app->tform->wordbook['error_plantilla_webdns']; + $this->onError(); + return true; + } + } //Comprueba que no exista el dominio y que no tenga sitio web, puede tener sitio web y no tener dns. function existeDominio($campos){ @@ -1432,6 +1463,10 @@ print "
IP6 WEB ";print_r($this->ip6_servidor_web);print "
\n";*/ function onSubmit() { global $app, $conf; + + if($this->plantillaWebDNS()){ + return; + } //Carga de campos del formulario. $fields = $app->tform->encode($this->dataRecord, $app->tform->getCurrentTab(), true);