|
|
|
@@ -411,8 +411,8 @@ class page_action extends tform_actions { |
|
|
|
$db_user_id = $remoto->insert_query('../sites/form/database_user.tform.php', |
|
|
|
$this->cli_id, $db_user_params, 'sites:web_database_user:on_after_insert'); |
|
|
|
//echo('El id ' . $this->id); |
|
|
|
$remoto2 = new remote_actions; |
|
|
|
$remoto->sites_database_user_after_add($this->cli_grupo_id, $db_user_params); |
|
|
|
// $remoto2 = new remote_actions; |
|
|
|
// $remoto->sites_database_user_after_add($this->cli_grupo_id, $db_user_params); |
|
|
|
//echo(' El cliente en webdns ' . $this->cli_id); |
|
|
|
//$db_user_id = $remoto2->sites_database_user_add(1, $this->cli_id, $db_user_params, 'sites:web_database_user:on_after_insert'); |
|
|
|
/*$sql = "INSERT INTO web_database_user (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES (?, ?, ?, ?, ?, ?, ?)"; |
|
|
|
@@ -440,7 +440,7 @@ class page_action extends tform_actions { |
|
|
|
//print "<pre> BBDD "; print_r($paramsBD); print "</pre>\n"; |
|
|
|
|
|
|
|
$this->nombre_db_txt = $paramsBD['database_name']; |
|
|
|
|
|
|
|
//IMPORTANTE. COMPROBAR EL VALOR QUE HAY QUE ENVIAR, SI ES CLI GRUPO Ó CLI ID |
|
|
|
$db_id = $remoto->sites_database_add($this->cli_grupo_id, /*$this->cli_id,*//*$fields['client_group_id'],*/ $paramsBD); |
|
|
|
|
|
|
|
$this->urlBBDD($db_id, $this->bbdd_serv); |
|
|
|
@@ -448,8 +448,8 @@ class page_action extends tform_actions { |
|
|
|
// get site data para usarlo en la creación de la cuenta ftp, otra forma de cargar una tupla dandole un id |
|
|
|
//$app->uses('remoting_lib'); |
|
|
|
$app->remoting_lib->loadFormDef('../sites/form/web_vhost_domain.tform.php'); |
|
|
|
//$site_data = $app->remoting_lib->getDataRecord($sitio_id); |
|
|
|
$site_data = $remoto->getDataRecordWebDNS($sitio_id); |
|
|
|
// $site_data = $app->remoting_lib->getDataRecord($sitio_id); |
|
|
|
// $site_data = $remoto->getDataRecordWebDNS($sitio_id); |
|
|
|
|
|
|
|
$this->nombre_user_ftp = $this->generaNombreFTP(); |
|
|
|
// add ftp user |
|
|
|
@@ -477,7 +477,7 @@ class page_action extends tform_actions { |
|
|
|
//print "<pre>"; print_r($site_data); print "</pre>\n"; |
|
|
|
//echo('El grupo del usuario es ' . $this->cli_grupo_id); |
|
|
|
$remoto->insert_query('../sites/form/ftp_user.tform.php', $this->cli_id,/*$fields['client_group_id'],*/ $ftp_params); |
|
|
|
$remoto->sites_ftp_user_after_insert(); |
|
|
|
// $remoto->sites_ftp_user_after_insert(); |
|
|
|
echo '<br><div class="alert alert-success"><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 . ' |
|
|
|
@@ -1565,7 +1565,7 @@ print "<pre>IP6 WEB ";print_r($this->ip6_servidor_web);print "</pre>\n";*/ |
|
|
|
echo ('Tabla sys_user --> userid ' . $this->sys_usuario_id . " <br>"); |
|
|
|
echo ('Tabla sys_user --> sys_groupid ' . $this->sys_grupo_id . " <br>");*/ |
|
|
|
//print "Subdomino: " . $this->subdomino . "</p>\n Dominio: " . $this->domino; |
|
|
|
if($this->comprobarSubDominios($fields['domain'])){ |
|
|
|
/* if($this->comprobarSubDominios($fields['domain'])){ |
|
|
|
|
|
|
|
$this->crearSubDominio($remote, $fields['domain']); |
|
|
|
if(!$this->subdom_error){ |
|
|
|
@@ -1578,9 +1578,9 @@ print "<pre>IP6 WEB ";print_r($this->ip6_servidor_web);print "</pre>\n";*/ |
|
|
|
//} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
if(!$this->dominio_error){ |
|
|
|
$this->crearDnsSitioWeb($remote); |
|
|
|
} else {*/ |
|
|
|
// if(!$this->dominio_error){ |
|
|
|
// $this->crearDnsSitioWeb($remote); |
|
|
|
//$variablePHP = "<script> document.write(test) </script>"; |
|
|
|
//Si todo va bien, el resultado de la web y dns |
|
|
|
echo '<br><div class="alert alert-success"><br> |
|
|
|
@@ -1598,12 +1598,12 @@ print "<pre>IP6 WEB ";print_r($this->ip6_servidor_web);print "</pre>\n";*/ |
|
|
|
$this->crearBaseDatosFtp($remote); |
|
|
|
//} |
|
|
|
//} |
|
|
|
}else{ |
|
|
|
/* }else{ |
|
|
|
$this->onError(); |
|
|
|
return; |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
} |
|
|
|
//} |
|
|
|
//parent::onSubmit(); |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -1629,6 +1629,7 @@ class remote_actions extends remoting { |
|
|
|
} |
|
|
|
|
|
|
|
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); |
|
|
|
if($sql !== false) return $this->insertQueryExecuteWebDNS($sql, $params, $event_identifier); |
|
|
|
else return false; |
|
|
|
@@ -1783,7 +1784,8 @@ class remote_actions extends remoting { |
|
|
|
if(@is_numeric($primary_id)) { |
|
|
|
if($primary_id > 0) { |
|
|
|
// Return a single record |
|
|
|
return $this->getDataRecordPadreWebDNS($primary_id); |
|
|
|
//return $this->getDataRecordPadreWebDNS($primary_id); |
|
|
|
return $app->tform->getDataRecord($primary_id); |
|
|
|
//return parent::getDataRecord($primary_id); |
|
|
|
} elseif($primary_id == -1) { |
|
|
|
// Return a array with all records |
|
|
|
@@ -1812,7 +1814,8 @@ class remote_actions extends remoting { |
|
|
|
} |
|
|
|
$sql_where = substr($sql_where, 0, -5); |
|
|
|
if($sql_where == '') $sql_where = '1'; |
|
|
|
$sql = "SELECT * FROM ?? WHERE ".$sql_where. " AND " . $this->getAuthSQLWebDNS('r', $this->formDef['db_table']); |
|
|
|
//$sql = "SELECT * FROM ?? WHERE ".$sql_where. " AND " . $this->getAuthSQLWebDNS('r', $this->formDef['db_table']); |
|
|
|
$sql = "SELECT * FROM ?? WHERE ".$sql_where. " AND " . $this->getAuthSQL('r', $this->formDef['db_table']); |
|
|
|
if($sql_offset >= 0 && $sql_limit > 0) $sql .= ' LIMIT ' . $sql_offset . ',' . $sql_limit; |
|
|
|
return $app->db->queryAllRecords($sql, true, $params); |
|
|
|
} else { |
|
|
|
@@ -1821,12 +1824,12 @@ class remote_actions extends remoting { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function getDataRecordPadreWebDNS($primary_id) { |
|
|
|
/*function getDataRecordPadreWebDNS($primary_id) { |
|
|
|
global $app; |
|
|
|
$escape = '`'; |
|
|
|
$sql = "SELECT * FROM ?? WHERE ?? = ? AND ".$this->getAuthSQLWebDNS('r', $this->formDef['db_table']); |
|
|
|
return $app->db->queryOneRecord($sql, $this->formDef['db_table'], $this->formDef['db_table_idx'], $primary_id); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
function getAuthSQLWebDNS($perm, $table = '') { |
|
|
|
if($_SESSION["s"]["user"]["typ"] == 'admin' || $_SESSION['s']['user']['mailuser_id'] > 0) { |
|
|
|
@@ -1851,6 +1854,7 @@ class remote_actions extends remoting { |
|
|
|
|
|
|
|
//$app->remoting_lib->loadFormDef('../sites/form/database.tform.php'); |
|
|
|
//$app->tform->formDef('../sites/form/database.tform.php'); |
|
|
|
//$sql = $app->remoting->insertQueryPrepare('../sites/form/database.tform.php', $client_id, $params); |
|
|
|
$sql = $this->insertQueryPrepareWebDNS('../sites/form/database.tform.php', $client_id, $params); |
|
|
|
|
|
|
|
if($sql !== false) { |
|
|
|
@@ -1860,8 +1864,10 @@ class remote_actions extends remoting { |
|
|
|
$this->dataRecord = $params; |
|
|
|
//$app->uses('sites_database_plugin'); |
|
|
|
|
|
|
|
$retval = $this->insertQueryExecuteWebDNS($sql, $params); |
|
|
|
|
|
|
|
$app->sites_database_plugin->processDatabaseInsert($this); |
|
|
|
//$retval = $this->insertQueryExecute($sql, $params); |
|
|
|
$retval = $this->insertQueryExecuteWebDNS($sql, $params); |
|
|
|
|
|
|
|
// set correct values for backup_interval and backup_copies |
|
|
|
/*if(isset($params['backup_interval']) || isset($params['backup_copies'])){ |
|
|
|
|