| @@ -642,13 +642,13 @@ class page_action extends tform_actions { | |||
| $camDnsRR = $app->db->queryOneRecord('SELECT server_id, zone FROM dns_rr WHERE name LIKE "'.$this->dominio.'."'); | |||
| //Para los registros tipo A la ip tiene que ser tipo IPv4 | |||
| $camServIP = $app->db->queryOneRecord( | |||
| /* $camServIP = $app->db->queryOneRecord( | |||
| "SELECT ip_address FROM server_ip | |||
| WHERE server_id = ".$camDnsRR['server_id']." AND ip_type='IPv4'"); | |||
| */ | |||
| //print_r($camDominio); | |||
| //print_r($camDnsRR); | |||
| $this->ip4_ultima = $this->ip4_servidor_dns['ip_address']; | |||
| //Si el dominio NO existe mostramos mensaje de error y salimos de la ejecución | |||
| if(!$camDominio['origin']){ | |||
| $this->subdom_error = true; | |||
| @@ -663,7 +663,7 @@ class page_action extends tform_actions { | |||
| 'zone' => $camDnsRR['zone'], | |||
| 'name' => $this->subdominio, | |||
| 'type' => 'a', | |||
| 'data' => $camServIP['ip_address'], | |||
| 'data' => $this->ip4_ultima, //$camServIP['ip_address'], | |||
| //'aux' => '0', | |||
| 'ttl' => '3600', | |||
| 'active' => 'y', | |||
| @@ -857,23 +857,21 @@ class page_action extends tform_actions { | |||
| //Captura de las ips del servidor dns de la variable global para ello. | |||
| $global_dns_config = $app->getconf->get_server_config($this->dns_serv, 'server'); | |||
| /* $global_dns_config = $app->getconf->get_server_config($this->dns_serv, 'server'); | |||
| $this->ip4_servidor_dns = $global_dns_config['ip_address']; | |||
| $this->ip6_servidor_dns = $global_dns_config['v6_prefix'];*/ | |||
| //El cliente 1 es admin | |||
| // if($this->cli_id == 0){ | |||
| $this->ip4_servidor_dns = $global_dns_config['ip_address']; | |||
| $this->ip6_servidor_dns = $global_dns_config['v6_prefix']; | |||
| 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( | |||
| $this->ip4_servidor_dns = $app->db->queryOneRecord( | |||
| 'SELECT ip_type, ip_address FROM server_ip | |||
| WHERE client_id = "0" AND server_id = "'.$this->dns_serv.'" AND ip_type="IPv4"');*/ | |||
| /* $this->ip6_servidor_dns = $app->db->queryOneRecord( | |||
| WHERE client_id = "0" 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 = "0" AND server_id = "'.$this->dns_serv.'" AND ip_type="IPv6"'); | |||
| */ | |||
| /*if(!$this->ip4_servidor_dns){ | |||
| $this->ip4_servidor_dns = $app->db->queryOneRecord( | |||
| 'SELECT ip_type, ip_address FROM server_ip | |||
| @@ -882,13 +880,13 @@ class page_action extends tform_actions { | |||
| /* if(!$this->ip6_servidor_dns){ | |||
| $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"'); | |||
| } | |||
| WHERE client_id = "1" AND server_id = "'.$this->dns_serv.'" AND ip_type="IPv6"');*/ | |||
| //} | |||
| }else{ | |||
| $this->ip4_servidor_dns = $global_dns_config['ip_address']; | |||
| // $this->ip4_servidor_dns = $global_dns_config['ip_address']; | |||
| //Comprobamos si el cliente tiene servidor asignado, si no lo tiene asignamos el que admin a seleccionado | |||
| //para este servidor. | |||
| /*$this->ip4_servidor_dns = $app->db->queryOneRecord( | |||
| $this->ip4_servidor_dns = $app->db->queryOneRecord( | |||
| 'SELECT ip_type, ip_address | |||
| FROM server_ip | |||
| WHERE client_id = "'.$this->cli_id.'" AND server_id = "'.$this->dns_serv.'" AND ip_type="IPv4"'); | |||
| @@ -897,13 +895,14 @@ class page_action extends tform_actions { | |||
| FROM server_ip | |||
| WHERE client_id = "'.$this->cli_id.'" AND server_id = "'.$this->dns_serv.'"AND ip_type="IPv6"'); | |||
| //echo(' la ip6 ' . $this->ip6_ultima); | |||
| //si no tiene asignado le damos el de admin. | |||
| if(!$this->ip4_servidor_dns){ | |||
| $this->ip4_servidor_dns = $global_dns_config['ip_address']; | |||
| /* if(!$this->ip4_servidor_dns){ | |||
| // $this->ip4_servidor_dns = $global_dns_config['ip_address']; | |||
| //Compruebo si hay datos para el client_id 0 y si no existe pruebo con el 1. Es admin ya que este cliente no tiene ip4 ni ip6 asignadas | |||
| //Tomamos las de admin. | |||
| //Alguno de los dos tiene que existir por configuración de ispconfig. | |||
| /*$this->ip4_servidor_dns = $app->db->queryOneRecord( | |||
| $this->ip4_servidor_dns = $app->db->queryOneRecord( | |||
| 'SELECT ip_type, ip_address FROM server_ip | |||
| WHERE client_id = "0" AND server_id = "'.$this->dns_serv.'" AND ip_type="IPv4"'); | |||
| @@ -911,10 +910,10 @@ 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"'); | |||
| }*/ | |||
| } | |||
| //} | |||
| /* if(!$this->ip6_servidor_dns){ | |||
| }*/ | |||
| if(!$this->ip6_servidor_dns){ | |||
| //Compruebo si hay datos para el client_id 0 y si no existe pruebo con el 1. Es admin ya que este cliente no tiene ip4 ni ip6 asignadas | |||
| //Tomamos las de admin. | |||
| //Alguno de los dos tiene que existir por configuración de ispconfig. | |||
| @@ -929,7 +928,8 @@ class page_action extends tform_actions { | |||
| WHERE client_id = "1" AND server_id = "'.$this->dns_serv.'" AND ip_type="IPv6"'); | |||
| } | |||
| } | |||
| }*/ | |||
| $this->ip6_ultima = $this->ip6_servidor_dns['ip_address']; | |||
| } | |||
| //Captura de las ips del servidor web | |||
| if($this->cli_id == 0){ | |||
| @@ -1057,9 +1057,14 @@ class page_action extends tform_actions { | |||
| print "<pre>IP4 BBDD ";print_r($this->ip4_servidor_bbdd);print "</pre>\n"; | |||
| print "<pre>IP6 BBDD ";print_r($this->ip6_servidor_bbdd);print "</pre>\n"; | |||
| echo('El cliente ' . $this->cli_id . '<br>');*/ | |||
| /* if(!$this->ip4_servidor_dns['ip_address']){ | |||
| if(!$this->ip4_servidor_dns['ip_address']){ | |||
| //si no tiene servidor dns en la lista de ips se toma el servidor por defecto web y se usan sus ips | |||
| $global_web_config = $app->getconf->get_server_config($this->web_serv, 'server'); | |||
| $this->ip4_servidor_dns = $global_web_config; | |||
| //$this->ip6_servidor_dns = $global_web_config; | |||
| $servicio_dns = $app->db->queryOneRecord( | |||
| /*$servicio_dns = $app->db->queryOneRecord( | |||
| 'SELECT server_id, dns_server, server_name FROM server | |||
| WHERE server_id = "'.$this->dns_serv.'"'); | |||
| @@ -1067,11 +1072,17 @@ class page_action extends tform_actions { | |||
| $app->tform->errorMessage = $app->tform->wordbook['error_no_ip']. 'la IP4 para el servidor ' . $nom_serv_dns; | |||
| $this->onError(); | |||
| return true; | |||
| return true;*/ | |||
| } | |||
| if(!$this->ip6_servidor_dns['ip_address']){ | |||
| $servicio_dns = $app->db->queryOneRecord( | |||
| if(!$this->ip6_servidor_dns['ip_address']){ | |||
| //si no tiene servidor dns en la lista de ips se toma el servidor por defecto web y se usan sus ips | |||
| // $global_web_config = $app->getconf->get_server_config($this->web_serv, 'server'); | |||
| //$this->ip4_servidor_dns = $global_web_config; | |||
| // $this->ip6_servidor_dns = $global_web_config['v6_prefix']; | |||
| // $this->ip6_ultima = $this->ip6_servidor_dns; | |||
| //echo(' la ip6 ' . $this->ip6_servidor_dns); | |||
| /* $servicio_dns = $app->db->queryOneRecord( | |||
| 'SELECT server_id, dns_server, server_name FROM server | |||
| WHERE server_id = "'.$this->dns_serv.'"'); | |||
| @@ -1079,19 +1090,24 @@ class page_action extends tform_actions { | |||
| $app->tform->errorMessage = $app->tform->wordbook['error_no_ip']. 'la IP6 para el servidor '. $nom_serv_dns; | |||
| $this->onError(); | |||
| return true; | |||
| }*/ | |||
| return true;*/ | |||
| } | |||
| if(!$this->ip4_servidor_web['ip_address']){ | |||
| $servidor_web = $app->db->queryOneRecord( | |||
| 'SELECT server_id, web_server, server_name FROM server | |||
| WHERE server_id = "'.$this->web_serv.'"'); | |||
| $nom_serv_web = $servidor_web['server_name']; | |||
| $global_web_config = $app->getconf->get_server_config($this->web_serv, 'server'); | |||
| $this->ip4_servidor_web = $global_web_config; | |||
| $app->tform->errorMessage = $app->tform->wordbook['error_no_ip']. 'la IP4 para el servidor ' . $nom_serv_web; | |||
| $this->onError(); | |||
| return true; | |||
| if(!$this->ip4_servidor_web['ip_address']){ | |||
| $servidor_web = $app->db->queryOneRecord( | |||
| 'SELECT server_id, web_server, server_name FROM server | |||
| WHERE server_id = "'.$this->web_serv.'"'); | |||
| $nom_serv_web = $servidor_web['server_name']; | |||
| $app->tform->errorMessage = $app->tform->wordbook['error_no_ip']. 'la IP4 para el servidor ' . $nom_serv_web; | |||
| $this->onError(); | |||
| return true; | |||
| } | |||
| } | |||
| if(!$this->ip6_servidor_web['ip_address']){ | |||
| @@ -1107,15 +1123,20 @@ class page_action extends tform_actions { | |||
| } | |||
| if(!$this->ip4_servidor_bbdd['ip_address']){ | |||
| $servicio_db = $app->db->queryOneRecord( | |||
| 'SELECT server_id, db_server, server_name FROM server | |||
| WHERE server_id = "'.$this->bbdd_serv.'"'); | |||
| $nom_serv_db = $servicio_db['server_name']; | |||
| $global_bbdd_config = $app->getconf->get_server_config($this->bbdd_serv, 'server'); | |||
| $this->ip4_servidor_bbdd = $global_bbdd_config; | |||
| $app->tform->errorMessage = $app->tform->wordbook['error_no_ip']. 'la IP4 para el servidor ' . $nom_serv_db; | |||
| $this->onError(); | |||
| return true; | |||
| if(!$this->ip4_servidor_bbdd['ip_address']){ | |||
| $servicio_db = $app->db->queryOneRecord( | |||
| 'SELECT server_id, db_server, server_name FROM server | |||
| WHERE server_id = "'.$this->bbdd_serv.'"'); | |||
| $nom_serv_db = $servicio_db['server_name']; | |||
| $app->tform->errorMessage = $app->tform->wordbook['error_no_ip']. 'la IP4 para el servidor ' . $nom_serv_db; | |||
| $this->onError(); | |||
| return true; | |||
| } | |||
| } | |||
| if(!$this->ip6_servidor_bbdd['ip_address']){ | |||
| @@ -1244,29 +1265,30 @@ class page_action extends tform_actions { | |||
| print "<pre>IP6 WEB ";print_r($this->ip6_servidor_web);print "</pre>\n";*/ | |||
| //Si el servidor es el que tiene asignado el cliente o el de admin por defecto, le damos esta ip4 | |||
| /* if($this->dns_serv && $this->ip4_servidor_dns){ | |||
| $this->ip4_ultima = $this->ip4_servidor_dns; | |||
| } | |||
| //if($this->dns_serv && $this->ip4_servidor_dns){ | |||
| $this->ip4_ultima = $this->ip4_servidor_dns['ip_address']; | |||
| //} | |||
| //echo(' ips ' . $this->ip4_ultima . ' ip4dns ' . $this->ip4_servidor_dns); | |||
| if($this->dns_serv && $this->ip6_servidor_dns){ | |||
| $this->ip6_ultima = $this->ip6_servidor_dns; | |||
| }*/ | |||
| if($this->web_serv && $this->ip4_servidor_web){ | |||
| $this->ip4_ultima = $this->ip4_servidor_web; | |||
| } | |||
| //if($this->dns_serv && $this->ip6_servidor_dns){ | |||
| $this->ip6_ultima = $this->ip6_servidor_dns['ip_address']; | |||
| //} | |||
| //echo(' ip4 ' . $this->ip4_ultima['ip_address'] . ' ip6 ' . $this->ip6_ultima); | |||
| //if($this->web_serv && $this->ip4_servidor_web){ | |||
| //$this->ip4_ultima = $this->ip4_servidor_dns;//$this->ip4_servidor_web; | |||
| //} | |||
| if($this->web_serv && $this->ip6_servidor_web){ | |||
| $this->ip6_ultima = $this->ip6_servidor_web; | |||
| } | |||
| //if($this->web_serv && $this->ip6_servidor_web){ | |||
| //$this->ip6_ultima = $this->ip4_servidor_dns;//$this->ip6_servidor_web; | |||
| //} | |||
| $tpl_content = $template_record['template']; | |||
| // Reemplazo la variable que nos encontramos en base de datos por el valor que se ha introducido en el formulario | |||
| $tpl_content = str_replace('{DOMAIN}', $fields['domain'], $tpl_content); | |||
| //Carga de los datos en las variables de las ips. | |||
| $tpl_content = str_replace('{IP}', $this->ip4_ultima['ip_address'],/*$dns_ip_servidor['ip_address'],*/ $tpl_content); | |||
| $tpl_content = str_replace('{IPV6}', $this->ip6_ultima['ip_address'], /*$dns_ip_servidor_ipv6['ip_address'],*/ $tpl_content); | |||
| $tpl_content = str_replace('{IP}', $this->ip4_ultima, $tpl_content); | |||
| $tpl_content = str_replace('{IPV6}', $this->ip6_ultima, $tpl_content); | |||
| $enable_dnssec = 'N'; | |||