|
|
@@ -86,17 +86,26 @@ class page_action extends tform_actions { |
|
|
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 |
|
|
|
|
|
|
|
|
// 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); |
|
|
$generated_username = $fields['client_id'].substr(sha1(rand()), 0, 8);//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.'%"'); |
|
|
|
|
|
|
|
|
// add database user |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*Recupero todos los prefix necesarios |
|
|
|
|
|
$app->uses('getconf,tools_sites'); |
|
|
|
|
|
$global_config = $app->getconf->get_global_config('sites'); |
|
|
|
|
|
$dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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' => $generated_username, |
|
|
|
|
|
|
|
|
'database_user' => $dbuser_prefix . $generated_username, |
|
|
'database_password' => substr(sha1(rand()), 0, 10) |
|
|
'database_password' => substr(sha1(rand()), 0, 10) |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
@@ -104,8 +113,8 @@ class page_action extends tform_actions { |
|
|
$this->pass_db_txt = $db_user_params['database_password']; |
|
|
$this->pass_db_txt = $db_user_params['database_password']; |
|
|
|
|
|
|
|
|
//print "<pre>"; print_r($db_user_params); print "</pre>\n"; |
|
|
//print "<pre>"; print_r($db_user_params); print "</pre>\n"; |
|
|
/*print "<br>". $this->usuario_db_txt; |
|
|
|
|
|
print "<br>". $this->pass_db_txt;*/ |
|
|
|
|
|
|
|
|
//print "<br>". $this->usuario_db_txt; |
|
|
|
|
|
//print "<br>". $this->pass_db_txt; |
|
|
|
|
|
|
|
|
//print "<pre>"; print_r($fields); print "</pre>\n"; |
|
|
//print "<pre>"; print_r($fields); print "</pre>\n"; |
|
|
$db_user_id = $remoto->insert_query('../sites/form/database_user.tform.php', $fields['client_id'], $db_user_params, 'sites:web_database_user:on_after_insert'); |
|
|
$db_user_id = $remoto->insert_query('../sites/form/database_user.tform.php', $fields['client_id'], $db_user_params, 'sites:web_database_user:on_after_insert'); |
|
|
@@ -116,7 +125,7 @@ class page_action extends tform_actions { |
|
|
'parent_domain_id' => $sitio_id['domain_id'], |
|
|
'parent_domain_id' => $sitio_id['domain_id'], |
|
|
'type' => 'mysql', |
|
|
'type' => 'mysql', |
|
|
'database_quota' => '-1', |
|
|
'database_quota' => '-1', |
|
|
'database_name' => $db_user_params['database_user'], |
|
|
|
|
|
|
|
|
'database_name' => $dbname_prefix . $generated_username,//$db_user_params['database_user'], |
|
|
'database_user_id' => $db_user_id, |
|
|
'database_user_id' => $db_user_id, |
|
|
'database_charset' => 'utf8', |
|
|
'database_charset' => 'utf8', |
|
|
'remote_access' => 'n', |
|
|
'remote_access' => 'n', |
|
|
@@ -140,7 +149,7 @@ class page_action extends tform_actions { |
|
|
$ftp_params = array( |
|
|
$ftp_params = array( |
|
|
'server_id' => $camDnsRR['server_id'],//$template['web_server_id'], |
|
|
'server_id' => $camDnsRR['server_id'],//$template['web_server_id'], |
|
|
'parent_domain_id' => $sitio_id['domain_id'],//$site_id, |
|
|
'parent_domain_id' => $sitio_id['domain_id'],//$site_id, |
|
|
'username' => $generated_username, |
|
|
|
|
|
|
|
|
'username' => $ftpuser_prefix . $generated_username, |
|
|
'password' => substr(sha1(rand()), 0, 10), |
|
|
'password' => substr(sha1(rand()), 0, 10), |
|
|
'quota_size' => '-1',//$template['hd_quota'], |
|
|
'quota_size' => '-1',//$template['hd_quota'], |
|
|
'dir' => $site_data['0']['document_root'], |
|
|
'dir' => $site_data['0']['document_root'], |
|
|
@@ -164,7 +173,8 @@ class page_action extends tform_actions { |
|
|
Altas de BBDD y FTP, ¡Correctas!<br><br> |
|
|
Altas de BBDD y FTP, ¡Correctas!<br><br> |
|
|
Usuario BBDD: <b>'. $this->usuario_db_txt .'</b><br>Contraseña: <b>' . $this->pass_db_txt . ' |
|
|
Usuario BBDD: <b>'. $this->usuario_db_txt .'</b><br>Contraseña: <b>' . $this->pass_db_txt . ' |
|
|
</b><br>Nombre BBDD: <b>' . $this->nombre_db_txt . '</b><br> |
|
|
</b><br>Nombre BBDD: <b>' . $this->nombre_db_txt . '</b><br> |
|
|
<br>Usuario FTP: <b>'. $this->usuario_ftp_txt .'</b><br>Contraseña: <b>' . $this->pass_ftp_txt . '</b><br><br></div></br>'; |
|
|
|
|
|
|
|
|
<br>Usuario FTP: <b>'. $this->usuario_ftp_txt .'</b><br>Contraseña: <b>' . $this->pass_ftp_txt . '</b><br><br> |
|
|
|
|
|
</div></br>'; |
|
|
|
|
|
|
|
|
$hoy = date("d-m-Y H:i:s"); |
|
|
$hoy = date("d-m-Y H:i:s"); |
|
|
|
|
|
|
|
|
@@ -189,7 +199,7 @@ class page_action extends tform_actions { |
|
|
"width=400, hight=150, top=200, toolbar=no, status=no, menubar=no");return false;"><img src="imagen/open6-logo.png"></img></a>'; |
|
|
"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.'">'; |
|
|
echo '<input id="nombre_bd" name="nombre_bd" type="hidden" value="'.$this->nombre_db_txt.'">'; |
|
|
echo '<input id="nombre_bd" name="nombre_bd" type="hidden" value="'.$this->nombre_db_txt.'">'; |
|
|
echo '<input id="usuario_bd" name="usuario_bd" type="hidden" value="'.$this->usuario_db_txt.'">'; |
|
|
echo '<input id="usuario_bd" name="usuario_bd" type="hidden" value="'.$this->usuario_db_txt.'">'; |
|
|
@@ -473,7 +483,7 @@ class page_action extends tform_actions { |
|
|
// client prefix and group id |
|
|
// client prefix and group id |
|
|
$res = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$app->functions->intval($fields['client_id'])); |
|
|
$res = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$app->functions->intval($fields['client_id'])); |
|
|
$client_group_id = $res['groupid']; |
|
|
$client_group_id = $res['groupid']; |
|
|
$client_prefix = 'c'.$fields['client_id']; |
|
|
|
|
|
|
|
|
//$client_prefix = 'c'.$fields['client_id']; |
|
|
|
|
|
|
|
|
// add domain. Llamada que inserta el dominio en la tabla domain |
|
|
// add domain. Llamada que inserta el dominio en la tabla domain |
|
|
//$domain_id = $remote->insert_query('../client/form/domain.tform.php', $fields['client_id'], array('domain' => $fields['domain'])); |
|
|
//$domain_id = $remote->insert_query('../client/form/domain.tform.php', $fields['client_id'], array('domain' => $fields['domain'])); |
|
|
|