function xmlbase_add($dominio, $usuario, $homedir, $tipo) { //Crea la configuracion en el XML $conf = new patConfiguration(); $conf->setConfigDir(_CFG_XML_CONFIG_DIR); $conf->parseConfigFile(_CFG_XML_FTP, a); $NEW_ID = xmlconfig_generaid(_CFG_XML_FTP); $conf->setConfigValue($NEW_ID, array("ID" => $NEW_ID, "DOMINIO" => $dominio, "HOMEDIR" => $homedir, "USUARIO" => $usuario, "PASSWORD" => "", "TIPO" => $tipo), "array"); $conf->writeConfigFile(_CFG_XML_FTP, "xml", array("mode" => "pretty")); //Fin fichero configuracion XML }
function xmlbase_add($dbase) { //Crea la configuracion en el XML $conf = new patConfiguration(); $conf->setConfigDir(_CFG_XML_CONFIG_DIR); $conf->parseConfigFile(_CFG_XML_BASEDATOS, a); $NEW_ID = xmlconfig_generaid(_CFG_XML_BASEDATOS); $conf->setConfigValue($NEW_ID, array("ID" => $NEW_ID, "DOMINIO" => "", "DATABASE" => $dbase, "USUARIO" => $dbase, "PASSWORD" => "", "ESTADO" => 1), "array"); $conf->writeConfigFile(_CFG_XML_BASEDATOS, "xml", array("mode" => "pretty")); //Fin fichero configuracion XML }
$mAlias = trim($_POST['frmAlias']); $mAutoRespuesta = trim($_POST['frmAutoRespuesta']); $mLista = trim($_POST['frmLista']); $mQuotaCORREO = trim($_POST['frmQuotaCORREO']); $mIDFTP = trim($_POST['frmIDFTP']); $mQuotaFTP = trim($_POST['frmQuotaFTP']); $mEstado = $_POST['frmEstado']; if ($_GET['id'] != 0) { $conf->setConfigValue($_GET['id'], array("ID" => $_GET['id'], "IDCLIENTE" => $mIDCliente, "DOMINIO" => $mDominio, "BASE" => $mBase, "USUARIO" => $mUsuario, "PASSWORD" => $mPassword, "CUENTAS" => $mCuentas, "REDIRECCIONES" => $mRedirecciones, "ALIAS" => $mAlias, "AUTORESPUESTA" => $mAutoRespuesta, "LISTA" => $mLista, "QUOTACORREO" => $mQuotaCORREO, "IDFTP" => $mIDFTP, "QUOTAFTP" => $mQuotaFTP, "ESTADO" => $mEstado), "array"); if (function_exists("awstats_info")) { $mUsuario_Antiguo = awstats_usuariohtpasswd($mDominio); awstats_htpasswdsave($mDominio, $mUsuario_Antiguo, $mUsuario, $_POST['frmPassword']); awstats_filesave_conf($mDominio, $mUsuario, $mContenido); } if (function_exists("vpopmail_info")) { vpopmail_domainquota($mDominio, $mQuota); vpopmail_domainconf($mDominio, "cuentas", $mCuentas); vpopmail_domainconf($mDominio, "alias", $mAlias); vpopmail_domainconf($mDominio, "redirecciones", $mRedirecciones); vpopmail_domainconf($mDominio, "autorespuesta", $mAutoRespuesta); vpopmail_domainconf($mDominio, "listas", $mLista); vpopmail_domainconf($mDominio, "quota", $mQuotaCORREO); } } else { $NEW_ID = xmlconfig_generaid(_CFG_XML_DOMINIOS); $conf->setConfigValue($NEW_ID, array("ID" => $NEW_ID, "IDCLIENTE" => $mIDCliente, "DOMINIO" => $mDominio, "BASE" => $mBase, "USUARIO" => $mUsuario, "PASSWORD" => $mPassword, "CUENTAS" => $mCuentas, "REDIRECCIONES" => $mRedirecciones, "ALIAS" => $mAlias, "AUTORESPUESTA" => $mAutoRespuesta, "LISTA" => $mLista, "QUOTACORREO" => $mQuotaCORREO, "IDFTP" => 0, "QUOTAFTP" => $mQuotaFTP, "ESTADO" => $mEstado), "array"); } $conf->writeConfigFile(_CFG_XML_DOMINIOS, "xml", array("mode" => "pretty")); $_SESSION["strTemp"] = "El dominio se ha añadido a su cuenta, solicite a su administrador la activación por favor<br>"; header("Location: ../../../index.php?resulid=99\n\n"); exit;
require _CFG_INTERFACE_LIBRERIA; include "../include_permiso.php"; require_once _CFG_INTERFACE_DIRMODULES . "mod_xmlconfig/include_funciones.php"; //Crea copia seguridad antes de modificar xmlconfig_backup(_CFG_XML_CLIENTES); $conf = new patConfiguration(); $conf->setConfigDir(_CFG_XML_CONFIG_DIR); $conf->parseConfigFile(_CFG_XML_CLIENTES, a); $mNombre = addslashes(trim($_POST['frmNombre'])); $mEmail = addslashes(trim($_POST['frmEmail'])); $mUsuario = addslashes(trim($_POST['frmUsuario'])); if ($_POST['frmPassword'] == "") { $datos = $conf->getConfigValue(xmlconfig_buscaid($_GET['id'], _CFG_XML_CLIENTES)); $mPassword = $datos['PASSWORD']; } else { $mPassword = md5(trim($_POST['frmPassword'])); } $mEstado = $_POST['frmEstado']; $mPermiso = $_POST['frmPermiso']; $mDominios = $_POST['frmDominios']; $mEspacio = $_POST['frmEspacio']; $mAnchoBanda = $_POST['frmAnchoBanda']; if ($_GET['id'] != 0) { $conf->setConfigValue($_GET['id'], array("ID" => $_GET['id'], "NOMBRE" => $mNombre, "EMAIL" => $mEmail, "USUARIO" => $mUsuario, "PASSWORD" => $mPassword, "ESTADO" => $mEstado, "PERMISO" => $mPermiso, "DOMINIOS" => $mDominios, "ESPACIO" => $mEspacio, "ANCHOBANDA" => $mAnchoBanda), "array"); } else { $NEW_ID = xmlconfig_generaid(_CFG_XML_CLIENTES); $conf->setConfigValue($NEW_ID, array("ID" => $NEW_ID, "NOMBRE" => $mNombre, "EMAIL" => $mEmail, "USUARIO" => $mUsuario, "PASSWORD" => $mPassword, "ESTADO" => $mEstado, "PERMISO" => $mPermiso, "DOMINIOS" => $mDominios, "ESPACIO" => $mEspacio, "ANCHOBANDA" => $mAnchoBanda), "array"); } $conf->writeConfigFile(_CFG_XML_CLIENTES, "xml", array("mode" => "pretty")); header("Location: ../../../index.php?grupo=gestion&seccion=clientes&pag=index\n\n"); exit;
<?php include "../../../config/main_config.php"; require _CFG_INTERFACE_LIBRERIA; include "../include_permiso.php"; require_once _CFG_INTERFACE_DIRMODULES . "mod_xmlconfig/include_funciones.php"; //Crea copia seguridad antes de modificar xmlconfig_backup(_CFG_XML_USUARIOS); $conf = new patConfiguration(); $conf->setConfigDir(_CFG_XML_CONFIG_DIR); $conf->parseConfigFile(_CFG_XML_USUARIOS, a); $mNombre = addslashes(trim($_POST['frmNombre'])); $mEmail = addslashes(trim($_POST['frmEmail'])); $mUsuario = addslashes(trim($_POST['frmUsuario'])); if ($_POST['frmPassword'] == "") { $datos = $conf->getConfigValue(xmlconfig_buscaid($_GET['id'], _CFG_XML_USUARIOS)); $mPassword = $datos['PASSWORD']; } else { $mPassword = md5(trim($_POST['frmPassword'])); } $mEstado = $_POST['frmEstado']; $mPermiso = $_POST['frmPermiso']; if ($_GET['id'] != 0) { $conf->setConfigValue($_GET['id'], array("ID" => $_GET['id'], "NOMBRE" => $mNombre, "EMAIL" => $mEmail, "USUARIO" => $mUsuario, "PASSWORD" => $mPassword, "ESTADO" => $mEstado, "PERMISO" => $mPermiso), "array"); } else { $NEW_ID = xmlconfig_generaid(_CFG_XML_USUARIOS); $conf->setConfigValue($NEW_ID, array("ID" => $NEW_ID, "NOMBRE" => $mNombre, "EMAIL" => $mEmail, "USUARIO" => $mUsuario, "PASSWORD" => $mPassword, "ESTADO" => $mEstado, "PERMISO" => $mPermiso), "array"); } $conf->writeConfigFile(_CFG_XML_USUARIOS, "xml", array("mode" => "pretty")); header("Location: ../../../index.php?grupo=configuracion&seccion=usuarios&pag=index\n\n"); exit;
function db_mysql_dbasecrear($dominio, $dbase, $password) { $link = mysql_connect(_CFG_MYSQL_SERVER, _CFG_MYSQL_USER, _CFG_MYSQL_PASSWORD); mysql_select_db(_CFG_MYSQL_DB, $link); @mysql_query("CREATE DATABASE `{$dbase}`;", $link); $version = db_mysql_version(1); switch ($version) { case "3.23": mysql_query("INSERT INTO user VALUES('localhost','{$dbase}',PASSWORD('{$password}'),'N','N','N','N','N','N','N','N','N','N','N','N','N','N');", $link); mysql_query("INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv) values ('localhost','{$dbase}','{$dbase}','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');", $link); break; case "4.0": mysql_query("INSERT INTO user VALUES('localhost','{$dbase}',PASSWORD('{$password}'),'N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0);", $link); mysql_query("INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Create_tmp_table_priv,Lock_tables_priv) values ('localhost','{$dbase}','{$dbase}','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');", $link); break; case "4.1": mysql_query("INSERT INTO user VALUES('localhost','{$dbase}',OLD_PASSWORD('{$password}'),'N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0);", $link); mysql_query("INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Create_tmp_table_priv,Lock_tables_priv) values ('localhost','{$dbase}','{$dbase}','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');", $link); break; case "5.0": mysql_query("INSERT INTO user VALUES('localhost','{$dbase}',OLD_PASSWORD('{$password}'),'N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0);", $link); mysql_query("INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Create_tmp_table_priv,Lock_tables_priv) values ('localhost','{$dbase}','{$dbase}','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');", $link); break; } @mysql_query("FLUSH PRIVILEGES;", $link); mysql_close($link); //Crea la configuracion en el XML $EXISTE = xmlconfig_buscar(_CFG_XML_BASEDATOS, "DOMINIO", $dominio, "DATABASE", $dbase, "posicion"); if ($EXISTE == 0) { //Crea copia seguridad antes de modificar xmlconfig_backup(_CFG_XML_BASEDATOS); $conf = new patConfiguration(); $conf->setConfigDir(_CFG_XML_CONFIG_DIR); $conf->parseConfigFile(_CFG_XML_BASEDATOS, a); $NEW_ID = xmlconfig_generaid(_CFG_XML_BASEDATOS); $conf->setConfigValue($NEW_ID, array("ID" => $NEW_ID, "DOMINIO" => $dominio, "DATABASE" => $dbase, "USUARIO" => $dbase, "PASSWORD" => md5_encrypt($password, _CFG_INTERFACE_BLOWFISH), "ESTADO" => 1), "array"); $conf->writeConfigFile(_CFG_XML_BASEDATOS, "xml", array("mode" => "pretty")); //Fin fichero configuracion XML } }