diff --git a/form/new_service_webdns.tform.php b/form/new_service_webdns.tform.php index 15529de..1ed8ac6 100755 --- a/form/new_service_webdns.tform.php +++ b/form/new_service_webdns.tform.php @@ -67,8 +67,8 @@ $form["title"] = "Nuevo servicio Web"; $form["description"] = ""; $form["name"] = "new_service_webdns"; $form["action"] = "new_service_webdns.php"; -$form["db_table"] = "server"; -$form["db_table_idx"] = "server_id"; +$form["db_table"] = "web_database"; +$form["db_table_idx"] = "database_id"; $form["db_history"] = "yes"; $form["tab_default"] = "webdns"; $form["auth"] = 'yes'; // yes / no diff --git a/new_service_webdns.php b/new_service_webdns.php index a3691e8..40f6e1e 100755 --- a/new_service_webdns.php +++ b/new_service_webdns.php @@ -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 "
BBDD "; print_r($paramsBD); print "\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 "
"; print_r($site_data); print "\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 '
IP6 WEB ";print_r($this->ip6_servidor_web);print "\n";*/ echo ('Tabla sys_user --> userid ' . $this->sys_usuario_id . "
IP6 WEB ";print_r($this->ip6_servidor_web);print "\n";*/ //} } - } else { - if(!$this->dominio_error){ - $this->crearDnsSitioWeb($remote); + } else {*/ +// if(!$this->dominio_error){ +// $this->crearDnsSitioWeb($remote); //$variablePHP = ""; //Si todo va bien, el resultado de la web y dns echo '
IP6 WEB ";print_r($this->ip6_servidor_web);print "\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'])){