From b4c75070d8f792eebddcf561dcac9c3c94bd6bea Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 26 Jun 2007 11:57:01 +0000
Subject: [PATCH] Several updaes and bugfixes.

---
 install/dist/conf/debian40.conf.php           |   6 +
 install/install.php                           |   4 +
 install/lib/installer_base.lib.php            |  26 ++++
 install/sql/ispconfig3.sql                    | 122 +++++++++++++++--
 install/tpl/apache_ispconfig.vhost.master     |  27 ++++
 install/tpl/config.inc.php.master             |   2 +-
 install/tpl/pureftpd_mysql.conf.master        | 128 ++++++++++++++++++
 interface/web/monitor/system.php              |   2 +-
 interface/web/sites/form/ftp_user.tform.php   |  15 --
 interface/web/sites/ftp_user_edit.php         |  20 +++
 .../web/sites/templates/ftp_user_advanced.htm |   8 +-
 .../web/sites/templates/ftp_user_edit.htm     |   2 +-
 server/plugins-enabled/apache2_plugin.inc.php |   1 -
 13 files changed, 329 insertions(+), 34 deletions(-)
 create mode 100644 install/tpl/apache_ispconfig.vhost.master
 create mode 100644 install/tpl/pureftpd_mysql.conf.master

diff --git a/install/dist/conf/debian40.conf.php b/install/dist/conf/debian40.conf.php
index 6a3c410c50..99718c797f 100644
--- a/install/dist/conf/debian40.conf.php
+++ b/install/dist/conf/debian40.conf.php
@@ -5,6 +5,7 @@ $conf["distname"] = "debian40";
 $conf["hostname"] = "server1.example.com"; // Full hostname
 $conf["ispconfig_install_dir"] = "/usr/local/ispconfig";
 $conf["ispconfig_config_dir"] = "/usr/local/ispconfig";
+$conf["server_id"] = 1;
 
 /*
 	Distribution specific settings
@@ -20,6 +21,8 @@ $conf["dist_apache_user"] = "www-data";
 $conf["dist_apache_group"] = "www-data";
 $conf["dist_apache_init_script"] = "apache2";
 $conf["dist_apache_version"] = "2.2";
+$conf["dist_apache_vhost_conf_dir"] = "/etc/apache2/sites-available";
+$conf["dist_apache_vhost_conf_enabled_dir"] = "/etc/apache2/sites-enabled";
 
 // Postfix
 $conf["dist_postfix_config_dir"] = "/etc/postfix";
@@ -41,6 +44,9 @@ $conf["dist_courier_config_dir"] = "/etc/courier";
 // Amavisd
 $conf["dist_amavis_config_dir"] = "/etc/amavis";
 
+// Pureftpd
+$conf["dist_pureftpd_config_dir"] = "/etc/pure-ftpd/db";
+
 /*
 	MySQL Database settings
 */
diff --git a/install/install.php b/install/install.php
index 5af71e9021..140db21a9f 100644
--- a/install/install.php
+++ b/install/install.php
@@ -90,6 +90,10 @@ $inst->configure_amavis();
 swriteln('Configuring Getmail');
 $inst->configure_getmail();
 
+// Configure Getmail
+swriteln('Configuring Pureftpd');
+$inst->configure_pureftpd();
+
 // Configure ISPConfig
 swriteln('Installing ISPConfig');
 $inst->install_ispconfig();
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 264d284929..00f60cb9ad 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -451,6 +451,26 @@ maildrop  unix  -       n       n       -       -       pipe
 	}
 	
 	
+	function configure_pureftpd() {
+		global $conf;
+		
+		// configure pam for SMTP authentication agains the ispconfig database
+		$configfile = 'mysql.conf';
+		if(is_file($conf["dist_pureftpd_config_dir"].'/'.$configfile)) copy($conf["dist_pureftpd_config_dir"].'/'.$configfile,$conf["dist_pureftpd_config_dir"].'/'.$configfile.'~');
+		if(is_file($conf["dist_pureftpd_config_dir"].'/'.$configfile.'~')) exec('chmod 400 '.$conf["dist_pureftpd_config_dir"].'/'.$configfile.'~');
+		$content = rf("tpl/pureftpd_".$configfile.".master");
+		$content = str_replace('{mysql_server_ispconfig_user}',$conf["mysql_server_ispconfig_user"],$content);
+		$content = str_replace('{mysql_server_ispconfig_password}',$conf["mysql_server_ispconfig_password"],$content);
+		$content = str_replace('{mysql_server_database}',$conf["mysql_server_database"],$content);
+		$content = str_replace('{mysql_server_ip}',$conf["mysql_server_ip"],$content);
+		$content = str_replace('{server_id}',$conf["server_id"],$content);
+		wf($conf["dist_pureftpd_config_dir"].'/'.$configfile,$content);
+		exec('chmod 600 '.$conf["dist_pureftpd_config_dir"].'/'.$configfile);
+		exec('chown root:root '.$conf["dist_pureftpd_config_dir"].'/'.$configfile);
+	
+	}
+	
+	
 	function install_ispconfig() {
 		global $conf;
 		
@@ -495,6 +515,7 @@ maildrop  unix  -       n       n       -       -       pipe
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf["mysql_server_ispconfig_password"],$content);
 		$content = str_replace('{mysql_server_database}',$conf["mysql_server_database"],$content);
 		$content = str_replace('{mysql_server_host}',$conf["mysql_server_host"],$content);
+		$content = str_replace('{server_id}',$conf["server_id"],$content);
 		wf($conf["ispconfig_install_dir"].'/server/lib/'.$configfile,$content);
 		
 		
@@ -517,6 +538,11 @@ maildrop  unix  -       n       n       -       -       pipe
 		$command = "chmod +x ".$conf["ispconfig_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
+		copy('tpl/apache_ispconfig.vhost.master',$conf["dist_apache_vhost_conf_dir"].'/ispconfig.vhost');
+		// and create the symlink
+		exec('ln -s '.$conf["dist_apache_vhost_conf_dir"].'/ispconfig.vhost '.$conf["dist_apache_vhost_conf_enabled_dir"].'/ispconfig.vhost');
+		
 	}
 	
 	function install_crontab() {
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index 15893bd72a..c80510db33 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -3,7 +3,7 @@
 -- http://www.phpmyadmin.net
 -- 
 -- Host: localhost
--- Erstellungszeit: 30. Mai 2007 um 16:57
+-- Erstellungszeit: 26. Juni 2007 um 13:47
 -- Server Version: 5.0.24
 -- PHP-Version: 5.1.4
 -- 
@@ -50,6 +50,8 @@ CREATE TABLE `client` (
   `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) NOT NULL,
+  `limit_web_ip` text NOT NULL,
   `username` varchar(255) default NULL,
   `password` varchar(255) default NULL,
   `language` varchar(255) NOT NULL default 'en',
@@ -61,6 +63,7 @@ CREATE TABLE `client` (
 -- Daten für Tabelle `client`
 -- 
 
+
 -- --------------------------------------------------------
 
 -- 
@@ -123,6 +126,41 @@ CREATE TABLE `dns_soa` (
 -- 
 
 
+-- --------------------------------------------------------
+
+-- 
+-- Tabellenstruktur für Tabelle `ftp_user`
+-- 
+
+CREATE TABLE `ftp_user` (
+  `ftp_user_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',
+  `parent_domain_id` int(11) NOT NULL default '0',
+  `username` varchar(255) default NULL,
+  `password` varchar(255) default NULL,
+  `quota_size` int(11) NOT NULL default '-1',
+  `active` varchar(255) NOT NULL default 'y',
+  `uid` int(11) NOT NULL default '0',
+  `gid` int(11) NOT NULL default '0',
+  `dir` varchar(255) default NULL,
+  `quota_files` int(11) 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`)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1 ;
+
+-- 
+-- Daten für Tabelle `ftp_user`
+-- 
+
+
 -- --------------------------------------------------------
 
 -- 
@@ -143,11 +181,13 @@ CREATE TABLE `mail_access` (
   `active` enum('n','y') NOT NULL default 'y',
   PRIMARY KEY  (`access_id`),
   KEY `server_id` (`server_id`,`source`)
-) ENGINE=MyISAM  DEFAULT CHARSET=latin1 ;
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1;
 
 -- 
 -- Daten für Tabelle `mail_access`
 -- 
+
+
 -- --------------------------------------------------------
 
 -- 
@@ -172,6 +212,7 @@ CREATE TABLE `mail_domain` (
 -- Daten für Tabelle `mail_domain`
 -- 
 
+
 -- --------------------------------------------------------
 
 -- 
@@ -192,12 +233,13 @@ CREATE TABLE `mail_forwarding` (
   `active` enum('y','n') NOT NULL,
   PRIMARY KEY  (`forwarding_id`),
   KEY `server_id` (`server_id`,`source`)
-) ENGINE=MyISAM  DEFAULT CHARSET=latin1 ;
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1;
 
 -- 
 -- Daten für Tabelle `mail_forwarding`
 -- 
 
+
 -- --------------------------------------------------------
 
 -- 
@@ -226,6 +268,7 @@ CREATE TABLE `mail_get` (
 -- Daten für Tabelle `mail_get`
 -- 
 
+
 -- --------------------------------------------------------
 
 -- 
@@ -241,7 +284,7 @@ CREATE TABLE `mail_greylist` (
   `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 DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
 
 -- 
 -- Daten für Tabelle `mail_greylist`
@@ -263,7 +306,7 @@ CREATE TABLE `mail_mailman_domain` (
   `mm_user` varchar(50) NOT NULL default '',
   `mm_group` varchar(50) NOT NULL default '',
   PRIMARY KEY  (`mailman_id`,`server_id`,`domain`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
 
 -- 
 -- Daten für Tabelle `mail_mailman_domain`
@@ -296,7 +339,6 @@ CREATE TABLE `mail_transport` (
 -- 
 -- Daten für Tabelle `mail_transport`
 -- 
-
 -- --------------------------------------------------------
 
 -- 
@@ -321,6 +363,7 @@ CREATE TABLE `mail_user` (
   `homedir` varchar(255) NOT NULL,
   `autoresponder` enum('n','y') NOT NULL default 'n',
   `autoresponder_text` tinytext NOT NULL,
+  `custom_mailfilter` text,
   `postfix` enum('y','n') NOT NULL,
   `access` enum('y','n') NOT NULL,
   PRIMARY KEY  (`mailuser_id`),
@@ -361,7 +404,28 @@ CREATE TABLE `server` (
 -- Daten für Tabelle `server`
 -- 
 
-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`) VALUES (1, 1, 1, 'riud', 'riud', 'r', 'Server 1', 1, 1, 1, 1, 1, 1, '[global]\nwebserver=apache\nmailserver=postfix\ndnsserver=mydns\n\n[mail]\nmodule=postfix_mysql\nmaildir_path=/home/vmail/[domain]/[localpart]/\nhomedir_path=/home/vmail/\nmailuser_uid=5000\nmailuser_gid=5000\n\n[getmail]\ngetmail_config_dir=/etc/getmail\n', 0, 1);
+-- --------------------------------------------------------
+
+-- 
+-- Tabellenstruktur für Tabelle `server_ip`
+-- 
+
+CREATE TABLE `server_ip` (
+  `server_ip_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(10) unsigned NOT NULL default '0',
+  `ip_address` varchar(15) default NULL,
+  `virtualhost` char(1) NOT NULL default 'y',
+  PRIMARY KEY  (`server_ip_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1 ;
+
+-- 
+-- Daten für Tabelle `server_ip`
+-- 
 
 -- --------------------------------------------------------
 
@@ -487,7 +551,6 @@ CREATE TABLE `spamfilter_wblist` (
 
 -- --------------------------------------------------------
 
-
 -- 
 -- Tabellenstruktur für Tabelle `sys_datalog`
 -- 
@@ -530,7 +593,7 @@ CREATE TABLE `sys_dbsync` (
   `last_datalog_id` bigint(20) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   KEY `last_datalog_id` (`last_datalog_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+) ENGINE=MyISAM DEFAULT CHARSET=latin1  ;
 
 -- 
 -- Daten für Tabelle `sys_dbsync`
@@ -583,7 +646,6 @@ CREATE TABLE `sys_group` (
 INSERT INTO `sys_group` (`groupid`, `name`, `description`, `client_id`) VALUES (1, 'admin', 'Administrators group', 0);
 INSERT INTO `sys_group` (`groupid`, `name`, `description`, `client_id`) VALUES (2, 'user', 'Users Group', 0);
 
-
 -- --------------------------------------------------------
 
 -- 
@@ -615,4 +677,42 @@ CREATE TABLE `sys_user` (
 -- Daten für Tabelle `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', 'admin,client,mail', 'mail', 'default', 'admin', 1, 'en', '1,2', 1, 0);
+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', 'admin,client,mail,monitor,sites', 'mail', 'default', 'admin', 1, 'en', '1,2', 1, 0);
+
+-- --------------------------------------------------------
+
+-- 
+-- Tabellenstruktur für Tabelle `web_domain`
+-- 
+
+CREATE TABLE `web_domain` (
+  `domain_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',
+  `ip_address` varchar(15) default NULL,
+  `domain` varchar(255) default NULL,
+  `type` varchar(255) NOT NULL default 'y',
+  `parent_domain_id` int(11) NOT NULL default '0',
+  `vhost_type` varchar(255) default NULL,
+  `document_root` varchar(255) default NULL,
+  `system_user` varchar(255) default NULL,
+  `system_group` varchar(255) default NULL,
+  `hd_quota` int(11) NOT NULL default '0',
+  `traffic_quota` int(11) NOT NULL default '0',
+  `cgi` varchar(255) NOT NULL default 'y',
+  `ssi` varchar(255) NOT NULL default 'y',
+  `suexec` varchar(255) NOT NULL default 'y',
+  `php` varchar(255) NOT NULL default 'y',
+  `redirect_type` varchar(255) NOT NULL default 'y',
+  `redirect_path` varchar(255) default NULL,
+  `active` varchar(255) NOT NULL default 'y',
+  PRIMARY KEY  (`domain_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1 ;
+
+-- 
+-- Daten für Tabelle `web_domain`
+-- 
diff --git a/install/tpl/apache_ispconfig.vhost.master b/install/tpl/apache_ispconfig.vhost.master
new file mode 100644
index 0000000000..ac691757cd
--- /dev/null
+++ b/install/tpl/apache_ispconfig.vhost.master
@@ -0,0 +1,27 @@
+
+######################################################
+# This virtual host contains the configuration
+# for the ISPConfig controlpanel
+######################################################
+
+Listen 8080
+NameVirtualHost *:8080
+
+<VirtualHost _default_:8080>
+	ServerAdmin webmaster@localhost
+    DocumentRoot /usr/local/ispconfig/interface/web/
+	
+	<IfModule mod_php5.c>
+  		AddType application/x-httpd-php .php
+	</IfModule>
+	
+	<Directory /usr/local/ispconfig/interface/web/>
+		Options FollowSymLinks
+		AllowOverride None
+	</Directory>
+	
+	ErrorLog /var/log/apache2/error.log
+	CustomLog /var/log/apache2/access.log combined
+    ServerSignature Off
+	
+</VirtualHost>
\ No newline at end of file
diff --git a/install/tpl/config.inc.php.master b/install/tpl/config.inc.php.master
index 5bf2aed238..83e6e4ac0b 100644
--- a/install/tpl/config.inc.php.master
+++ b/install/tpl/config.inc.php.master
@@ -35,7 +35,7 @@ ini_set('register_globals',0);
 
 $conf["app_title"] = "ISPConfig";
 $conf["app_version"] = "3.0.0";
-$conf["server_id"] 	= "1";
+$conf["server_id"] 	= "{server_id}";
 
 
 /*
diff --git a/install/tpl/pureftpd_mysql.conf.master b/install/tpl/pureftpd_mysql.conf.master
new file mode 100644
index 0000000000..8dceee90ef
--- /dev/null
+++ b/install/tpl/pureftpd_mysql.conf.master
@@ -0,0 +1,128 @@
+##############################################
+#                                            #
+# Sample Pure-FTPd Mysql configuration file. #
+# See README.MySQL for explanations.         #
+#                                            #
+##############################################
+
+
+# Optional : MySQL server name or IP. Don't define this for unix sockets.
+
+MYSQLServer     {mysql_server_ip}
+
+
+# Optional : MySQL port. Don't define this if a local unix socket is used.
+
+# MYSQLPort       3306
+
+
+# Optional : define the location of mysql.sock if the server runs on this host.
+
+# MYSQLSocket      /var/run/mysqld/mysqld.sock
+
+
+# Mandatory : user to bind the server as.
+
+MYSQLUser       {mysql_server_ispconfig_user}
+
+
+# Mandatory : user password. You must have a password.
+
+MYSQLPassword   {mysql_server_ispconfig_password}
+
+
+# Mandatory : database to open.
+
+MYSQLDatabase   {mysql_server_database}
+
+
+# Mandatory : how passwords are stored
+# Valid values are : "cleartext", "crypt", "md5" and "password"
+# ("password" = MySQL password() function)
+# You can also use "any" to try "crypt", "md5" *and* "password"
+
+MYSQLCrypt      crypt
+
+
+# In the following directives, parts of the strings are replaced at
+# run-time before performing queries :
+#
+# \L is replaced by the login of the user trying to authenticate.
+# \I is replaced by the IP address the user connected to.
+# \P is replaced by the port number the user connected to.
+# \R is replaced by the IP address the user connected from.
+# \D is replaced by the remote IP address, as a long decimal number.
+#
+# Very complex queries can be performed using these substitution strings,
+# especially for virtual hosting.
+
+
+# Query to execute in order to fetch the password
+
+MYSQLGetPW      SELECT password FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L"
+
+
+# Query to execute in order to fetch the system user name or uid
+
+MYSQLGetUID     SELECT uid FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L"
+
+
+# Optional : default UID - if set this overrides MYSQLGetUID
+
+#MYSQLDefaultUID 1000
+
+
+# Query to execute in order to fetch the system user group or gid
+
+MYSQLGetGID     SELECT gid FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L"
+
+
+# Optional : default GID - if set this overrides MYSQLGetGID
+
+#MYSQLDefaultGID 1000
+
+
+# Query to execute in order to fetch the home directory
+
+MYSQLGetDir     SELECT dir FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L"
+
+
+# Optional : query to get the maximal number of files 
+# Pure-FTPd must have been compiled with virtual quotas support.
+
+MySQLGetQTAFS  SELECT quota_files FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_files != '-1' AND username="\L"
+
+
+# Optional : query to get the maximal disk usage (virtual quotas)
+# The number should be in Megabytes.
+# Pure-FTPd must have been compiled with virtual quotas support.
+
+MySQLGetQTASZ  SELECT quota_size FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_files != '-1' AND username="\L"
+
+
+# Optional : ratios. The server has to be compiled with ratio support.
+
+MySQLGetRatioUL SELECT ul_ratio FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_files != '-1' AND username="\L"
+MySQLGetRatioDL SELECT dl_ratio FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_files != '-1' AND username="\L"
+
+
+# Optional : bandwidth throttling.
+# The server has to be compiled with throttling support.
+# Values are in KB/s .
+
+MySQLGetBandwidthUL SELECT ul_bandwidth FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_files != '-1' AND username="\L"
+MySQLGetBandwidthDL SELECT dl_bandwidth FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_files != '-1' AND username="\L"
+
+# Enable ~ expansion. NEVER ENABLE THIS BLINDLY UNLESS :
+# 1) You know what you are doing.
+# 2) Real and virtual users match.
+
+# MySQLForceTildeExpansion 1
+
+
+# If you upgraded your tables to transactionnal tables (Gemini,
+# BerkeleyDB, Innobase...), you can enable SQL transactions to
+# avoid races. Leave this commented if you are using the
+# traditionnal MyIsam databases or old (< 3.23.x) MySQL versions.
+
+# MySQLTransactions On
diff --git a/interface/web/monitor/system.php b/interface/web/monitor/system.php
index 43886a1bae..8286e2cb2f 100644
--- a/interface/web/monitor/system.php
+++ b/interface/web/monitor/system.php
@@ -333,7 +333,7 @@ function show_services ()
     $status = '<font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FF0000"><b>Offline</b></font>';
     }
     $html_out .= '<tr>
-       <td width="70%" bgcolor="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">BIND-Server:</font></td>
+       <td width="70%" bgcolor="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">DNS-Server:</font></td>
        <td width="30%" bgcolor="#FFFFFF"><center>'.$status.'</center></td>
      </tr>';
 
diff --git a/interface/web/sites/form/ftp_user.tform.php b/interface/web/sites/form/ftp_user.tform.php
index 232561a35a..9c13991721 100644
--- a/interface/web/sites/form/ftp_user.tform.php
+++ b/interface/web/sites/form/ftp_user.tform.php
@@ -173,9 +173,6 @@ $form["tabs"]['advanced'] = array (
 		'quota_files' => array (
 			'datatype'	=> 'INTEGER',
 			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'quota_files_error_empty'),
-									),
 			'default'	=> '0',
 			'value'		=> '',
 			'width'		=> '7',
@@ -184,9 +181,6 @@ $form["tabs"]['advanced'] = array (
 		'ul_ratio' => array (
 			'datatype'	=> 'INTEGER',
 			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ul_ratio_error_empty'),
-									),
 			'default'	=> '0',
 			'value'		=> '',
 			'width'		=> '7',
@@ -195,9 +189,6 @@ $form["tabs"]['advanced'] = array (
 		'dl_ratio' => array (
 			'datatype'	=> 'INTEGER',
 			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'qdl_ratio_error_empty'),
-									),
 			'default'	=> '0',
 			'value'		=> '',
 			'width'		=> '7',
@@ -206,9 +197,6 @@ $form["tabs"]['advanced'] = array (
 		'ul_bandwidth' => array (
 			'datatype'	=> 'INTEGER',
 			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ul_bandwidth_error_empty'),
-									),
 			'default'	=> '0',
 			'value'		=> '',
 			'width'		=> '7',
@@ -217,9 +205,6 @@ $form["tabs"]['advanced'] = array (
 		'dl_bandwidth' => array (
 			'datatype'	=> 'INTEGER',
 			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'dl_bandwidth_error_empty'),
-									),
 			'default'	=> '0',
 			'value'		=> '',
 			'width'		=> '7',
diff --git a/interface/web/sites/ftp_user_edit.php b/interface/web/sites/ftp_user_edit.php
index ba709b8218..4c90855b4c 100644
--- a/interface/web/sites/ftp_user_edit.php
+++ b/interface/web/sites/ftp_user_edit.php
@@ -54,6 +54,26 @@ $app->load('tform_actions');
 class page_action extends tform_actions {
 	
 	
+	function onAfterInsert() {
+		global $app, $conf;
+		
+		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
+		$server_id = $web["server_id"];
+		$dir = $web["document_root"];
+		$uid = $web["system_user"];
+		$gid = $web["system_group"];
+		
+		$sql = "UPDATE ftp_user SET server_id = $server_id, dir = '$dir', uid = '$uid', gid = '$gid' WHERE ftp_user_id = ".$this->id;
+		$app->db->query($sql);
+		
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+		
+		
+	}
+	
 }
 
 $page = new page_action;
diff --git a/interface/web/sites/templates/ftp_user_advanced.htm b/interface/web/sites/templates/ftp_user_advanced.htm
index 81e55387b1..97a09a468c 100644
--- a/interface/web/sites/templates/ftp_user_advanced.htm
+++ b/interface/web/sites/templates/ftp_user_advanced.htm
@@ -25,11 +25,11 @@
   </tr>
   <tr>
     <td class="frmText11">{tmpl_var name='ul_bandwidth_txt'}:</td>
-    <td class="frmText11"><input name="ul_bandwidth" type="text" class="text" value="{tmpl_var name='ul_bandwidth'}" size="7" maxlength="7"></td>
+    <td class="frmText11"><input name="ul_bandwidth" type="text" class="text" value="{tmpl_var name='ul_bandwidth'}" size="7" maxlength="7"> KB/s</td>
   </tr>
   <tr>
     <td class="frmText11">{tmpl_var name='dl_bandwidth_txt'}:</td>
-    <td class="frmText11"><input name="dl_bandwidth" type="text" class="text" value="{tmpl_var name='dl_bandwidth'}" size="7" maxlength="7"></td>
+    <td class="frmText11"><input name="dl_bandwidth" type="text" class="text" value="{tmpl_var name='dl_bandwidth'}" size="7" maxlength="7"> KB/s</td>
   </tr>  <tr>
     <td class="frmText11">&nbsp;</td>
     <td class="frmText11">&nbsp;</td>
@@ -39,6 +39,6 @@
     <td><input name="btn_save" type="button" class="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/ftp_user_edit.php');"><div class="buttonEnding"></div>&nbsp;
       <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('sites/ftp_user_list.php');"><div class="buttonEnding"></div>
     </td>
-  </tr>
-</table>
+  </tr>
+</table>
 <input type="hidden" name="id" value="{tmpl_var name='id'}">
\ No newline at end of file
diff --git a/interface/web/sites/templates/ftp_user_edit.htm b/interface/web/sites/templates/ftp_user_edit.htm
index 3d3bd98d72..894a0d1e5c 100644
--- a/interface/web/sites/templates/ftp_user_edit.htm
+++ b/interface/web/sites/templates/ftp_user_edit.htm
@@ -25,7 +25,7 @@
   </tr>
   <tr>
     <td class="frmText11">{tmpl_var name='quota_size_txt'}:</td>
-    <td class="frmText11"><input name="quota_size" type="text" class="text" value="{tmpl_var name='quota_size'}" size="7" maxlength="7"></td>
+    <td class="frmText11"><input name="quota_size" type="text" class="text" value="{tmpl_var name='quota_size'}" size="7" maxlength="7"> MB</td>
   </tr>
   <tr>
     <td class="frmText11">{tmpl_var name='active_txt'}:</td>
diff --git a/server/plugins-enabled/apache2_plugin.inc.php b/server/plugins-enabled/apache2_plugin.inc.php
index a96d317a45..f8aafe0bc2 100644
--- a/server/plugins-enabled/apache2_plugin.inc.php
+++ b/server/plugins-enabled/apache2_plugin.inc.php
@@ -33,7 +33,6 @@ class apache2_plugin {
 	var $plugin_name = 'apache2_plugin';
 	var $class_name = $this->plugin_name;
 	
-	
 		
 	/*
 	 	This function is called when the plugin is loaded
-- 
GitLab