diff --git a/install/sql/incremental/upd_0070.sql b/install/sql/incremental/upd_0070.sql
new file mode 100644
index 0000000000000000000000000000000000000000..37f667e70fb97d7bb69f840eb745d5f24cbd91b0
--- /dev/null
+++ b/install/sql/incremental/upd_0070.sql
@@ -0,0 +1 @@
+ALTER TABLE `mail_user` ADD `disablesieve-filter` ENUM( 'y', 'n' ) NOT NULL DEFAULT 'n' AFTER `disablesieve`;
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index f2744e5700949a0c5c30c1d6c8e890a8808e2bfa..92370373af340f29296b99b1ca0a29f0a49f4783 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -912,6 +912,7 @@ CREATE TABLE `mail_user` (
   `disabledeliver` enum('n','y') NOT NULL default 'n',
   `disablesmtp` enum('n','y') NOT NULL default 'n',
   `disablesieve` enum('n','y') NOT NULL default 'n',
+  `disablesieve-filter` enum('n','y') NOT NULL default 'n',
   `disablelda` enum('n','y') NOT NULL default 'n',
   `disablelmtp` enum('n','y') NOT NULL default 'n',
   `disabledoveadm` enum('n','y') NOT NULL default 'n',
diff --git a/install/tpl/debian6_dovecot-sql.conf.master b/install/tpl/debian6_dovecot-sql.conf.master
index 1fb6101abc454d1ca782b341d25fbc2313021dd6..86eb4df6fe5a6f5d804a6beb2cdab63a7afd7404 100644
--- a/install/tpl/debian6_dovecot-sql.conf.master
+++ b/install/tpl/debian6_dovecot-sql.conf.master
@@ -14,7 +14,7 @@ connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_se
 default_pass_scheme = CRYPT
 
 password_query = SELECT password FROM mail_user WHERE (login = '%u' OR email = '%u') AND disable%Ls = 'n'
-user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('*:storage=', quota, 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE (login = '%u' OR email = '%u') AND disable%Ls = 'n'
+user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('*:storage=', quota, 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE (login = '%u' OR email = '%u') AND `disable%Ls` = 'n'
 
 # The iterate_query is required for the doveadm command only and works only on dovecot 2 servers.
 # Do not enable it on Dovecot 1.x servers
diff --git a/install/tpl/fedora_dovecot-sql.conf.master b/install/tpl/fedora_dovecot-sql.conf.master
index d7389896ec98c57a70a4025bc5b4f83e58b66b71..faf3be286c7283700e1a45e1e802acb0b77acbdf 100644
--- a/install/tpl/fedora_dovecot-sql.conf.master
+++ b/install/tpl/fedora_dovecot-sql.conf.master
@@ -134,7 +134,7 @@ connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_se
 default_pass_scheme = CRYPT
 
 password_query = SELECT password FROM mail_user WHERE (login = '%u' OR email = '%u') AND disable%Ls = 'n'
-user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('*:storage=', quota, 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE (login = '%u' OR email = '%u') AND disable%Ls = 'n'
+user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('*:storage=', quota, 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE (login = '%u' OR email = '%u') AND `disable%Ls` = 'n'
 
 # The iterate_query is required for the doveadm command only and works only on dovecot 2 servers.
 # Do not enable it on Dovecot 1.x servers
diff --git a/install/tpl/opensuse_dovecot-sql.conf.master b/install/tpl/opensuse_dovecot-sql.conf.master
index de652c4fe1db081dec435922bf89f904e2f4c76d..e33603a1c20ac7332d9608e172286bfc83fb0ef0 100644
--- a/install/tpl/opensuse_dovecot-sql.conf.master
+++ b/install/tpl/opensuse_dovecot-sql.conf.master
@@ -134,7 +134,7 @@ connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_se
 default_pass_scheme = CRYPT
 
 password_query = SELECT password FROM mail_user WHERE (login = '%u' OR email = '%u') AND disable%Ls = 'n'
-user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('*:storage=', quota, 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE (login = '%u' OR email = '%u') AND disable%Ls = 'n'
+user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('*:storage=', quota, 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE (login = '%u' OR email = '%u') AND `disable%Ls` = 'n'
 
 # The iterate_query is required for the doveadm command only and works only on dovecot 2 servers.
 # Do not enable it on Dovecot 1.x servers
diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php
index e0d3517b91ec308e2584e78da60403282e5db617..c5f5e9fbc3a9e8bd736816976273b399b144533c 100644
--- a/interface/lib/classes/db_mysql.inc.php
+++ b/interface/lib/classes/db_mysql.inc.php
@@ -419,7 +419,7 @@ class db extends mysqli
 		if($this->show_error_messages && $conf['demo_mode'] === false) {
 			echo $sErrormsg . $sAddMsg;
 		} else if(is_object($app) && method_exists($app, 'log')) {
-				$app->log($sErrormsg . $sAddMsg, LOGLEVEL_WARN);
+				$app->log($sErrormsg . $sAddMsg . ' -> ' . $mysql_errno . ' (' . $mysql_error . ')', LOGLEVEL_WARN);
 			}
 	}
 
diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php
index a05f95199fcd7637c86beca83dd92ed46c52bb21..fb0fdbcd953d6e695f6a7662b5a0499b418784cd 100644
--- a/interface/web/client/form/client.tform.php
+++ b/interface/web/client/form/client.tform.php
@@ -250,7 +250,7 @@ $form["tabs"]['address'] = array (
 			'formtype' => 'SELECT',
 			'default' => (isset($conf['language']) ? strtoupper($conf['language']) : ''),
 			'datasource' => array (  'type'          => 'SQL',
-				'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY iso ASC',
+				'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY printable_name ASC',
 				'keyfield'      => 'iso',
 				'valuefield'    => 'printable_name'
 			),
diff --git a/interface/web/dns/form/dns_a.tform.php b/interface/web/dns/form/dns_a.tform.php
index b7def7d1ea61a0ba0c339b4378084a08c0c0ea49..95aa5b81c0d6cb1a5ccd0c43789c69bacee2fd99 100644
--- a/interface/web/dns/form/dns_a.tform.php
+++ b/interface/web/dns/form/dns_a.tform.php
@@ -129,6 +129,10 @@ $form["tabs"]['dns'] = array (
 		'ttl' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
 			'default' => '86400',
 			'value'  => '',
 			'width'  => '10',
diff --git a/interface/web/dns/form/dns_aaaa.tform.php b/interface/web/dns/form/dns_aaaa.tform.php
index 0550aa4269b0a39dab1e7480d2ee71d7887cdf7c..47bbac39c2911c957e254e44080d7744aa813432 100644
--- a/interface/web/dns/form/dns_aaaa.tform.php
+++ b/interface/web/dns/form/dns_aaaa.tform.php
@@ -122,6 +122,10 @@ $form["tabs"]['dns'] = array (
 		'ttl' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
 			'default' => '86400',
 			'value'  => '',
 			'width'  => '10',
diff --git a/interface/web/dns/form/dns_alias.tform.php b/interface/web/dns/form/dns_alias.tform.php
index 3325814dc17cc5dcbbf0062343048fb99279f483..663bf84278e83b1de1df7e04a716711de2960283 100644
--- a/interface/web/dns/form/dns_alias.tform.php
+++ b/interface/web/dns/form/dns_alias.tform.php
@@ -138,6 +138,10 @@ $form["tabs"]['dns'] = array (
 		'ttl' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
 			'default' => '86400',
 			'value'  => '',
 			'width'  => '10',
diff --git a/interface/web/dns/form/dns_cname.tform.php b/interface/web/dns/form/dns_cname.tform.php
index e2a86dea8593bc10a69b0e6e89d57ad2c63478e9..ca2419b1fd2211e918ecb49854d6254542766eaa 100644
--- a/interface/web/dns/form/dns_cname.tform.php
+++ b/interface/web/dns/form/dns_cname.tform.php
@@ -136,6 +136,10 @@ $form["tabs"]['dns'] = array (
 		'ttl' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
 			'default' => '86400',
 			'value'  => '',
 			'width'  => '10',
diff --git a/interface/web/dns/form/dns_hinfo.tform.php b/interface/web/dns/form/dns_hinfo.tform.php
index 6e815f5cd867b98421bca01c85fb15f614ed0f53..231bdfc65a6a5fac8dc8ee187dbb44f31c239abf 100644
--- a/interface/web/dns/form/dns_hinfo.tform.php
+++ b/interface/web/dns/form/dns_hinfo.tform.php
@@ -128,6 +128,10 @@ $form["tabs"]['dns'] = array (
 		'ttl' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
 			'default' => '86400',
 			'value'  => '',
 			'width'  => '10',
diff --git a/interface/web/dns/form/dns_mx.tform.php b/interface/web/dns/form/dns_mx.tform.php
index 6e0c7e3236ae70750d6efcb1f62d27c06f774da0..2a8ee6df62c6a943463c792e8284d0a399053539 100644
--- a/interface/web/dns/form/dns_mx.tform.php
+++ b/interface/web/dns/form/dns_mx.tform.php
@@ -137,6 +137,10 @@ $form["tabs"]['dns'] = array (
 		'ttl' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
 			'default' => '86400',
 			'value'  => '',
 			'width'  => '10',
diff --git a/interface/web/dns/form/dns_ns.tform.php b/interface/web/dns/form/dns_ns.tform.php
index 502097773929dfb2263e8651f36a4fca117e23db..82b30901fdbfb8244699796cdf6fd903203991dd 100644
--- a/interface/web/dns/form/dns_ns.tform.php
+++ b/interface/web/dns/form/dns_ns.tform.php
@@ -136,6 +136,10 @@ $form["tabs"]['dns'] = array (
 		'ttl' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
 			'default' => '86400',
 			'value'  => '',
 			'width'  => '10',
diff --git a/interface/web/dns/form/dns_ptr.tform.php b/interface/web/dns/form/dns_ptr.tform.php
index b7499928846a63823c4c2ebdd2d62d919990b9dd..59a91e7c8fff26e98579ffc40f719491242de453 100644
--- a/interface/web/dns/form/dns_ptr.tform.php
+++ b/interface/web/dns/form/dns_ptr.tform.php
@@ -136,6 +136,10 @@ $form["tabs"]['dns'] = array (
 		'ttl' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
 			'default' => '86400',
 			'value'  => '',
 			'width'  => '10',
diff --git a/interface/web/dns/form/dns_rp.tform.php b/interface/web/dns/form/dns_rp.tform.php
index 3b7808e71651a97aa1b06cbb0007e0dcdd6516ef..35b8e55ad149e97e0fd83fc4e549a4df9d89c655 100644
--- a/interface/web/dns/form/dns_rp.tform.php
+++ b/interface/web/dns/form/dns_rp.tform.php
@@ -129,6 +129,10 @@ $form["tabs"]['dns'] = array (
 		'ttl' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
 			'default' => '86400',
 			'value'  => '',
 			'width'  => '10',
diff --git a/interface/web/dns/form/dns_srv.tform.php b/interface/web/dns/form/dns_srv.tform.php
index 368ecbf076c4a65abfc85b6b99587cd1d6b70d15..2741a5f7f1218a7275242d9181e2f9ae1fe6f330 100644
--- a/interface/web/dns/form/dns_srv.tform.php
+++ b/interface/web/dns/form/dns_srv.tform.php
@@ -127,6 +127,10 @@ $form["tabs"]['dns'] = array (
 		'ttl' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
 			'default' => '86400',
 			'value'  => '',
 			'width'  => '10',
diff --git a/interface/web/dns/form/dns_txt.tform.php b/interface/web/dns/form/dns_txt.tform.php
index 489c5e813850af3dfbda2770732aac74aeb588de..a4b7d4073eaa0a8cb9ba15117c49f4ae4b2e46ae 100644
--- a/interface/web/dns/form/dns_txt.tform.php
+++ b/interface/web/dns/form/dns_txt.tform.php
@@ -126,6 +126,10 @@ $form["tabs"]['dns'] = array (
 		'ttl' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
 			'default' => '86400',
 			'value'  => '',
 			'width'  => '10',
diff --git a/interface/web/dns/lib/lang/en_dns_a.lng b/interface/web/dns/lib/lang/en_dns_a.lng
index 5bd9c335447e722ed66952e10edebd8f21ff54cb..b2a3a980088d99774e75e3050ade8f5fa4577560 100644
--- a/interface/web/dns/lib/lang/en_dns_a.lng
+++ b/interface/web/dns/lib/lang/en_dns_a.lng
@@ -13,4 +13,5 @@ $wb["name_error_regex"] = 'The hostname has the wrong format.';
 $wb["data_error_empty"] = 'IP-Address empty';
 $wb["data_error_regex"] = 'IP-Address format invalid';
 $wb["data_error_duplicate"] = 'Duplicate A-Record or CNAME-Record';
+$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/lib/lang/en_dns_aaaa.lng b/interface/web/dns/lib/lang/en_dns_aaaa.lng
index c56d55863bee2496b2fefa05a229e4893d732b39..939952d5685b9ca1ec6e2198aac911a0bc59f7d4 100644
--- a/interface/web/dns/lib/lang/en_dns_aaaa.lng
+++ b/interface/web/dns/lib/lang/en_dns_aaaa.lng
@@ -12,4 +12,5 @@ $wb["name_error_empty"] = 'The hostname is empty.';
 $wb["name_error_regex"] = 'The hostname has the wrong format.';
 $wb["data_error_empty"] = 'IP-Address empty';
 $wb["data_error_regex"] = 'IP-Address format invalid';
+$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/lib/lang/en_dns_alias.lng b/interface/web/dns/lib/lang/en_dns_alias.lng
index 46f73a38784509f309184d8392ffc255b99468a1..35c0e0451adadbf13800f1f91a5d6c6874e3dcce 100644
--- a/interface/web/dns/lib/lang/en_dns_alias.lng
+++ b/interface/web/dns/lib/lang/en_dns_alias.lng
@@ -12,4 +12,5 @@ $wb["name_error_empty"] = 'The hostname is empty.';
 $wb["name_error_regex"] = 'The hostname has the wrong format.';
 $wb["data_error_empty"] = 'Target hostname empty';
 $wb["data_error_regex"] = 'Target hostname format invalid';
+$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/lib/lang/en_dns_cname.lng b/interface/web/dns/lib/lang/en_dns_cname.lng
index 96061b27c9f43374753dd85e7c0ab02b6805a9ce..ea67106e7af1c58dc38100fbbb29f5958dbcf791 100644
--- a/interface/web/dns/lib/lang/en_dns_cname.lng
+++ b/interface/web/dns/lib/lang/en_dns_cname.lng
@@ -13,4 +13,5 @@ $wb["name_error_regex"] = 'The hostname has the wrong format.';
 $wb["data_error_empty"] = 'Target hostname empty';
 $wb["data_error_regex"] = 'Target hostname format invalid';
 $wb["data_error_duplicate"] = 'Duplicate A-Record or CNAME-Record';
+$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/lib/lang/en_dns_hinfo.lng b/interface/web/dns/lib/lang/en_dns_hinfo.lng
index 0fb7f4597ce132a1b20e6b759b06759171a15481..7a954b01db410e5bc058325edc8d89c2d8247f31 100644
--- a/interface/web/dns/lib/lang/en_dns_hinfo.lng
+++ b/interface/web/dns/lib/lang/en_dns_hinfo.lng
@@ -12,4 +12,5 @@ $wb["name_error_empty"] = 'The hostname is empty.';
 $wb["name_error_regex"] = 'The hostname has the wrong format.';
 $wb["data_error_empty"] = 'Host information empty';
 $wb["data_error_regex"] = 'Host Information format invalid';
+$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/lib/lang/en_dns_mx.lng b/interface/web/dns/lib/lang/en_dns_mx.lng
index d61f592ec2c977884449b15b5d1f5a0a574f27ef..298568c16cd7129715a10c569b4c03bf200e111f 100644
--- a/interface/web/dns/lib/lang/en_dns_mx.lng
+++ b/interface/web/dns/lib/lang/en_dns_mx.lng
@@ -14,4 +14,5 @@ $wb["name_error_regex"] = 'The hostname has the wrong format.';
 $wb["data_error_empty"] = 'Mailserver hostname empty';
 $wb["data_error_regex"] = 'Mailserver hostname format invalid';
 $wb["duplicate_mx_record_txt"] = 'Duplicate MX record.';
+$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/lib/lang/en_dns_ns.lng b/interface/web/dns/lib/lang/en_dns_ns.lng
index 9e0e1e149efe6c2012d3dceb8709eda045dd5ac8..15678111791d504a110241079001c3111a318441 100644
--- a/interface/web/dns/lib/lang/en_dns_ns.lng
+++ b/interface/web/dns/lib/lang/en_dns_ns.lng
@@ -12,4 +12,5 @@ $wb["name_error_empty"] = 'The zone is empty.';
 $wb["name_error_regex"] = 'The zone has the wrong format.';
 $wb["data_error_empty"] = 'Nameserver empty';
 $wb["data_error_regex"] = 'Nameserver format invalid';
+$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/lib/lang/en_dns_ptr.lng b/interface/web/dns/lib/lang/en_dns_ptr.lng
index 1219a96e1f57be52bff5cb5c6442e73cca6e2583..e9ed6aeac6037d482872d39fcb6d78e86477cb3e 100644
--- a/interface/web/dns/lib/lang/en_dns_ptr.lng
+++ b/interface/web/dns/lib/lang/en_dns_ptr.lng
@@ -12,4 +12,5 @@ $wb["name_error_empty"] = 'The name is empty.';
 $wb["name_error_regex"] = 'The name has the wrong format.';
 $wb["data_error_empty"] = 'Canonical hostname empty';
 $wb["data_error_regex"] = 'Canonical hostname format invalid';
+$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/lib/lang/en_dns_rp.lng b/interface/web/dns/lib/lang/en_dns_rp.lng
index e705d9fff07b4f9ef5748d3cc324febba48cf4ba..d3e76e711d458140f5aa946e11fd25fe9e992479 100644
--- a/interface/web/dns/lib/lang/en_dns_rp.lng
+++ b/interface/web/dns/lib/lang/en_dns_rp.lng
@@ -12,4 +12,5 @@ $wb["name_error_empty"] = 'The hostname is empty.';
 $wb["name_error_regex"] = 'The hostname has the wrong format.';
 $wb["data_error_empty"] = 'Responsible person field empty';
 $wb["data_error_regex"] = 'Responsible person field format invalid';
+$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/lib/lang/en_dns_srv.lng b/interface/web/dns/lib/lang/en_dns_srv.lng
index c50b72198300a9dc05d24d7744b042e4a65fabd1..a90be0310242dce4d13678ce4804a80960c6bedc 100644
--- a/interface/web/dns/lib/lang/en_dns_srv.lng
+++ b/interface/web/dns/lib/lang/en_dns_srv.lng
@@ -16,4 +16,5 @@ $wb["name_error_regex"] = 'The hostname has the wrong format.';
 $wb["data_error_empty"] = 'Server record empty';
 $wb["data_error_regex"] = 'Server record format invalid';
 $wb["srv_error_regex"] = 'Invalid server record format. The server record must contain 3 text strings separated by spaces.';
+$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/lib/lang/en_dns_txt.lng b/interface/web/dns/lib/lang/en_dns_txt.lng
index af43605901f4851ea84455037cedcca175a3794b..b70b8b19d5efba1c68c1d621f42a9929e13aeb6a 100644
--- a/interface/web/dns/lib/lang/en_dns_txt.lng
+++ b/interface/web/dns/lib/lang/en_dns_txt.lng
@@ -12,4 +12,5 @@ $wb["name_error_empty"] = 'The hostname is empty.';
 $wb["name_error_regex"] = 'The hostname has the wrong format.';
 $wb["data_error_empty"] = 'Text empty';
 $wb["data_error_regex"] = 'Text format invalid';
+$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php
index 75fb42fa11dd975e7ee1657fde436971606be8cc..690683ad808ff12131bf9c5fdd6268a3e79a559f 100644
--- a/interface/web/mail/mail_user_edit.php
+++ b/interface/web/mail/mail_user_edit.php
@@ -302,7 +302,7 @@ class page_action extends tform_actions {
 			$disabledeliver = ($this->dataRecord["postfix"] == 'y')?'n':'y';
 			$disablesmtp = ($this->dataRecord["postfix"] == 'y')?'n':'y';
 
-			$sql = "UPDATE mail_user SET disableimap = '$disableimap', disablesieve = '$disableimap', disablepop3 = '$disablepop3', disablesmtp = '$disablesmtp', disabledeliver = '$disabledeliver', disablelda = '$disabledeliver', disabledoveadm = '$disableimap' WHERE mailuser_id = ".$this->id;
+			$sql = "UPDATE mail_user SET disableimap = '$disableimap', disablesieve = '$disableimap', `disablesieve-filter` = '$disableimap', disablepop3 = '$disablepop3', disablesmtp = '$disablesmtp', disabledeliver = '$disabledeliver', disablelda = '$disabledeliver', disabledoveadm = '$disableimap' WHERE mailuser_id = ".$this->id;
 			$app->db->query($sql);
 		}
 
diff --git a/interface/web/monitor/show_sys_state.php b/interface/web/monitor/show_sys_state.php
index aa97317ade9a0bb94a31748b0680ea182b763779..93d1f95971655857e65a5c8bc22975cea395ce43 100644
--- a/interface/web/monitor/show_sys_state.php
+++ b/interface/web/monitor/show_sys_state.php
@@ -223,7 +223,8 @@ function _getServerState($serverId, $serverName) {
 	/*
 	 * Info of a VE inside a OpenVz-Host
 	*/
-	$html_ve  = '<div class="systemmonitor-ve state-' . $serverState . '-ve os-' . $osData['name'] . '">';
+	//$html_ve  = '<div class="systemmonitor-ve state-' . $serverState . '-ve os-' . $osData['name'] . '">';
+	$html_ve  = '<div class="systemmonitor state-' . $serverState . ' os-' . $osData['name'] . '">';
 	if ($osData != null) {
 		$html_ve .= '<div class="icoDevice"><p class="status"></p></div>';
 	}
diff --git a/interface/web/sites/lib/lang/de_web_folder.lng b/interface/web/sites/lib/lang/de_web_folder.lng
index 8defc36f4cc0c7046bac8ea2ac5bc430c6bd7ae2..d92082ff2efcce89d2a3e4be5e1c093c198c84ae 100644
--- a/interface/web/sites/lib/lang/de_web_folder.lng
+++ b/interface/web/sites/lib/lang/de_web_folder.lng
@@ -4,4 +4,5 @@ $wb['parent_domain_id_txt'] = 'Webseite';
 $wb['path_txt'] = 'Pfad';
 $wb['active_txt'] = 'Aktiv';
 $wb['path_error_regex'] = 'Ungültiger Pfad.';
+$wb['error_folder_already_protected_txt'] = 'Für diesen Ordner existiert schon ein Eintrag.';
 ?>
diff --git a/interface/web/sites/lib/lang/de_web_folder_user.lng b/interface/web/sites/lib/lang/de_web_folder_user.lng
index 6983dc136e265beef4ee4400461e30c30ad4ebb0..a6ba183b004413480d8ac88076c0ed253634d94b 100644
--- a/interface/web/sites/lib/lang/de_web_folder_user.lng
+++ b/interface/web/sites/lib/lang/de_web_folder_user.lng
@@ -10,4 +10,5 @@ $wb['repeat_password_txt'] = 'Passwort wiederholen';
 $wb['password_mismatch_txt'] = 'Die Passwörter stimmen nicht überein.';
 $wb['password_match_txt'] = 'Die Passwörter stimmen überein.';
 $wb['no_folder_perm'] = 'Sie haben keine Berechtigung für diesen Ordner.';
+$wb['error_user_exists_already_txt'] = 'Für diesen Benutzer existiert schon ein Eintrag.';
 ?>
diff --git a/interface/web/sites/lib/lang/de_web_vhost_domain.lng b/interface/web/sites/lib/lang/de_web_vhost_domain.lng
index 27f790f81b736dd463345309efd14f83d7cb9a76..c4e9eb072ae9524241be63d7e98e77a1536ab2ff 100644
--- a/interface/web/sites/lib/lang/de_web_vhost_domain.lng
+++ b/interface/web/sites/lib/lang/de_web_vhost_domain.lng
@@ -131,5 +131,5 @@ $wb['web_folder_invalid_txt'] = 'Dieser Ordner darf nicht als Basisordner verwen
 $wb['web_folder_unique_txt'] = 'Dieser Ordner wird bereits verwendet, bitte geben Sie einen anderen Basisordner an.';
 $wb['host_txt'] = 'Host';
 $wb['domain_error_wildcard'] = 'Wildcard-Subdomains sind nicht erlaubt.';
-
+$wb['invalid_custom_php_ini_settings_txt'] = 'Unzulässige php.ini-Einstellungen';
 ?>
diff --git a/interface/web/sites/lib/lang/en_web_folder.lng b/interface/web/sites/lib/lang/en_web_folder.lng
index 5e8ede00cff5f0428b418b01f05a472951db647e..f205daef0ecd5cdfa34cde5a670ccdfaf1e5a438 100644
--- a/interface/web/sites/lib/lang/en_web_folder.lng
+++ b/interface/web/sites/lib/lang/en_web_folder.lng
@@ -4,4 +4,5 @@ $wb["parent_domain_id_txt"] = 'Website';
 $wb["path_txt"] = 'Path';
 $wb["active_txt"] = 'Active';
 $wb["path_error_regex"] = 'Invalid folder path.';
+$wb['error_folder_already_protected_txt'] = 'There is already a record for this folder.';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/en_web_folder_user.lng b/interface/web/sites/lib/lang/en_web_folder_user.lng
index 63c18567f89e5ab5fa18ab199c56798c95ffab57..207f5367ebe1f5036bb28254d584d9845740c7d8 100644
--- a/interface/web/sites/lib/lang/en_web_folder_user.lng
+++ b/interface/web/sites/lib/lang/en_web_folder_user.lng
@@ -10,4 +10,5 @@ $wb['repeat_password_txt'] = 'Repeat Password';
 $wb['password_mismatch_txt'] = 'The passwords do not match.';
 $wb['password_match_txt'] = 'The passwords do match.';
 $wb["no_folder_perm"] = 'You have no permission for this folder.';
+$wb['error_user_exists_already_txt'] = 'There is already a record for this user.';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/web_folder_edit.php b/interface/web/sites/web_folder_edit.php
index d3235df7f13578266767c41fe002ff9d4c7d987f..009b039c1d1af7cc9719d3f60e8dd5f1e4c59dd4 100644
--- a/interface/web/sites/web_folder_edit.php
+++ b/interface/web/sites/web_folder_edit.php
@@ -60,9 +60,45 @@ class page_action extends tform_actions {
 
 		// Set a few fixed values
 		$this->dataRecord["server_id"] = $parent_domain["server_id"];
+		
+		// make sure this folder isn't protected already
+		if($this->id > 0){
+			$folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE parent_domain_id = ".$this->dataRecord['parent_domain_id']." AND path = '".$this->dataRecord['path']."' AND web_folder_id != ".$this->id);
+		} else {
+			$folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE parent_domain_id = ".$this->dataRecord['parent_domain_id']." AND path = '".$this->dataRecord['path']."'");
+		}
+		if(is_array($folder) && !empty($folder)) $app->tform->errorMessage .= $app->tform->lng('error_folder_already_protected_txt');
 
 		parent::onSubmit();
 	}
+	
+	function onAfterInsert() {
+		global $app, $conf;
+
+		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
+
+		// The web folder entry shall be owned by the same group as the website
+		$sys_groupid = $app->functions->intval($web['sys_groupid']);
+
+		$sql = "UPDATE web_folder SET sys_groupid = '$sys_groupid' WHERE web_folder_id = ".$this->id;
+		$app->db->query($sql);
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+
+		//* When the site of the web folder has been changed
+		if(isset($this->dataRecord['parent_domain_id']) && $this->oldDataRecord['parent_domain_id'] != $this->dataRecord['parent_domain_id']) {
+			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
+
+			// The web folder entry shall be owned by the same group as the website
+			$sys_groupid = $app->functions->intval($web['sys_groupid']);
+
+			$sql = "UPDATE web_folder SET sys_groupid = '$sys_groupid' WHERE web_folder_id = ".$this->id;
+			$app->db->query($sql);
+		}
+
+	}
 
 }
 
diff --git a/interface/web/sites/web_folder_user_edit.php b/interface/web/sites/web_folder_user_edit.php
index ce4663e71617d30c7d3a744d6dddd1d2ba70f756..ec3bdd1edbb099ca1ff2226a0157a154dce5c274 100644
--- a/interface/web/sites/web_folder_user_edit.php
+++ b/interface/web/sites/web_folder_user_edit.php
@@ -60,9 +60,45 @@ class page_action extends tform_actions {
 
 		// Set a few fixed values
 		$this->dataRecord["server_id"] = $folder["server_id"];
+		
+		// make sure this folder/user combination does not exist already
+		if($this->id > 0){
+			$user = $app->db->queryOneRecord("SELECT * FROM web_folder_user WHERE web_folder_id = ".$this->dataRecord['web_folder_id']." AND username = '".$this->dataRecord['username']."' AND web_folder_user_id != ".$this->id);
+		} else {
+			$user = $app->db->queryOneRecord("SELECT * FROM web_folder_user WHERE web_folder_id = ".$this->dataRecord['web_folder_id']." AND username = '".$this->dataRecord['username']."'");
+		}
+		if(is_array($user) && !empty($user)) $app->tform->errorMessage .= $app->tform->lng('error_user_exists_already_txt');
 
 		parent::onSubmit();
 	}
+	
+	function onAfterInsert() {
+		global $app, $conf;
+
+		$folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ".$app->functions->intval($this->dataRecord["web_folder_id"]));
+
+		// The web folder user entry shall be owned by the same group as the web folder
+		$sys_groupid = $app->functions->intval($folder['sys_groupid']);
+
+		$sql = "UPDATE web_folder_user SET sys_groupid = '$sys_groupid' WHERE web_folder_user_id = ".$this->id;
+		$app->db->query($sql);
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+
+		//* When the web folder has been changed
+		if(isset($this->dataRecord['web_folder_id']) && $this->oldDataRecord['web_folder_id'] != $this->dataRecord['web_folder_id']) {
+			$folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ".$app->functions->intval($this->dataRecord["web_folder_id"]));
+
+			// The web folder user entry shall be owned by the same group as the web folder
+			$sys_groupid = $app->functions->intval($folder['sys_groupid']);
+
+			$sql = "UPDATE web_folder_user SET sys_groupid = '$sys_groupid' WHERE web_folder_user_id = ".$this->id;
+			$app->db->query($sql);
+		}
+
+	}
 
 }
 
diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php
index bd020dfa0b335f8ec61f13e3b7defa822583eb16..2defb3ea1d53d81de8dce8912cb7574a9fb8126c 100644
--- a/interface/web/sites/web_vhost_domain_edit.php
+++ b/interface/web/sites/web_vhost_domain_edit.php
@@ -1003,6 +1003,35 @@ class page_action extends tform_actions {
 				$app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'<br>';
 			}
 		}
+		
+		// check custom php.ini settings
+		if(isset($this->dataRecord['custom_php_ini']) && trim($this->dataRecord['custom_php_ini']) != '') {
+			$custom_php_ini_settings = trim($this->dataRecord['custom_php_ini']);
+			$custom_php_ini_settings_are_valid = true;
+			// Make sure we only have Unix linebreaks
+			$custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings);
+			$custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings);
+			$custom_php_ini_settings_lines = explode("\n", $custom_php_ini_settings);
+			if(is_array($custom_php_ini_settings_lines) && !empty($custom_php_ini_settings_lines)){
+				foreach($custom_php_ini_settings_lines as $custom_php_ini_settings_line){
+					if(trim($custom_php_ini_settings_line) == '') continue;
+					if(substr(trim($custom_php_ini_settings_line),0,1) == ';') continue;
+					// empty value
+					if(preg_match('@^\s*;*\s*[a-zA-Z0-9._]*\s*=\s*;*\s*$@', $custom_php_ini_settings_line)) continue;
+					// value inside ""
+					if(preg_match('@^\s*;*\s*[a-zA-Z0-9._]*\s*=\s*".*"\s*;*\s*$@', $custom_php_ini_settings_line)) continue;
+					// value inside ''
+					if(preg_match('@^\s*;*\s*[a-zA-Z0-9._]*\s*=\s*\'.*\'\s*;*\s*$@', $custom_php_ini_settings_line)) continue;
+					// everything else
+					if(preg_match('@^\s*;*\s*[a-zA-Z0-9._]*\s*=\s*[-a-zA-Z0-9~&=_\@/,.#\s]*\s*;*\s*$@', $custom_php_ini_settings_line)) continue;
+					$custom_php_ini_settings_are_valid = false;
+					break;
+				}
+			}
+			if(!$custom_php_ini_settings_are_valid){
+				$app->tform->errorMessage .= $app->tform->lng("invalid_custom_php_ini_settings_txt").'<br>';
+			}
+		}
 
 		parent::onSubmit();
 	}
diff --git a/server/lib/classes/aps_installer.inc.php b/server/lib/classes/aps_installer.inc.php
index 23c4b5fa632c6353dfad53eef2036f72c99d6676..089c7ab22a6535d2e437d1ba8fd20179c5fd8b57 100644
--- a/server/lib/classes/aps_installer.inc.php
+++ b/server/lib/classes/aps_installer.inc.php
@@ -371,6 +371,21 @@ class ApsInstaller extends ApsBase
 
 		$tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_login' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
 		$newdb_login = $tmp['value'];
+		
+		/* Test if the new mysql connection is laready working to ensure that db servers in multiserver
+		   setups get enough time to create the database */
+		if($this->handle_type == 'install') {
+			for($n = 1; $n < 15; $n++) {
+				$link = mysql_connect($newdb_host, $newdb_login, $newdb_pw);
+				if (!$link) {
+					unset($link);
+					sleep(5);
+				} else {
+					unset($link);
+					break;
+				}
+			}
+		}
 
 		$this->putenv[] = 'DB_'.$db_id.'_TYPE=mysql';
 		$this->putenv[] = 'DB_'.$db_id.'_NAME='.$newdb_name;
diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index af846efb71db67d430075002578b9315b9fc02f9..e6600e9f5f63b00e95ea7b3a5bf9ed47c6737890 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -424,7 +424,7 @@ class db extends mysqli
 		if($this->show_error_messages && $conf['demo_mode'] === false) {
 			echo $sErrormsg . $sAddMsg;
 		} else if(is_object($app) && method_exists($app, 'log')) {
-				$app->log($sErrormsg . $sAddMsg, LOGLEVEL_WARN);
+				$app->log($sErrormsg . $sAddMsg . ' -> ' . $mysql_errno . ' (' . $mysql_error . ')', LOGLEVEL_WARN);
 			}
 	}
 
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 14b27c4e6761ee6f8d40a53dbfed1231faebcb47..fd5149df8cc84dc3a1d0a08641a1ab7114ee6d30 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -564,7 +564,9 @@ class apache2_plugin {
 			//* Change the log mount
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
 			$app->system->removeLine('/etc/fstab', $fstab_line);
-			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait    0 0';
+			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind,nobootwait';
+			$app->system->removeLine('/etc/fstab', $fstab_line);
+			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait,_netdev    0 0';
 			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 
 		}
@@ -614,7 +616,7 @@ class apache2_plugin {
 			$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 			exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
 			//* add mountpoint to fstab
-			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait    0 0';
+			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait,_netdev    0 0';
 			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 		}
 
@@ -2799,7 +2801,7 @@ class apache2_plugin {
 					if(substr($ini_setting, 0, 1) == ';') continue;
 					if(substr($ini_setting, 0, 1) == '#') continue;
 					if(substr($ini_setting, 0, 2) == '//') continue;
-					list($key, $value) = explode('=', $ini_setting);
+					list($key, $value) = explode('=', $ini_setting, 2);
 					if($value){
 						$value = trim($value);
 						$key = trim($key);
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 878c114fbfb1c5090d708e92bb6dfadaf36e438b..d7d1266d4b07ca5276ea8d73cc5d88d08b1f456c 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -479,7 +479,9 @@ class nginx_plugin {
 			//* Change the log mount
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
 			$app->system->removeLine('/etc/fstab', $fstab_line);
-			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait    0 0';
+			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind,nobootwait';
+			$app->system->removeLine('/etc/fstab', $fstab_line);
+			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait,_netdev    0 0';
 			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 
 		}
@@ -529,7 +531,7 @@ class nginx_plugin {
 			$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 			exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
 			//* add mountpoint to fstab
-			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait    0 0';
+			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait,_netdev    0 0';
 			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 		}
 
@@ -2378,7 +2380,7 @@ class nginx_plugin {
 					if(substr($ini_setting, 0, 1) == ';') continue;
 					if(substr($ini_setting, 0, 1) == '#') continue;
 					if(substr($ini_setting, 0, 2) == '//') continue;
-					list($key, $value) = explode('=', $ini_setting);
+					list($key, $value) = explode('=', $ini_setting, 2);
 					if($value){
 						$value = trim($value);
 						$key = trim($key);