From 986c06492731ba723dd23daf43b6415844aaa51e Mon Sep 17 00:00:00 2001 From: David Ramos Date: Thu, 21 Dec 2017 16:39:44 +0100 Subject: [PATCH] =?UTF-8?q?Implementaci=C3=B3n=20del=20control=20para=20sa?= =?UTF-8?q?ber=20si=20todos=20los=20servidores=20tienen=20activados=20los?= =?UTF-8?q?=20servicios=20necesarios=20dns,=20web,=20db=20y=20ftp.=20Creac?= =?UTF-8?q?i=C3=B3n=20del=20texto=20para=20los=20distintos=20errores=20pos?= =?UTF-8?q?ibles.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/lang/en_new_service_webdns.lng | 1 + lib/lang/es_new_service_webdns.lng | 1 + new_service_webdns.php | 56 ++++++++++++++++++++++++------ 3 files changed, 48 insertions(+), 10 deletions(-) diff --git a/lib/lang/en_new_service_webdns.lng b/lib/lang/en_new_service_webdns.lng index a51d626..46686d4 100755 --- a/lib/lang/en_new_service_webdns.lng +++ b/lib/lang/en_new_service_webdns.lng @@ -186,6 +186,7 @@ $wb['error_no_existe_dominio_padre'] = 'El dominio padre para este subdominio, n $wb['error_no_ip'] = 'No tiene ip, necesita añadirla en la configuración.'; $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["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 6d52d98..cd459d9 100755 --- a/lib/lang/es_new_service_webdns.lng +++ b/lib/lang/es_new_service_webdns.lng @@ -186,6 +186,7 @@ $wb['error_no_existe_dominio_padre'] = 'El dominio padre para este subdominio, n $wb['error_no_ip'] = 'No tiene ip, necesita añadirla en la configuración.'; $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['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 19d8998..eea63ce 100755 --- a/new_service_webdns.php +++ b/new_service_webdns.php @@ -448,10 +448,10 @@ class page_action extends tform_actions { ); $this->usuario_ftp_txt = $ftp_params['username']; $this->pass_ftp_txt = $ftp_params['password']; - //print "
"; print_r($ftp_params); print "
\n"; - //print "
"; print_r($site_data); print "
\n"; - //echo('El usuario es ' . $fields['client_group_id']); - $remoto->insert_query('../sites/form/ftp_user.tform.php', $fields['client_group_id'], $ftp_params); + /*print "
"; print_r($ftp_params); print "
\n"; + print "
"; print_r($site_data); print "
\n"; + echo('El usuario es ' . $fields['client_group_id']);*/ + //$remoto->insert_query('../sites/form/ftp_user.tform.php', $fields['client_group_id'], $ftp_params); echo '

Altas de BBDD y FTP, ¡Correctas!

@@ -828,6 +828,43 @@ class page_action extends tform_actions { $site_id = $remoto->insert_query('../sites/form/web_vhost_domain.tform.php', $this->cli_id, $paramsite, 'sites:web_vhost_domain:on_after_insert'); } + function servidoresActivados(){ + global $app, $conf; + + $servidores = $app->db->queryAllRecords( + 'SELECT server_id, server_name, web_server, dns_server, file_server, db_server FROM server'); + + foreach($servidores as $servidor){ + $serv_web = $servidor['web_server']; + $serv_dns = $servidor['dns_server']; + $serv_ftp = $servidor['file_server']; + $serv_db = $servidor['db_server']; + $nombre_server = $servidor['server_name']; + //print "
Todos los servidores ";print_r($servidor);print "
\n"; + //Si alguno de los servidores no esta activo, mostramos error. + if($serv_web == 0){ + $app->tform->errorMessage = $app->tform->wordbook['error_activado_servidor'] . $nombre_server . ' el servicio WEB'; + $this->onError(); + return true; + } else if($serv_dns == 0){ + $app->tform->errorMessage = $app->tform->wordbook['error_activado_servidor'] . $nombre_server . ' el servicio DNS'; + $this->onError(); + return true; + } else if($serv_ftp == 0){ + $app->tform->errorMessage = $app->tform->wordbook['error_activado_servidor'] . $nombre_server . ' el servicio FTP'; + $this->onError(); + return true; + } else if($serv_db == 0){ + $app->tform->errorMessage = $app->tform->wordbook['error_activado_servidor'] . $nombre_server . ' el servicio DB'; + $this->onError(); + return true; + } + + } + return false; + } + + public $ip4_servidor_dns; public $ip6_servidor_dns; public $ip4_servidor_web; @@ -845,7 +882,7 @@ class page_action extends tform_actions { global $app, $conf; $this->controlUserGrupoId(); - + //El cliente 1 es admin. if($this->cli_id == 1) { $this->dns_serv = 1; @@ -894,9 +931,6 @@ class page_action extends tform_actions { $this->ip4_servidor_dns = $app->db->queryOneRecord( 'SELECT ip_type, ip_address FROM server_ip WHERE client_id = "1" AND server_id = "'.$this->dns_serv.'" AND ip_type="IPv4"'); - /*$this->ip6_servidor_dns = $app->db->queryOneRecord( - 'SELECT ip_type, ip_address FROM server_ip - WHERE client_id = "1" AND server_id = "'.$this->dns_serv.'" AND ip_type="IPv6"');*/ } if(!$this->ip6_servidor_dns){ $this->ip6_servidor_dns = $app->db->queryOneRecord( @@ -982,7 +1016,6 @@ class page_action extends tform_actions { $this->ip4_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="IPv4"'); - //$this->ip6_servidor_dns = $app->db->queryOneRecord('SELECT ip_type, ip_address FROM server_ip WHERE client_id = "0" AND ip_type="IPv6"'); if(!$this->ip4_servidor_web){ $this->ip4_servidor_web = $app->db->queryOneRecord( @@ -1041,7 +1074,6 @@ class page_action extends tform_actions { $this->ip4_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="IPv4"'); - //$this->ip6_servidor_bbdd = $app->db->queryOneRecord('SELECT ip_type, ip_address FROM server_ip WHERE client_id = "0" AND ip_type="IPv6"'); if(!$this->ip4_servidor_bbdd){ $this->ip4_servidor_bbdd = $app->db->queryOneRecord( @@ -1435,6 +1467,10 @@ print "
IP6 WEB ";print_r($this->ip6_servidor_web);print "
\n";*/ //Creo la clase remote para usar las librerias $remote = new remote_actions; + if($this->servidoresActivados()){ + return; + } + if($this->tieneServidorIPs()){ return; }