|
|
@@ -82,31 +82,105 @@ class page_action extends tform_actions { |
|
|
public $pass_ftp_txt; |
|
|
public $pass_ftp_txt; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function generaPass(){ |
|
|
|
|
|
//Cadena de caractares para construir las password. |
|
|
|
|
|
$cadena = "abcdefghijklmnopqrstuvwxyz!@#_ABCDEFGHIJKLMNOPQRSTUVWXYZ23456789"; |
|
|
|
|
|
$cadSpeciales = "!@#_"; |
|
|
|
|
|
|
|
|
|
|
|
//Obtengo la longitud de las cadenas |
|
|
|
|
|
$longitudCadena=strlen($cadena); |
|
|
|
|
|
$longSpeciales = strlen($cadSpeciales); |
|
|
|
|
|
|
|
|
|
|
|
//Variable para la password |
|
|
|
|
|
$pass = ""; |
|
|
|
|
|
//Longitud para la password |
|
|
|
|
|
$longitudPass=13; |
|
|
|
|
|
|
|
|
|
|
|
//Creo la password |
|
|
|
|
|
for($i=1 ; $i<=$longitudPass ; $i++){ |
|
|
|
|
|
//Número aleatorio entre 0 y la longitud de la cadena de caracteres-1 |
|
|
|
|
|
$pos=rand(0,$longitudCadena-1); |
|
|
|
|
|
//Formo la password en cada iteraccion del bucle, añadiendo a la cadena $pass |
|
|
|
|
|
//la letra correspondiente a la posicion $pos en la cadena de caracteres definida. |
|
|
|
|
|
$pass .= substr($cadena,$pos,1); |
|
|
|
|
|
//Añado algún caracter especial en los últimos cuatro caracteres |
|
|
|
|
|
for($i2=13;$i2<=$i; $i2++){ |
|
|
|
|
|
$poSpecial=rand(0,$longSpeciales-1); |
|
|
|
|
|
$pass .= substr($cadSpeciales, $poSpecial, 1); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return $pass; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*function comprobarPass($claveGenerada){ |
|
|
|
|
|
//compruebo que el tamaño del string sea válido. |
|
|
|
|
|
if (strlen($claveGenerada)<3 || strlen($claveGenerada)>20){ |
|
|
|
|
|
echo $claveGenerada . " no es válida0<br>"; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//compruebo que los caracteres sean los permitidos |
|
|
|
|
|
$alphachars = "abcdefghijkmnopqrstuvwxyz"; |
|
|
|
|
|
$upperchars = "ABCDEFGHJKLMNPQRSTUVWXYZ"; |
|
|
|
|
|
$numchars = "23456789"; |
|
|
|
|
|
$specialchars = "!@#_"; |
|
|
|
|
|
|
|
|
|
|
|
//$permitidos = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ereg("^[a-zA-Z0-9\-_]{3,20}$", $claveGenerada)) { |
|
|
|
|
|
echo $claveGenerada . " es válido<br>"; |
|
|
|
|
|
return true; |
|
|
|
|
|
} else { |
|
|
|
|
|
echo $claveGenerada . " NO válido<br>"; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
echo $claveGenerada . " es válido<br>"; |
|
|
|
|
|
return true; |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function crearBaseDatosFtp($remoto){ |
|
|
function crearBaseDatosFtp($remoto){ |
|
|
global $app, $conf; |
|
|
global $app, $conf; |
|
|
|
|
|
|
|
|
$fields = $app->tform->encode($this->dataRecord, $app->tform->getCurrentTab(), true); |
|
|
$fields = $app->tform->encode($this->dataRecord, $app->tform->getCurrentTab(), true); |
|
|
// generate username lo uso para generar el nombre del usuario y nombre BBDD y usuario FTP |
|
|
// generate username lo uso para generar el nombre del usuario y nombre BBDD y usuario FTP |
|
|
$generated_username = $fields['client_id'].substr(sha1(rand()), 0, 8);//client_prefix.substr(sha1(rand()), 0, 8); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$app->uses('ini_parser,getconf'); |
|
|
|
|
|
$server_config_array = $app->getconf->get_global_config(); |
|
|
|
|
|
|
|
|
|
|
|
//Tomo el valor mínimo de dígitos que tiene que tener la contraseña |
|
|
|
|
|
$min_password_length = 10; |
|
|
|
|
|
//if(isset($server_config_array['misc']['min_password_length'])) { |
|
|
|
|
|
$min_password_length = $app->functions->intval($server_config_array['misc']['min_password_length']); |
|
|
|
|
|
//} |
|
|
|
|
|
//print "Cantidad de digitos: " . $min_password_length; |
|
|
|
|
|
//print 'La clave ' . $this->generaPass(); |
|
|
|
|
|
|
|
|
|
|
|
$generated_username = $fields['client_id'].substr(sha1(rand()), 0, 10);//client_prefix.substr(sha1(rand()), 0, 8); |
|
|
//print "<pre>"; print_r($generated_username); print "</pre>\n"; |
|
|
//print "<pre>"; print_r($generated_username); print "</pre>\n"; |
|
|
$sitio_id = $app->db->queryOneRecord('SELECT domain_id, domain FROM web_domain WHERE domain = "'.$fields['domain'].'"'); |
|
|
$sitio_id = $app->db->queryOneRecord('SELECT domain_id, domain FROM web_domain WHERE domain = "'.$fields['domain'].'"'); |
|
|
//print "<pre>"; print_r($camDnsRR); print "</pre>\n"; |
|
|
//print "<pre>"; print_r($camDnsRR); print "</pre>\n"; |
|
|
$camDnsRR = $app->db->queryOneRecord('SELECT server_id, zone FROM dns_rr WHERE name LIKE "'.$this->dominio.'%"'); |
|
|
$camDnsRR = $app->db->queryOneRecord('SELECT server_id, zone FROM dns_rr WHERE name LIKE "'.$this->dominio.'%"'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$clavePass = $this->generaPass(); |
|
|
//*Recupero todos los prefix necesarios |
|
|
//*Recupero todos los prefix necesarios |
|
|
$app->uses('getconf,tools_sites'); |
|
|
$app->uses('getconf,tools_sites'); |
|
|
$global_config = $app->getconf->get_global_config('sites'); |
|
|
$global_config = $app->getconf->get_global_config('sites'); |
|
|
$dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $this->dataRecord); |
|
|
$dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $this->dataRecord); |
|
|
$dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $this->dataRecord); |
|
|
$dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $this->dataRecord); |
|
|
$ftpuser_prefix = $app->tools_sites->replacePrefix($global_config['ftpuser_prefix'], $this->dataRecord); |
|
|
$ftpuser_prefix = $app->tools_sites->replacePrefix($global_config['ftpuser_prefix'], $this->dataRecord); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*if(isset($dbuser_prefix)){ |
|
|
|
|
|
print 'BBDD prefix-->' . $dbuser_prefix . "<-->" . $generated_username; |
|
|
|
|
|
}*/ |
|
|
// añado database user con su prefix |
|
|
// añado database user con su prefix |
|
|
$db_user_params = array( |
|
|
$db_user_params = array( |
|
|
'server_id' => $camDnsRR['server_id'], |
|
|
'server_id' => $camDnsRR['server_id'], |
|
|
'database_user' => $dbuser_prefix . $generated_username, |
|
|
'database_user' => $dbuser_prefix . $generated_username, |
|
|
'database_password' => substr(sha1(rand()), 0, 10) |
|
|
|
|
|
|
|
|
'database_password' => $clavePass//substr(sha1($dbuser_prefix . $generated_username), 0, 16) |
|
|
|
|
|
//substr(sha1(rand()), 0, 20) |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
$this->usuario_db_txt = $db_user_params['database_user']; |
|
|
$this->usuario_db_txt = $db_user_params['database_user']; |
|
|
@@ -147,20 +221,20 @@ class page_action extends tform_actions { |
|
|
|
|
|
|
|
|
// add ftp user |
|
|
// add ftp user |
|
|
$ftp_params = array( |
|
|
$ftp_params = array( |
|
|
'server_id' => $camDnsRR['server_id'],//$template['web_server_id'], |
|
|
|
|
|
'parent_domain_id' => $sitio_id['domain_id'],//$site_id, |
|
|
|
|
|
|
|
|
'server_id' => $camDnsRR['server_id'], |
|
|
|
|
|
'parent_domain_id' => $sitio_id['domain_id'], |
|
|
'username' => $ftpuser_prefix . $generated_username, |
|
|
'username' => $ftpuser_prefix . $generated_username, |
|
|
'password' => substr(sha1(rand()), 0, 10), |
|
|
|
|
|
'quota_size' => '-1',//$template['hd_quota'], |
|
|
|
|
|
|
|
|
'password' => $clavePass,//substr(sha1(rand()), 0, 10), |
|
|
|
|
|
'quota_size' => '-1', |
|
|
'dir' => $site_data['0']['document_root'], |
|
|
'dir' => $site_data['0']['document_root'], |
|
|
'uid' => $site_data['0']['system_user'], |
|
|
'uid' => $site_data['0']['system_user'], |
|
|
'gid' => $site_data['0']['system_group'], |
|
|
'gid' => $site_data['0']['system_group'], |
|
|
'sys_groupid' => $site_data['0']['sys_groupid'], |
|
|
'sys_groupid' => $site_data['0']['sys_groupid'], |
|
|
'quota_files' => '-1',//$template['quota_files'], |
|
|
|
|
|
'ul_ratio' => '-1',//$template['ul_ratio'], |
|
|
|
|
|
'dl_ratio' => '-1',//$template['dl_ratio'], |
|
|
|
|
|
'ul_bandwidth' => '-1',//$template['ul_bandwidth'], |
|
|
|
|
|
'dl_bandwidth' => '-1',//$template['dl_bandwidth'], |
|
|
|
|
|
|
|
|
'quota_files' => '-1', |
|
|
|
|
|
'ul_ratio' => '-1', |
|
|
|
|
|
'dl_ratio' => '-1', |
|
|
|
|
|
'ul_bandwidth' => '-1', |
|
|
|
|
|
'dl_bandwidth' => '-1', |
|
|
'active' => 'y', |
|
|
'active' => 'y', |
|
|
); |
|
|
); |
|
|
$this->usuario_ftp_txt = $ftp_params['username']; |
|
|
$this->usuario_ftp_txt = $ftp_params['username']; |
|
|
@@ -190,14 +264,7 @@ class page_action extends tform_actions { |
|
|
Nuevo dominio: <b>'. $fields['domain'].'</b><br><br> |
|
|
Nuevo dominio: <b>'. $fields['domain'].'</b><br><br> |
|
|
Documento generado: <b>' . $hoy . '</b><br><br>'; |
|
|
Documento generado: <b>' . $hoy . '</b><br><br>'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*echo '<a href="webdns/pdf_o6h.php" target="_blank" onclick="window.open(this.href, this.target, |
|
|
|
|
|
"width=400, hight=150, top=200, toolbar=no, status=no, menubar=no");return false;">Decargar PDF</a>';*/ |
|
|
|
|
|
|
|
|
|
|
|
/*echo '<a href="webdns/pdf_o6h.php" target="_blank" onclick="window.open(this.href, this.target, |
|
|
|
|
|
"width=400, hight=150, top=200, toolbar=no, status=no, menubar=no");return false;"><img src="imagen/open6-logo.png"></img></a>'; |
|
|
|
|
|
*/ |
|
|
|
|
|
$eldom = $fields['domain']; |
|
|
$eldom = $fields['domain']; |
|
|
echo '<form method="post" id="formulario" action="webdns/pdf_o6h.php" target="_blank">'; |
|
|
echo '<form method="post" id="formulario" action="webdns/pdf_o6h.php" target="_blank">'; |
|
|
echo '<input id="pdf_power" name="pdf_power" type="hidden" value="'.$html_resultado.'">'; |
|
|
echo '<input id="pdf_power" name="pdf_power" type="hidden" value="'.$html_resultado.'">'; |
|
|
@@ -208,28 +275,10 @@ class page_action extends tform_actions { |
|
|
echo '<input id="pass_ftp" name="pass_ftp" type="hidden" value="'.$this->pass_ftp_txt.'">'; |
|
|
echo '<input id="pass_ftp" name="pass_ftp" type="hidden" value="'.$this->pass_ftp_txt.'">'; |
|
|
echo '<input id="dominio_nuevo" name="dominio_nuevo" type="hidden" value="'.$eldom.'">'; |
|
|
echo '<input id="dominio_nuevo" name="dominio_nuevo" type="hidden" value="'.$eldom.'">'; |
|
|
echo '<input type="submit" class="btn btn-default formbutton-success" value="Descargar PDF">'; |
|
|
echo '<input type="submit" class="btn btn-default formbutton-success" value="Descargar PDF">'; |
|
|
/*echo '<button class="btn btn-default formbutton-success" id="dom-edit-submit" type="button" value="'.$html_resultado.'">FueraPdf</button>'; |
|
|
|
|
|
echo '<a href="webdns/pdf_o6h.php" target="_blank" onclick="window.open(this.href, this.target, |
|
|
|
|
|
"width=400, hight=150, top=200, toolbar=no, status=no, menubar=no");return false;"><img src="imagen/open6-logo.png"></img>FueraPDF</a>'; |
|
|
|
|
|
*/ |
|
|
|
|
|
echo '</form>'; |
|
|
echo '</form>'; |
|
|
|
|
|
|
|
|
echo '<div id="resp"></div>'; |
|
|
echo '<div id="resp"></div>'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//echo '<input type="button" id="btn-ingresar" value="Ingresar" />'; |
|
|
|
|
|
/*echo '<a href="webdns/pdf_o6h.php?datos_pdf='.$html_resultado.'" target="_blank" onclick="window.open(this.href, this.target, |
|
|
|
|
|
"toolbar=no, status=no, menubar=no);return false;">Crear PDF</img></a>';*/ |
|
|
|
|
|
//$datos_test = 'Datos muchosssss datos'; |
|
|
|
|
|
|
|
|
|
|
|
//echo'<script type="text/javascript">document.forms[0].datos_test.value=".$datos_test.";document.forms[0].submit();</script>'; |
|
|
|
|
|
//echo '<a href=\"javascript:formularioSubmit('.$datos_test.');\">Pedefeando '.$datos_test.'</a>'; |
|
|
|
|
|
|
|
|
|
|
|
/*echo '<a href="https://desarrollo.open6hosting.com/html/pdf_o6h.php" id="dom-edit-submit2" target="_blank" onclick="window.open(this.href, this.target, |
|
|
|
|
|
"width=400, hight=150, top=200, toolbar=no, status=no, menubar=no");return false;"><img src="imagen/open6-logo.png"></img>PDF</a>'; |
|
|
|
|
|
*/ |
|
|
|
|
|
//echo '<button class="btn btn-default formbutton-success" id="dom-edit-submit2" type="button" value="'.$html_resultado.'">pdf</button>'; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//Expresiones regulares para comprobar si es subdominio |
|
|
//Expresiones regulares para comprobar si es subdominio |
|
|
@@ -266,16 +315,10 @@ class page_action extends tform_actions { |
|
|
|
|
|
|
|
|
//print "Subdomino: " . $this->subdomino . "</p>\n Dominio: " . $this->domino; |
|
|
//print "Subdomino: " . $this->subdomino . "</p>\n Dominio: " . $this->domino; |
|
|
$this->es_subdominio = true; |
|
|
$this->es_subdominio = true; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
//print "<pre>El dominio es: " . $this->dominio; |
|
|
//print "<pre>El dominio es: " . $this->dominio; |
|
|
return $this->es_subdominio; |
|
|
return $this->es_subdominio; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function onAfterInsert(){ |
|
|
|
|
|
global $app, $conf; |
|
|
|
|
|
$app->uses('sites_database_plugin'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Crear subdominio |
|
|
//Crear subdominio |
|
|
function crearSubDominio($remoto, $campoSubDominio){ |
|
|
function crearSubDominio($remoto, $campoSubDominio){ |
|
|
@@ -336,12 +379,9 @@ class page_action extends tform_actions { |
|
|
echo '<br><div class="alert alert-success"><br> |
|
|
echo '<br><div class="alert alert-success"><br> |
|
|
Se ha dado de alta Web y Subdominio, <b>'.$this->subdominio.'</b>, ¡Correctamente! |
|
|
Se ha dado de alta Web y Subdominio, <b>'.$this->subdominio.'</b>, ¡Correctamente! |
|
|
<br><br></div></br>'; |
|
|
<br><br></div></br>'; |
|
|
/*echo '<br><div class="alert alert-success"><br> |
|
|
|
|
|
Usuario de la Base de Datos: <b>'. $this->usuario_db_txt .'</b>, Contraseña: <b>' . $this->pass_db_txt . '</b><br><br></div></br>'; |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
//$this->onShow(); |
|
|
//$this->onShow(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function crearSitioWebSubdominio($remoto){ |
|
|
function crearSitioWebSubdominio($remoto){ |
|
|
@@ -410,8 +450,6 @@ class page_action extends tform_actions { |
|
|
'client_group_id' => $client_group_id, |
|
|
'client_group_id' => $client_group_id, |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//$app->uses('remoting_lib'); |
|
|
//$app->uses('remoting_lib'); |
|
|
//$formulario = $app->remoting_lib->loadFormDef('../sites/form/web_vhost_domain.tform.php'); |
|
|
//$formulario = $app->remoting_lib->loadFormDef('../sites/form/web_vhost_domain.tform.php'); |
|
|
//$formulario = $app->tform->loadFormDef('../sites/form/web_vhost_domain.tform.php'); |
|
|
//$formulario = $app->tform->loadFormDef('../sites/form/web_vhost_domain.tform.php'); |
|
|
@@ -423,18 +461,14 @@ class page_action extends tform_actions { |
|
|
print "<pre>";print_r($fields);print "</pre>\n" . $fields['client_id'];*/ |
|
|
print "<pre>";print_r($fields);print "</pre>\n" . $fields['client_id'];*/ |
|
|
//print "<pre>Formulario ";print_r($formulario);print "</pre>\n"; |
|
|
//print "<pre>Formulario ";print_r($formulario);print "</pre>\n"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//print '<pre>DNS IPV6 ' . $dns_ip_servidor_ipv6['ip_address']; |
|
|
//print '<pre>DNS IPV6 ' . $dns_ip_servidor_ipv6['ip_address']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//$tform_def_file2 = "../sites/form/web_vhost_domain.tform.php"; |
|
|
//$tform_def_file2 = "../sites/form/web_vhost_domain.tform.php"; |
|
|
//$app->tform->loadFormDef($tform_def_file2); |
|
|
//$app->tform->loadFormDef($tform_def_file2); |
|
|
//El último parámetro es para lanzar un evento que llama a la función on_after_insert que prepara los campos document_root, system_user y system_group |
|
|
//El último parámetro es para lanzar un evento que llama a la función on_after_insert que prepara los campos document_root, system_user y system_group |
|
|
$site_id = $remoto->insert_query('../sites/form/web_vhost_domain.tform.php', $fields['client_id'], $paramsite, 'sites:web_vhost_domain:on_after_insert'); |
|
|
$site_id = $remoto->insert_query('../sites/form/web_vhost_domain.tform.php', $fields['client_id'], $paramsite, 'sites:web_vhost_domain:on_after_insert'); |
|
|
|
|
|
|
|
|
//print '<pre>ID sitio web del subdominio --> ' . $site_id; |
|
|
//print '<pre>ID sitio web del subdominio --> ' . $site_id; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function tieneIPs(){ |
|
|
function tieneIPs(){ |
|
|
@@ -563,14 +597,13 @@ class page_action extends tform_actions { |
|
|
} |
|
|
} |
|
|
} // end foreach |
|
|
} // end foreach |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Llamada a la tabla client para recuperar el client_id y su default_dnsserver |
|
|
//Llamada a la tabla client para recuperar el client_id y su default_dnsserver |
|
|
$dns_servidor = $app->db->queryOneRecord("SELECT client_id, default_dnsserver, default_webserver FROM client WHERE client_id = ".$app->functions->intval($fields['client_id'])); |
|
|
$dns_servidor = $app->db->queryOneRecord("SELECT client_id, default_dnsserver, default_webserver FROM client WHERE client_id = ".$app->functions->intval($fields['client_id'])); |
|
|
$valor_recuperado1 = $dns_servidor['client_id']; |
|
|
$valor_recuperado1 = $dns_servidor['client_id']; |
|
|
/*$valor_recuperado2 = $dns_servidor['default_dnsserver']; |
|
|
/*$valor_recuperado2 = $dns_servidor['default_dnsserver']; |
|
|
$valor_recuperado3 = $dns_servidor['default_webserver']; |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
$valor_recuperado3 = $dns_servidor['default_webserver'];*/ |
|
|
|
|
|
|
|
|
// Insert the soa record |
|
|
// Insert the soa record |
|
|
$sys_userid = $_SESSION['s']['user']['userid']; |
|
|
$sys_userid = $_SESSION['s']['user']['userid']; |
|
|
$origin = $vars['origin']; |
|
|
$origin = $vars['origin']; |
|
|
@@ -634,10 +667,8 @@ class page_action extends tform_actions { |
|
|
//sites_web_domain_add |
|
|
//sites_web_domain_add |
|
|
$tform_def_file = "../sites/form/web_vhost_domain.tform.php"; |
|
|
$tform_def_file = "../sites/form/web_vhost_domain.tform.php"; |
|
|
$app->tform->loadFormDef($tform_def_file); |
|
|
$app->tform->loadFormDef($tform_def_file); |
|
|
|
|
|
|
|
|
//$app->remoting_lib->loadFormDef($tform_def_file); |
|
|
|
|
|
|
|
|
|
|
|
// add site |
|
|
|
|
|
|
|
|
// add site |
|
|
$paramsite = array( |
|
|
$paramsite = array( |
|
|
'type' => 'vhost', |
|
|
'type' => 'vhost', |
|
|
'domain' => $fields['domain'], |
|
|
'domain' => $fields['domain'], |
|
|
@@ -693,12 +724,6 @@ class page_action extends tform_actions { |
|
|
//El último parámetro es para lanzar un evento que llama a la función on_after_insert que prepara los campos document_root, system_user y system_group |
|
|
//El último parámetro es para lanzar un evento que llama a la función on_after_insert que prepara los campos document_root, system_user y system_group |
|
|
$site_id = $remoto->insert_query('../sites/form/web_vhost_domain.tform.php', $fields['client_id'], $paramsite, 'sites:web_vhost_domain:on_after_insert'); |
|
|
$site_id = $remoto->insert_query('../sites/form/web_vhost_domain.tform.php', $fields['client_id'], $paramsite, 'sites:web_vhost_domain:on_after_insert'); |
|
|
//print 'Sitio id '. $site_id; |
|
|
//print 'Sitio id '. $site_id; |
|
|
//$this->crearBaseDatosFtp($remote); |
|
|
|
|
|
// get site data |
|
|
|
|
|
/*$app->uses('remoting_lib'); |
|
|
|
|
|
$app->remoting_lib->loadFormDef('../sites/form/web_vhost_domain.tform.php'); |
|
|
|
|
|
$site_data = $app->remoting_lib->getDataRecord($site_id);*/ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function onSubmit() { |
|
|
function onSubmit() { |
|
|
@@ -712,7 +737,6 @@ class page_action extends tform_actions { |
|
|
if($this->tieneIPs()){ |
|
|
if($this->tieneIPs()){ |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if($this->existeDominio($fields)){ |
|
|
if($this->existeDominio($fields)){ |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
@@ -737,21 +761,18 @@ class page_action extends tform_actions { |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
|
|
|
$this->crearSitioDns($remote); |
|
|
$this->crearSitioDns($remote); |
|
|
|
|
|
|
|
|
|
|
|
//$variablePHP = "<script> document.write(test) </script>"; |
|
|
//Si todo va bien, el resultado de la web y dns |
|
|
//Si todo va bien, el resultado de la web y dns |
|
|
echo '<br><div class="alert alert-success"><br> |
|
|
echo '<br><div class="alert alert-success"><br> |
|
|
Altas Web y DNS del dominio <b>'.$fields['domain'].'</b>, ¡Creadas correctamente! |
|
|
Altas Web y DNS del dominio <b>'.$fields['domain'].'</b>, ¡Creadas correctamente! |
|
|
<br><br></div></br>'; |
|
|
<br><br></div></br>'; |
|
|
|
|
|
|
|
|
//IMPORTANTE, es necesario cargar nuestro formulario para poder ejecutar la función que crea |
|
|
//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. |
|
|
|
|
|
|
|
|
//la base de datos y el ftp ya que hay datos que tomamos de él antes de ejecutarla. |
|
|
$app->tform->loadFormDef('form/new_service_webdns.tform.php'); |
|
|
$app->tform->loadFormDef('form/new_service_webdns.tform.php'); |
|
|
$this->crearBaseDatosFtp($remote); |
|
|
$this->crearBaseDatosFtp($remote); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -797,83 +818,63 @@ $page = new page_action; |
|
|
$page->onLoad(); |
|
|
$page->onLoad(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//IMPORTENTE, es necesario estas líneas para que el botón del pdf funcione. Activa el javascript |
|
|
|
|
|
//echo '<script type="text/javascript">'; |
|
|
|
|
|
//echo 'alert (password(7, false, 1));'; |
|
|
|
|
|
//echo '</script>'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?> |
|
|
?> |
|
|
|
|
|
|
|
|
|
|
|
<!--IMPORTENTE, es necesario estas líneas para que el botón del pdf funcione. Activa el javascript --> |
|
|
<script type="text/javascript"> |
|
|
<script type="text/javascript"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*function crearElPdf(url) { |
|
|
|
|
|
alert ("Esto es javascript"); |
|
|
|
|
|
window.open(url, "nuevo", "directories=no, location=no, menubar=no, scrollbars=yes, statusbar=no, tittlebar=no, width=400, height=400"); |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
/*var test = "PARALACLAVE"; |
|
|
|
|
|
function getRandomInt(min, max){ |
|
|
|
|
|
return Math.floor(Math.random() * (max - min + 1)) + min; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function formularioSubmit(pdf_power){ |
|
|
|
|
|
alert("Vamos"); |
|
|
|
|
|
//document.forms[0].pdf_power.value = pdf_power; |
|
|
|
|
|
//document.forms[0].submit(); |
|
|
|
|
|
|
|
|
var clave = password(7, false, 1); |
|
|
|
|
|
function password(minLength, special, num_special){ |
|
|
|
|
|
minLength = minLength || 10; |
|
|
|
|
|
if(minLength < 8) minLength = 8; |
|
|
|
|
|
var maxLength = minLength + 5; |
|
|
|
|
|
var length = getRandomInt(minLength, maxLength); |
|
|
|
|
|
|
|
|
|
|
|
var alphachars = "abcdefghijkmnopqrstuvwxyz"; |
|
|
|
|
|
var upperchars = "ABCDEFGHJKLMNPQRSTUVWXYZ"; |
|
|
|
|
|
var numchars = "23456789"; |
|
|
|
|
|
var specialchars = "!@#_"; |
|
|
|
|
|
|
|
|
|
|
|
if(num_special == undefined) num_special = 0; |
|
|
|
|
|
if(special != undefined && special == true) { |
|
|
|
|
|
num_special = Math.floor(Math.random() * (length / 4)) + 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
jQuery('#dom-edit-submit2').click(function() { |
|
|
|
|
|
//$("#pdf_power").val("1"); |
|
|
|
|
|
alert(document.getElementById("pdf_power").value); |
|
|
|
|
|
//ISPConfig.submitForm('formulario','webdns/pdf_o6h.php'); |
|
|
|
|
|
w = window.open('webdns/pdf_o6h.php'); |
|
|
|
|
|
//w.document.open(); |
|
|
|
|
|
//w.document.write($html_resultado); |
|
|
|
|
|
w.document.write(document.getElementById("pdf_power").value); |
|
|
|
|
|
w.document.close(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
var numericlen = getRandomInt(1, 2); |
|
|
|
|
|
var alphalen = length - num_special - numericlen; |
|
|
|
|
|
var upperlen = Math.floor(alphalen / 2); |
|
|
|
|
|
alphalen = alphalen - upperlen; |
|
|
|
|
|
var password = ""; |
|
|
|
|
|
|
|
|
/*jQuery('#dom-edit-submit2').click(function() { |
|
|
|
|
|
/*alert("Vamos"); |
|
|
|
|
|
document.forms[0].pdf_power.value = pdf_power; |
|
|
|
|
|
document.forms[0].submit();*/ |
|
|
|
|
|
/*var url = "webdns/pdf_o6h.php"; |
|
|
|
|
|
$.post("webdns/pdf_o6h.php", |
|
|
|
|
|
{ |
|
|
|
|
|
name: "David", |
|
|
|
|
|
city: "Málaga" |
|
|
|
|
|
},*/ |
|
|
|
|
|
/*function(data, status){ |
|
|
|
|
|
//window.open(url, '_blank'); |
|
|
|
|
|
//var w = window.open('webdns/pdf_o6h.php','popup','width=300,height=200'); |
|
|
|
|
|
//var w = window.open('webdns/pdf_o6h.php); |
|
|
|
|
|
//w.document.open(); |
|
|
|
|
|
//w.document.write(data); |
|
|
|
|
|
//w.document.close(); |
|
|
|
|
|
//w.window.open('webdns/pdf_o6h.php','popup','width=300,height=200'); |
|
|
|
|
|
//w.document.getElementById('formulario').submit(); |
|
|
|
|
|
//alert("Data: " + data + "\nStatus: " + status); |
|
|
|
|
|
//document.location.href = 'webdns/pdf_o6h.php' |
|
|
|
|
|
|
|
|
|
|
|
});*/ |
|
|
|
|
|
|
|
|
|
|
|
//alert(document.getElementById("pdf_power").value); |
|
|
|
|
|
//ISPConfig.submitForm('formulario','webdns/pdf_o6h.php'); |
|
|
|
|
|
//document.location.href = '/webdns/pdf_o6h.php'; |
|
|
|
|
|
|
|
|
|
|
|
/* var url = "webdns/pdf_o6h.php"; |
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
type: "POST", |
|
|
|
|
|
url: url, |
|
|
|
|
|
data: $("#formulario").serialize(), |
|
|
|
|
|
success: function(data) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
//alert("Datos:" + data); |
|
|
|
|
|
//document.location.href = 'webdns/pdf_o6h.php'; |
|
|
|
|
|
w = window.open('webdns/pdf_o6h.php', 'popup'); |
|
|
|
|
|
//w.document.open(); |
|
|
|
|
|
w.document.write(data); |
|
|
|
|
|
w.document.close(); |
|
|
|
|
|
$('#resp').html(data); |
|
|
|
|
|
//document.location.href = 'webdns/pdf_o6h.php'; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
});*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*$.post( "https://desarrollo.open6hosting.com/html/pdf_o6h.php", function( data ) { |
|
|
|
|
|
$( ".resp" ).html( data ); |
|
|
|
|
|
});*/ |
|
|
|
|
|
|
|
|
for(i = 0; i < alphalen; i++) { |
|
|
|
|
|
password += alphachars.charAt(Math.floor(Math.random() * alphachars.length)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
for(i = 0; i < upperlen; i++) { |
|
|
|
|
|
password += upperchars.charAt(Math.floor(Math.random() * upperchars.length)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < num_special; i++) { |
|
|
|
|
|
password += specialchars.charAt(Math.floor(Math.random() * specialchars.length)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < numericlen; i++) { |
|
|
|
|
|
password += numchars.charAt(Math.floor(Math.random() * numchars.length)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
password = password.split('').sort(function() { return 0.5 - Math.random(); }).join(''); |
|
|
|
|
|
|
|
|
|
|
|
return password; |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
</script> |