diff --git a/install/autoupdate.php b/install/autoupdate.php index 7a57985806744ea50cb634329a0ccc7641edf1a1..d4bbfcd11e51e6454cdb59a68b11edd7dabd110d 100644 --- a/install/autoupdate.php +++ b/install/autoupdate.php @@ -1,309 +1,314 @@ ->This script is for internal use only! Please use update.php! \n\n"; - exit; -} - -//** Include the library with the basic installer functions -require_once('lib/install.lib.php'); - -//** Include the library with the basic updater functions -require_once('lib/update.lib.php'); - -//** Include the base class of the installer class -require_once('lib/installer_base.lib.php'); - -//** Ensure that current working directory is install directory -$cur_dir = getcwd(); -if(realpath(dirname(__FILE__)) != $cur_dir) die("Please run installation/update from _inside_ the install directory!\n"); - -//** Install logfile -define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log'); -define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../')); - -//** Get distribution identifier -$dist = get_distname(); - -include_once("/usr/local/ispconfig/server/lib/config.inc.php"); -$conf_old = $conf; -unset($conf); - -if($dist['id'] == '') die('Linux distribution or version not recognized.'); - -//** Include the distribution-specific installer class library and configuration -if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php'); -include_once('dist/lib/'.$dist['id'].'.lib.php'); -include_once('dist/conf/'.$dist['id'].'.conf.php'); - -//** Get hostname -exec('hostname -f', $tmp_out); -$conf['hostname'] = $tmp_out[0]; -unset($tmp_out); - -//** Set the mysql login information -$conf["mysql"]["host"] = $conf_old["db_host"]; -$conf["mysql"]["database"] = $conf_old["db_database"]; -$conf['mysql']['charset'] = 'utf8'; -$conf["mysql"]["ispconfig_user"] = $conf_old["db_user"]; -$conf["mysql"]["ispconfig_password"] = $conf_old["db_password"]; -$conf['language'] = $conf_old['language']; -if($conf['language'] == '{language}') $conf['language'] = 'en'; - -if(isset($conf_old["dbmaster_host"])) $conf["mysql"]["master_host"] = $conf_old["dbmaster_host"]; -if(isset($conf_old["dbmaster_database"])) $conf["mysql"]["master_database"] = $conf_old["dbmaster_database"]; -if(isset($conf_old["dbmaster_user"])) $conf["mysql"]["master_ispconfig_user"] = $conf_old["dbmaster_user"]; -if(isset($conf_old["dbmaster_password"])) $conf["mysql"]["master_ispconfig_password"] = $conf_old["dbmaster_password"]; - -//* Check if this is a master / slave setup -$conf['mysql']['master_slave_setup'] = 'n'; -if($conf["mysql"]["master_host"] != '' && $conf["mysql"]["host"] != $conf["mysql"]["master_host"]) { - $conf['mysql']['master_slave_setup'] = 'y'; -} - -// Resolve the IP address of the mysql hostname. -if(!$conf['mysql']['ip'] = gethostbyname($conf['mysql']['host'])) die('Unable to resolve hostname'.$conf['mysql']['host']); - -$conf['server_id'] = intval($conf_old["server_id"]); -$conf['ispconfig_log_priority'] = $conf_old["log_priority"]; - -$inst = new installer(); -$inst->is_update = true; - -//** Detect the installed applications -$inst->find_installed_apps(); - -//** Initialize the MySQL server connection -include_once('lib/mysql.lib.php'); - -//** Database update is a bit brute force and should be rebuild later ;) - -/* - * Try to read the DB-admin settings - */ -$clientdb_host = ''; -$clientdb_user = ''; -$clientdb_password = ''; -include_once("/usr/local/ispconfig/server/lib/mysql_clientdb.conf"); -$conf["mysql"]["admin_user"] = $clientdb_user; -$conf["mysql"]["admin_password"] = $clientdb_password; -$clientdb_host = ''; -$clientdb_user = ''; -$clientdb_password = ''; - -//** There is a error if user for mysql admin_password if empty -if( empty($conf["mysql"]["admin_password"]) ) { - die("internal error - MYSQL-Root passord not known"); -} - -/* - * Prepare the dump of the database -*/ -prepareDBDump(); - -//* initialize the database -$inst->db = new db(); - -/* - * The next line is a bit tricky! - * At the automated update we have no connection to the master-db (we don't need it, because - * there are only TWO points, where this is needed) - * 1) update the rights --> the autoupdater sets the rights of all clients when the server is - * autoupdated) - * 2) update the server-settings (is web installed, is mail installed) --> the autoupdates - * doesn't change any of this settings, so there ist no need to update this. - * This means, the autoupdater did not need any connection to the master-db (only to the local bd - * of the master-server). To avoid any problems, we set the master-db to the local one. - */ -$inst->dbmaster = $inst->db; - -/* - * If it is NOT a master-slave - Setup then we are at the Master-DB. So set all rights -*/ -if($conf['mysql']['master_slave_setup'] != 'y') { - $inst->grant_master_database_rights(); -} - -/* - * dump the new Database and reconfigure the server.ini - */ -updateDbAndIni(); - -/* - * Reconfigure all Services - */ -if($conf['services']['mail'] == true) { - //** Configure postfix - swriteln('Configuring Postfix'); - $inst->configure_postfix('dont-create-certs'); - - //* Configure Jailkit - swriteln('Configuring Jailkit'); - $inst->configure_jailkit(); - - if($conf['dovecot']['installed'] == true) { - //* Configure dovecot - swriteln('Configuring Dovecot'); - $inst->configure_dovecot(); - } else { - //** Configure saslauthd - swriteln('Configuring SASL'); - $inst->configure_saslauthd(); - - //** Configure PAM - swriteln('Configuring PAM'); - $inst->configure_pam(); - - //* Configure courier - swriteln('Configuring Courier'); - $inst->configure_courier(); - } - - //** Configure Spamasassin - swriteln('Configuring Spamassassin'); - $inst->configure_spamassassin(); - - //** Configure Amavis - swriteln('Configuring Amavisd'); - $inst->configure_amavis(); - - //** Configure Getmail - swriteln('Configuring Getmail'); - $inst->configure_getmail(); -} - -if($conf['services']['web'] == true) { - //** Configure Pureftpd - swriteln('Configuring Pureftpd'); - $inst->configure_pureftpd(); -} - -if($conf['services']['dns'] == true) { - //* Configure DNS - if($conf['powerdns']['installed'] == true) { - swriteln('Configuring PowerDNS'); - $inst->configure_powerdns(); - } elseif($conf['bind']['installed'] == true) { - swriteln('Configuring BIND'); - $inst->configure_bind(); - } else { - swriteln('Configuring MyDNS'); - $inst->configure_mydns(); - } -} - -if($conf['services']['web'] == true) { - //** Configure Apache - swriteln('Configuring Apache'); - $inst->configure_apache(); - - //** Configure vlogger - swriteln('Configuring vlogger'); - $inst->configure_vlogger(); - - //** Configure apps vhost - swriteln('Configuring Apps vhost'); - $inst->configure_apps_vhost(); -} - - -//* Configure DBServer -swriteln('Configuring Database'); -$inst->configure_dbserver(); - - -//if(@is_dir('/etc/Bastille')) { -//* Configure Firewall -swriteln('Configuring Firewall'); -$inst->configure_firewall(); -//} - -//** Configure ISPConfig -swriteln('Updating ISPConfig'); - - -//** Customise the port ISPConfig runs on -$conf['apache']['vhost_port'] = get_ispconfig_port_number(); - -$inst->install_ispconfig(); - -//** Configure Crontab -swriteln('Updating Crontab'); -$inst->install_crontab(); - -//** Restart services: -swriteln('Restarting services ...'); -if($conf['mysql']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mysql']['init_script'])) system($conf['init_scripts'].'/'.$conf['mysql']['init_script'].' reload'); -if($conf['services']['mail']) { - if($conf['postfix']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['postfix']['init_script'])) system($conf['init_scripts'].'/'.$conf['postfix']['init_script'].' restart'); - if($conf['saslauthd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'])) system($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'].' restart'); - if($conf['amavis']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['amavis']['init_script'])) system($conf['init_scripts'].'/'.$conf['amavis']['init_script'].' restart'); - if($conf['clamav']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['clamav']['init_script'])) system($conf['init_scripts'].'/'.$conf['clamav']['init_script'].' restart'); - if($conf['courier']['courier-authdaemon'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'].' restart'); - if($conf['courier']['courier-imap'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap'].' restart'); - if($conf['courier']['courier-imap-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'].' restart'); - if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart'); - if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart'); - if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script'])) system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart'); -} -if($conf['services']['web']) { - if($conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart'); - if($conf['pureftpd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'])) system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart'); -} -if($conf['services']['dns']) { - if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mydns']['init_script'])) system($conf['init_scripts'].'/'.$conf['mydns']['init_script'].' restart &> /dev/null'); - if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['powerdns']['init_script'])) system($conf['init_scripts'].'/'.$conf['powerdns']['init_script'].' restart &> /dev/null'); - if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['bind']['init_script'])) system($conf['init_scripts'].'/'.$conf['bind']['init_script'].' restart &> /dev/null'); -} - -echo "Update finished.\n"; - -?> +>This script is for internal use only! Please use update.php! \n\n"; + exit; +} + +//** Include the library with the basic installer functions +require_once('lib/install.lib.php'); + +//** Include the library with the basic updater functions +require_once('lib/update.lib.php'); + +//** Include the base class of the installer class +require_once('lib/installer_base.lib.php'); + +//** Ensure that current working directory is install directory +$cur_dir = getcwd(); +if(realpath(dirname(__FILE__)) != $cur_dir) die("Please run installation/update from _inside_ the install directory!\n"); + +//** Install logfile +define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log'); +define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../')); + +//** Get distribution identifier +$dist = get_distname(); + +include_once("/usr/local/ispconfig/server/lib/config.inc.php"); +$conf_old = $conf; +unset($conf); + +if($dist['id'] == '') die('Linux distribution or version not recognized.'); + +//** Include the distribution-specific installer class library and configuration +if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php'); +include_once('dist/lib/'.$dist['id'].'.lib.php'); +include_once('dist/conf/'.$dist['id'].'.conf.php'); + +//** Get hostname +exec('hostname -f', $tmp_out); +$conf['hostname'] = $tmp_out[0]; +unset($tmp_out); + +//** Set the mysql login information +$conf["mysql"]["host"] = $conf_old["db_host"]; +$conf["mysql"]["database"] = $conf_old["db_database"]; +$conf['mysql']['charset'] = 'utf8'; +$conf["mysql"]["ispconfig_user"] = $conf_old["db_user"]; +$conf["mysql"]["ispconfig_password"] = $conf_old["db_password"]; +$conf['language'] = $conf_old['language']; +if($conf['language'] == '{language}') $conf['language'] = 'en'; + +if(isset($conf_old["dbmaster_host"])) $conf["mysql"]["master_host"] = $conf_old["dbmaster_host"]; +if(isset($conf_old["dbmaster_database"])) $conf["mysql"]["master_database"] = $conf_old["dbmaster_database"]; +if(isset($conf_old["dbmaster_user"])) $conf["mysql"]["master_ispconfig_user"] = $conf_old["dbmaster_user"]; +if(isset($conf_old["dbmaster_password"])) $conf["mysql"]["master_ispconfig_password"] = $conf_old["dbmaster_password"]; + +//* Check if this is a master / slave setup +$conf['mysql']['master_slave_setup'] = 'n'; +if($conf["mysql"]["master_host"] != '' && $conf["mysql"]["host"] != $conf["mysql"]["master_host"]) { + $conf['mysql']['master_slave_setup'] = 'y'; +} + +// Resolve the IP address of the mysql hostname. +if(!$conf['mysql']['ip'] = gethostbyname($conf['mysql']['host'])) die('Unable to resolve hostname'.$conf['mysql']['host']); + +$conf['server_id'] = intval($conf_old["server_id"]); +$conf['ispconfig_log_priority'] = $conf_old["log_priority"]; + +$inst = new installer(); +$inst->is_update = true; + +//** Detect the installed applications +$inst->find_installed_apps(); + +//** Initialize the MySQL server connection +include_once('lib/mysql.lib.php'); + +//** Database update is a bit brute force and should be rebuild later ;) + +/* + * Try to read the DB-admin settings + */ +$clientdb_host = ''; +$clientdb_user = ''; +$clientdb_password = ''; +include_once("/usr/local/ispconfig/server/lib/mysql_clientdb.conf"); +$conf["mysql"]["admin_user"] = $clientdb_user; +$conf["mysql"]["admin_password"] = $clientdb_password; +$clientdb_host = ''; +$clientdb_user = ''; +$clientdb_password = ''; + +//** There is a error if user for mysql admin_password if empty +if( empty($conf["mysql"]["admin_password"]) ) { + die("internal error - MYSQL-Root passord not known"); +} + +/* + * Prepare the dump of the database +*/ +prepareDBDump(); + +//* initialize the database +$inst->db = new db(); + +/* + * The next line is a bit tricky! + * At the automated update we have no connection to the master-db (we don't need it, because + * there are only TWO points, where this is needed) + * 1) update the rights --> the autoupdater sets the rights of all clients when the server is + * autoupdated) + * 2) update the server-settings (is web installed, is mail installed) --> the autoupdates + * doesn't change any of this settings, so there ist no need to update this. + * This means, the autoupdater did not need any connection to the master-db (only to the local bd + * of the master-server). To avoid any problems, we set the master-db to the local one. + */ +$inst->dbmaster = $inst->db; + +/* + * If it is NOT a master-slave - Setup then we are at the Master-DB. So set all rights +*/ +if($conf['mysql']['master_slave_setup'] != 'y') { + $inst->grant_master_database_rights(); +} + +/* + * dump the new Database and reconfigure the server.ini + */ +updateDbAndIni(); + +/* + * Reconfigure all Services + */ +if($conf['services']['mail'] == true) { + //** Configure postfix + swriteln('Configuring Postfix'); + $inst->configure_postfix('dont-create-certs'); + + //** Configure mailman + swriteln('Configuring Mailman'); + $inst->configure_mailman('update'); + + //* Configure Jailkit + swriteln('Configuring Jailkit'); + $inst->configure_jailkit(); + + if($conf['dovecot']['installed'] == true) { + //* Configure dovecot + swriteln('Configuring Dovecot'); + $inst->configure_dovecot(); + } else { + //** Configure saslauthd + swriteln('Configuring SASL'); + $inst->configure_saslauthd(); + + //** Configure PAM + swriteln('Configuring PAM'); + $inst->configure_pam(); + + //* Configure courier + swriteln('Configuring Courier'); + $inst->configure_courier(); + } + + //** Configure Spamasassin + swriteln('Configuring Spamassassin'); + $inst->configure_spamassassin(); + + //** Configure Amavis + swriteln('Configuring Amavisd'); + $inst->configure_amavis(); + + //** Configure Getmail + swriteln('Configuring Getmail'); + $inst->configure_getmail(); +} + +if($conf['services']['web'] == true) { + //** Configure Pureftpd + swriteln('Configuring Pureftpd'); + $inst->configure_pureftpd(); +} + +if($conf['services']['dns'] == true) { + //* Configure DNS + if($conf['powerdns']['installed'] == true) { + swriteln('Configuring PowerDNS'); + $inst->configure_powerdns(); + } elseif($conf['bind']['installed'] == true) { + swriteln('Configuring BIND'); + $inst->configure_bind(); + } else { + swriteln('Configuring MyDNS'); + $inst->configure_mydns(); + } +} + +if($conf['services']['web'] == true) { + //** Configure Apache + swriteln('Configuring Apache'); + $inst->configure_apache(); + + //** Configure vlogger + swriteln('Configuring vlogger'); + $inst->configure_vlogger(); + + //** Configure apps vhost + swriteln('Configuring Apps vhost'); + $inst->configure_apps_vhost(); +} + + +//* Configure DBServer +swriteln('Configuring Database'); +$inst->configure_dbserver(); + + +//if(@is_dir('/etc/Bastille')) { +//* Configure Firewall +swriteln('Configuring Firewall'); +$inst->configure_firewall(); +//} + +//** Configure ISPConfig +swriteln('Updating ISPConfig'); + + +//** Customise the port ISPConfig runs on +$conf['apache']['vhost_port'] = get_ispconfig_port_number(); + +$inst->install_ispconfig(); + +//** Configure Crontab +swriteln('Updating Crontab'); +$inst->install_crontab(); + +//** Restart services: +swriteln('Restarting services ...'); +if($conf['mysql']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mysql']['init_script'])) system($conf['init_scripts'].'/'.$conf['mysql']['init_script'].' reload'); +if($conf['services']['mail']) { + if($conf['postfix']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['postfix']['init_script'])) system($conf['init_scripts'].'/'.$conf['postfix']['init_script'].' restart'); + if($conf['saslauthd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'])) system($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'].' restart'); + if($conf['amavis']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['amavis']['init_script'])) system($conf['init_scripts'].'/'.$conf['amavis']['init_script'].' restart'); + if($conf['clamav']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['clamav']['init_script'])) system($conf['init_scripts'].'/'.$conf['clamav']['init_script'].' restart'); + if($conf['courier']['courier-authdaemon'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'].' restart'); + if($conf['courier']['courier-imap'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap'].' restart'); + if($conf['courier']['courier-imap-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'].' restart'); + if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart'); + if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart'); + if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script'])) system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart'); + if($conf['mailman']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mailman']['init_script'])) system($conf['init_scripts'].'/'.$conf['mailman']['init_script'].' restart'); +} +if($conf['services']['web']) { + if($conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart'); + if($conf['pureftpd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'])) system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart'); +} +if($conf['services']['dns']) { + if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mydns']['init_script'])) system($conf['init_scripts'].'/'.$conf['mydns']['init_script'].' restart &> /dev/null'); + if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['powerdns']['init_script'])) system($conf['init_scripts'].'/'.$conf['powerdns']['init_script'].' restart &> /dev/null'); + if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['bind']['init_script'])) system($conf['init_scripts'].'/'.$conf['bind']['init_script'].' restart &> /dev/null'); +} + +echo "Update finished.\n"; + +?> diff --git a/install/dist/conf/debian40.conf.php b/install/dist/conf/debian40.conf.php index a4ba76b63ea0e1b87d2552418f6a1e05b96a40d3..d17670164438cda6d108da400ea5f60aa793e74a 100644 --- a/install/dist/conf/debian40.conf.php +++ b/install/dist/conf/debian40.conf.php @@ -1,189 +1,194 @@ - + diff --git a/install/dist/conf/debian60.conf.php b/install/dist/conf/debian60.conf.php index 0f239c68181501682340080bb488b69bd5dfcd70..c1344d50985aa23cde682103ff8e0503ac7e744d 100644 --- a/install/dist/conf/debian60.conf.php +++ b/install/dist/conf/debian60.conf.php @@ -1,189 +1,194 @@ - + diff --git a/install/install.php b/install/install.php index e4a934be2054c5405cd95320a6152b1eb858738e..e5785fa744367c621fce97174692abbf6aae5a79 100644 --- a/install/install.php +++ b/install/install.php @@ -1,482 +1,491 @@ -> Initial configuration \n\n"; - -//** Include the library with the basic installer functions -require_once('lib/install.lib.php'); - -//** Include the base class of the installer class -require_once('lib/installer_base.lib.php'); - -//** Ensure that current working directory is install directory -$cur_dir = getcwd(); -if(realpath(dirname(__FILE__)) != $cur_dir) { - chdir( realpath(dirname(__FILE__)) ); -} - -//** Install logfile -define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log'); -define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../')); - -//** Check for existing installation -/*if(is_dir("/usr/local/ispconfig")) { - die('We will stop here. There is already a ISPConfig installation, use the update script to update this installation.'); -}*/ - -//** Get distribution identifier -$dist = get_distname(); - -if($dist['id'] == '') die('Linux distribution or version not recognized.'); - -//** Include the distribution-specific installer class library and configuration -if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php'); -include_once('dist/lib/'.$dist['id'].'.lib.php'); -include_once('dist/conf/'.$dist['id'].'.conf.php'); - -//**************************************************************************************************** -//** Installer Interface -//**************************************************************************************************** -$inst = new installer(); -swriteln($inst->lng(' Following will be a few questions for primary configuration so be careful.')); -swriteln($inst->lng(' Default values are in [brackets] and can be accepted with .')); -swriteln($inst->lng(' Tap in "quit" (without the quotes) to stop the installer.'."\n\n")); - -//** Check log file is writable (probably not root or sudo) -if(!is_writable(dirname(ISPC_LOG_FILE))){ - die("ERROR: Cannot write to the ".dirname(ISPC_LOG_FILE)." directory. Are you root or sudo ?\n\n"); -} - -if(is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) { - die('This software cannot be installed on a server wich runs ISPConfig 2.x.'); -} - -if(is_dir('/usr/local/ispconfig')) { - die('ISPConfig 3 installation found. Please use update.php instead if install.php to update the installation.'); -} - -//** Detect the installed applications -$inst->find_installed_apps(); - -//** Select the language -$conf['language'] = $inst->simple_query('Select language', array('en','de'), 'en'); - -//** Select installation mode -$install_mode = $inst->simple_query('Installation mode', array('standard','expert'), 'standard'); - - -//** Get the hostname -$tmp_out = array(); -exec('hostname -f', $tmp_out); -$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', $tmp_out[0]); -unset($tmp_out); - -// Check if the mysql functions are loaded in PHP -if(!function_exists('mysql_connect')) die('No PHP MySQL functions available. Please ensure that the PHP MySQL module is loaded.'); - -//** Get MySQL root credentials -$finished = false; -do { - $tmp_mysql_server_host = $inst->free_query('MySQL server hostname', $conf['mysql']['host']); - $tmp_mysql_server_admin_user = $inst->free_query('MySQL root username', $conf['mysql']['admin_user']); - $tmp_mysql_server_admin_password = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']); - $tmp_mysql_server_database = $inst->free_query('MySQL database to create', $conf['mysql']['database']); - $tmp_mysql_server_charset = $inst->free_query('MySQL charset', $conf['mysql']['charset']); - - //* Initialize the MySQL server connection - if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { - $conf['mysql']['host'] = $tmp_mysql_server_host; - $conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user; - $conf['mysql']['admin_password'] = $tmp_mysql_server_admin_password; - $conf['mysql']['database'] = $tmp_mysql_server_database; - $conf['mysql']['charset'] = $tmp_mysql_server_charset; - $finished = true; - } else { - swriteln($inst->lng('Unable to connect to the specified MySQL server').' '.mysql_error()); - } -} while ($finished == false); -unset($finished); - -// Resolve the IP address of the MySQL hostname. -$tmp = explode(':',$conf['mysql']['host']); -if(!$conf['mysql']['ip'] = gethostbyname($tmp[0])) die('Unable to resolve hostname'.$tmp[0]); -unset($tmp); - - -//** Initializing database connection -include_once('lib/mysql.lib.php'); -$inst->db = new db(); - -//** Begin with standard or expert installation -if($install_mode == 'standard') { - - //* Create the MySQL database - $inst->configure_database(); - - //* Insert the Server record into the database - $inst->add_database_server_record(); - - //* Configure Postfix - $inst->configure_postfix(); - - //* Configure jailkit - swriteln('Configuring Jailkit'); - $inst->configure_jailkit(); - - if($conf['dovecot']['installed'] == true) { - //* Configure Dovecot - swriteln('Configuring Dovecot'); - $inst->configure_dovecot(); - } else { - //* Configure saslauthd - swriteln('Configuring SASL'); - $inst->configure_saslauthd(); - - //* Configure PAM - swriteln('Configuring PAM'); - $inst->configure_pam(); - - //* Configure Courier - swriteln('Configuring Courier'); - $inst->configure_courier(); - } - - //* Configure Spamasassin - swriteln('Configuring Spamassassin'); - $inst->configure_spamassassin(); - - //* Configure Amavis - swriteln('Configuring Amavisd'); - $inst->configure_amavis(); - - //* Configure Getmail - swriteln('Configuring Getmail'); - $inst->configure_getmail(); - - - //* Configure Pureftpd - swriteln('Configuring Pureftpd'); - $inst->configure_pureftpd(); - - //* Configure DNS - if($conf['powerdns']['installed'] == true) { - swriteln('Configuring PowerDNS'); - $inst->configure_powerdns(); - } elseif($conf['bind']['installed'] == true) { - swriteln('Configuring BIND'); - $inst->configure_bind(); - } else { - swriteln('Configuring MyDNS'); - $inst->configure_mydns(); - } - - //* Configure Apache - swriteln('Configuring Apache'); - $inst->configure_apache(); - - //** Configure Vlogger - swriteln('Configuring Vlogger'); - $inst->configure_vlogger(); - - //** Configure apps vhost - swriteln('Configuring Apps vhost'); - $inst->configure_apps_vhost(); - - //* Configure Firewall - swriteln('Configuring Firewall'); - $inst->configure_firewall(); - - //* Configure ISPConfig - swriteln('Installing ISPConfig'); - - //** Customize the port ISPConfig runs on - $conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', '8080'); - - $inst->install_ispconfig(); - - //* Configure DBServer - swriteln('Configuring DBServer'); - $inst->configure_dbserver(); - - //* Configure ISPConfig - swriteln('Installing ISPConfig crontab'); - $inst->install_crontab(); - - swriteln('Restarting services ...'); - if($conf['mysql']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mysql']['init_script'])) system($conf['init_scripts'].'/'.$conf['mysql']['init_script'].' restart'); - if($conf['postfix']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['postfix']['init_script'])) system($conf['init_scripts'].'/'.$conf['postfix']['init_script'].' restart'); - if($conf['saslauthd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'])) system($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'].' restart'); - if($conf['amavis']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['amavis']['init_script'])) system($conf['init_scripts'].'/'.$conf['amavis']['init_script'].' restart'); - if($conf['clamav']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['clamav']['init_script'])) system($conf['init_scripts'].'/'.$conf['clamav']['init_script'].' restart'); - if($conf['courier']['courier-authdaemon'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'].' restart'); - if($conf['courier']['courier-imap'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap'].' restart'); - if($conf['courier']['courier-imap-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'].' restart'); - if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart'); - if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart'); - if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script'])) system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart'); - if($conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart'); - if($conf['pureftpd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'])) system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart'); - if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mydns']['init_script'])) system($conf['init_scripts'].'/'.$conf['mydns']['init_script'].' restart &> /dev/null'); - if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['powerdns']['init_script'])) system($conf['init_scripts'].'/'.$conf['powerdns']['init_script'].' restart &> /dev/null'); - if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['bind']['init_script'])) system($conf['init_scripts'].'/'.$conf['bind']['init_script'].' restart &> /dev/null'); - -}else{ - - //* In expert mode, we select the services in the following steps, only db is always available - $conf['services']['mail'] = false; - $conf['services']['web'] = false; - $conf['services']['dns'] = false; - $conf['services']['db'] = true; - - - //** Get Server ID - // $conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1'); - // Server ID is an autoInc value of the mysql database now - - if(strtolower($inst->simple_query('Shall this server join an existing ISPConfig multiserver setup',array('y','n'),'n')) == 'y') { - $conf['mysql']['master_slave_setup'] = 'y'; - - //** Get MySQL root credentials - $finished = false; - do { - $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host']); - $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user']); - $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password']); - $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']); - - //* Initialize the MySQL server connection - if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { - $conf['mysql']['master_host'] = $tmp_mysql_server_host; - $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; - $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password; - $conf['mysql']['master_database'] = $tmp_mysql_server_database; - $finished = true; - } else { - swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); - } - } while ($finished == false); - unset($finished); - - // initialize the connection to the master database - $inst->dbmaster = new db(); - if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); - $inst->dbmaster->dbHost = $conf['mysql']["master_host"]; - $inst->dbmaster->dbName = $conf['mysql']["master_database"]; - $inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"]; - $inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"]; - - } else { - // the master DB is the same then the slave DB - $inst->dbmaster = $inst->db; - } - - //* Create the mysql database - $inst->configure_database(); - - //* Insert the Server record into the database - swriteln('Adding ISPConfig server record to database.'); - swriteln(''); - $inst->add_database_server_record(); - - - if(strtolower($inst->simple_query('Configure Mail', array('y','n') ,'y') ) == 'y') { - - $conf['services']['mail'] = true; - - //* Configure Postfix - swriteln('Configuring Postfix'); - $inst->configure_postfix(); - - if($conf['dovecot']['installed'] == true) { - //* Configure dovecot - swriteln('Configuring Dovecot'); - $inst->configure_dovecot(); - } else { - - //* Configure saslauthd - swriteln('Configuring SASL'); - $inst->configure_saslauthd(); - - //* Configure PAM - swriteln('Configuring PAM'); - $inst->configure_pam(); - - //* Configure courier - swriteln('Configuring Courier'); - $inst->configure_courier(); - } - - //* Configure Spamasassin - swriteln('Configuring Spamassassin'); - $inst->configure_spamassassin(); - - //* Configure Amavis - swriteln('Configuring Amavisd'); - $inst->configure_amavis(); - - //* Configure Getmail - swriteln('Configuring Getmail'); - $inst->configure_getmail(); - - if($conf['postfix']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['postfix']['init_script'])) system($conf['init_scripts'].'/'.$conf['postfix']['init_script'].' restart'); - if($conf['saslauthd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'])) system($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'].' restart'); - if($conf['amavis']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['amavis']['init_script'])) system($conf['init_scripts'].'/'.$conf['amavis']['init_script'].' restart'); - if($conf['clamav']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['clamav']['init_script'])) system($conf['init_scripts'].'/'.$conf['clamav']['init_script'].' restart'); - if($conf['courier']['courier-authdaemon'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'].' restart'); - if($conf['courier']['courier-imap'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap'].' restart'); - if($conf['courier']['courier-imap-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'].' restart'); - if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart'); - if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart'); - if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script'])) system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart'); - } - - //** Configure Jailkit - if(strtolower($inst->simple_query('Configure Jailkit', array('y','n'),'y') ) == 'y') { - swriteln('Configuring Jailkit'); - $inst->configure_jailkit(); - } - - //** Configure Pureftpd - if(strtolower($inst->simple_query('Configure FTP Server', array('y','n'),'y') ) == 'y') { - swriteln('Configuring Pureftpd'); - $inst->configure_pureftpd(); - if($conf['pureftpd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'])) system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart'); - } - - //** Configure DNS - if(strtolower($inst->simple_query('Configure DNS Server',array('y','n'),'y')) == 'y') { - $conf['services']['dns'] = true; - //* Configure DNS - if($conf['powerdns']['installed'] == true) { - swriteln('Configuring PowerDNS'); - $inst->configure_powerdns(); - if($conf['powerdns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['powerdns']['init_script'])) system($conf['init_scripts'].'/'.$conf['powerdns']['init_script'].' restart &> /dev/null'); - } elseif($conf['bind']['installed'] == true) { - swriteln('Configuring BIND'); - $inst->configure_bind(); - if($conf['bind']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['bind']['init_script'])) system($conf['init_scripts'].'/'.$conf['bind']['init_script'].' restart &> /dev/null'); - } else { - swriteln('Configuring MyDNS'); - $inst->configure_mydns(); - if($conf['mydns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mydns']['init_script'])) system($conf['init_scripts'].'/'.$conf['mydns']['init_script'].' restart &> /dev/null'); - } - - } - - //** Configure Apache - swriteln("\nHint: If this server shall run the ISPConfig interface, select 'y' in the 'Configure Apache Server' option.\n"); - if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') { - $conf['services']['web'] = true; - swriteln('Configuring Apache'); - $inst->configure_apache(); - - //** Configure Vlogger - swriteln('Configuring Vlogger'); - $inst->configure_vlogger(); - - //** Configure apps vhost - swriteln('Configuring Apps vhost'); - $inst->configure_apps_vhost(); - } - - //** Configure Firewall - if(strtolower($inst->simple_query('Configure Firewall Server',array('y','n'),'y')) == 'y') { - swriteln('Configuring Firewall'); - $inst->configure_firewall(); - } - - //** Configure ISPConfig :-) - if(strtolower($inst->simple_query('Install ISPConfig Web Interface',array('y','n'),'y')) == 'y') { - swriteln('Installing ISPConfig'); - - //** We want to check if the server is a module or cgi based php enabled server - //** TODO: Don't always ask for this somehow ? - /* - $fast_cgi = $inst->simple_query('CGI PHP Enabled Server?', array('yes','no'),'no'); - - if($fast_cgi == 'yes') { - $alias = $inst->free_query('Script Alias', '/php/'); - $path = $inst->free_query('Script Alias Path', '/path/to/cgi/bin'); - $conf['apache']['vhost_cgi_alias'] = sprintf('ScriptAlias %s %s', $alias, $path); - } else { - $conf['apache']['vhost_cgi_alias'] = ""; - } - */ - - //** Customise the port ISPConfig runs on - $conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', '8080'); - - if(strtolower($inst->simple_query('Enable SSL for the ISPConfig web interface',array('y','n'),'y')) == 'y') { - $inst->make_ispconfig_ssl_cert(); - } - - $inst->install_ispconfig_interface = true; - - } else { - $inst->install_ispconfig_interface = false; - } - - $inst->install_ispconfig(); - - //* Configure DBServer - swriteln('Configuring DBServer'); - $inst->configure_dbserver(); - - //* Configure ISPConfig - swriteln('Installing ISPConfig crontab'); - $inst->install_crontab(); - if($conf['apache']['init_script'] != '' && @is_file($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart'); - - - -} //* << $install_mode / 'Standard' or Genius - - -echo "Installation completed.\n"; - - -?> +> Initial configuration \n\n"; + +//** Include the library with the basic installer functions +require_once('lib/install.lib.php'); + +//** Include the base class of the installer class +require_once('lib/installer_base.lib.php'); + +//** Ensure that current working directory is install directory +$cur_dir = getcwd(); +if(realpath(dirname(__FILE__)) != $cur_dir) { + chdir( realpath(dirname(__FILE__)) ); +} + +//** Install logfile +define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log'); +define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../')); + +//** Check for existing installation +/*if(is_dir("/usr/local/ispconfig")) { + die('We will stop here. There is already a ISPConfig installation, use the update script to update this installation.'); +}*/ + +//** Get distribution identifier +$dist = get_distname(); + +if($dist['id'] == '') die('Linux distribution or version not recognized.'); + +//** Include the distribution-specific installer class library and configuration +if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php'); +include_once('dist/lib/'.$dist['id'].'.lib.php'); +include_once('dist/conf/'.$dist['id'].'.conf.php'); + +//**************************************************************************************************** +//** Installer Interface +//**************************************************************************************************** +$inst = new installer(); +swriteln($inst->lng(' Following will be a few questions for primary configuration so be careful.')); +swriteln($inst->lng(' Default values are in [brackets] and can be accepted with .')); +swriteln($inst->lng(' Tap in "quit" (without the quotes) to stop the installer.'."\n\n")); + +//** Check log file is writable (probably not root or sudo) +if(!is_writable(dirname(ISPC_LOG_FILE))){ + die("ERROR: Cannot write to the ".dirname(ISPC_LOG_FILE)." directory. Are you root or sudo ?\n\n"); +} + +if(is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) { + die('This software cannot be installed on a server wich runs ISPConfig 2.x.'); +} + +if(is_dir('/usr/local/ispconfig')) { + die('ISPConfig 3 installation found. Please use update.php instead if install.php to update the installation.'); +} + +//** Detect the installed applications +$inst->find_installed_apps(); + +//** Select the language +$conf['language'] = $inst->simple_query('Select language', array('en','de'), 'en'); + +//** Select installation mode +$install_mode = $inst->simple_query('Installation mode', array('standard','expert'), 'standard'); + + +//** Get the hostname +$tmp_out = array(); +exec('hostname -f', $tmp_out); +$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', $tmp_out[0]); +unset($tmp_out); + +// Check if the mysql functions are loaded in PHP +if(!function_exists('mysql_connect')) die('No PHP MySQL functions available. Please ensure that the PHP MySQL module is loaded.'); + +//** Get MySQL root credentials +$finished = false; +do { + $tmp_mysql_server_host = $inst->free_query('MySQL server hostname', $conf['mysql']['host']); + $tmp_mysql_server_admin_user = $inst->free_query('MySQL root username', $conf['mysql']['admin_user']); + $tmp_mysql_server_admin_password = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']); + $tmp_mysql_server_database = $inst->free_query('MySQL database to create', $conf['mysql']['database']); + $tmp_mysql_server_charset = $inst->free_query('MySQL charset', $conf['mysql']['charset']); + + //* Initialize the MySQL server connection + if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { + $conf['mysql']['host'] = $tmp_mysql_server_host; + $conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user; + $conf['mysql']['admin_password'] = $tmp_mysql_server_admin_password; + $conf['mysql']['database'] = $tmp_mysql_server_database; + $conf['mysql']['charset'] = $tmp_mysql_server_charset; + $finished = true; + } else { + swriteln($inst->lng('Unable to connect to the specified MySQL server').' '.mysql_error()); + } +} while ($finished == false); +unset($finished); + +// Resolve the IP address of the MySQL hostname. +$tmp = explode(':',$conf['mysql']['host']); +if(!$conf['mysql']['ip'] = gethostbyname($tmp[0])) die('Unable to resolve hostname'.$tmp[0]); +unset($tmp); + + +//** Initializing database connection +include_once('lib/mysql.lib.php'); +$inst->db = new db(); + +//** Begin with standard or expert installation +if($install_mode == 'standard') { + + //* Create the MySQL database + $inst->configure_database(); + + //* Insert the Server record into the database + $inst->add_database_server_record(); + + //* Configure Postfix + $inst->configure_postfix(); + + //* Configure Mailman + $inst->configure_mailman('install'); + + //* Configure jailkit + swriteln('Configuring Jailkit'); + $inst->configure_jailkit(); + + if($conf['dovecot']['installed'] == true) { + //* Configure Dovecot + swriteln('Configuring Dovecot'); + $inst->configure_dovecot(); + } else { + //* Configure saslauthd + swriteln('Configuring SASL'); + $inst->configure_saslauthd(); + + //* Configure PAM + swriteln('Configuring PAM'); + $inst->configure_pam(); + + //* Configure Courier + swriteln('Configuring Courier'); + $inst->configure_courier(); + } + + //* Configure Spamasassin + swriteln('Configuring Spamassassin'); + $inst->configure_spamassassin(); + + //* Configure Amavis + swriteln('Configuring Amavisd'); + $inst->configure_amavis(); + + //* Configure Getmail + swriteln('Configuring Getmail'); + $inst->configure_getmail(); + + + //* Configure Pureftpd + swriteln('Configuring Pureftpd'); + $inst->configure_pureftpd(); + + //* Configure DNS + if($conf['powerdns']['installed'] == true) { + swriteln('Configuring PowerDNS'); + $inst->configure_powerdns(); + } elseif($conf['bind']['installed'] == true) { + swriteln('Configuring BIND'); + $inst->configure_bind(); + } else { + swriteln('Configuring MyDNS'); + $inst->configure_mydns(); + } + + //* Configure Apache + swriteln('Configuring Apache'); + $inst->configure_apache(); + + //** Configure Vlogger + swriteln('Configuring Vlogger'); + $inst->configure_vlogger(); + + //** Configure apps vhost + swriteln('Configuring Apps vhost'); + $inst->configure_apps_vhost(); + + //* Configure Firewall + swriteln('Configuring Firewall'); + $inst->configure_firewall(); + + //* Configure ISPConfig + swriteln('Installing ISPConfig'); + + //** Customize the port ISPConfig runs on + $conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', '8080'); + + $inst->install_ispconfig(); + + //* Configure DBServer + swriteln('Configuring DBServer'); + $inst->configure_dbserver(); + + //* Configure ISPConfig + swriteln('Installing ISPConfig crontab'); + $inst->install_crontab(); + + swriteln('Restarting services ...'); + if($conf['mysql']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mysql']['init_script'])) system($conf['init_scripts'].'/'.$conf['mysql']['init_script'].' restart'); + if($conf['postfix']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['postfix']['init_script'])) system($conf['init_scripts'].'/'.$conf['postfix']['init_script'].' restart'); + if($conf['saslauthd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'])) system($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'].' restart'); + if($conf['amavis']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['amavis']['init_script'])) system($conf['init_scripts'].'/'.$conf['amavis']['init_script'].' restart'); + if($conf['clamav']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['clamav']['init_script'])) system($conf['init_scripts'].'/'.$conf['clamav']['init_script'].' restart'); + if($conf['courier']['courier-authdaemon'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'].' restart'); + if($conf['courier']['courier-imap'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap'].' restart'); + if($conf['courier']['courier-imap-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'].' restart'); + if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart'); + if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart'); + if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script'])) system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart'); + if($conf['mailman']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mailman']['init_script'])) system($conf['init_scripts'].'/'.$conf['mailman']['init_script'].' restart'); + if($conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart'); + if($conf['pureftpd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'])) system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart'); + if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mydns']['init_script'])) system($conf['init_scripts'].'/'.$conf['mydns']['init_script'].' restart &> /dev/null'); + if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['powerdns']['init_script'])) system($conf['init_scripts'].'/'.$conf['powerdns']['init_script'].' restart &> /dev/null'); + if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['bind']['init_script'])) system($conf['init_scripts'].'/'.$conf['bind']['init_script'].' restart &> /dev/null'); + +}else{ + + //* In expert mode, we select the services in the following steps, only db is always available + $conf['services']['mail'] = false; + $conf['services']['web'] = false; + $conf['services']['dns'] = false; + $conf['services']['db'] = true; + + + //** Get Server ID + // $conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1'); + // Server ID is an autoInc value of the mysql database now + + if(strtolower($inst->simple_query('Shall this server join an existing ISPConfig multiserver setup',array('y','n'),'n')) == 'y') { + $conf['mysql']['master_slave_setup'] = 'y'; + + //** Get MySQL root credentials + $finished = false; + do { + $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host']); + $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user']); + $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password']); + $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']); + + //* Initialize the MySQL server connection + if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { + $conf['mysql']['master_host'] = $tmp_mysql_server_host; + $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; + $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password; + $conf['mysql']['master_database'] = $tmp_mysql_server_database; + $finished = true; + } else { + swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); + } + } while ($finished == false); + unset($finished); + + // initialize the connection to the master database + $inst->dbmaster = new db(); + if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); + $inst->dbmaster->dbHost = $conf['mysql']["master_host"]; + $inst->dbmaster->dbName = $conf['mysql']["master_database"]; + $inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"]; + $inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"]; + + } else { + // the master DB is the same then the slave DB + $inst->dbmaster = $inst->db; + } + + //* Create the mysql database + $inst->configure_database(); + + //* Insert the Server record into the database + swriteln('Adding ISPConfig server record to database.'); + swriteln(''); + $inst->add_database_server_record(); + + + if(strtolower($inst->simple_query('Configure Mail', array('y','n') ,'y') ) == 'y') { + + $conf['services']['mail'] = true; + + //* Configure Postfix + swriteln('Configuring Postfix'); + $inst->configure_postfix(); + + //* Configure Mailman + swriteln('Configuring Mailman'); + $inst->configure_mailman(); + + if($conf['dovecot']['installed'] == true) { + //* Configure dovecot + swriteln('Configuring Dovecot'); + $inst->configure_dovecot(); + } else { + + //* Configure saslauthd + swriteln('Configuring SASL'); + $inst->configure_saslauthd(); + + //* Configure PAM + swriteln('Configuring PAM'); + $inst->configure_pam(); + + //* Configure courier + swriteln('Configuring Courier'); + $inst->configure_courier(); + } + + //* Configure Spamasassin + swriteln('Configuring Spamassassin'); + $inst->configure_spamassassin(); + + //* Configure Amavis + swriteln('Configuring Amavisd'); + $inst->configure_amavis(); + + //* Configure Getmail + swriteln('Configuring Getmail'); + $inst->configure_getmail(); + + if($conf['postfix']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['postfix']['init_script'])) system($conf['init_scripts'].'/'.$conf['postfix']['init_script'].' restart'); + if($conf['saslauthd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'])) system($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'].' restart'); + if($conf['amavis']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['amavis']['init_script'])) system($conf['init_scripts'].'/'.$conf['amavis']['init_script'].' restart'); + if($conf['clamav']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['clamav']['init_script'])) system($conf['init_scripts'].'/'.$conf['clamav']['init_script'].' restart'); + if($conf['courier']['courier-authdaemon'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'].' restart'); + if($conf['courier']['courier-imap'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap'].' restart'); + if($conf['courier']['courier-imap-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'].' restart'); + if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart'); + if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart'); + if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script'])) system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart'); + if($conf['mailman']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mailman']['init_script'])) system($conf['init_scripts'].'/'.$conf['mailman']['init_script'].' restart'); + } + + //** Configure Jailkit + if(strtolower($inst->simple_query('Configure Jailkit', array('y','n'),'y') ) == 'y') { + swriteln('Configuring Jailkit'); + $inst->configure_jailkit(); + } + + //** Configure Pureftpd + if(strtolower($inst->simple_query('Configure FTP Server', array('y','n'),'y') ) == 'y') { + swriteln('Configuring Pureftpd'); + $inst->configure_pureftpd(); + if($conf['pureftpd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'])) system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart'); + } + + //** Configure DNS + if(strtolower($inst->simple_query('Configure DNS Server',array('y','n'),'y')) == 'y') { + $conf['services']['dns'] = true; + //* Configure DNS + if($conf['powerdns']['installed'] == true) { + swriteln('Configuring PowerDNS'); + $inst->configure_powerdns(); + if($conf['powerdns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['powerdns']['init_script'])) system($conf['init_scripts'].'/'.$conf['powerdns']['init_script'].' restart &> /dev/null'); + } elseif($conf['bind']['installed'] == true) { + swriteln('Configuring BIND'); + $inst->configure_bind(); + if($conf['bind']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['bind']['init_script'])) system($conf['init_scripts'].'/'.$conf['bind']['init_script'].' restart &> /dev/null'); + } else { + swriteln('Configuring MyDNS'); + $inst->configure_mydns(); + if($conf['mydns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mydns']['init_script'])) system($conf['init_scripts'].'/'.$conf['mydns']['init_script'].' restart &> /dev/null'); + } + + } + + //** Configure Apache + swriteln("\nHint: If this server shall run the ISPConfig interface, select 'y' in the 'Configure Apache Server' option.\n"); + if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') { + $conf['services']['web'] = true; + swriteln('Configuring Apache'); + $inst->configure_apache(); + + //** Configure Vlogger + swriteln('Configuring Vlogger'); + $inst->configure_vlogger(); + + //** Configure apps vhost + swriteln('Configuring Apps vhost'); + $inst->configure_apps_vhost(); + } + + //** Configure Firewall + if(strtolower($inst->simple_query('Configure Firewall Server',array('y','n'),'y')) == 'y') { + swriteln('Configuring Firewall'); + $inst->configure_firewall(); + } + + //** Configure ISPConfig :-) + if(strtolower($inst->simple_query('Install ISPConfig Web Interface',array('y','n'),'y')) == 'y') { + swriteln('Installing ISPConfig'); + + //** We want to check if the server is a module or cgi based php enabled server + //** TODO: Don't always ask for this somehow ? + /* + $fast_cgi = $inst->simple_query('CGI PHP Enabled Server?', array('yes','no'),'no'); + + if($fast_cgi == 'yes') { + $alias = $inst->free_query('Script Alias', '/php/'); + $path = $inst->free_query('Script Alias Path', '/path/to/cgi/bin'); + $conf['apache']['vhost_cgi_alias'] = sprintf('ScriptAlias %s %s', $alias, $path); + } else { + $conf['apache']['vhost_cgi_alias'] = ""; + } + */ + + //** Customise the port ISPConfig runs on + $conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', '8080'); + + if(strtolower($inst->simple_query('Enable SSL for the ISPConfig web interface',array('y','n'),'y')) == 'y') { + $inst->make_ispconfig_ssl_cert(); + } + + $inst->install_ispconfig_interface = true; + + } else { + $inst->install_ispconfig_interface = false; + } + + $inst->install_ispconfig(); + + //* Configure DBServer + swriteln('Configuring DBServer'); + $inst->configure_dbserver(); + + //* Configure ISPConfig + swriteln('Installing ISPConfig crontab'); + $inst->install_crontab(); + if($conf['apache']['init_script'] != '' && @is_file($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart'); + + + +} //* << $install_mode / 'Standard' or Genius + + +echo "Installation completed.\n"; + + +?> diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 9edc4a19c9c18b91ce93128326ad062aeddf2ce3..741f9a6f388d03cc94eabed714f0d3c6549f1816 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -1,1726 +1,1780 @@ -conf = $conf; - } - - //: TODO Implement the translation function and language files for the installer. - public function lng($text) { - return $text; - } - - public function error($msg) { - die('ERROR: '.$msg."\n"); - } - - public function simple_query($query, $answers, $default) { - $finished = false; - do { - $answers_str = implode(',', $answers); - swrite($this->lng($query).' ('.$answers_str.') ['.$default.']: '); - $input = sread(); - - //* Stop the installation - if($input == 'quit') { - swriteln($this->lng("Installation terminated by user.\n")); - die(); - } - - //* Select the default - if($input == '') { - $answer = $default; - $finished = true; - } - - //* Set answer id valid - if(in_array($input, $answers)) { - $answer = $input; - $finished = true; - } - - } while ($finished == false); - swriteln(); - return $answer; - } - - public function free_query($query,$default) { - swrite($this->lng($query).' ['.$default.']: '); - $input = sread(); - - //* Stop the installation - if($input == 'quit') { - swriteln($this->lng("Installation terminated by user.\n")); - die(); - } - - $answer = ($input == '') ? $default : $input; - swriteln(); - return $answer; - } - - /* - // TODO: this function is not used atmo I think - pedro - function request_language(){ - - swriteln(lng('Enter your language')); - swriteln(lng('de, en')); - - } - */ - - //** Detect installed applications - public function find_installed_apps() { - global $conf; - - if(is_installed('mysql') || is_installed('mysqld')) $conf['mysql']['installed'] = true; - if(is_installed('postfix')) $conf['postfix']['installed'] = true; - if(is_installed('apache') || is_installed('apache2') || is_installed('httpd')) $conf['apache']['installed'] = true; - if(is_installed('getmail')) $conf['getmail']['installed'] = true; - if(is_installed('courierlogger')) $conf['courier']['installed'] = true; - if(is_installed('dovecot')) $conf['dovecot']['installed'] = true; - if(is_installed('saslsauthd')) $conf['saslauthd']['installed'] = true; - if(is_installed('amavisd-new')) $conf['amavis']['installed'] = true; - if(is_installed('clamdscan')) $conf['clamav']['installed'] = true; - if(is_installed('pure-ftpd') || is_installed('pure-ftpd-wrapper')) $conf['pureftpd']['installed'] = true; - if(is_installed('mydns') || is_installed('mydns-ng')) $conf['mydns']['installed'] = true; - if(is_installed('jk_chrootsh')) $conf['jailkit']['installed'] = true; - if(is_installed('pdns_server') || is_installed('pdns_control')) $conf['powerdns']['installed'] = true; - if(is_installed('named') || is_installed('bind') || is_installed('bind9')) $conf['bind']['installed'] = true; - - } - - /** Create the database for ISPConfig */ - public function configure_database() { - global $conf; - - //** Create the database - if(!$this->db->query('CREATE DATABASE IF NOT EXISTS '.$conf['mysql']['database'].' DEFAULT CHARACTER SET '.$conf['mysql']['charset'])) { - $this->error('Unable to create MySQL database: '.$conf['mysql']['database'].'.'); - } - - //* Set the database name in the DB library - $this->db->dbName = $conf['mysql']['database']; - - //* Load the database dump into the database, if database contains no tables - $db_tables = $this->db->getTables(); - if(count($db_tables) > 0) { - $this->error('Stopped: Database already contains some tables.'); - } else { - if($conf['mysql']['admin_password'] == '') { - caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['mysql']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null", - __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql'); - } else { - caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['mysql']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null", - __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql'); - } - $db_tables = $this->db->getTables(); - if(count($db_tables) == 0) { - $this->error('Unable to load SQL-Dump into database table.'); - } - - //* Load system.ini into the sys_ini table - $system_ini = $this->db->quote(rf('tpl/system.ini.master')); - $this->db->query("UPDATE sys_ini SET config = '$system_ini' WHERE sysini_id = 1"); - - } - } - - //** Create the server record in the database - public function add_database_server_record() { - - global $conf; - - if($conf['mysql']['host'] == 'localhost') { - $from_host = 'localhost'; - } else { - $from_host = $conf['hostname']; - } - - // Delete ISPConfig user in the local database, in case that it exists - $this->db->query("DELETE FROM mysql.user WHERE User = '".$conf['mysql']['ispconfig_user']."' AND Host = '".$from_host."';"); - $this->db->query("DELETE FROM mysql.db WHERE Db = '".$conf['mysql']['database']."' AND Host = '".$from_host."';"); - $this->db->query('FLUSH PRIVILEGES;'); - - //* Create the ISPConfig database user in the local database - $query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$conf['mysql']['database'].".* " - ."TO '".$conf['mysql']['ispconfig_user']."'@'".$from_host."' " - ."IDENTIFIED BY '".$conf['mysql']['ispconfig_password']."';"; - if(!$this->db->query($query)) { - $this->error('Unable to create database user: '.$conf['mysql']['ispconfig_user'].' Error: '.$this->db->errorMessage); - } - - //* Reload database privelages - $this->db->query('FLUSH PRIVILEGES;'); - - //* Set the database name in the DB library - $this->db->dbName = $conf['mysql']['database']; - - $tpl_ini_array = ini_to_array(rf('tpl/server.ini.master')); - - //* Update further distribution specific parameters for server config here - //* HINT: Every line added here has to be added in update.lib.php too!! - $tpl_ini_array['web']['vhost_conf_dir'] = $conf['apache']['vhost_conf_dir']; - $tpl_ini_array['web']['vhost_conf_enabled_dir'] = $conf['apache']['vhost_conf_enabled_dir']; - $tpl_ini_array['jailkit']['jailkit_chroot_app_programs'] = $conf['jailkit']['jailkit_chroot_app_programs']; - $tpl_ini_array['fastcgi']['fastcgi_phpini_path'] = $conf['fastcgi']['fastcgi_phpini_path']; - $tpl_ini_array['fastcgi']['fastcgi_starter_path'] = $conf['fastcgi']['fastcgi_starter_path']; - $tpl_ini_array['server']['hostname'] = $conf['hostname']; - $tpl_ini_array['server']['ip_address'] = @gethostbyname($conf['hostname']); - $tpl_ini_array['web']['website_basedir'] = $conf['web']['website_basedir']; - $tpl_ini_array['web']['website_path'] = $conf['web']['website_path']; - $tpl_ini_array['web']['website_symlinks'] = $conf['web']['website_symlinks']; - $tpl_ini_array['cron']['crontab_dir'] = $conf['cron']['crontab_dir']; - $tpl_ini_array['web']['security_level'] = 20; - $tpl_ini_array['web']['user'] = $conf['apache']['user']; - $tpl_ini_array['web']['group'] = $conf['apache']['group']; - $tpl_ini_array['web']['php_ini_path_apache'] = $conf['apache']['php_ini_path_apache']; - $tpl_ini_array['web']['php_ini_path_cgi'] = $conf['apache']['php_ini_path_cgi']; - $tpl_ini_array['mail']['pop3_imap_daemon'] = ($conf['dovecot']['installed'] == true)?'dovecot':'courier'; - $tpl_ini_array['mail']['mail_filter_syntax'] = ($conf['dovecot']['installed'] == true)?'sieve':'maildrop'; - $tpl_ini_array['dns']['bind_user'] = $conf['bind']['bind_user']; - $tpl_ini_array['dns']['bind_group'] = $conf['bind']['bind_group']; - $tpl_ini_array['dns']['bind_zonefiles_dir'] = $conf['bind']['bind_zonefiles_dir']; - $tpl_ini_array['dns']['named_conf_path'] = $conf['bind']['named_conf_path']; - $tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path']; - - if (array_key_exists('awstats', $conf)) { - foreach ($conf['awstats'] as $aw_sett => $aw_value) { - $tpl_ini_array['web']['awstats_'.$aw_sett] = $aw_value; - } - } - - $server_ini_content = array_to_ini($tpl_ini_array); - $server_ini_content = mysql_real_escape_string($server_ini_content); - - $mail_server_enabled = ($conf['services']['mail'])?1:0; - $web_server_enabled = ($conf['services']['web'])?1:0; - $dns_server_enabled = ($conf['services']['dns'])?1:0; - $file_server_enabled = ($conf['services']['file'])?1:0; - $db_server_enabled = ($conf['services']['db'])?1:0; - $vserver_server_enabled = ($conf['services']['vserver'])?1:0; - - //** Get the database version number based on the patchfiles - $found = true; - $current_db_version = 1; - while($found == true) { - $next_db_version = intval($current_db_version + 1); - $patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql'; - if(is_file($patch_filename)) { - $current_db_version = $next_db_version; - } else { - $found = false; - } - } - $current_db_version = intval($current_db_version); - - - if($conf['mysql']['master_slave_setup'] == 'y') { - - //* Insert the server record in master DB - $sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`, `dbversion`) VALUES (1, 1, 'riud', 'riud', 'r', '".$conf['hostname']."', '$mail_server_enabled', '$web_server_enabled', '$dns_server_enabled', '$file_server_enabled', '$db_server_enabled', '$vserver_server_enabled', '$server_ini_content', 0, 1, $current_db_version);"; - $this->dbmaster->query($sql); - $conf['server_id'] = $this->dbmaster->insertID(); - $conf['server_id'] = $conf['server_id']; - - //* Insert the same record in the local DB - $sql = "INSERT INTO `server` (`server_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`, `dbversion`) VALUES ('".$conf['server_id']."',1, 1, 'riud', 'riud', 'r', '".$conf['hostname']."', '$mail_server_enabled', '$web_server_enabled', '$dns_server_enabled', '$file_server_enabled', '$db_server_enabled', '$vserver_server_enabled', '$server_ini_content', 0, 1, $current_db_version);"; - $this->db->query($sql); - - //* username for the ispconfig user - $conf['mysql']['master_ispconfig_user'] = 'ispcsrv'.$conf['server_id']; - - $this->grant_master_database_rights(); - - } else { - //* Insert the server, if its not a mster / slave setup - $sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`, `dbversion`) VALUES (1, 1, 'riud', 'riud', 'r', '".$conf['hostname']."', '$mail_server_enabled', '$web_server_enabled', '$dns_server_enabled', '$file_server_enabled', '$db_server_enabled', '$vserver_server_enabled', '$server_ini_content', 0, 1, $current_db_version);"; - $this->db->query($sql); - $conf['server_id'] = $this->db->insertID(); - $conf['server_id'] = $conf['server_id']; - } - - - } - - public function grant_master_database_rights() { - global $conf; - - /* - * The following code is a little bit tricky: - * * If we HAVE a master-slave - Setup then the client has to grant the rights for himself - * at the master. - * * If we DO NOT have a master-slave - Setup then we have two possibilities - * 1) it is a single server - * 2) it is the MASTER of n clients - */ - $hosts = array(); - - if($conf['mysql']['master_slave_setup'] == 'y') { - /* - * it is a master-slave - Setup so the slave has to grant its rights in the master - * database - */ - - //* insert the ispconfig user in the remote server - $from_host = $conf['hostname']; - $from_ip = gethostbyname($conf['hostname']); - - $hosts[$from_host]['user'] = $conf['mysql']['master_ispconfig_user']; - $hosts[$from_host]['db'] = $conf['mysql']['master_database']; - $hosts[$from_host]['pwd'] = $conf['mysql']['master_ispconfig_password']; - - $hosts[$from_ip]['user'] = $conf['mysql']['master_ispconfig_user']; - $hosts[$from_ip]['db'] = $conf['mysql']['master_database']; - $hosts[$from_ip]['pwd'] = $conf['mysql']['master_ispconfig_password']; - } else{ - /* - * it is NOT a master-slave - Setup so we have to find out all clients and their - * host - */ - $query = "SELECT Host, User FROM mysql.user WHERE User like 'ispcsrv%' ORDER BY User, Host"; - $data = $this->dbmaster->queryAllRecords($query); - if($data === false) { - $this->error('Unable to get the user rights: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); - } - foreach ($data as $item){ - $hosts[$item['Host']]['user'] = $item['User']; - $hosts[$item['Host']]['db'] = $conf['mysql']['master_database']; - $hosts[$item['Host']]['pwd'] = ''; // the user already exists, so we need no pwd! - } - } - - if(count($hosts) > 0) { - foreach($hosts as $host => $value) { - /* - * If a pwd exists, this means, we have to add the new user (and his pwd). - * if not, the user already exists and we do not need the pwd - */ - if ($value['pwd'] != ''){ - $query = "CREATE USER '".$value['user']."'@'".$host."' IDENTIFIED BY '" . $value['pwd'] . "'"; - $this->dbmaster->query($query); // ignore the error - } - - /* - * Try to delete all rights of the user in case that it exists. - * In Case that it will not exist, do nothing (ignore the error!) - */ - $query = "REVOKE ALL PRIVILEGES, GRANT OPTION FROM '".$value['user']."'@'".$host."' "; - $this->dbmaster->query($query); // ignore the error - - //* Create the ISPConfig database user in the remote database - $query = "GRANT SELECT ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' "; - if(!$this->dbmaster->query($query)) { - $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); - } - - $query = "GRANT SELECT, INSERT ON ".$value['db'].".`sys_log` TO '".$value['user']."'@'".$host."' "; - if(!$this->dbmaster->query($query)) { - $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); - } - - $query = "GRANT SELECT, UPDATE(`status`) ON ".$value['db'].".`sys_datalog` TO '".$value['user']."'@'".$host."' "; - if(!$this->dbmaster->query($query)) { - $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); - } - - $query = "GRANT SELECT, UPDATE(`status`) ON ".$value['db'].".`software_update_inst` TO '".$value['user']."'@'".$host."' "; - if(!$this->dbmaster->query($query)) { - $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); - } - - $query = "GRANT SELECT, UPDATE(`updated`) ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' "; - if(!$this->dbmaster->query($query)) { - $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); - } - - $query = "GRANT SELECT, UPDATE (`ssl_request`, `ssl_cert`, `ssl_action`) ON ".$value['db'].".`web_domain` TO '".$value['user']."'@'".$host."' "; - if(!$this->dbmaster->query($query)) { - $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); - } - - $query = "GRANT SELECT ON ".$value['db'].".`sys_group` TO '".$value['user']."'@'".$host."' "; - if(!$this->dbmaster->query($query)) { - $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); - } - - $query = "GRANT SELECT, UPDATE (`action_state`, `response`) ON ".$value['db'].".`sys_remoteaction` TO '".$value['user']."'@'".$host."' "; - if(!$this->dbmaster->query($query)) { - $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); - } - - $query = "GRANT SELECT, INSERT , DELETE ON ".$value['db'].".`monitor_data` TO '".$value['user']."'@'".$host."' "; - if(!$this->dbmaster->query($query)) { - $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); - } - - $query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`mail_traffic` TO '".$value['user']."'@'".$host."' "; - if(!$this->dbmaster->query($query)) { - $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); - } - - $query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`web_traffic` TO '".$value['user']."'@'".$host."' "; - if(!$this->dbmaster->query($query)) { - $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); - } - } - - /* - * It is all done. Relod the rights... - */ - $this->dbmaster->query('FLUSH PRIVILEGES;'); - } - - } - - //** writes postfix configuration files - public function process_postfix_config($configfile) { - global $conf; - - $config_dir = $conf['postfix']['config_dir'].'/'; - $full_file_name = $config_dir.$configfile; - //* Backup exiting file - if(is_file($full_file_name)) { - copy($full_file_name, $config_dir.$configfile.'~'); - } - $content = rf('tpl/'.$configfile.'.master'); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); - $content = str_replace('{server_id}', $conf['server_id'], $content); - wf($full_file_name, $content); - } - - public function configure_jailkit() { - global $conf; - - $cf = $conf['jailkit']; - $config_dir = $cf['config_dir']; - $jk_init = $cf['jk_init']; - $jk_chrootsh = $cf['jk_chrootsh']; - - if (is_dir($config_dir)) { - if(is_file($config_dir.'/'.$jk_init)) copy($config_dir.'/'.$jk_init, $config_dir.'/'.$jk_init.'~'); - if(is_file($config_dir.'/'.$jk_chrootsh.'.master')) copy($config_dir.'/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh.'~'); - - copy('tpl/'.$jk_init.'.master', $config_dir.'/'.$jk_init); - copy('tpl/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh); - } - - } - - public function configure_postfix($options = '') { - global $conf; - $cf = $conf['postfix']; - $config_dir = $cf['config_dir']; - - if(!is_dir($config_dir)) { - $this->error("The postfix configuration directory '$config_dir' does not exist."); - } - - //* mysql-virtual_domains.cf - $this->process_postfix_config('mysql-virtual_domains.cf'); - - //* mysql-virtual_forwardings.cf - $this->process_postfix_config('mysql-virtual_forwardings.cf'); - - //* mysql-virtual_mailboxes.cf - $this->process_postfix_config('mysql-virtual_mailboxes.cf'); - - //* mysql-virtual_email2email.cf - $this->process_postfix_config('mysql-virtual_email2email.cf'); - - //* mysql-virtual_transports.cf - $this->process_postfix_config('mysql-virtual_transports.cf'); - - //* mysql-virtual_recipient.cf - $this->process_postfix_config('mysql-virtual_recipient.cf'); - - //* mysql-virtual_sender.cf - $this->process_postfix_config('mysql-virtual_sender.cf'); - - //* mysql-virtual_client.cf - $this->process_postfix_config('mysql-virtual_client.cf'); - - //* mysql-virtual_relaydomains.cf - $this->process_postfix_config('mysql-virtual_relaydomains.cf'); - - //* mysql-virtual_relayrecipientmaps.cf - $this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf'); - - //* Changing mode and group of the new created config files. - caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', - __FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed'); - caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', - __FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed'); - - //* Creating virtual mail user and group - $command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname']; - if(!is_group($cf['vmail_groupname'])) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - $command = 'useradd -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' '.$cf['vmail_username'].' -d '.$cf['vmail_mailbox_base'].' -m'; - if(!is_user($cf['vmail_username'])) caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - $postconf_commands = array ( - 'myhostname = '.$conf['hostname'], - 'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain', - 'mynetworks = 127.0.0.0/8 [::1]/128', - 'virtual_alias_domains =', - 'virtual_alias_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_forwardings.cf, mysql:'.$config_dir.'/mysql-virtual_email2email.cf', - 'virtual_mailbox_domains = proxy:mysql:'.$config_dir.'/mysql-virtual_domains.cf', - 'virtual_mailbox_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailboxes.cf', - 'virtual_mailbox_base = '.$cf['vmail_mailbox_base'], - 'virtual_uid_maps = static:'.$cf['vmail_userid'], - 'virtual_gid_maps = static:'.$cf['vmail_groupid'], - 'smtpd_sasl_auth_enable = yes', - 'broken_sasl_auth_clients = yes', - 'smtpd_sasl_authenticated_header = yes', - 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:'.$config_dir.'/mysql-virtual_recipient.cf, reject_unauth_destination', - 'smtpd_use_tls = yes', - 'smtpd_tls_security_level = may', - 'smtpd_tls_cert_file = '.$config_dir.'/smtpd.cert', - 'smtpd_tls_key_file = '.$config_dir.'/smtpd.key', - 'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf', - 'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf', - 'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf', - 'virtual_create_maildirsize = yes', - 'virtual_maildir_extended = yes', - 'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf', - 'virtual_mailbox_limit_override = yes', - 'virtual_maildir_limit_message = "The user you are trying to reach is over quota."', - 'virtual_overquota_bounce = yes', - 'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps', - 'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf', - 'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf', - 'maildrop_destination_concurrency_limit = 1', - 'maildrop_destination_recipient_limit = 1', - 'virtual_transport = maildrop', - 'header_checks = regexp:'.$config_dir.'/header_checks', - 'mime_header_checks = regexp:'.$config_dir.'/mime_header_checks', - 'nested_header_checks = regexp:'.$config_dir.'/nested_header_checks', - 'body_checks = regexp:'.$config_dir.'/body_checks' - ); - - //* Create the header and body check files - touch($config_dir.'/header_checks'); - touch($config_dir.'/mime_header_checks'); - touch($config_dir.'/nested_header_checks'); - touch($config_dir.'/body_checks'); - - - //* Make a backup copy of the main.cf file - copy($config_dir.'/main.cf', $config_dir.'/main.cf~'); - - //* Executing the postconf commands - foreach($postconf_commands as $cmd) { - $command = "postconf -e '$cmd'"; - caselog($command." &> /dev/null", __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); - } - - if(!stristr($options,'dont-create-certs')) { - //* Create the SSL certificate - $command = 'cd '.$config_dir.'; ' - .'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509'; - exec($command); - - $command = 'chmod o= '.$config_dir.'/smtpd.key'; - caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); - } - - //** We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop. - $command = 'chmod 755 /var/run/courier/authdaemon/'; - if(is_file('/var/run/courier/authdaemon/')) caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); - - //* Changing maildrop lines in posfix master.cf - if(is_file($config_dir.'/master.cf')) { - copy($config_dir.'/master.cf', $config_dir.'/master.cf~'); - } - if(is_file($config_dir.'/master.cf~')) { - chmod($config_dir.'/master.cf~', 0400); - } - $configfile = $config_dir.'/master.cf'; - $content = rf($configfile); - $content = str_replace('flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}', - 'flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d '.$cf['vmail_username'].' ${extension} ${recipient} ${user} ${nexthop} ${sender}', - $content); - wf($configfile, $content); - - //* Writing the Maildrop mailfilter file - $configfile = 'mailfilter'; - if(is_file($cf['vmail_mailbox_base'].'/.'.$configfile)) { - copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~'); - } - $content = rf('tpl/'.$configfile.'.master'); - $content = str_replace('{dist_postfix_vmail_mailbox_base}', $cf['vmail_mailbox_base'], $content); - wf($cf['vmail_mailbox_base'].'/.'.$configfile, $content); - - //* Create the directory for the custom mailfilters - if(!is_dir($cf['vmail_mailbox_base'].'/mailfilters')) { - $command = 'mkdir '.$cf['vmail_mailbox_base'].'/mailfilters'; - caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - } - - //* Chmod and chown the .mailfilter file - $command = 'chown -R '.$cf['vmail_username'].':'.$cf['vmail_groupname'].' '.$cf['vmail_mailbox_base'].'/.mailfilter'; - caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - $command = 'chmod -R 600 '.$cf['vmail_mailbox_base'].'/.mailfilter'; - caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - } - - public function configure_saslauthd() { - global $conf; - - - $configfile = 'sasl_smtpd.conf'; - if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf')) copy($conf['postfix']['config_dir'].'/sasl/smtpd.conf',$conf['postfix']['config_dir'].'/sasl/smtpd.conf~'); - if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf~')) chmod($conf['postfix']['config_dir'].'/sasl/smtpd.conf~', 0400); - $content = rf('tpl/'.$configfile.'.master'); - $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); - $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); - $content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content); - wf($conf['postfix']['config_dir'].'/sasl/smtpd.conf',$content); - - // TODO: Chmod and chown on the config file - - - // Recursively create the spool directory - if(!@is_dir('/var/spool/postfix/var/run/saslauthd')) mkdir('/var/spool/postfix/var/run/saslauthd', 0755, true); - - // Edit the file /etc/default/saslauthd - $configfile = $conf['saslauthd']['config']; - if(is_file($configfile)) copy($configfile,$configfile.'~'); - if(is_file($configfile.'~')) chmod($configfile.'~', 0400); - $content = rf($configfile); - $content = str_replace('START=no','START=yes',$content); - // Debian - $content = str_replace('OPTIONS="-c"','OPTIONS="-m /var/spool/postfix/var/run/saslauthd -r"',$content); - // Ubuntu - $content = str_replace('OPTIONS="-c -m /var/run/saslauthd"','OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"',$content); - wf($configfile,$content); - - // Edit the file /etc/init.d/saslauthd - $configfile = $conf['init_scripts'].'/'.$conf['saslauthd']['init_script']; - $content = rf($configfile); - $content = str_replace('PIDFILE=$RUN_DIR/saslauthd.pid','PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"',$content); - wf($configfile,$content); - - // add the postfix user to the sasl group (at least necessary for Ubuntu 8.04 and most likely Debian Lenny as well. - exec('adduser postfix sasl'); - - - } - - public function configure_pam() { - global $conf; - $pam = $conf['pam']; - //* configure pam for SMTP authentication agains the ispconfig database - $configfile = 'pamd_smtp'; - if(is_file($pam.'/smtp')) copy($pam.'/smtp', $pam.'/smtp~'); - if(is_file($pam.'/smtp~')) chmod($pam.'/smtp~', 0400); - - $content = rf('tpl/'.$configfile.'.master'); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); - wf($pam.'/smtp', $content); - // On some OSes smtp is world readable which allows for reading database information. Removing world readable rights should have no effect. - if(is_file($pam.'/smtp')) exec("chmod o= $pam/smtp"); - chmod($pam.'/smtp', 0660); - chown($pam.'/smtp', 'daemon'); - chgrp($pam.'/smtp', 'daemon'); - - } - - public function configure_courier() { - global $conf; - $config_dir = $conf['courier']['config_dir']; - //* authmysqlrc - $configfile = 'authmysqlrc'; - if(is_file($config_dir.'/'.$configfile)) { - copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); - } - chmod($config_dir.'/'.$configfile.'~', 0400); - $content = rf('tpl/'.$configfile.'.master'); - $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); - $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); - $content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content); - wf($config_dir.'/'.$configfile, $content); - - chmod($config_dir.'/'.$configfile, 0660); - chown($config_dir.'/'.$configfile, 'daemon'); - chgrp($config_dir.'/'.$configfile, 'daemon'); - - //* authdaemonrc - $configfile = $config_dir.'/authdaemonrc'; - if(is_file($configfile)) { - copy($configfile, $configfile.'~'); - } - if(is_file($configfile.'~')) { - chmod($configfile.'~', 0400); - } - $content = rf($configfile); - $content = str_replace('authmodulelist="authpam"', 'authmodulelist="authmysql"', $content); - wf($configfile, $content); - } - - public function configure_dovecot() { - global $conf; - - $config_dir = $conf['dovecot']['config_dir']; - - //* Configure master.cf and add a line for deliver - if(is_file($conf['postfix']['config_dir'].'/master.cf')) { - copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~2'); - } - if(is_file($conf['postfix']['config_dir'].'/master.cf~')) { - chmod($conf['postfix']['config_dir'].'/master.cf~2', 0400); - } - $content = rf($conf['postfix']['config_dir'].'/master.cf'); - // Only add the content if we had not addded it before - if(!stristr($content,'dovecot/deliver')) { - $deliver_content = 'dovecot unix - n n - - pipe'."\n".' flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}'; - af($conf['postfix']['config_dir'].'/master.cf',$deliver_content); - } - unset($content); - unset($deliver_content); - - - //* Reconfigure postfix to use dovecot authentication - // Adding the amavisd commands to the postfix configuration - $postconf_commands = array ( - 'dovecot_destination_recipient_limit = 1', - 'virtual_transport = dovecot', - 'smtpd_sasl_type = dovecot', - 'smtpd_sasl_path = private/auth' - ); - - // Make a backup copy of the main.cf file - copy($conf['postfix']['config_dir'].'/main.cf',$conf['postfix']['config_dir'].'/main.cf~3'); - - // Executing the postconf commands - foreach($postconf_commands as $cmd) { - $command = "postconf -e '$cmd'"; - caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - } - - //* copy dovecot.conf - $configfile = 'dovecot.conf'; - if(is_file($config_dir.'/'.$configfile)) { - copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); - } - copy('tpl/debian_dovecot.conf.master',$config_dir.'/'.$configfile); - - //* dovecot-sql.conf - $configfile = 'dovecot-sql.conf'; - if(is_file($config_dir.'/'.$configfile)) { - copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); - } - chmod($config_dir.'/'.$configfile.'~', 0400); - $content = rf('tpl/debian_dovecot-sql.conf.master'); - $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); - $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); - $content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content); - wf($config_dir.'/'.$configfile, $content); - - chmod($config_dir.'/'.$configfile, 0600); - chown($config_dir.'/'.$configfile, 'root'); - chgrp($config_dir.'/'.$configfile, 'root'); - - } - - public function configure_amavis() { - global $conf; - - // amavisd user config file - $configfile = 'amavisd_user_config'; - if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user')) copy($conf['amavis']['config_dir'].'/conf.d/50-user',$conf['amavis']['config_dir'].'/50-user~'); - if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user~')) chmod($conf['amavis']['config_dir'].'/conf.d/50-user~', 0400); - $content = rf('tpl/'.$configfile.'.master'); - $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); - $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); - $content = str_replace('{mysql_server_port}',$conf['mysql']['port'],$content); - $content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content); - wf($conf['amavis']['config_dir'].'/conf.d/50-user',$content); - - // TODO: chmod and chown on the config file - - - // Adding the amavisd commands to the postfix configuration - $postconf_commands = array ( - 'content_filter = amavis:[127.0.0.1]:10024', - 'receive_override_options = no_address_mappings' - ); - - // Make a backup copy of the main.cf file - copy($conf['postfix']['config_dir'].'/main.cf',$conf['postfix']['config_dir'].'/main.cf~2'); - - // Executing the postconf commands - foreach($postconf_commands as $cmd) { - $command = "postconf -e '$cmd'"; - caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - } - - // Append the configuration for amavisd to the master.cf file - if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf',$conf['postfix']['config_dir'].'/master.cf~'); - $content = rf($conf['postfix']['config_dir'].'/master.cf'); - // Only add the content if we had not addded it before - if(!stristr($content,'127.0.0.1:10025')) { - unset($content); - $content = rf('tpl/master_cf_amavis.master'); - af($conf['postfix']['config_dir'].'/master.cf',$content); - } - unset($content); - - // Add the clamav user to the amavis group - exec('adduser clamav amavis'); - - - } - - public function configure_spamassassin() { - global $conf; - - //* Enable spamasasssin on debian and ubuntu - $configfile = '/etc/default/spamassassin'; - if(is_file($configfile)) { - copy($configfile, $configfile.'~'); - } - $content = rf($configfile); - $content = str_replace('ENABLED=0', 'ENABLED=1', $content); - wf($configfile, $content); - } - - public function configure_getmail() { - global $conf; - - $config_dir = $conf['getmail']['config_dir']; - - if(!@is_dir($config_dir)) mkdir(escapeshellcmd($config_dir), 0700, true); - - $command = 'useradd -d '.$config_dir.' getmail'; - if(!is_user('getmail')) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - $command = "chown -R getmail $config_dir"; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - $command = "chmod -R 700 $config_dir"; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - } - - - public function configure_pureftpd() { - global $conf; - - $config_dir = $conf['pureftpd']['config_dir']; - - //* configure pure-ftpd for MySQL authentication against the ispconfig database - $configfile = 'db/mysql.conf'; - if(is_file($config_dir.'/'.$configfile)) { - copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); - } - if(is_file($config_dir.'/'.$configfile.'~')) { - chmod($config_dir.'/'.$configfile.'~', 0400); - } - $content = rf('tpl/pureftpd_mysql.conf.master'); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); - $content = str_replace('{server_id}', $conf['server_id'], $content); - wf($config_dir.'/'.$configfile, $content); - chmod($config_dir.'/'.$configfile, 0600); - chown($config_dir.'/'.$configfile, 'root'); - chgrp($config_dir.'/'.$configfile, 'root'); - // **enable chrooting - //exec('mkdir -p '.$config_dir.'/conf/ChrootEveryone'); - exec('echo "yes" > '.$config_dir.'/conf/ChrootEveryone'); - exec('echo "yes" > '.$config_dir.'/conf/BrokenClientsCompatibility'); - exec('echo "yes" > '.$config_dir.'/conf/DisplayDotFiles'); - - if(is_file('/etc/default/pure-ftpd-common')) { - replaceLine('/etc/default/pure-ftpd-common','STANDALONE_OR_INETD=inetd','STANDALONE_OR_INETD=standalone',1,0); - replaceLine('/etc/default/pure-ftpd-common','VIRTUALCHROOT=false','VIRTUALCHROOT=true',1,0); - } - - if(is_file('/etc/inetd.conf')) { - replaceLine('/etc/inetd.conf','/usr/sbin/pure-ftpd-wrapper','#ftp stream tcp nowait root /usr/sbin/tcpd /usr/sbin/pure-ftpd-wrapper',0,0); - if(is_file($conf['init_scripts'].'/'.'openbsd-inetd')) exec($conf['init_scripts'].'/'.'openbsd-inetd restart'); - } - - if(!is_file('/etc/pure-ftpd/conf/DontResolve')) exec('echo "yes" > /etc/pure-ftpd/conf/DontResolve'); - } - - public function configure_mydns() { - global $conf; - - // configure pam for SMTP authentication agains the ispconfig database - $configfile = 'mydns.conf'; - if(is_file($conf['mydns']['config_dir'].'/'.$configfile)) copy($conf['mydns']['config_dir'].'/'.$configfile,$conf['mydns']['config_dir'].'/'.$configfile.'~'); - if(is_file($conf['mydns']['config_dir'].'/'.$configfile.'~')) chmod($conf['mydns']['config_dir'].'/'.$configfile.'~', 0400); - $content = rf('tpl/'.$configfile.'.master'); - $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); - $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); - $content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content); - $content = str_replace('{server_id}',$conf['server_id'],$content); - wf($conf['mydns']['config_dir'].'/'.$configfile,$content); - chmod($conf['mydns']['config_dir'].'/'.$configfile, 0600); - chown($conf['mydns']['config_dir'].'/'.$configfile, 'root'); - chgrp($conf['mydns']['config_dir'].'/'.$configfile, 'root'); - - } - - public function configure_powerdns() { - global $conf; - - //* Create the database - if(!$this->db->query('CREATE DATABASE IF NOT EXISTS '.$conf['powerdns']['database'].' DEFAULT CHARACTER SET '.$conf['mysql']['charset'])) { - $this->error('Unable to create MySQL database: '.$conf['powerdns']['database'].'.'); - } - - //* Create the ISPConfig database user in the local database - $query = "GRANT ALL ON `".$conf['powerdns']['database']."` . * TO '".$conf['mysql']['ispconfig_user']."'@'localhost';"; - if(!$this->db->query($query)) { - $this->error('Unable to create user for powerdns database Error: '.$this->db->errorMessage); - } - - //* Reload database privelages - $this->db->query('FLUSH PRIVILEGES;'); - - //* load the powerdns databse dump - if($conf['mysql']['admin_password'] == '') { - caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null", - __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql'); - } else { - caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null", - __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql'); - } - - //* Create the powerdns config file - $configfile = 'pdns.local'; - if(is_file($conf['powerdns']['config_dir'].'/'.$configfile)) copy($conf['powerdns']['config_dir'].'/'.$configfile,$conf['powerdns']['config_dir'].'/'.$configfile.'~'); - if(is_file($conf['powerdns']['config_dir'].'/'.$configfile.'~')) chmod($conf['powerdns']['config_dir'].'/'.$configfile.'~', 0400); - $content = rf('tpl/'.$configfile.'.master'); - $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); - $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{powerdns_database}',$conf['powerdns']['database'],$content); - $content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content); - wf($conf['powerdns']['config_dir'].'/'.$configfile,$content); - chmod($conf['powerdns']['config_dir'].'/'.$configfile, 0600); - chown($conf['powerdns']['config_dir'].'/'.$configfile, 'root'); - chgrp($conf['powerdns']['config_dir'].'/'.$configfile, 'root'); - - - } - - public function configure_bind() { - global $conf; - - //* Check if the zonefile directory has a slash at the end - $content=$conf['bind']['bind_zonefiles_dir']; - if(substr($content,-1,1) != '/') { - $content .= '/'; - } - - //* Create the slave subdirectory - $content .= 'slave'; - if(!@is_dir($content)) mkdir($content, 0770, true); - - //* Chown the slave subdirectory to $conf['bind']['bind_user'] - chown($content, $conf['bind']['bind_user']); - chgrp($content, $conf['bind']['bind_group']); - - } - - - - public function configure_apache() { - global $conf; - - //* Create the logging directory for the vhost logfiles - if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true); - - if(is_file('/etc/suphp/suphp.conf')) { - replaceLine('/etc/suphp/suphp.conf','php=php:/usr/bin','x-httpd-suphp="php:/usr/bin/php-cgi"',0); - //replaceLine('/etc/suphp/suphp.conf','docroot=','docroot=/var/clients',0); - replaceLine('/etc/suphp/suphp.conf','umask=0077','umask=0022',0); - } - - if(is_file('/etc/apache2/sites-enabled/000-default')) { - replaceLine('/etc/apache2/sites-available/000-default','NameVirtualHost *','NameVirtualHost *:80',1,0); - replaceLine('/etc/apache2/sites-available/000-default','','',1,0); - } - - if(is_file('/etc/apache2/ports.conf')) { - // add a line "Listen 443" to ports conf if line does not exist - replaceLine('/etc/apache2/ports.conf','Listen 443','Listen 443',1); - } - - - //* Copy the ISPConfig configuration include - $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; - $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; - - // copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf'); - - $content = rf('tpl/apache_ispconfig.conf.master'); - $records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'"); - if(is_array($records) && count($records) > 0) { - foreach($records as $rec) { - $content .= 'NameVirtualHost '.$rec['ip_address'].":80\n"; - $content .= 'NameVirtualHost '.$rec['ip_address'].":443\n"; - } - } - $content .= "\n"; - wf($vhost_conf_dir.'/ispconfig.conf',$content); - - if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.conf')) { - symlink($vhost_conf_dir.'/ispconfig.conf',$vhost_conf_enabled_dir.'/000-ispconfig.conf'); - } - - //* make sure that webalizer finds its config file when it is directly in /etc - if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) { - mkdir('/etc/webalizer'); - symlink('/etc/webalizer.conf','/etc/webalizer/webalizer.conf'); - } - - if(is_file('/etc/webalizer/webalizer.conf')) { - // Change webalizer mode to incremental - replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0); - replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental yes',0,0); - replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName webalizer.hist',0,0); - } - - // Check the awsatst script - if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools'); - if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl'); - - //* add a sshusers group - $command = 'groupadd sshusers'; - if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - } - - public function configure_firewall() { - global $conf; - - $dist_init_scripts = $conf['init_scripts']; - - if(is_dir('/etc/Bastille.backup')) caselog('rm -rf /etc/Bastille.backup', __FILE__, __LINE__); - if(is_dir('/etc/Bastille')) caselog('mv -f /etc/Bastille /etc/Bastille.backup', __FILE__, __LINE__); - @mkdir('/etc/Bastille', 0700); - if(is_dir('/etc/Bastille.backup/firewall.d')) caselog('cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/', __FILE__, __LINE__); - caselog('cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__); - caselog('chmod 644 /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__); - $content = rf('/etc/Bastille/bastille-firewall.cfg'); - $content = str_replace('{DNS_SERVERS}', '', $content); - - $tcp_public_services = ''; - $udp_public_services = ''; - - $row = $this->db->queryOneRecord('SELECT * FROM '.$conf["mysql"]["database"].'.firewall WHERE server_id = '.intval($conf['server_id'])); - - if(trim($row['tcp_port']) != '' || trim($row['udp_port']) != '') { - $tcp_public_services = trim(str_replace(',',' ',$row['tcp_port'])); - $udp_public_services = trim(str_replace(',',' ',$row['udp_port'])); - } else { - $tcp_public_services = '21 22 25 53 80 110 143 443 3306 8080 10000'; - $udp_public_services = '53'; - } - - if(!stristr($tcp_public_services, $conf['apache']['vhost_port'])) { - $tcp_public_services .= ' '.intval($conf['apache']['vhost_port']); - if($row['tcp_port'] != '') $this->db->query("UPDATE firewall SET tcp_port = tcp_port + ',".intval($conf['apache']['vhost_port'])."' WHERE server_id = ".intval($conf['server_id'])); - } - - $content = str_replace('{TCP_PUBLIC_SERVICES}', $tcp_public_services, $content); - $content = str_replace('{UDP_PUBLIC_SERVICES}', $udp_public_services, $content); - - wf('/etc/Bastille/bastille-firewall.cfg', $content); - - if(is_file($dist_init_scripts.'/bastille-firewall')) caselog('mv -f '.$dist_init_scripts.'/bastille-firewall '.$dist_init_scripts.'/bastille-firewall.backup', __FILE__, __LINE__); - caselog('cp -f apps/bastille-firewall '.$dist_init_scripts, __FILE__, __LINE__); - caselog('chmod 700 '.$dist_init_scripts.'/bastille-firewall', __FILE__, __LINE__); - - if(is_file('/sbin/bastille-ipchains')) caselog('mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup', __FILE__, __LINE__); - caselog('cp -f apps/bastille-ipchains /sbin', __FILE__, __LINE__); - caselog('chmod 700 /sbin/bastille-ipchains', __FILE__, __LINE__); - - if(is_file('/sbin/bastille-netfilter')) caselog('mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup', __FILE__, __LINE__); - caselog('cp -f apps/bastille-netfilter /sbin', __FILE__, __LINE__); - caselog('chmod 700 /sbin/bastille-netfilter', __FILE__, __LINE__); - - if(!@is_dir('/var/lock/subsys')) caselog('mkdir /var/lock/subsys', __FILE__, __LINE__); - - exec('which ipchains &> /dev/null', $ipchains_location, $ret_val); - if(!is_file('/sbin/ipchains') && !is_link('/sbin/ipchains') && $ret_val == 0) phpcaselog(@symlink(shell_exec('which ipchains'), '/sbin/ipchains'), 'create symlink', __FILE__, __LINE__); - unset($ipchains_location); - exec('which iptables &> /dev/null', $iptables_location, $ret_val); - if(!is_file('/sbin/iptables') && !is_link('/sbin/iptables') && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec('which iptables')), '/sbin/iptables'), 'create symlink', __FILE__, __LINE__); - unset($iptables_location); - - } - - public function configure_vlogger() { - global $conf; - - //** Configure vlogger to use traffic logging to mysql (master) db - $configfile = 'vlogger-dbi.conf'; - if(is_file($conf['vlogger']['config_dir'].'/'.$configfile)) copy($conf['vlogger']['config_dir'].'/'.$configfile,$conf['vlogger']['config_dir'].'/'.$configfile.'~'); - if(is_file($conf['vlogger']['config_dir'].'/'.$configfile.'~')) chmod($conf['vlogger']['config_dir'].'/'.$configfile.'~', 0400); - $content = rf('tpl/'.$configfile.'.master'); - if($conf['mysql']['master_slave_setup'] == 'y') { - $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['master_ispconfig_user'],$content); - $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['master_ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}',$conf['mysql']['master_database'],$content); - $content = str_replace('{mysql_server_ip}',$conf['mysql']['master_host'],$content); - } else { - $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); - $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); - $content = str_replace('{mysql_server_ip}',$conf['mysql']['host'],$content); - } - wf($conf['vlogger']['config_dir'].'/'.$configfile,$content); - chmod($conf['vlogger']['config_dir'].'/'.$configfile, 0600); - chown($conf['vlogger']['config_dir'].'/'.$configfile, 'root'); - chgrp($conf['vlogger']['config_dir'].'/'.$configfile, 'root'); - - } - - public function configure_apps_vhost() { - global $conf; - - //* Create the ispconfig apps vhost user and group - - $apps_vhost_user = escapeshellcmd($conf['web']['apps_vhost_user']); - $apps_vhost_group = escapeshellcmd($conf['web']['apps_vhost_group']); - $install_dir = escapeshellcmd($conf['web']['website_basedir'].'/apps'); - - $command = 'groupadd '.$apps_vhost_user; - if(!is_group($apps_vhost_group)) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - $command = 'useradd -g '.$apps_vhost_group.' -d '.$install_dir.' '.$apps_vhost_group; - if(!is_user($apps_vhost_user)) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - - $command = 'adduser '.$conf['apache']['user'].' '.$apps_vhost_group; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - if(!@is_dir($install_dir)) mkdir($install_dir, 0755, true); - chown($install_dir, $apps_vhost_user); - chgrp($install_dir, $apps_vhost_group); - - //* Copy the apps vhost file - $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; - $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; - $apps_vhost_servername = ($conf['web']['apps_vhost_servername'] == '')?'':'ServerName '.$conf['web']['apps_vhost_servername']; - - // Dont just copy over the virtualhost template but add some custom settings - $content = rf('tpl/apache_apps.vhost.master'); - - $content = str_replace('{apps_vhost_ip}', $conf['web']['apps_vhost_ip'], $content); - $content = str_replace('{apps_vhost_port}', $conf['web']['apps_vhost_port'], $content); - $content = str_replace('{apps_vhost_dir}', $conf['web']['website_basedir'].'/apps', $content); - $content = str_replace('{website_basedir}', $conf['web']['website_basedir'], $content); - $content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content); - - - // comment out the listen directive if port is 80 or 443 - if($conf['web']['apps_vhost_ip'] == 80 or $conf['web']['apps_vhost_ip'] == 443) { - $content = str_replace('{vhost_port_listen}', '#', $content); - } else { - $content = str_replace('{vhost_port_listen}', '', $content); - } - - wf($vhost_conf_dir.'/apps.vhost', $content); - - //copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost"); - //* and create the symlink - if($this->install_ispconfig_interface == true) { - if(@is_link($vhost_conf_enabled_dir.'/apps.vhost')) unlink($vhost_conf_enabled_dir.'/apps.vhost'); - if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost')) { - symlink($vhost_conf_dir.'/apps.vhost',$vhost_conf_enabled_dir.'/000-apps.vhost'); - } - } - if(!is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter')) { - mkdir($conf['web']['website_basedir'].'/php-fcgi-scripts/apps', 0755, true); - copy('tpl/apache_apps_fcgi_starter.master',$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter'); - exec('chmod +x '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter'); - exec('chown -R ispapps:ispapps '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps'); - - } - - } - - public function make_ispconfig_ssl_cert() { - global $conf; - - $install_dir = $conf['ispconfig_install_dir']; - - $ssl_crt_file = $install_dir.'/interface/ssl/ispserver.crt'; - $ssl_csr_file = $install_dir.'/interface/ssl/ispserver.csr'; - $ssl_key_file = $install_dir.'/interface/ssl/ispserver.key'; - - if(!@is_dir($install_dir.'/interface/ssl')) mkdir($install_dir.'/interface/ssl', 0755, true); - - $ssl_pw = substr(md5(mt_rand()),0,6); - exec("openssl genrsa -des3 -passout pass:$ssl_pw -out $ssl_key_file 4096"); - exec("openssl req -new -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -out $ssl_csr_file"); - exec("openssl req -x509 -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -in $ssl_csr_file -out $ssl_crt_file -days 3650"); - exec("openssl rsa -passin pass:$ssl_pw -in $ssl_key_file -out $ssl_key_file.insecure"); - rename($ssl_key_file,$ssl_key_file.'.secure'); - rename($ssl_key_file.'.insecure',$ssl_key_file); - - } - - public function install_ispconfig() { - global $conf; - - $install_dir = $conf['ispconfig_install_dir']; - - //* Create the ISPConfig installation directory - if(!@is_dir($install_dir)) { - $command = "mkdir $install_dir"; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - } - - //* Create a ISPConfig user and group - $command = 'groupadd ispconfig'; - if(!is_group('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - $command = 'useradd -g ispconfig -d '.$install_dir.' ispconfig'; - if(!is_user('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - //* copy the ISPConfig interface part - $command = 'cp -rf ../interface '.$install_dir; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - //* copy the ISPConfig server part - $command = 'cp -rf ../server '.$install_dir; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - //* Create a symlink, so ISPConfig is accessible via web - // Replaced by a separate vhost definition for port 8080 - // $command = "ln -s $install_dir/interface/web/ /var/www/ispconfig"; - // caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - //* Create the config file for ISPConfig interface - $configfile = 'config.inc.php'; - if(is_file($install_dir.'/interface/lib/'.$configfile)) { - copy($install_dir.'/interface/lib/'.$configfile, $install_dir.'/interface/lib/'.$configfile.'~'); - } - $content = rf('tpl/'.$configfile.'.master'); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); - - $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content); - $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content); - $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content); - $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content); - - $content = str_replace('{server_id}', $conf['server_id'], $content); - $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content); - $content = str_replace('{language}', $conf['language'], $content); - - wf($install_dir.'/interface/lib/'.$configfile, $content); - - //* Create the config file for ISPConfig server - $configfile = 'config.inc.php'; - if(is_file($install_dir.'/server/lib/'.$configfile)) { - copy($install_dir.'/server/lib/'.$configfile, $install_dir.'/interface/lib/'.$configfile.'~'); - } - $content = rf('tpl/'.$configfile.'.master'); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); - - $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content); - $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content); - $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content); - $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content); - - $content = str_replace('{server_id}', $conf['server_id'], $content); - $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content); - $content = str_replace('{language}', $conf['language'], $content); - - wf($install_dir.'/server/lib/'.$configfile, $content); - - //* Create the config file for remote-actions (but only, if it does not exist, because - // the value is a autoinc-value and so changed by the remoteaction_core_module - if (!file_exists($install_dir.'/server/lib/remote_action.inc.php')) { - $content = ''; - wf($install_dir.'/server/lib/remote_action.inc.php', $content); - } - - //* Enable the server modules and plugins. - // TODO: Implement a selector which modules and plugins shall be enabled. - $dir = $install_dir.'/server/mods-available/'; - if (is_dir($dir)) { - if ($dh = opendir($dir)) { - while (($file = readdir($dh)) !== false) { - if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') { - include_once($install_dir.'/server/mods-available/'.$file); - $module_name = substr($file,0,-8); - $tmp = new $module_name; - if($tmp->onInstall()) { - if(!@is_link($install_dir.'/server/mods-enabled/'.$file)) { - @symlink($install_dir.'/server/mods-available/'.$file, $install_dir.'/server/mods-enabled/'.$file); - // @symlink($install_dir.'/server/mods-available/'.$file, '../mods-enabled/'.$file); - } - if (strpos($file, '_core_module') !== false) { - if(!@is_link($install_dir.'/server/mods-core/'.$file)) { - @symlink($install_dir.'/server/mods-available/'.$file, $install_dir.'/server/mods-core/'.$file); - // @symlink($install_dir.'/server/mods-available/'.$file, '../mods-core/'.$file); - } - } - } - unset($tmp); - } - } - closedir($dh); - } - } - - $dir = $install_dir.'/server/plugins-available/'; - if (is_dir($dir)) { - if ($dh = opendir($dir)) { - while (($file = readdir($dh)) !== false) { - if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') { - include_once($install_dir.'/server/plugins-available/'.$file); - $plugin_name = substr($file,0,-8); - $tmp = new $plugin_name; - if(method_exists($tmp,'onInstall') && $tmp->onInstall()) { - if(!@is_link($install_dir.'/server/plugins-enabled/'.$file)) { - @symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-enabled/'.$file); - //@symlink($install_dir.'/server/plugins-available/'.$file, '../plugins-enabled/'.$file); - } - if (strpos($file, '_core_plugin') !== false) { - if(!@is_link($install_dir.'/server/plugins-core/'.$file)) { - @symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-core/'.$file); - //@symlink($install_dir.'/server/plugins-available/'.$file, '../plugins-core/'.$file); - } - } - } - unset($tmp); - } - } - closedir($dh); - } - } - - // Update the server config - $mail_server_enabled = ($conf['services']['mail'])?1:0; - $web_server_enabled = ($conf['services']['web'])?1:0; - $dns_server_enabled = ($conf['services']['dns'])?1:0; - $file_server_enabled = ($conf['services']['file'])?1:0; - $db_server_enabled = ($conf['services']['db'])?1:0; - $vserver_server_enabled = ($conf['services']['vserver'])?1:0; - - - - - - - $sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled' WHERE server_id = ".intval($conf['server_id']); - - if($conf['mysql']['master_slave_setup'] == 'y') { - $this->dbmaster->query($sql); - $this->db->query($sql); - } else { - $this->db->query($sql); - } - - - //* Chmod the files - $command = 'chmod -R 750 '.$install_dir; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - //* chown the files to the ispconfig user and group - $command = 'chown -R ispconfig:ispconfig '.$install_dir; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - //* Make the global language file directory group writable - exec("chmod -R 770 $install_dir/interface/lib/lang"); - - //* Make the temp directory for language file exports writable - if(is_dir($install_dir.'/interface/web/temp')) exec("chmod -R 770 $install_dir/interface/web/temp"); - - //* Make all interface language file directories group writable - $handle = @opendir($install_dir.'/interface/web'); - while ($file = @readdir ($handle)) { - if ($file != '.' && $file != '..') { - if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) { - $handle2 = opendir($install_dir.'/interface/web'.'/'.$file.'/lib/lang'); - chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang',0770); - while ($lang_file = @readdir ($handle2)) { - if ($lang_file != '.' && $lang_file != '..') { - chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file,0770); - } - } - } - } - } - - //* make sure that the server config file (not the interface one) is only readable by the root user - chmod($install_dir.'/server/lib/'.$configfile, 0600); - chown($install_dir.'/server/lib/'.$configfile, 'root'); - chgrp($install_dir.'/server/lib/'.$configfile, 'root'); - - chmod($install_dir.'/server/lib/remote_action.inc.php', 0600); - chown($install_dir.'/server/lib/remote_action.inc.php', 'root'); - chgrp($install_dir.'/server/lib/remote_action.inc.php', 'root'); - - if(@is_file($install_dir.'/server/lib/mysql_clientdb.conf')) { - chmod($install_dir.'/server/lib/mysql_clientdb.conf', 0600); - chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); - chgrp($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); - } - - // TODO: FIXME: add the www-data user to the ispconfig group. This is just for testing - // and must be fixed as this will allow the apache user to read the ispconfig files. - // Later this must run as own apache server or via suexec! - $command = 'adduser www-data ispconfig'; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - //* Make the shell scripts executable - $command = "chmod +x $install_dir/server/scripts/*.sh"; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - //* Copy the ISPConfig vhost for the controlpanel - $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; - $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; - - - // Dont just copy over the virtualhost template but add some custom settings - $content = rf('tpl/apache_ispconfig.vhost.master'); - $content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content); - - // comment out the listen directive if port is 80 or 443 - if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) { - $content = str_replace('{vhost_port_listen}', '#', $content); - } else { - $content = str_replace('{vhost_port_listen}', '', $content); - } - - if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) { - $content = str_replace('{ssl_comment}', '', $content); - } else { - $content = str_replace('{ssl_comment}', '#', $content); - } - - wf($vhost_conf_dir.'/ispconfig.vhost', $content); - - //copy('tpl/apache_ispconfig.vhost.master', $vhost_conf_dir.'/ispconfig.vhost'); - //* and create the symlink - if($this->install_ispconfig_interface == true && $this->is_update == false) { - if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost'); - if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) { - symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost'); - } - } - if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) { - mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true); - copy('tpl/apache_ispconfig_fcgi_starter.master','/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter'); - exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter'); - symlink($install_dir.'/interface/web','/var/www/ispconfig'); - exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig'); - - } - - //* Install the update script - if(is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) unlink('/usr/local/bin/ispconfig_update_from_svn.sh'); - chown($install_dir.'/server/scripts/update_from_svn.sh', 'root'); - chmod($install_dir.'/server/scripts/update_from_svn.sh', 0700); - chown($install_dir.'/server/scripts/update_from_tgz.sh', 'root'); - chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700); - chown($install_dir.'/server/scripts/ispconfig_update.sh', 'root'); - chmod($install_dir.'/server/scripts/ispconfig_update.sh', 0700); - if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh','/usr/local/bin/ispconfig_update_from_svn.sh'); - if(!is_link('/usr/local/bin/ispconfig_update.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh','/usr/local/bin/ispconfig_update.sh'); - - //* Make the logs readable for the ispconfig user - if(@is_file('/var/log/mail.log')) exec('chmod +r /var/log/mail.log'); - if(@is_file('/var/log/mail.warn')) exec('chmod +r /var/log/mail.warn'); - if(@is_file('/var/log/mail.err')) exec('chmod +r /var/log/mail.err'); - if(@is_file('/var/log/messages')) exec('chmod +r /var/log/messages'); - if(@is_file('/var/log/clamav/clamav.log')) exec('chmod +r /var/log/clamav/clamav.log'); - if(@is_file('/var/log/clamav/freshclam.log')) exec('chmod +r /var/log/clamav/freshclam.log'); - - //* Create the ispconfig log file and directory - if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) { - if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir'], 0755); - touch($conf['ispconfig_log_dir'].'/ispconfig.log'); - } - - rename($install_dir.'/server/scripts/run-getmail.sh','/usr/local/bin/run-getmail.sh'); - if(is_user('getmail')) chown('/usr/local/bin/run-getmail.sh', 'getmail'); - chmod('/usr/local/bin/run-getmail.sh', 0744); - - //* Add Log-Rotation - if (is_dir('/etc/logrotate.d')) { - @unlink('/etc/logrotate.d/logispc3'); // ignore, if the file is not there - /* We rotate these logs in cron_daily.php - $fh = fopen('/etc/logrotate.d/logispc3', 'w'); - fwrite($fh, - "$conf['ispconfig_log_dir']/ispconfig.log { \n" . - " weekly \n" . - " missingok \n" . - " rotate 4 \n" . - " compress \n" . - " delaycompress \n" . - "} \n" . - "$conf['ispconfig_log_dir']/cron.log { \n" . - " weekly \n" . - " missingok \n" . - " rotate 4 \n" . - " compress \n" . - " delaycompress \n" . - "}"); - fclose($fh); - */ - } - } - - public function configure_dbserver() { - global $conf; - - //* If this server shall act as database server for client DB's, we configure this here - $install_dir = $conf['ispconfig_install_dir']; - - // Create a file with the database login details which - // are used to create the client databases. - - if(!is_dir($install_dir.'/server/lib')) { - $command = "mkdir $install_dir/server/lib"; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - } - - $content = rf('tpl/mysql_clientdb.conf.master'); - $content = str_replace('{username}',$conf['mysql']['admin_user'],$content); - $content = str_replace('{password}',$conf['mysql']['admin_password'], $content); - wf($install_dir.'/server/lib/mysql_clientdb.conf',$content); - chmod($install_dir.'/server/lib/mysql_clientdb.conf', 0600); - chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); - chgrp($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); - - } - - public function install_crontab() { - global $conf; - - $install_dir = $conf['ispconfig_install_dir']; - - //* Root Crontab - exec('crontab -u root -l > crontab.txt'); - $existing_root_cron_jobs = file('crontab.txt'); - - // remove existing ispconfig cronjobs, in case the syntax has changed - foreach($existing_root_cron_jobs as $key => $val) { - if(stristr($val,$install_dir)) unset($existing_root_cron_jobs[$key]); - } - - $root_cron_jobs = array( - "* * * * * ".$install_dir."/server/server.sh > /dev/null 2>> ".$conf['ispconfig_log_dir']."/cron.log", - "30 00 * * * ".$install_dir."/server/cron_daily.sh > /dev/null 2>> ".$conf['ispconfig_log_dir']."/cron.log" - ); - foreach($root_cron_jobs as $cron_job) { - if(!in_array($cron_job."\n", $existing_root_cron_jobs)) { - $existing_root_cron_jobs[] = $cron_job."\n"; - } - } - file_put_contents('crontab.txt', $existing_root_cron_jobs); - exec('crontab -u root crontab.txt &> /dev/null'); - unlink('crontab.txt'); - - //* Getmail crontab - if(is_user('getmail')) { - $cf = $conf['getmail']; - exec('crontab -u getmail -l > crontab.txt'); - $existing_cron_jobs = file('crontab.txt'); - - $cron_jobs = array( - '*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> '.$conf['ispconfig_log_dir'].'/cron.log' - ); - - // remove existing ispconfig cronjobs, in case the syntax has changed - foreach($existing_cron_jobs as $key => $val) { - if(stristr($val,'getmail')) unset($existing_cron_jobs[$key]); - } - - foreach($cron_jobs as $cron_job) { - if(!in_array($cron_job."\n", $existing_cron_jobs)) { - $existing_cron_jobs[] = $cron_job."\n"; - } - } - file_put_contents('crontab.txt', $existing_cron_jobs); - exec('crontab -u getmail crontab.txt &> /dev/null'); - unlink('crontab.txt'); - } - - touch($conf['ispconfig_log_dir'].'/cron.log'); - chmod($conf['ispconfig_log_dir'].'/cron.log', 0666); - - } - - /** - * Helper function - get the path to a template file based on - * the local part of the filename. Checks first for the existence - * of a distribution specific file and if not found looks in the - * base template folder. Optionally the behaviour can be changed - * by setting the 2nd parameter which will fetch the contents - * of the template file and return it instead of the path. The 3rd - * parameter further extends this behaviour by filtering the contents - * by inserting the ispconfig database credentials using the {} placeholders. - * - * @param string $tLocal local part of filename - * @param bool $tRf - * @param bool $tDBCred - * @return string Relative path to the chosen template file - */ - protected function get_template_file($tLocal, $tRf=false, $tDBCred=false) { - global $conf, $dist; - - $final_path = ''; - $dist_template = 'dist/tpl/'.strtolower($dist['name'])."/$tLocal.master"; - if (file_exists($dist_template)) { - $final_path = $dist_template; - } else { - $final_path = "tpl/$tLocal.master"; - } - - if (!$tRf) { - return $final_path; - } else { - return (!$tDBCred) ? rf($final_path) : $this->insert_db_credentials(rf($final_path)); - } - } - - /** - * Helper function - writes the contents to a config file - * and performs a backup if the file exist. Additionally - * if the file exists the new file will be given the - * same rights and ownership as the original. Optionally the - * rights and/or ownership can be overriden by appending umask, - * user and group to the parameters. Providing only uid and gid - * values will result in only a chown. - * - * @param $tConf - * @param $tContents - * @return bool - */ - protected function write_config_file($tConf, $tContents) { - // Backup config file before writing new contents and stat file - if ( is_file($tConf) ) { - $stat = exec('stat -c \'%a %U %G\' '.escapeshellarg($tConf), $output, $res); - if ($res == 0) { // stat successfull - list($access, $user, $group) = split(" ", $stat); - } - - if ( copy($tConf, $tConf.'~') ) { - chmod($tConf.'~', 0400); - } - } - - wf($tConf, $tContents); // write file - - if (func_num_args() >= 4) // override rights and/or ownership - { - $args = func_get_args(); - $output = array_slice($args, 2); - - switch (sizeof($output)) { - case 3: - $umask = array_shift($output); - if (is_numeric($umask) && preg_match('/^0?[0-7]{3}$/', $umask)) { - $access = $umask; - } - case 2: - if (is_user($output[0]) && is_group($output[1])) { - list($user,$group) = $output; - } - break; - } - } - - if (!empty($user) && !empty($group)) { - chown($tConf, $user); - chgrp($tConf, $group); - } - - if (!empty($access)) { - exec("chmod $access $tConf"); - } - } - - /** - * Helper function - filter the contents of a config - * file by inserting the common ispconfig database - * credentials. - * - * @param $tContents - * @return string - */ - protected function insert_db_credentials($tContents) { - global $conf; - - $tContents = str_replace('{mysql_server_ispconfig_user}', $conf["mysql"]["ispconfig_user"], $tContents); - $tContents = str_replace('{mysql_server_ispconfig_password}', $conf["mysql"]["ispconfig_password"], $tContents); - $tContents = str_replace('{mysql_server_database}', $conf["mysql"]["database"], $tContents); - $tContents = str_replace('{mysql_server_ip}', $conf["mysql"]["ip"], $tContents); - $tContents = str_replace('{mysql_server_host}',$conf['mysql']['host'], $tContents); - $tContents = str_replace('{mysql_server_port}',$conf["mysql"]["port"], $tContents); - - return $tContents; - } -} - -?> +conf = $conf; + } + + //: TODO Implement the translation function and language files for the installer. + public function lng($text) { + return $text; + } + + public function error($msg) { + die('ERROR: '.$msg."\n"); + } + + public function simple_query($query, $answers, $default) { + $finished = false; + do { + $answers_str = implode(',', $answers); + swrite($this->lng($query).' ('.$answers_str.') ['.$default.']: '); + $input = sread(); + + //* Stop the installation + if($input == 'quit') { + swriteln($this->lng("Installation terminated by user.\n")); + die(); + } + + //* Select the default + if($input == '') { + $answer = $default; + $finished = true; + } + + //* Set answer id valid + if(in_array($input, $answers)) { + $answer = $input; + $finished = true; + } + + } while ($finished == false); + swriteln(); + return $answer; + } + + public function free_query($query,$default) { + swrite($this->lng($query).' ['.$default.']: '); + $input = sread(); + + //* Stop the installation + if($input == 'quit') { + swriteln($this->lng("Installation terminated by user.\n")); + die(); + } + + $answer = ($input == '') ? $default : $input; + swriteln(); + return $answer; + } + + /* + // TODO: this function is not used atmo I think - pedro + function request_language(){ + + swriteln(lng('Enter your language')); + swriteln(lng('de, en')); + + } + */ + + //** Detect installed applications + public function find_installed_apps() { + global $conf; + + if(is_installed('mysql') || is_installed('mysqld')) $conf['mysql']['installed'] = true; + if(is_installed('postfix')) $conf['postfix']['installed'] = true; + if(is_installed('mailman')) $conf['mailman']['installed'] = true; + if(is_installed('apache') || is_installed('apache2') || is_installed('httpd')) $conf['apache']['installed'] = true; + if(is_installed('getmail')) $conf['getmail']['installed'] = true; + if(is_installed('courierlogger')) $conf['courier']['installed'] = true; + if(is_installed('dovecot')) $conf['dovecot']['installed'] = true; + if(is_installed('saslsauthd')) $conf['saslauthd']['installed'] = true; + if(is_installed('amavisd-new')) $conf['amavis']['installed'] = true; + if(is_installed('clamdscan')) $conf['clamav']['installed'] = true; + if(is_installed('pure-ftpd') || is_installed('pure-ftpd-wrapper')) $conf['pureftpd']['installed'] = true; + if(is_installed('mydns') || is_installed('mydns-ng')) $conf['mydns']['installed'] = true; + if(is_installed('jk_chrootsh')) $conf['jailkit']['installed'] = true; + if(is_installed('pdns_server') || is_installed('pdns_control')) $conf['powerdns']['installed'] = true; + if(is_installed('named') || is_installed('bind') || is_installed('bind9')) $conf['bind']['installed'] = true; + + } + + /** Create the database for ISPConfig */ + public function configure_database() { + global $conf; + + //** Create the database + if(!$this->db->query('CREATE DATABASE IF NOT EXISTS '.$conf['mysql']['database'].' DEFAULT CHARACTER SET '.$conf['mysql']['charset'])) { + $this->error('Unable to create MySQL database: '.$conf['mysql']['database'].'.'); + } + + //* Set the database name in the DB library + $this->db->dbName = $conf['mysql']['database']; + + //* Load the database dump into the database, if database contains no tables + $db_tables = $this->db->getTables(); + if(count($db_tables) > 0) { + $this->error('Stopped: Database already contains some tables.'); + } else { + if($conf['mysql']['admin_password'] == '') { + caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['mysql']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null", + __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql'); + } else { + caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['mysql']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null", + __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql'); + } + $db_tables = $this->db->getTables(); + if(count($db_tables) == 0) { + $this->error('Unable to load SQL-Dump into database table.'); + } + + //* Load system.ini into the sys_ini table + $system_ini = $this->db->quote(rf('tpl/system.ini.master')); + $this->db->query("UPDATE sys_ini SET config = '$system_ini' WHERE sysini_id = 1"); + + } + } + + //** Create the server record in the database + public function add_database_server_record() { + + global $conf; + + if($conf['mysql']['host'] == 'localhost') { + $from_host = 'localhost'; + } else { + $from_host = $conf['hostname']; + } + + // Delete ISPConfig user in the local database, in case that it exists + $this->db->query("DELETE FROM mysql.user WHERE User = '".$conf['mysql']['ispconfig_user']."' AND Host = '".$from_host."';"); + $this->db->query("DELETE FROM mysql.db WHERE Db = '".$conf['mysql']['database']."' AND Host = '".$from_host."';"); + $this->db->query('FLUSH PRIVILEGES;'); + + //* Create the ISPConfig database user in the local database + $query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$conf['mysql']['database'].".* " + ."TO '".$conf['mysql']['ispconfig_user']."'@'".$from_host."' " + ."IDENTIFIED BY '".$conf['mysql']['ispconfig_password']."';"; + if(!$this->db->query($query)) { + $this->error('Unable to create database user: '.$conf['mysql']['ispconfig_user'].' Error: '.$this->db->errorMessage); + } + + //* Reload database privelages + $this->db->query('FLUSH PRIVILEGES;'); + + //* Set the database name in the DB library + $this->db->dbName = $conf['mysql']['database']; + + $tpl_ini_array = ini_to_array(rf('tpl/server.ini.master')); + + //* Update further distribution specific parameters for server config here + //* HINT: Every line added here has to be added in update.lib.php too!! + $tpl_ini_array['web']['vhost_conf_dir'] = $conf['apache']['vhost_conf_dir']; + $tpl_ini_array['web']['vhost_conf_enabled_dir'] = $conf['apache']['vhost_conf_enabled_dir']; + $tpl_ini_array['jailkit']['jailkit_chroot_app_programs'] = $conf['jailkit']['jailkit_chroot_app_programs']; + $tpl_ini_array['fastcgi']['fastcgi_phpini_path'] = $conf['fastcgi']['fastcgi_phpini_path']; + $tpl_ini_array['fastcgi']['fastcgi_starter_path'] = $conf['fastcgi']['fastcgi_starter_path']; + $tpl_ini_array['server']['hostname'] = $conf['hostname']; + $tpl_ini_array['server']['ip_address'] = @gethostbyname($conf['hostname']); + $tpl_ini_array['web']['website_basedir'] = $conf['web']['website_basedir']; + $tpl_ini_array['web']['website_path'] = $conf['web']['website_path']; + $tpl_ini_array['web']['website_symlinks'] = $conf['web']['website_symlinks']; + $tpl_ini_array['cron']['crontab_dir'] = $conf['cron']['crontab_dir']; + $tpl_ini_array['web']['security_level'] = 20; + $tpl_ini_array['web']['user'] = $conf['apache']['user']; + $tpl_ini_array['web']['group'] = $conf['apache']['group']; + $tpl_ini_array['web']['php_ini_path_apache'] = $conf['apache']['php_ini_path_apache']; + $tpl_ini_array['web']['php_ini_path_cgi'] = $conf['apache']['php_ini_path_cgi']; + $tpl_ini_array['mail']['pop3_imap_daemon'] = ($conf['dovecot']['installed'] == true)?'dovecot':'courier'; + $tpl_ini_array['mail']['mail_filter_syntax'] = ($conf['dovecot']['installed'] == true)?'sieve':'maildrop'; + $tpl_ini_array['dns']['bind_user'] = $conf['bind']['bind_user']; + $tpl_ini_array['dns']['bind_group'] = $conf['bind']['bind_group']; + $tpl_ini_array['dns']['bind_zonefiles_dir'] = $conf['bind']['bind_zonefiles_dir']; + $tpl_ini_array['dns']['named_conf_path'] = $conf['bind']['named_conf_path']; + $tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path']; + + if (array_key_exists('awstats', $conf)) { + foreach ($conf['awstats'] as $aw_sett => $aw_value) { + $tpl_ini_array['web']['awstats_'.$aw_sett] = $aw_value; + } + } + + $server_ini_content = array_to_ini($tpl_ini_array); + $server_ini_content = mysql_real_escape_string($server_ini_content); + + $mail_server_enabled = ($conf['services']['mail'])?1:0; + $web_server_enabled = ($conf['services']['web'])?1:0; + $dns_server_enabled = ($conf['services']['dns'])?1:0; + $file_server_enabled = ($conf['services']['file'])?1:0; + $db_server_enabled = ($conf['services']['db'])?1:0; + $vserver_server_enabled = ($conf['services']['vserver'])?1:0; + + //** Get the database version number based on the patchfiles + $found = true; + $current_db_version = 1; + while($found == true) { + $next_db_version = intval($current_db_version + 1); + $patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql'; + if(is_file($patch_filename)) { + $current_db_version = $next_db_version; + } else { + $found = false; + } + } + $current_db_version = intval($current_db_version); + + + if($conf['mysql']['master_slave_setup'] == 'y') { + + //* Insert the server record in master DB + $sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`, `dbversion`) VALUES (1, 1, 'riud', 'riud', 'r', '".$conf['hostname']."', '$mail_server_enabled', '$web_server_enabled', '$dns_server_enabled', '$file_server_enabled', '$db_server_enabled', '$vserver_server_enabled', '$server_ini_content', 0, 1, $current_db_version);"; + $this->dbmaster->query($sql); + $conf['server_id'] = $this->dbmaster->insertID(); + $conf['server_id'] = $conf['server_id']; + + //* Insert the same record in the local DB + $sql = "INSERT INTO `server` (`server_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`, `dbversion`) VALUES ('".$conf['server_id']."',1, 1, 'riud', 'riud', 'r', '".$conf['hostname']."', '$mail_server_enabled', '$web_server_enabled', '$dns_server_enabled', '$file_server_enabled', '$db_server_enabled', '$vserver_server_enabled', '$server_ini_content', 0, 1, $current_db_version);"; + $this->db->query($sql); + + //* username for the ispconfig user + $conf['mysql']['master_ispconfig_user'] = 'ispcsrv'.$conf['server_id']; + + $this->grant_master_database_rights(); + + } else { + //* Insert the server, if its not a mster / slave setup + $sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`, `dbversion`) VALUES (1, 1, 'riud', 'riud', 'r', '".$conf['hostname']."', '$mail_server_enabled', '$web_server_enabled', '$dns_server_enabled', '$file_server_enabled', '$db_server_enabled', '$vserver_server_enabled', '$server_ini_content', 0, 1, $current_db_version);"; + $this->db->query($sql); + $conf['server_id'] = $this->db->insertID(); + $conf['server_id'] = $conf['server_id']; + } + + + } + + public function grant_master_database_rights() { + global $conf; + + /* + * The following code is a little bit tricky: + * * If we HAVE a master-slave - Setup then the client has to grant the rights for himself + * at the master. + * * If we DO NOT have a master-slave - Setup then we have two possibilities + * 1) it is a single server + * 2) it is the MASTER of n clients + */ + $hosts = array(); + + if($conf['mysql']['master_slave_setup'] == 'y') { + /* + * it is a master-slave - Setup so the slave has to grant its rights in the master + * database + */ + + //* insert the ispconfig user in the remote server + $from_host = $conf['hostname']; + $from_ip = gethostbyname($conf['hostname']); + + $hosts[$from_host]['user'] = $conf['mysql']['master_ispconfig_user']; + $hosts[$from_host]['db'] = $conf['mysql']['master_database']; + $hosts[$from_host]['pwd'] = $conf['mysql']['master_ispconfig_password']; + + $hosts[$from_ip]['user'] = $conf['mysql']['master_ispconfig_user']; + $hosts[$from_ip]['db'] = $conf['mysql']['master_database']; + $hosts[$from_ip]['pwd'] = $conf['mysql']['master_ispconfig_password']; + } else{ + /* + * it is NOT a master-slave - Setup so we have to find out all clients and their + * host + */ + $query = "SELECT Host, User FROM mysql.user WHERE User like 'ispcsrv%' ORDER BY User, Host"; + $data = $this->dbmaster->queryAllRecords($query); + if($data === false) { + $this->error('Unable to get the user rights: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + foreach ($data as $item){ + $hosts[$item['Host']]['user'] = $item['User']; + $hosts[$item['Host']]['db'] = $conf['mysql']['master_database']; + $hosts[$item['Host']]['pwd'] = ''; // the user already exists, so we need no pwd! + } + } + + if(count($hosts) > 0) { + foreach($hosts as $host => $value) { + /* + * If a pwd exists, this means, we have to add the new user (and his pwd). + * if not, the user already exists and we do not need the pwd + */ + if ($value['pwd'] != ''){ + $query = "CREATE USER '".$value['user']."'@'".$host."' IDENTIFIED BY '" . $value['pwd'] . "'"; + $this->dbmaster->query($query); // ignore the error + } + + /* + * Try to delete all rights of the user in case that it exists. + * In Case that it will not exist, do nothing (ignore the error!) + */ + $query = "REVOKE ALL PRIVILEGES, GRANT OPTION FROM '".$value['user']."'@'".$host."' "; + $this->dbmaster->query($query); // ignore the error + + //* Create the ISPConfig database user in the remote database + $query = "GRANT SELECT ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' "; + if(!$this->dbmaster->query($query)) { + $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, INSERT ON ".$value['db'].".`sys_log` TO '".$value['user']."'@'".$host."' "; + if(!$this->dbmaster->query($query)) { + $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, UPDATE(`status`) ON ".$value['db'].".`sys_datalog` TO '".$value['user']."'@'".$host."' "; + if(!$this->dbmaster->query($query)) { + $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, UPDATE(`status`) ON ".$value['db'].".`software_update_inst` TO '".$value['user']."'@'".$host."' "; + if(!$this->dbmaster->query($query)) { + $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, UPDATE(`updated`) ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' "; + if(!$this->dbmaster->query($query)) { + $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, UPDATE (`ssl_request`, `ssl_cert`, `ssl_action`) ON ".$value['db'].".`web_domain` TO '".$value['user']."'@'".$host."' "; + if(!$this->dbmaster->query($query)) { + $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT ON ".$value['db'].".`sys_group` TO '".$value['user']."'@'".$host."' "; + if(!$this->dbmaster->query($query)) { + $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, UPDATE (`action_state`, `response`) ON ".$value['db'].".`sys_remoteaction` TO '".$value['user']."'@'".$host."' "; + if(!$this->dbmaster->query($query)) { + $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, INSERT , DELETE ON ".$value['db'].".`monitor_data` TO '".$value['user']."'@'".$host."' "; + if(!$this->dbmaster->query($query)) { + $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`mail_traffic` TO '".$value['user']."'@'".$host."' "; + if(!$this->dbmaster->query($query)) { + $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`web_traffic` TO '".$value['user']."'@'".$host."' "; + if(!$this->dbmaster->query($query)) { + $this->error('Unable to set rights of user in master database: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + } + + /* + * It is all done. Relod the rights... + */ + $this->dbmaster->query('FLUSH PRIVILEGES;'); + } + + } + + //** writes postfix configuration files + public function process_postfix_config($configfile) { + global $conf; + + $config_dir = $conf['postfix']['config_dir'].'/'; + $full_file_name = $config_dir.$configfile; + //* Backup exiting file + if(is_file($full_file_name)) { + copy($full_file_name, $config_dir.$configfile.'~'); + } + $content = rf('tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); + $content = str_replace('{server_id}', $conf['server_id'], $content); + wf($full_file_name, $content); + } + + public function configure_jailkit() { + global $conf; + + $cf = $conf['jailkit']; + $config_dir = $cf['config_dir']; + $jk_init = $cf['jk_init']; + $jk_chrootsh = $cf['jk_chrootsh']; + + if (is_dir($config_dir)) { + if(is_file($config_dir.'/'.$jk_init)) copy($config_dir.'/'.$jk_init, $config_dir.'/'.$jk_init.'~'); + if(is_file($config_dir.'/'.$jk_chrootsh.'.master')) copy($config_dir.'/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh.'~'); + + copy('tpl/'.$jk_init.'.master', $config_dir.'/'.$jk_init); + copy('tpl/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh); + } + + } + + public function configure_mailman($status = 'insert') { + global $conf; + + $config_dir = $conf['mailman']['config_dir'].'/'; + $full_file_name = $config_dir.'mm_cfg.py'; + //* Backup exiting file + if(is_file($full_file_name)) { + copy($full_file_name, $config_dir.'mm_cfg.py~'); + } + + // load files + $content = rf('tpl/mm_cfg.py.master'); + $old_file = rf($full_file_name); + + $old_options = array(); + $lines = explode("\n", $old_file); + foreach ($lines as $line) + { + if (strlen($line) && substr($line, 0, 1) != '#') + { + list($key, $value) = explode("=", $line); + if (!empty($value)) + { + $key = rtrim($key); + $old_options[$key] = trim($value); + } + } + } + + $virtual_domains = ''; + if($status == 'update') + { + // create virtual_domains list + $domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain"); + + foreach($domainAll as $domain) + { + if ($domainAll[0]['domain'] == $domain['domain']) + $virtual_domains .= "'".$domain['domain']."'"; + else + $virtual_domains .= ", '".$domain['domain']."'"; + } + } + else + $virtual_domains = "' '"; + + $content = str_replace('{hostname}', $conf['hostname'], $content); + $content = str_replace('{default_language}', $old_options['DEFAULT_SERVER_LANGUAGE'], $content); + $content = str_replace('{virtual_domains}', $virtual_domains, $content); + + wf($full_file_name, $content); + } + + public function configure_postfix($options = '') { + global $conf; + $cf = $conf['postfix']; + $config_dir = $cf['config_dir']; + + if(!is_dir($config_dir)) { + $this->error("The postfix configuration directory '$config_dir' does not exist."); + } + + //* mysql-virtual_domains.cf + $this->process_postfix_config('mysql-virtual_domains.cf'); + + //* mysql-virtual_forwardings.cf + $this->process_postfix_config('mysql-virtual_forwardings.cf'); + + //* mysql-virtual_mailboxes.cf + $this->process_postfix_config('mysql-virtual_mailboxes.cf'); + + //* mysql-virtual_email2email.cf + $this->process_postfix_config('mysql-virtual_email2email.cf'); + + //* mysql-virtual_transports.cf + $this->process_postfix_config('mysql-virtual_transports.cf'); + + //* mysql-virtual_recipient.cf + $this->process_postfix_config('mysql-virtual_recipient.cf'); + + //* mysql-virtual_sender.cf + $this->process_postfix_config('mysql-virtual_sender.cf'); + + //* mysql-virtual_client.cf + $this->process_postfix_config('mysql-virtual_client.cf'); + + //* mysql-virtual_relaydomains.cf + $this->process_postfix_config('mysql-virtual_relaydomains.cf'); + + //* mysql-virtual_relayrecipientmaps.cf + $this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf'); + + //* Changing mode and group of the new created config files. + caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', + __FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed'); + caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', + __FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed'); + + //* Creating virtual mail user and group + $command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname']; + if(!is_group($cf['vmail_groupname'])) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = 'useradd -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' '.$cf['vmail_username'].' -d '.$cf['vmail_mailbox_base'].' -m'; + if(!is_user($cf['vmail_username'])) caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $postconf_commands = array ( + 'myhostname = '.$conf['hostname'], + 'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain', + 'mynetworks = 127.0.0.0/8 [::1]/128', + 'virtual_alias_domains =', + 'virtual_alias_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_forwardings.cf, mysql:'.$config_dir.'/mysql-virtual_email2email.cf', + 'virtual_mailbox_domains = proxy:mysql:'.$config_dir.'/mysql-virtual_domains.cf', + 'virtual_mailbox_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailboxes.cf', + 'virtual_mailbox_base = '.$cf['vmail_mailbox_base'], + 'virtual_uid_maps = static:'.$cf['vmail_userid'], + 'virtual_gid_maps = static:'.$cf['vmail_groupid'], + 'smtpd_sasl_auth_enable = yes', + 'broken_sasl_auth_clients = yes', + 'smtpd_sasl_authenticated_header = yes', + 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:'.$config_dir.'/mysql-virtual_recipient.cf, reject_unauth_destination', + 'smtpd_use_tls = yes', + 'smtpd_tls_security_level = may', + 'smtpd_tls_cert_file = '.$config_dir.'/smtpd.cert', + 'smtpd_tls_key_file = '.$config_dir.'/smtpd.key', + 'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf', + 'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf', + 'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf', + 'virtual_create_maildirsize = yes', + 'virtual_maildir_extended = yes', + 'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf', + 'virtual_mailbox_limit_override = yes', + 'virtual_maildir_limit_message = "The user you are trying to reach is over quota."', + 'virtual_overquota_bounce = yes', + 'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps', + 'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf', + 'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf', + 'maildrop_destination_concurrency_limit = 1', + 'maildrop_destination_recipient_limit = 1', + 'virtual_transport = maildrop', + 'header_checks = regexp:'.$config_dir.'/header_checks', + 'mime_header_checks = regexp:'.$config_dir.'/mime_header_checks', + 'nested_header_checks = regexp:'.$config_dir.'/nested_header_checks', + 'body_checks = regexp:'.$config_dir.'/body_checks' + ); + + //* Create the header and body check files + touch($config_dir.'/header_checks'); + touch($config_dir.'/mime_header_checks'); + touch($config_dir.'/nested_header_checks'); + touch($config_dir.'/body_checks'); + + + //* Make a backup copy of the main.cf file + copy($config_dir.'/main.cf', $config_dir.'/main.cf~'); + + //* Executing the postconf commands + foreach($postconf_commands as $cmd) { + $command = "postconf -e '$cmd'"; + caselog($command." &> /dev/null", __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); + } + + if(!stristr($options,'dont-create-certs')) { + //* Create the SSL certificate + $command = 'cd '.$config_dir.'; ' + .'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509'; + exec($command); + + $command = 'chmod o= '.$config_dir.'/smtpd.key'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); + } + + //** We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop. + $command = 'chmod 755 /var/run/courier/authdaemon/'; + if(is_file('/var/run/courier/authdaemon/')) caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); + + //* Changing maildrop lines in posfix master.cf + if(is_file($config_dir.'/master.cf')) { + copy($config_dir.'/master.cf', $config_dir.'/master.cf~'); + } + if(is_file($config_dir.'/master.cf~')) { + chmod($config_dir.'/master.cf~', 0400); + } + $configfile = $config_dir.'/master.cf'; + $content = rf($configfile); + $content = str_replace('flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}', + 'flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d '.$cf['vmail_username'].' ${extension} ${recipient} ${user} ${nexthop} ${sender}', + $content); + wf($configfile, $content); + + //* Writing the Maildrop mailfilter file + $configfile = 'mailfilter'; + if(is_file($cf['vmail_mailbox_base'].'/.'.$configfile)) { + copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~'); + } + $content = rf('tpl/'.$configfile.'.master'); + $content = str_replace('{dist_postfix_vmail_mailbox_base}', $cf['vmail_mailbox_base'], $content); + wf($cf['vmail_mailbox_base'].'/.'.$configfile, $content); + + //* Create the directory for the custom mailfilters + if(!is_dir($cf['vmail_mailbox_base'].'/mailfilters')) { + $command = 'mkdir '.$cf['vmail_mailbox_base'].'/mailfilters'; + caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + + //* Chmod and chown the .mailfilter file + $command = 'chown -R '.$cf['vmail_username'].':'.$cf['vmail_groupname'].' '.$cf['vmail_mailbox_base'].'/.mailfilter'; + caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = 'chmod -R 600 '.$cf['vmail_mailbox_base'].'/.mailfilter'; + caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + } + + public function configure_saslauthd() { + global $conf; + + + $configfile = 'sasl_smtpd.conf'; + if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf')) copy($conf['postfix']['config_dir'].'/sasl/smtpd.conf',$conf['postfix']['config_dir'].'/sasl/smtpd.conf~'); + if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf~')) chmod($conf['postfix']['config_dir'].'/sasl/smtpd.conf~', 0400); + $content = rf('tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); + $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); + $content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content); + wf($conf['postfix']['config_dir'].'/sasl/smtpd.conf',$content); + + // TODO: Chmod and chown on the config file + + + // Recursively create the spool directory + if(!@is_dir('/var/spool/postfix/var/run/saslauthd')) mkdir('/var/spool/postfix/var/run/saslauthd', 0755, true); + + // Edit the file /etc/default/saslauthd + $configfile = $conf['saslauthd']['config']; + if(is_file($configfile)) copy($configfile,$configfile.'~'); + if(is_file($configfile.'~')) chmod($configfile.'~', 0400); + $content = rf($configfile); + $content = str_replace('START=no','START=yes',$content); + // Debian + $content = str_replace('OPTIONS="-c"','OPTIONS="-m /var/spool/postfix/var/run/saslauthd -r"',$content); + // Ubuntu + $content = str_replace('OPTIONS="-c -m /var/run/saslauthd"','OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"',$content); + wf($configfile,$content); + + // Edit the file /etc/init.d/saslauthd + $configfile = $conf['init_scripts'].'/'.$conf['saslauthd']['init_script']; + $content = rf($configfile); + $content = str_replace('PIDFILE=$RUN_DIR/saslauthd.pid','PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"',$content); + wf($configfile,$content); + + // add the postfix user to the sasl group (at least necessary for Ubuntu 8.04 and most likely Debian Lenny as well. + exec('adduser postfix sasl'); + + + } + + public function configure_pam() { + global $conf; + $pam = $conf['pam']; + //* configure pam for SMTP authentication agains the ispconfig database + $configfile = 'pamd_smtp'; + if(is_file($pam.'/smtp')) copy($pam.'/smtp', $pam.'/smtp~'); + if(is_file($pam.'/smtp~')) chmod($pam.'/smtp~', 0400); + + $content = rf('tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); + wf($pam.'/smtp', $content); + // On some OSes smtp is world readable which allows for reading database information. Removing world readable rights should have no effect. + if(is_file($pam.'/smtp')) exec("chmod o= $pam/smtp"); + chmod($pam.'/smtp', 0660); + chown($pam.'/smtp', 'daemon'); + chgrp($pam.'/smtp', 'daemon'); + + } + + public function configure_courier() { + global $conf; + $config_dir = $conf['courier']['config_dir']; + //* authmysqlrc + $configfile = 'authmysqlrc'; + if(is_file($config_dir.'/'.$configfile)) { + copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); + } + chmod($config_dir.'/'.$configfile.'~', 0400); + $content = rf('tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); + $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); + $content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content); + wf($config_dir.'/'.$configfile, $content); + + chmod($config_dir.'/'.$configfile, 0660); + chown($config_dir.'/'.$configfile, 'daemon'); + chgrp($config_dir.'/'.$configfile, 'daemon'); + + //* authdaemonrc + $configfile = $config_dir.'/authdaemonrc'; + if(is_file($configfile)) { + copy($configfile, $configfile.'~'); + } + if(is_file($configfile.'~')) { + chmod($configfile.'~', 0400); + } + $content = rf($configfile); + $content = str_replace('authmodulelist="authpam"', 'authmodulelist="authmysql"', $content); + wf($configfile, $content); + } + + public function configure_dovecot() { + global $conf; + + $config_dir = $conf['dovecot']['config_dir']; + + //* Configure master.cf and add a line for deliver + if(is_file($conf['postfix']['config_dir'].'/master.cf')) { + copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~2'); + } + if(is_file($conf['postfix']['config_dir'].'/master.cf~')) { + chmod($conf['postfix']['config_dir'].'/master.cf~2', 0400); + } + $content = rf($conf['postfix']['config_dir'].'/master.cf'); + // Only add the content if we had not addded it before + if(!stristr($content,'dovecot/deliver')) { + $deliver_content = 'dovecot unix - n n - - pipe'."\n".' flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}'; + af($conf['postfix']['config_dir'].'/master.cf',$deliver_content); + } + unset($content); + unset($deliver_content); + + + //* Reconfigure postfix to use dovecot authentication + // Adding the amavisd commands to the postfix configuration + $postconf_commands = array ( + 'dovecot_destination_recipient_limit = 1', + 'virtual_transport = dovecot', + 'smtpd_sasl_type = dovecot', + 'smtpd_sasl_path = private/auth' + ); + + // Make a backup copy of the main.cf file + copy($conf['postfix']['config_dir'].'/main.cf',$conf['postfix']['config_dir'].'/main.cf~3'); + + // Executing the postconf commands + foreach($postconf_commands as $cmd) { + $command = "postconf -e '$cmd'"; + caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + + //* copy dovecot.conf + $configfile = 'dovecot.conf'; + if(is_file($config_dir.'/'.$configfile)) { + copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); + } + copy('tpl/debian_dovecot.conf.master',$config_dir.'/'.$configfile); + + //* dovecot-sql.conf + $configfile = 'dovecot-sql.conf'; + if(is_file($config_dir.'/'.$configfile)) { + copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); + } + chmod($config_dir.'/'.$configfile.'~', 0400); + $content = rf('tpl/debian_dovecot-sql.conf.master'); + $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); + $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); + $content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content); + wf($config_dir.'/'.$configfile, $content); + + chmod($config_dir.'/'.$configfile, 0600); + chown($config_dir.'/'.$configfile, 'root'); + chgrp($config_dir.'/'.$configfile, 'root'); + + } + + public function configure_amavis() { + global $conf; + + // amavisd user config file + $configfile = 'amavisd_user_config'; + if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user')) copy($conf['amavis']['config_dir'].'/conf.d/50-user',$conf['amavis']['config_dir'].'/50-user~'); + if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user~')) chmod($conf['amavis']['config_dir'].'/conf.d/50-user~', 0400); + $content = rf('tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); + $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); + $content = str_replace('{mysql_server_port}',$conf['mysql']['port'],$content); + $content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content); + wf($conf['amavis']['config_dir'].'/conf.d/50-user',$content); + + // TODO: chmod and chown on the config file + + + // Adding the amavisd commands to the postfix configuration + $postconf_commands = array ( + 'content_filter = amavis:[127.0.0.1]:10024', + 'receive_override_options = no_address_mappings' + ); + + // Make a backup copy of the main.cf file + copy($conf['postfix']['config_dir'].'/main.cf',$conf['postfix']['config_dir'].'/main.cf~2'); + + // Executing the postconf commands + foreach($postconf_commands as $cmd) { + $command = "postconf -e '$cmd'"; + caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + + // Append the configuration for amavisd to the master.cf file + if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf',$conf['postfix']['config_dir'].'/master.cf~'); + $content = rf($conf['postfix']['config_dir'].'/master.cf'); + // Only add the content if we had not addded it before + if(!stristr($content,'127.0.0.1:10025')) { + unset($content); + $content = rf('tpl/master_cf_amavis.master'); + af($conf['postfix']['config_dir'].'/master.cf',$content); + } + unset($content); + + // Add the clamav user to the amavis group + exec('adduser clamav amavis'); + + + } + + public function configure_spamassassin() { + global $conf; + + //* Enable spamasasssin on debian and ubuntu + $configfile = '/etc/default/spamassassin'; + if(is_file($configfile)) { + copy($configfile, $configfile.'~'); + } + $content = rf($configfile); + $content = str_replace('ENABLED=0', 'ENABLED=1', $content); + wf($configfile, $content); + } + + public function configure_getmail() { + global $conf; + + $config_dir = $conf['getmail']['config_dir']; + + if(!@is_dir($config_dir)) mkdir(escapeshellcmd($config_dir), 0700, true); + + $command = 'useradd -d '.$config_dir.' getmail'; + if(!is_user('getmail')) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = "chown -R getmail $config_dir"; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = "chmod -R 700 $config_dir"; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + + + public function configure_pureftpd() { + global $conf; + + $config_dir = $conf['pureftpd']['config_dir']; + + //* configure pure-ftpd for MySQL authentication against the ispconfig database + $configfile = 'db/mysql.conf'; + if(is_file($config_dir.'/'.$configfile)) { + copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); + } + if(is_file($config_dir.'/'.$configfile.'~')) { + chmod($config_dir.'/'.$configfile.'~', 0400); + } + $content = rf('tpl/pureftpd_mysql.conf.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); + $content = str_replace('{server_id}', $conf['server_id'], $content); + wf($config_dir.'/'.$configfile, $content); + chmod($config_dir.'/'.$configfile, 0600); + chown($config_dir.'/'.$configfile, 'root'); + chgrp($config_dir.'/'.$configfile, 'root'); + // **enable chrooting + //exec('mkdir -p '.$config_dir.'/conf/ChrootEveryone'); + exec('echo "yes" > '.$config_dir.'/conf/ChrootEveryone'); + exec('echo "yes" > '.$config_dir.'/conf/BrokenClientsCompatibility'); + exec('echo "yes" > '.$config_dir.'/conf/DisplayDotFiles'); + + if(is_file('/etc/default/pure-ftpd-common')) { + replaceLine('/etc/default/pure-ftpd-common','STANDALONE_OR_INETD=inetd','STANDALONE_OR_INETD=standalone',1,0); + replaceLine('/etc/default/pure-ftpd-common','VIRTUALCHROOT=false','VIRTUALCHROOT=true',1,0); + } + + if(is_file('/etc/inetd.conf')) { + replaceLine('/etc/inetd.conf','/usr/sbin/pure-ftpd-wrapper','#ftp stream tcp nowait root /usr/sbin/tcpd /usr/sbin/pure-ftpd-wrapper',0,0); + if(is_file($conf['init_scripts'].'/'.'openbsd-inetd')) exec($conf['init_scripts'].'/'.'openbsd-inetd restart'); + } + + if(!is_file('/etc/pure-ftpd/conf/DontResolve')) exec('echo "yes" > /etc/pure-ftpd/conf/DontResolve'); + } + + public function configure_mydns() { + global $conf; + + // configure pam for SMTP authentication agains the ispconfig database + $configfile = 'mydns.conf'; + if(is_file($conf['mydns']['config_dir'].'/'.$configfile)) copy($conf['mydns']['config_dir'].'/'.$configfile,$conf['mydns']['config_dir'].'/'.$configfile.'~'); + if(is_file($conf['mydns']['config_dir'].'/'.$configfile.'~')) chmod($conf['mydns']['config_dir'].'/'.$configfile.'~', 0400); + $content = rf('tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); + $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); + $content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content); + $content = str_replace('{server_id}',$conf['server_id'],$content); + wf($conf['mydns']['config_dir'].'/'.$configfile,$content); + chmod($conf['mydns']['config_dir'].'/'.$configfile, 0600); + chown($conf['mydns']['config_dir'].'/'.$configfile, 'root'); + chgrp($conf['mydns']['config_dir'].'/'.$configfile, 'root'); + + } + + public function configure_powerdns() { + global $conf; + + //* Create the database + if(!$this->db->query('CREATE DATABASE IF NOT EXISTS '.$conf['powerdns']['database'].' DEFAULT CHARACTER SET '.$conf['mysql']['charset'])) { + $this->error('Unable to create MySQL database: '.$conf['powerdns']['database'].'.'); + } + + //* Create the ISPConfig database user in the local database + $query = "GRANT ALL ON `".$conf['powerdns']['database']."` . * TO '".$conf['mysql']['ispconfig_user']."'@'localhost';"; + if(!$this->db->query($query)) { + $this->error('Unable to create user for powerdns database Error: '.$this->db->errorMessage); + } + + //* Reload database privelages + $this->db->query('FLUSH PRIVILEGES;'); + + //* load the powerdns databse dump + if($conf['mysql']['admin_password'] == '') { + caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null", + __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql'); + } else { + caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null", + __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql'); + } + + //* Create the powerdns config file + $configfile = 'pdns.local'; + if(is_file($conf['powerdns']['config_dir'].'/'.$configfile)) copy($conf['powerdns']['config_dir'].'/'.$configfile,$conf['powerdns']['config_dir'].'/'.$configfile.'~'); + if(is_file($conf['powerdns']['config_dir'].'/'.$configfile.'~')) chmod($conf['powerdns']['config_dir'].'/'.$configfile.'~', 0400); + $content = rf('tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); + $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{powerdns_database}',$conf['powerdns']['database'],$content); + $content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content); + wf($conf['powerdns']['config_dir'].'/'.$configfile,$content); + chmod($conf['powerdns']['config_dir'].'/'.$configfile, 0600); + chown($conf['powerdns']['config_dir'].'/'.$configfile, 'root'); + chgrp($conf['powerdns']['config_dir'].'/'.$configfile, 'root'); + + + } + + public function configure_bind() { + global $conf; + + //* Check if the zonefile directory has a slash at the end + $content=$conf['bind']['bind_zonefiles_dir']; + if(substr($content,-1,1) != '/') { + $content .= '/'; + } + + //* Create the slave subdirectory + $content .= 'slave'; + if(!@is_dir($content)) mkdir($content, 0770, true); + + //* Chown the slave subdirectory to $conf['bind']['bind_user'] + chown($content, $conf['bind']['bind_user']); + chgrp($content, $conf['bind']['bind_group']); + + } + + + + public function configure_apache() { + global $conf; + + //* Create the logging directory for the vhost logfiles + if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true); + + if(is_file('/etc/suphp/suphp.conf')) { + replaceLine('/etc/suphp/suphp.conf','php=php:/usr/bin','x-httpd-suphp="php:/usr/bin/php-cgi"',0); + //replaceLine('/etc/suphp/suphp.conf','docroot=','docroot=/var/clients',0); + replaceLine('/etc/suphp/suphp.conf','umask=0077','umask=0022',0); + } + + if(is_file('/etc/apache2/sites-enabled/000-default')) { + replaceLine('/etc/apache2/sites-available/000-default','NameVirtualHost *','NameVirtualHost *:80',1,0); + replaceLine('/etc/apache2/sites-available/000-default','','',1,0); + } + + if(is_file('/etc/apache2/ports.conf')) { + // add a line "Listen 443" to ports conf if line does not exist + replaceLine('/etc/apache2/ports.conf','Listen 443','Listen 443',1); + } + + + //* Copy the ISPConfig configuration include + $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; + $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; + + // copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf'); + + $content = rf('tpl/apache_ispconfig.conf.master'); + $records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'"); + if(is_array($records) && count($records) > 0) { + foreach($records as $rec) { + $content .= 'NameVirtualHost '.$rec['ip_address'].":80\n"; + $content .= 'NameVirtualHost '.$rec['ip_address'].":443\n"; + } + } + $content .= "\n"; + wf($vhost_conf_dir.'/ispconfig.conf',$content); + + if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.conf')) { + symlink($vhost_conf_dir.'/ispconfig.conf',$vhost_conf_enabled_dir.'/000-ispconfig.conf'); + } + + //* make sure that webalizer finds its config file when it is directly in /etc + if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) { + mkdir('/etc/webalizer'); + symlink('/etc/webalizer.conf','/etc/webalizer/webalizer.conf'); + } + + if(is_file('/etc/webalizer/webalizer.conf')) { + // Change webalizer mode to incremental + replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0); + replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental yes',0,0); + replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName webalizer.hist',0,0); + } + + // Check the awsatst script + if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools'); + if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl'); + + //* add a sshusers group + $command = 'groupadd sshusers'; + if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + } + + public function configure_firewall() { + global $conf; + + $dist_init_scripts = $conf['init_scripts']; + + if(is_dir('/etc/Bastille.backup')) caselog('rm -rf /etc/Bastille.backup', __FILE__, __LINE__); + if(is_dir('/etc/Bastille')) caselog('mv -f /etc/Bastille /etc/Bastille.backup', __FILE__, __LINE__); + @mkdir('/etc/Bastille', 0700); + if(is_dir('/etc/Bastille.backup/firewall.d')) caselog('cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/', __FILE__, __LINE__); + caselog('cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__); + caselog('chmod 644 /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__); + $content = rf('/etc/Bastille/bastille-firewall.cfg'); + $content = str_replace('{DNS_SERVERS}', '', $content); + + $tcp_public_services = ''; + $udp_public_services = ''; + + $row = $this->db->queryOneRecord('SELECT * FROM '.$conf["mysql"]["database"].'.firewall WHERE server_id = '.intval($conf['server_id'])); + + if(trim($row['tcp_port']) != '' || trim($row['udp_port']) != '') { + $tcp_public_services = trim(str_replace(',',' ',$row['tcp_port'])); + $udp_public_services = trim(str_replace(',',' ',$row['udp_port'])); + } else { + $tcp_public_services = '21 22 25 53 80 110 143 443 3306 8080 10000'; + $udp_public_services = '53'; + } + + if(!stristr($tcp_public_services, $conf['apache']['vhost_port'])) { + $tcp_public_services .= ' '.intval($conf['apache']['vhost_port']); + if($row['tcp_port'] != '') $this->db->query("UPDATE firewall SET tcp_port = tcp_port + ',".intval($conf['apache']['vhost_port'])."' WHERE server_id = ".intval($conf['server_id'])); + } + + $content = str_replace('{TCP_PUBLIC_SERVICES}', $tcp_public_services, $content); + $content = str_replace('{UDP_PUBLIC_SERVICES}', $udp_public_services, $content); + + wf('/etc/Bastille/bastille-firewall.cfg', $content); + + if(is_file($dist_init_scripts.'/bastille-firewall')) caselog('mv -f '.$dist_init_scripts.'/bastille-firewall '.$dist_init_scripts.'/bastille-firewall.backup', __FILE__, __LINE__); + caselog('cp -f apps/bastille-firewall '.$dist_init_scripts, __FILE__, __LINE__); + caselog('chmod 700 '.$dist_init_scripts.'/bastille-firewall', __FILE__, __LINE__); + + if(is_file('/sbin/bastille-ipchains')) caselog('mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup', __FILE__, __LINE__); + caselog('cp -f apps/bastille-ipchains /sbin', __FILE__, __LINE__); + caselog('chmod 700 /sbin/bastille-ipchains', __FILE__, __LINE__); + + if(is_file('/sbin/bastille-netfilter')) caselog('mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup', __FILE__, __LINE__); + caselog('cp -f apps/bastille-netfilter /sbin', __FILE__, __LINE__); + caselog('chmod 700 /sbin/bastille-netfilter', __FILE__, __LINE__); + + if(!@is_dir('/var/lock/subsys')) caselog('mkdir /var/lock/subsys', __FILE__, __LINE__); + + exec('which ipchains &> /dev/null', $ipchains_location, $ret_val); + if(!is_file('/sbin/ipchains') && !is_link('/sbin/ipchains') && $ret_val == 0) phpcaselog(@symlink(shell_exec('which ipchains'), '/sbin/ipchains'), 'create symlink', __FILE__, __LINE__); + unset($ipchains_location); + exec('which iptables &> /dev/null', $iptables_location, $ret_val); + if(!is_file('/sbin/iptables') && !is_link('/sbin/iptables') && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec('which iptables')), '/sbin/iptables'), 'create symlink', __FILE__, __LINE__); + unset($iptables_location); + + } + + public function configure_vlogger() { + global $conf; + + //** Configure vlogger to use traffic logging to mysql (master) db + $configfile = 'vlogger-dbi.conf'; + if(is_file($conf['vlogger']['config_dir'].'/'.$configfile)) copy($conf['vlogger']['config_dir'].'/'.$configfile,$conf['vlogger']['config_dir'].'/'.$configfile.'~'); + if(is_file($conf['vlogger']['config_dir'].'/'.$configfile.'~')) chmod($conf['vlogger']['config_dir'].'/'.$configfile.'~', 0400); + $content = rf('tpl/'.$configfile.'.master'); + if($conf['mysql']['master_slave_setup'] == 'y') { + $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['master_ispconfig_user'],$content); + $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['master_ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}',$conf['mysql']['master_database'],$content); + $content = str_replace('{mysql_server_ip}',$conf['mysql']['master_host'],$content); + } else { + $content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content); + $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content); + $content = str_replace('{mysql_server_ip}',$conf['mysql']['host'],$content); + } + wf($conf['vlogger']['config_dir'].'/'.$configfile,$content); + chmod($conf['vlogger']['config_dir'].'/'.$configfile, 0600); + chown($conf['vlogger']['config_dir'].'/'.$configfile, 'root'); + chgrp($conf['vlogger']['config_dir'].'/'.$configfile, 'root'); + + } + + public function configure_apps_vhost() { + global $conf; + + //* Create the ispconfig apps vhost user and group + + $apps_vhost_user = escapeshellcmd($conf['web']['apps_vhost_user']); + $apps_vhost_group = escapeshellcmd($conf['web']['apps_vhost_group']); + $install_dir = escapeshellcmd($conf['web']['website_basedir'].'/apps'); + + $command = 'groupadd '.$apps_vhost_user; + if(!is_group($apps_vhost_group)) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = 'useradd -g '.$apps_vhost_group.' -d '.$install_dir.' '.$apps_vhost_group; + if(!is_user($apps_vhost_user)) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + + $command = 'adduser '.$conf['apache']['user'].' '.$apps_vhost_group; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + if(!@is_dir($install_dir)) mkdir($install_dir, 0755, true); + chown($install_dir, $apps_vhost_user); + chgrp($install_dir, $apps_vhost_group); + + //* Copy the apps vhost file + $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; + $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; + $apps_vhost_servername = ($conf['web']['apps_vhost_servername'] == '')?'':'ServerName '.$conf['web']['apps_vhost_servername']; + + // Dont just copy over the virtualhost template but add some custom settings + $content = rf('tpl/apache_apps.vhost.master'); + + $content = str_replace('{apps_vhost_ip}', $conf['web']['apps_vhost_ip'], $content); + $content = str_replace('{apps_vhost_port}', $conf['web']['apps_vhost_port'], $content); + $content = str_replace('{apps_vhost_dir}', $conf['web']['website_basedir'].'/apps', $content); + $content = str_replace('{website_basedir}', $conf['web']['website_basedir'], $content); + $content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content); + + + // comment out the listen directive if port is 80 or 443 + if($conf['web']['apps_vhost_ip'] == 80 or $conf['web']['apps_vhost_ip'] == 443) { + $content = str_replace('{vhost_port_listen}', '#', $content); + } else { + $content = str_replace('{vhost_port_listen}', '', $content); + } + + wf($vhost_conf_dir.'/apps.vhost', $content); + + //copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost"); + //* and create the symlink + if($this->install_ispconfig_interface == true) { + if(@is_link($vhost_conf_enabled_dir.'/apps.vhost')) unlink($vhost_conf_enabled_dir.'/apps.vhost'); + if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost')) { + symlink($vhost_conf_dir.'/apps.vhost',$vhost_conf_enabled_dir.'/000-apps.vhost'); + } + } + if(!is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter')) { + mkdir($conf['web']['website_basedir'].'/php-fcgi-scripts/apps', 0755, true); + copy('tpl/apache_apps_fcgi_starter.master',$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter'); + exec('chmod +x '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter'); + exec('chown -R ispapps:ispapps '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps'); + + } + + } + + public function make_ispconfig_ssl_cert() { + global $conf; + + $install_dir = $conf['ispconfig_install_dir']; + + $ssl_crt_file = $install_dir.'/interface/ssl/ispserver.crt'; + $ssl_csr_file = $install_dir.'/interface/ssl/ispserver.csr'; + $ssl_key_file = $install_dir.'/interface/ssl/ispserver.key'; + + if(!@is_dir($install_dir.'/interface/ssl')) mkdir($install_dir.'/interface/ssl', 0755, true); + + $ssl_pw = substr(md5(mt_rand()),0,6); + exec("openssl genrsa -des3 -passout pass:$ssl_pw -out $ssl_key_file 4096"); + exec("openssl req -new -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -out $ssl_csr_file"); + exec("openssl req -x509 -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -in $ssl_csr_file -out $ssl_crt_file -days 3650"); + exec("openssl rsa -passin pass:$ssl_pw -in $ssl_key_file -out $ssl_key_file.insecure"); + rename($ssl_key_file,$ssl_key_file.'.secure'); + rename($ssl_key_file.'.insecure',$ssl_key_file); + + } + + public function install_ispconfig() { + global $conf; + + $install_dir = $conf['ispconfig_install_dir']; + + //* Create the ISPConfig installation directory + if(!@is_dir($install_dir)) { + $command = "mkdir $install_dir"; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + + //* Create a ISPConfig user and group + $command = 'groupadd ispconfig'; + if(!is_group('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = 'useradd -g ispconfig -d '.$install_dir.' ispconfig'; + if(!is_user('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* copy the ISPConfig interface part + $command = 'cp -rf ../interface '.$install_dir; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* copy the ISPConfig server part + $command = 'cp -rf ../server '.$install_dir; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* Create a symlink, so ISPConfig is accessible via web + // Replaced by a separate vhost definition for port 8080 + // $command = "ln -s $install_dir/interface/web/ /var/www/ispconfig"; + // caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* Create the config file for ISPConfig interface + $configfile = 'config.inc.php'; + if(is_file($install_dir.'/interface/lib/'.$configfile)) { + copy($install_dir.'/interface/lib/'.$configfile, $install_dir.'/interface/lib/'.$configfile.'~'); + } + $content = rf('tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); + + $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content); + $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content); + $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content); + $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content); + + $content = str_replace('{server_id}', $conf['server_id'], $content); + $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content); + $content = str_replace('{language}', $conf['language'], $content); + + wf($install_dir.'/interface/lib/'.$configfile, $content); + + //* Create the config file for ISPConfig server + $configfile = 'config.inc.php'; + if(is_file($install_dir.'/server/lib/'.$configfile)) { + copy($install_dir.'/server/lib/'.$configfile, $install_dir.'/interface/lib/'.$configfile.'~'); + } + $content = rf('tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); + + $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content); + $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content); + $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content); + $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content); + + $content = str_replace('{server_id}', $conf['server_id'], $content); + $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content); + $content = str_replace('{language}', $conf['language'], $content); + + wf($install_dir.'/server/lib/'.$configfile, $content); + + //* Create the config file for remote-actions (but only, if it does not exist, because + // the value is a autoinc-value and so changed by the remoteaction_core_module + if (!file_exists($install_dir.'/server/lib/remote_action.inc.php')) { + $content = ''; + wf($install_dir.'/server/lib/remote_action.inc.php', $content); + } + + //* Enable the server modules and plugins. + // TODO: Implement a selector which modules and plugins shall be enabled. + $dir = $install_dir.'/server/mods-available/'; + if (is_dir($dir)) { + if ($dh = opendir($dir)) { + while (($file = readdir($dh)) !== false) { + if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') { + include_once($install_dir.'/server/mods-available/'.$file); + $module_name = substr($file,0,-8); + $tmp = new $module_name; + if($tmp->onInstall()) { + if(!@is_link($install_dir.'/server/mods-enabled/'.$file)) { + @symlink($install_dir.'/server/mods-available/'.$file, $install_dir.'/server/mods-enabled/'.$file); + // @symlink($install_dir.'/server/mods-available/'.$file, '../mods-enabled/'.$file); + } + if (strpos($file, '_core_module') !== false) { + if(!@is_link($install_dir.'/server/mods-core/'.$file)) { + @symlink($install_dir.'/server/mods-available/'.$file, $install_dir.'/server/mods-core/'.$file); + // @symlink($install_dir.'/server/mods-available/'.$file, '../mods-core/'.$file); + } + } + } + unset($tmp); + } + } + closedir($dh); + } + } + + $dir = $install_dir.'/server/plugins-available/'; + if (is_dir($dir)) { + if ($dh = opendir($dir)) { + while (($file = readdir($dh)) !== false) { + if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') { + include_once($install_dir.'/server/plugins-available/'.$file); + $plugin_name = substr($file,0,-8); + $tmp = new $plugin_name; + if(method_exists($tmp,'onInstall') && $tmp->onInstall()) { + if(!@is_link($install_dir.'/server/plugins-enabled/'.$file)) { + @symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-enabled/'.$file); + //@symlink($install_dir.'/server/plugins-available/'.$file, '../plugins-enabled/'.$file); + } + if (strpos($file, '_core_plugin') !== false) { + if(!@is_link($install_dir.'/server/plugins-core/'.$file)) { + @symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-core/'.$file); + //@symlink($install_dir.'/server/plugins-available/'.$file, '../plugins-core/'.$file); + } + } + } + unset($tmp); + } + } + closedir($dh); + } + } + + // Update the server config + $mail_server_enabled = ($conf['services']['mail'])?1:0; + $web_server_enabled = ($conf['services']['web'])?1:0; + $dns_server_enabled = ($conf['services']['dns'])?1:0; + $file_server_enabled = ($conf['services']['file'])?1:0; + $db_server_enabled = ($conf['services']['db'])?1:0; + $vserver_server_enabled = ($conf['services']['vserver'])?1:0; + + + + + + + $sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled' WHERE server_id = ".intval($conf['server_id']); + + if($conf['mysql']['master_slave_setup'] == 'y') { + $this->dbmaster->query($sql); + $this->db->query($sql); + } else { + $this->db->query($sql); + } + + + //* Chmod the files + $command = 'chmod -R 750 '.$install_dir; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the files to the ispconfig user and group + $command = 'chown -R ispconfig:ispconfig '.$install_dir; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* Make the global language file directory group writable + exec("chmod -R 770 $install_dir/interface/lib/lang"); + + //* Make the temp directory for language file exports writable + if(is_dir($install_dir.'/interface/web/temp')) exec("chmod -R 770 $install_dir/interface/web/temp"); + + //* Make all interface language file directories group writable + $handle = @opendir($install_dir.'/interface/web'); + while ($file = @readdir ($handle)) { + if ($file != '.' && $file != '..') { + if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) { + $handle2 = opendir($install_dir.'/interface/web'.'/'.$file.'/lib/lang'); + chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang',0770); + while ($lang_file = @readdir ($handle2)) { + if ($lang_file != '.' && $lang_file != '..') { + chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file,0770); + } + } + } + } + } + + //* make sure that the server config file (not the interface one) is only readable by the root user + chmod($install_dir.'/server/lib/'.$configfile, 0600); + chown($install_dir.'/server/lib/'.$configfile, 'root'); + chgrp($install_dir.'/server/lib/'.$configfile, 'root'); + + chmod($install_dir.'/server/lib/remote_action.inc.php', 0600); + chown($install_dir.'/server/lib/remote_action.inc.php', 'root'); + chgrp($install_dir.'/server/lib/remote_action.inc.php', 'root'); + + if(@is_file($install_dir.'/server/lib/mysql_clientdb.conf')) { + chmod($install_dir.'/server/lib/mysql_clientdb.conf', 0600); + chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); + chgrp($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); + } + + // TODO: FIXME: add the www-data user to the ispconfig group. This is just for testing + // and must be fixed as this will allow the apache user to read the ispconfig files. + // Later this must run as own apache server or via suexec! + $command = 'adduser www-data ispconfig'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* Make the shell scripts executable + $command = "chmod +x $install_dir/server/scripts/*.sh"; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* Copy the ISPConfig vhost for the controlpanel + $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; + $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; + + + // Dont just copy over the virtualhost template but add some custom settings + $content = rf('tpl/apache_ispconfig.vhost.master'); + $content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content); + + // comment out the listen directive if port is 80 or 443 + if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) { + $content = str_replace('{vhost_port_listen}', '#', $content); + } else { + $content = str_replace('{vhost_port_listen}', '', $content); + } + + if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) { + $content = str_replace('{ssl_comment}', '', $content); + } else { + $content = str_replace('{ssl_comment}', '#', $content); + } + + wf($vhost_conf_dir.'/ispconfig.vhost', $content); + + //copy('tpl/apache_ispconfig.vhost.master', $vhost_conf_dir.'/ispconfig.vhost'); + //* and create the symlink + if($this->install_ispconfig_interface == true && $this->is_update == false) { + if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost'); + if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) { + symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost'); + } + } + if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) { + mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true); + copy('tpl/apache_ispconfig_fcgi_starter.master','/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter'); + exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter'); + symlink($install_dir.'/interface/web','/var/www/ispconfig'); + exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig'); + + } + + //* Install the update script + if(is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) unlink('/usr/local/bin/ispconfig_update_from_svn.sh'); + chown($install_dir.'/server/scripts/update_from_svn.sh', 'root'); + chmod($install_dir.'/server/scripts/update_from_svn.sh', 0700); + chown($install_dir.'/server/scripts/update_from_tgz.sh', 'root'); + chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700); + chown($install_dir.'/server/scripts/ispconfig_update.sh', 'root'); + chmod($install_dir.'/server/scripts/ispconfig_update.sh', 0700); + if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh','/usr/local/bin/ispconfig_update_from_svn.sh'); + if(!is_link('/usr/local/bin/ispconfig_update.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh','/usr/local/bin/ispconfig_update.sh'); + + //* Make the logs readable for the ispconfig user + if(@is_file('/var/log/mail.log')) exec('chmod +r /var/log/mail.log'); + if(@is_file('/var/log/mail.warn')) exec('chmod +r /var/log/mail.warn'); + if(@is_file('/var/log/mail.err')) exec('chmod +r /var/log/mail.err'); + if(@is_file('/var/log/messages')) exec('chmod +r /var/log/messages'); + if(@is_file('/var/log/clamav/clamav.log')) exec('chmod +r /var/log/clamav/clamav.log'); + if(@is_file('/var/log/clamav/freshclam.log')) exec('chmod +r /var/log/clamav/freshclam.log'); + + //* Create the ispconfig log file and directory + if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) { + if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir'], 0755); + touch($conf['ispconfig_log_dir'].'/ispconfig.log'); + } + + rename($install_dir.'/server/scripts/run-getmail.sh','/usr/local/bin/run-getmail.sh'); + if(is_user('getmail')) chown('/usr/local/bin/run-getmail.sh', 'getmail'); + chmod('/usr/local/bin/run-getmail.sh', 0744); + + //* Add Log-Rotation + if (is_dir('/etc/logrotate.d')) { + @unlink('/etc/logrotate.d/logispc3'); // ignore, if the file is not there + /* We rotate these logs in cron_daily.php + $fh = fopen('/etc/logrotate.d/logispc3', 'w'); + fwrite($fh, + "$conf['ispconfig_log_dir']/ispconfig.log { \n" . + " weekly \n" . + " missingok \n" . + " rotate 4 \n" . + " compress \n" . + " delaycompress \n" . + "} \n" . + "$conf['ispconfig_log_dir']/cron.log { \n" . + " weekly \n" . + " missingok \n" . + " rotate 4 \n" . + " compress \n" . + " delaycompress \n" . + "}"); + fclose($fh); + */ + } + } + + public function configure_dbserver() { + global $conf; + + //* If this server shall act as database server for client DB's, we configure this here + $install_dir = $conf['ispconfig_install_dir']; + + // Create a file with the database login details which + // are used to create the client databases. + + if(!is_dir($install_dir.'/server/lib')) { + $command = "mkdir $install_dir/server/lib"; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + + $content = rf('tpl/mysql_clientdb.conf.master'); + $content = str_replace('{username}',$conf['mysql']['admin_user'],$content); + $content = str_replace('{password}',$conf['mysql']['admin_password'], $content); + wf($install_dir.'/server/lib/mysql_clientdb.conf',$content); + chmod($install_dir.'/server/lib/mysql_clientdb.conf', 0600); + chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); + chgrp($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); + + } + + public function install_crontab() { + global $conf; + + $install_dir = $conf['ispconfig_install_dir']; + + //* Root Crontab + exec('crontab -u root -l > crontab.txt'); + $existing_root_cron_jobs = file('crontab.txt'); + + // remove existing ispconfig cronjobs, in case the syntax has changed + foreach($existing_root_cron_jobs as $key => $val) { + if(stristr($val,$install_dir)) unset($existing_root_cron_jobs[$key]); + } + + $root_cron_jobs = array( + "* * * * * ".$install_dir."/server/server.sh > /dev/null 2>> ".$conf['ispconfig_log_dir']."/cron.log", + "30 00 * * * ".$install_dir."/server/cron_daily.sh > /dev/null 2>> ".$conf['ispconfig_log_dir']."/cron.log" + ); + foreach($root_cron_jobs as $cron_job) { + if(!in_array($cron_job."\n", $existing_root_cron_jobs)) { + $existing_root_cron_jobs[] = $cron_job."\n"; + } + } + file_put_contents('crontab.txt', $existing_root_cron_jobs); + exec('crontab -u root crontab.txt &> /dev/null'); + unlink('crontab.txt'); + + //* Getmail crontab + if(is_user('getmail')) { + $cf = $conf['getmail']; + exec('crontab -u getmail -l > crontab.txt'); + $existing_cron_jobs = file('crontab.txt'); + + $cron_jobs = array( + '*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> '.$conf['ispconfig_log_dir'].'/cron.log' + ); + + // remove existing ispconfig cronjobs, in case the syntax has changed + foreach($existing_cron_jobs as $key => $val) { + if(stristr($val,'getmail')) unset($existing_cron_jobs[$key]); + } + + foreach($cron_jobs as $cron_job) { + if(!in_array($cron_job."\n", $existing_cron_jobs)) { + $existing_cron_jobs[] = $cron_job."\n"; + } + } + file_put_contents('crontab.txt', $existing_cron_jobs); + exec('crontab -u getmail crontab.txt &> /dev/null'); + unlink('crontab.txt'); + } + + touch($conf['ispconfig_log_dir'].'/cron.log'); + chmod($conf['ispconfig_log_dir'].'/cron.log', 0666); + + } + + /** + * Helper function - get the path to a template file based on + * the local part of the filename. Checks first for the existence + * of a distribution specific file and if not found looks in the + * base template folder. Optionally the behaviour can be changed + * by setting the 2nd parameter which will fetch the contents + * of the template file and return it instead of the path. The 3rd + * parameter further extends this behaviour by filtering the contents + * by inserting the ispconfig database credentials using the {} placeholders. + * + * @param string $tLocal local part of filename + * @param bool $tRf + * @param bool $tDBCred + * @return string Relative path to the chosen template file + */ + protected function get_template_file($tLocal, $tRf=false, $tDBCred=false) { + global $conf, $dist; + + $final_path = ''; + $dist_template = 'dist/tpl/'.strtolower($dist['name'])."/$tLocal.master"; + if (file_exists($dist_template)) { + $final_path = $dist_template; + } else { + $final_path = "tpl/$tLocal.master"; + } + + if (!$tRf) { + return $final_path; + } else { + return (!$tDBCred) ? rf($final_path) : $this->insert_db_credentials(rf($final_path)); + } + } + + /** + * Helper function - writes the contents to a config file + * and performs a backup if the file exist. Additionally + * if the file exists the new file will be given the + * same rights and ownership as the original. Optionally the + * rights and/or ownership can be overriden by appending umask, + * user and group to the parameters. Providing only uid and gid + * values will result in only a chown. + * + * @param $tConf + * @param $tContents + * @return bool + */ + protected function write_config_file($tConf, $tContents) { + // Backup config file before writing new contents and stat file + if ( is_file($tConf) ) { + $stat = exec('stat -c \'%a %U %G\' '.escapeshellarg($tConf), $output, $res); + if ($res == 0) { // stat successfull + list($access, $user, $group) = split(" ", $stat); + } + + if ( copy($tConf, $tConf.'~') ) { + chmod($tConf.'~', 0400); + } + } + + wf($tConf, $tContents); // write file + + if (func_num_args() >= 4) // override rights and/or ownership + { + $args = func_get_args(); + $output = array_slice($args, 2); + + switch (sizeof($output)) { + case 3: + $umask = array_shift($output); + if (is_numeric($umask) && preg_match('/^0?[0-7]{3}$/', $umask)) { + $access = $umask; + } + case 2: + if (is_user($output[0]) && is_group($output[1])) { + list($user,$group) = $output; + } + break; + } + } + + if (!empty($user) && !empty($group)) { + chown($tConf, $user); + chgrp($tConf, $group); + } + + if (!empty($access)) { + exec("chmod $access $tConf"); + } + } + + /** + * Helper function - filter the contents of a config + * file by inserting the common ispconfig database + * credentials. + * + * @param $tContents + * @return string + */ + protected function insert_db_credentials($tContents) { + global $conf; + + $tContents = str_replace('{mysql_server_ispconfig_user}', $conf["mysql"]["ispconfig_user"], $tContents); + $tContents = str_replace('{mysql_server_ispconfig_password}', $conf["mysql"]["ispconfig_password"], $tContents); + $tContents = str_replace('{mysql_server_database}', $conf["mysql"]["database"], $tContents); + $tContents = str_replace('{mysql_server_ip}', $conf["mysql"]["ip"], $tContents); + $tContents = str_replace('{mysql_server_host}',$conf['mysql']['host'], $tContents); + $tContents = str_replace('{mysql_server_port}',$conf["mysql"]["port"], $tContents); + + return $tContents; + } +} + +?> diff --git a/install/sql/incremental/upd_0007.sql b/install/sql/incremental/upd_0007.sql new file mode 100644 index 0000000000000000000000000000000000000000..a7697e84bd08914303ee0e442b877e41d9807948 --- /dev/null +++ b/install/sql/incremental/upd_0007.sql @@ -0,0 +1,19 @@ +ALTER TABLE client ADD COLUMN limit_mailmailinglist int(11) NOT NULL default '-1'; +ALTER TABLE client_template ADD COLUMN limit_mailmailinglist int(11) NOT NULL default '-1'; + +CREATE TABLE IF NOT EXISTS `mail_mailinglist` ( + `mailinglist_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) character set ucs2 NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `domain` varchar(255) NOT NULL, + `listname` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + PRIMARY KEY (`mailinglist_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +DROP TABLE `mail_mailman_domain`; \ No newline at end of file diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index d39665a69286f6f87ec9c46521459c09da0c4e1a..780ecac2a7a8050c39acc3b1f2dbb694d3093f4d 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -1,1655 +1,1661 @@ - -/* -Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of ISPConfig nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - --- --- ISPConfig 3 --- DB-Version: 3.0.0.9 --- - -SET FOREIGN_KEY_CHECKS = 0; - --- -------------------------------------------------------- --- -------------------------------------------------------- --- DB-STRUCTURE --- -------------------------------------------------------- --- -------------------------------------------------------- - --- --- Table structure for table `client` --- - -CREATE TABLE `client` ( - `client_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `company_name` varchar(64) default NULL, - `contact_name` varchar(64) default NULL, - `customer_no` varchar(64) default NULL, - `vat_id` varchar(64) default NULL, - `street` varchar(255) default NULL, - `zip` varchar(32) default NULL, - `city` varchar(64) default NULL, - `state` varchar(32) default NULL, - `country` char(2) default NULL, - `telephone` varchar(32) default NULL, - `mobile` varchar(32) default NULL, - `fax` varchar(32) default NULL, - `email` varchar(255) default NULL, - `internet` varchar(255) NOT NULL, - `icq` varchar(16) default NULL, - `notes` text, - `default_mailserver` int(11) unsigned NOT NULL default '1', - `limit_maildomain` int(11) NOT NULL default '-1', - `limit_mailbox` int(11) NOT NULL default '-1', - `limit_mailalias` int(11) NOT NULL default '-1', - `limit_mailaliasdomain` int(11) NOT NULL default '-1', - `limit_mailforward` int(11) NOT NULL default '-1', - `limit_mailcatchall` int(11) NOT NULL default '-1', - `limit_mailrouting` int(11) NOT NULL default '0', - `limit_mailfilter` int(11) NOT NULL default '-1', - `limit_fetchmail` int(11) NOT NULL default '-1', - `limit_mailquota` int(11) NOT NULL default '-1', - `limit_spamfilter_wblist` int(11) NOT NULL default '0', - `limit_spamfilter_user` int(11) NOT NULL default '0', - `limit_spamfilter_policy` int(11) NOT NULL default '0', - `default_webserver` int(11) unsigned NOT NULL default '1', - `limit_web_ip` text, - `limit_web_domain` int(11) NOT NULL default '-1', - `limit_web_quota` int(11) NOT NULL default '-1', - `web_php_options` varchar(255) NOT NULL default 'no,fast-cgi,cgi,mod,suphp', - `limit_web_subdomain` int(11) NOT NULL default '-1', - `limit_web_aliasdomain` int(11) NOT NULL default '-1', - `limit_ftp_user` int(11) NOT NULL default '-1', - `limit_shell_user` int(11) NOT NULL default '0', - `ssh_chroot` varchar(255) NOT NULL DEFAULT 'no,jailkit,ssh-chroot', - `limit_webdav_user` int(11) NOT NULL default '0', - `default_dnsserver` int(11) unsigned NOT NULL default '1', - `limit_dns_zone` int(11) NOT NULL default '-1', - `limit_dns_slave_zone` int(11) NOT NULL default '-1', - `limit_dns_record` int(11) NOT NULL default '-1', - `default_dbserver` int(11) NOT NULL default '1', - `limit_database` int(11) NOT NULL default '-1', - `limit_cron` int(11) NOT NULL default '0', - `limit_cron_type` enum('url','chrooted','full') NOT NULL default 'url', - `limit_cron_frequency` int(11) NOT NULL default '5', - `limit_traffic_quota` int(11) NOT NULL default '-1', - `limit_client` int(11) NOT NULL default '0', - `parent_client_id` int(11) unsigned NOT NULL default '0', - `username` varchar(64) default NULL, - `password` varchar(64) default NULL, - `language` char(2) NOT NULL default 'en', - `usertheme` varchar(32) NOT NULL default 'default', - `template_master` int(11) unsigned NOT NULL default '0', - `template_additional` varchar(255) NOT NULL default '', - `created_at` bigint(20) DEFAULT NULL, - PRIMARY KEY (`client_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `client_template` --- - -CREATE TABLE `client_template` ( - `template_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `template_name` varchar(64) NOT NULL, - `template_type` varchar(1) NOT NULL default 'm', - `limit_maildomain` int(11) NOT NULL default '-1', - `limit_mailbox` int(11) NOT NULL default '-1', - `limit_mailalias` int(11) NOT NULL default '-1', - `limit_mailaliasdomain` int(11) NOT NULL default '-1', - `limit_mailforward` int(11) NOT NULL default '-1', - `limit_mailcatchall` int(11) NOT NULL default '-1', - `limit_mailrouting` int(11) NOT NULL default '0', - `limit_mailfilter` int(11) NOT NULL default '-1', - `limit_fetchmail` int(11) NOT NULL default '-1', - `limit_mailquota` int(11) NOT NULL default '-1', - `limit_spamfilter_wblist` int(11) NOT NULL default '0', - `limit_spamfilter_user` int(11) NOT NULL default '0', - `limit_spamfilter_policy` int(11) NOT NULL default '0', - `limit_web_ip` text, - `limit_web_domain` int(11) NOT NULL default '-1', - `limit_web_quota` int(11) NOT NULL default '-1', - `limit_web_subdomain` int(11) NOT NULL default '-1', - `limit_web_aliasdomain` int(11) NOT NULL default '-1', - `limit_ftp_user` int(11) NOT NULL default '-1', - `limit_shell_user` int(11) NOT NULL default '0', - `limit_webdav_user` int(11) NOT NULL default '0', - `limit_dns_zone` int(11) NOT NULL default '-1', - `limit_dns_slave_zone` int(11) NOT NULL default '-1', - `limit_dns_record` int(11) NOT NULL default '-1', - `limit_database` int(11) NOT NULL default '-1', - `limit_cron` int(11) NOT NULL default '0', - `limit_cron_type` enum('url','chrooted','full') NOT NULL default 'url', - `limit_cron_frequency` int(11) NOT NULL default '5', - `limit_traffic_quota` int(11) NOT NULL default '-1', - `limit_client` int(11) NOT NULL default '0', - PRIMARY KEY (`template_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - - --- -------------------------------------------------------- - --- --- Table structure for table `cron` --- -CREATE TABLE `cron` ( - `id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) NULL default NULL, - `sys_perm_group` varchar(5) NULL default NULL, - `sys_perm_other` varchar(5) NULL default NULL, - `server_id` int(11) unsigned NOT NULL default '0', - `parent_domain_id` int(11) unsigned NOT NULL default '0', - `type` enum('url','chrooted','full') NOT NULL default 'url', - `command` varchar(255) NOT NULL, - `run_min` varchar(100) NULL, - `run_hour` varchar(100) NULL, - `run_mday` varchar(100) NULL, - `run_month` varchar(100) NULL, - `run_wday` varchar(100) NULL, - `active` enum('n','y') NOT NULL default 'y', - PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - - --- -------------------------------------------------------- - --- --- Table structure for table `dns_rr` --- - -CREATE TABLE `dns_rr` ( - `id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL, - `sys_groupid` int(11) unsigned NOT NULL, - `sys_perm_user` varchar(5) NOT NULL, - `sys_perm_group` varchar(5) NOT NULL, - `sys_perm_other` varchar(5) NOT NULL, - `server_id` int(11) NOT NULL default '1', - `zone` int(11) unsigned NOT NULL, - `name` varchar(64) NOT NULL, - `type` enum('A','AAAA','ALIAS','CNAME','HINFO','MX','NAPTR','NS','PTR','RP','SRV','TXT') default NULL, - `data` varchar(255) NOT NULL, - `aux` int(11) unsigned NOT NULL default '0', - `ttl` int(11) unsigned NOT NULL default '86400', - `active` enum('N','Y') NOT NULL default 'Y', - `stamp` timestamp NOT NULL default CURRENT_TIMESTAMP, - `serial` int(10) unsigned default NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `rr` (`zone`,`name`,`type`,`data`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `dns_soa` --- - -CREATE TABLE `dns_soa` ( - `id` int(10) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL, - `sys_groupid` int(11) unsigned NOT NULL, - `sys_perm_user` varchar(5) NOT NULL, - `sys_perm_group` varchar(5) NOT NULL, - `sys_perm_other` varchar(5) NOT NULL, - `server_id` int(11) NOT NULL default '1', - `origin` varchar(255) NOT NULL, - `ns` varchar(255) NOT NULL, - `mbox` varchar(255) NOT NULL, - `serial` int(11) unsigned NOT NULL default '1', - `refresh` int(11) unsigned NOT NULL default '28800', - `retry` int(11) unsigned NOT NULL default '7200', - `expire` int(11) unsigned NOT NULL default '604800', - `minimum` int(11) unsigned NOT NULL default '86400', - `ttl` int(11) unsigned NOT NULL default '86400', - `active` enum('N','Y') NOT NULL, - `xfer` varchar(255) NOT NULL, - `also_notify` varchar(255) default NULL, - `update_acl` varchar(255) default NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `origin` (`origin`), - KEY `active` (`active`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `dns_slave` --- - -CREATE TABLE `dns_slave` ( - `id` int(10) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL, - `sys_groupid` int(11) unsigned NOT NULL, - `sys_perm_user` varchar(5) NOT NULL, - `sys_perm_group` varchar(5) NOT NULL, - `sys_perm_other` varchar(5) NOT NULL, - `server_id` int(11) NOT NULL default '1', - `origin` varchar(255) NOT NULL, - `ns` varchar(255) NOT NULL, - `active` enum('N','Y') NOT NULL, - `xfer` varchar(255) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `origin` (`origin`), - KEY `active` (`active`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `dns_template` --- - -CREATE TABLE `dns_template` ( - `template_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `name` varchar(64) default NULL, - `fields` varchar(255) default NULL, - `template` text, - `visible` enum('N','Y') NOT NULL default 'Y', - PRIMARY KEY (`template_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- --- Tabellenstruktur für Tabelle `domain` --- - -CREATE TABLE `domain` ( - `domain_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) NOT NULL default '', - `sys_perm_group` varchar(5) NOT NULL default '', - `sys_perm_other` varchar(5) NOT NULL default '', - `domain` varchar(255) NOT NULL default '', - PRIMARY KEY (`domain_id`), - UNIQUE KEY `domain` (`domain`) -) ENGINE=MyISAM; - --- -------------------------------------------------------- - --- --- Table structure for table `firewall` --- - -CREATE TABLE `firewall` ( - `firewall_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `server_id` int(11) unsigned NOT NULL default '0', - `tcp_port` varchar(255) default NULL, - `udp_port` varchar(255) default NULL, - `active` enum('n','y') NOT NULL default 'y', - PRIMARY KEY (`firewall_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `ftp_user` --- - -CREATE TABLE `ftp_user` ( - `ftp_user_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `server_id` int(11) unsigned NOT NULL default '0', - `parent_domain_id` int(11) unsigned NOT NULL default '0', - `username` varchar(64) default NULL, - `password` varchar(64) default NULL, - `quota_size` bigint(20) NOT NULL default '-1', - `active` enum('n','y') NOT NULL default 'y', - `uid` varchar(64) default NULL, - `gid` varchar(64) default NULL, - `dir` varchar(255) default NULL, - `quota_files` bigint(20) NOT NULL default '-1', - `ul_ratio` int(11) NOT NULL default '-1', - `dl_ratio` int(11) NOT NULL default '-1', - `ul_bandwidth` int(11) NOT NULL default '-1', - `dl_bandwidth` int(11) NOT NULL default '-1', - PRIMARY KEY (`ftp_user_id`), - KEY `active` (`active`), - KEY `server_id` (`server_id`), - KEY `username` (`username`), - KEY `quota_files` (`quota_files`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `mail_access` --- - -CREATE TABLE `mail_access` ( - `access_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) NOT NULL default '', - `sys_perm_group` varchar(5) NOT NULL default '', - `sys_perm_other` varchar(5) NOT NULL default '', - `server_id` int(11) NOT NULL default '0', - `source` varchar(255) NOT NULL, - `access` varchar(255) NOT NULL, - `type` set('recipient','sender','client') NOT NULL, - `active` enum('n','y') NOT NULL default 'y', - PRIMARY KEY (`access_id`), - KEY `server_id` (`server_id`,`source`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `mail_content_filter` --- - -CREATE TABLE `mail_content_filter` ( - `content_filter_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `server_id` int(11) NOT NULL default '0', - `type` varchar(255) default NULL, - `pattern` varchar(255) default NULL, - `data` varchar(255) default NULL, - `action` varchar(255) default NULL, - `active` varchar(255) NOT NULL default 'y', - PRIMARY KEY (`content_filter_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `mail_domain` --- - -CREATE TABLE `mail_domain` ( - `domain_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) NOT NULL default '', - `sys_perm_group` varchar(5) NOT NULL default '', - `sys_perm_other` varchar(5) NOT NULL default '', - `server_id` int(11) unsigned NOT NULL default '0', - `domain` varchar(255) NOT NULL default '', - `active` enum('n','y') NOT NULL, - PRIMARY KEY (`domain_id`), - KEY `server_id` (`server_id`,`domain`), - KEY `domain_active` (`domain`,`active`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `mail_forwarding` --- - -CREATE TABLE `mail_forwarding` ( - `forwarding_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) NOT NULL default '', - `sys_perm_group` varchar(5) NOT NULL default '', - `sys_perm_other` varchar(5) NOT NULL default '', - `server_id` int(11) unsigned NOT NULL default '0', - `source` varchar(255) NOT NULL, - `destination` text, - `type` enum('alias','aliasdomain','forward','catchall') NOT NULL default 'alias', - `active` enum('n','y') NOT NULL, - PRIMARY KEY (`forwarding_id`), - KEY `server_id` (`server_id`,`source`), - KEY `type` (`type`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `mail_get` --- - -CREATE TABLE `mail_get` ( - `mailget_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `server_id` int(11) unsigned NOT NULL default '0', - `type` varchar(255) default NULL, - `source_server` varchar(255) default NULL, - `source_username` varchar(255) default NULL, - `source_password` varchar(64) default NULL, - `source_delete` varchar(255) NOT NULL default 'y', - `destination` varchar(255) default NULL, - `active` varchar(255) NOT NULL default 'y', - PRIMARY KEY (`mailget_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `mail_greylist` --- - -CREATE TABLE `mail_greylist` ( - `greylist_id` int(11) unsigned NOT NULL auto_increment, - `relay_ip` varchar(39) default NULL, - `from_domain` varchar(255) default NULL, - `block_expires` datetime NOT NULL default '0000-00-00 00:00:00', - `record_expires` datetime NOT NULL default '0000-00-00 00:00:00', - `origin_type` enum('MANUAL','AUTO') NOT NULL default 'AUTO', - `create_time` datetime NOT NULL default '0000-00-00 00:00:00', - PRIMARY KEY (`greylist_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `mail_mailman_domain` --- - -CREATE TABLE `mail_mailman_domain` ( - `mailman_id` int(11) unsigned NOT NULL auto_increment, - `server_id` int(11) unsigned NOT NULL default '0', - `domain` varchar(255) NOT NULL default '', - `mm_home` varchar(255) NOT NULL default '', - `mm_wrap` varchar(255) NOT NULL default '', - `mm_user` varchar(50) NOT NULL default '', - `mm_group` varchar(50) NOT NULL default '', - PRIMARY KEY (`mailman_id`,`server_id`,`domain`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for Table `mail_relay_recipient` --- - -CREATE TABLE IF NOT EXISTS `mail_relay_recipient` ( - `relay_recipient_id` bigint(20) NOT NULL AUTO_INCREMENT, - `sys_userid` int(11) NOT NULL DEFAULT '0', - `sys_groupid` int(11) NOT NULL DEFAULT '0', - `sys_perm_user` varchar(5) DEFAULT NULL, - `sys_perm_group` varchar(5) DEFAULT NULL, - `sys_perm_other` varchar(5) DEFAULT NULL, - `server_id` int(11) NOT NULL DEFAULT '0', - `source` varchar(255) DEFAULT NULL, - `access` varchar(255) NOT NULL DEFAULT 'OK', - `active` varchar(255) NOT NULL DEFAULT 'y', - PRIMARY KEY (`relay_recipient_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1 ; - - --- -------------------------------------------------------- - --- --- Table structure for table `mail_traffic` --- - -CREATE TABLE `mail_traffic` ( - `traffic_id` int(11) unsigned NOT NULL auto_increment, - `mailuser_id` int(11) unsigned NOT NULL, - `month` char(7) NOT NULL, - `traffic` bigint(20) unsigned NOT NULL, - PRIMARY KEY (`traffic_id`), - KEY `mailuser_id` (`mailuser_id`,`month`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `mail_transport` --- - -CREATE TABLE `mail_transport` ( - `transport_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) NOT NULL default '', - `sys_perm_group` varchar(5) NOT NULL default '', - `sys_perm_other` varchar(5) NOT NULL default '', - `server_id` int(11) unsigned NOT NULL default '0', - `domain` varchar(255) NOT NULL default '', - `transport` varchar(255) NOT NULL, - `sort_order` int(11) unsigned NOT NULL default '5', - `active` enum('n','y') NOT NULL, - PRIMARY KEY (`transport_id`), - KEY `server_id` (`server_id`,`transport`), - KEY `server_id_2` (`server_id`,`domain`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `mail_user` --- - -CREATE TABLE `mail_user` ( - `mailuser_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) NOT NULL default '', - `sys_perm_group` varchar(5) NOT NULL default '', - `sys_perm_other` varchar(5) NOT NULL default '', - `server_id` int(11) unsigned NOT NULL default '0', - `email` varchar(255) NOT NULL default '', - `password` varchar(255) NOT NULL, - `name` varchar(255) NOT NULL default '', - `uid` int(11) unsigned NOT NULL default '5000', - `gid` int(11) unsigned NOT NULL default '5000', - `maildir` varchar(255) NOT NULL default '', - `quota` bigint(20) NOT NULL default '-1', - `cc` varchar(255) NOT NULL default '', - `homedir` varchar(255) NOT NULL, - `autoresponder` enum('n','y') NOT NULL default 'n', - `autoresponder_start_date` datetime NOT NULL default '0000-00-00 00:00:00', - `autoresponder_end_date` datetime NOT NULL default '0000-00-00 00:00:00', - `autoresponder_text` mediumtext NULL, - `move_junk` enum('n','y') NOT NULL default 'n', - `custom_mailfilter` mediumtext, - `postfix` enum('n','y') NOT NULL, - `access` enum('n','y') NOT NULL, - `disableimap` enum('n','y') NOT NULL default 'n', - `disablepop3` enum('n','y') NOT NULL default 'n', - `disabledeliver` enum('n','y') NOT NULL default 'n', - `disablesmtp` enum('n','y') NOT NULL default 'n', - PRIMARY KEY (`mailuser_id`), - KEY `server_id` (`server_id`,`email`), - KEY `email_access` (`email`,`access`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `mail_user_filter` --- - -CREATE TABLE `mail_user_filter` ( - `filter_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `mailuser_id` int(11) unsigned NOT NULL default '0', - `rulename` varchar(64) default NULL, - `source` varchar(255) default NULL, - `searchterm` varchar(255) default NULL, - `op` varchar(255) default NULL, - `action` varchar(255) default NULL, - `target` varchar(255) default NULL, - `active` enum('n','y') NOT NULL default 'y', - PRIMARY KEY (`filter_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `remote_session` --- - -CREATE TABLE `remote_session` ( - `remote_session` varchar(64) NOT NULL, - `remote_userid` int(11) unsigned NOT NULL, - `remote_functions` text NOT NULL, - `tstamp` int(10) unsigned NOT NULL, - PRIMARY KEY (`remote_session`) -) ENGINE=MyISAM; - --- -------------------------------------------------------- - --- --- Table structure for table `remote_user` --- - -CREATE TABLE `remote_user` ( - `remote_userid` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `remote_username` varchar(64) NOT NULL, - `remote_password` varchar(64) NOT NULL, - `remote_functions` text NOT NULL, - PRIMARY KEY (`remote_userid`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `server` --- - -CREATE TABLE `server` ( - `server_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) NOT NULL default '', - `sys_perm_group` varchar(5) NOT NULL default '', - `sys_perm_other` varchar(5) NOT NULL default '', - `server_name` varchar(255) NOT NULL default '', - `mail_server` tinyint(1) NOT NULL default '0', - `web_server` tinyint(1) NOT NULL default '0', - `dns_server` tinyint(1) NOT NULL default '0', - `file_server` tinyint(1) NOT NULL default '0', - `db_server` tinyint(1) NOT NULL default '0', - `vserver_server` tinyint(1) NOT NULL default '0', - `config` text NOT NULL, - `updated` bigint(20) unsigned NOT NULL default '0', - `mirror_server_id` int(11) unsigned NOT NULL default '0', - `dbversion` int(11) unsigned NOT NULL default '1', - `active` tinyint(1) NOT NULL default '1', - PRIMARY KEY (`server_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `server_ip` --- - -CREATE TABLE `server_ip` ( - `server_ip_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `server_id` int(11) unsigned NOT NULL default '0', - `ip_address` varchar(39) default NULL, - `virtualhost` enum('n','y') NOT NULL default 'y', - PRIMARY KEY (`server_ip_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - -CREATE TABLE `shell_user` ( - `shell_user_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `server_id` int(11) unsigned NOT NULL default '0', - `parent_domain_id` int(11) unsigned NOT NULL default '0', - `username` varchar(64) default NULL, - `password` varchar(64) default NULL, - `quota_size` bigint(20) NOT NULL default '-1', - `active` enum('n','y') NOT NULL default 'y', - `puser` varchar(255) default NULL, - `pgroup` varchar(255) default NULL, - `shell` varchar(255) NOT NULL default '/bin/bash', - `dir` varchar(255) default NULL, - `chroot` varchar(255) NOT NULL, - PRIMARY KEY (`shell_user_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `software_package` --- - -CREATE TABLE `software_package` ( - `package_id` int(11) unsigned NOT NULL auto_increment, - `software_repo_id` int(11) unsigned NOT NULL, - `package_name` varchar(64) NOT NULL, - `package_title` varchar(64) NOT NULL, - `package_description` text, - `package_version` varchar(8) default NULL, - `package_type` enum('ispconfig','app','web') NOT NULL default 'app', - `package_installable` enum('yes','no','key') NOT NULL default 'yes', - `package_requires_db` enum('no','mysql') NOT NULL default 'no', - `package_remote_functions` text, - `package_key` varchar(255) NOT NULL, - `package_config` text, - PRIMARY KEY (`package_id`), - UNIQUE KEY `package_name` (`package_name`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `software_repo` --- - -CREATE TABLE `software_repo` ( - `software_repo_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `repo_name` varchar(64) default NULL, - `repo_url` varchar(255) default NULL, - `repo_username` varchar(64) default NULL, - `repo_password` varchar(64) default NULL, - `active` enum('n','y') NOT NULL default 'y', - PRIMARY KEY (`software_repo_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `software_update` --- - -CREATE TABLE `software_update` ( - `software_update_id` int(11) unsigned NOT NULL auto_increment, - `software_repo_id` int(11) unsigned NOT NULL, - `package_name` varchar(64) NOT NULL, - `update_url` varchar(255) NOT NULL, - `update_md5` varchar(255) NOT NULL, - `update_dependencies` varchar(255) NOT NULL, - `update_title` varchar(64) NOT NULL, - `v1` tinyint(1) NOT NULL default '0', - `v2` tinyint(1) NOT NULL default '0', - `v3` tinyint(1) NOT NULL default '0', - `v4` tinyint(1) NOT NULL default '0', - `type` enum('full','update') NOT NULL default 'full', - PRIMARY KEY (`software_update_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `software_update_inst` --- - -CREATE TABLE `software_update_inst` ( - `software_update_inst_id` int(11) unsigned NOT NULL auto_increment, - `software_update_id` int(11) unsigned NOT NULL default '0', - `package_name` varchar(64) NOT NULL, - `server_id` int(11) unsigned NOT NULL, - `status` enum('none','installing','installed','deleting','deleted','failed') NOT NULL default 'none', - PRIMARY KEY (`software_update_inst_id`), - UNIQUE KEY `software_update_id` (`software_update_id`,`package_name`,`server_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `spamfilter_policy` --- - -CREATE TABLE `spamfilter_policy` ( - `id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL, - `sys_groupid` int(11) unsigned NOT NULL, - `sys_perm_user` varchar(5) NOT NULL, - `sys_perm_group` varchar(5) NOT NULL, - `sys_perm_other` varchar(5) NOT NULL, - `policy_name` varchar(64) default NULL, - `virus_lover` enum('N','Y') default NULL, - `spam_lover` enum('N','Y') default NULL, - `banned_files_lover` enum('N','Y') default NULL, - `bad_header_lover` enum('N','Y') default NULL, - `bypass_virus_checks` enum('N','Y') default NULL, - `bypass_spam_checks` enum('N','Y') default NULL, - `bypass_banned_checks` enum('N','Y') default NULL, - `bypass_header_checks` enum('N','Y') default NULL, - `spam_modifies_subj` enum('N','Y') default NULL, - `virus_quarantine_to` varchar(255) default NULL, - `spam_quarantine_to` varchar(255) default NULL, - `banned_quarantine_to` varchar(255) default NULL, - `bad_header_quarantine_to` varchar(255) default NULL, - `clean_quarantine_to` varchar(255) default NULL, - `other_quarantine_to` varchar(255) default NULL, - `spam_tag_level` float default NULL, - `spam_tag2_level` float default NULL, - `spam_kill_level` float default NULL, - `spam_dsn_cutoff_level` float default NULL, - `spam_quarantine_cutoff_level` float default NULL, - `addr_extension_virus` varchar(64) default NULL, - `addr_extension_spam` varchar(64) default NULL, - `addr_extension_banned` varchar(64) default NULL, - `addr_extension_bad_header` varchar(64) default NULL, - `warnvirusrecip` enum('N','Y') default NULL, - `warnbannedrecip` enum('N','Y') default NULL, - `warnbadhrecip` enum('N','Y') default NULL, - `newvirus_admin` varchar(64) default NULL, - `virus_admin` varchar(64) default NULL, - `banned_admin` varchar(64) default NULL, - `bad_header_admin` varchar(64) default NULL, - `spam_admin` varchar(64) default NULL, - `spam_subject_tag` varchar(64) default NULL, - `spam_subject_tag2` varchar(64) default NULL, - `message_size_limit` int(11) unsigned default NULL, - `banned_rulenames` varchar(64) default NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=1 ; - --- -------------------------------------------------------- - --- --- Table structure for table `spamfilter_users` --- - -CREATE TABLE `spamfilter_users` ( - `id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL, - `sys_groupid` int(11) unsigned NOT NULL, - `sys_perm_user` varchar(5) NOT NULL, - `sys_perm_group` varchar(5) NOT NULL, - `sys_perm_other` varchar(5) NOT NULL, - `server_id` int(11) unsigned NOT NULL, - `priority` tinyint(3) unsigned NOT NULL default '7', - `policy_id` int(11) unsigned NOT NULL default '1', - `email` varchar(255) NOT NULL, - `fullname` varchar(64) default NULL, - `local` varchar(1) default NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `email` (`email`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `spamfilter_wblist` --- - -CREATE TABLE `spamfilter_wblist` ( - `wblist_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL, - `sys_groupid` int(11) unsigned NOT NULL, - `sys_perm_user` varchar(5) NOT NULL, - `sys_perm_group` varchar(5) NOT NULL, - `sys_perm_other` varchar(5) NOT NULL, - `server_id` int(11) unsigned NOT NULL, - `wb` enum('W','B') NOT NULL default 'W', - `rid` int(11) unsigned NOT NULL, - `email` varchar(255) NOT NULL, - `priority` tinyint(3) unsigned NOT NULL, - `active` enum('y','n') NOT NULL default 'y', - PRIMARY KEY (`wblist_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `support_message` --- - -CREATE TABLE `support_message` ( - `support_message_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `recipient_id` int(11) unsigned NOT NULL default '0', - `sender_id` int(11) unsigned NOT NULL default '0', - `subject` varchar(255) default NULL, - `message` text default NULL, - `tstamp` int(11) NOT NULL default '0', - PRIMARY KEY (`support_message_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `sys_datalog` --- - -CREATE TABLE `sys_datalog` ( - `datalog_id` int(11) unsigned NOT NULL auto_increment, - `server_id` int(11) unsigned NOT NULL, - `dbtable` varchar(255) NOT NULL default '', - `dbidx` varchar(255) NOT NULL default '', - `action` char(1) NOT NULL default '', - `tstamp` int(11) NOT NULL default '0', - `user` varchar(255) NOT NULL default '', - `data` longtext NOT NULL, - `status` set('pending','ok','warning','error') NOT NULL default 'pending', - PRIMARY KEY (`datalog_id`), - KEY `server_id` (`server_id`,`status`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `sys_dbsync` --- - -CREATE TABLE `sys_dbsync` ( - `id` int(11) unsigned NOT NULL auto_increment, - `jobname` varchar(64) NOT NULL default '', - `sync_interval_minutes` int(11) unsigned NOT NULL default '0', - `db_type` varchar(16) NOT NULL default '', - `db_host` varchar(255) NOT NULL default '', - `db_name` varchar(64) NOT NULL default '', - `db_username` varchar(64) NOT NULL default '', - `db_password` varchar(64) NOT NULL default '', - `db_tables` varchar(255) NOT NULL default 'admin,forms', - `empty_datalog` int(11) unsigned NOT NULL default '0', - `sync_datalog_external` int(11) unsigned NOT NULL default '0', - `active` tinyint(1) NOT NULL default '1', - `last_datalog_id` int(11) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `last_datalog_id` (`last_datalog_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; --- -------------------------------------------------------- - --- --- Table structure for table `sys_filesync` --- - -CREATE TABLE `sys_filesync` ( - `id` int(11) unsigned NOT NULL auto_increment, - `jobname` varchar(64) NOT NULL default '', - `sync_interval_minutes` int(11) unsigned NOT NULL default '0', - `ftp_host` varchar(255) NOT NULL default '', - `ftp_path` varchar(255) NOT NULL default '', - `ftp_username` varchar(64) NOT NULL default '', - `ftp_password` varchar(64) NOT NULL default '', - `local_path` varchar(255) NOT NULL default '', - `wput_options` varchar(255) NOT NULL default '--timestamping --reupload --dont-continue', - `active` tinyint(1) NOT NULL default '1', - PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `sys_group` --- - -CREATE TABLE `sys_group` ( - `groupid` int(11) unsigned NOT NULL auto_increment, - `name` varchar(64) NOT NULL default '', - `description` text NOT NULL, - `client_id` int(11) unsigned NOT NULL default '0', - PRIMARY KEY (`groupid`) -) ENGINE=MyISAM AUTO_INCREMENT=1 ; - --- -------------------------------------------------------- - --- --- Table structure for table `sys_ini` --- - -CREATE TABLE `sys_ini` ( - `sysini_id` int(11) unsigned NOT NULL auto_increment, - `config` longtext NOT NULL, - PRIMARY KEY (`sysini_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `sys_log` --- - -CREATE TABLE `sys_log` ( - `syslog_id` int(11) unsigned NOT NULL auto_increment, - `server_id` int(11) unsigned NOT NULL default '0', - `datalog_id` int(11) unsigned NOT NULL default '0', - `loglevel` tinyint(4) NOT NULL default '0', - `tstamp` int(11) unsigned NOT NULL, - `message` text, - PRIMARY KEY (`syslog_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - - --- -------------------------------------------------------- - --- --- Table structure for table `sys_user` --- - -CREATE TABLE `sys_user` ( - `userid` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '1', - `sys_groupid` int(11) unsigned NOT NULL default '1', - `sys_perm_user` varchar(5) NOT NULL default 'riud', - `sys_perm_group` varchar(5) NOT NULL default 'riud', - `sys_perm_other` varchar(5) NOT NULL default '', - `username` varchar(64) NOT NULL default '', - `passwort` varchar(64) NOT NULL default '', - `modules` varchar(255) NOT NULL default '', - `startmodule` varchar(255) NOT NULL default '', - `app_theme` varchar(32) NOT NULL default 'default', - `typ` varchar(16) NOT NULL default 'user', - `active` tinyint(1) NOT NULL default '1', - `language` varchar(2) NOT NULL default 'de', - `groups` varchar(255) NOT NULL default '', - `default_group` int(11) unsigned NOT NULL default '0', - `client_id` int(11) unsigned NOT NULL default '0', - PRIMARY KEY (`userid`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `sys_session` --- - -CREATE TABLE `sys_session` ( - `session_id` varchar(32) NOT NULL default '', - `date_created` datetime NOT NULL default '0000-00-00 00:00:00', - `last_updated` datetime NOT NULL default '0000-00-00 00:00:00', - `session_data` longtext, - PRIMARY KEY (`session_id`), - KEY `last_updated` (`last_updated`) -) ENGINE=MyISAM; - --- -------------------------------------------------------- - --- --- Table structure for table `web_domain` --- - -CREATE TABLE `web_domain` ( - `domain_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `server_id` int(11) unsigned NOT NULL default '0', - `ip_address` varchar(39) default NULL, - `domain` varchar(255) default NULL, - `type` varchar(32) default NULL, - `parent_domain_id` int(11) unsigned NOT NULL default '0', - `vhost_type` varchar(32) default NULL, - `document_root` varchar(255) default NULL, - `system_user` varchar(255) default NULL, - `system_group` varchar(255) default NULL, - `hd_quota` bigint(20) NOT NULL default '0', - `traffic_quota` bigint(20) NOT NULL default '-1', - `cgi` enum('n','y') NOT NULL default 'y', - `ssi` enum('n','y') NOT NULL default 'y', - `suexec` enum('n','y') NOT NULL default 'y', - `errordocs` tinyint(1) NOT NULL default '1', - `is_subdomainwww` tinyint(1) NOT NULL default '1', - `subdomain` enum('none','www','*') NOT NULL default 'none', - `php` varchar(32) NOT NULL default 'y', - `ruby` enum('n','y') NOT NULL default 'n', - `redirect_type` varchar(255) default NULL, - `redirect_path` varchar(255) default NULL, - `ssl` enum('n','y') NOT NULL default 'n', - `ssl_state` varchar(255) NULL, - `ssl_locality` varchar(255) NULL, - `ssl_organisation` varchar(255) NULL, - `ssl_organisation_unit` varchar(255) NULL, - `ssl_country` varchar(255) NULL, - `ssl_domain` varchar(255) NULL, - `ssl_request` mediumtext NULL, - `ssl_cert` mediumtext NULL, - `ssl_bundle` mediumtext NULL, - `ssl_action` varchar(16) NULL, - `stats_password` varchar(255) default NULL, - `stats_type` varchar(255) default 'webalizer', - `allow_override` varchar(255) NOT NULL default 'All', - `apache_directives` mediumtext, - `php_open_basedir` mediumtext, - `custom_php_ini` mediumtext, - `backup_interval` VARCHAR( 255 ) NOT NULL DEFAULT 'none', - `backup_copies` INT NOT NULL DEFAULT '1', - `active` enum('n','y') NOT NULL default 'y', - `traffic_quota_lock` enum('n','y') NOT NULL default 'n', - PRIMARY KEY (`domain_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - --- -------------------------------------------------------- - --- --- Table structure for table `web_database` --- - -CREATE TABLE `web_database` ( - `database_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `server_id` int(11) unsigned NOT NULL default '0', - `type` varchar(16) NOT NULL default 'y', - `database_name` varchar(64) default NULL, - `database_user` varchar(64) default NULL, - `database_password` varchar(64) default NULL, - `database_charset` varchar(64) default NULL, - `remote_access` enum('n','y') NOT NULL default 'y', - `remote_ips` text NOT NULL, - `active` enum('n','y') NOT NULL default 'y', - PRIMARY KEY (`database_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - - --- -------------------------------------------------------- - --- --- Table structure for table `web_traffic` --- - -CREATE TABLE `web_traffic` ( - `hostname` varchar(255) NOT NULL, - `traffic_date` date NOT NULL, - `traffic_bytes` bigint(32) unsigned NOT NULL default '0', - PRIMARY KEY (`hostname`,`traffic_date`) -) ENGINE=MyISAM; - - --- -------------------------------------------------------- - --- --- Table structure for table `webdav_user` --- - -CREATE TABLE `webdav_user` ( - `webdav_user_id` int(11) unsigned NOT NULL auto_increment, - `sys_userid` int(11) unsigned NOT NULL default '0', - `sys_groupid` int(11) unsigned NOT NULL default '0', - `sys_perm_user` varchar(5) default NULL, - `sys_perm_group` varchar(5) default NULL, - `sys_perm_other` varchar(5) default NULL, - `server_id` int(11) unsigned NOT NULL default '0', - `parent_domain_id` int(11) unsigned NOT NULL default '0', - `username` varchar(64) default NULL, - `password` varchar(64) default NULL, - `active` enum('n','y') NOT NULL default 'y', - `dir` varchar(255) default NULL, - PRIMARY KEY (`webdav_user_id`) -) ENGINE=MyISAM; - - --- -------------------------------------------------------- - --- --- Table structure for table `attempts_login` --- - -CREATE TABLE `attempts_login` ( - `ip` varchar(39) NOT NULL, - `times` int(11) default NULL, - `login_time` timestamp -) ENGINE=MyISAM; - --- -------------------------------------------------------- - --- --- Table structure for table `monitor_data` --- - -CREATE TABLE `monitor_data` ( - `server_id` int(11) unsigned NOT NULL, - `type` varchar(255) NOT NULL, - `created` int(11) unsigned NOT NULL, - `data` mediumtext NOT NULL, - `state` enum('no_state', 'unknown', 'ok', 'info', 'warning', 'critical', 'error') NOT NULL default 'unknown', - PRIMARY KEY (`server_id`,`type`,`created`) -) ENGINE=MyISAM; - --- -------------------------------------------------------- - --- --- Table structure for table `sys_config` --- - -CREATE TABLE `sys_config` ( - `config_id` int(11) unsigned NOT NULL, - `group` varchar(64) NOT NULL, - `name` varchar(64) NOT NULL, - `value` varchar(255) NOT NULL -) ENGINE=MyISAM; - - --- --- Tabellenstruktur für Tabelle `sys_remoteaction` --- - -CREATE TABLE `sys_remoteaction` ( - `action_id` int(11) unsigned NOT NULL auto_increment, - `server_id` int(11) unsigned NOT NULL, - `tstamp` int(11) NOT NULL, - `action_type` varchar(20) NOT NULL, - `action_param` mediumtext NOT NULL, - `action_state` enum('pending','ok','warning','error') NOT NULL, - `response` mediumtext NOT NULL, - PRIMARY KEY (`action_id`), - KEY `server_id` (`server_id`) -) ENGINE=MyISAM; - --- -------------------------------------------------------- - --- --- iso_country_list.sql --- --- This will create and then populate a MySQL table with a list of the names and --- ISO 3166 codes for countries in existence as of the date below. --- --- For updates to this file, see http://27.org/isocountrylist/ --- For more about ISO 3166, see http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html --- --- Created by getisocountrylist.pl on Sun Nov 2 14:59:20 2003. --- Wm. Rhodes --- - --- --- Table structure for table `country` --- - -CREATE TABLE `country` ( - `iso` char(2) NOT NULL PRIMARY KEY, - `name` varchar(64) NOT NULL, - `printable_name` varchar(64) NOT NULL, - `iso3` char(3), - `numcode` SMALLINT -) ENGINE=MyISAM; - - - --- -------------------------------------------------------- --- -------------------------------------------------------- --- DB-DATA --- -------------------------------------------------------- --- -------------------------------------------------------- - --- --- Dumping data for table `dns_template` --- - -INSERT INTO `dns_template` (`template_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `name`, `fields`, `template`, `visible`) VALUES (1, 1, 1, 'riud', 'riud', '', 'Default', 'DOMAIN,IP,NS1,NS2,EMAIL', '[ZONE]\norigin={DOMAIN}.\nns={NS1}.\nmbox={EMAIL}.\nrefresh=28800\nretry=7200\nexpire=604800\nminimum=86400\nttl=86400\n\n[DNS_RECORDS]\nA|{DOMAIN}.|{IP}|0|86400\nA|www|{IP}|0|86400\nA|mail|{IP}|0|86400\nNS|{DOMAIN}.|{NS1}.|0|86400\nNS|{DOMAIN}.|{NS2}.|0|86400\nMX|{DOMAIN}.|mail.{DOMAIN}.|10|86400', 'y'); - --- -------------------------------------------------------- - --- --- Dumping data for table `software_repo` --- - -INSERT INTO `software_repo` (`software_repo_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `repo_name`, `repo_url`, `repo_username`, `repo_password`, `active`) VALUES (1, 1, 1, 'riud', 'riud', '', 'ISPConfig Addons', 'http://repo.ispconfig.org/addons/', '', '', 'n'); - --- -------------------------------------------------------- - --- --- Dumping data for table `spamfilter_policy` --- - -INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(1, 1, 0, 'riud', 'riud', 'r', 'Non-paying', 'N', 'N', 'N', 'N', 'Y', 'Y', 'Y', 'N', 'Y', '', '', '', '', '', '', 3, 7, 10, 0, 0, '', '', '', '', 'N', 'N', 'N', '', '', '', '', '', '', '', 0, ''); -INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(2, 1, 0, 'riud', 'riud', 'r', 'Uncensored', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', NULL, NULL, NULL, NULL, NULL, NULL, 3, 999, 999, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(3, 1, 0, 'riud', 'riud', 'r', 'Wants all spam', 'N', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 999, 999, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(4, 1, 0, 'riud', 'riud', 'r', 'Wants viruses', 'Y', 'N', 'Y', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 6.9, 6.9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(5, 1, 0, 'riud', 'riud', 'r', 'Normal', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', '', '', '', '', '', '', 1, 4.5, 50, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', '***SPAM***', NULL, NULL); -INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(6, 1, 0, 'riud', 'riud', 'r', 'Trigger happy', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 5, 5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(7, 1, 0, 'riud', 'riud', 'r', 'Permissive', 'N', 'N', 'N', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 10, 20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - --- -------------------------------------------------------- - --- --- Dumping data for table `sys_group` --- - -INSERT INTO `sys_group` (`groupid`, `name`, `description`, `client_id`) VALUES (1, 'admin', 'Administrators group', 0); - --- -------------------------------------------------------- - --- --- Dumping data for table `sys_ini` --- - -INSERT INTO `sys_ini` (`sysini_id`, `config`) VALUES (1, ''); - --- -------------------------------------------------------- - --- --- Dumping data for table `sys_user` --- - -INSERT INTO `sys_user` (`userid`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `username`, `passwort`, `modules`, `startmodule`, `app_theme`, `typ`, `active`, `language`, `groups`, `default_group`, `client_id`) VALUES (1, 1, 0, 'riud', 'riud', '', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'dashboard,admin,client,mail,monitor,sites,dns,tools,help', 'dashboard', 'default', 'admin', 1, 'en', '1,2', 1, 0); - --- -------------------------------------------------------- - --- --- Dumping data for table `sys_config` --- - -INSERT INTO sys_config VALUES ('1','db','db_version','3.0.3.1'); - --- -------------------------------------------------------- - --- --- iso_country_list.sql --- --- This will create and then populate a MySQL table with a list of the names and --- ISO 3166 codes for countries in existence as of the date below. --- --- For updates to this file, see http://27.org/isocountrylist/ --- For more about ISO 3166, see http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html --- --- Created by getisocountrylist.pl on Sun Nov 2 14:59:20 2003. --- Wm. Rhodes --- - --- --- Dumping data for table `country` --- - -INSERT INTO `country` (`iso`, `name`, `printable_name`, `iso3`, `numcode`) VALUES -('AF', 'AFGHANISTAN', 'Afghanistan', 'AFG', 4), -('AL', 'ALBANIA', 'Albania', 'ALB', 8), -('DZ', 'ALGERIA', 'Algeria', 'DZA', 12), -('AS', 'AMERICAN SAMOA', 'American Samoa', 'ASM', 16), -('AD', 'ANDORRA', 'Andorra', 'AND', 20), -('AO', 'ANGOLA', 'Angola', 'AGO', 24), -('AI', 'ANGUILLA', 'Anguilla', 'AIA', 660), -('AQ', 'ANTARCTICA', 'Antarctica', NULL, NULL), -('AG', 'ANTIGUA AND BARBUDA', 'Antigua and Barbuda', 'ATG', 28), -('AR', 'ARGENTINA', 'Argentina', 'ARG', 32), -('AM', 'ARMENIA', 'Armenia', 'ARM', 51), -('AW', 'ARUBA', 'Aruba', 'ABW', 533), -('AU', 'AUSTRALIA', 'Australia', 'AUS', 36), -('AT', 'AUSTRIA', 'Austria', 'AUT', 40), -('AZ', 'AZERBAIJAN', 'Azerbaijan', 'AZE', 31), -('BS', 'BAHAMAS', 'Bahamas', 'BHS', 44), -('BH', 'BAHRAIN', 'Bahrain', 'BHR', 48), -('BD', 'BANGLADESH', 'Bangladesh', 'BGD', 50), -('BB', 'BARBADOS', 'Barbados', 'BRB', 52), -('BY', 'BELARUS', 'Belarus', 'BLR', 112), -('BE', 'BELGIUM', 'Belgium', 'BEL', 56), -('BZ', 'BELIZE', 'Belize', 'BLZ', 84), -('BJ', 'BENIN', 'Benin', 'BEN', 204), -('BM', 'BERMUDA', 'Bermuda', 'BMU', 60), -('BT', 'BHUTAN', 'Bhutan', 'BTN', 64), -('BO', 'BOLIVIA', 'Bolivia', 'BOL', 68), -('BA', 'BOSNIA AND HERZEGOVINA', 'Bosnia and Herzegovina', 'BIH', 70), -('BW', 'BOTSWANA', 'Botswana', 'BWA', 72), -('BV', 'BOUVET ISLAND', 'Bouvet Island', NULL, NULL), -('BR', 'BRAZIL', 'Brazil', 'BRA', 76), -('IO', 'BRITISH INDIAN OCEAN TERRITORY', 'British Indian Ocean Territory', NULL, NULL), -('BN', 'BRUNEI DARUSSALAM', 'Brunei Darussalam', 'BRN', 96), -('BG', 'BULGARIA', 'Bulgaria', 'BGR', 100), -('BF', 'BURKINA FASO', 'Burkina Faso', 'BFA', 854), -('BI', 'BURUNDI', 'Burundi', 'BDI', 108), -('KH', 'CAMBODIA', 'Cambodia', 'KHM', 116), -('CM', 'CAMEROON', 'Cameroon', 'CMR', 120), -('CA', 'CANADA', 'Canada', 'CAN', 124), -('CV', 'CAPE VERDE', 'Cape Verde', 'CPV', 132), -('KY', 'CAYMAN ISLANDS', 'Cayman Islands', 'CYM', 136), -('CF', 'CENTRAL AFRICAN REPUBLIC', 'Central African Republic', 'CAF', 140), -('TD', 'CHAD', 'Chad', 'TCD', 148), -('CL', 'CHILE', 'Chile', 'CHL', 152), -('CN', 'CHINA', 'China', 'CHN', 156), -('CX', 'CHRISTMAS ISLAND', 'Christmas Island', NULL, NULL), -('CC', 'COCOS (KEELING) ISLANDS', 'Cocos (Keeling) Islands', NULL, NULL), -('CO', 'COLOMBIA', 'Colombia', 'COL', 170), -('KM', 'COMOROS', 'Comoros', 'COM', 174), -('CG', 'CONGO', 'Congo', 'COG', 178), -('CD', 'CONGO, THE DEMOCRATIC REPUBLIC OF THE', 'Congo, the Democratic Republic of the', 'COD', 180), -('CK', 'COOK ISLANDS', 'Cook Islands', 'COK', 184), -('CR', 'COSTA RICA', 'Costa Rica', 'CRI', 188), -('CI', 'COTE D''IVOIRE', 'Cote D''Ivoire', 'CIV', 384), -('HR', 'CROATIA', 'Croatia', 'HRV', 191), -('CU', 'CUBA', 'Cuba', 'CUB', 192), -('CY', 'CYPRUS', 'Cyprus', 'CYP', 196), -('CZ', 'CZECH REPUBLIC', 'Czech Republic', 'CZE', 203), -('DK', 'DENMARK', 'Denmark', 'DNK', 208), -('DJ', 'DJIBOUTI', 'Djibouti', 'DJI', 262), -('DM', 'DOMINICA', 'Dominica', 'DMA', 212), -('DO', 'DOMINICAN REPUBLIC', 'Dominican Republic', 'DOM', 214), -('EC', 'ECUADOR', 'Ecuador', 'ECU', 218), -('EG', 'EGYPT', 'Egypt', 'EGY', 818), -('SV', 'EL SALVADOR', 'El Salvador', 'SLV', 222), -('GQ', 'EQUATORIAL GUINEA', 'Equatorial Guinea', 'GNQ', 226), -('ER', 'ERITREA', 'Eritrea', 'ERI', 232), -('EE', 'ESTONIA', 'Estonia', 'EST', 233), -('ET', 'ETHIOPIA', 'Ethiopia', 'ETH', 231), -('FK', 'FALKLAND ISLANDS (MALVINAS)', 'Falkland Islands (Malvinas)', 'FLK', 238), -('FO', 'FAROE ISLANDS', 'Faroe Islands', 'FRO', 234), -('FJ', 'FIJI', 'Fiji', 'FJI', 242), -('FI', 'FINLAND', 'Finland', 'FIN', 246), -('FR', 'FRANCE', 'France', 'FRA', 250), -('GF', 'FRENCH GUIANA', 'French Guiana', 'GUF', 254), -('PF', 'FRENCH POLYNESIA', 'French Polynesia', 'PYF', 258), -('TF', 'FRENCH SOUTHERN TERRITORIES', 'French Southern Territories', NULL, NULL), -('GA', 'GABON', 'Gabon', 'GAB', 266), -('GM', 'GAMBIA', 'Gambia', 'GMB', 270), -('GE', 'GEORGIA', 'Georgia', 'GEO', 268), -('DE', 'GERMANY', 'Germany', 'DEU', 276), -('GH', 'GHANA', 'Ghana', 'GHA', 288), -('GI', 'GIBRALTAR', 'Gibraltar', 'GIB', 292), -('GR', 'GREECE', 'Greece', 'GRC', 300), -('GL', 'GREENLAND', 'Greenland', 'GRL', 304), -('GD', 'GRENADA', 'Grenada', 'GRD', 308), -('GP', 'GUADELOUPE', 'Guadeloupe', 'GLP', 312), -('GU', 'GUAM', 'Guam', 'GUM', 316), -('GT', 'GUATEMALA', 'Guatemala', 'GTM', 320), -('GN', 'GUINEA', 'Guinea', 'GIN', 324), -('GW', 'GUINEA-BISSAU', 'Guinea-Bissau', 'GNB', 624), -('GY', 'GUYANA', 'Guyana', 'GUY', 328), -('HT', 'HAITI', 'Haiti', 'HTI', 332), -('HM', 'HEARD ISLAND AND MCDONALD ISLANDS', 'Heard Island and Mcdonald Islands', NULL, NULL), -('VA', 'HOLY SEE (VATICAN CITY STATE)', 'Holy See (Vatican City State)', 'VAT', 336), -('HN', 'HONDURAS', 'Honduras', 'HND', 340), -('HK', 'HONG KONG', 'Hong Kong', 'HKG', 344), -('HU', 'HUNGARY', 'Hungary', 'HUN', 348), -('IS', 'ICELAND', 'Iceland', 'ISL', 352), -('IN', 'INDIA', 'India', 'IND', 356), -('ID', 'INDONESIA', 'Indonesia', 'IDN', 360), -('IR', 'IRAN, ISLAMIC REPUBLIC OF', 'Iran, Islamic Republic of', 'IRN', 364), -('IQ', 'IRAQ', 'Iraq', 'IRQ', 368), -('IE', 'IRELAND', 'Ireland', 'IRL', 372), -('IL', 'ISRAEL', 'Israel', 'ISR', 376), -('IT', 'ITALY', 'Italy', 'ITA', 380), -('JM', 'JAMAICA', 'Jamaica', 'JAM', 388), -('JP', 'JAPAN', 'Japan', 'JPN', 392), -('JO', 'JORDAN', 'Jordan', 'JOR', 400), -('KZ', 'KAZAKHSTAN', 'Kazakhstan', 'KAZ', 398), -('KE', 'KENYA', 'Kenya', 'KEN', 404), -('KI', 'KIRIBATI', 'Kiribati', 'KIR', 296), -('KP', 'KOREA, DEMOCRATIC PEOPLE''S REPUBLIC OF', 'Korea, Democratic People''s Republic of', 'PRK', 408), -('KR', 'KOREA, REPUBLIC OF', 'Korea, Republic of', 'KOR', 410), -('KW', 'KUWAIT', 'Kuwait', 'KWT', 414), -('KG', 'KYRGYZSTAN', 'Kyrgyzstan', 'KGZ', 417), -('LA', 'LAO PEOPLE''S DEMOCRATIC REPUBLIC', 'Lao People''s Democratic Republic', 'LAO', 418), -('LV', 'LATVIA', 'Latvia', 'LVA', 428), -('LB', 'LEBANON', 'Lebanon', 'LBN', 422), -('LS', 'LESOTHO', 'Lesotho', 'LSO', 426), -('LR', 'LIBERIA', 'Liberia', 'LBR', 430), -('LY', 'LIBYAN ARAB JAMAHIRIYA', 'Libyan Arab Jamahiriya', 'LBY', 434), -('LI', 'LIECHTENSTEIN', 'Liechtenstein', 'LIE', 438), -('LT', 'LITHUANIA', 'Lithuania', 'LTU', 440), -('LU', 'LUXEMBOURG', 'Luxembourg', 'LUX', 442), -('MO', 'MACAO', 'Macao', 'MAC', 446), -('MK', 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF', 'Macedonia, the Former Yugoslav Republic of', 'MKD', 807), -('MG', 'MADAGASCAR', 'Madagascar', 'MDG', 450), -('MW', 'MALAWI', 'Malawi', 'MWI', 454), -('MY', 'MALAYSIA', 'Malaysia', 'MYS', 458), -('MV', 'MALDIVES', 'Maldives', 'MDV', 462), -('ML', 'MALI', 'Mali', 'MLI', 466), -('MT', 'MALTA', 'Malta', 'MLT', 470), -('MH', 'MARSHALL ISLANDS', 'Marshall Islands', 'MHL', 584), -('MQ', 'MARTINIQUE', 'Martinique', 'MTQ', 474), -('MR', 'MAURITANIA', 'Mauritania', 'MRT', 478), -('MU', 'MAURITIUS', 'Mauritius', 'MUS', 480), -('YT', 'MAYOTTE', 'Mayotte', NULL, NULL), -('MX', 'MEXICO', 'Mexico', 'MEX', 484), -('FM', 'MICRONESIA, FEDERATED STATES OF', 'Micronesia, Federated States of', 'FSM', 583), -('MD', 'MOLDOVA, REPUBLIC OF', 'Moldova, Republic of', 'MDA', 498), -('MC', 'MONACO', 'Monaco', 'MCO', 492), -('MN', 'MONGOLIA', 'Mongolia', 'MNG', 496), -('MS', 'MONTSERRAT', 'Montserrat', 'MSR', 500), -('MA', 'MOROCCO', 'Morocco', 'MAR', 504), -('MZ', 'MOZAMBIQUE', 'Mozambique', 'MOZ', 508), -('MM', 'MYANMAR', 'Myanmar', 'MMR', 104), -('NA', 'NAMIBIA', 'Namibia', 'NAM', 516), -('NR', 'NAURU', 'Nauru', 'NRU', 520), -('NP', 'NEPAL', 'Nepal', 'NPL', 524), -('NL', 'NETHERLANDS', 'Netherlands', 'NLD', 528), -('AN', 'NETHERLANDS ANTILLES', 'Netherlands Antilles', 'ANT', 530), -('NC', 'NEW CALEDONIA', 'New Caledonia', 'NCL', 540), -('NZ', 'NEW ZEALAND', 'New Zealand', 'NZL', 554), -('NI', 'NICARAGUA', 'Nicaragua', 'NIC', 558), -('NE', 'NIGER', 'Niger', 'NER', 562), -('NG', 'NIGERIA', 'Nigeria', 'NGA', 566), -('NU', 'NIUE', 'Niue', 'NIU', 570), -('NF', 'NORFOLK ISLAND', 'Norfolk Island', 'NFK', 574), -('MP', 'NORTHERN MARIANA ISLANDS', 'Northern Mariana Islands', 'MNP', 580), -('NO', 'NORWAY', 'Norway', 'NOR', 578), -('OM', 'OMAN', 'Oman', 'OMN', 512), -('PK', 'PAKISTAN', 'Pakistan', 'PAK', 586), -('PW', 'PALAU', 'Palau', 'PLW', 585), -('PS', 'PALESTINIAN TERRITORY, OCCUPIED', 'Palestinian Territory, Occupied', NULL, NULL), -('PA', 'PANAMA', 'Panama', 'PAN', 591), -('PG', 'PAPUA NEW GUINEA', 'Papua New Guinea', 'PNG', 598), -('PY', 'PARAGUAY', 'Paraguay', 'PRY', 600), -('PE', 'PERU', 'Peru', 'PER', 604), -('PH', 'PHILIPPINES', 'Philippines', 'PHL', 608), -('PN', 'PITCAIRN', 'Pitcairn', 'PCN', 612), -('PL', 'POLAND', 'Poland', 'POL', 616), -('PT', 'PORTUGAL', 'Portugal', 'PRT', 620), -('PR', 'PUERTO RICO', 'Puerto Rico', 'PRI', 630), -('QA', 'QATAR', 'Qatar', 'QAT', 634), -('RE', 'REUNION', 'Reunion', 'REU', 638), -('RO', 'ROMANIA', 'Romania', 'ROM', 642), -('RU', 'RUSSIAN FEDERATION', 'Russian Federation', 'RUS', 643), -('RW', 'RWANDA', 'Rwanda', 'RWA', 646), -('SH', 'SAINT HELENA', 'Saint Helena', 'SHN', 654), -('KN', 'SAINT KITTS AND NEVIS', 'Saint Kitts and Nevis', 'KNA', 659), -('LC', 'SAINT LUCIA', 'Saint Lucia', 'LCA', 662), -('PM', 'SAINT PIERRE AND MIQUELON', 'Saint Pierre and Miquelon', 'SPM', 666), -('VC', 'SAINT VINCENT AND THE GRENADINES', 'Saint Vincent and the Grenadines', 'VCT', 670), -('WS', 'SAMOA', 'Samoa', 'WSM', 882), -('SM', 'SAN MARINO', 'San Marino', 'SMR', 674), -('ST', 'SAO TOME AND PRINCIPE', 'Sao Tome and Principe', 'STP', 678), -('SA', 'SAUDI ARABIA', 'Saudi Arabia', 'SAU', 682), -('SN', 'SENEGAL', 'Senegal', 'SEN', 686), -('CS', 'SERBIA AND MONTENEGRO', 'Serbia and Montenegro', NULL, NULL), -('SC', 'SEYCHELLES', 'Seychelles', 'SYC', 690), -('SL', 'SIERRA LEONE', 'Sierra Leone', 'SLE', 694), -('SG', 'SINGAPORE', 'Singapore', 'SGP', 702), -('SK', 'SLOVAKIA', 'Slovakia', 'SVK', 703), -('SI', 'SLOVENIA', 'Slovenia', 'SVN', 705), -('SB', 'SOLOMON ISLANDS', 'Solomon Islands', 'SLB', 90), -('SO', 'SOMALIA', 'Somalia', 'SOM', 706), -('ZA', 'SOUTH AFRICA', 'South Africa', 'ZAF', 710), -('GS', 'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS', 'South Georgia and the South Sandwich Islands', NULL, NULL), -('ES', 'SPAIN', 'Spain', 'ESP', 724), -('LK', 'SRI LANKA', 'Sri Lanka', 'LKA', 144), -('SD', 'SUDAN', 'Sudan', 'SDN', 736), -('SR', 'SURINAME', 'Suriname', 'SUR', 740), -('SJ', 'SVALBARD AND JAN MAYEN', 'Svalbard and Jan Mayen', 'SJM', 744), -('SZ', 'SWAZILAND', 'Swaziland', 'SWZ', 748), -('SE', 'SWEDEN', 'Sweden', 'SWE', 752), -('CH', 'SWITZERLAND', 'Switzerland', 'CHE', 756), -('SY', 'SYRIAN ARAB REPUBLIC', 'Syrian Arab Republic', 'SYR', 760), -('TW', 'TAIWAN, PROVINCE OF CHINA', 'Taiwan, Province of China', 'TWN', 158), -('TJ', 'TAJIKISTAN', 'Tajikistan', 'TJK', 762), -('TZ', 'TANZANIA, UNITED REPUBLIC OF', 'Tanzania, United Republic of', 'TZA', 834), -('TH', 'THAILAND', 'Thailand', 'THA', 764), -('TL', 'TIMOR-LESTE', 'Timor-Leste', NULL, NULL), -('TG', 'TOGO', 'Togo', 'TGO', 768), -('TK', 'TOKELAU', 'Tokelau', 'TKL', 772), -('TO', 'TONGA', 'Tonga', 'TON', 776), -('TT', 'TRINIDAD AND TOBAGO', 'Trinidad and Tobago', 'TTO', 780), -('TN', 'TUNISIA', 'Tunisia', 'TUN', 788), -('TR', 'TURKEY', 'Turkey', 'TUR', 792), -('TM', 'TURKMENISTAN', 'Turkmenistan', 'TKM', 795), -('TC', 'TURKS AND CAICOS ISLANDS', 'Turks and Caicos Islands', 'TCA', 796), -('TV', 'TUVALU', 'Tuvalu', 'TUV', 798), -('UG', 'UGANDA', 'Uganda', 'UGA', 800), -('UA', 'UKRAINE', 'Ukraine', 'UKR', 804), -('AE', 'UNITED ARAB EMIRATES', 'United Arab Emirates', 'ARE', 784), -('GB', 'UNITED KINGDOM', 'United Kingdom', 'GBR', 826), -('US', 'UNITED STATES', 'United States', 'USA', 840), -('UM', 'UNITED STATES MINOR OUTLYING ISLANDS', 'United States Minor Outlying Islands', NULL, NULL), -('UY', 'URUGUAY', 'Uruguay', 'URY', 858), -('UZ', 'UZBEKISTAN', 'Uzbekistan', 'UZB', 860), -('VU', 'VANUATU', 'Vanuatu', 'VUT', 548), -('VE', 'VENEZUELA', 'Venezuela', 'VEN', 862), -('VN', 'VIET NAM', 'Viet Nam', 'VNM', 704), -('VG', 'VIRGIN ISLANDS, BRITISH', 'Virgin Islands, British', 'VGB', 92), -('VI', 'VIRGIN ISLANDS, U.S.', 'Virgin Islands, U.s.', 'VIR', 850), -('WF', 'WALLIS AND FUTUNA', 'Wallis and Futuna', 'WLF', 876), -('EH', 'WESTERN SAHARA', 'Western Sahara', 'ESH', 732), -('YE', 'YEMEN', 'Yemen', 'YEM', 887), -('ZM', 'ZAMBIA', 'Zambia', 'ZMB', 894), -('ZW', 'ZIMBABWE', 'Zimbabwe', 'ZWE', 716); - --- -------------------------------------------------------- --- tables for the FAQ module - -CREATE TABLE `help_faq_sections` ( - `hfs_id` int(11) NOT NULL AUTO_INCREMENT, - `hfs_name` varchar(255) DEFAULT NULL, - `hfs_order` int(11) DEFAULT '0', - `sys_userid` int(11) DEFAULT NULL, - `sys_groupid` int(11) DEFAULT NULL, - `sys_perm_user` varchar(5) DEFAULT NULL, - `sys_perm_group` varchar(5) DEFAULT NULL, - `sys_perm_other` varchar(5) DEFAULT NULL, - PRIMARY KEY (`hfs_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - -INSERT INTO `help_faq_sections` VALUES (1,'General',0,NULL,NULL,NULL,NULL,NULL); - -CREATE TABLE `help_faq` ( - `hf_id` int(11) NOT NULL AUTO_INCREMENT, - `hf_section` int(11) DEFAULT NULL, - `hf_order` int(11) DEFAULT '0', - `hf_question` text, - `hf_answer` text, - `sys_userid` int(11) DEFAULT NULL, - `sys_groupid` int(11) DEFAULT NULL, - `sys_perm_user` varchar(5) DEFAULT NULL, - `sys_perm_group` varchar(5) DEFAULT NULL, - `sys_perm_other` varchar(5) DEFAULT NULL, - PRIMARY KEY (`hf_id`) -) ENGINE=MyISAM AUTO_INCREMENT=1; - -INSERT INTO `help_faq` VALUES (1,1,0,'I\'d like to know ...','Yes, of course.',1,1,'riud','riud','r'); - -ALTER TABLE client ADD COLUMN company_id varchar(30); - --- -------------------------------------------------------- - -SET FOREIGN_KEY_CHECKS = 1; + +/* +Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of ISPConfig nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +-- +-- ISPConfig 3 +-- DB-Version: 3.0.0.9 +-- + +SET FOREIGN_KEY_CHECKS = 0; + +-- -------------------------------------------------------- +-- -------------------------------------------------------- +-- DB-STRUCTURE +-- -------------------------------------------------------- +-- -------------------------------------------------------- + +-- +-- Table structure for table `client` +-- + +CREATE TABLE `client` ( + `client_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `company_name` varchar(64) default NULL, + `contact_name` varchar(64) default NULL, + `customer_no` varchar(64) default NULL, + `vat_id` varchar(64) default NULL, + `street` varchar(255) default NULL, + `zip` varchar(32) default NULL, + `city` varchar(64) default NULL, + `state` varchar(32) default NULL, + `country` char(2) default NULL, + `telephone` varchar(32) default NULL, + `mobile` varchar(32) default NULL, + `fax` varchar(32) default NULL, + `email` varchar(255) default NULL, + `internet` varchar(255) NOT NULL, + `icq` varchar(16) default NULL, + `notes` text, + `default_mailserver` int(11) unsigned NOT NULL default '1', + `limit_maildomain` int(11) NOT NULL default '-1', + `limit_mailbox` int(11) NOT NULL default '-1', + `limit_mailalias` int(11) NOT NULL default '-1', + `limit_mailaliasdomain` int(11) NOT NULL default '-1', + `limit_mailforward` int(11) NOT NULL default '-1', + `limit_mailcatchall` int(11) NOT NULL default '-1', + `limit_mailrouting` int(11) NOT NULL default '0', + `limit_mailfilter` int(11) NOT NULL default '-1', + `limit_fetchmail` int(11) NOT NULL default '-1', + `limit_mailquota` int(11) NOT NULL default '-1', + `limit_spamfilter_wblist` int(11) NOT NULL default '0', + `limit_spamfilter_user` int(11) NOT NULL default '0', + `limit_spamfilter_policy` int(11) NOT NULL default '0', + `default_webserver` int(11) unsigned NOT NULL default '1', + `limit_web_ip` text, + `limit_web_domain` int(11) NOT NULL default '-1', + `limit_web_quota` int(11) NOT NULL default '-1', + `web_php_options` varchar(255) NOT NULL default 'no,fast-cgi,cgi,mod,suphp', + `limit_web_subdomain` int(11) NOT NULL default '-1', + `limit_web_aliasdomain` int(11) NOT NULL default '-1', + `limit_ftp_user` int(11) NOT NULL default '-1', + `limit_shell_user` int(11) NOT NULL default '0', + `ssh_chroot` varchar(255) NOT NULL DEFAULT 'no,jailkit,ssh-chroot', + `limit_webdav_user` int(11) NOT NULL default '0', + `default_dnsserver` int(11) unsigned NOT NULL default '1', + `limit_dns_zone` int(11) NOT NULL default '-1', + `limit_dns_slave_zone` int(11) NOT NULL default '-1', + `limit_dns_record` int(11) NOT NULL default '-1', + `default_dbserver` int(11) NOT NULL default '1', + `limit_database` int(11) NOT NULL default '-1', + `limit_cron` int(11) NOT NULL default '0', + `limit_cron_type` enum('url','chrooted','full') NOT NULL default 'url', + `limit_cron_frequency` int(11) NOT NULL default '5', + `limit_traffic_quota` int(11) NOT NULL default '-1', + `limit_client` int(11) NOT NULL default '0', + `limit_mailmailinglist` int(11) NOT NULL default '-1', + `parent_client_id` int(11) unsigned NOT NULL default '0', + `username` varchar(64) default NULL, + `password` varchar(64) default NULL, + `language` char(2) NOT NULL default 'en', + `usertheme` varchar(32) NOT NULL default 'default', + `template_master` int(11) unsigned NOT NULL default '0', + `template_additional` varchar(255) NOT NULL default '', + `created_at` bigint(20) DEFAULT NULL, + PRIMARY KEY (`client_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `client_template` +-- + +CREATE TABLE `client_template` ( + `template_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `template_name` varchar(64) NOT NULL, + `template_type` varchar(1) NOT NULL default 'm', + `limit_maildomain` int(11) NOT NULL default '-1', + `limit_mailbox` int(11) NOT NULL default '-1', + `limit_mailalias` int(11) NOT NULL default '-1', + `limit_mailaliasdomain` int(11) NOT NULL default '-1', + `limit_mailforward` int(11) NOT NULL default '-1', + `limit_mailcatchall` int(11) NOT NULL default '-1', + `limit_mailrouting` int(11) NOT NULL default '0', + `limit_mailfilter` int(11) NOT NULL default '-1', + `limit_fetchmail` int(11) NOT NULL default '-1', + `limit_mailquota` int(11) NOT NULL default '-1', + `limit_spamfilter_wblist` int(11) NOT NULL default '0', + `limit_spamfilter_user` int(11) NOT NULL default '0', + `limit_spamfilter_policy` int(11) NOT NULL default '0', + `limit_web_ip` text, + `limit_web_domain` int(11) NOT NULL default '-1', + `limit_web_quota` int(11) NOT NULL default '-1', + `limit_web_subdomain` int(11) NOT NULL default '-1', + `limit_web_aliasdomain` int(11) NOT NULL default '-1', + `limit_ftp_user` int(11) NOT NULL default '-1', + `limit_shell_user` int(11) NOT NULL default '0', + `limit_webdav_user` int(11) NOT NULL default '0', + `limit_dns_zone` int(11) NOT NULL default '-1', + `limit_dns_slave_zone` int(11) NOT NULL default '-1', + `limit_dns_record` int(11) NOT NULL default '-1', + `limit_database` int(11) NOT NULL default '-1', + `limit_cron` int(11) NOT NULL default '0', + `limit_cron_type` enum('url','chrooted','full') NOT NULL default 'url', + `limit_cron_frequency` int(11) NOT NULL default '5', + `limit_traffic_quota` int(11) NOT NULL default '-1', + `limit_client` int(11) NOT NULL default '0', + `limit_mailmailinglist` int(11) NOT NULL default '-1', + PRIMARY KEY (`template_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `cron` +-- +CREATE TABLE `cron` ( + `id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NULL default NULL, + `sys_perm_group` varchar(5) NULL default NULL, + `sys_perm_other` varchar(5) NULL default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `parent_domain_id` int(11) unsigned NOT NULL default '0', + `type` enum('url','chrooted','full') NOT NULL default 'url', + `command` varchar(255) NOT NULL, + `run_min` varchar(100) NULL, + `run_hour` varchar(100) NULL, + `run_mday` varchar(100) NULL, + `run_month` varchar(100) NULL, + `run_wday` varchar(100) NULL, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `dns_rr` +-- + +CREATE TABLE `dns_rr` ( + `id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL, + `sys_groupid` int(11) unsigned NOT NULL, + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `server_id` int(11) NOT NULL default '1', + `zone` int(11) unsigned NOT NULL, + `name` varchar(64) NOT NULL, + `type` enum('A','AAAA','ALIAS','CNAME','HINFO','MX','NAPTR','NS','PTR','RP','SRV','TXT') default NULL, + `data` varchar(255) NOT NULL, + `aux` int(11) unsigned NOT NULL default '0', + `ttl` int(11) unsigned NOT NULL default '86400', + `active` enum('N','Y') NOT NULL default 'Y', + `stamp` timestamp NOT NULL default CURRENT_TIMESTAMP, + `serial` int(10) unsigned default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `rr` (`zone`,`name`,`type`,`data`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `dns_soa` +-- + +CREATE TABLE `dns_soa` ( + `id` int(10) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL, + `sys_groupid` int(11) unsigned NOT NULL, + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `server_id` int(11) NOT NULL default '1', + `origin` varchar(255) NOT NULL, + `ns` varchar(255) NOT NULL, + `mbox` varchar(255) NOT NULL, + `serial` int(11) unsigned NOT NULL default '1', + `refresh` int(11) unsigned NOT NULL default '28800', + `retry` int(11) unsigned NOT NULL default '7200', + `expire` int(11) unsigned NOT NULL default '604800', + `minimum` int(11) unsigned NOT NULL default '86400', + `ttl` int(11) unsigned NOT NULL default '86400', + `active` enum('N','Y') NOT NULL, + `xfer` varchar(255) NOT NULL, + `also_notify` varchar(255) default NULL, + `update_acl` varchar(255) default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `origin` (`origin`), + KEY `active` (`active`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `dns_slave` +-- + +CREATE TABLE `dns_slave` ( + `id` int(10) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL, + `sys_groupid` int(11) unsigned NOT NULL, + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `server_id` int(11) NOT NULL default '1', + `origin` varchar(255) NOT NULL, + `ns` varchar(255) NOT NULL, + `active` enum('N','Y') NOT NULL, + `xfer` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `origin` (`origin`), + KEY `active` (`active`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `dns_template` +-- + +CREATE TABLE `dns_template` ( + `template_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `name` varchar(64) default NULL, + `fields` varchar(255) default NULL, + `template` text, + `visible` enum('N','Y') NOT NULL default 'Y', + PRIMARY KEY (`template_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- +-- Tabellenstruktur für Tabelle `domain` +-- + +CREATE TABLE `domain` ( + `domain_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `domain` varchar(255) NOT NULL default '', + PRIMARY KEY (`domain_id`), + UNIQUE KEY `domain` (`domain`) +) ENGINE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `firewall` +-- + +CREATE TABLE `firewall` ( + `firewall_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `tcp_port` varchar(255) default NULL, + `udp_port` varchar(255) default NULL, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`firewall_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ftp_user` +-- + +CREATE TABLE `ftp_user` ( + `ftp_user_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `parent_domain_id` int(11) unsigned NOT NULL default '0', + `username` varchar(64) default NULL, + `password` varchar(64) default NULL, + `quota_size` bigint(20) NOT NULL default '-1', + `active` enum('n','y') NOT NULL default 'y', + `uid` varchar(64) default NULL, + `gid` varchar(64) default NULL, + `dir` varchar(255) default NULL, + `quota_files` bigint(20) NOT NULL default '-1', + `ul_ratio` int(11) NOT NULL default '-1', + `dl_ratio` int(11) NOT NULL default '-1', + `ul_bandwidth` int(11) NOT NULL default '-1', + `dl_bandwidth` int(11) NOT NULL default '-1', + PRIMARY KEY (`ftp_user_id`), + KEY `active` (`active`), + KEY `server_id` (`server_id`), + KEY `username` (`username`), + KEY `quota_files` (`quota_files`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_access` +-- + +CREATE TABLE `mail_access` ( + `access_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) NOT NULL default '0', + `source` varchar(255) NOT NULL, + `access` varchar(255) NOT NULL, + `type` set('recipient','sender','client') NOT NULL, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`access_id`), + KEY `server_id` (`server_id`,`source`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_content_filter` +-- + +CREATE TABLE `mail_content_filter` ( + `content_filter_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) NOT NULL default '0', + `type` varchar(255) default NULL, + `pattern` varchar(255) default NULL, + `data` varchar(255) default NULL, + `action` varchar(255) default NULL, + `active` varchar(255) NOT NULL default 'y', + PRIMARY KEY (`content_filter_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_domain` +-- + +CREATE TABLE `mail_domain` ( + `domain_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `domain` varchar(255) NOT NULL default '', + `active` enum('n','y') NOT NULL, + PRIMARY KEY (`domain_id`), + KEY `server_id` (`server_id`,`domain`), + KEY `domain_active` (`domain`,`active`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_forwarding` +-- + +CREATE TABLE `mail_forwarding` ( + `forwarding_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `source` varchar(255) NOT NULL, + `destination` text, + `type` enum('alias','aliasdomain','forward','catchall') NOT NULL default 'alias', + `active` enum('n','y') NOT NULL, + PRIMARY KEY (`forwarding_id`), + KEY `server_id` (`server_id`,`source`), + KEY `type` (`type`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_get` +-- + +CREATE TABLE `mail_get` ( + `mailget_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `type` varchar(255) default NULL, + `source_server` varchar(255) default NULL, + `source_username` varchar(255) default NULL, + `source_password` varchar(64) default NULL, + `source_delete` varchar(255) NOT NULL default 'y', + `destination` varchar(255) default NULL, + `active` varchar(255) NOT NULL default 'y', + PRIMARY KEY (`mailget_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_greylist` +-- + +CREATE TABLE `mail_greylist` ( + `greylist_id` int(11) unsigned NOT NULL auto_increment, + `relay_ip` varchar(39) default NULL, + `from_domain` varchar(255) default NULL, + `block_expires` datetime NOT NULL default '0000-00-00 00:00:00', + `record_expires` datetime NOT NULL default '0000-00-00 00:00:00', + `origin_type` enum('MANUAL','AUTO') NOT NULL default 'AUTO', + `create_time` datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`greylist_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `mail_mailinglist` +-- + +CREATE TABLE `mail_mailinglist` ( + `mailinglist_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `domain` varchar(255) NOT NULL, + `listname` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + PRIMARY KEY (`mailinglist_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for Table `mail_relay_recipient` +-- + +CREATE TABLE IF NOT EXISTS `mail_relay_recipient` ( + `relay_recipient_id` bigint(20) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `server_id` int(11) NOT NULL DEFAULT '0', + `source` varchar(255) DEFAULT NULL, + `access` varchar(255) NOT NULL DEFAULT 'OK', + `active` varchar(255) NOT NULL DEFAULT 'y', + PRIMARY KEY (`relay_recipient_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1 ; + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_traffic` +-- + +CREATE TABLE `mail_traffic` ( + `traffic_id` int(11) unsigned NOT NULL auto_increment, + `mailuser_id` int(11) unsigned NOT NULL, + `month` char(7) NOT NULL, + `traffic` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`traffic_id`), + KEY `mailuser_id` (`mailuser_id`,`month`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_transport` +-- + +CREATE TABLE `mail_transport` ( + `transport_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `domain` varchar(255) NOT NULL default '', + `transport` varchar(255) NOT NULL, + `sort_order` int(11) unsigned NOT NULL default '5', + `active` enum('n','y') NOT NULL, + PRIMARY KEY (`transport_id`), + KEY `server_id` (`server_id`,`transport`), + KEY `server_id_2` (`server_id`,`domain`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_user` +-- + +CREATE TABLE `mail_user` ( + `mailuser_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `email` varchar(255) NOT NULL default '', + `password` varchar(255) NOT NULL, + `name` varchar(255) NOT NULL default '', + `uid` int(11) unsigned NOT NULL default '5000', + `gid` int(11) unsigned NOT NULL default '5000', + `maildir` varchar(255) NOT NULL default '', + `quota` bigint(20) NOT NULL default '-1', + `cc` varchar(255) NOT NULL default '', + `homedir` varchar(255) NOT NULL, + `autoresponder` enum('n','y') NOT NULL default 'n', + `autoresponder_start_date` datetime NOT NULL default '0000-00-00 00:00:00', + `autoresponder_end_date` datetime NOT NULL default '0000-00-00 00:00:00', + `autoresponder_text` mediumtext NULL, + `move_junk` enum('n','y') NOT NULL default 'n', + `custom_mailfilter` mediumtext, + `postfix` enum('n','y') NOT NULL, + `access` enum('n','y') NOT NULL, + `disableimap` enum('n','y') NOT NULL default 'n', + `disablepop3` enum('n','y') NOT NULL default 'n', + `disabledeliver` enum('n','y') NOT NULL default 'n', + `disablesmtp` enum('n','y') NOT NULL default 'n', + PRIMARY KEY (`mailuser_id`), + KEY `server_id` (`server_id`,`email`), + KEY `email_access` (`email`,`access`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_user_filter` +-- + +CREATE TABLE `mail_user_filter` ( + `filter_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `mailuser_id` int(11) unsigned NOT NULL default '0', + `rulename` varchar(64) default NULL, + `source` varchar(255) default NULL, + `searchterm` varchar(255) default NULL, + `op` varchar(255) default NULL, + `action` varchar(255) default NULL, + `target` varchar(255) default NULL, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`filter_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `remote_session` +-- + +CREATE TABLE `remote_session` ( + `remote_session` varchar(64) NOT NULL, + `remote_userid` int(11) unsigned NOT NULL, + `remote_functions` text NOT NULL, + `tstamp` int(10) unsigned NOT NULL, + PRIMARY KEY (`remote_session`) +) ENGINE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `remote_user` +-- + +CREATE TABLE `remote_user` ( + `remote_userid` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `remote_username` varchar(64) NOT NULL, + `remote_password` varchar(64) NOT NULL, + `remote_functions` text NOT NULL, + PRIMARY KEY (`remote_userid`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `server` +-- + +CREATE TABLE `server` ( + `server_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_name` varchar(255) NOT NULL default '', + `mail_server` tinyint(1) NOT NULL default '0', + `web_server` tinyint(1) NOT NULL default '0', + `dns_server` tinyint(1) NOT NULL default '0', + `file_server` tinyint(1) NOT NULL default '0', + `db_server` tinyint(1) NOT NULL default '0', + `vserver_server` tinyint(1) NOT NULL default '0', + `config` text NOT NULL, + `updated` bigint(20) unsigned NOT NULL default '0', + `mirror_server_id` int(11) unsigned NOT NULL default '0', + `dbversion` int(11) unsigned NOT NULL default '1', + `active` tinyint(1) NOT NULL default '1', + PRIMARY KEY (`server_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `server_ip` +-- + +CREATE TABLE `server_ip` ( + `server_ip_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `ip_address` varchar(39) default NULL, + `virtualhost` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`server_ip_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +CREATE TABLE `shell_user` ( + `shell_user_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `parent_domain_id` int(11) unsigned NOT NULL default '0', + `username` varchar(64) default NULL, + `password` varchar(64) default NULL, + `quota_size` bigint(20) NOT NULL default '-1', + `active` enum('n','y') NOT NULL default 'y', + `puser` varchar(255) default NULL, + `pgroup` varchar(255) default NULL, + `shell` varchar(255) NOT NULL default '/bin/bash', + `dir` varchar(255) default NULL, + `chroot` varchar(255) NOT NULL, + PRIMARY KEY (`shell_user_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `software_package` +-- + +CREATE TABLE `software_package` ( + `package_id` int(11) unsigned NOT NULL auto_increment, + `software_repo_id` int(11) unsigned NOT NULL, + `package_name` varchar(64) NOT NULL, + `package_title` varchar(64) NOT NULL, + `package_description` text, + `package_version` varchar(8) default NULL, + `package_type` enum('ispconfig','app','web') NOT NULL default 'app', + `package_installable` enum('yes','no','key') NOT NULL default 'yes', + `package_requires_db` enum('no','mysql') NOT NULL default 'no', + `package_remote_functions` text, + `package_key` varchar(255) NOT NULL, + `package_config` text, + PRIMARY KEY (`package_id`), + UNIQUE KEY `package_name` (`package_name`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `software_repo` +-- + +CREATE TABLE `software_repo` ( + `software_repo_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `repo_name` varchar(64) default NULL, + `repo_url` varchar(255) default NULL, + `repo_username` varchar(64) default NULL, + `repo_password` varchar(64) default NULL, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`software_repo_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `software_update` +-- + +CREATE TABLE `software_update` ( + `software_update_id` int(11) unsigned NOT NULL auto_increment, + `software_repo_id` int(11) unsigned NOT NULL, + `package_name` varchar(64) NOT NULL, + `update_url` varchar(255) NOT NULL, + `update_md5` varchar(255) NOT NULL, + `update_dependencies` varchar(255) NOT NULL, + `update_title` varchar(64) NOT NULL, + `v1` tinyint(1) NOT NULL default '0', + `v2` tinyint(1) NOT NULL default '0', + `v3` tinyint(1) NOT NULL default '0', + `v4` tinyint(1) NOT NULL default '0', + `type` enum('full','update') NOT NULL default 'full', + PRIMARY KEY (`software_update_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `software_update_inst` +-- + +CREATE TABLE `software_update_inst` ( + `software_update_inst_id` int(11) unsigned NOT NULL auto_increment, + `software_update_id` int(11) unsigned NOT NULL default '0', + `package_name` varchar(64) NOT NULL, + `server_id` int(11) unsigned NOT NULL, + `status` enum('none','installing','installed','deleting','deleted','failed') NOT NULL default 'none', + PRIMARY KEY (`software_update_inst_id`), + UNIQUE KEY `software_update_id` (`software_update_id`,`package_name`,`server_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `spamfilter_policy` +-- + +CREATE TABLE `spamfilter_policy` ( + `id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL, + `sys_groupid` int(11) unsigned NOT NULL, + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `policy_name` varchar(64) default NULL, + `virus_lover` enum('N','Y') default NULL, + `spam_lover` enum('N','Y') default NULL, + `banned_files_lover` enum('N','Y') default NULL, + `bad_header_lover` enum('N','Y') default NULL, + `bypass_virus_checks` enum('N','Y') default NULL, + `bypass_spam_checks` enum('N','Y') default NULL, + `bypass_banned_checks` enum('N','Y') default NULL, + `bypass_header_checks` enum('N','Y') default NULL, + `spam_modifies_subj` enum('N','Y') default NULL, + `virus_quarantine_to` varchar(255) default NULL, + `spam_quarantine_to` varchar(255) default NULL, + `banned_quarantine_to` varchar(255) default NULL, + `bad_header_quarantine_to` varchar(255) default NULL, + `clean_quarantine_to` varchar(255) default NULL, + `other_quarantine_to` varchar(255) default NULL, + `spam_tag_level` float default NULL, + `spam_tag2_level` float default NULL, + `spam_kill_level` float default NULL, + `spam_dsn_cutoff_level` float default NULL, + `spam_quarantine_cutoff_level` float default NULL, + `addr_extension_virus` varchar(64) default NULL, + `addr_extension_spam` varchar(64) default NULL, + `addr_extension_banned` varchar(64) default NULL, + `addr_extension_bad_header` varchar(64) default NULL, + `warnvirusrecip` enum('N','Y') default NULL, + `warnbannedrecip` enum('N','Y') default NULL, + `warnbadhrecip` enum('N','Y') default NULL, + `newvirus_admin` varchar(64) default NULL, + `virus_admin` varchar(64) default NULL, + `banned_admin` varchar(64) default NULL, + `bad_header_admin` varchar(64) default NULL, + `spam_admin` varchar(64) default NULL, + `spam_subject_tag` varchar(64) default NULL, + `spam_subject_tag2` varchar(64) default NULL, + `message_size_limit` int(11) unsigned default NULL, + `banned_rulenames` varchar(64) default NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `spamfilter_users` +-- + +CREATE TABLE `spamfilter_users` ( + `id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL, + `sys_groupid` int(11) unsigned NOT NULL, + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `server_id` int(11) unsigned NOT NULL, + `priority` tinyint(3) unsigned NOT NULL default '7', + `policy_id` int(11) unsigned NOT NULL default '1', + `email` varchar(255) NOT NULL, + `fullname` varchar(64) default NULL, + `local` varchar(1) default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `email` (`email`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `spamfilter_wblist` +-- + +CREATE TABLE `spamfilter_wblist` ( + `wblist_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL, + `sys_groupid` int(11) unsigned NOT NULL, + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `server_id` int(11) unsigned NOT NULL, + `wb` enum('W','B') NOT NULL default 'W', + `rid` int(11) unsigned NOT NULL, + `email` varchar(255) NOT NULL, + `priority` tinyint(3) unsigned NOT NULL, + `active` enum('y','n') NOT NULL default 'y', + PRIMARY KEY (`wblist_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `support_message` +-- + +CREATE TABLE `support_message` ( + `support_message_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `recipient_id` int(11) unsigned NOT NULL default '0', + `sender_id` int(11) unsigned NOT NULL default '0', + `subject` varchar(255) default NULL, + `message` text default NULL, + `tstamp` int(11) NOT NULL default '0', + PRIMARY KEY (`support_message_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_datalog` +-- + +CREATE TABLE `sys_datalog` ( + `datalog_id` int(11) unsigned NOT NULL auto_increment, + `server_id` int(11) unsigned NOT NULL, + `dbtable` varchar(255) NOT NULL default '', + `dbidx` varchar(255) NOT NULL default '', + `action` char(1) NOT NULL default '', + `tstamp` int(11) NOT NULL default '0', + `user` varchar(255) NOT NULL default '', + `data` longtext NOT NULL, + `status` set('pending','ok','warning','error') NOT NULL default 'pending', + PRIMARY KEY (`datalog_id`), + KEY `server_id` (`server_id`,`status`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_dbsync` +-- + +CREATE TABLE `sys_dbsync` ( + `id` int(11) unsigned NOT NULL auto_increment, + `jobname` varchar(64) NOT NULL default '', + `sync_interval_minutes` int(11) unsigned NOT NULL default '0', + `db_type` varchar(16) NOT NULL default '', + `db_host` varchar(255) NOT NULL default '', + `db_name` varchar(64) NOT NULL default '', + `db_username` varchar(64) NOT NULL default '', + `db_password` varchar(64) NOT NULL default '', + `db_tables` varchar(255) NOT NULL default 'admin,forms', + `empty_datalog` int(11) unsigned NOT NULL default '0', + `sync_datalog_external` int(11) unsigned NOT NULL default '0', + `active` tinyint(1) NOT NULL default '1', + `last_datalog_id` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`id`), + KEY `last_datalog_id` (`last_datalog_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_filesync` +-- + +CREATE TABLE `sys_filesync` ( + `id` int(11) unsigned NOT NULL auto_increment, + `jobname` varchar(64) NOT NULL default '', + `sync_interval_minutes` int(11) unsigned NOT NULL default '0', + `ftp_host` varchar(255) NOT NULL default '', + `ftp_path` varchar(255) NOT NULL default '', + `ftp_username` varchar(64) NOT NULL default '', + `ftp_password` varchar(64) NOT NULL default '', + `local_path` varchar(255) NOT NULL default '', + `wput_options` varchar(255) NOT NULL default '--timestamping --reupload --dont-continue', + `active` tinyint(1) NOT NULL default '1', + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_group` +-- + +CREATE TABLE `sys_group` ( + `groupid` int(11) unsigned NOT NULL auto_increment, + `name` varchar(64) NOT NULL default '', + `description` text NOT NULL, + `client_id` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`groupid`) +) ENGINE=MyISAM AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_ini` +-- + +CREATE TABLE `sys_ini` ( + `sysini_id` int(11) unsigned NOT NULL auto_increment, + `config` longtext NOT NULL, + PRIMARY KEY (`sysini_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_log` +-- + +CREATE TABLE `sys_log` ( + `syslog_id` int(11) unsigned NOT NULL auto_increment, + `server_id` int(11) unsigned NOT NULL default '0', + `datalog_id` int(11) unsigned NOT NULL default '0', + `loglevel` tinyint(4) NOT NULL default '0', + `tstamp` int(11) unsigned NOT NULL, + `message` text, + PRIMARY KEY (`syslog_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_user` +-- + +CREATE TABLE `sys_user` ( + `userid` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '1', + `sys_groupid` int(11) unsigned NOT NULL default '1', + `sys_perm_user` varchar(5) NOT NULL default 'riud', + `sys_perm_group` varchar(5) NOT NULL default 'riud', + `sys_perm_other` varchar(5) NOT NULL default '', + `username` varchar(64) NOT NULL default '', + `passwort` varchar(64) NOT NULL default '', + `modules` varchar(255) NOT NULL default '', + `startmodule` varchar(255) NOT NULL default '', + `app_theme` varchar(32) NOT NULL default 'default', + `typ` varchar(16) NOT NULL default 'user', + `active` tinyint(1) NOT NULL default '1', + `language` varchar(2) NOT NULL default 'de', + `groups` varchar(255) NOT NULL default '', + `default_group` int(11) unsigned NOT NULL default '0', + `client_id` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`userid`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_session` +-- + +CREATE TABLE `sys_session` ( + `session_id` varchar(32) NOT NULL default '', + `date_created` datetime NOT NULL default '0000-00-00 00:00:00', + `last_updated` datetime NOT NULL default '0000-00-00 00:00:00', + `session_data` longtext, + PRIMARY KEY (`session_id`), + KEY `last_updated` (`last_updated`) +) ENGINE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `web_domain` +-- + +CREATE TABLE `web_domain` ( + `domain_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `ip_address` varchar(39) default NULL, + `domain` varchar(255) default NULL, + `type` varchar(32) default NULL, + `parent_domain_id` int(11) unsigned NOT NULL default '0', + `vhost_type` varchar(32) default NULL, + `document_root` varchar(255) default NULL, + `system_user` varchar(255) default NULL, + `system_group` varchar(255) default NULL, + `hd_quota` bigint(20) NOT NULL default '0', + `traffic_quota` bigint(20) NOT NULL default '-1', + `cgi` enum('n','y') NOT NULL default 'y', + `ssi` enum('n','y') NOT NULL default 'y', + `suexec` enum('n','y') NOT NULL default 'y', + `errordocs` tinyint(1) NOT NULL default '1', + `is_subdomainwww` tinyint(1) NOT NULL default '1', + `subdomain` enum('none','www','*') NOT NULL default 'none', + `php` varchar(32) NOT NULL default 'y', + `ruby` enum('n','y') NOT NULL default 'n', + `redirect_type` varchar(255) default NULL, + `redirect_path` varchar(255) default NULL, + `ssl` enum('n','y') NOT NULL default 'n', + `ssl_state` varchar(255) NULL, + `ssl_locality` varchar(255) NULL, + `ssl_organisation` varchar(255) NULL, + `ssl_organisation_unit` varchar(255) NULL, + `ssl_country` varchar(255) NULL, + `ssl_domain` varchar(255) NULL, + `ssl_request` mediumtext NULL, + `ssl_cert` mediumtext NULL, + `ssl_bundle` mediumtext NULL, + `ssl_action` varchar(16) NULL, + `stats_password` varchar(255) default NULL, + `stats_type` varchar(255) default 'webalizer', + `allow_override` varchar(255) NOT NULL default 'All', + `apache_directives` mediumtext, + `php_open_basedir` mediumtext, + `custom_php_ini` mediumtext, + `backup_interval` VARCHAR( 255 ) NOT NULL DEFAULT 'none', + `backup_copies` INT NOT NULL DEFAULT '1', + `active` enum('n','y') NOT NULL default 'y', + `traffic_quota_lock` enum('n','y') NOT NULL default 'n', + PRIMARY KEY (`domain_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `web_database` +-- + +CREATE TABLE `web_database` ( + `database_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `type` varchar(16) NOT NULL default 'y', + `database_name` varchar(64) default NULL, + `database_user` varchar(64) default NULL, + `database_password` varchar(64) default NULL, + `database_charset` varchar(64) default NULL, + `remote_access` enum('n','y') NOT NULL default 'y', + `remote_ips` text NOT NULL, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`database_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `web_traffic` +-- + +CREATE TABLE `web_traffic` ( + `hostname` varchar(255) NOT NULL, + `traffic_date` date NOT NULL, + `traffic_bytes` bigint(32) unsigned NOT NULL default '0', + PRIMARY KEY (`hostname`,`traffic_date`) +) ENGINE=MyISAM; + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `webdav_user` +-- + +CREATE TABLE `webdav_user` ( + `webdav_user_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `parent_domain_id` int(11) unsigned NOT NULL default '0', + `username` varchar(64) default NULL, + `password` varchar(64) default NULL, + `active` enum('n','y') NOT NULL default 'y', + `dir` varchar(255) default NULL, + PRIMARY KEY (`webdav_user_id`) +) ENGINE=MyISAM; + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `attempts_login` +-- + +CREATE TABLE `attempts_login` ( + `ip` varchar(39) NOT NULL, + `times` int(11) default NULL, + `login_time` timestamp +) ENGINE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `monitor_data` +-- + +CREATE TABLE `monitor_data` ( + `server_id` int(11) unsigned NOT NULL, + `type` varchar(255) NOT NULL, + `created` int(11) unsigned NOT NULL, + `data` mediumtext NOT NULL, + `state` enum('no_state', 'unknown', 'ok', 'info', 'warning', 'critical', 'error') NOT NULL default 'unknown', + PRIMARY KEY (`server_id`,`type`,`created`) +) ENGINE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_config` +-- + +CREATE TABLE `sys_config` ( + `config_id` int(11) unsigned NOT NULL, + `group` varchar(64) NOT NULL, + `name` varchar(64) NOT NULL, + `value` varchar(255) NOT NULL +) ENGINE=MyISAM; + + +-- +-- Tabellenstruktur für Tabelle `sys_remoteaction` +-- + +CREATE TABLE `sys_remoteaction` ( + `action_id` int(11) unsigned NOT NULL auto_increment, + `server_id` int(11) unsigned NOT NULL, + `tstamp` int(11) NOT NULL, + `action_type` varchar(20) NOT NULL, + `action_param` mediumtext NOT NULL, + `action_state` enum('pending','ok','warning','error') NOT NULL, + `response` mediumtext NOT NULL, + PRIMARY KEY (`action_id`), + KEY `server_id` (`server_id`) +) ENGINE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- iso_country_list.sql +-- +-- This will create and then populate a MySQL table with a list of the names and +-- ISO 3166 codes for countries in existence as of the date below. +-- +-- For updates to this file, see http://27.org/isocountrylist/ +-- For more about ISO 3166, see http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html +-- +-- Created by getisocountrylist.pl on Sun Nov 2 14:59:20 2003. +-- Wm. Rhodes +-- + +-- +-- Table structure for table `country` +-- + +CREATE TABLE `country` ( + `iso` char(2) NOT NULL PRIMARY KEY, + `name` varchar(64) NOT NULL, + `printable_name` varchar(64) NOT NULL, + `iso3` char(3), + `numcode` SMALLINT +) ENGINE=MyISAM; + + + +-- -------------------------------------------------------- +-- -------------------------------------------------------- +-- DB-DATA +-- -------------------------------------------------------- +-- -------------------------------------------------------- + +-- +-- Dumping data for table `dns_template` +-- + +INSERT INTO `dns_template` (`template_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `name`, `fields`, `template`, `visible`) VALUES (1, 1, 1, 'riud', 'riud', '', 'Default', 'DOMAIN,IP,NS1,NS2,EMAIL', '[ZONE]\norigin={DOMAIN}.\nns={NS1}.\nmbox={EMAIL}.\nrefresh=28800\nretry=7200\nexpire=604800\nminimum=86400\nttl=86400\n\n[DNS_RECORDS]\nA|{DOMAIN}.|{IP}|0|86400\nA|www|{IP}|0|86400\nA|mail|{IP}|0|86400\nNS|{DOMAIN}.|{NS1}.|0|86400\nNS|{DOMAIN}.|{NS2}.|0|86400\nMX|{DOMAIN}.|mail.{DOMAIN}.|10|86400', 'y'); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `software_repo` +-- + +INSERT INTO `software_repo` (`software_repo_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `repo_name`, `repo_url`, `repo_username`, `repo_password`, `active`) VALUES (1, 1, 1, 'riud', 'riud', '', 'ISPConfig Addons', 'http://repo.ispconfig.org/addons/', '', '', 'n'); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `spamfilter_policy` +-- + +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(1, 1, 0, 'riud', 'riud', 'r', 'Non-paying', 'N', 'N', 'N', 'N', 'Y', 'Y', 'Y', 'N', 'Y', '', '', '', '', '', '', 3, 7, 10, 0, 0, '', '', '', '', 'N', 'N', 'N', '', '', '', '', '', '', '', 0, ''); +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(2, 1, 0, 'riud', 'riud', 'r', 'Uncensored', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', NULL, NULL, NULL, NULL, NULL, NULL, 3, 999, 999, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(3, 1, 0, 'riud', 'riud', 'r', 'Wants all spam', 'N', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 999, 999, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(4, 1, 0, 'riud', 'riud', 'r', 'Wants viruses', 'Y', 'N', 'Y', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 6.9, 6.9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(5, 1, 0, 'riud', 'riud', 'r', 'Normal', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', '', '', '', '', '', '', 1, 4.5, 50, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', '***SPAM***', NULL, NULL); +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(6, 1, 0, 'riud', 'riud', 'r', 'Trigger happy', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 5, 5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(7, 1, 0, 'riud', 'riud', 'r', 'Permissive', 'N', 'N', 'N', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 10, 20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `sys_group` +-- + +INSERT INTO `sys_group` (`groupid`, `name`, `description`, `client_id`) VALUES (1, 'admin', 'Administrators group', 0); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `sys_ini` +-- + +INSERT INTO `sys_ini` (`sysini_id`, `config`) VALUES (1, ''); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `sys_user` +-- + +INSERT INTO `sys_user` (`userid`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `username`, `passwort`, `modules`, `startmodule`, `app_theme`, `typ`, `active`, `language`, `groups`, `default_group`, `client_id`) VALUES (1, 1, 0, 'riud', 'riud', '', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'dashboard,admin,client,mail,monitor,sites,dns,tools,help', 'dashboard', 'default', 'admin', 1, 'en', '1,2', 1, 0); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `sys_config` +-- + +INSERT INTO sys_config VALUES ('1','db','db_version','3.0.3.1'); + +-- -------------------------------------------------------- + +-- +-- iso_country_list.sql +-- +-- This will create and then populate a MySQL table with a list of the names and +-- ISO 3166 codes for countries in existence as of the date below. +-- +-- For updates to this file, see http://27.org/isocountrylist/ +-- For more about ISO 3166, see http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html +-- +-- Created by getisocountrylist.pl on Sun Nov 2 14:59:20 2003. +-- Wm. Rhodes +-- + +-- +-- Dumping data for table `country` +-- + +INSERT INTO `country` (`iso`, `name`, `printable_name`, `iso3`, `numcode`) VALUES +('AF', 'AFGHANISTAN', 'Afghanistan', 'AFG', 4), +('AL', 'ALBANIA', 'Albania', 'ALB', 8), +('DZ', 'ALGERIA', 'Algeria', 'DZA', 12), +('AS', 'AMERICAN SAMOA', 'American Samoa', 'ASM', 16), +('AD', 'ANDORRA', 'Andorra', 'AND', 20), +('AO', 'ANGOLA', 'Angola', 'AGO', 24), +('AI', 'ANGUILLA', 'Anguilla', 'AIA', 660), +('AQ', 'ANTARCTICA', 'Antarctica', NULL, NULL), +('AG', 'ANTIGUA AND BARBUDA', 'Antigua and Barbuda', 'ATG', 28), +('AR', 'ARGENTINA', 'Argentina', 'ARG', 32), +('AM', 'ARMENIA', 'Armenia', 'ARM', 51), +('AW', 'ARUBA', 'Aruba', 'ABW', 533), +('AU', 'AUSTRALIA', 'Australia', 'AUS', 36), +('AT', 'AUSTRIA', 'Austria', 'AUT', 40), +('AZ', 'AZERBAIJAN', 'Azerbaijan', 'AZE', 31), +('BS', 'BAHAMAS', 'Bahamas', 'BHS', 44), +('BH', 'BAHRAIN', 'Bahrain', 'BHR', 48), +('BD', 'BANGLADESH', 'Bangladesh', 'BGD', 50), +('BB', 'BARBADOS', 'Barbados', 'BRB', 52), +('BY', 'BELARUS', 'Belarus', 'BLR', 112), +('BE', 'BELGIUM', 'Belgium', 'BEL', 56), +('BZ', 'BELIZE', 'Belize', 'BLZ', 84), +('BJ', 'BENIN', 'Benin', 'BEN', 204), +('BM', 'BERMUDA', 'Bermuda', 'BMU', 60), +('BT', 'BHUTAN', 'Bhutan', 'BTN', 64), +('BO', 'BOLIVIA', 'Bolivia', 'BOL', 68), +('BA', 'BOSNIA AND HERZEGOVINA', 'Bosnia and Herzegovina', 'BIH', 70), +('BW', 'BOTSWANA', 'Botswana', 'BWA', 72), +('BV', 'BOUVET ISLAND', 'Bouvet Island', NULL, NULL), +('BR', 'BRAZIL', 'Brazil', 'BRA', 76), +('IO', 'BRITISH INDIAN OCEAN TERRITORY', 'British Indian Ocean Territory', NULL, NULL), +('BN', 'BRUNEI DARUSSALAM', 'Brunei Darussalam', 'BRN', 96), +('BG', 'BULGARIA', 'Bulgaria', 'BGR', 100), +('BF', 'BURKINA FASO', 'Burkina Faso', 'BFA', 854), +('BI', 'BURUNDI', 'Burundi', 'BDI', 108), +('KH', 'CAMBODIA', 'Cambodia', 'KHM', 116), +('CM', 'CAMEROON', 'Cameroon', 'CMR', 120), +('CA', 'CANADA', 'Canada', 'CAN', 124), +('CV', 'CAPE VERDE', 'Cape Verde', 'CPV', 132), +('KY', 'CAYMAN ISLANDS', 'Cayman Islands', 'CYM', 136), +('CF', 'CENTRAL AFRICAN REPUBLIC', 'Central African Republic', 'CAF', 140), +('TD', 'CHAD', 'Chad', 'TCD', 148), +('CL', 'CHILE', 'Chile', 'CHL', 152), +('CN', 'CHINA', 'China', 'CHN', 156), +('CX', 'CHRISTMAS ISLAND', 'Christmas Island', NULL, NULL), +('CC', 'COCOS (KEELING) ISLANDS', 'Cocos (Keeling) Islands', NULL, NULL), +('CO', 'COLOMBIA', 'Colombia', 'COL', 170), +('KM', 'COMOROS', 'Comoros', 'COM', 174), +('CG', 'CONGO', 'Congo', 'COG', 178), +('CD', 'CONGO, THE DEMOCRATIC REPUBLIC OF THE', 'Congo, the Democratic Republic of the', 'COD', 180), +('CK', 'COOK ISLANDS', 'Cook Islands', 'COK', 184), +('CR', 'COSTA RICA', 'Costa Rica', 'CRI', 188), +('CI', 'COTE D''IVOIRE', 'Cote D''Ivoire', 'CIV', 384), +('HR', 'CROATIA', 'Croatia', 'HRV', 191), +('CU', 'CUBA', 'Cuba', 'CUB', 192), +('CY', 'CYPRUS', 'Cyprus', 'CYP', 196), +('CZ', 'CZECH REPUBLIC', 'Czech Republic', 'CZE', 203), +('DK', 'DENMARK', 'Denmark', 'DNK', 208), +('DJ', 'DJIBOUTI', 'Djibouti', 'DJI', 262), +('DM', 'DOMINICA', 'Dominica', 'DMA', 212), +('DO', 'DOMINICAN REPUBLIC', 'Dominican Republic', 'DOM', 214), +('EC', 'ECUADOR', 'Ecuador', 'ECU', 218), +('EG', 'EGYPT', 'Egypt', 'EGY', 818), +('SV', 'EL SALVADOR', 'El Salvador', 'SLV', 222), +('GQ', 'EQUATORIAL GUINEA', 'Equatorial Guinea', 'GNQ', 226), +('ER', 'ERITREA', 'Eritrea', 'ERI', 232), +('EE', 'ESTONIA', 'Estonia', 'EST', 233), +('ET', 'ETHIOPIA', 'Ethiopia', 'ETH', 231), +('FK', 'FALKLAND ISLANDS (MALVINAS)', 'Falkland Islands (Malvinas)', 'FLK', 238), +('FO', 'FAROE ISLANDS', 'Faroe Islands', 'FRO', 234), +('FJ', 'FIJI', 'Fiji', 'FJI', 242), +('FI', 'FINLAND', 'Finland', 'FIN', 246), +('FR', 'FRANCE', 'France', 'FRA', 250), +('GF', 'FRENCH GUIANA', 'French Guiana', 'GUF', 254), +('PF', 'FRENCH POLYNESIA', 'French Polynesia', 'PYF', 258), +('TF', 'FRENCH SOUTHERN TERRITORIES', 'French Southern Territories', NULL, NULL), +('GA', 'GABON', 'Gabon', 'GAB', 266), +('GM', 'GAMBIA', 'Gambia', 'GMB', 270), +('GE', 'GEORGIA', 'Georgia', 'GEO', 268), +('DE', 'GERMANY', 'Germany', 'DEU', 276), +('GH', 'GHANA', 'Ghana', 'GHA', 288), +('GI', 'GIBRALTAR', 'Gibraltar', 'GIB', 292), +('GR', 'GREECE', 'Greece', 'GRC', 300), +('GL', 'GREENLAND', 'Greenland', 'GRL', 304), +('GD', 'GRENADA', 'Grenada', 'GRD', 308), +('GP', 'GUADELOUPE', 'Guadeloupe', 'GLP', 312), +('GU', 'GUAM', 'Guam', 'GUM', 316), +('GT', 'GUATEMALA', 'Guatemala', 'GTM', 320), +('GN', 'GUINEA', 'Guinea', 'GIN', 324), +('GW', 'GUINEA-BISSAU', 'Guinea-Bissau', 'GNB', 624), +('GY', 'GUYANA', 'Guyana', 'GUY', 328), +('HT', 'HAITI', 'Haiti', 'HTI', 332), +('HM', 'HEARD ISLAND AND MCDONALD ISLANDS', 'Heard Island and Mcdonald Islands', NULL, NULL), +('VA', 'HOLY SEE (VATICAN CITY STATE)', 'Holy See (Vatican City State)', 'VAT', 336), +('HN', 'HONDURAS', 'Honduras', 'HND', 340), +('HK', 'HONG KONG', 'Hong Kong', 'HKG', 344), +('HU', 'HUNGARY', 'Hungary', 'HUN', 348), +('IS', 'ICELAND', 'Iceland', 'ISL', 352), +('IN', 'INDIA', 'India', 'IND', 356), +('ID', 'INDONESIA', 'Indonesia', 'IDN', 360), +('IR', 'IRAN, ISLAMIC REPUBLIC OF', 'Iran, Islamic Republic of', 'IRN', 364), +('IQ', 'IRAQ', 'Iraq', 'IRQ', 368), +('IE', 'IRELAND', 'Ireland', 'IRL', 372), +('IL', 'ISRAEL', 'Israel', 'ISR', 376), +('IT', 'ITALY', 'Italy', 'ITA', 380), +('JM', 'JAMAICA', 'Jamaica', 'JAM', 388), +('JP', 'JAPAN', 'Japan', 'JPN', 392), +('JO', 'JORDAN', 'Jordan', 'JOR', 400), +('KZ', 'KAZAKHSTAN', 'Kazakhstan', 'KAZ', 398), +('KE', 'KENYA', 'Kenya', 'KEN', 404), +('KI', 'KIRIBATI', 'Kiribati', 'KIR', 296), +('KP', 'KOREA, DEMOCRATIC PEOPLE''S REPUBLIC OF', 'Korea, Democratic People''s Republic of', 'PRK', 408), +('KR', 'KOREA, REPUBLIC OF', 'Korea, Republic of', 'KOR', 410), +('KW', 'KUWAIT', 'Kuwait', 'KWT', 414), +('KG', 'KYRGYZSTAN', 'Kyrgyzstan', 'KGZ', 417), +('LA', 'LAO PEOPLE''S DEMOCRATIC REPUBLIC', 'Lao People''s Democratic Republic', 'LAO', 418), +('LV', 'LATVIA', 'Latvia', 'LVA', 428), +('LB', 'LEBANON', 'Lebanon', 'LBN', 422), +('LS', 'LESOTHO', 'Lesotho', 'LSO', 426), +('LR', 'LIBERIA', 'Liberia', 'LBR', 430), +('LY', 'LIBYAN ARAB JAMAHIRIYA', 'Libyan Arab Jamahiriya', 'LBY', 434), +('LI', 'LIECHTENSTEIN', 'Liechtenstein', 'LIE', 438), +('LT', 'LITHUANIA', 'Lithuania', 'LTU', 440), +('LU', 'LUXEMBOURG', 'Luxembourg', 'LUX', 442), +('MO', 'MACAO', 'Macao', 'MAC', 446), +('MK', 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF', 'Macedonia, the Former Yugoslav Republic of', 'MKD', 807), +('MG', 'MADAGASCAR', 'Madagascar', 'MDG', 450), +('MW', 'MALAWI', 'Malawi', 'MWI', 454), +('MY', 'MALAYSIA', 'Malaysia', 'MYS', 458), +('MV', 'MALDIVES', 'Maldives', 'MDV', 462), +('ML', 'MALI', 'Mali', 'MLI', 466), +('MT', 'MALTA', 'Malta', 'MLT', 470), +('MH', 'MARSHALL ISLANDS', 'Marshall Islands', 'MHL', 584), +('MQ', 'MARTINIQUE', 'Martinique', 'MTQ', 474), +('MR', 'MAURITANIA', 'Mauritania', 'MRT', 478), +('MU', 'MAURITIUS', 'Mauritius', 'MUS', 480), +('YT', 'MAYOTTE', 'Mayotte', NULL, NULL), +('MX', 'MEXICO', 'Mexico', 'MEX', 484), +('FM', 'MICRONESIA, FEDERATED STATES OF', 'Micronesia, Federated States of', 'FSM', 583), +('MD', 'MOLDOVA, REPUBLIC OF', 'Moldova, Republic of', 'MDA', 498), +('MC', 'MONACO', 'Monaco', 'MCO', 492), +('MN', 'MONGOLIA', 'Mongolia', 'MNG', 496), +('MS', 'MONTSERRAT', 'Montserrat', 'MSR', 500), +('MA', 'MOROCCO', 'Morocco', 'MAR', 504), +('MZ', 'MOZAMBIQUE', 'Mozambique', 'MOZ', 508), +('MM', 'MYANMAR', 'Myanmar', 'MMR', 104), +('NA', 'NAMIBIA', 'Namibia', 'NAM', 516), +('NR', 'NAURU', 'Nauru', 'NRU', 520), +('NP', 'NEPAL', 'Nepal', 'NPL', 524), +('NL', 'NETHERLANDS', 'Netherlands', 'NLD', 528), +('AN', 'NETHERLANDS ANTILLES', 'Netherlands Antilles', 'ANT', 530), +('NC', 'NEW CALEDONIA', 'New Caledonia', 'NCL', 540), +('NZ', 'NEW ZEALAND', 'New Zealand', 'NZL', 554), +('NI', 'NICARAGUA', 'Nicaragua', 'NIC', 558), +('NE', 'NIGER', 'Niger', 'NER', 562), +('NG', 'NIGERIA', 'Nigeria', 'NGA', 566), +('NU', 'NIUE', 'Niue', 'NIU', 570), +('NF', 'NORFOLK ISLAND', 'Norfolk Island', 'NFK', 574), +('MP', 'NORTHERN MARIANA ISLANDS', 'Northern Mariana Islands', 'MNP', 580), +('NO', 'NORWAY', 'Norway', 'NOR', 578), +('OM', 'OMAN', 'Oman', 'OMN', 512), +('PK', 'PAKISTAN', 'Pakistan', 'PAK', 586), +('PW', 'PALAU', 'Palau', 'PLW', 585), +('PS', 'PALESTINIAN TERRITORY, OCCUPIED', 'Palestinian Territory, Occupied', NULL, NULL), +('PA', 'PANAMA', 'Panama', 'PAN', 591), +('PG', 'PAPUA NEW GUINEA', 'Papua New Guinea', 'PNG', 598), +('PY', 'PARAGUAY', 'Paraguay', 'PRY', 600), +('PE', 'PERU', 'Peru', 'PER', 604), +('PH', 'PHILIPPINES', 'Philippines', 'PHL', 608), +('PN', 'PITCAIRN', 'Pitcairn', 'PCN', 612), +('PL', 'POLAND', 'Poland', 'POL', 616), +('PT', 'PORTUGAL', 'Portugal', 'PRT', 620), +('PR', 'PUERTO RICO', 'Puerto Rico', 'PRI', 630), +('QA', 'QATAR', 'Qatar', 'QAT', 634), +('RE', 'REUNION', 'Reunion', 'REU', 638), +('RO', 'ROMANIA', 'Romania', 'ROM', 642), +('RU', 'RUSSIAN FEDERATION', 'Russian Federation', 'RUS', 643), +('RW', 'RWANDA', 'Rwanda', 'RWA', 646), +('SH', 'SAINT HELENA', 'Saint Helena', 'SHN', 654), +('KN', 'SAINT KITTS AND NEVIS', 'Saint Kitts and Nevis', 'KNA', 659), +('LC', 'SAINT LUCIA', 'Saint Lucia', 'LCA', 662), +('PM', 'SAINT PIERRE AND MIQUELON', 'Saint Pierre and Miquelon', 'SPM', 666), +('VC', 'SAINT VINCENT AND THE GRENADINES', 'Saint Vincent and the Grenadines', 'VCT', 670), +('WS', 'SAMOA', 'Samoa', 'WSM', 882), +('SM', 'SAN MARINO', 'San Marino', 'SMR', 674), +('ST', 'SAO TOME AND PRINCIPE', 'Sao Tome and Principe', 'STP', 678), +('SA', 'SAUDI ARABIA', 'Saudi Arabia', 'SAU', 682), +('SN', 'SENEGAL', 'Senegal', 'SEN', 686), +('CS', 'SERBIA AND MONTENEGRO', 'Serbia and Montenegro', NULL, NULL), +('SC', 'SEYCHELLES', 'Seychelles', 'SYC', 690), +('SL', 'SIERRA LEONE', 'Sierra Leone', 'SLE', 694), +('SG', 'SINGAPORE', 'Singapore', 'SGP', 702), +('SK', 'SLOVAKIA', 'Slovakia', 'SVK', 703), +('SI', 'SLOVENIA', 'Slovenia', 'SVN', 705), +('SB', 'SOLOMON ISLANDS', 'Solomon Islands', 'SLB', 90), +('SO', 'SOMALIA', 'Somalia', 'SOM', 706), +('ZA', 'SOUTH AFRICA', 'South Africa', 'ZAF', 710), +('GS', 'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS', 'South Georgia and the South Sandwich Islands', NULL, NULL), +('ES', 'SPAIN', 'Spain', 'ESP', 724), +('LK', 'SRI LANKA', 'Sri Lanka', 'LKA', 144), +('SD', 'SUDAN', 'Sudan', 'SDN', 736), +('SR', 'SURINAME', 'Suriname', 'SUR', 740), +('SJ', 'SVALBARD AND JAN MAYEN', 'Svalbard and Jan Mayen', 'SJM', 744), +('SZ', 'SWAZILAND', 'Swaziland', 'SWZ', 748), +('SE', 'SWEDEN', 'Sweden', 'SWE', 752), +('CH', 'SWITZERLAND', 'Switzerland', 'CHE', 756), +('SY', 'SYRIAN ARAB REPUBLIC', 'Syrian Arab Republic', 'SYR', 760), +('TW', 'TAIWAN, PROVINCE OF CHINA', 'Taiwan, Province of China', 'TWN', 158), +('TJ', 'TAJIKISTAN', 'Tajikistan', 'TJK', 762), +('TZ', 'TANZANIA, UNITED REPUBLIC OF', 'Tanzania, United Republic of', 'TZA', 834), +('TH', 'THAILAND', 'Thailand', 'THA', 764), +('TL', 'TIMOR-LESTE', 'Timor-Leste', NULL, NULL), +('TG', 'TOGO', 'Togo', 'TGO', 768), +('TK', 'TOKELAU', 'Tokelau', 'TKL', 772), +('TO', 'TONGA', 'Tonga', 'TON', 776), +('TT', 'TRINIDAD AND TOBAGO', 'Trinidad and Tobago', 'TTO', 780), +('TN', 'TUNISIA', 'Tunisia', 'TUN', 788), +('TR', 'TURKEY', 'Turkey', 'TUR', 792), +('TM', 'TURKMENISTAN', 'Turkmenistan', 'TKM', 795), +('TC', 'TURKS AND CAICOS ISLANDS', 'Turks and Caicos Islands', 'TCA', 796), +('TV', 'TUVALU', 'Tuvalu', 'TUV', 798), +('UG', 'UGANDA', 'Uganda', 'UGA', 800), +('UA', 'UKRAINE', 'Ukraine', 'UKR', 804), +('AE', 'UNITED ARAB EMIRATES', 'United Arab Emirates', 'ARE', 784), +('GB', 'UNITED KINGDOM', 'United Kingdom', 'GBR', 826), +('US', 'UNITED STATES', 'United States', 'USA', 840), +('UM', 'UNITED STATES MINOR OUTLYING ISLANDS', 'United States Minor Outlying Islands', NULL, NULL), +('UY', 'URUGUAY', 'Uruguay', 'URY', 858), +('UZ', 'UZBEKISTAN', 'Uzbekistan', 'UZB', 860), +('VU', 'VANUATU', 'Vanuatu', 'VUT', 548), +('VE', 'VENEZUELA', 'Venezuela', 'VEN', 862), +('VN', 'VIET NAM', 'Viet Nam', 'VNM', 704), +('VG', 'VIRGIN ISLANDS, BRITISH', 'Virgin Islands, British', 'VGB', 92), +('VI', 'VIRGIN ISLANDS, U.S.', 'Virgin Islands, U.s.', 'VIR', 850), +('WF', 'WALLIS AND FUTUNA', 'Wallis and Futuna', 'WLF', 876), +('EH', 'WESTERN SAHARA', 'Western Sahara', 'ESH', 732), +('YE', 'YEMEN', 'Yemen', 'YEM', 887), +('ZM', 'ZAMBIA', 'Zambia', 'ZMB', 894), +('ZW', 'ZIMBABWE', 'Zimbabwe', 'ZWE', 716); + +-- -------------------------------------------------------- +-- tables for the FAQ module + +CREATE TABLE `help_faq_sections` ( + `hfs_id` int(11) NOT NULL AUTO_INCREMENT, + `hfs_name` varchar(255) DEFAULT NULL, + `hfs_order` int(11) DEFAULT '0', + `sys_userid` int(11) DEFAULT NULL, + `sys_groupid` int(11) DEFAULT NULL, + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + PRIMARY KEY (`hfs_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +INSERT INTO `help_faq_sections` VALUES (1,'General',0,NULL,NULL,NULL,NULL,NULL); + +CREATE TABLE `help_faq` ( + `hf_id` int(11) NOT NULL AUTO_INCREMENT, + `hf_section` int(11) DEFAULT NULL, + `hf_order` int(11) DEFAULT '0', + `hf_question` text, + `hf_answer` text, + `sys_userid` int(11) DEFAULT NULL, + `sys_groupid` int(11) DEFAULT NULL, + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + PRIMARY KEY (`hf_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + +INSERT INTO `help_faq` VALUES (1,1,0,'I\'d like to know ...','Yes, of course.',1,1,'riud','riud','r'); + +ALTER TABLE client ADD COLUMN company_id varchar(30); + +-- -------------------------------------------------------- + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/install/tpl/mm_cfg.py.master b/install/tpl/mm_cfg.py.master new file mode 100644 index 0000000000000000000000000000000000000000..9ec47a727ea678448d6eaed24fd56fdda2d4c17d --- /dev/null +++ b/install/tpl/mm_cfg.py.master @@ -0,0 +1,106 @@ +# -*- python -*- + +# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA + + +"""This is the module which takes your site-specific settings. + +From a raw distribution it should be copied to mm_cfg.py. If you +already have an mm_cfg.py, be careful to add in only the new settings +you want. The complete set of distributed defaults, with annotation, +are in ./Defaults. In mm_cfg, override only those you want to +change, after the + + from Defaults import * + +line (see below). + +Note that these are just default settings - many can be overridden via the +admin and user interfaces on a per-list or per-user basis. + +Note also that some of the settings are resolved against the active list +setting by using the value as a format string against the +list-instance-object's dictionary - see the distributed value of +DEFAULT_MSG_FOOTER for an example.""" + + +####################################################### +# Here's where we get the distributed defaults. # + +from Defaults import * + +############################################################## +# Put YOUR site-specific configuration below, in mm_cfg.py . # +# See Defaults.py for explanations of the values. # + +#------------------------------------------------------------- +# The name of the list Mailman uses to send password reminders +# and similar. Don't change if you want mailman-owner to be +# a valid local part. +MAILMAN_SITE_LIST = 'mailman' + +#------------------------------------------------------------- +# If you change these, you have to configure your http server +# accordingly (Alias and ScriptAlias directives in most httpds) +DEFAULT_URL_PATTERN = 'http://%s/cgi-bin/mailman/' +PRIVATE_ARCHIVE_URL = '/cgi-bin/mailman/private' +IMAGE_LOGOS = '/images/mailman/' + +#------------------------------------------------------------- +# Default domain for email addresses of newly created MLs +DEFAULT_EMAIL_HOST = '{hostname}' +#------------------------------------------------------------- +# Default host for web interface of newly created MLs +DEFAULT_URL_HOST = '{hostname}' +#------------------------------------------------------------- +# Required when setting any of its arguments. +add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST) + +#------------------------------------------------------------- +# The default language for this server. +DEFAULT_SERVER_LANGUAGE = {default_language} + +#------------------------------------------------------------- +# Iirc this was used in pre 2.1, leave it for now +USE_ENVELOPE_SENDER = 0 # Still used? + +#------------------------------------------------------------- +# Unset send_reminders on newly created lists +DEFAULT_SEND_REMINDERS = 0 + +#------------------------------------------------------------- +# Uncomment this if you configured your MTA such that it +# automatically recognizes newly created lists. +# (see /usr/share/doc/mailman/README.Exim4.Debian or +# /usr/share/mailman/postfix-to-mailman.py) +# MTA=None # Misnomer, suppresses alias output on newlist + +#------------------------------------------------------------- +# Uncomment if you use Postfix virtual domains (but not +# postfix-to-mailman.py), but be sure to see +# /usr/share/doc/mailman/README.Debian first. +MTA='Postfix' +POSTFIX_STYLE_VIRTUAL_DOMAINS = [{virtual_domains}] +#------------------------------------------------------------- +# Uncomment if you want to filter mail with SpamAssassin. For +# more information please visit this website: +# http://www.jamesh.id.au/articles/mailman-spamassassin/ +# GLOBAL_PIPELINE.insert(1, 'SpamAssassin') + +# Note - if you're looking for something that is imported from mm_cfg, but you +# didn't find it above, it's probably in /usr/lib/mailman/Mailman/Defaults.py. \ No newline at end of file diff --git a/install/update.php b/install/update.php index fb4df831dce0df43802928ccbedb7e571f9550a4..17f6c3c3ca16d5db5ad91fa33ac0a95a95532df1 100644 --- a/install/update.php +++ b/install/update.php @@ -1,353 +1,358 @@ -> Update \n\n"; - -//** Include the library with the basic installer functions -require_once('lib/install.lib.php'); - -//** Include the library with the basic updater functions -require_once('lib/update.lib.php'); - -//** Include the base class of the installer class -require_once('lib/installer_base.lib.php'); - -//** Ensure that current working directory is install directory -$cur_dir = getcwd(); -if(realpath(dirname(__FILE__)) != $cur_dir) die("Please run installation/update from _inside_ the install directory!\n"); - -//** Install logfile -define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log'); -define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../')); - -//** Check for ISPConfig 2.x versions -if(is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) { - die('This software cannot be installed on a server wich runs ISPConfig 2.x.'); -} - -//** Get distribution identifier -$dist = get_distname(); - -include_once("/usr/local/ispconfig/server/lib/config.inc.php"); -$conf_old = $conf; -unset($conf); - -if($dist['id'] == '') die('Linux distribution or version not recognized.'); - -//** Include the distribution-specific installer class library and configuration -if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php'); -include_once('dist/lib/'.$dist['id'].'.lib.php'); -include_once('dist/conf/'.$dist['id'].'.conf.php'); - -//** Get hostname -exec('hostname -f', $tmp_out); -$conf['hostname'] = $tmp_out[0]; -unset($tmp_out); - -//** Set the mysql login information -$conf["mysql"]["host"] = $conf_old["db_host"]; -$conf["mysql"]["database"] = $conf_old["db_database"]; -$conf['mysql']['charset'] = 'utf8'; -$conf["mysql"]["ispconfig_user"] = $conf_old["db_user"]; -$conf["mysql"]["ispconfig_password"] = $conf_old["db_password"]; -$conf['language'] = $conf_old['language']; -if($conf['language'] == '{language}') $conf['language'] = 'en'; - -if(isset($conf_old["dbmaster_host"])) $conf["mysql"]["master_host"] = $conf_old["dbmaster_host"]; -if(isset($conf_old["dbmaster_database"])) $conf["mysql"]["master_database"] = $conf_old["dbmaster_database"]; -if(isset($conf_old["dbmaster_user"])) $conf["mysql"]["master_ispconfig_user"] = $conf_old["dbmaster_user"]; -if(isset($conf_old["dbmaster_password"])) $conf["mysql"]["master_ispconfig_password"] = $conf_old["dbmaster_password"]; - -//* Check if this is a master / slave setup -if($conf["mysql"]["master_host"] != '' && $conf["mysql"]["host"] != $conf["mysql"]["master_host"]) { - $conf['mysql']['master_slave_setup'] = 'y'; -} - -// Resolve the IP address of the mysql hostname. -if(!$conf['mysql']['ip'] = gethostbyname($conf['mysql']['host'])) die('Unable to resolve hostname'.$conf['mysql']['host']); - -$conf['server_id'] = intval($conf_old["server_id"]); -$conf['ispconfig_log_priority'] = $conf_old["log_priority"]; - -$inst = new installer(); -$inst->is_update = true; - -//** Detect the installed applications -$inst->find_installed_apps(); - -echo "This application will update ISPConfig 3 on your server.\n"; - -//** Initialize the MySQL server connection -include_once('lib/mysql.lib.php'); - -//** Database update is a bit brute force and should be rebuild later ;) - -/* - * Try to read the DB-admin settings - */ -$clientdb_host = ''; -$clientdb_user = ''; -$clientdb_password = ''; -include_once("/usr/local/ispconfig/server/lib/mysql_clientdb.conf"); -$conf["mysql"]["admin_user"] = $clientdb_user; -$conf["mysql"]["admin_password"] = $clientdb_password; -$clientdb_host = ''; -$clientdb_user = ''; -$clientdb_password = ''; - -//** Ask user for mysql admin_password if empty -if( empty($conf["mysql"]["admin_password"]) ) { - - $conf["mysql"]["admin_password"] = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']); -} - -/* - * Prepare the dump of the database - */ -prepareDBDump(); - -//* initialize the database -$inst->db = new db(); - -//* initialize the master DB, if we have a multiserver setup -if($conf['mysql']['master_slave_setup'] == 'y') { - //** Get MySQL root credentials - $finished = false; - do { - $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host']); - $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user']); - $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password']); - $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']); - - //* Initialize the MySQL server connection - if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { - $conf['mysql']['master_host'] = $tmp_mysql_server_host; - $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; - $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password; - $conf['mysql']['master_database'] = $tmp_mysql_server_database; - $finished = true; - } else { - swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); - } - } while ($finished == false); - unset($finished); - - // initialize the connection to the master database - $inst->dbmaster = new db(); - if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); - $inst->dbmaster->dbHost = $conf['mysql']["master_host"]; - $inst->dbmaster->dbName = $conf['mysql']["master_database"]; - $inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"]; - $inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"]; -} else { - $inst->dbmaster = $inst->db; -} - - -/* - * dump the new Database and reconfigure the server.ini - */ -updateDbAndIni(); - -/* - * Reconfigure the permisson if needed - * (if this is done at client side, only this client is updated. - * If this is done at server side, all clients are updated. - */ -//if($conf_old['dbmaster_user'] != '' or $conf_old['dbmaster_host'] != '') { - //** Update master database rights - $reconfigure_master_database_rights_answer = $inst->simple_query('Reconfigure Permissions in master database?', array('yes','no'),'no'); - - if($reconfigure_master_database_rights_answer == 'yes') { - $inst->grant_master_database_rights(); - } -//} - -//** Shall the services be reconfigured during update -$reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes','no'),'yes'); - -if($reconfigure_services_answer == 'yes') { - - if($conf['services']['mail']) { - //** Configure postfix - swriteln('Configuring Postfix'); - $inst->configure_postfix('dont-create-certs'); - - //* Configure Jailkit - swriteln('Configuring Jailkit'); - $inst->configure_jailkit(); - - if($conf['dovecot']['installed'] == true) { - //* Configure dovecot - swriteln('Configuring Dovecot'); - $inst->configure_dovecot(); - } else { - //** Configure saslauthd - swriteln('Configuring SASL'); - $inst->configure_saslauthd(); - - //** Configure PAM - swriteln('Configuring PAM'); - $inst->configure_pam(); - - //* Configure courier - swriteln('Configuring Courier'); - $inst->configure_courier(); - } - - //** Configure Spamasassin - swriteln('Configuring Spamassassin'); - $inst->configure_spamassassin(); - - //** Configure Amavis - swriteln('Configuring Amavisd'); - $inst->configure_amavis(); - - //** Configure Getmail - swriteln('Configuring Getmail'); - $inst->configure_getmail(); - } - - if($conf['services']['web']) { - //** Configure Pureftpd - swriteln('Configuring Pureftpd'); - $inst->configure_pureftpd(); - } - - if($conf['services']['dns']) { - //* Configure DNS - if($conf['powerdns']['installed'] == true) { - swriteln('Configuring PowerDNS'); - $inst->configure_powerdns(); - } elseif($conf['bind']['installed'] == true) { - swriteln('Configuring BIND'); - $inst->configure_bind(); - } else { - swriteln('Configuring MyDNS'); - $inst->configure_mydns(); - } - } - - if($conf['services']['web']) { - //** Configure Apache - swriteln('Configuring Apache'); - $inst->configure_apache(); - - //** Configure vlogger - swriteln('Configuring vlogger'); - $inst->configure_vlogger(); - - //** Configure apps vhost - swriteln('Configuring Apps vhost'); - $inst->configure_apps_vhost(); - } - - - //* Configure DBServer - swriteln('Configuring Database'); - $inst->configure_dbserver(); - - - //if(@is_dir('/etc/Bastille')) { - //* Configure Firewall - swriteln('Configuring Firewall'); - $inst->configure_firewall(); - //} -} - -//** Configure ISPConfig -swriteln('Updating ISPConfig'); - - -//** Customise the port ISPConfig runs on -$ispconfig_port_number = get_ispconfig_port_number(); -$conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', $ispconfig_port_number); - -// $ispconfig_ssl_default = (is_ispconfig_ssl_enabled() == true)?'y':'n'; -if(strtolower($inst->simple_query('Create new ISPConfig SSL certificate',array('yes','no'),'no')) == 'yes') { - $inst->make_ispconfig_ssl_cert(); -} - -$inst->install_ispconfig(); - -//** Configure Crontab -$update_crontab_answer = $inst->simple_query('Reconfigure Crontab?', array('yes','no'),'yes'); -if($update_crontab_answer == 'yes') { - swriteln('Updating Crontab'); - $inst->install_crontab(); -} - -//** Restart services: -if($reconfigure_services_answer == 'yes') { - swriteln('Restarting services ...'); - if($conf['mysql']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mysql']['init_script'])) system($conf['init_scripts'].'/'.$conf['mysql']['init_script'].' restart'); - if($conf['services']['mail']) { - if($conf['postfix']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['postfix']['init_script'])) system($conf['init_scripts'].'/'.$conf['postfix']['init_script'].' restart'); - if($conf['saslauthd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'])) system($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'].' restart'); - if($conf['amavis']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['amavis']['init_script'])) system($conf['init_scripts'].'/'.$conf['amavis']['init_script'].' restart'); - if($conf['clamav']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['clamav']['init_script'])) system($conf['init_scripts'].'/'.$conf['clamav']['init_script'].' restart'); - if($conf['courier']['courier-authdaemon'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'].' restart'); - if($conf['courier']['courier-imap'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap'].' restart'); - if($conf['courier']['courier-imap-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'].' restart'); - if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart'); - if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart'); - if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script'])) system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart'); - } - if($conf['services']['web']) { - if($conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart'); - if($conf['pureftpd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'])) system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart'); - } - if($conf['services']['dns']) { - if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mydns']['init_script'])) system($conf['init_scripts'].'/'.$conf['mydns']['init_script'].' restart &> /dev/null'); - if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['powerdns']['init_script'])) system($conf['init_scripts'].'/'.$conf['powerdns']['init_script'].' restart &> /dev/null'); - if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['bind']['init_script'])) system($conf['init_scripts'].'/'.$conf['bind']['init_script'].' restart &> /dev/null'); - } -} - -echo "Update finished.\n"; - -?> +> Update \n\n"; + +//** Include the library with the basic installer functions +require_once('lib/install.lib.php'); + +//** Include the library with the basic updater functions +require_once('lib/update.lib.php'); + +//** Include the base class of the installer class +require_once('lib/installer_base.lib.php'); + +//** Ensure that current working directory is install directory +$cur_dir = getcwd(); +if(realpath(dirname(__FILE__)) != $cur_dir) die("Please run installation/update from _inside_ the install directory!\n"); + +//** Install logfile +define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log'); +define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../')); + +//** Check for ISPConfig 2.x versions +if(is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) { + die('This software cannot be installed on a server wich runs ISPConfig 2.x.'); +} + +//** Get distribution identifier +$dist = get_distname(); + +include_once("/usr/local/ispconfig/server/lib/config.inc.php"); +$conf_old = $conf; +unset($conf); + +if($dist['id'] == '') die('Linux distribution or version not recognized.'); + +//** Include the distribution-specific installer class library and configuration +if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php'); +include_once('dist/lib/'.$dist['id'].'.lib.php'); +include_once('dist/conf/'.$dist['id'].'.conf.php'); + +//** Get hostname +exec('hostname -f', $tmp_out); +$conf['hostname'] = $tmp_out[0]; +unset($tmp_out); + +//** Set the mysql login information +$conf["mysql"]["host"] = $conf_old["db_host"]; +$conf["mysql"]["database"] = $conf_old["db_database"]; +$conf['mysql']['charset'] = 'utf8'; +$conf["mysql"]["ispconfig_user"] = $conf_old["db_user"]; +$conf["mysql"]["ispconfig_password"] = $conf_old["db_password"]; +$conf['language'] = $conf_old['language']; +if($conf['language'] == '{language}') $conf['language'] = 'en'; + +if(isset($conf_old["dbmaster_host"])) $conf["mysql"]["master_host"] = $conf_old["dbmaster_host"]; +if(isset($conf_old["dbmaster_database"])) $conf["mysql"]["master_database"] = $conf_old["dbmaster_database"]; +if(isset($conf_old["dbmaster_user"])) $conf["mysql"]["master_ispconfig_user"] = $conf_old["dbmaster_user"]; +if(isset($conf_old["dbmaster_password"])) $conf["mysql"]["master_ispconfig_password"] = $conf_old["dbmaster_password"]; + +//* Check if this is a master / slave setup +if($conf["mysql"]["master_host"] != '' && $conf["mysql"]["host"] != $conf["mysql"]["master_host"]) { + $conf['mysql']['master_slave_setup'] = 'y'; +} + +// Resolve the IP address of the mysql hostname. +if(!$conf['mysql']['ip'] = gethostbyname($conf['mysql']['host'])) die('Unable to resolve hostname'.$conf['mysql']['host']); + +$conf['server_id'] = intval($conf_old["server_id"]); +$conf['ispconfig_log_priority'] = $conf_old["log_priority"]; + +$inst = new installer(); +$inst->is_update = true; + +//** Detect the installed applications +$inst->find_installed_apps(); + +echo "This application will update ISPConfig 3 on your server.\n"; + +//** Initialize the MySQL server connection +include_once('lib/mysql.lib.php'); + +//** Database update is a bit brute force and should be rebuild later ;) + +/* + * Try to read the DB-admin settings + */ +$clientdb_host = ''; +$clientdb_user = ''; +$clientdb_password = ''; +include_once("/usr/local/ispconfig/server/lib/mysql_clientdb.conf"); +$conf["mysql"]["admin_user"] = $clientdb_user; +$conf["mysql"]["admin_password"] = $clientdb_password; +$clientdb_host = ''; +$clientdb_user = ''; +$clientdb_password = ''; + +//** Ask user for mysql admin_password if empty +if( empty($conf["mysql"]["admin_password"]) ) { + + $conf["mysql"]["admin_password"] = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']); +} + +/* + * Prepare the dump of the database + */ +prepareDBDump(); + +//* initialize the database +$inst->db = new db(); + +//* initialize the master DB, if we have a multiserver setup +if($conf['mysql']['master_slave_setup'] == 'y') { + //** Get MySQL root credentials + $finished = false; + do { + $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host']); + $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user']); + $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password']); + $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']); + + //* Initialize the MySQL server connection + if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { + $conf['mysql']['master_host'] = $tmp_mysql_server_host; + $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; + $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password; + $conf['mysql']['master_database'] = $tmp_mysql_server_database; + $finished = true; + } else { + swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); + } + } while ($finished == false); + unset($finished); + + // initialize the connection to the master database + $inst->dbmaster = new db(); + if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); + $inst->dbmaster->dbHost = $conf['mysql']["master_host"]; + $inst->dbmaster->dbName = $conf['mysql']["master_database"]; + $inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"]; + $inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"]; +} else { + $inst->dbmaster = $inst->db; +} + + +/* + * dump the new Database and reconfigure the server.ini + */ +updateDbAndIni(); + +/* + * Reconfigure the permisson if needed + * (if this is done at client side, only this client is updated. + * If this is done at server side, all clients are updated. + */ +//if($conf_old['dbmaster_user'] != '' or $conf_old['dbmaster_host'] != '') { + //** Update master database rights + $reconfigure_master_database_rights_answer = $inst->simple_query('Reconfigure Permissions in master database?', array('yes','no'),'no'); + + if($reconfigure_master_database_rights_answer == 'yes') { + $inst->grant_master_database_rights(); + } +//} + +//** Shall the services be reconfigured during update +$reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes','no'),'yes'); + +if($reconfigure_services_answer == 'yes') { + + if($conf['services']['mail']) { + //** Configure postfix + swriteln('Configuring Postfix'); + $inst->configure_postfix('dont-create-certs'); + + //** Configure mailman + swriteln('Configuring Mailman'); + $inst->configure_mailman('update'); + + //* Configure Jailkit + swriteln('Configuring Jailkit'); + $inst->configure_jailkit(); + + if($conf['dovecot']['installed'] == true) { + //* Configure dovecot + swriteln('Configuring Dovecot'); + $inst->configure_dovecot(); + } else { + //** Configure saslauthd + swriteln('Configuring SASL'); + $inst->configure_saslauthd(); + + //** Configure PAM + swriteln('Configuring PAM'); + $inst->configure_pam(); + + //* Configure courier + swriteln('Configuring Courier'); + $inst->configure_courier(); + } + + //** Configure Spamasassin + swriteln('Configuring Spamassassin'); + $inst->configure_spamassassin(); + + //** Configure Amavis + swriteln('Configuring Amavisd'); + $inst->configure_amavis(); + + //** Configure Getmail + swriteln('Configuring Getmail'); + $inst->configure_getmail(); + } + + if($conf['services']['web']) { + //** Configure Pureftpd + swriteln('Configuring Pureftpd'); + $inst->configure_pureftpd(); + } + + if($conf['services']['dns']) { + //* Configure DNS + if($conf['powerdns']['installed'] == true) { + swriteln('Configuring PowerDNS'); + $inst->configure_powerdns(); + } elseif($conf['bind']['installed'] == true) { + swriteln('Configuring BIND'); + $inst->configure_bind(); + } else { + swriteln('Configuring MyDNS'); + $inst->configure_mydns(); + } + } + + if($conf['services']['web']) { + //** Configure Apache + swriteln('Configuring Apache'); + $inst->configure_apache(); + + //** Configure vlogger + swriteln('Configuring vlogger'); + $inst->configure_vlogger(); + + //** Configure apps vhost + swriteln('Configuring Apps vhost'); + $inst->configure_apps_vhost(); + } + + + //* Configure DBServer + swriteln('Configuring Database'); + $inst->configure_dbserver(); + + + //if(@is_dir('/etc/Bastille')) { + //* Configure Firewall + swriteln('Configuring Firewall'); + $inst->configure_firewall(); + //} +} + +//** Configure ISPConfig +swriteln('Updating ISPConfig'); + + +//** Customise the port ISPConfig runs on +$ispconfig_port_number = get_ispconfig_port_number(); +$conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', $ispconfig_port_number); + +// $ispconfig_ssl_default = (is_ispconfig_ssl_enabled() == true)?'y':'n'; +if(strtolower($inst->simple_query('Create new ISPConfig SSL certificate',array('yes','no'),'no')) == 'yes') { + $inst->make_ispconfig_ssl_cert(); +} + +$inst->install_ispconfig(); + +//** Configure Crontab +$update_crontab_answer = $inst->simple_query('Reconfigure Crontab?', array('yes','no'),'yes'); +if($update_crontab_answer == 'yes') { + swriteln('Updating Crontab'); + $inst->install_crontab(); +} + +//** Restart services: +if($reconfigure_services_answer == 'yes') { + swriteln('Restarting services ...'); + if($conf['mysql']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mysql']['init_script'])) system($conf['init_scripts'].'/'.$conf['mysql']['init_script'].' restart'); + if($conf['services']['mail']) { + if($conf['postfix']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['postfix']['init_script'])) system($conf['init_scripts'].'/'.$conf['postfix']['init_script'].' restart'); + if($conf['saslauthd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'])) system($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'].' restart'); + if($conf['amavis']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['amavis']['init_script'])) system($conf['init_scripts'].'/'.$conf['amavis']['init_script'].' restart'); + if($conf['clamav']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['clamav']['init_script'])) system($conf['init_scripts'].'/'.$conf['clamav']['init_script'].' restart'); + if($conf['courier']['courier-authdaemon'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'].' restart'); + if($conf['courier']['courier-imap'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap'].' restart'); + if($conf['courier']['courier-imap-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'].' restart'); + if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart'); + if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart'); + if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script'])) system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart'); + if($conf['mailman']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mailman']['init_script'])) system($conf['init_scripts'].'/'.$conf['mailman']['init_script'].' restart'); + } + if($conf['services']['web']) { + if($conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart'); + if($conf['pureftpd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'])) system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart'); + } + if($conf['services']['dns']) { + if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mydns']['init_script'])) system($conf['init_scripts'].'/'.$conf['mydns']['init_script'].' restart &> /dev/null'); + if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['powerdns']['init_script'])) system($conf['init_scripts'].'/'.$conf['powerdns']['init_script'].' restart &> /dev/null'); + if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['bind']['init_script'])) system($conf['init_scripts'].'/'.$conf['bind']['init_script'].' restart &> /dev/null'); + } +} + +echo "Update finished.\n"; + +?> diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php index 7ded1df377e1965e8fc4b2ff02bc8eba5be52258..875eaffcad24fdf8f5dfa3ee0aeb80229063a4f7 100644 --- a/interface/lib/classes/remoting.inc.php +++ b/interface/lib/classes/remoting.inc.php @@ -1,2385 +1,2432 @@ -server = $server; - /* - $this->app = $app; - $this->conf = $conf; - */ - } - - //* remote login function - public function login($username, $password) - { - global $app, $conf, $server; - - if(empty($username)) { - $this->server->fault('login_username_empty', 'The login username is empty'); - return false; - } - - if(empty($password)) { - $this->server->fault('login_password_empty', 'The login password is empty'); - return false; - } - - //* Delete old remoting sessions - $sql = "DELETE FROM remote_session WHERE tstamp < ".time(); - $app->db->query($sql); - - $username = $app->db->quote($username); - $password = $app->db->quote($password); - - $sql = "SELECT * FROM remote_user WHERE remote_username = '$username' and remote_password = md5('$password')"; - $remote_user = $app->db->queryOneRecord($sql); - if($remote_user['remote_userid'] > 0) { - //* Create a remote user session - srand ((double)microtime()*1000000); - $remote_session = md5(rand()); - $remote_userid = $remote_user['remote_userid']; - $remote_functions = $remote_user['remote_functions']; - $tstamp = time() + $this->session_timeout; - $sql = 'INSERT INTO remote_session (remote_session,remote_userid,remote_functions,tstamp' - .') VALUES (' - ." '$remote_session',$remote_userid,'$remote_functions',$tstamp)"; - $app->db->query($sql); - return $remote_session; - } else { - $this->server->fault('login_failed', 'The login failed. Username or password wrong.'); - return false; - } - - } - - //* remote logout function - public function logout($session_id) - { - global $app; - - if(empty($session_id)) { - $this->server->fault('session_id_empty', 'The SessionID is empty.'); - return false; - } - - $session_id = $app->db->quote($session_id); - - $sql = "DELETE FROM remote_session WHERE remote_session = '$session_id'"; - $app->db->query($sql); - return ($app->db->affectedRows() == 1); - } - - - /** - Gets the server configuration - @param int session id - @param int server id - @param string section of the config field in the server table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc - @author Julio Montoya BeezNest 2010 - */ - public function server_get($session_id, $server_id, $section ='') { - global $app; - if(!$this->checkPerm($session_id, 'server_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if (!empty($session_id) && !empty($server_id)) { - $app->uses('remoting_lib , getconf'); - $section_config = $app->getconf->get_server_config($server_id,$section); - return $section_config; - } else { - return false; - } - } - - //* Get mail domain details - public function mail_domain_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_domain_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/mail_domain.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a mail domain - public function mail_domain_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'mail_domain_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $primary_id = $this->insertQuery('../mail/form/mail_domain.tform.php',$client_id,$params); - return $primary_id; - } - - //* Update a mail domain - public function mail_domain_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'mail_domain_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/mail_domain.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - //* Delete a mail domain - public function mail_domain_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'mail_domain_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/mail_domain.tform.php', $primary_id); - return $affected_rows; - } - - //* Get mail user details - public function mail_user_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_user_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/mail_user.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - - //* dodanie uzytkownika email - public function mail_user_add($session_id, $client_id, $params){ - if (!$this->checkPerm($session_id, 'mail_user_add')){ - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params); - return $affected_rows; - } - - //* edycja uzytkownika email - public function mail_user_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_user_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/mail_user.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - - //*usuniecie uzytkownika emial - public function mail_user_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_user_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/mail_user.tform.php', $primary_id); - return $affected_rows; - } - - //* Get mail user filter details - public function mail_user_filter_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_user_filter_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/mail_user_filter.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - public function mail_user_filter_add($session_id, $client_id, $params) - { - global $app; - if (!$this->checkPerm($session_id, 'mail_user_filter_add')){ - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/mail_user_filter.tform.php', $client_id, $params,'mail:mail_user_filter:on_after_insert'); - // $app->plugin->raiseEvent('mail:mail_user_filter:on_after_insert',$this); - return $affected_rows; - } - - public function mail_user_filter_update($session_id, $client_id, $primary_id, $params) - { - global $app; - if (!$this->checkPerm($session_id, 'mail_user_filter_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/mail_user_filter.tform.php', $client_id, $primary_id, $params,'mail:mail_user_filter:on_after_update'); - // $app->plugin->raiseEvent('mail:mail_user_filter:on_after_update',$this); - return $affected_rows; - } - - public function mail_user_filter_delete($session_id, $primary_id) - { - global $app; - if (!$this->checkPerm($session_id, 'mail_user_filter_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/mail_user_filter.tform.php', $primary_id); - $app->plugin->raiseEvent('mail:mail_user_filter:on_after_delete',$this); - return $affected_rows; - } - - //* Get alias details - public function mail_alias_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_alias_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/mail_alias.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* aliasy email - public function mail_alias_add($session_id, $client_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_alias_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/mail_alias.tform.php', $client_id, $params); - return $affected_rows; - } - - - public function mail_alias_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_alias_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/mail_alias.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - public function mail_alias_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_alias_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/mail_alias.tform.php', $primary_id); - return $affected_rows; - } - - //* Get mail forwarding details - public function mail_forward_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_forward_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/mail_forward.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* przekierowania email - public function mail_forward_add($session_id, $client_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_forward_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/mail_forward.tform.php', $client_id, $params); - return $affected_rows; - } - - - public function mail_forward_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_forward_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/mail_forward.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - - public function mail_forward_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_forward_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/mail_forward.tform.php', $primary_id); - return $affected_rows; - } - - //* Get catchall details - public function mail_catchall_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_catchall_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/mail_domain_catchall.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* catchall e-mail - public function mail_catchall_add($session_id, $client_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_catchall_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $params); - return $affected_rows; - } - - public function mail_catchall_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_catchall_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - public function mail_catchall_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_catchall_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/mail_domain_catchall.tform.php', $primary_id); - return $affected_rows; - } - - //* Get transport details - public function mail_transport_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_transport_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/mail_transport.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* przeniesienia e-mail - public function mail_transport_add($session_id, $client_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_transport_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/mail_transport.tform.php', $client_id, $params); - return $affected_rows; - } - - - public function mail_transport_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_transport_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/mail_transport.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - - public function mail_transport_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_transport_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/mail_transport.tform.php', $primary_id); - return $affected_rows; - } - - //* Get spamfilter whitelist details - public function mail_spamfilter_whitelist_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/spamfilter_whitelist.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* biała lista e-mail - public function mail_spamfilter_whitelist_add($session_id, $client_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $params); - return $affected_rows; - } - - - public function mail_spamfilter_whitelist_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - - public function mail_spamfilter_whitelist_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/spamfilter_whitelist.tform.php', $primary_id); - return $affected_rows; - } - - //* Get spamfilter blacklist details - public function mail_spamfilter_blacklist_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/spamfilter_blacklist.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* czarna lista e-mail - public function mail_spamfilter_blacklist_add($session_id, $client_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $params); - return $affected_rows; - } - - - public function mail_spamfilter_blacklist_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - - public function mail_spamfilter_blacklist_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/spamfilter_blacklist.tform.php', $primary_id); - return $affected_rows; - } - - //* Get spamfilter user details - public function mail_spamfilter_user_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_spamfilter_user_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/spamfilter_users.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* filtr spamu użytkowników e-mail - public function mail_spamfilter_user_add($session_id, $client_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_spamfilter_user_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/spamfilter_users.tform.php', $client_id, $params); - return $affected_rows; - } - - - public function mail_spamfilter_user_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_spamfilter_user_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/spamfilter_users.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - - public function mail_spamfilter_user_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_spamfilter_user_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/spamfilter_users.tform.php', $primary_id); - return $affected_rows; - } - - //* Get policy details - public function mail_policy_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_policy_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/spamfilter_policy.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* polityki filtrów spamu e-mail - public function mail_policy_add($session_id, $client_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_policy_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $params); - return $affected_rows; - } - - - public function mail_policy_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_policy_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - - public function mail_policy_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_policy_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/spamfilter_policy.tform.php', $primary_id); - return $affected_rows; - } - - //* Get fetchmail details - public function mail_fetchmail_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_fetchmail_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/mail_get.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* fetchmail - public function mail_fetchmail_add($session_id, $client_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_fetchmail_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/mail_get.tform.php', $client_id, $params); - return $affected_rows; - } - - - public function mail_fetchmail_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_fetchmail_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/mail_get.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - - public function mail_fetchmail_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_fetchmail_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/mail_get.tform.php', $primary_id); - return $affected_rows; - } - - //* Get whitelist details - public function mail_whitelist_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_whitelist_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/mail_whitelist.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* wpisy białej listy - public function mail_whitelist_add($session_id, $client_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_whitelist_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/mail_whitelist.tform.php', $client_id, $params); - return $affected_rows; - } - - - public function mail_whitelist_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_whitelist_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/mail_whitelist.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - - public function mail_whitelist_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_whitelist_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/mail_whitelist.tform.php', $primary_id); - return $affected_rows; - } - - //* Get Blacklist details - public function mail_blacklist_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_blacklist_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/mail_blacklist.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* wpisy białej listy - public function mail_blacklist_add($session_id, $client_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_blacklist_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/mail_blacklist.tform.php', $client_id, $params); - return $affected_rows; - } - - - public function mail_blacklist_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_blacklist_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/mail_blacklist.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - - public function mail_blacklist_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_blacklist_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/mail_blacklist.tform.php', $primary_id); - return $affected_rows; - } - - //* Get filter details - public function mail_filter_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'mail_filter_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/mail_content_filter.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* wpisy filtrow e-mail - public function mail_filter_add($session_id, $client_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_filter_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../mail/form/mail_content_filter.tform.php', $client_id, $params); - return $affected_rows; - } - - - public function mail_filter_update($session_id, $client_id, $primary_id, $params) - { - if (!$this->checkPerm($session_id, 'mail_filter_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/mail_content_filter.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - - public function mail_filter_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'mail_filter_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/mail_content_filter.tform.php', $primary_id); - return $affected_rows; - } - - - - -/* - * - * - * - * * Client functions - * - * - */ - //* Get client details - public function client_get($session_id, $client_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'client_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../client/form/client.tform.php'); - return $app->remoting_lib->getDataRecord($client_id); - } - - public function client_get_id($session_id, $sys_userid) - { - global $app; - if(!$this->checkPerm($session_id, 'client_get_id')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - - $sys_userid = intval($sys_userid); - - $rec = $app->db->queryOneRecord("SELECT client_id FROM sys_user WHERE userid = ".$sys_userid); - if(isset($rec['client_id'])) { - return intval($rec['client_id']); - } else { - $this->server->fault('no_client_found', 'There is no sysuser account for this client ID.'); - return false; - } - - } - - - public function client_add($session_id, $reseller_id, $params) - { - if (!$this->checkPerm($session_id, 'client_add')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->klientadd('../client/form/client.tform.php',$reseller_id, $params); - return $affected_rows; - - } - - public function client_update($session_id, $client_id, $reseller_id, $params) - { - global $app; - - if (!$this->checkPerm($session_id, 'client_update')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../client/form/client.tform.php', $client_id, $reseller_id, $params); - - $app->remoting_lib->ispconfig_sysuser_update($params,$client_id); - - return $affected_rows; - } - - - public function client_delete($session_id,$client_id) - { - global $app; - - if (!$this->checkPerm($session_id, 'client_delete')) - { - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../client/form/client.tform.php',$client_id); - - $app->remoting_lib->ispconfig_sysuser_delete($client_id); - - return $affected_rows; - } - - // Website functions --------------------------------------------------------------------------------------- - - //* Get cron details - public function sites_cron_get($session_id, $cron_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'sites_cron_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../sites/form/cron.tform.php'); - return $app->remoting_lib->getDataRecord($cron_id); - } - - //* Add a cron record - public function sites_cron_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_cron_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../sites/form/cron.tform.php',$client_id,$params); - } - - //* Update cron record - public function sites_cron_update($session_id, $client_id, $cron_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_cron_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../sites/form/cron.tform.php',$client_id,$cron_id,$params); - return $affected_rows; - } - - //* Delete cron record - public function sites_cron_delete($session_id, $cron_id) - { - if(!$this->checkPerm($session_id, 'sites_cron_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../sites/form/cron.tform.php',$cron_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------- - - //* Get record details - public function sites_database_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'sites_database_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../sites/form/database.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function sites_database_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_database_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../sites/form/database.tform.php',$client_id,$params); - } - - //* Update a record - public function sites_database_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_database_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../sites/form/database.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function sites_database_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'sites_database_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../sites/form/database.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------- - - //* Get record details - public function sites_ftp_user_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'sites_ftp_user_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../sites/form/ftp_user.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function sites_ftp_user_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_ftp_user_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../sites/form/ftp_user.tform.php',$client_id,$params); - } - - //* Update a record - public function sites_ftp_user_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_ftp_user_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../sites/form/ftp_user.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function sites_ftp_user_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'sites_ftp_user_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../sites/form/ftp_user.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------- - - //* Get record details - public function sites_shell_user_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'sites_shell_user_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../sites/form/shell_user.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function sites_shell_user_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_shell_user_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../sites/form/shell_user.tform.php',$client_id,$params); - } - - //* Update a record - public function sites_shell_user_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_shell_user_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../sites/form/shell_user.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function sites_shell_user_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'sites_shell_user_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../sites/form/shell_user.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------- - - //* Get record details - public function sites_web_domain_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'sites_web_domain_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../sites/form/web_domain.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function sites_web_domain_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_web_domain_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->insertQuery('../sites/form/web_domain.tform.php',$client_id,$params, 'sites:web_domain:on_after_insert'); - return $affected_rows; - } - - //* Update a record - public function sites_web_domain_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_web_domain_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../sites/form/web_domain.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function sites_web_domain_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'sites_web_domain_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../sites/form/web_domain.tform.php',$primary_id); - return $affected_rows; - } - - // ----------------------------------------------------------------------------------------------- - - //* Get record details - public function sites_web_aliasdomain_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../sites/form/web_aliasdomain.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function sites_web_aliasdomain_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../sites/form/web_aliasdomain.tform.php',$client_id,$params); - } - - //* Update a record - public function sites_web_aliasdomain_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../sites/form/web_aliasdomain.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function sites_web_aliasdomain_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../sites/form/web_aliasdomain.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------- - - //* Get record details - public function sites_web_subdomain_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'sites_web_subdomain_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../sites/form/web_subdomain.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function sites_web_subdomain_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_web_subdomain_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../sites/form/web_subdomain.tform.php',$client_id,$params); - } - - //* Update a record - public function sites_web_subdomain_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'sites_web_subdomain_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../sites/form/web_subdomain.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function sites_web_subdomain_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'sites_web_subdomain_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../sites/form/web_subdomain.tform.php',$primary_id); - return $affected_rows; - } - - - // DNS Function -------------------------------------------------------------------------------------------------- - - //* Get record details - public function dns_zone_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_zone_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_soa.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function dns_zone_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_zone_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../dns/form/dns_soa.tform.php',$client_id,$params); - } - - //* Update a record - public function dns_zone_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_zone_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../dns/form/dns_soa.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function dns_zone_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'dns_zone_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_soa.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------------- - - //* Get record details - public function dns_aaaa_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_aaaa_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_aaaa.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function dns_aaaa_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_aaaa_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../dns/form/dns_aaaa.tform.php',$client_id,$params); - } - - //* Update a record - public function dns_aaaa_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_aaaa_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../dns/form/dns_aaaa.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function dns_aaaa_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'dns_aaaa_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_aaaa.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------------- - - //* Get record details - public function dns_a_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_a_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_a.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function dns_a_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_a_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../dns/form/dns_a.tform.php',$client_id,$params); - } - - //* Update a record - public function dns_a_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_a_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../dns/form/dns_a.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function dns_a_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'dns_a_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_a.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------------- - - //* Get record details - public function dns_alias_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_alias_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_alias.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function dns_alias_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_alias_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../dns/form/dns_alias.tform.php',$client_id,$params); - } - - //* Update a record - public function dns_alias_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_alias_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../dns/form/dns_alias.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function dns_alias_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'dns_alias_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_alias.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------------- - - //* Get record details - public function dns_cname_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_cname_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_cname.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function dns_cname_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_cname_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../dns/form/dns_cname.tform.php',$client_id,$params); - } - - //* Update a record - public function dns_cname_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_cname_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../dns/form/dns_cname.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function dns_cname_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'dns_cname_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_cname.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------------- - - //* Get record details - public function dns_hinfo_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_hinfo_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_hinfo.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function dns_hinfo_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_hinfo_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../dns/form/dns_hinfo.tform.php',$client_id,$params); - } - - //* Update a record - public function dns_hinfo_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_hinfo_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../dns/form/dns_hinfo.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function dns_hinfo_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'dns_hinfo_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_hinfo.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------------- - - //* Get record details - public function dns_mx_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_mx_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_mx.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function dns_mx_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_mx_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../dns/form/dns_mx.tform.php',$client_id,$params); - } - - //* Update a record - public function dns_mx_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_mx_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../dns/form/dns_mx.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function dns_mx_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'dns_mx_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_mx.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------------- - - //* Get record details - public function dns_ns_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_ns_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_ns.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function dns_ns_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_ns_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../dns/form/dns_ns.tform.php',$client_id,$params); - } - - //* Update a record - public function dns_ns_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_ns_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../dns/form/dns_ns.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function dns_ns_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'dns_ns_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_ns.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------------- - - //* Get record details - public function dns_ptr_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_ptr_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_ptr.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function dns_ptr_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_ptr_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../dns/form/dns_ptr.tform.php',$client_id,$params); - } - - //* Update a record - public function dns_ptr_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_ptr_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../dns/form/dns_ptr.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function dns_ptr_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'dns_ptr_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_ptr.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------------- - - //* Get record details - public function dns_rp_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_rp_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_rp.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function dns_rp_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_rp_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../dns/form/dns_rp.tform.php',$client_id,$params); - } - - //* Update a record - public function dns_rp_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_rp_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../dns/form/dns_rp.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function dns_rp_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'dns_rp_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_rp.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------------- - - //* Get record details - public function dns_srv_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_srv_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_srv.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function dns_srv_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_srv_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../dns/form/dns_srv.tform.php',$client_id,$params); - } - - //* Update a record - public function dns_srv_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_srv_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../dns/form/dns_srv.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function dns_srv_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'dns_srv_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_srv.tform.php',$primary_id); - return $affected_rows; - } - - // ---------------------------------------------------------------------------------------------------------------- - - //* Get record details - public function dns_txt_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_txt_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_txt.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - //* Add a record - public function dns_txt_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_txt_add')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../dns/form/dns_txt.tform.php',$client_id,$params); - } - - //* Update a record - public function dns_txt_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'dns_txt_update')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../dns/form/dns_txt.tform.php',$client_id,$primary_id,$params); - return $affected_rows; - } - - //* Delete a record - public function dns_txt_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'dns_txt_delete')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_txt.tform.php',$primary_id); - return $affected_rows; - } - - - - - - - - - - - - - - //** private functions ----------------------------------------------------------------------------------- - - - - - private function klientadd($formdef_file, $reseller_id, $params) - { - global $app, $tform, $remoting_lib; - $app->uses('remoting_lib'); - - //* Load the form definition - $app->remoting_lib->loadFormDef($formdef_file); - - //* load the user profile of the client - $app->remoting_lib->loadUserProfile($reseller_id); - - //* load the client template - if(isset($params['template_master']) and $params['template_master'] > 0) - { - $template=$app->db->queryOneRecord("SELECT * FROM client_template WHERE template_id=".intval($params['template_master'])); - $params=array_merge($params,$template); - } - - //* Get the SQL query - $sql = $app->remoting_lib->getSQL($params,'INSERT',0); - if($app->remoting_lib->errorMessage != '') { - $this->server->fault('data_processing_error', $app->remoting_lib->errorMessage); - return false; - } - - $app->db->query($sql); - - if($app->db->errorMessage != '') { - $this->server->fault('database_error', $app->db->errorMessage . ' '.$sql); - return false; - } - - - - $insert_id = $app->db->insertID(); - //$app->uses('tform'); - //* Save changes to Datalog - if($app->remoting_lib->formDef["db_history"] == 'yes') { - $new_rec = $app->remoting_lib->getDataRecord($insert_id); - $app->remoting_lib->datalogSave('INSERT',$primary_id,array(),$new_rec); - $app->remoting_lib->ispconfig_sysuser_add($params,$insert_id); - } - return $insert_id; - } - - private function insertQuery($formdef_file, $client_id, $params,$event_identifier = '') - { - global $app, $tform, $remoting_lib; - - $app->uses('remoting_lib'); - - //* load the user profile of the client - $app->remoting_lib->loadUserProfile($client_id); - - //* Load the form definition - $app->remoting_lib->loadFormDef($formdef_file); - - //* Get the SQL query - $sql = $app->remoting_lib->getSQL($params,'INSERT',0); - if($app->remoting_lib->errorMessage != '') { - $this->server->fault('data_processing_error', $app->remoting_lib->errorMessage); - return false; - } - - $app->db->query($sql); - - if($app->db->errorMessage != '') { - $this->server->fault('database_error', $app->db->errorMessage . ' '.$sql); - return false; - } - - $insert_id = $app->db->insertID(); - - // set a few values for compatibility with tform actions, mostly used by plugins - $this->id = $insert_id; - $this->dataRecord = $params; - - if($event_identifier != '') $app->plugin->raiseEvent($event_identifier,$this); - - //$app->uses('tform'); - //* Save changes to Datalog - if($app->remoting_lib->formDef["db_history"] == 'yes') { - $new_rec = $app->remoting_lib->getDataRecord($insert_id); - $app->remoting_lib->datalogSave('INSERT',$primary_id,array(),$new_rec); - } - return $insert_id; - } - - - private function updateQuery($formdef_file, $client_id, $primary_id, $params, $event_identifier = '') - { - global $app; - - $app->uses('remoting_lib'); - - //* load the user profile of the client - $app->remoting_lib->loadUserProfile($client_id); - - //* Load the form definition - $app->remoting_lib->loadFormDef($formdef_file); - - //* Get the SQL query - $sql = $app->remoting_lib->getSQL($params,'UPDATE',$primary_id); - if($app->remoting_lib->errorMessage != '') { - $this->server->fault('data_processing_error', $app->remoting_lib->errorMessage); - return false; - } - - $old_rec = $app->remoting_lib->getDataRecord($primary_id); - - // set a few values for compatibility with tform actions, mostly used by plugins - $this->oldDataRecord = $old_rec; - $this->id = $primary_id; - $this->dataRecord = $params; - - $app->db->query($sql); - - if($app->db->errorMessage != '') { - $this->server->fault('database_error', $app->db->errorMessage . ' '.$sql); - return false; - } - - $affected_rows = $app->db->affectedRows(); - - if($event_identifier != '') $app->plugin->raiseEvent($event_identifier,$this); - - //* Save changes to Datalog - if($app->remoting_lib->formDef["db_history"] == 'yes') { - $new_rec = $app->remoting_lib->getDataRecord($primary_id); - $app->remoting_lib->datalogSave('UPDATE',$primary_id,$old_rec,$new_rec); - } - - return $affected_rows; - } - - private function deleteQuery($formdef_file, $primary_id) - { - global $app; - - $app->uses('remoting_lib'); - - //* load the user profile of the client - $app->remoting_lib->loadUserProfile(0); - - //* Load the form definition - $app->remoting_lib->loadFormDef($formdef_file); - - $old_rec = $app->remoting_lib->getDataRecord($primary_id); - - // set a few values for compatibility with tform actions, mostly used by plugins - $this->oldDataRecord = $old_rec; - $this->id = $primary_id; - $this->dataRecord = $params; - - //* Get the SQL query - $sql = $app->remoting_lib->getDeleteSQL($primary_id); - - $app->db->query($sql); - - if($app->db->errorMessage != '') { - $this->server->fault('database_error', $app->db->errorMessage . ' '.$sql); - return false; - } - - $affected_rows = $app->db->affectedRows(); - - //* Save changes to Datalog - if($app->remoting_lib->formDef["db_history"] == 'yes') { - $app->remoting_lib->datalogSave('DELETE',$primary_id,$old_rec,array()); - } - - - return $affected_rows; - } - - - private function checkPerm($session_id, $function_name) - { - $dobre=array(); - $session = $this->getSession($session_id); - if(!$session){ - return false; - } - - $dobre= str_replace(';',',',$session['remote_functions']); - return in_array($function_name, explode(',', $dobre) ); - } - - - private function getSession($session_id) - { - global $app; - - if(empty($session_id)) { - $this->server->fault('session_id_empty','The SessionID is empty.'); - return false; - } - - $session_id = $app->db->quote($session_id); - - $now = time(); - $sql = "SELECT * FROM remote_session WHERE remote_session = '$session_id' AND tstamp >= $now"; - $session = $app->db->queryOneRecord($sql); - if($session['remote_userid'] > 0) { - return $session; - } else { - $this->server->fault('session_does_not_exist','The Session is expired or does not exist.'); - return false; - } - } - - //--- - - - /** - * Gets sites by $sys_userid & $sys_groupid - * @param int session id - * @param int user id - * @param array list of groups - * @return mixed array with sites by user - * @author Julio Montoya BeezNest 2010 - */ - public function client_get_sites_by_user($session_id, $sys_userid, $sys_groupid) { - global $app; - if(!$this->checkPerm($session_id, 'client_get_sites_by_user')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $sys_userid = intval($sys_userid); - $sys_groupid = explode(',', $sys_groupid); - $new_group = array(); - foreach($sys_groupid as $group_id) { - $new_group[] = intval( $group_id); - } - $group_list = implode(',', $new_group); - $sql ="SELECT domain, domain_id, document_root, active FROM web_domain WHERE ( (sys_userid = $sys_userid AND sys_perm_user LIKE '%r%') OR (sys_groupid IN ($group_list) AND sys_perm_group LIKE '%r%') OR sys_perm_other LIKE '%r%') AND type = 'vhost'"; - $result = $app->db->queryAllRecords($sql); - if(isset($result)) { - return $result; - } else { - $this->server->fault('no_client_found', 'There is no site for this user'); - return false; - } - } - - /** - * Change domains status - * @param int session id - * @param int site id - * @param string active or inactive string - * @return mixed false if error - * @author Julio Montoya BeezNest 2010 - */ - - public function sites_web_domain_set_status($session_id, $primary_id, $status) { - global $app; - if(!$this->checkPerm($session_id, 'sites_web_domain_set_status')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if(in_array($status, array('active', 'inactive'))) { - if ($status == 'active') { - $status = 'y'; - } else { - $status = 'n'; - } - $sql = "UPDATE web_domain SET active = '$status' WHERE domain_id = ".intval($primary_id); - $app->db->query($sql); - $result = $app->db->affectedRows(); - return $result; - } else { - $this->server->fault('status_undefined', 'The status is not available'); - return false; - } - } - - /** - * Get sys_user information by username - * @param int session id - * @param string user's name - * @return mixed false if error - * @author Julio Montoya BeezNest 2010 - */ - public function client_get_by_username($session_id, $username) { - global $app; - if(!$this->checkPerm($session_id, 'client_get_by_username')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $username = $app->db->quote($username); - $rec = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE username = '".$username."'"); - if (isset($rec)) { - return $rec; - } else { - $this->server->fault('no_client_found', 'There is no user account for this user name.'); - return false; - } - } - - /** - * Changes client password - * - * @param int session id - * @param int client id - * @param string new password - * @return bool true if success - * @author Julio Montoya BeezNest 2010 - * - */ - public function client_change_password($session_id, $client_id, $new_password) { - global $app; - - if(!$this->checkPerm($session_id, 'client_change_password')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $client_id = intval($client_id); - $client = $app->db->queryOneRecord("SELECT client_id FROM client WHERE client_id = ".$client_id); - if($client['client_id'] > 0) { - $new_password = $app->db->quote($new_password); - $sql = "UPDATE client SET password = md5('".($new_password)."') WHERE client_id = ".$client_id; - $app->db->query($sql); - $sql = "UPDATE sys_user SET passwort = md5('".($new_password)."') WHERE client_id = ".$client_id; - $app->db->query($sql); - return true; - } else { - $this->server->fault('no_client_found', 'There is no user account for this client_id'); - return false; - } - } - - public function mail_domain_get_by_domain($session_id, $domain) { - global $app; - if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if (!empty($domain_id)) { - $domain = $app->db->quote($domain); - $sql = "SELECT * FROM mail_domain WHERE domain = $domain"; - $result = $app->db->queryAllRecords($sql); - return $result; - } - return false; - } - - - - /** - * Get a list of functions - * @param int session id - * @return mixed array of the available functions - * @author Julio Montoya BeezNest 2010 - */ - public function get_function_list($session_id) - { - if(!$this->checkPerm($session_id, 'get_function_list')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return get_class_methods($this); - } - - /** - * Get all databases by user - * @author Julio Montoya BeezNest 2010 - */ - public function sites_database_get_all_by_user($session_id, $client_id) - { - global $app; - if(!$this->checkPerm($session_id, 'sites_database_get_all_by_user')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $client_id = intval($client_id); - $sql = "SELECT database_id, database_name, database_user, database_password FROM web_database WHERE sys_userid = $client_id "; - $all = $app->db->queryAllRecords($sql); - return $all; - } - - /** - * Get all client templates - * @param int session id - * @author Julio Montoya BeezNest 2010 - */ - public function client_templates_get_all($session_id) { - global $app; - if(!$this->checkPerm($session_id, 'client_templates_get_all')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $sql = "SELECT * FROM client_template"; - $result = $app->db->queryAllRecords($sql); - return $result; - } - - /** - * Get all DNS zone by user - *@author Julio Montoya BeezNest 2010 - */ - public function dns_zone_get_by_user($session_id, $client_id, $server_id) { - global $app; - if(!$this->checkPerm($session_id, 'dns_zone_get')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if (!empty($client_id) && !empty($server_id)) { - $server_id = intval($server_id); - $client_id = intval($client_id); - $sql = "SELECT id, origin FROM dns_soa d INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id AND server_id = $server_id"; - $result = $app->db->queryAllRecords($sql); - return $result; - } - return false; - } - - - /** - * Changes DNS zone status - * @param int session id - * @param int dns soa id - * @param string status active or inactive string - * @author Julio Montoya BeezNest 2010 - */ - - public function dns_zone_set_status($session_id, $primary_id, $status) { - global $app; - if(!$this->checkPerm($session_id, 'dns_zone_set_status')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if(in_array($status, array('active', 'inactive'))) { - if ($status == 'active') { - $status = 'Y'; - } else { - $status = 'N'; - } - $sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".intval($primary_id); - $app->db->query($sql); - $result = $app->db->affectedRows(); - return $result; - } else { - $this->server->fault('status_undefined', 'The status is not available'); - return false; - } - } - - public function mail_domain_set_status($session_id, $primary_id, $status) { - global $app; - if(!$this->checkPerm($session_id, 'mail_domain_set_status')) { - $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if(in_array($status, array('active', 'inactive'))) { - if ($status == 'active') { - $status = 'y'; - } else { - $status = 'n'; - } - $sql = "UPDATE mail_domain SET active = '$status' WHERE domain_id = ".intval($primary_id); - $app->db->query($sql); - $result = $app->db->affectedRows(); - return $result; - } else { - $this->server->fault('status_undefined', 'The status is not available'); - return false; - } - } -} +server = $server; + /* + $this->app = $app; + $this->conf = $conf; + */ + } + + //* remote login function + public function login($username, $password) + { + global $app, $conf, $server; + + if(empty($username)) { + $this->server->fault('login_username_empty', 'The login username is empty'); + return false; + } + + if(empty($password)) { + $this->server->fault('login_password_empty', 'The login password is empty'); + return false; + } + + //* Delete old remoting sessions + $sql = "DELETE FROM remote_session WHERE tstamp < ".time(); + $app->db->query($sql); + + $username = $app->db->quote($username); + $password = $app->db->quote($password); + + $sql = "SELECT * FROM remote_user WHERE remote_username = '$username' and remote_password = md5('$password')"; + $remote_user = $app->db->queryOneRecord($sql); + if($remote_user['remote_userid'] > 0) { + //* Create a remote user session + srand ((double)microtime()*1000000); + $remote_session = md5(rand()); + $remote_userid = $remote_user['remote_userid']; + $remote_functions = $remote_user['remote_functions']; + $tstamp = time() + $this->session_timeout; + $sql = 'INSERT INTO remote_session (remote_session,remote_userid,remote_functions,tstamp' + .') VALUES (' + ." '$remote_session',$remote_userid,'$remote_functions',$tstamp)"; + $app->db->query($sql); + return $remote_session; + } else { + $this->server->fault('login_failed', 'The login failed. Username or password wrong.'); + return false; + } + + } + + //* remote logout function + public function logout($session_id) + { + global $app; + + if(empty($session_id)) { + $this->server->fault('session_id_empty', 'The SessionID is empty.'); + return false; + } + + $session_id = $app->db->quote($session_id); + + $sql = "DELETE FROM remote_session WHERE remote_session = '$session_id'"; + $app->db->query($sql); + return ($app->db->affectedRows() == 1); + } + + + /** + Gets the server configuration + @param int session id + @param int server id + @param string section of the config field in the server table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc + @author Julio Montoya BeezNest 2010 + */ + public function server_get($session_id, $server_id, $section ='') { + global $app; + if(!$this->checkPerm($session_id, 'server_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + if (!empty($session_id) && !empty($server_id)) { + $app->uses('remoting_lib , getconf'); + $section_config = $app->getconf->get_server_config($server_id,$section); + return $section_config; + } else { + return false; + } + } + + //* Get mail domain details + public function mail_domain_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_domain_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_domain.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a mail domain + public function mail_domain_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'mail_domain_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $primary_id = $this->insertQuery('../mail/form/mail_domain.tform.php',$client_id,$params); + return $primary_id; + } + + //* Update a mail domain + public function mail_domain_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'mail_domain_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/mail_domain.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + //* Delete a mail domain + public function mail_domain_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'mail_domain_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/mail_domain.tform.php', $primary_id); + return $affected_rows; + } + + //* Get mail mailinglist details + public function mail_mailinglist_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_mailinglist_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_mailinglist.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a mail mailinglist + public function mail_mailinglist_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'mail_mailinglist_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $primary_id = $this->insertQuery('../mail/form/mail_mailinglist.tform.php',$client_id,$params); + return $primary_id; + } + + //* Update a mail mailinglist + public function mail_mailinglist_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'mail_mailinglist_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/mail_mailinglist.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + //* Delete a mail mailinglist + public function mail_mailinglist_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'mail_mailinglist_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/mail_mailinglist.tform.php', $primary_id); + return $affected_rows; + } + + //* Get mail user details + public function mail_user_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_user_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_user.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + + //* dodanie uzytkownika email + public function mail_user_add($session_id, $client_id, $params){ + if (!$this->checkPerm($session_id, 'mail_user_add')){ + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params); + return $affected_rows; + } + + //* edycja uzytkownika email + public function mail_user_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_user_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/mail_user.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + + //*usuniecie uzytkownika emial + public function mail_user_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_user_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/mail_user.tform.php', $primary_id); + return $affected_rows; + } + + //* Get mail user filter details + public function mail_user_filter_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_user_filter_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_user_filter.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + public function mail_user_filter_add($session_id, $client_id, $params) + { + global $app; + if (!$this->checkPerm($session_id, 'mail_user_filter_add')){ + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/mail_user_filter.tform.php', $client_id, $params,'mail:mail_user_filter:on_after_insert'); + // $app->plugin->raiseEvent('mail:mail_user_filter:on_after_insert',$this); + return $affected_rows; + } + + public function mail_user_filter_update($session_id, $client_id, $primary_id, $params) + { + global $app; + if (!$this->checkPerm($session_id, 'mail_user_filter_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/mail_user_filter.tform.php', $client_id, $primary_id, $params,'mail:mail_user_filter:on_after_update'); + // $app->plugin->raiseEvent('mail:mail_user_filter:on_after_update',$this); + return $affected_rows; + } + + public function mail_user_filter_delete($session_id, $primary_id) + { + global $app; + if (!$this->checkPerm($session_id, 'mail_user_filter_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/mail_user_filter.tform.php', $primary_id); + $app->plugin->raiseEvent('mail:mail_user_filter:on_after_delete',$this); + return $affected_rows; + } + + //* Get alias details + public function mail_alias_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_alias_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_alias.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* aliasy email + public function mail_alias_add($session_id, $client_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_alias_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/mail_alias.tform.php', $client_id, $params); + return $affected_rows; + } + + + public function mail_alias_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_alias_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/mail_alias.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + public function mail_alias_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_alias_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/mail_alias.tform.php', $primary_id); + return $affected_rows; + } + + //* Get mail forwarding details + public function mail_forward_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_forward_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_forward.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* przekierowania email + public function mail_forward_add($session_id, $client_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_forward_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/mail_forward.tform.php', $client_id, $params); + return $affected_rows; + } + + + public function mail_forward_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_forward_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/mail_forward.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + + public function mail_forward_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_forward_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/mail_forward.tform.php', $primary_id); + return $affected_rows; + } + + //* Get catchall details + public function mail_catchall_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_catchall_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_domain_catchall.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* catchall e-mail + public function mail_catchall_add($session_id, $client_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_catchall_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $params); + return $affected_rows; + } + + public function mail_catchall_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_catchall_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + public function mail_catchall_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_catchall_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/mail_domain_catchall.tform.php', $primary_id); + return $affected_rows; + } + + //* Get transport details + public function mail_transport_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_transport_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_transport.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* przeniesienia e-mail + public function mail_transport_add($session_id, $client_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_transport_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/mail_transport.tform.php', $client_id, $params); + return $affected_rows; + } + + + public function mail_transport_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_transport_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/mail_transport.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + + public function mail_transport_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_transport_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/mail_transport.tform.php', $primary_id); + return $affected_rows; + } + + //* Get spamfilter whitelist details + public function mail_spamfilter_whitelist_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/spamfilter_whitelist.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* biała lista e-mail + public function mail_spamfilter_whitelist_add($session_id, $client_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $params); + return $affected_rows; + } + + + public function mail_spamfilter_whitelist_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + + public function mail_spamfilter_whitelist_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/spamfilter_whitelist.tform.php', $primary_id); + return $affected_rows; + } + + //* Get spamfilter blacklist details + public function mail_spamfilter_blacklist_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/spamfilter_blacklist.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* czarna lista e-mail + public function mail_spamfilter_blacklist_add($session_id, $client_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $params); + return $affected_rows; + } + + + public function mail_spamfilter_blacklist_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + + public function mail_spamfilter_blacklist_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/spamfilter_blacklist.tform.php', $primary_id); + return $affected_rows; + } + + //* Get spamfilter user details + public function mail_spamfilter_user_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_spamfilter_user_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/spamfilter_users.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* filtr spamu użytkowników e-mail + public function mail_spamfilter_user_add($session_id, $client_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_spamfilter_user_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/spamfilter_users.tform.php', $client_id, $params); + return $affected_rows; + } + + + public function mail_spamfilter_user_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_spamfilter_user_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/spamfilter_users.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + + public function mail_spamfilter_user_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_spamfilter_user_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/spamfilter_users.tform.php', $primary_id); + return $affected_rows; + } + + //* Get policy details + public function mail_policy_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_policy_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/spamfilter_policy.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* polityki filtrów spamu e-mail + public function mail_policy_add($session_id, $client_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_policy_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $params); + return $affected_rows; + } + + + public function mail_policy_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_policy_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + + public function mail_policy_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_policy_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/spamfilter_policy.tform.php', $primary_id); + return $affected_rows; + } + + //* Get fetchmail details + public function mail_fetchmail_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_fetchmail_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_get.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* fetchmail + public function mail_fetchmail_add($session_id, $client_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_fetchmail_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/mail_get.tform.php', $client_id, $params); + return $affected_rows; + } + + + public function mail_fetchmail_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_fetchmail_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/mail_get.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + + public function mail_fetchmail_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_fetchmail_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/mail_get.tform.php', $primary_id); + return $affected_rows; + } + + //* Get whitelist details + public function mail_whitelist_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_whitelist_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_whitelist.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* wpisy białej listy + public function mail_whitelist_add($session_id, $client_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_whitelist_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/mail_whitelist.tform.php', $client_id, $params); + return $affected_rows; + } + + + public function mail_whitelist_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_whitelist_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/mail_whitelist.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + + public function mail_whitelist_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_whitelist_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/mail_whitelist.tform.php', $primary_id); + return $affected_rows; + } + + //* Get Blacklist details + public function mail_blacklist_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_blacklist_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_blacklist.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* wpisy białej listy + public function mail_blacklist_add($session_id, $client_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_blacklist_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/mail_blacklist.tform.php', $client_id, $params); + return $affected_rows; + } + + + public function mail_blacklist_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_blacklist_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/mail_blacklist.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + + public function mail_blacklist_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_blacklist_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/mail_blacklist.tform.php', $primary_id); + return $affected_rows; + } + + //* Get filter details + public function mail_filter_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'mail_filter_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../mail/form/mail_content_filter.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* wpisy filtrow e-mail + public function mail_filter_add($session_id, $client_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_filter_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../mail/form/mail_content_filter.tform.php', $client_id, $params); + return $affected_rows; + } + + + public function mail_filter_update($session_id, $client_id, $primary_id, $params) + { + if (!$this->checkPerm($session_id, 'mail_filter_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../mail/form/mail_content_filter.tform.php', $client_id, $primary_id, $params); + return $affected_rows; + } + + + public function mail_filter_delete($session_id, $primary_id) + { + if (!$this->checkPerm($session_id, 'mail_filter_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../mail/form/mail_content_filter.tform.php', $primary_id); + return $affected_rows; + } + + + + +/* + * + * + * + * * Client functions + * + * + */ + //* Get client details + public function client_get($session_id, $client_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'client_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../client/form/client.tform.php'); + return $app->remoting_lib->getDataRecord($client_id); + } + + public function client_get_id($session_id, $sys_userid) + { + global $app; + if(!$this->checkPerm($session_id, 'client_get_id')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + $sys_userid = intval($sys_userid); + + $rec = $app->db->queryOneRecord("SELECT client_id FROM sys_user WHERE userid = ".$sys_userid); + if(isset($rec['client_id'])) { + return intval($rec['client_id']); + } else { + $this->server->fault('no_client_found', 'There is no sysuser account for this client ID.'); + return false; + } + + } + + + public function client_add($session_id, $reseller_id, $params) + { + if (!$this->checkPerm($session_id, 'client_add')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->klientadd('../client/form/client.tform.php',$reseller_id, $params); + return $affected_rows; + + } + + public function client_update($session_id, $client_id, $reseller_id, $params) + { + global $app; + + if (!$this->checkPerm($session_id, 'client_update')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../client/form/client.tform.php', $client_id, $reseller_id, $params); + + $app->remoting_lib->ispconfig_sysuser_update($params,$client_id); + + return $affected_rows; + } + + + public function client_delete($session_id,$client_id) + { + global $app; + + if (!$this->checkPerm($session_id, 'client_delete')) + { + $this->server->fault('permission_denied','You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../client/form/client.tform.php',$client_id); + + $app->remoting_lib->ispconfig_sysuser_delete($client_id); + + return $affected_rows; + } + + // Website functions --------------------------------------------------------------------------------------- + + //* Get cron details + public function sites_cron_get($session_id, $cron_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'sites_cron_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../sites/form/cron.tform.php'); + return $app->remoting_lib->getDataRecord($cron_id); + } + + //* Add a cron record + public function sites_cron_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_cron_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../sites/form/cron.tform.php',$client_id,$params); + } + + //* Update cron record + public function sites_cron_update($session_id, $client_id, $cron_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_cron_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../sites/form/cron.tform.php',$client_id,$cron_id,$params); + return $affected_rows; + } + + //* Delete cron record + public function sites_cron_delete($session_id, $cron_id) + { + if(!$this->checkPerm($session_id, 'sites_cron_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../sites/form/cron.tform.php',$cron_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------- + + //* Get record details + public function sites_database_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'sites_database_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../sites/form/database.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function sites_database_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_database_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../sites/form/database.tform.php',$client_id,$params); + } + + //* Update a record + public function sites_database_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_database_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../sites/form/database.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function sites_database_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'sites_database_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../sites/form/database.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------- + + //* Get record details + public function sites_ftp_user_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'sites_ftp_user_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../sites/form/ftp_user.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function sites_ftp_user_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_ftp_user_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../sites/form/ftp_user.tform.php',$client_id,$params); + } + + //* Update a record + public function sites_ftp_user_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_ftp_user_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../sites/form/ftp_user.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function sites_ftp_user_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'sites_ftp_user_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../sites/form/ftp_user.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------- + + //* Get record details + public function sites_shell_user_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'sites_shell_user_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../sites/form/shell_user.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function sites_shell_user_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_shell_user_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../sites/form/shell_user.tform.php',$client_id,$params); + } + + //* Update a record + public function sites_shell_user_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_shell_user_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../sites/form/shell_user.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function sites_shell_user_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'sites_shell_user_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../sites/form/shell_user.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------- + + //* Get record details + public function sites_web_domain_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'sites_web_domain_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../sites/form/web_domain.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function sites_web_domain_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_web_domain_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->insertQuery('../sites/form/web_domain.tform.php',$client_id,$params, 'sites:web_domain:on_after_insert'); + return $affected_rows; + } + + //* Update a record + public function sites_web_domain_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_web_domain_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../sites/form/web_domain.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function sites_web_domain_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'sites_web_domain_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../sites/form/web_domain.tform.php',$primary_id); + return $affected_rows; + } + + // ----------------------------------------------------------------------------------------------- + + //* Get record details + public function sites_web_aliasdomain_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../sites/form/web_aliasdomain.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function sites_web_aliasdomain_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../sites/form/web_aliasdomain.tform.php',$client_id,$params); + } + + //* Update a record + public function sites_web_aliasdomain_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../sites/form/web_aliasdomain.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function sites_web_aliasdomain_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../sites/form/web_aliasdomain.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------- + + //* Get record details + public function sites_web_subdomain_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'sites_web_subdomain_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../sites/form/web_subdomain.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function sites_web_subdomain_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_web_subdomain_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../sites/form/web_subdomain.tform.php',$client_id,$params); + } + + //* Update a record + public function sites_web_subdomain_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'sites_web_subdomain_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../sites/form/web_subdomain.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function sites_web_subdomain_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'sites_web_subdomain_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../sites/form/web_subdomain.tform.php',$primary_id); + return $affected_rows; + } + + + // DNS Function -------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_zone_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_zone_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_soa.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function dns_zone_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_zone_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../dns/form/dns_soa.tform.php',$client_id,$params); + } + + //* Update a record + public function dns_zone_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_zone_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../dns/form/dns_soa.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function dns_zone_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'dns_zone_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../dns/form/dns_soa.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_aaaa_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_aaaa_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_aaaa.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function dns_aaaa_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_aaaa_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../dns/form/dns_aaaa.tform.php',$client_id,$params); + } + + //* Update a record + public function dns_aaaa_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_aaaa_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../dns/form/dns_aaaa.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function dns_aaaa_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'dns_aaaa_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../dns/form/dns_aaaa.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_a_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_a_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_a.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function dns_a_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_a_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../dns/form/dns_a.tform.php',$client_id,$params); + } + + //* Update a record + public function dns_a_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_a_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../dns/form/dns_a.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function dns_a_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'dns_a_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../dns/form/dns_a.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_alias_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_alias_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_alias.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function dns_alias_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_alias_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../dns/form/dns_alias.tform.php',$client_id,$params); + } + + //* Update a record + public function dns_alias_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_alias_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../dns/form/dns_alias.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function dns_alias_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'dns_alias_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../dns/form/dns_alias.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_cname_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_cname_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_cname.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function dns_cname_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_cname_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../dns/form/dns_cname.tform.php',$client_id,$params); + } + + //* Update a record + public function dns_cname_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_cname_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../dns/form/dns_cname.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function dns_cname_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'dns_cname_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../dns/form/dns_cname.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_hinfo_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_hinfo_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_hinfo.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function dns_hinfo_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_hinfo_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../dns/form/dns_hinfo.tform.php',$client_id,$params); + } + + //* Update a record + public function dns_hinfo_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_hinfo_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../dns/form/dns_hinfo.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function dns_hinfo_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'dns_hinfo_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../dns/form/dns_hinfo.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_mx_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_mx_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_mx.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function dns_mx_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_mx_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../dns/form/dns_mx.tform.php',$client_id,$params); + } + + //* Update a record + public function dns_mx_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_mx_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../dns/form/dns_mx.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function dns_mx_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'dns_mx_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../dns/form/dns_mx.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_ns_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_ns_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_ns.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function dns_ns_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_ns_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../dns/form/dns_ns.tform.php',$client_id,$params); + } + + //* Update a record + public function dns_ns_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_ns_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../dns/form/dns_ns.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function dns_ns_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'dns_ns_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../dns/form/dns_ns.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_ptr_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_ptr_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_ptr.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function dns_ptr_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_ptr_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../dns/form/dns_ptr.tform.php',$client_id,$params); + } + + //* Update a record + public function dns_ptr_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_ptr_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../dns/form/dns_ptr.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function dns_ptr_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'dns_ptr_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../dns/form/dns_ptr.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_rp_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_rp_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_rp.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function dns_rp_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_rp_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../dns/form/dns_rp.tform.php',$client_id,$params); + } + + //* Update a record + public function dns_rp_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_rp_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../dns/form/dns_rp.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function dns_rp_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'dns_rp_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../dns/form/dns_rp.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_srv_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_srv_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_srv.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function dns_srv_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_srv_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../dns/form/dns_srv.tform.php',$client_id,$params); + } + + //* Update a record + public function dns_srv_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_srv_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../dns/form/dns_srv.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function dns_srv_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'dns_srv_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../dns/form/dns_srv.tform.php',$primary_id); + return $affected_rows; + } + + // ---------------------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_txt_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_txt_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_txt.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a record + public function dns_txt_add($session_id, $client_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_txt_add')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->insertQuery('../dns/form/dns_txt.tform.php',$client_id,$params); + } + + //* Update a record + public function dns_txt_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'dns_txt_update')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->updateQuery('../dns/form/dns_txt.tform.php',$client_id,$primary_id,$params); + return $affected_rows; + } + + //* Delete a record + public function dns_txt_delete($session_id, $primary_id) + { + if(!$this->checkPerm($session_id, 'dns_txt_delete')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $affected_rows = $this->deleteQuery('../dns/form/dns_txt.tform.php',$primary_id); + return $affected_rows; + } + + + + + + + + + + + + + + //** private functions ----------------------------------------------------------------------------------- + + + + + private function klientadd($formdef_file, $reseller_id, $params) + { + global $app, $tform, $remoting_lib; + $app->uses('remoting_lib'); + + //* Load the form definition + $app->remoting_lib->loadFormDef($formdef_file); + + //* load the user profile of the client + $app->remoting_lib->loadUserProfile($reseller_id); + + //* load the client template + if(isset($params['template_master']) and $params['template_master'] > 0) + { + $template=$app->db->queryOneRecord("SELECT * FROM client_template WHERE template_id=".intval($params['template_master'])); + $params=array_merge($params,$template); + } + + //* Get the SQL query + $sql = $app->remoting_lib->getSQL($params,'INSERT',0); + if($app->remoting_lib->errorMessage != '') { + $this->server->fault('data_processing_error', $app->remoting_lib->errorMessage); + return false; + } + + $app->db->query($sql); + + if($app->db->errorMessage != '') { + $this->server->fault('database_error', $app->db->errorMessage . ' '.$sql); + return false; + } + + + + $insert_id = $app->db->insertID(); + //$app->uses('tform'); + //* Save changes to Datalog + if($app->remoting_lib->formDef["db_history"] == 'yes') { + $new_rec = $app->remoting_lib->getDataRecord($insert_id); + $app->remoting_lib->datalogSave('INSERT',$primary_id,array(),$new_rec); + $app->remoting_lib->ispconfig_sysuser_add($params,$insert_id); + } + return $insert_id; + } + + private function insertQuery($formdef_file, $client_id, $params,$event_identifier = '') + { + global $app, $tform, $remoting_lib; + + $app->uses('remoting_lib'); + + //* load the user profile of the client + $app->remoting_lib->loadUserProfile($client_id); + + //* Load the form definition + $app->remoting_lib->loadFormDef($formdef_file); + + //* Get the SQL query + $sql = $app->remoting_lib->getSQL($params,'INSERT',0); + if($app->remoting_lib->errorMessage != '') { + $this->server->fault('data_processing_error', $app->remoting_lib->errorMessage); + return false; + } + + $app->db->query($sql); + + if($app->db->errorMessage != '') { + $this->server->fault('database_error', $app->db->errorMessage . ' '.$sql); + return false; + } + + $insert_id = $app->db->insertID(); + + // set a few values for compatibility with tform actions, mostly used by plugins + $this->id = $insert_id; + $this->dataRecord = $params; + + if($event_identifier != '') $app->plugin->raiseEvent($event_identifier,$this); + + //$app->uses('tform'); + //* Save changes to Datalog + if($app->remoting_lib->formDef["db_history"] == 'yes') { + $new_rec = $app->remoting_lib->getDataRecord($insert_id); + $app->remoting_lib->datalogSave('INSERT',$primary_id,array(),$new_rec); + } + return $insert_id; + } + + + private function updateQuery($formdef_file, $client_id, $primary_id, $params, $event_identifier = '') + { + global $app; + + $app->uses('remoting_lib'); + + //* load the user profile of the client + $app->remoting_lib->loadUserProfile($client_id); + + //* Load the form definition + $app->remoting_lib->loadFormDef($formdef_file); + + //* Get the SQL query + $sql = $app->remoting_lib->getSQL($params,'UPDATE',$primary_id); + if($app->remoting_lib->errorMessage != '') { + $this->server->fault('data_processing_error', $app->remoting_lib->errorMessage); + return false; + } + + $old_rec = $app->remoting_lib->getDataRecord($primary_id); + + // set a few values for compatibility with tform actions, mostly used by plugins + $this->oldDataRecord = $old_rec; + $this->id = $primary_id; + $this->dataRecord = $params; + + $app->db->query($sql); + + if($app->db->errorMessage != '') { + $this->server->fault('database_error', $app->db->errorMessage . ' '.$sql); + return false; + } + + $affected_rows = $app->db->affectedRows(); + + if($event_identifier != '') $app->plugin->raiseEvent($event_identifier,$this); + + //* Save changes to Datalog + if($app->remoting_lib->formDef["db_history"] == 'yes') { + $new_rec = $app->remoting_lib->getDataRecord($primary_id); + $app->remoting_lib->datalogSave('UPDATE',$primary_id,$old_rec,$new_rec); + } + + return $affected_rows; + } + + private function deleteQuery($formdef_file, $primary_id) + { + global $app; + + $app->uses('remoting_lib'); + + //* load the user profile of the client + $app->remoting_lib->loadUserProfile(0); + + //* Load the form definition + $app->remoting_lib->loadFormDef($formdef_file); + + $old_rec = $app->remoting_lib->getDataRecord($primary_id); + + // set a few values for compatibility with tform actions, mostly used by plugins + $this->oldDataRecord = $old_rec; + $this->id = $primary_id; + $this->dataRecord = $params; + + //* Get the SQL query + $sql = $app->remoting_lib->getDeleteSQL($primary_id); + + $app->db->query($sql); + + if($app->db->errorMessage != '') { + $this->server->fault('database_error', $app->db->errorMessage . ' '.$sql); + return false; + } + + $affected_rows = $app->db->affectedRows(); + + //* Save changes to Datalog + if($app->remoting_lib->formDef["db_history"] == 'yes') { + $app->remoting_lib->datalogSave('DELETE',$primary_id,$old_rec,array()); + } + + + return $affected_rows; + } + + + private function checkPerm($session_id, $function_name) + { + $dobre=array(); + $session = $this->getSession($session_id); + if(!$session){ + return false; + } + + $dobre= str_replace(';',',',$session['remote_functions']); + return in_array($function_name, explode(',', $dobre) ); + } + + + private function getSession($session_id) + { + global $app; + + if(empty($session_id)) { + $this->server->fault('session_id_empty','The SessionID is empty.'); + return false; + } + + $session_id = $app->db->quote($session_id); + + $now = time(); + $sql = "SELECT * FROM remote_session WHERE remote_session = '$session_id' AND tstamp >= $now"; + $session = $app->db->queryOneRecord($sql); + if($session['remote_userid'] > 0) { + return $session; + } else { + $this->server->fault('session_does_not_exist','The Session is expired or does not exist.'); + return false; + } + } + + //--- + + + /** + * Gets sites by $sys_userid & $sys_groupid + * @param int session id + * @param int user id + * @param array list of groups + * @return mixed array with sites by user + * @author Julio Montoya BeezNest 2010 + */ + public function client_get_sites_by_user($session_id, $sys_userid, $sys_groupid) { + global $app; + if(!$this->checkPerm($session_id, 'client_get_sites_by_user')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $sys_userid = intval($sys_userid); + $sys_groupid = explode(',', $sys_groupid); + $new_group = array(); + foreach($sys_groupid as $group_id) { + $new_group[] = intval( $group_id); + } + $group_list = implode(',', $new_group); + $sql ="SELECT domain, domain_id, document_root, active FROM web_domain WHERE ( (sys_userid = $sys_userid AND sys_perm_user LIKE '%r%') OR (sys_groupid IN ($group_list) AND sys_perm_group LIKE '%r%') OR sys_perm_other LIKE '%r%') AND type = 'vhost'"; + $result = $app->db->queryAllRecords($sql); + if(isset($result)) { + return $result; + } else { + $this->server->fault('no_client_found', 'There is no site for this user'); + return false; + } + } + + /** + * Change domains status + * @param int session id + * @param int site id + * @param string active or inactive string + * @return mixed false if error + * @author Julio Montoya BeezNest 2010 + */ + + public function sites_web_domain_set_status($session_id, $primary_id, $status) { + global $app; + if(!$this->checkPerm($session_id, 'sites_web_domain_set_status')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + if(in_array($status, array('active', 'inactive'))) { + if ($status == 'active') { + $status = 'y'; + } else { + $status = 'n'; + } + $sql = "UPDATE web_domain SET active = '$status' WHERE domain_id = ".intval($primary_id); + $app->db->query($sql); + $result = $app->db->affectedRows(); + return $result; + } else { + $this->server->fault('status_undefined', 'The status is not available'); + return false; + } + } + + /** + * Get sys_user information by username + * @param int session id + * @param string user's name + * @return mixed false if error + * @author Julio Montoya BeezNest 2010 + */ + public function client_get_by_username($session_id, $username) { + global $app; + if(!$this->checkPerm($session_id, 'client_get_by_username')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $username = $app->db->quote($username); + $rec = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE username = '".$username."'"); + if (isset($rec)) { + return $rec; + } else { + $this->server->fault('no_client_found', 'There is no user account for this user name.'); + return false; + } + } + + /** + * Changes client password + * + * @param int session id + * @param int client id + * @param string new password + * @return bool true if success + * @author Julio Montoya BeezNest 2010 + * + */ + public function client_change_password($session_id, $client_id, $new_password) { + global $app; + + if(!$this->checkPerm($session_id, 'client_change_password')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $client_id = intval($client_id); + $client = $app->db->queryOneRecord("SELECT client_id FROM client WHERE client_id = ".$client_id); + if($client['client_id'] > 0) { + $new_password = $app->db->quote($new_password); + $sql = "UPDATE client SET password = md5('".($new_password)."') WHERE client_id = ".$client_id; + $app->db->query($sql); + $sql = "UPDATE sys_user SET passwort = md5('".($new_password)."') WHERE client_id = ".$client_id; + $app->db->query($sql); + return true; + } else { + $this->server->fault('no_client_found', 'There is no user account for this client_id'); + return false; + } + } + + public function mail_domain_get_by_domain($session_id, $domain) { + global $app; + if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + if (!empty($domain_id)) { + $domain = $app->db->quote($domain); + $sql = "SELECT * FROM mail_domain WHERE domain = $domain"; + $result = $app->db->queryAllRecords($sql); + return $result; + } + return false; + } + + + + /** + * Get a list of functions + * @param int session id + * @return mixed array of the available functions + * @author Julio Montoya BeezNest 2010 + */ + public function get_function_list($session_id) + { + if(!$this->checkPerm($session_id, 'get_function_list')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return get_class_methods($this); + } + + /** + * Get all databases by user + * @author Julio Montoya BeezNest 2010 + */ + public function sites_database_get_all_by_user($session_id, $client_id) + { + global $app; + if(!$this->checkPerm($session_id, 'sites_database_get_all_by_user')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $client_id = intval($client_id); + $sql = "SELECT database_id, database_name, database_user, database_password FROM web_database WHERE sys_userid = $client_id "; + $all = $app->db->queryAllRecords($sql); + return $all; + } + + /** + * Get all client templates + * @param int session id + * @author Julio Montoya BeezNest 2010 + */ + public function client_templates_get_all($session_id) { + global $app; + if(!$this->checkPerm($session_id, 'client_templates_get_all')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $sql = "SELECT * FROM client_template"; + $result = $app->db->queryAllRecords($sql); + return $result; + } + + /** + * Get all DNS zone by user + *@author Julio Montoya BeezNest 2010 + */ + public function dns_zone_get_by_user($session_id, $client_id, $server_id) { + global $app; + if(!$this->checkPerm($session_id, 'dns_zone_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + if (!empty($client_id) && !empty($server_id)) { + $server_id = intval($server_id); + $client_id = intval($client_id); + $sql = "SELECT id, origin FROM dns_soa d INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id AND server_id = $server_id"; + $result = $app->db->queryAllRecords($sql); + return $result; + } + return false; + } + + + /** + * Changes DNS zone status + * @param int session id + * @param int dns soa id + * @param string status active or inactive string + * @author Julio Montoya BeezNest 2010 + */ + + public function dns_zone_set_status($session_id, $primary_id, $status) { + global $app; + if(!$this->checkPerm($session_id, 'dns_zone_set_status')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + if(in_array($status, array('active', 'inactive'))) { + if ($status == 'active') { + $status = 'Y'; + } else { + $status = 'N'; + } + $sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".intval($primary_id); + $app->db->query($sql); + $result = $app->db->affectedRows(); + return $result; + } else { + $this->server->fault('status_undefined', 'The status is not available'); + return false; + } + } + + public function mail_domain_set_status($session_id, $primary_id, $status) { + global $app; + if(!$this->checkPerm($session_id, 'mail_domain_set_status')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + if(in_array($status, array('active', 'inactive'))) { + if ($status == 'active') { + $status = 'y'; + } else { + $status = 'n'; + } + $sql = "UPDATE mail_domain SET active = '$status' WHERE domain_id = ".intval($primary_id); + $app->db->query($sql); + $result = $app->db->affectedRows(); + return $result; + } else { + $this->server->fault('status_undefined', 'The status is not available'); + return false; + } + } +} ?> \ No newline at end of file diff --git a/interface/web/admin/form/remote_user.tform.php b/interface/web/admin/form/remote_user.tform.php index 9f6bcce954fab52a673978dc8ddd8d8872f5f3ca..d495a813234b1fb6ed13ffecef3173cd2e7edbb6 100644 --- a/interface/web/admin/form/remote_user.tform.php +++ b/interface/web/admin/form/remote_user.tform.php @@ -1,161 +1,162 @@ - 0 id must match with id of current user -$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user -$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete - -$form["tabs"]['remote_user'] = array ( - 'title' => "Remote User", - 'width' => 100, - 'template' => "templates/remote_user_edit.htm", - 'fields' => array ( - ################################## - # Begin Datatable fields - ################################## - 'remote_userid' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT remote_userid,remote_username FROM remote_user WHERE {AUTHSQL} ORDER BY remote_username', - 'keyfield'=> 'remote_userid', - 'valuefield'=> 'remote_username' - ), - 'value' => '' - ), - - 'remote_username' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'UNIQUE', - 'errmsg'=> 'username_error_unique'), - 1 => array ( 'type' => 'REGEX', - 'regex' => '/^[\w\.\-]{0,64}$/', - 'errmsg'=> 'username_error_regex'), -2 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'username_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'remote_password' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'PASSWORD', - 'encryption' => 'MD5', - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'remote_functions' => array ( - 'datatype' => 'TEXT', - 'formtype' => 'CHECKBOXARRAY', - 'regex' => '', - 'errmsg' => '', - 'default' => '', - 'value' => $function_list, - 'separator' => ';', - 'width' => '', - 'maxlength' => '', - 'rows' => '5', - 'cols' => '30' - ) - - ################################## - # ENDE Datatable fields - ################################## - ) -); - - - - - -?> + 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete + +$form["tabs"]['remote_user'] = array ( + 'title' => "Remote User", + 'width' => 100, + 'template' => "templates/remote_user_edit.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'remote_userid' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT remote_userid,remote_username FROM remote_user WHERE {AUTHSQL} ORDER BY remote_username', + 'keyfield'=> 'remote_userid', + 'valuefield'=> 'remote_username' + ), + 'value' => '' + ), + + 'remote_username' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'UNIQUE', + 'errmsg'=> 'username_error_unique'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^[\w\.\-]{0,64}$/', + 'errmsg'=> 'username_error_regex'), +2 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'username_error_empty'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'remote_password' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'PASSWORD', + 'encryption' => 'MD5', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'remote_functions' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'CHECKBOXARRAY', + 'regex' => '', + 'errmsg' => '', + 'default' => '', + 'value' => $function_list, + 'separator' => ';', + 'width' => '', + 'maxlength' => '', + 'rows' => '5', + 'cols' => '30' + ) + + ################################## + # ENDE Datatable fields + ################################## + ) +); + + + + + +?> diff --git a/interface/web/admin/form/system_config.tform.php b/interface/web/admin/form/system_config.tform.php index db43fc81870cf0cd60995efc6ff005a4d8fb724c..7c080ccbdfbff7fac4de2c6ffe84eec1f960d41e 100644 --- a/interface/web/admin/form/system_config.tform.php +++ b/interface/web/admin/form/system_config.tform.php @@ -1,252 +1,270 @@ - 0 id must match with id of current user -$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user -$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete - -$form["tabs"]['sites'] = array ( - 'title' => "Sites", - 'width' => 70, - 'template' => "templates/system_config_sites_edit.htm", - 'fields' => array ( - ################################## - # Begin Datatable fields - ################################## - 'dbname_prefix' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/', - 'errmsg'=> 'dbname_prefix_error_regex'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'dbuser_prefix' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/', - 'errmsg'=> 'dbuser_prefix_error_regex'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'ftpuser_prefix' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/', - 'errmsg'=> 'ftpuser_prefix_error_regex'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'shelluser_prefix' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/', - 'errmsg'=> 'shelluser_prefix_error_regex'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'webdavuser_prefix' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/', - 'errmsg'=> 'webdavuser_prefix_error_regex'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'dblist_phpmyadmin_link' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n',1 => 'y') - ), - 'phpmyadmin_url' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/', - 'errmsg'=> 'phpmyadmin_url_error_regex'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'webftp_url' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/', - 'errmsg'=> 'webftp_url_error_regex'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - ################################## - # ENDE Datatable fields - ################################## - ) -); - -$form["tabs"]['mail'] = array ( - 'title' => "Mail", - 'width' => 70, - 'template' => "templates/system_config_mail_edit.htm", - 'fields' => array ( - ################################## - # Begin Datatable fields - ################################## - 'mailboxlist_webmail_link' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n',1 => 'y') - ), - 'webmail_url' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/', - 'errmsg'=> 'webmail_url_error_regex'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'admin_mail' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'admin_name' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - ################################## - # ENDE Datatable fields - ################################## - ) -); - -$form["tabs"]['domains'] = array ( - 'title' => "Domains", - 'width' => 70, - 'template' => "templates/system_config_domains_edit.htm", - 'fields' => array ( - ################################## - # Begin Datatable fields - ################################## - 'use_domain_module' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n',1 => 'y') - ), - 'new_domain_html' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '' - ), - ################################## - # ENDE Datatable fields - ################################## - ) -); - -$form["tabs"]['misc'] = array ( - 'title' => "Misc", - 'width' => 70, - 'template' => "templates/system_config_misc_edit.htm", - 'fields' => array ( - ################################## - # Begin Datatable fields - ################################## - 'dashboard_atom_url' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => 'http://www.ispconfig.org/atom', - 'value' => '' - ), - ################################## - # ENDE Datatable fields - ################################## - ) -); - - -?> + 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete + +$form["tabs"]['sites'] = array ( + 'title' => "Sites", + 'width' => 70, + 'template' => "templates/system_config_sites_edit.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'dbname_prefix' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/', + 'errmsg'=> 'dbname_prefix_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'dbuser_prefix' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/', + 'errmsg'=> 'dbuser_prefix_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'ftpuser_prefix' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/', + 'errmsg'=> 'ftpuser_prefix_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'shelluser_prefix' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/', + 'errmsg'=> 'shelluser_prefix_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'webdavuser_prefix' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/', + 'errmsg'=> 'webdavuser_prefix_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'dblist_phpmyadmin_link' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n',1 => 'y') + ), + 'phpmyadmin_url' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/', + 'errmsg'=> 'phpmyadmin_url_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'webftp_url' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/', + 'errmsg'=> 'webftp_url_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); + +$form["tabs"]['mail'] = array ( + 'title' => "Mail", + 'width' => 70, + 'template' => "templates/system_config_mail_edit.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'mailboxlist_webmail_link' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n',1 => 'y') + ), + 'webmail_url' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/', + 'errmsg'=> 'webmail_url_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'mailmailinglist_link' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n',1 => 'y') + ), + 'mailmailinglist_url' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/', + 'errmsg'=> 'mailinglist_url_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'admin_mail' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'admin_name' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); + +$form["tabs"]['domains'] = array ( + 'title' => "Domains", + 'width' => 70, + 'template' => "templates/system_config_domains_edit.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'use_domain_module' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n',1 => 'y') + ), + 'new_domain_html' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '' + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); + +$form["tabs"]['misc'] = array ( + 'title' => "Misc", + 'width' => 70, + 'template' => "templates/system_config_misc_edit.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'dashboard_atom_url' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => 'http://www.ispconfig.org/atom', + 'value' => '' + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); + + +?> diff --git a/interface/web/admin/lib/lang/en_remote_user.lng b/interface/web/admin/lib/lang/en_remote_user.lng index cc9335bc52638b05b2a4419cbb6415daebbca52e..3a47fbfca3172679ef7894dc10ccbdfcc3e15557 100644 --- a/interface/web/admin/lib/lang/en_remote_user.lng +++ b/interface/web/admin/lib/lang/en_remote_user.lng @@ -7,6 +7,7 @@ $wb['username_error_empty'] = 'Username cannot be empty'; $wb['password_error_empty'] = 'Password cannot be empty'; $wb['password_strength_txt'] = 'Password Strength:'; $wb['Mail domain functions'] = 'Mail domain functions'; +$wb['Mail mailing list functions'] = 'Mail mailinglist functions'; $wb['Mail user functions'] = 'Mail user functions'; $wb['Mail alias functions'] = 'Mail alias functions'; $wb['Mail forward functions'] = 'Mail forward functions'; diff --git a/interface/web/admin/lib/lang/en_system_config.lng b/interface/web/admin/lib/lang/en_system_config.lng index 3ccc8245ba5d9c3ccf81cd64d4319112143c8ff7..c096e12fbf9b844e99a1b5e2f45f611391726548 100644 --- a/interface/web/admin/lib/lang/en_system_config.lng +++ b/interface/web/admin/lib/lang/en_system_config.lng @@ -14,6 +14,8 @@ $wb["webdavuser_prefix_error_regex"] = 'Char not allowed in webdav user prefix.' $wb["dblist_phpmyadmin_link_txt"] = 'Link to phpmyadmin in DB list'; $wb["mailboxlist_webmail_link_txt"] = 'Link to webmail in Mailbox list'; $wb["webmail_url_txt"] = 'Webmail URL'; +$wb["mailmailinglist_link_txt"] = 'Link to mailing list in Mailing list list'; +$wb["mailmailinglist_url_txt"] = 'Mailing list URL'; $wb["phpmyadmin_url_txt"] = 'PHPMyAdmin URL'; $wb["use_domain_module_txt"] = 'Use the domain-module to add new domains'; $wb["use_domain_module_hint"] = 'If you use this module, your customers can only select one of the domains the admin creates for them. They cannot free edit the domain-field.You have to re-login after changing this value, to make the changes visible.'; diff --git a/interface/web/admin/templates/system_config_mail_edit.htm b/interface/web/admin/templates/system_config_mail_edit.htm index 41ba4cd0520542f8f7f0b5b89e0934e8d60ce325..c728404d7abe5ef42002f74ca710e13b6ad43ee9 100644 --- a/interface/web/admin/templates/system_config_mail_edit.htm +++ b/interface/web/admin/templates/system_config_mail_edit.htm @@ -15,6 +15,16 @@ +
+

{tmpl_var name='mailmailinglist_link_txt'}

+
+ {tmpl_var name='mailmailinglist_link'} +
+
+
+ + +
diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php index 2b832aaa7ee1203054a2c61dfed0e52afb6e234a..61daec17598946c20721d30b25c69303829e8642 100644 --- a/interface/web/client/form/client.tform.php +++ b/interface/web/client/form/client.tform.php @@ -1,846 +1,860 @@ - 0 id must match with id of current user -$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user -$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete - -//* Languages -$language_list = array(); -$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); -while ($file = @readdir ($handle)) { - if ($file != '.' && $file != '..') { - if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') { - $tmp = substr($file, 0, 2); - $language_list[$tmp] = $tmp; - } - } -} - -//* Load themes -$themes_list = array(); -$handle = @opendir(ISPC_THEMES_PATH); -while ($file = @readdir ($handle)) { - if (substr($file, 0, 1) != '.') { - if(@is_dir(ISPC_THEMES_PATH."/$file")) { - $themes_list[$file] = $file; - } - } -} - -$form["tabs"]['address'] = array ( - 'title' => "Address", - 'width' => 100, - 'template' => "templates/client_edit_address.htm", - 'fields' => array ( - ################################## - # Begin Datatable fields - ################################## - 'company_name' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'contact_name' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'contact_error_empty'), - ), - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'customer_no' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'username' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'username_error_empty'), - 1 => array ( 'type' => 'CUSTOM', - 'class' => 'validate_client', - 'function' => 'username_unique', - 'errmsg'=> 'username_error_unique'), - 2 => array ( 'type' => 'REGEX', - 'regex' => '/^[\w\.\-\_]{0,64}$/', - 'errmsg'=> 'username_error_regex'), - ), - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'password' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'PASSWORD', - 'encryption'=> 'CRYPT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'language' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'default' => $conf["language"], - 'value' => $language_list, - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'usertheme' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'default' => 'default', - 'value' => $themes_list, - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'street' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'zip' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'city' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'state' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'country' => array ( - 'datatype' => 'VARCHAR', - - 'formtype' => 'SELECT', - 'default' => 'DE', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name', - 'keyfield'=> 'iso', - 'valuefield'=> 'printable_name' - ), - 'value' => '' - ), - 'telephone' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'mobile' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'fax' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'email' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'internet' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => 'http://', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'icq' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'vat_id' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'company_id' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '20', - 'rows' => '', - 'cols' => '' - ), - 'notes' => array ( - 'datatype' => 'TEXT', - 'formtype' => 'TEXTAREA', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '', - 'maxlength' => '', - 'rows' => '10', - 'cols' => '30' - ), - ################################## - # END Datatable fields - ################################## - ) -); - -$form["tabs"]['limits'] = array ( - 'title' => "Limits", - 'width' => 80, - 'template' => "templates/client_edit_limits.htm", - 'fields' => array ( - ################################## - # Begin Datatable fields - ################################## - 'template_master' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'CUSTOM', - 'class'=> 'custom_datasource', - 'function'=> 'master_templates' - ), - 'value' => '' - ), - 'template_additional' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - ), - 'default_mailserver' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'CUSTOM', - 'class'=> 'custom_datasource', - 'function'=> 'client_servers' - ), - 'value' => '', - 'name' => 'default_mailserver' - ), - 'limit_maildomain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_maildomain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailbox' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailbox_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailalias' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailalias_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailaliasdomain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailaliasdomain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailforward' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailforward_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailcatchall' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailcatchall_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailrouting' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailrouting_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailfilter' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailfilter_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_fetchmail' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailfetchmail_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailquota' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailquota_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_spamfilter_wblist' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_spamfilter_wblist_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_spamfilter_user' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_spamfilter_user_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_spamfilter_policy' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_spamfilter_policy_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'default_webserver' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'CUSTOM', - 'class'=> 'custom_datasource', - 'function'=> 'client_servers' - ), - 'value' => '', - 'name' => 'default_webserver' - ), - 'limit_web_domain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_web_domain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_web_quota' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_web_quota_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'web_php_options' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOXARRAY', - 'default' => '', - 'separator' => ',', - 'valuelimit' => 'client:web_php_options', - 'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP') - ), - 'limit_web_aliasdomain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_web_aliasdomain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_web_subdomain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_web_subdomain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_ftp_user' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_ftp_user_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_shell_user' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_shell_user_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'ssh_chroot' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOXARRAY', - 'default' => '', - 'separator' => ',', - 'valuelimit' => 'client:ssh_chroot', - 'value' => array('no' => 'None', 'jailkit' => 'Jailkit') - ), - 'limit_webdav_user' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_webdav_user_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'default_dnsserver' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'CUSTOM', - 'class'=> 'custom_datasource', - 'function'=> 'client_servers' - ), - 'value' => '', - 'name' => 'default_dnsserver' - ), - 'limit_dns_zone' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_dns_zone_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_dns_slave_zone' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_dns_slave_zone_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_dns_record' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_dns_record_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_client' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_client_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'default_dbserver' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'CUSTOM', - 'class'=> 'custom_datasource', - 'function'=> 'client_servers' - ), - 'value' => '', - 'name' => 'default_dbserver' - ), - 'limit_database' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_database_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_cron' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_cron_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_cron_type' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'default' => '', - 'value' => array('full' => 'Full Cron','chrooted' => 'Chrooted Cron','url' => 'URL Cron') - ), - 'limit_cron_frequency' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_cron_error_frequency'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_traffic_quota' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_traffic_quota_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - ################################## - # END Datatable fields - ################################## - ) -); - -/* -$form["tabs"]['ipaddress'] = array ( - 'title' => "IP Addresses", - 'width' => 100, - 'template' => "templates/client_edit_ipaddress.htm", - 'fields' => array ( - ################################## - # Beginn Datatable fields - ################################## - 'ip_address' => array ( - 'datatype' => 'TEXT', - 'formtype' => 'CHECKBOXARRAY', - 'default' => '', - 'value' => array('192.168.0.1' => '192.168.0.1', '192.168.0.2' => '192.168.0.2'), - 'separator' => ';' - ), - ################################## - # ENDE Datatable fields - ################################## - ) -); -*/ - - -?> + 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete + +//* Languages +$language_list = array(); +$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); +while ($file = @readdir ($handle)) { + if ($file != '.' && $file != '..') { + if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') { + $tmp = substr($file, 0, 2); + $language_list[$tmp] = $tmp; + } + } +} + +//* Load themes +$themes_list = array(); +$handle = @opendir(ISPC_THEMES_PATH); +while ($file = @readdir ($handle)) { + if (substr($file, 0, 1) != '.') { + if(@is_dir(ISPC_THEMES_PATH."/$file")) { + $themes_list[$file] = $file; + } + } +} + +$form["tabs"]['address'] = array ( + 'title' => "Address", + 'width' => 100, + 'template' => "templates/client_edit_address.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'company_name' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'contact_name' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'contact_error_empty'), + ), + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'customer_no' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'username' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'username_error_empty'), + 1 => array ( 'type' => 'CUSTOM', + 'class' => 'validate_client', + 'function' => 'username_unique', + 'errmsg'=> 'username_error_unique'), + 2 => array ( 'type' => 'REGEX', + 'regex' => '/^[\w\.\-\_]{0,64}$/', + 'errmsg'=> 'username_error_regex'), + ), + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'password' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'PASSWORD', + 'encryption'=> 'CRYPT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'language' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => $conf["language"], + 'value' => $language_list, + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'usertheme' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'default', + 'value' => $themes_list, + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'street' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'zip' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'city' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'state' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'country' => array ( + 'datatype' => 'VARCHAR', + + 'formtype' => 'SELECT', + 'default' => 'DE', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name', + 'keyfield'=> 'iso', + 'valuefield'=> 'printable_name' + ), + 'value' => '' + ), + 'telephone' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'mobile' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'fax' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'email' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'internet' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => 'http://', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'icq' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'vat_id' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'company_id' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '20', + 'rows' => '', + 'cols' => '' + ), + 'notes' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXTAREA', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '', + 'maxlength' => '', + 'rows' => '10', + 'cols' => '30' + ), + ################################## + # END Datatable fields + ################################## + ) +); + +$form["tabs"]['limits'] = array ( + 'title' => "Limits", + 'width' => 80, + 'template' => "templates/client_edit_limits.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'template_master' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'CUSTOM', + 'class'=> 'custom_datasource', + 'function'=> 'master_templates' + ), + 'value' => '' + ), + 'template_additional' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + ), + 'default_mailserver' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'CUSTOM', + 'class'=> 'custom_datasource', + 'function'=> 'client_servers' + ), + 'value' => '', + 'name' => 'default_mailserver' + ), + 'limit_maildomain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_maildomain_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailbox' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailbox_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailalias' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailalias_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailaliasdomain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailaliasdomain_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailmailinglist' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailmailinglist_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailforward' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailforward_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailcatchall' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailcatchall_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailrouting' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailrouting_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailfilter' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailfilter_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_fetchmail' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailfetchmail_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailquota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailquota_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_spamfilter_wblist' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_spamfilter_wblist_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_spamfilter_user' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_spamfilter_user_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_spamfilter_policy' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_spamfilter_policy_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'default_webserver' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'CUSTOM', + 'class'=> 'custom_datasource', + 'function'=> 'client_servers' + ), + 'value' => '', + 'name' => 'default_webserver' + ), + 'limit_web_domain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_domain_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_web_quota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_quota_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'web_php_options' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOXARRAY', + 'default' => '', + 'separator' => ',', + 'valuelimit' => 'client:web_php_options', + 'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP') + ), + 'limit_web_aliasdomain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_aliasdomain_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_web_subdomain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_subdomain_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_ftp_user' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_ftp_user_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_shell_user' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_shell_user_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'ssh_chroot' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOXARRAY', + 'default' => '', + 'separator' => ',', + 'valuelimit' => 'client:ssh_chroot', + 'value' => array('no' => 'None', 'jailkit' => 'Jailkit') + ), + 'limit_webdav_user' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_webdav_user_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'default_dnsserver' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'CUSTOM', + 'class'=> 'custom_datasource', + 'function'=> 'client_servers' + ), + 'value' => '', + 'name' => 'default_dnsserver' + ), + 'limit_dns_zone' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_dns_zone_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_dns_slave_zone' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_dns_slave_zone_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_dns_record' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_dns_record_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_client' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_client_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'default_dbserver' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'CUSTOM', + 'class'=> 'custom_datasource', + 'function'=> 'client_servers' + ), + 'value' => '', + 'name' => 'default_dbserver' + ), + 'limit_database' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_database_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_cron' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_cron_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_cron_type' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + 'value' => array('full' => 'Full Cron','chrooted' => 'Chrooted Cron','url' => 'URL Cron') + ), + 'limit_cron_frequency' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_cron_error_frequency'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_traffic_quota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_traffic_quota_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + ################################## + # END Datatable fields + ################################## + ) +); + +/* +$form["tabs"]['ipaddress'] = array ( + 'title' => "IP Addresses", + 'width' => 100, + 'template' => "templates/client_edit_ipaddress.htm", + 'fields' => array ( + ################################## + # Beginn Datatable fields + ################################## + 'ip_address' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'CHECKBOXARRAY', + 'default' => '', + 'value' => array('192.168.0.1' => '192.168.0.1', '192.168.0.2' => '192.168.0.2'), + 'separator' => ';' + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); +*/ + + +?> diff --git a/interface/web/client/form/client_template.tform.php b/interface/web/client/form/client_template.tform.php index 9e8fe607a57d5f04110ac8a43cda07dd28f60834..dc1627ce120e2f9526f228b686535fc1943a39e0 100644 --- a/interface/web/client/form/client_template.tform.php +++ b/interface/web/client/form/client_template.tform.php @@ -1,510 +1,524 @@ - 0 id must match with id of current user -$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user -$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete - -//* Languages -$language_list = array(); -$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); -while ($file = @readdir ($handle)) { - if ($file != '.' && $file != '..') { - if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') { - $tmp = substr($file, 0, 2); - $language_list[$tmp] = $tmp; - } - } -} - -$form["tabs"]['template'] = array ( - 'title' => "Template", - 'width' => 80, - 'template' => "templates/client_template_edit_template.htm", - 'fields' => array ( - ################################## - # Begin Datatable fields - ################################## - 'template_type' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'default' => 'm', - 'value' => array('m' => "Main Template",'a' => "Additional Template"), - ), - 'template_name' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'error_template_name_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - ################################## - # END Datatable fields - ################################## - ) -); - -$form["tabs"]['limits'] = array ( - 'title' => "Limits", - 'width' => 80, - 'template' => "templates/client_template_edit_limits.htm", - 'fields' => array ( - ################################## - # Begin Datatable fields - ################################## - 'limit_maildomain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_maildomain_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailbox' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailbox_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailalias' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailalias_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailaliasdomain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailaliasdomain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailforward' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailforward_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailcatchall' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailcatchall_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailrouting' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailrouting_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailfilter' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailfilter_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_fetchmail' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailfetchmail_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailquota' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailquota_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_spamfilter_wblist' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_spamfilter_wblist_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_spamfilter_user' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_spamfilter_user_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_spamfilter_policy' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_spamfilter_policy_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_web_domain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_web_domain_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_web_quota' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_web_quota_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_web_aliasdomain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_web_aliasdomain_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_web_subdomain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_web_subdomain_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_ftp_user' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_ftp_user_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_shell_user' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_shell_user_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_webdav_user' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_webdav_user_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_dns_zone' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_dns_zone_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_dns_slave_zone' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_dns_slave_zone_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_dns_record' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_dns_record_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - /* - 'limit_client' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_client_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - */ - 'limit_database' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_database_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_cron' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_cron_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_cron_type' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'default' => '', - 'value' => array('full' => 'Full Cron','chrooted' => 'Chrooted Cron','url' => 'URL Cron') - ), - 'limit_cron_frequency' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_cron_error_frequency'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_traffic_quota' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_traffic_quota_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - ################################## - # END Datatable fields - ################################## - ) -); - -?> + 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete + +//* Languages +$language_list = array(); +$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); +while ($file = @readdir ($handle)) { + if ($file != '.' && $file != '..') { + if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') { + $tmp = substr($file, 0, 2); + $language_list[$tmp] = $tmp; + } + } +} + +$form["tabs"]['template'] = array ( + 'title' => "Template", + 'width' => 80, + 'template' => "templates/client_template_edit_template.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'template_type' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'm', + 'value' => array('m' => "Main Template",'a' => "Additional Template"), + ), + 'template_name' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'error_template_name_empty'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + ################################## + # END Datatable fields + ################################## + ) +); + +$form["tabs"]['limits'] = array ( + 'title' => "Limits", + 'width' => 80, + 'template' => "templates/client_template_edit_limits.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'limit_maildomain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_maildomain_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailbox' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailbox_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailalias' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailalias_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailaliasdomain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailaliasdomain_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailmailinglist' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailmailinglist_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailforward' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailforward_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailcatchall' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailcatchall_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailrouting' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailrouting_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailfilter' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailfilter_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_fetchmail' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailfetchmail_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailquota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailquota_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_spamfilter_wblist' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_spamfilter_wblist_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_spamfilter_user' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_spamfilter_user_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_spamfilter_policy' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_spamfilter_policy_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_web_domain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_domain_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_web_quota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_quota_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_web_aliasdomain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_aliasdomain_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_web_subdomain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_subdomain_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_ftp_user' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_ftp_user_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_shell_user' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_shell_user_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_webdav_user' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_webdav_user_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_dns_zone' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_dns_zone_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_dns_slave_zone' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_dns_slave_zone_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_dns_record' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_dns_record_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + /* + 'limit_client' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_client_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + */ + 'limit_database' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_database_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_cron' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_cron_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_cron_type' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + 'value' => array('full' => 'Full Cron','chrooted' => 'Chrooted Cron','url' => 'URL Cron') + ), + 'limit_cron_frequency' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_cron_error_frequency'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_traffic_quota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_traffic_quota_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + ################################## + # END Datatable fields + ################################## + ) +); + +?> diff --git a/interface/web/client/form/reseller.tform.php b/interface/web/client/form/reseller.tform.php index 1ce70416efaa2985ed0dd6e93d58669f65bde9b8..0f3d3f4949f8d5c5c574c2e223604e089b7a8fa9 100644 --- a/interface/web/client/form/reseller.tform.php +++ b/interface/web/client/form/reseller.tform.php @@ -1,797 +1,811 @@ - 0 id must match with id of current user -$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user -$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete - -//* Languages -$language_list = array(); -$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); -while ($file = @readdir ($handle)) { - if ($file != '.' && $file != '..') { - if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') { - $tmp = substr($file, 0, 2); - $language_list[$tmp] = $tmp; - } - } -} - -$form["tabs"]['address'] = array ( - 'title' => "Address", - 'width' => 100, - 'template' => "templates/reseller_edit_address.htm", - 'fields' => array ( - ################################## - # Begin Datatable fields - ################################## - 'company_name' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'contact_name' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'contact_error_empty'), - ), - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'customer_no' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'username' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'username_error_empty'), - 1 => array ( 'type' => 'CUSTOM', - 'class' => 'validate_client', - 'function' => 'username_unique', - 'errmsg'=> 'username_error_unique'), - 2 => array ( 'type' => 'REGEX', - 'regex' => '/^[\w\.\-\_]{0,64}$/', - 'errmsg'=> 'username_error_regex'), - ), - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'password' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'PASSWORD', - 'encryption'=> 'CRYPT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'language' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'default' => $conf["language"], - 'value' => $language_list, - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'usertheme' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'default' => 'default', - 'value' => array('default' => 'default'), - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'street' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'zip' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'city' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'state' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'country' => array ( - 'datatype' => 'VARCHAR', - - 'formtype' => 'SELECT', - 'default' => 'DE', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name', - 'keyfield'=> 'iso', - 'valuefield'=> 'printable_name' - ), - 'value' => '' - ), - 'telephone' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'mobile' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'fax' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'email' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'internet' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => 'http://', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'icq' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'vat_id' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '30', - 'maxlength' => '255', - 'rows' => '', - 'cols' => '' - ), - 'notes' => array ( - 'datatype' => 'TEXT', - 'formtype' => 'TEXTAREA', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '', - 'maxlength' => '', - 'rows' => '10', - 'cols' => '30' - ), - ################################## - # END Datatable fields - ################################## - ) -); - -$form["tabs"]['limits'] = array ( - 'title' => "Limits", - 'width' => 80, - 'template' => "templates/reseller_edit_limits.htm", - 'fields' => array ( - ################################## - # Begin Datatable fields - ################################## - 'template_master' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'CUSTOM', - 'class'=> 'custom_datasource', - 'function'=> 'master_templates' - ), - 'value' => '' - ), - 'template_additional' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - ), - 'default_mailserver' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND {AUTHSQL} ORDER BY server_name', - 'keyfield'=> 'server_id', - 'valuefield'=> 'server_name' - ), - 'value' => '' - ), - 'limit_maildomain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_maildomain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailbox' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailbox_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailalias' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailalias_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailforward' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailforward_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailcatchall' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailcatchall_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailrouting' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailrouting_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailfilter' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailfilter_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_fetchmail' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailfetchmail_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_mailquota' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailquota_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_spamfilter_wblist' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_spamfilter_wblist_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_spamfilter_user' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_spamfilter_user_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_spamfilter_policy' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_spamfilter_policy_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'default_webserver' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT server_id,server_name FROM server WHERE web_server = 1 AND {AUTHSQL} ORDER BY server_name', - 'keyfield'=> 'server_id', - 'valuefield'=> 'server_name' - ), - 'value' => '' - ), - 'limit_web_domain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_web_domain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_web_quota' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_web_quota_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'web_php_options' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOXARRAY', - 'default' => '', - 'separator' => ',', - 'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP') - ), - 'limit_web_aliasdomain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_web_aliasdomain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_web_subdomain' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_web_subdomain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_ftp_user' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_ftp_user_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_shell_user' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_shell_user_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'ssh_chroot' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOXARRAY', - 'default' => '', - 'separator' => ',', - 'value' => array('no' => 'None', 'jailkit' => 'Jailkit') - ), - 'default_dnsserver' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT server_id,server_name FROM server WHERE dns_server = 1 AND {AUTHSQL} ORDER BY server_name', - 'keyfield'=> 'server_id', - 'valuefield'=> 'server_name' - ), - 'value' => '' - ), - 'limit_dns_zone' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_dns_zone_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_dns_slave_zone' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_dns_slave_zone_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_dns_record' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_dns_record_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_client' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_client_error_notint'), - 1 => array ( 'type' => 'CUSTOM', - 'class' => 'validate_reseller', - 'function' => 'limit_client'), - ), - 'default' => '1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'default_dbserver' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT server_id,server_name FROM server WHERE db_server = 1 AND {AUTHSQL} ORDER BY server_name', - 'keyfield'=> 'server_id', - 'valuefield'=> 'server_name' - ), - 'value' => '' - ), - 'limit_database' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_database_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_cron' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_cron_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_cron_type' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'default' => '', - 'value' => array('full' => 'Full Cron','chrooted' => 'Chrooted Cron','url' => 'URL Cron') - ), - 'limit_cron_frequency' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_cron_error_frequency'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_traffic_quota' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_traffic_quota_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - ################################## - # END Datatable fields - ################################## - ) -); - -/* -$form["tabs"]['ipaddress'] = array ( - 'title' => "IP Addresses", - 'width' => 100, - 'template' => "templates/client_edit_ipaddress.htm", - 'fields' => array ( - ################################## - # Beginn Datatable fields - ################################## - 'ip_address' => array ( - 'datatype' => 'TEXT', - 'formtype' => 'CHECKBOXARRAY', - 'default' => '', - 'value' => array('192.168.0.1' => '192.168.0.1', '192.168.0.2' => '192.168.0.2'), - 'separator' => ';' - ), - ################################## - # ENDE Datatable fields - ################################## - ) -); -*/ - - -?> + 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete + +//* Languages +$language_list = array(); +$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); +while ($file = @readdir ($handle)) { + if ($file != '.' && $file != '..') { + if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') { + $tmp = substr($file, 0, 2); + $language_list[$tmp] = $tmp; + } + } +} + +$form["tabs"]['address'] = array ( + 'title' => "Address", + 'width' => 100, + 'template' => "templates/reseller_edit_address.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'company_name' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'contact_name' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'contact_error_empty'), + ), + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'customer_no' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'username' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'username_error_empty'), + 1 => array ( 'type' => 'CUSTOM', + 'class' => 'validate_client', + 'function' => 'username_unique', + 'errmsg'=> 'username_error_unique'), + 2 => array ( 'type' => 'REGEX', + 'regex' => '/^[\w\.\-\_]{0,64}$/', + 'errmsg'=> 'username_error_regex'), + ), + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'password' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'PASSWORD', + 'encryption'=> 'CRYPT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'language' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => $conf["language"], + 'value' => $language_list, + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'usertheme' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'default', + 'value' => array('default' => 'default'), + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'street' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'zip' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'city' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'state' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'country' => array ( + 'datatype' => 'VARCHAR', + + 'formtype' => 'SELECT', + 'default' => 'DE', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name', + 'keyfield'=> 'iso', + 'valuefield'=> 'printable_name' + ), + 'value' => '' + ), + 'telephone' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'mobile' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'fax' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'email' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'internet' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => 'http://', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'icq' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'vat_id' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '' + ), + 'notes' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXTAREA', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '', + 'maxlength' => '', + 'rows' => '10', + 'cols' => '30' + ), + ################################## + # END Datatable fields + ################################## + ) +); + +$form["tabs"]['limits'] = array ( + 'title' => "Limits", + 'width' => 80, + 'template' => "templates/reseller_edit_limits.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'template_master' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'CUSTOM', + 'class'=> 'custom_datasource', + 'function'=> 'master_templates' + ), + 'value' => '' + ), + 'template_additional' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + ), + 'default_mailserver' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND {AUTHSQL} ORDER BY server_name', + 'keyfield'=> 'server_id', + 'valuefield'=> 'server_name' + ), + 'value' => '' + ), + 'limit_maildomain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_maildomain_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailmailinglist' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailmailinglist_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailbox' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailbox_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailalias' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailalias_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailforward' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailforward_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailcatchall' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailcatchall_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailrouting' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailrouting_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailfilter' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailfilter_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_fetchmail' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailfetchmail_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_mailquota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_mailquota_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_spamfilter_wblist' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_spamfilter_wblist_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_spamfilter_user' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_spamfilter_user_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_spamfilter_policy' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_spamfilter_policy_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'default_webserver' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT server_id,server_name FROM server WHERE web_server = 1 AND {AUTHSQL} ORDER BY server_name', + 'keyfield'=> 'server_id', + 'valuefield'=> 'server_name' + ), + 'value' => '' + ), + 'limit_web_domain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_domain_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_web_quota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_quota_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'web_php_options' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOXARRAY', + 'default' => '', + 'separator' => ',', + 'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP') + ), + 'limit_web_aliasdomain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_aliasdomain_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_web_subdomain' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_subdomain_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_ftp_user' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_ftp_user_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_shell_user' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_shell_user_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'ssh_chroot' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOXARRAY', + 'default' => '', + 'separator' => ',', + 'value' => array('no' => 'None', 'jailkit' => 'Jailkit') + ), + 'default_dnsserver' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT server_id,server_name FROM server WHERE dns_server = 1 AND {AUTHSQL} ORDER BY server_name', + 'keyfield'=> 'server_id', + 'valuefield'=> 'server_name' + ), + 'value' => '' + ), + 'limit_dns_zone' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_dns_zone_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_dns_slave_zone' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_dns_slave_zone_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_dns_record' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_dns_record_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_client' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_client_error_notint'), + 1 => array ( 'type' => 'CUSTOM', + 'class' => 'validate_reseller', + 'function' => 'limit_client'), + ), + 'default' => '1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'default_dbserver' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT server_id,server_name FROM server WHERE db_server = 1 AND {AUTHSQL} ORDER BY server_name', + 'keyfield'=> 'server_id', + 'valuefield'=> 'server_name' + ), + 'value' => '' + ), + 'limit_database' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_database_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_cron' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_cron_error_notint'), + ), + 'default' => '0', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_cron_type' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + 'value' => array('full' => 'Full Cron','chrooted' => 'Chrooted Cron','url' => 'URL Cron') + ), + 'limit_cron_frequency' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_cron_error_frequency'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_traffic_quota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_traffic_quota_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + ################################## + # END Datatable fields + ################################## + ) +); + +/* +$form["tabs"]['ipaddress'] = array ( + 'title' => "IP Addresses", + 'width' => 100, + 'template' => "templates/client_edit_ipaddress.htm", + 'fields' => array ( + ################################## + # Beginn Datatable fields + ################################## + 'ip_address' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'CHECKBOXARRAY', + 'default' => '', + 'value' => array('192.168.0.1' => '192.168.0.1', '192.168.0.2' => '192.168.0.2'), + 'separator' => ';' + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); +*/ + + +?> diff --git a/interface/web/client/lib/lang/en_client.lng b/interface/web/client/lib/lang/en_client.lng index 656968c420c64bd7c825327bfd45024d73d96571..8ce69611875c98aa2371a5e510126a5bf935c76d 100644 --- a/interface/web/client/lib/lang/en_client.lng +++ b/interface/web/client/lib/lang/en_client.lng @@ -1,5 +1,6 @@ -

- -
- - -
-
{tmpl_var name="toolsarea_head_txt"} -
- - -
-
-
-
- -
-
Limits - -
- - -
-
- - -


{tmpl_var name='template_additional_list'}
- -
-
-   -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -  MB -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -  MB -
-
-

{tmpl_var name='web_php_options_txt'}

-
- {tmpl_var name='web_php_options'} -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
-

{tmpl_var name='ssh_chroot_txt'}

-
- {tmpl_var name='ssh_chroot'} -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -  MB -
-
- - - -
- - -
-
- -
+

+

+ +
+ + +
+
{tmpl_var name="toolsarea_head_txt"} +
+ + +
+
+
+
+ +
+
Limits + +
+ + +
+
+ + +


{tmpl_var name='template_additional_list'}
+ +
+
+   +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +  MB +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +  MB +
+
+

{tmpl_var name='web_php_options_txt'}

+
+ {tmpl_var name='web_php_options'} +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+

{tmpl_var name='ssh_chroot_txt'}

+
+ {tmpl_var name='ssh_chroot'} +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +  MB +
+
+ + + +
+ + +
+
+ +
diff --git a/interface/web/client/templates/client_template_edit_limits.htm b/interface/web/client/templates/client_template_edit_limits.htm index c9a0d39fd0d4f4baa912f9df85e416b7bfc823fc..5e405a177f6619dd46d6f04873ead7b1b4c63bbb 100644 --- a/interface/web/client/templates/client_template_edit_limits.htm +++ b/interface/web/client/templates/client_template_edit_limits.htm @@ -1,132 +1,136 @@ -

-

- -
- -
-
Limits -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -  MB -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -  MB -
-
- - - -
- - -
-
- -
+

+

+ +
+ +
+
Limits +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +  MB +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +  MB +
+
+ + + +
+ + +
+
+ +
diff --git a/interface/web/client/templates/reseller_edit_limits.htm b/interface/web/client/templates/reseller_edit_limits.htm index ced6de842d2190b5aea2355161a9bd8f62ebf8ad..aa9da9cac59db26872210ca65c5ed5253b44d58b 100644 --- a/interface/web/client/templates/reseller_edit_limits.htm +++ b/interface/web/client/templates/reseller_edit_limits.htm @@ -1,183 +1,187 @@ -

-

- -
- -
-
Limits - -
- - -
-
- - - {tmpl_var name='template_additional_list'} - -
-
-   -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -  MB -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -  MB -
-
-

{tmpl_var name='web_php_options_txt'}

-
- {tmpl_var name='web_php_options'} -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
-

{tmpl_var name='ssh_chroot_txt'}

-
- {tmpl_var name='ssh_chroot'} -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -  MB -
-
- - - -
- - -
-
- -
+

+

+ +
+ +
+
Limits + +
+ + +
+
+ + + {tmpl_var name='template_additional_list'} + +
+
+   +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +  MB +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +  MB +
+
+

{tmpl_var name='web_php_options_txt'}

+
+ {tmpl_var name='web_php_options'} +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+

{tmpl_var name='ssh_chroot_txt'}

+
+ {tmpl_var name='ssh_chroot'} +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +  MB +
+
+ + + +
+ + +
+
+ +
diff --git a/interface/web/dashboard/dashlets/limits.php b/interface/web/dashboard/dashlets/limits.php index 7a7c00f1372f60047b8e1f2dbd7aa62ce2f8b709..b020def549975970eddf7a712a0f0cf48f8dc34c 100644 --- a/interface/web/dashboard/dashlets/limits.php +++ b/interface/web/dashboard/dashlets/limits.php @@ -12,6 +12,10 @@ class dashlet_limits { $limits[] = array('field' => 'limit_maildomain', 'db_table' => 'mail_domain', 'db_where' => ''); + + $limits[] = array('field' => 'limit_mailmailinglist', + 'db_table' => 'mail_mailinglist', + 'db_where' => ''); $limits[] = array('field' => 'limit_mailbox', 'db_table' => 'mail_user', diff --git a/interface/web/dashboard/lib/lang/en_dashlet_limits.lng b/interface/web/dashboard/lib/lang/en_dashlet_limits.lng index 22b435d0e1017a9d316e3cc91a006da1279d3875..a73fe64b8eef0178200ed326c785af51f3f4c1b3 100644 --- a/interface/web/dashboard/lib/lang/en_dashlet_limits.lng +++ b/interface/web/dashboard/lib/lang/en_dashlet_limits.lng @@ -3,6 +3,7 @@ $wb['limits_txt'] = "Account limits"; $wb['of_txt'] = "of"; $wb['unlimited_txt'] = "Unlimited"; $wb['limit_maildomain_txt'] = "Number of email domains"; +$wb['limit_mailmailinglist_txt'] = "Number of mailing lists"; $wb['limit_mailbox_txt'] = "Number of mailboxes"; $wb["limit_mailalias_txt"] = 'Number of email aliases'; $wb["limit_mailaliasdomain_txt"] = 'Number of domain aliases'; diff --git a/interface/web/mail/form/mail_mailinglist.tform.php b/interface/web/mail/form/mail_mailinglist.tform.php new file mode 100644 index 0000000000000000000000000000000000000000..1b4ce690800d7b6c6a51bc020c71a2a1e65e6a11 --- /dev/null +++ b/interface/web/mail/form/mail_mailinglist.tform.php @@ -0,0 +1,122 @@ + 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete + +$form["tabs"]['mailinglist'] = array ( + 'title' => "Mailing List", + 'width' => 100, + 'template' => "templates/mail_mailinglist_edit.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'server_id' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name', + 'keyfield'=> 'server_id', + 'valuefield'=> 'server_name' + ), + 'value' => '' + ), + 'domain' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'domain_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z\-]{2,10}$/', + 'errmsg'=> 'domain_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'listname' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'listname_error_empty'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'email' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISEMAIL', + 'errmsg'=> 'email_error_isemail'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'password' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'PASSWORD', + 'encryption'=> 'CLEARTEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); +?> \ No newline at end of file diff --git a/interface/web/mail/lib/lang/en_mail_mailinglist.lng b/interface/web/mail/lib/lang/en_mail_mailinglist.lng new file mode 100644 index 0000000000000000000000000000000000000000..44790b1ad46dd87823b2ac1c8baf4470452dfc54 --- /dev/null +++ b/interface/web/mail/lib/lang/en_mail_mailinglist.lng @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/interface/web/mail/lib/lang/en_mail_mailinglist_list.lng b/interface/web/mail/lib/lang/en_mail_mailinglist_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..ec48108bf965e3872afb6c08fe89d70865228197 --- /dev/null +++ b/interface/web/mail/lib/lang/en_mail_mailinglist_list.lng @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/interface/web/mail/lib/module.conf.php b/interface/web/mail/lib/module.conf.php index c69fe417adcadb8912cd7dcbba3f0c4652627bc9..842dd16ac20f114499040698670c9389207ac077 100644 --- a/interface/web/mail/lib/module.conf.php +++ b/interface/web/mail/lib/module.conf.php @@ -1,183 +1,201 @@ -auth->get_user_id(); - -$module['name'] = 'mail'; -$module['title'] = 'top_menu_email'; -$module['template'] = 'module.tpl.htm'; -$module['startpage'] = 'mail/mail_domain_list.php'; -$module['tab_width'] = ''; - - -//**** Email accounts menu -$items = array(); - -if($app->auth->get_client_limit($userid,'maildomain') != 0) -{ - $items[] = array( 'title' => 'Domain', - 'target' => 'content', - 'link' => 'mail/mail_domain_list.php', - 'html_id' => 'mail_domain_list'); -} - -if($app->auth->get_client_limit($userid,'mailaliasdomain') != 0) -{ - $items[] = array( 'title' => 'Domain Alias', - 'target' => 'content', - 'link' => 'mail/mail_aliasdomain_list.php', - 'html_id' => 'mail_aliasdomain_list'); -} - -if($app->auth->get_client_limit($userid,'mailbox') != 0) -{ - $items[] = array( 'title' => 'Email Mailbox', - 'target' => 'content', - 'link' => 'mail/mail_user_list.php', - 'html_id' => 'mail_user_list'); -} - -if($app->auth->get_client_limit($userid,'mailalias') != 0) -{ - $items[] = array( 'title' => 'Email Alias', - 'target' => 'content', - 'link' => 'mail/mail_alias_list.php', - 'html_id' => 'mail_alias_list'); -} - -if($app->auth->get_client_limit($userid,'mailforward') != 0) -{ - $items[] = array( 'title' => 'Email Forward', - 'target' => 'content', - 'link' => 'mail/mail_forward_list.php', - 'html_id' => 'mail_forward_list'); -} - -if($app->auth->get_client_limit($userid,'mailcatchall') != 0) -{ - $items[] = array( 'title' => 'Email Catchall', - 'target' => 'content', - 'link' => 'mail/mail_domain_catchall_list.php', - 'html_id' => 'mail_domain_catchall_list'); -} - -if($app->auth->get_client_limit($userid,'mailrouting') != 0) -{ - $items[] = array( 'title' => 'Email Routing', - 'target' => 'content', - 'link' => 'mail/mail_transport_list.php', - 'html_id' => 'mail_transport_list'); -} - -if(count($items)) -{ - $module['nav'][] = array( 'title' => 'Email Accounts', - 'open' => 1, - 'items' => $items); -} - -//**** Spamfilter menu -$items = array(); - -if($app->auth->get_client_limit($userid,'spamfilter_wblist') != 0) -{ - $items[] = array( 'title' => 'Whitelist', - 'target' => 'content', - 'link' => 'mail/spamfilter_whitelist_list.php', - 'html_id' => 'spamfilter_whitelist_list'); - - $items[] = array( 'title' => 'Blacklist', - 'target' => 'content', - 'link' => 'mail/spamfilter_blacklist_list.php', - 'html_id' => 'spamfilter_blacklist_list'); -} - -if($app->auth->is_admin()) { - - $items[] = array( 'title' => 'User / Domain', - 'target' => 'content', - 'link' => 'mail/spamfilter_users_list.php', - 'html_id' => 'spamfilter_users_list'); - - $items[] = array( 'title' => 'Policy', - 'target' => 'content', - 'link' => 'mail/spamfilter_policy_list.php', - 'html_id' => 'spamfilter_policy_list'); - -// $items[] = array( 'title' => 'Server Settings', -// 'target' => 'content', -// 'link' => 'mail/spamfilter_config_list.php'); -} - -if(count($items)) -{ - $module['nav'][] = array( 'title' => 'Spamfilter', - 'open' => 1, - 'items' => $items); -} - -//**** Fetchmail menu -$items = array(); - -if($app->auth->get_client_limit($userid,'fetchmail') != 0) -{ - $items[] = array( 'title' => 'Fetchmail', - 'target' => 'content', - 'link' => 'mail/mail_get_list.php', - 'html_id' => 'mail_get_list'); - - $module['nav'][] = array( 'title' => 'Fetchmail', - 'open' => 1, - 'items' => $items); -} - - - -//**** Statistics menu -$items = array(); - -$items[] = array( 'title' => 'Mailbox traffic', - 'target' => 'content', - 'link' => 'mail/mail_user_stats.php', - 'html_id' => 'mail_user_stats'); - - - -$module['nav'][] = array( 'title' => 'Statistics', - 'open' => 1, - 'items' => $items); - - -//**** Global filters menu -$items = array(); -if($_SESSION['s']['user']['typ'] == 'admin') { - - $items[] = array( 'title' => 'Postfix Whitelist', - 'target' => 'content', - 'link' => 'mail/mail_whitelist_list.php', - 'html_id' => 'mail_whitelist_list'); - - - $items[] = array( 'title' => 'Postfix Blacklist', - 'target' => 'content', - 'link' => 'mail/mail_blacklist_list.php', - 'html_id' => 'mail_blacklist_list'); - - - $items[] = array( 'title' => 'Content Filter', - 'target' => 'content', - 'link' => 'mail/mail_content_filter_list.php', - 'html_id' => 'mail_content_filter_list'); - - - $items[] = array( 'title' => 'Relay Recipients', - 'target' => 'content', - 'link' => 'mail/mail_relay_recipient_list.php', - 'html_id' => 'mail_relay_recipient_list'); - - - $module['nav'][] = array( 'title' => 'Global Filters', - 'open' => 1, - 'items' => $items); -} - +auth->get_user_id(); + +$module['name'] = 'mail'; +$module['title'] = 'top_menu_email'; +$module['template'] = 'module.tpl.htm'; +$module['startpage'] = 'mail/mail_domain_list.php'; +$module['tab_width'] = ''; + + +//**** Email accounts menu +$items = array(); + +if($app->auth->get_client_limit($userid,'maildomain') != 0) +{ + $items[] = array( 'title' => 'Domain', + 'target' => 'content', + 'link' => 'mail/mail_domain_list.php', + 'html_id' => 'mail_domain_list'); +} + +if($app->auth->get_client_limit($userid,'mailaliasdomain') != 0) +{ + $items[] = array( 'title' => 'Domain Alias', + 'target' => 'content', + 'link' => 'mail/mail_aliasdomain_list.php', + 'html_id' => 'mail_aliasdomain_list'); +} + +if($app->auth->get_client_limit($userid,'mailbox') != 0) +{ + $items[] = array( 'title' => 'Email Mailbox', + 'target' => 'content', + 'link' => 'mail/mail_user_list.php', + 'html_id' => 'mail_user_list'); +} + +if($app->auth->get_client_limit($userid,'mailalias') != 0) +{ + $items[] = array( 'title' => 'Email Alias', + 'target' => 'content', + 'link' => 'mail/mail_alias_list.php', + 'html_id' => 'mail_alias_list'); +} + +if($app->auth->get_client_limit($userid,'mailforward') != 0) +{ + $items[] = array( 'title' => 'Email Forward', + 'target' => 'content', + 'link' => 'mail/mail_forward_list.php', + 'html_id' => 'mail_forward_list'); +} + +if($app->auth->get_client_limit($userid,'mailcatchall') != 0) +{ + $items[] = array( 'title' => 'Email Catchall', + 'target' => 'content', + 'link' => 'mail/mail_domain_catchall_list.php', + 'html_id' => 'mail_domain_catchall_list'); +} + +if($app->auth->get_client_limit($userid,'mailrouting') != 0) +{ + $items[] = array( 'title' => 'Email Routing', + 'target' => 'content', + 'link' => 'mail/mail_transport_list.php', + 'html_id' => 'mail_transport_list'); +} + +if(count($items)) +{ + $module['nav'][] = array( 'title' => 'Email Accounts', + 'open' => 1, + 'items' => $items); +} + +//**** Mailinglist menu +$items = array(); + +if($app->auth->get_client_limit($userid,'mailmailinglist') != 0) +{ + $items[] = array( 'title' => 'Mailing List', + 'target' => 'content', + 'link' => 'mail/mail_mailinglist_list.php', + 'html_id' => 'mail_mailinglist_list'); +} + +if(count($items)) +{ + $module['nav'][] = array( 'title' => 'Mailing List', + 'open' => 1, + 'items' => $items); +} + +//**** Spamfilter menu +$items = array(); + +if($app->auth->get_client_limit($userid,'spamfilter_wblist') != 0) +{ + $items[] = array( 'title' => 'Whitelist', + 'target' => 'content', + 'link' => 'mail/spamfilter_whitelist_list.php', + 'html_id' => 'spamfilter_whitelist_list'); + + $items[] = array( 'title' => 'Blacklist', + 'target' => 'content', + 'link' => 'mail/spamfilter_blacklist_list.php', + 'html_id' => 'spamfilter_blacklist_list'); +} + +if($app->auth->is_admin()) { + + $items[] = array( 'title' => 'User / Domain', + 'target' => 'content', + 'link' => 'mail/spamfilter_users_list.php', + 'html_id' => 'spamfilter_users_list'); + + $items[] = array( 'title' => 'Policy', + 'target' => 'content', + 'link' => 'mail/spamfilter_policy_list.php', + 'html_id' => 'spamfilter_policy_list'); + +// $items[] = array( 'title' => 'Server Settings', +// 'target' => 'content', +// 'link' => 'mail/spamfilter_config_list.php'); +} + +if(count($items)) +{ + $module['nav'][] = array( 'title' => 'Spamfilter', + 'open' => 1, + 'items' => $items); +} + +//**** Fetchmail menu +$items = array(); + +if($app->auth->get_client_limit($userid,'fetchmail') != 0) +{ + $items[] = array( 'title' => 'Fetchmail', + 'target' => 'content', + 'link' => 'mail/mail_get_list.php', + 'html_id' => 'mail_get_list'); + + $module['nav'][] = array( 'title' => 'Fetchmail', + 'open' => 1, + 'items' => $items); +} + + + +//**** Statistics menu +$items = array(); + +$items[] = array( 'title' => 'Mailbox traffic', + 'target' => 'content', + 'link' => 'mail/mail_user_stats.php', + 'html_id' => 'mail_user_stats'); + + + +$module['nav'][] = array( 'title' => 'Statistics', + 'open' => 1, + 'items' => $items); + + +//**** Global filters menu +$items = array(); +if($_SESSION['s']['user']['typ'] == 'admin') { + + $items[] = array( 'title' => 'Postfix Whitelist', + 'target' => 'content', + 'link' => 'mail/mail_whitelist_list.php', + 'html_id' => 'mail_whitelist_list'); + + + $items[] = array( 'title' => 'Postfix Blacklist', + 'target' => 'content', + 'link' => 'mail/mail_blacklist_list.php', + 'html_id' => 'mail_blacklist_list'); + + + $items[] = array( 'title' => 'Content Filter', + 'target' => 'content', + 'link' => 'mail/mail_content_filter_list.php', + 'html_id' => 'mail_content_filter_list'); + + + $items[] = array( 'title' => 'Relay Recipients', + 'target' => 'content', + 'link' => 'mail/mail_relay_recipient_list.php', + 'html_id' => 'mail_relay_recipient_list'); + + + $module['nav'][] = array( 'title' => 'Global Filters', + 'open' => 1, + 'items' => $items); +} + ?> \ No newline at end of file diff --git a/interface/web/mail/list/mail_mailinglist.list.php b/interface/web/mail/list/mail_mailinglist.list.php new file mode 100644 index 0000000000000000000000000000000000000000..27842a5d346facb04c243ea863a7e16d1c7f26e9 --- /dev/null +++ b/interface/web/mail/list/mail_mailinglist.list.php @@ -0,0 +1,67 @@ + "listname", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "domain", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +?> \ No newline at end of file diff --git a/interface/web/mail/mail_domain_del.php b/interface/web/mail/mail_domain_del.php index 1e62ac628467d1f23c278c81b22da7641c30d336..456a7335a36f65749d58d4d5aba361047d41604b 100644 --- a/interface/web/mail/mail_domain_del.php +++ b/interface/web/mail/mail_domain_del.php @@ -1,92 +1,98 @@ -auth->check_module_permissions('mail'); - -// Loading classes -$app->uses('tpl,tform,tform_actions'); -$app->load('tform_actions'); - -class page_action extends tform_actions { - - function onBeforeDelete() { - global $app; $conf; - - $domain = $this->dataRecord['domain']; - - // Before we delete the email domain, - // we will delete all depending records. - - // Delete all forwardings where the osurce or destination belongs to this domain - $records = $app->db->queryAllRecords("SELECT forwarding_id as id FROM mail_forwarding WHERE source like '%@".$app->db->quote($domain)."' OR destination like '%@".$app->db->quote($domain)."'"); - foreach($records as $rec) { - $app->db->datalogDelete('mail_forwarding','forwarding_id',$rec['id']); - } - - // Delete all fetchmail accounts where destination belongs to this domain - $records = $app->db->queryAllRecords("SELECT mailget_id as id FROM mail_get WHERE destination like '%@".$app->db->quote($domain)."'"); - foreach($records as $rec) { - $app->db->datalogDelete('mail_get','mailget_id',$rec['id']); - } - - // Delete all mailboxes where destination belongs to this domain - $records = $app->db->queryAllRecords("SELECT mailuser_id as id FROM mail_user WHERE email like '%@".$app->db->quote($domain)."'"); - foreach($records as $rec) { - $app->db->datalogDelete('mail_user','mailuser_id',$rec['id']); - } - - // Delete all spamfilters that belong to this domain - $records = $app->db->queryAllRecords("SELECT id FROM spamfilter_users WHERE email = '@".$app->db->quote($domain)."'"); - foreach($records as $rec) { - $app->db->datalogDelete('spamfilter_users','id',$rec['id']); - } - - } -} - -$page = new page_action; -$page->onDelete(); - +auth->check_module_permissions('mail'); + +// Loading classes +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + function onBeforeDelete() { + global $app; $conf; + + $domain = $this->dataRecord['domain']; + + // Before we delete the email domain, + // we will delete all depending records. + + // Delete all forwardings where the osurce or destination belongs to this domain + $records = $app->db->queryAllRecords("SELECT forwarding_id as id FROM mail_forwarding WHERE source like '%@".$app->db->quote($domain)."' OR destination like '%@".$app->db->quote($domain)."'"); + foreach($records as $rec) { + $app->db->datalogDelete('mail_forwarding','forwarding_id',$rec['id']); + } + + // Delete all fetchmail accounts where destination belongs to this domain + $records = $app->db->queryAllRecords("SELECT mailget_id as id FROM mail_get WHERE destination like '%@".$app->db->quote($domain)."'"); + foreach($records as $rec) { + $app->db->datalogDelete('mail_get','mailget_id',$rec['id']); + } + + // Delete all mailboxes where destination belongs to this domain + $records = $app->db->queryAllRecords("SELECT mailuser_id as id FROM mail_user WHERE email like '%@".$app->db->quote($domain)."'"); + foreach($records as $rec) { + $app->db->datalogDelete('mail_user','mailuser_id',$rec['id']); + } + + // Delete all spamfilters that belong to this domain + $records = $app->db->queryAllRecords("SELECT id FROM spamfilter_users WHERE email = '@".$app->db->quote($domain)."'"); + foreach($records as $rec) { + $app->db->datalogDelete('spamfilter_users','id',$rec['id']); + } + + // Delete all mailinglists that belong to this domain + $records = $app->db->queryAllRecords("SELECT mailinglist_id FROM mail_mailinglist WHERE domain = '".$app->db->quote($domain)."'"); + foreach($records as $rec) { + $app->db->datalogDelete('mail_mailinglist','mailinglist_id',$rec['id']); + } + + } +} + +$page = new page_action; +$page->onDelete(); + ?> \ No newline at end of file diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php index f44348bcfd6d32a08be35eb550ff3903bea7388e..c323d3c3286d7a78b4c687f2dc71d408991c720e 100644 --- a/interface/web/mail/mail_domain_edit.php +++ b/interface/web/mail/mail_domain_edit.php @@ -1,367 +1,370 @@ -auth->check_module_permissions('mail'); - -// Loading classes -$app->uses('tpl,tform,tform_actions'); -$app->load('tform_actions'); - -class page_action extends tform_actions { - - function onShowNew() { - global $app, $conf; - - // we will check only users, not admins - if($_SESSION["s"]["user"]["typ"] == 'user') { - if(!$app->tform->checkClientLimit('limit_maildomain')) { - $app->error($app->tform->wordbook["limit_maildomain_txt"]); - } - if(!$app->tform->checkResellerLimit('limit_maildomain')) { - $app->error('Reseller: '.$app->tform->wordbook["limit_maildomain_txt"]); - } - } - - parent::onShowNew(); - } - - function onShowEnd() { - global $app, $conf; - - if($_SESSION["s"]["user"]["typ"] == 'admin') { - // Getting Clients of the user - if($_SESSION["s"]["user"]["typ"] == 'admin') { - $sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name"; - } else { - $client_group_id = $_SESSION["s"]["user"]["default_group"]; - $sql = "SELECT client.client_id, limit_web_domain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"; - } - $clients = $app->db->queryAllRecords($sql); - $client_select = ''; - if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= ""; - $tmp_data_record = $app->tform->getDataRecord($this->id); - if(is_array($clients)) { - foreach( $clients as $client) { - $selected = ($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':''; - $client_select .= "\r\n"; - } - } - $app->tpl->setVar("client_group_id",$client_select); - - } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) { - - // Get the limits of the client - $client_group_id = $_SESSION["s"]["user"]["default_group"]; - $client = $app->db->queryOneRecord("SELECT client.client_id, contact_name, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id order by contact_name"); - - // Set the mailserver to the default server of the client - $tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_mailserver]"); - $app->tpl->setVar("server_id",""); - unset($tmp); - - // Fill the client select field - $sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']; - $clients = $app->db->queryAllRecords($sql); - $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']); - $client_select = ''; - $tmp_data_record = $app->tform->getDataRecord($this->id); - if(is_array($clients)) { - foreach( $clients as $client) { - $selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':''; - $client_select .= "\r\n"; - } - } - $app->tpl->setVar("client_group_id",$client_select); - - } - - /* - * Now we have to check, if we should use the domain-module to select the domain - * or not - */ - $app->uses('ini_parser,getconf'); - $settings = $app->getconf->get_global_config('domains'); - if ($settings['use_domain_module'] == 'y') { - /* - * The domain-module is in use. - */ - $client_group_id = $_SESSION["s"]["user"]["default_group"]; - /* - * The admin can select ALL domains, the user only the domains assigned to him - */ - $sql = "SELECT domain FROM domain "; - if ($_SESSION["s"]["user"]["typ"] != 'admin') { - $sql .= "WHERE sys_groupid =" . $client_group_id; - } - $sql .= " ORDER BY domain"; - $domains = $app->db->queryAllRecords($sql); - $domain_select = ''; - if(is_array($domains) && sizeof($domains) > 0) { - /* We have domains in the list, so create the drop-down-list */ - foreach( $domains as $domain) { - $domain_select .= "\r\n"; - } - $app->tpl->setVar("domain_option",$domain_select); - } - - - // Get the spamfilter policys for the user - $tmp_user = $app->db->queryOneRecord("SELECT policy_id FROM spamfilter_users WHERE email = '@".$this->dataRecord["domain"]."'"); - $sql = "SELECT id, policy_name FROM spamfilter_policy WHERE ".$app->tform->getAuthSQL('r'); - $policys = $app->db->queryAllRecords($sql); - $policy_select = ""; - if(is_array($policys)) { - foreach( $policys as $p) { - $selected = ($p["id"] == $tmp_user["policy_id"])?'SELECTED':''; - $policy_select .= "\r\n"; - } - } - $app->tpl->setVar("policy",$policy_select); - unset($policys); - unset($policy_select); - unset($tmp_user); - - if($this->id > 0) { - //* we are editing a existing record - $app->tpl->setVar("edit_disabled", 1); - $app->tpl->setVar("server_id_value", $this->dataRecord["server_id"]); - } else { - $app->tpl->setVar("edit_disabled", 0); - } - - parent::onShowEnd(); - } - - function onSubmit() { - global $app, $conf; - if($_SESSION["s"]["user"]["typ"] != 'admin') { - - // Get the limits of the client - $client_group_id = $_SESSION["s"]["user"]["default_group"]; - $client = $app->db->queryOneRecord("SELECT limit_maildomain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); - - // When the record is updated - if($this->id > 0) { - // restore the server ID if the user is not admin and record is edited - $tmp = $app->db->queryOneRecord("SELECT server_id FROM mail_domain WHERE domain_id = ".intval($this->id)); - $this->dataRecord["server_id"] = $tmp["server_id"]; - unset($tmp); - // When the record is inserted - } else { - // set the server ID to the default mailserver of the client - $this->dataRecord["server_id"] = $client["default_mailserver"]; - - // Check if the user may add another mail_domain - if($client["limit_maildomain"] >= 0) { - $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM mail_domain WHERE sys_groupid = $client_group_id"); - if($tmp["number"] >= $client["limit_maildomain"]) { - $app->error($app->tform->wordbook["limit_maildomain_txt"]); - } - } - } - - // Clients may not set the client_group_id, so we unset them if user is not a admin - if(!$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]); - } - - //* make sure that the email domain is lowercase - if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]); - - - parent::onSubmit(); - } - - function onAfterInsert() { - global $app, $conf; - - // make sure that the record belongs to the client group and not the admin group when a dmin inserts it - // also make sure that the user can not delete domain created by a admin - if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); - $app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); - } - if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); - $app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id); - } - - // Spamfilter policy - $policy_id = intval($this->dataRecord["policy"]); - if($policy_id > 0) { - $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".mysql_real_escape_string($this->dataRecord["domain"])."'"); - if($tmp_user["id"] > 0) { - // There is already a record that we will update - $app->db->datalogUpdate('spamfilter_users', "policy_id = $ploicy_id", 'id', $tmp_user["id"]); - } else { - $tmp_domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain_id = ".$this->id); - // We create a new record - $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) - VALUES (".$_SESSION["s"]["user"]["userid"].", ".$tmp_domain["sys_groupid"].", 'riud', 'riud', '', ".$this->dataRecord["server_id"].", 5, ".$policy_id.", '@".mysql_real_escape_string($this->dataRecord["domain"])."', '@".mysql_real_escape_string($this->dataRecord["domain"])."', 'Y')"; - $app->db->datalogInsert('spamfilter_users', $insert_data, 'id'); - unset($tmp_domain); - } - } // endif spamfilter policy - } - - function onBeforeUpdate() { - global $app, $conf; - - //* Check if the server has been changed - // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway - if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) { - $rec = $app->db->queryOneRecord("SELECT server_id, domain from mail_domain WHERE domain_id = ".$this->id); - if($rec['server_id'] != $this->dataRecord["server_id"]) { - //* Add a error message and switch back to old server - $app->tform->errorMessage .= $app->lng('The Server can not be changed.'); - $this->dataRecord["server_id"] = $rec['server_id']; - } - unset($rec); - //* If the user is neither admin nor reseller - } else { - //* We do not allow users to change a domain which has been created by the admin - $rec = $app->db->queryOneRecord("SELECT domain from mail_domain WHERE domain_id = ".$this->id); - if($rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id,'u')) { - //* Add a error message and switch back to old server - $app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.'); - $this->dataRecord["domain"] = $rec['domain']; - } - unset($rec); - } - } - - - - function onAfterUpdate() { - global $app, $conf; - - // make sure that the record belongs to the clinet group and not the admin group when admin inserts it - // also make sure that the user can not delete domain created by a admin - if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); - $app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); - } - if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); - $app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id); - } - - // Spamfilter policy - $policy_id = intval($this->dataRecord["policy"]); - $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".mysql_real_escape_string($this->dataRecord["domain"])."'"); - if($policy_id > 0) { - if($tmp_user["id"] > 0) { - // There is already a record that we will update - $app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]); - } else { - $tmp_domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain_id = ".$this->id); - // We create a new record - $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) - VALUES (".$_SESSION["s"]["user"]["userid"].", ".$tmp_domain["sys_groupid"].", 'riud', 'riud', '', ".$this->dataRecord["server_id"].", 5, ".$policy_id.", '@".mysql_real_escape_string($this->dataRecord["domain"])."', '@".mysql_real_escape_string($this->dataRecord["domain"])."', 'Y')"; - $app->db->datalogInsert('spamfilter_users', $insert_data, 'id'); - unset($tmp_domain); - } - } else { - if($tmp_user["id"] > 0) { - // There is already a record but the user shall have no policy, so we delete it - $app->db->datalogDelete('spamfilter_users', 'id', $tmp_user["id"]); - } - } // endif spamfilter policy - //** If the domain name or owner has been changed, change the domain and owner in all mailbox records - if($this->oldDataRecord['domain'] != $this->dataRecord['domain'] || (isset($this->dataRecord['client_group_id']) && $this->oldDataRecord['sys_groupid'] != $this->dataRecord['client_group_id'])) { - $app->uses('getconf'); - $mail_config = $app->getconf->get_server_config($this->dataRecord["server_id"],'mail'); - - //* Update the mailboxes - $mailusers = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE email like '%@".mysql_real_escape_string($this->oldDataRecord['domain'])."'"); - $sys_groupid = (isset($this->dataRecord['client_group_id']))?$this->dataRecord['client_group_id']:$this->oldDataRecord['sys_groupid']; - if(is_array($mailusers)) { - foreach($mailusers as $rec) { - // setting Maildir, Homedir, UID and GID - $mail_parts = explode("@",$rec['email']); - $maildir = str_replace("[domain]",$this->dataRecord['domain'],$mail_config["maildir_path"]); - $maildir = str_replace("[localpart]",$mail_parts[0],$maildir); - $maildir = mysql_real_escape_string($maildir); - $email = mysql_real_escape_string($mail_parts[0].'@'.$this->dataRecord['domain']); - $app->db->datalogUpdate('mail_user', "maildir = '$maildir', email = '$email', sys_groupid = '$sys_groupid'", 'mailuser_id', $rec['mailuser_id']); - } - } - - //* Update the aliases - $forwardings = $app->db->queryAllRecords("SELECT * FROM mail_forwarding WHERE source like '%@".mysql_real_escape_string($this->oldDataRecord['domain'])."' OR destination like '%@".mysql_real_escape_string($this->oldDataRecord['domain'])."'"); - if(is_array($forwardings)) { - foreach($forwardings as $rec) { - $destination = mysql_real_escape_string(str_replace($this->oldDataRecord['domain'],$this->dataRecord['domain'],$rec['destination'])); - $source = mysql_real_escape_string(str_replace($this->oldDataRecord['domain'],$this->dataRecord['domain'],$rec['source'])); - $app->db->datalogUpdate('mail_forwarding', "source = '$source', destination = '$destination', sys_groupid = '$sys_groupid'", 'forwarding_id', $rec['forwarding_id']); - } - } - - //* Delete the old spamfilter record - $tmp = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".mysql_real_escape_string($this->oldDataRecord["domain"])."'"); - $app->db->datalogDelete('spamfilter_users', 'id', $tmp["id"]); - unset($tmp); - - } // end if domain name changed - - } - -} - -$page = new page_action; -$page->onLoad(); - +auth->check_module_permissions('mail'); + +// Loading classes +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + function onShowNew() { + global $app, $conf; + + // we will check only users, not admins + if($_SESSION["s"]["user"]["typ"] == 'user') { + if(!$app->tform->checkClientLimit('limit_maildomain')) { + $app->error($app->tform->wordbook["limit_maildomain_txt"]); + } + if(!$app->tform->checkResellerLimit('limit_maildomain')) { + $app->error('Reseller: '.$app->tform->wordbook["limit_maildomain_txt"]); + } + } + + parent::onShowNew(); + } + + function onShowEnd() { + global $app, $conf; + + if($_SESSION["s"]["user"]["typ"] == 'admin') { + // Getting Clients of the user + if($_SESSION["s"]["user"]["typ"] == 'admin') { + $sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name"; + } else { + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $sql = "SELECT client.client_id, limit_web_domain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"; + } + $clients = $app->db->queryAllRecords($sql); + $client_select = ''; + if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= ""; + $tmp_data_record = $app->tform->getDataRecord($this->id); + if(is_array($clients)) { + foreach( $clients as $client) { + $selected = ($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':''; + $client_select .= "\r\n"; + } + } + $app->tpl->setVar("client_group_id",$client_select); + + } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) { + + // Get the limits of the client + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $client = $app->db->queryOneRecord("SELECT client.client_id, contact_name, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id order by contact_name"); + + // Set the mailserver to the default server of the client + $tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_mailserver]"); + $app->tpl->setVar("server_id",""); + unset($tmp); + + // Fill the client select field + $sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']; + $clients = $app->db->queryAllRecords($sql); + $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']); + $client_select = ''; + $tmp_data_record = $app->tform->getDataRecord($this->id); + if(is_array($clients)) { + foreach( $clients as $client) { + $selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':''; + $client_select .= "\r\n"; + } + } + $app->tpl->setVar("client_group_id",$client_select); + + } + + /* + * Now we have to check, if we should use the domain-module to select the domain + * or not + */ + $app->uses('ini_parser,getconf'); + $settings = $app->getconf->get_global_config('domains'); + if ($settings['use_domain_module'] == 'y') { + /* + * The domain-module is in use. + */ + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + /* + * The admin can select ALL domains, the user only the domains assigned to him + */ + $sql = "SELECT domain FROM domain "; + if ($_SESSION["s"]["user"]["typ"] != 'admin') { + $sql .= "WHERE sys_groupid =" . $client_group_id; + } + $sql .= " ORDER BY domain"; + $domains = $app->db->queryAllRecords($sql); + $domain_select = ''; + if(is_array($domains) && sizeof($domains) > 0) { + /* We have domains in the list, so create the drop-down-list */ + foreach( $domains as $domain) { + $domain_select .= "\r\n"; + } + $app->tpl->setVar("domain_option",$domain_select); + } + + + // Get the spamfilter policys for the user + $tmp_user = $app->db->queryOneRecord("SELECT policy_id FROM spamfilter_users WHERE email = '@".$this->dataRecord["domain"]."'"); + $sql = "SELECT id, policy_name FROM spamfilter_policy WHERE ".$app->tform->getAuthSQL('r'); + $policys = $app->db->queryAllRecords($sql); + $policy_select = ""; + if(is_array($policys)) { + foreach( $policys as $p) { + $selected = ($p["id"] == $tmp_user["policy_id"])?'SELECTED':''; + $policy_select .= "\r\n"; + } + } + $app->tpl->setVar("policy",$policy_select); + unset($policys); + unset($policy_select); + unset($tmp_user); + + if($this->id > 0) { + //* we are editing a existing record + $app->tpl->setVar("edit_disabled", 1); + $app->tpl->setVar("server_id_value", $this->dataRecord["server_id"]); + } else { + $app->tpl->setVar("edit_disabled", 0); + } + + parent::onShowEnd(); + } + + function onSubmit() { + global $app, $conf; + if($_SESSION["s"]["user"]["typ"] != 'admin') { + + // Get the limits of the client + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $client = $app->db->queryOneRecord("SELECT limit_maildomain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + + // When the record is updated + if($this->id > 0) { + // restore the server ID if the user is not admin and record is edited + $tmp = $app->db->queryOneRecord("SELECT server_id FROM mail_domain WHERE domain_id = ".intval($this->id)); + $this->dataRecord["server_id"] = $tmp["server_id"]; + unset($tmp); + // When the record is inserted + } else { + // set the server ID to the default mailserver of the client + $this->dataRecord["server_id"] = $client["default_mailserver"]; + + // Check if the user may add another mail_domain + if($client["limit_maildomain"] >= 0) { + $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM mail_domain WHERE sys_groupid = $client_group_id"); + if($tmp["number"] >= $client["limit_maildomain"]) { + $app->error($app->tform->wordbook["limit_maildomain_txt"]); + } + } + } + + // Clients may not set the client_group_id, so we unset them if user is not a admin + if(!$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]); + } + + //* make sure that the email domain is lowercase + if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]); + + + parent::onSubmit(); + } + + function onAfterInsert() { + global $app, $conf; + + // make sure that the record belongs to the client group and not the admin group when a dmin inserts it + // also make sure that the user can not delete domain created by a admin + if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { + $client_group_id = intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); + } + if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { + $client_group_id = intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id); + } + + // Spamfilter policy + $policy_id = intval($this->dataRecord["policy"]); + if($policy_id > 0) { + $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".mysql_real_escape_string($this->dataRecord["domain"])."'"); + if($tmp_user["id"] > 0) { + // There is already a record that we will update + $app->db->datalogUpdate('spamfilter_users', "policy_id = $ploicy_id", 'id', $tmp_user["id"]); + } else { + $tmp_domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain_id = ".$this->id); + // We create a new record + $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) + VALUES (".$_SESSION["s"]["user"]["userid"].", ".$tmp_domain["sys_groupid"].", 'riud', 'riud', '', ".$this->dataRecord["server_id"].", 5, ".$policy_id.", '@".mysql_real_escape_string($this->dataRecord["domain"])."', '@".mysql_real_escape_string($this->dataRecord["domain"])."', 'Y')"; + $app->db->datalogInsert('spamfilter_users', $insert_data, 'id'); + unset($tmp_domain); + } + } // endif spamfilter policy + } + + function onBeforeUpdate() { + global $app, $conf; + + //* Check if the server has been changed + // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway + if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) { + $rec = $app->db->queryOneRecord("SELECT server_id, domain from mail_domain WHERE domain_id = ".$this->id); + if($rec['server_id'] != $this->dataRecord["server_id"]) { + //* Add a error message and switch back to old server + $app->tform->errorMessage .= $app->lng('The Server can not be changed.'); + $this->dataRecord["server_id"] = $rec['server_id']; + } + unset($rec); + //* If the user is neither admin nor reseller + } else { + //* We do not allow users to change a domain which has been created by the admin + $rec = $app->db->queryOneRecord("SELECT domain from mail_domain WHERE domain_id = ".$this->id); + if($rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id,'u')) { + //* Add a error message and switch back to old server + $app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.'); + $this->dataRecord["domain"] = $rec['domain']; + } + unset($rec); + } + } + + + + function onAfterUpdate() { + global $app, $conf; + + // make sure that the record belongs to the clinet group and not the admin group when admin inserts it + // also make sure that the user can not delete domain created by a admin + if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { + $client_group_id = intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); + } + if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { + $client_group_id = intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id); + } + + // Spamfilter policy + $policy_id = intval($this->dataRecord["policy"]); + $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".mysql_real_escape_string($this->dataRecord["domain"])."'"); + if($policy_id > 0) { + if($tmp_user["id"] > 0) { + // There is already a record that we will update + $app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]); + } else { + $tmp_domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain_id = ".$this->id); + // We create a new record + $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) + VALUES (".$_SESSION["s"]["user"]["userid"].", ".$tmp_domain["sys_groupid"].", 'riud', 'riud', '', ".$this->dataRecord["server_id"].", 5, ".$policy_id.", '@".mysql_real_escape_string($this->dataRecord["domain"])."', '@".mysql_real_escape_string($this->dataRecord["domain"])."', 'Y')"; + $app->db->datalogInsert('spamfilter_users', $insert_data, 'id'); + unset($tmp_domain); + } + } else { + if($tmp_user["id"] > 0) { + // There is already a record but the user shall have no policy, so we delete it + $app->db->datalogDelete('spamfilter_users', 'id', $tmp_user["id"]); + } + } // endif spamfilter policy + //** If the domain name or owner has been changed, change the domain and owner in all mailbox records + if($this->oldDataRecord['domain'] != $this->dataRecord['domain'] || (isset($this->dataRecord['client_group_id']) && $this->oldDataRecord['sys_groupid'] != $this->dataRecord['client_group_id'])) { + $app->uses('getconf'); + $mail_config = $app->getconf->get_server_config($this->dataRecord["server_id"],'mail'); + + //* Update the mailboxes + $mailusers = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE email like '%@".mysql_real_escape_string($this->oldDataRecord['domain'])."'"); + $sys_groupid = (isset($this->dataRecord['client_group_id']))?$this->dataRecord['client_group_id']:$this->oldDataRecord['sys_groupid']; + if(is_array($mailusers)) { + foreach($mailusers as $rec) { + // setting Maildir, Homedir, UID and GID + $mail_parts = explode("@",$rec['email']); + $maildir = str_replace("[domain]",$this->dataRecord['domain'],$mail_config["maildir_path"]); + $maildir = str_replace("[localpart]",$mail_parts[0],$maildir); + $maildir = mysql_real_escape_string($maildir); + $email = mysql_real_escape_string($mail_parts[0].'@'.$this->dataRecord['domain']); + $app->db->datalogUpdate('mail_user', "maildir = '$maildir', email = '$email', sys_groupid = '$sys_groupid'", 'mailuser_id', $rec['mailuser_id']); + } + } + + //* Update the aliases + $forwardings = $app->db->queryAllRecords("SELECT * FROM mail_forwarding WHERE source like '%@".mysql_real_escape_string($this->oldDataRecord['domain'])."' OR destination like '%@".mysql_real_escape_string($this->oldDataRecord['domain'])."'"); + if(is_array($forwardings)) { + foreach($forwardings as $rec) { + $destination = mysql_real_escape_string(str_replace($this->oldDataRecord['domain'],$this->dataRecord['domain'],$rec['destination'])); + $source = mysql_real_escape_string(str_replace($this->oldDataRecord['domain'],$this->dataRecord['domain'],$rec['source'])); + $app->db->datalogUpdate('mail_forwarding', "source = '$source', destination = '$destination', sys_groupid = '$sys_groupid'", 'forwarding_id', $rec['forwarding_id']); + } + } + + //* Update the mailinglist + $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $sys_groupid WHERE domain = '".mysql_real_escape_string($this->oldDataRecord['domain'])."'"); + + //* Delete the old spamfilter record + $tmp = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".mysql_real_escape_string($this->oldDataRecord["domain"])."'"); + $app->db->datalogDelete('spamfilter_users', 'id', $tmp["id"]); + unset($tmp); + + } // end if domain name changed + + } + +} + +$page = new page_action; +$page->onLoad(); + ?> \ No newline at end of file diff --git a/interface/web/mail/mail_mailinglist_del.php b/interface/web/mail/mail_mailinglist_del.php new file mode 100644 index 0000000000000000000000000000000000000000..a0f0a8fb1a4c13c223f67c55dbcc217e47d323ca --- /dev/null +++ b/interface/web/mail/mail_mailinglist_del.php @@ -0,0 +1,58 @@ +auth->check_module_permissions('mail'); + +// Loading classes +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { +} + +$page = new page_action; +$page->onDelete(); + +?> \ No newline at end of file diff --git a/interface/web/mail/mail_mailinglist_edit.php b/interface/web/mail/mail_mailinglist_edit.php new file mode 100644 index 0000000000000000000000000000000000000000..9729757db0651ed694557f5a2b24b882c9db781d --- /dev/null +++ b/interface/web/mail/mail_mailinglist_edit.php @@ -0,0 +1,256 @@ +auth->check_module_permissions('mail'); + +// Loading classes +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + + function onShowNew() { + global $app, $conf; + + // we will check only users, not admins + if($_SESSION["s"]["user"]["typ"] == 'user') { + if(!$app->tform->checkClientLimit('limit_mailmailinglist')) { + $app->error($app->tform->wordbook["limit_mailmailinglist_txt"]); + } + if(!$app->tform->checkResellerLimit('limit_mailmailinglist')) { + $app->error('Reseller: '.$app->tform->wordbook["limit_mailmailinglist_txt"]); + } + } + + parent::onShowNew(); + } + + function onShowEnd() { + global $app, $conf; + + if($_SESSION["s"]["user"]["typ"] == 'admin') { + // Getting Clients of the user + if($_SESSION["s"]["user"]["typ"] == 'admin') { + $sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name"; + } else { + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $sql = "SELECT client.client_id, limit_web_domain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"; + } + $clients = $app->db->queryAllRecords($sql); + $client_select = ''; + if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= ""; + $tmp_data_record = $app->tform->getDataRecord($this->id); + if(is_array($clients)) { + foreach( $clients as $client) { + $selected = ($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':''; + $client_select .= "\r\n"; + } + } + $app->tpl->setVar("client_group_id",$client_select); + + } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) { + + // Get the limits of the client + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $client = $app->db->queryOneRecord("SELECT client.client_id, contact_name, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id order by contact_name"); + + // Fill the client select field + $sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']; + $clients = $app->db->queryAllRecords($sql); + $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']); + $client_select = ''; + $tmp_data_record = $app->tform->getDataRecord($this->id); + if(is_array($clients)) { + foreach( $clients as $client) { + $selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':''; + $client_select .= "\r\n"; + } + } + $app->tpl->setVar("client_group_id",$client_select); + } + + // Getting Domains of the user + $sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain'; + $domains = $app->db->queryAllRecords($sql); + $domain_select = ''; + if(is_array($domains)) { + foreach( $domains as $domain) { + $selected = ($domain["domain"] == $this->dataRecord["domain"])?'SELECTED':''; + $domain_select .= "\r\n"; + } + } + $app->tpl->setVar("domain_option",$domain_select); + + if($this->id > 0) { + //* we are editing a existing record + $app->tpl->setVar("edit_disabled", 1); + $app->tpl->setVar("listname_value", $this->dataRecord["listname"]); + $app->tpl->setVar("domain_value", $this->dataRecord["domain"]); + $app->tpl->setVar("email_value", $this->dataRecord["email"]); + } else { + $app->tpl->setVar("edit_disabled", 0); + } + + parent::onShowEnd(); + } + + function onSubmit() { + global $app, $conf; + + if($_SESSION["s"]["user"]["typ"] != 'admin') { + + // Get the limits of the client + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $client = $app->db->queryOneRecord("SELECT limit_mailmailinglist, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + + //* Check if Domain belongs to user + if(isset($_POST["domain"])) { + $domain = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = '".$this->dataRecord["domain"]."' AND ".$app->tform->getAuthSQL('r')); + if($domain["domain"] != $this->dataRecord["domain"]) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm"); + } + + // When the record is updated + if($this->id == 0) { + //Check if email is in use + $check = $app->db->queryOneRecord("SELECT count(source) as number FROM mail_forwarding WHERE source = '".$this->dataRecord["listname"]."@".$this->dataRecord["domain"]."'"); + if($check['number'] != 0) { + $app->error($app->tform->wordbook["email_in_use_txt"]); + } + + $check = $app->db->queryOneRecord("SELECT count(email) as number FROM mail_user WHERE email = '".$this->dataRecord["listname"]."@".$this->dataRecord["domain"]."'"); + if($check['number'] != 0) { + $app->error($app->tform->wordbook["email_in_use_txt"]); + } + + $check = $app->db->queryOneRecord("SELECT count(mailinglist_id) as number FROM mail_mailinglist WHERE listname = '".$this->dataRecord["listname"]."' AND domain = '".$this->dataRecord["domain"]."'"); + if($check['number'] != 0) { + $app->error($app->tform->wordbook["email_in_use_txt"]); + } + + // Check if the user may add another mail_domain + if($client["limit_mailmailinglist"] >= 0) { + $tmp = $app->db->queryOneRecord("SELECT count(mailinglist_id) as number FROM mail_mailinglist WHERE sys_groupid = $client_group_id"); + if($tmp["number"] >= $client["limit_mailmailinglist"]) { + $app->error($app->tform->wordbook["limit_mailmailinglist_txt"]); + } + } + } + + // Clients may not set the client_group_id, so we unset them if user is not a admin + if(!$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]); + } + + //* make sure that the email domain is lowercase + if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]); + + parent::onSubmit(); + } + + function onBeforeInsert() { + global $app, $conf; + + // Set the server id of the mailinglist = server ID of mail domain. + $domain = $app->db->queryOneRecord("SELECT server_id FROM mail_domain WHERE domain = '".$this->dataRecord["domain"]."'"); + $this->dataRecord["server_id"] = $domain['server_id']; + } + + function onAfterInsert() { + global $app, $conf; + + // make sure that the record belongs to the client group and not the admin group when a dmin inserts it + // also make sure that the user can not delete domain created by a admin + if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { + $client_group_id = intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE mailinglist_id = ".$this->id); + } + if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { + $client_group_id = intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE mailinglist_id = ".$this->id); + } + } + + function onBeforeUpdate() { + global $app, $conf; + + //* Check if the server has been changed + // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway + if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) { + $rec = $app->db->queryOneRecord("SELECT server_id, domain from mail_mailinglist WHERE mailinglist_id = ".$this->id); + $this->dataRecord["server_id"] = $rec['server_id']; + unset($rec); + //* If the user is neither admin nor reseller + } else { + //* We do not allow users to change a domain which has been created by the admin + $rec = $app->db->queryOneRecord("SELECT domain from mail_mailinglist WHERE mailinglist_id = ".$this->id); + if($rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id,'u')) { + //* Add a error message and switch back to old server + $app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.'); + $this->dataRecord["domain"] = $rec['domain']; + } + unset($rec); + } + } + + function onAfterUpdate() { + global $app, $conf; + + // make sure that the record belongs to the clinet group and not the admin group when admin inserts it + // also make sure that the user can not delete domain created by a admin + if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { + $client_group_id = intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE mailinglist_id = ".$this->id); + } + if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { + $client_group_id = intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE mailinglist_id = ".$this->id); + } + } + +} + +$app->tform_actions = new page_action; +$app->tform_actions->onLoad(); + +?> diff --git a/interface/web/mail/mail_mailinglist_list.php b/interface/web/mail/mail_mailinglist_list.php new file mode 100644 index 0000000000000000000000000000000000000000..b466c522d9f829a91dc5601d981cdf4f1ca4a134 --- /dev/null +++ b/interface/web/mail/mail_mailinglist_list.php @@ -0,0 +1,44 @@ +auth->check_module_permissions('mail'); + +$app->load('listform_actions'); + + +class list_action extends listform_actions { + + function onShow() { + global $app,$conf; + + $app->uses('getconf'); + $global_config = $app->getconf->get_global_config('mail'); + + if($global_config['mailmailinglist_link'] == 'y') { + $app->tpl->setVar('mailmailinglist_link',1); + } else { + $app->tpl->setVar('mailmailinglist_link',0); + } + + parent::onShow(); + } + +} + +$list = new list_action; +$list->onLoad(); + + +?> \ No newline at end of file diff --git a/interface/web/mail/mailinglist.php b/interface/web/mail/mailinglist.php new file mode 100644 index 0000000000000000000000000000000000000000..67b35e179a197bddd2b514266501d5257f14f068 --- /dev/null +++ b/interface/web/mail/mailinglist.php @@ -0,0 +1,68 @@ +auth->check_module_permissions('mail'); + +/* get the id of the mail (must be int!) */ +if (!isset($_GET['id'])){ + die ("No List selected!"); +} +$listId = intval($_GET['id']); + +/* + * Get the data to connect to the database + */ +$dbData = $app->db->queryAllRecords("SELECT server_id, listname FROM mail_mailinglist WHERE mailinglist_id = " . $listId); +$serverId = intval($dbData[0]['server_id']); +if ($serverId == 0){ + die ("No List - Server found!"); +} + +$serverData = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".$serverId); + +$app->uses('getconf'); +$global_config = $app->getconf->get_global_config('mail'); + +if($global_config['mailmailinglist_url'] != '') { + header('Location:' . $global_config['mailmailinglist_url']); +} else { + +/* + * We only redirect to the login-form, so there is no need, to check any rights + */ + isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http'; + header('Location:' . $http . '://' . $serverData['server_name'] . '/cgi-bin/mailman/admin/' . $dbData[0]['listname']); +} +exit; +?> \ No newline at end of file diff --git a/interface/web/mail/templates/mail_mailinglist_edit.htm b/interface/web/mail/templates/mail_mailinglist_edit.htm new file mode 100644 index 0000000000000000000000000000000000000000..2ac742ee1b973fcbe6e8630c00a8fa99e9bab512 --- /dev/null +++ b/interface/web/mail/templates/mail_mailinglist_edit.htm @@ -0,0 +1,80 @@ +

+

+ +
+ +
+
Mailing List + +
+ + +
+
+ + +
+ + +
+
+ + +
+ + + +
+ +
+ + + +
+
+ + + +
+ +
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+

{tmpl_var name='password_strength_txt'}

+
+

 

+
+
+ + + +
+ + +
+
+ +
diff --git a/interface/web/mail/templates/mail_mailinglist_list.htm b/interface/web/mail/templates/mail_mailinglist_list.htm new file mode 100644 index 0000000000000000000000000000000000000000..58da87ecc96e015b9a6cca80ebcf283a042b7bcf --- /dev/null +++ b/interface/web/mail/templates/mail_mailinglist_list.htm @@ -0,0 +1,53 @@ +

+ +
+ +
+
{tmpl_var name="toolsarea_head_txt"} +
+ +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
{tmpl_var name="listname"}{tmpl_var name="domain"} + +
+
+
+ +
diff --git a/server/conf/mm_cfg.py.master b/server/conf/mm_cfg.py.master new file mode 100644 index 0000000000000000000000000000000000000000..9ec47a727ea678448d6eaed24fd56fdda2d4c17d --- /dev/null +++ b/server/conf/mm_cfg.py.master @@ -0,0 +1,106 @@ +# -*- python -*- + +# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA + + +"""This is the module which takes your site-specific settings. + +From a raw distribution it should be copied to mm_cfg.py. If you +already have an mm_cfg.py, be careful to add in only the new settings +you want. The complete set of distributed defaults, with annotation, +are in ./Defaults. In mm_cfg, override only those you want to +change, after the + + from Defaults import * + +line (see below). + +Note that these are just default settings - many can be overridden via the +admin and user interfaces on a per-list or per-user basis. + +Note also that some of the settings are resolved against the active list +setting by using the value as a format string against the +list-instance-object's dictionary - see the distributed value of +DEFAULT_MSG_FOOTER for an example.""" + + +####################################################### +# Here's where we get the distributed defaults. # + +from Defaults import * + +############################################################## +# Put YOUR site-specific configuration below, in mm_cfg.py . # +# See Defaults.py for explanations of the values. # + +#------------------------------------------------------------- +# The name of the list Mailman uses to send password reminders +# and similar. Don't change if you want mailman-owner to be +# a valid local part. +MAILMAN_SITE_LIST = 'mailman' + +#------------------------------------------------------------- +# If you change these, you have to configure your http server +# accordingly (Alias and ScriptAlias directives in most httpds) +DEFAULT_URL_PATTERN = 'http://%s/cgi-bin/mailman/' +PRIVATE_ARCHIVE_URL = '/cgi-bin/mailman/private' +IMAGE_LOGOS = '/images/mailman/' + +#------------------------------------------------------------- +# Default domain for email addresses of newly created MLs +DEFAULT_EMAIL_HOST = '{hostname}' +#------------------------------------------------------------- +# Default host for web interface of newly created MLs +DEFAULT_URL_HOST = '{hostname}' +#------------------------------------------------------------- +# Required when setting any of its arguments. +add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST) + +#------------------------------------------------------------- +# The default language for this server. +DEFAULT_SERVER_LANGUAGE = {default_language} + +#------------------------------------------------------------- +# Iirc this was used in pre 2.1, leave it for now +USE_ENVELOPE_SENDER = 0 # Still used? + +#------------------------------------------------------------- +# Unset send_reminders on newly created lists +DEFAULT_SEND_REMINDERS = 0 + +#------------------------------------------------------------- +# Uncomment this if you configured your MTA such that it +# automatically recognizes newly created lists. +# (see /usr/share/doc/mailman/README.Exim4.Debian or +# /usr/share/mailman/postfix-to-mailman.py) +# MTA=None # Misnomer, suppresses alias output on newlist + +#------------------------------------------------------------- +# Uncomment if you use Postfix virtual domains (but not +# postfix-to-mailman.py), but be sure to see +# /usr/share/doc/mailman/README.Debian first. +MTA='Postfix' +POSTFIX_STYLE_VIRTUAL_DOMAINS = [{virtual_domains}] +#------------------------------------------------------------- +# Uncomment if you want to filter mail with SpamAssassin. For +# more information please visit this website: +# http://www.jamesh.id.au/articles/mailman-spamassassin/ +# GLOBAL_PIPELINE.insert(1, 'SpamAssassin') + +# Note - if you're looking for something that is imported from mm_cfg, but you +# didn't find it above, it's probably in /usr/lib/mailman/Mailman/Defaults.py. \ No newline at end of file diff --git a/server/mods-available/mail_module.inc.php b/server/mods-available/mail_module.inc.php index 2d9df3a59347ed5716ee88a341ca1ccf03c2a3b1..1b7f9575ba7fdfb0c5859f31b1ea2ea3ac36c975 100644 --- a/server/mods-available/mail_module.inc.php +++ b/server/mods-available/mail_module.inc.php @@ -1,153 +1,162 @@ -plugins->announceEvents($this->module_name,$this->actions_available); - - /* - As we want to get notified of any changes on several database tables, - we register for them. - - The following function registers the function "functionname" - to be executed when a record for the table "dbtable" is - processed in the sys_datalog. "classname" is the name of the - class that contains the function functionname. - */ - - $app->modules->registerTableHook('mail_access','mail_module','process'); - $app->modules->registerTableHook('mail_domain','mail_module','process'); - $app->modules->registerTableHook('mail_forwarding','mail_module','process'); - $app->modules->registerTableHook('mail_transport','mail_module','process'); - $app->modules->registerTableHook('mail_user','mail_module','process'); - $app->modules->registerTableHook('mail_get','mail_module','process'); - $app->modules->registerTableHook('mail_content_filter','mail_module','process'); - - } - - /* - This function is called when a change in one of the registered tables is detected. - The function then raises the events for the plugins. - */ - - function process($tablename,$action,$data) { - global $app; - - switch ($tablename) { - case 'mail_access': - if($action == 'i') $app->plugins->raiseEvent('mail_access_insert',$data); - if($action == 'u') $app->plugins->raiseEvent('mail_access_update',$data); - if($action == 'd') $app->plugins->raiseEvent('mail_access_delete',$data); - break; - case 'mail_domain': - if($action == 'i') $app->plugins->raiseEvent('mail_domain_insert',$data); - if($action == 'u') $app->plugins->raiseEvent('mail_domain_update',$data); - if($action == 'd') $app->plugins->raiseEvent('mail_domain_delete',$data); - break; - case 'mail_forwarding': - if($action == 'i') $app->plugins->raiseEvent('mail_forwarding_insert',$data); - if($action == 'u') $app->plugins->raiseEvent('mail_forwarding_update',$data); - if($action == 'd') $app->plugins->raiseEvent('mail_forwarding_delete',$data); - break; - case 'mail_transport': - if($action == 'i') $app->plugins->raiseEvent('mail_transport_insert',$data); - if($action == 'u') $app->plugins->raiseEvent('mail_transport_update',$data); - if($action == 'd') $app->plugins->raiseEvent('mail_transport_delete',$data); - break; - case 'mail_user': - if($action == 'i') $app->plugins->raiseEvent('mail_user_insert',$data); - if($action == 'u') $app->plugins->raiseEvent('mail_user_update',$data); - if($action == 'd') $app->plugins->raiseEvent('mail_user_delete',$data); - break; - case 'mail_get': - if($action == 'i') $app->plugins->raiseEvent('mail_get_insert',$data); - if($action == 'u') $app->plugins->raiseEvent('mail_get_update',$data); - if($action == 'd') $app->plugins->raiseEvent('mail_get_delete',$data); - break; - case 'mail_content_filter': - if($action == 'i') $app->plugins->raiseEvent('mail_content_filter_insert',$data); - if($action == 'u') $app->plugins->raiseEvent('mail_content_filter_update',$data); - if($action == 'd') $app->plugins->raiseEvent('mail_content_filter_delete',$data); - break; - } // end switch - } // end function - -} // end class - +plugins->announceEvents($this->module_name,$this->actions_available); + + /* + As we want to get notified of any changes on several database tables, + we register for them. + + The following function registers the function "functionname" + to be executed when a record for the table "dbtable" is + processed in the sys_datalog. "classname" is the name of the + class that contains the function functionname. + */ + + $app->modules->registerTableHook('mail_access','mail_module','process'); + $app->modules->registerTableHook('mail_domain','mail_module','process'); + $app->modules->registerTableHook('mail_forwarding','mail_module','process'); + $app->modules->registerTableHook('mail_transport','mail_module','process'); + $app->modules->registerTableHook('mail_user','mail_module','process'); + $app->modules->registerTableHook('mail_get','mail_module','process'); + $app->modules->registerTableHook('mail_content_filter','mail_module','process'); + $app->modules->registerTableHook('mail_mailinglist','mail_module','process'); + + } + + /* + This function is called when a change in one of the registered tables is detected. + The function then raises the events for the plugins. + */ + + function process($tablename,$action,$data) { + global $app; + + switch ($tablename) { + case 'mail_access': + if($action == 'i') $app->plugins->raiseEvent('mail_access_insert',$data); + if($action == 'u') $app->plugins->raiseEvent('mail_access_update',$data); + if($action == 'd') $app->plugins->raiseEvent('mail_access_delete',$data); + break; + case 'mail_domain': + if($action == 'i') $app->plugins->raiseEvent('mail_domain_insert',$data); + if($action == 'u') $app->plugins->raiseEvent('mail_domain_update',$data); + if($action == 'd') $app->plugins->raiseEvent('mail_domain_delete',$data); + break; + case 'mail_forwarding': + if($action == 'i') $app->plugins->raiseEvent('mail_forwarding_insert',$data); + if($action == 'u') $app->plugins->raiseEvent('mail_forwarding_update',$data); + if($action == 'd') $app->plugins->raiseEvent('mail_forwarding_delete',$data); + break; + case 'mail_transport': + if($action == 'i') $app->plugins->raiseEvent('mail_transport_insert',$data); + if($action == 'u') $app->plugins->raiseEvent('mail_transport_update',$data); + if($action == 'd') $app->plugins->raiseEvent('mail_transport_delete',$data); + break; + case 'mail_user': + if($action == 'i') $app->plugins->raiseEvent('mail_user_insert',$data); + if($action == 'u') $app->plugins->raiseEvent('mail_user_update',$data); + if($action == 'd') $app->plugins->raiseEvent('mail_user_delete',$data); + break; + case 'mail_get': + if($action == 'i') $app->plugins->raiseEvent('mail_get_insert',$data); + if($action == 'u') $app->plugins->raiseEvent('mail_get_update',$data); + if($action == 'd') $app->plugins->raiseEvent('mail_get_delete',$data); + break; + case 'mail_content_filter': + if($action == 'i') $app->plugins->raiseEvent('mail_content_filter_insert',$data); + if($action == 'u') $app->plugins->raiseEvent('mail_content_filter_update',$data); + if($action == 'd') $app->plugins->raiseEvent('mail_content_filter_delete',$data); + break; + case 'mail_mailinglist': + if($action == 'i') $app->plugins->raiseEvent('mail_mailinglist_insert',$data); + if($action == 'u') $app->plugins->raiseEvent('mail_mailinglist_update',$data); + if($action == 'd') $app->plugins->raiseEvent('mail_mailinglist_delete',$data); + break; + } // end switch + } // end function + +} // end class + ?> \ No newline at end of file diff --git a/server/plugins-available/mailman_plugin.inc.php b/server/plugins-available/mailman_plugin.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..5e13ba3bfba930c825b129014eae2a0716c69ecd --- /dev/null +++ b/server/plugins-available/mailman_plugin.inc.php @@ -0,0 +1,155 @@ +plugins->registerEvent('mail_mailinglist_insert','mailman_plugin','insert'); + $app->plugins->registerEvent('mail_mailinglist_update','mailman_plugin','update'); + $app->plugins->registerEvent('mail_mailinglist_delete','mailman_plugin','delete'); + + + + } + + function insert($event_name,$data) { + global $app, $conf; + + $this->update_config(); + + exec("/usr/lib/mailman/bin/newlist -u ".$data["new"]["domain"]." -e ".$data["new"]["domain"]." ".$data["new"]["listname"]." ".$data["new"]["email"]." ".$data["new"]["password"].""); + + exec($conf['init_scripts'] . '/' . 'mailman reload &> /dev/null'); + + $app->db->query("UPDATE mail_mailinglist SET password = '' WHERE mailinglist_id = ".$data["new"]['mailinglist_id']); + + } + + // The purpose of this plugin is to rewrite the main.cf file + function update($event_name,$data) { + global $app, $conf; + + exec("/usr/lib/mailman/bin/change_pw -l ".$data["new"]["listname"]." -p ".$data["new"]["password"].""); + + exec($conf['init_scripts'] . '/' . 'mailman reload &> /dev/null'); + + $app->db->query("UPDATE mail_mailinglist SET password = '' WHERE mailinglist_id = ".$data["new"]['mailinglist_id']); + + } + + function delete($event_name,$data) { + global $app, $conf; + + $this->update_config(); + + exec("/usr/lib/mailman/bin/rmlist -a ".$data["old"]["listname"]); + + exec($conf['init_scripts'] . '/' . 'mailman reload &> /dev/null'); + + } + + function update_config() { + global $app, $conf; + + copy($this->mailman_config_dir.'mm_cfg.py',$this->mailman_config_dir.'mm_cfg.py'); + + // load the server configuration options + $app->uses('getconf'); + $server_config = $app->getconf->get_server_config($conf['server_id'], 'server'); + + // load files + $content = file_get_contents($conf["rootpath"]."/conf/mm_cfg.py.master"); + $old_file = file_get_contents($this->mailman_config_dir."/mm_cfg.py"); + + $old_options = array(); + $lines = explode("\n", $old_file); + foreach ($lines as $line) + { + if (strlen($line) && substr($line, 0, 1) != '#') + { + list($key, $value) = explode("=", $line); + if (!empty($value)) + { + $key = rtrim($key); + $old_options[$key] = trim($value); + } + } + } + + // create virtual_domains list + $domainAll = $app->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain"); + $virtual_domains = ''; + foreach($domainAll as $domain) + { + if ($domainAll[0]['domain'] == $domain['domain']) + $virtual_domains .= "'".$domain['domain']."'"; + else + $virtual_domains .= ", '".$domain['domain']."'"; + } + + $content = str_replace('{hostname}', $server_config['hostname'], $content); + $content = str_replace('{default_language}', $old_options['DEFAULT_SERVER_LANGUAGE'], $content); + $content = str_replace('{virtual_domains}', $virtual_domains, $content); + + file_put_contents($this->mailman_config_dir."/mm_cfg.py", $content); + } + +} // end class + +?>