diff --git a/clases/limites.inc.php b/clases/limites.inc.php index 1c88275..cc9f723 100755 --- a/clases/limites.inc.php +++ b/clases/limites.inc.php @@ -32,7 +32,7 @@ class limites { $this->cliente_grupo_id = $cliente_group_id; } - + //Comprobaciones en la carga del formulario. public function limitesLoad(){ global $app; @@ -89,7 +89,7 @@ class limites { public $esReventa; public $todosLosGrupos; //public $gruposDelReventa; - + //Comprobamos si es un reventa. public function esRevendedor(){ global $app, $conf; //PARA SABER QUIEN ES UN RESELLER @@ -127,7 +127,7 @@ class limites { //* 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']); diff --git a/new_service_webdns.php b/new_service_webdns.php index e2dab47..c4c5aec 100755 --- a/new_service_webdns.php +++ b/new_service_webdns.php @@ -402,7 +402,7 @@ class page_action extends tform_actions { //$app->uses('remoting_lib'); //$app->remoting_lib->loadFormDef('../sites/form/web_vhost_domain.tform.php'); //IMPORTANTE. AL NO PODER USAR LA FUNCION getDataRecord YA QUE NOS HACE ADMIN. - //TENGO QUE LANZAR LA FUNCION sites_ftp_user_after_insert PARA SOLUCIONAR ESTE PROBLEMA. + //TENGO QUE LANZAR LA FUNCION sites_ftp_user_after_insert PARA SOLUCIONAR ESTE PROBLEMA Y NO getDataRecord(). //$site_data = $app->remoting_lib->getDataRecord($sitio_id); //$site_data = $remoto->getDataRecordWebDNS($sitio_id); @@ -441,7 +441,7 @@ class page_action extends tform_actions { //Register for the events. NO FUNCIONA. $app->plugin->registerEvent('sites:ftp_user:on_after_insert'); - //Lo lanzo yo. + //LO LANZAMOS DE NUESTRA FUNCION EXTRAIDA Y MODIFICADA DEL PLUGING QUE SE TENDRÍA QUE EJECUTAR PERO NO LO HACE.WHY? $remoto->sites_ftp_user_after_insert(); echo '

@@ -546,6 +546,7 @@ class page_action extends tform_actions { public $sys_usuario_id; public $sys_grupo_id; + //Control del usuario logeado y captura de sus variables de systema. function controlUserGrupoId(){ global $app, $conf; @@ -653,8 +654,6 @@ class page_action extends tform_actions { $this->subdom_error = true; $app->tform->errorMessage = $app->tform->wordbook['error_no_existe_dominio_padre']; $this->onError(); - //return; - //print 'No existe el dominio'; return $this->subdom_error; } else { @@ -772,6 +771,7 @@ class page_action extends tform_actions { $app->tform->loadFormDef($tform_def_file); } + public $ip4_servidor_dns; public $ip6_servidor_dns; public $ip4_servidor_web; @@ -785,6 +785,7 @@ class page_action extends tform_actions { public $bbdd_serv; public $ftp_serv; + function tieneServidorIPs(){ global $app, $conf; @@ -831,20 +832,20 @@ class page_action extends tform_actions { //para el ftp el servidor es el mismo que para el sitio web. $this->ftp_serv = $servidores['web_servers']; - //Si el cliente no tiene asignado un servidor se añade por defecto al 1 + //Si el cliente no tiene asignado un servidor se añade por defecto al que hay en la configuración por defecto if(!$this->dns_serv){ $this->dns_serv = $global_config_dns['default_dnsserver'];//1; } - //Si el cliente no tiene asignado un servidor se añade por defecto al 1 + //Si el cliente no tiene asignado un servidor se añade por defecto al que hay en la configuración por defecto if(!$this->web_serv){ $this->web_serv = $global_config_sitio['default_webserver'];//1; } - //Si el cliente no tiene asignado un servidor se añade por defecto al 1 + //Si el cliente no tiene asignado un servidor se añade por defecto al que hay en la configuración por defecto if(!$this->bbdd_serv){ $this->bbdd_serv = $global_config_sitio['default_dbserver'];//1; } - //Si el cliente no tiene asignado un servidor se añade por defecto al 1 + //Si el cliente no tiene asignado un servidor se añade por defecto al que hay en la configuración por defecto if(!$this->ftp_serv){ $this->ftp_serv = $global_config_sitio['default_webserver'];//1; } @@ -858,7 +859,7 @@ class page_action extends tform_actions { //Captura de las ips del servidor dns 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. + //Alguno de los dos tiene que existir por configuración de ispconfig. $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"'); @@ -1173,36 +1174,6 @@ class page_action extends tform_actions { return true; } - /*$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; } @@ -1254,12 +1225,12 @@ class page_action extends tform_actions { "SELECT * FROM dns_template WHERE visible = 'Y' AND name = 'webdns'"); /*'open6hosting'");*/ -/*print "
DNS SERVER ";print_r($this->dns_serv);print "
\n"; -print "
WEB SERVER ";print_r($this->web_serv);print "
\n"; -print "
IP4 DNS ";print_r($this->ip4_servidor_dns);print "
\n"; -print "
IP6 DNS ";print_r($this->ip6_servidor_dns);print "
\n"; -print "
IP4 WEB ";print_r($this->ip4_servidor_web);print "
\n"; -print "
IP6 WEB ";print_r($this->ip6_servidor_web);print "
\n";*/ + /*print "
DNS SERVER ";print_r($this->dns_serv);print "
\n"; + print "
WEB SERVER ";print_r($this->web_serv);print "
\n"; + print "
IP4 DNS ";print_r($this->ip4_servidor_dns);print "
\n"; + print "
IP6 DNS ";print_r($this->ip6_servidor_dns);print "
\n"; + print "
IP4 WEB ";print_r($this->ip4_servidor_web);print "
\n"; + print "
IP6 WEB ";print_r($this->ip6_servidor_web);print "
\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){ @@ -1287,7 +1258,7 @@ print "
IP6 WEB ";print_r($this->ip6_servidor_web);print "
\n";*/ $tpl_content = str_replace('{IPV6}', $this->ip6_ultima['ip_address'], /*$dns_ip_servidor_ipv6['ip_address'],*/ $tpl_content); - $enable_dnssec = 'N';//(($_POST['dns_dnssec'] == 'Y') ? 'Y' : 'N'); + $enable_dnssec = 'N'; // Parse the template $tpl_rows = explode("\n", $tpl_content); @@ -1350,7 +1321,7 @@ print "
IP6 WEB ";print_r($this->ip6_servidor_web);print "
\n";*/ "sys_perm_user" => 'riud', "sys_perm_group" => 'riud', "sys_perm_other" => '', - "server_id" => $this->dns_serv, //$dns_servidor,//$server_id,//$dns_servidor, //$server_id,//$dns_servidor['default_dnsserver'], + "server_id" => $this->dns_serv, "origin" => $origin, "ns" => $ns, "mbox" => $mbox, @@ -1478,7 +1449,6 @@ print "
IP6 WEB ";print_r($this->ip6_servidor_web);print "
\n";*/ //print('la ssessison es ' .$ssionId); //print_r($sesionesLog2); - //echo('(Sub)Prefix ' . $this->valor_prefix . '(Sub)Prefix ftp ' . $this->valor_prefix_ftp ); if($this->plantillaWebDNS()){ return; } @@ -1488,8 +1458,6 @@ print "
IP6 WEB ";print_r($this->ip6_servidor_web);print "
\n";*/ //Creo la clase remote para usar las librerias $remote = new remote_actions; - /*$sitiosBoom = new sitios_remoting; - $sitiosBoom->test();*/ if($this->tieneServidorIPs()){ return; @@ -1520,62 +1488,37 @@ print "
IP6 WEB ";print_r($this->ip6_servidor_web);print "
\n";*/ return; } - /*echo ('Lo seleccionado ' . $fields['client_group_id'] . "
"); - echo ('Tabla sys_group --> client id ' . $this->cli_id . "
"); - echo ('Tabla sys_group --> groupid ' . $this->cli_grupo_id . "
"); - - echo ('Tabla sys_user --> userid ' . $this->sys_usuario_id . "
"); - echo ('Tabla sys_user --> sys_groupid ' . $this->sys_grupo_id . "
");*/ - //print "Subdomino: " . $this->subdomino . "

\n Dominio: " . $this->domino; if($this->comprobarSubDominios($fields['domain'])){ $this->crearSubDominio($remote, $fields['domain']); if(!$this->subdom_error){ $this->crearSitioWebSubdominio($remote); - - //if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])){ - // $this->crearBaseDatosFtpClientes($remote); - //}else{ - $this->crearBaseDatosFtp($remote); - //} + $this->crearBaseDatosFtp($remote); } } else { if(!$this->dominio_error){ $this->crearDnsSitioWeb($remote); - //$variablePHP = ""; //Si todo va bien, el resultado de la web y dns echo '

Altas Web y DNS del dominio '.$fields['domain'].', ¡Creadas correctamente!


'; - //IMPORTANTE, es necesario cargar nuestro formulario para poder ejecutar la función que crea - //la base de datos y el ftp ya que hay datos que tomamos de el antes de ejecutarla. - $app->tform->loadFormDef('form/new_service_webdns.tform.php'); - //if(!$app->auth->is_admin()){ - //if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])){ - //$this->crearBaseDatosFtpClientes($remote); - //}else{ - //echo('Esto es mental ' . $app->auth->is_admin()); - $this->crearBaseDatosFtp($remote); - //} - //} + //IMPORTANTE, es necesario cargar nuestro formulario para poder ejecutar la función que crea + //la base de datos y el ftp ya que hay datos que tomamos de el antes de ejecutarla. + $app->tform->loadFormDef('form/new_service_webdns.tform.php'); + + $this->crearBaseDatosFtp($remote); + }else{ $this->onError(); return; } } - //parent::onSubmit(); } } -/*class sitios_remoting extends remoting_sites { - public function test(){ - echo('Texto test'); - } -}*/ - class remote_actions extends remoting { public function insert_query($formdef_file, $client_id, $params, $event_identifier = '') { @@ -1589,7 +1532,9 @@ class remote_actions extends remoting { //echo(' insertQueryPrepare ' . $this->insertQueryExecute($sql, $params, $event_identifier)); return $this->insertQueryWebDNS($formdef_file, $client_id, $params, $event_identifier); } - + //------------------------------------------------------------------------------------------------------------ + //IMPORTANTE. FUNCIONES EXTRAIDAS Y MODIFICADAS DE ISPCONFIG PARA SOLUCIONAR EL PROBLEMA DE AUTOLOGEO A ADMIN. + //------------------------------------------------------------------------------------------------------------ function insertQueryWebDNS($formdef_file, $client_id, $params, $event_identifier = '') { //$sql = $app->remoting->insertQueryPrepare($formdef_file, $client_id, $params); $sql = $this->insertQueryPrepareWebDNS($formdef_file, $client_id, $params); @@ -1829,7 +1774,9 @@ class remote_actions extends remoting { return $sql; } } - + //---------------------------------------------------------------------------------- + //IMPORTANTE. ESTA FUNCION ES COMO LO HACE ISPCONFIG NO EXTRAIDA PERO SI MODIFICADA. + //---------------------------------------------------------------------------------- public function sites_database_add($client_id, $params){ global $app, $conf; @@ -1878,61 +1825,11 @@ $page->onLoad(); //IMPORTENTE, es necesario estas lí­neas para que el botón del pdf funcione. Activa el javascript //echo ''; - ?>