Переглянути джерело

Recuperación de los diferentes prefix para los nombres. Versión 1.2 testeada

master
David Ramos 8 роки тому
джерело
коміт
a601bc4ff7
2 змінених файлів з 21 додано та 11 видалено
  1. +20
    -10
      new_service_webdns.php
  2. +1
    -1
      pdf_o6h.php

+ 20
- 10
new_service_webdns.php Переглянути файл

@@ -86,17 +86,26 @@ class page_action extends tform_actions {
global $app, $conf;

$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);
//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'].'"');
//print "<pre>"; print_r($camDnsRR); print "</pre>\n";
$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(
'server_id' => $camDnsRR['server_id'],
'database_user' => $generated_username,
'database_user' => $dbuser_prefix . $generated_username,
'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'];

//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";
$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'],
'type' => 'mysql',
'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_charset' => 'utf8',
'remote_access' => 'n',
@@ -140,7 +149,7 @@ class page_action extends tform_actions {
$ftp_params = array(
'server_id' => $camDnsRR['server_id'],//$template['web_server_id'],
'parent_domain_id' => $sitio_id['domain_id'],//$site_id,
'username' => $generated_username,
'username' => $ftpuser_prefix . $generated_username,
'password' => substr(sha1(rand()), 0, 10),
'quota_size' => '-1',//$template['hd_quota'],
'dir' => $site_data['0']['document_root'],
@@ -164,7 +173,8 @@ class page_action extends tform_actions {
Altas de BBDD y FTP, ¡Correctas!<br><br>
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>
<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");

@@ -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>';
*/
$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="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.'">';
@@ -473,7 +483,7 @@ class page_action extends tform_actions {
// client prefix and group 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_prefix = 'c'.$fields['client_id'];
//$client_prefix = 'c'.$fields['client_id'];
// 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']));


+ 1
- 1
pdf_o6h.php Переглянути файл

@@ -8,7 +8,7 @@ $usuario_ftp = $_POST['usuario_ftp'];
$pass_ftp = $_POST['pass_ftp'];
$dominio_nuevo = $_POST['dominio_nuevo'];

echo "<body style='background-color:3c3c3c'>";
//print $nombre_bd . ' ' . $usuario_bd . ' ' . $pass_bd;
//print $usuario_ftp . ' ' . $pass_ftp;
echo '<form method="post" id="formulario" action="crear_pdf_o6h.php">';


Завантаження…
Відмінити
Зберегти