diff --git a/docs/autoinstall_samples/autoinstall.conf_sample.php b/docs/autoinstall_samples/autoinstall.conf_sample.php
index ccd36aae6a5d38939068f4269dd24151cb3b94f1..187dc68b5c3d65f88f4f3e938b4c0eff754e564b 100644
--- a/docs/autoinstall_samples/autoinstall.conf_sample.php
+++ b/docs/autoinstall_samples/autoinstall.conf_sample.php
@@ -1,52 +1,52 @@
-<?php
-$autoinstall['language'] = 'en'; // de, en (default)
-$autoinstall['install_mode'] = 'standard'; // standard (default), expert
-
-$autoinstall['hostname'] = 'server1.example.com'; // default
-$autoinstall['mysql_hostname'] = 'localhost'; // default: localhost
-$autoinstall['mysql_root_user'] = 'root'; // default: root
-$autoinstall['mysql_root_password'] = 'howtoforge';
-$autoinstall['mysql_database'] = 'dbispconfig'; // default: dbispcongig
-$autoinstall['mysql_charset'] = 'utf8'; // default: utf8
-$autoinstall['http_server'] = 'nginx'; // apache (default), nginx
-$autoinstall['ispconfig_port'] = '8080'; // default: 8080
-$autoinstall['ispconfig_use_ssl'] = 'y'; // y (default), n
-
-/* SSL Settings */
-$autoinstall['ssl_cert_country'] = 'AU';
-$autoinstall['ssl_cert_state'] = 'Some-State';
-$autoinstall['ssl_cert_locality'] = 'Chicago';
-$autoinstall['ssl_cert_organisation'] = 'Internet Widgits Pty Ltd';
-$autoinstall['ssl_cert_organisation_unit'] = 'IT department';
-$autoinstall['ssl_cert_common_name'] = $autoinstall['hostname'];
-
-/* optional expert mode settings, needed only for expert mode */
-$autoinstall['mysql_ispconfig_user'] = 'ispconfig'; // default: ispconfig
-$autoinstall['mysql_ispconfig_password'] = md5(uniqid(rand()));
-$autoinstall['join_multiserver_setup'] = 'n'; // y, n (default)
-$autoinstall['mysql_master_hostname'] = 'master.example.com';
-$autoinstall['mysql_master_root_user'] = 'root';
-$autoinstall['mysql_master_root_password'] = 'howtoforge';
-$autoinstall['mysql_master_database'] = 'dbispconfig'; // default: dbispconfig
-$autoinstall['configure_mail'] = 'y'; // y (default), n
-$autoinstall['configure_jailkit'] = 'y'; // y (default), n
-$autoinstall['configure_ftp'] = 'y'; // y (default), n
-$autoinstall['configure_dns'] = 'y'; // y (default), n
-$autoinstall['configure_apache'] = 'y'; // y (default), n
-$autoinstall['configure_nginx'] = 'y'; // y (default), n
-$autoinstall['configure_firewall'] = 'y'; // y (default), n
-$autoinstall['install_ispconfig_web_interface'] = 'y'; // y (default), n
-
-/* optional update settings, needed only for updates */
-$autoupdate['do_backup'] = 'yes'; // yes (default), no
-$autoupdate['mysql_root_password'] = 'howtoforge';
-$autoupdate['mysql_master_hostname'] = 'master.example.com';
-$autoupdate['mysql_master_root_user'] = 'root';
-$autoupdate['mysql_master_root_password'] = 'howtoforge';
-$autoupdate['mysql_master_database'] = 'dbispconfig'; // default: dbispconfig
-$autoupdate['reconfigure_permissions_in_master_database'] = 'no'; // no (default), yes
-$autoupdate['reconfigure_services'] = 'yes'; // yes (default), no
-$autoupdate['ispconfig_port'] = '8080'; // default: 8080
-$autoupdate['create_new_ispconfig_ssl_cert'] = 'no'; // no (default), yes
-$autoupdate['reconfigure_crontab'] = 'yes'; // yes (default), no
+<?php
+$autoinstall['language'] = 'en'; // de, en (default)
+$autoinstall['install_mode'] = 'standard'; // standard (default), expert
+
+$autoinstall['hostname'] = 'server1.example.com'; // default
+$autoinstall['mysql_hostname'] = 'localhost'; // default: localhost
+$autoinstall['mysql_root_user'] = 'root'; // default: root
+$autoinstall['mysql_root_password'] = 'howtoforge';
+$autoinstall['mysql_database'] = 'dbispconfig'; // default: dbispcongig
+$autoinstall['mysql_charset'] = 'utf8'; // default: utf8
+$autoinstall['http_server'] = 'nginx'; // apache (default), nginx
+$autoinstall['ispconfig_port'] = '8080'; // default: 8080
+$autoinstall['ispconfig_use_ssl'] = 'y'; // y (default), n
+
+/* SSL Settings */
+$autoinstall['ssl_cert_country'] = 'AU';
+$autoinstall['ssl_cert_state'] = 'Some-State';
+$autoinstall['ssl_cert_locality'] = 'Chicago';
+$autoinstall['ssl_cert_organisation'] = 'Internet Widgits Pty Ltd';
+$autoinstall['ssl_cert_organisation_unit'] = 'IT department';
+$autoinstall['ssl_cert_common_name'] = $autoinstall['hostname'];
+
+/* optional expert mode settings, needed only for expert mode */
+$autoinstall['mysql_ispconfig_user'] = 'ispconfig'; // default: ispconfig
+$autoinstall['mysql_ispconfig_password'] = md5(uniqid(rand()));
+$autoinstall['join_multiserver_setup'] = 'n'; // y, n (default)
+$autoinstall['mysql_master_hostname'] = 'master.example.com';
+$autoinstall['mysql_master_root_user'] = 'root';
+$autoinstall['mysql_master_root_password'] = 'howtoforge';
+$autoinstall['mysql_master_database'] = 'dbispconfig'; // default: dbispconfig
+$autoinstall['configure_mail'] = 'y'; // y (default), n
+$autoinstall['configure_jailkit'] = 'y'; // y (default), n
+$autoinstall['configure_ftp'] = 'y'; // y (default), n
+$autoinstall['configure_dns'] = 'y'; // y (default), n
+$autoinstall['configure_apache'] = 'y'; // y (default), n
+$autoinstall['configure_nginx'] = 'y'; // y (default), n
+$autoinstall['configure_firewall'] = 'y'; // y (default), n
+$autoinstall['install_ispconfig_web_interface'] = 'y'; // y (default), n
+
+/* optional update settings, needed only for updates */
+$autoupdate['do_backup'] = 'yes'; // yes (default), no
+$autoupdate['mysql_root_password'] = 'howtoforge';
+$autoupdate['mysql_master_hostname'] = 'master.example.com';
+$autoupdate['mysql_master_root_user'] = 'root';
+$autoupdate['mysql_master_root_password'] = 'howtoforge';
+$autoupdate['mysql_master_database'] = 'dbispconfig'; // default: dbispconfig
+$autoupdate['reconfigure_permissions_in_master_database'] = 'no'; // no (default), yes
+$autoupdate['reconfigure_services'] = 'yes'; // yes (default), no
+$autoupdate['ispconfig_port'] = '8080'; // default: 8080
+$autoupdate['create_new_ispconfig_ssl_cert'] = 'no'; // no (default), yes
+$autoupdate['reconfigure_crontab'] = 'yes'; // yes (default), no
 ?>
\ No newline at end of file
diff --git a/docs/autoinstall_samples/autoinstall.ini.sample b/docs/autoinstall_samples/autoinstall.ini.sample
index 1f4d9d7da0956d3b819bc86f4b4b519786a81898..bfe4c2d8f8cf2d90719ad8919fe5f60dab9f673f 100644
--- a/docs/autoinstall_samples/autoinstall.ini.sample
+++ b/docs/autoinstall_samples/autoinstall.ini.sample
@@ -1,50 +1,50 @@
-[install]
-language=en
-install_mode=standard
-hostname=server1.example.com
-mysql_hostname=localhost
-mysql_root_user=root
-mysql_root_password=ispconfig
-mysql_database=dbispconfig
-mysql_charset=utf8
-http_server=apache
-ispconfig_port=8080
-ispconfig_use_ssl=y
-
-[ssl_cert]
-ssl_cert_country=AU
-ssl_cert_state=Some-State
-ssl_cert_locality=Chicago
-ssl_cert_organisation=Internet Widgits Pty Ltd
-ssl_cert_organisation_unit=IT department
-ssl_cert_common_name=server1.example.com
-
-[expert]
-mysql_ispconfig_user=ispconfig
-mysql_ispconfig_password=afStEratXBsgatRtsa42CadwhQ
-join_multiserver_setup=n
-mysql_master_hostname=master.example.com
-mysql_master_root_user=root
-mysql_master_root_password=ispconfig
-mysql_master_database=dbispconfig
-configure_mail=y
-configure_jailkit=y
-configure_ftp=y
-configure_dns=y
-configure_apache=y
-configure_nginx=y
-configure_firewall=y
-install_ispconfig_web_interface=y
-
-[update]
-do_backup=yes
-mysql_root_password=ispconfig
-mysql_master_hostname=master.example.com
-mysql_master_root_user=root
-mysql_master_root_password=ispconfig
-mysql_master_database=dbispconfig
-reconfigure_permissions_in_master_database=no
-reconfigure_services=yes
-ispconfig_port=8080
-create_new_ispconfig_ssl_cert=no
+[install]
+language=en
+install_mode=standard
+hostname=server1.example.com
+mysql_hostname=localhost
+mysql_root_user=root
+mysql_root_password=ispconfig
+mysql_database=dbispconfig
+mysql_charset=utf8
+http_server=apache
+ispconfig_port=8080
+ispconfig_use_ssl=y
+
+[ssl_cert]
+ssl_cert_country=AU
+ssl_cert_state=Some-State
+ssl_cert_locality=Chicago
+ssl_cert_organisation=Internet Widgits Pty Ltd
+ssl_cert_organisation_unit=IT department
+ssl_cert_common_name=server1.example.com
+
+[expert]
+mysql_ispconfig_user=ispconfig
+mysql_ispconfig_password=afStEratXBsgatRtsa42CadwhQ
+join_multiserver_setup=n
+mysql_master_hostname=master.example.com
+mysql_master_root_user=root
+mysql_master_root_password=ispconfig
+mysql_master_database=dbispconfig
+configure_mail=y
+configure_jailkit=y
+configure_ftp=y
+configure_dns=y
+configure_apache=y
+configure_nginx=y
+configure_firewall=y
+install_ispconfig_web_interface=y
+
+[update]
+do_backup=yes
+mysql_root_password=ispconfig
+mysql_master_hostname=master.example.com
+mysql_master_root_user=root
+mysql_master_root_password=ispconfig
+mysql_master_database=dbispconfig
+reconfigure_permissions_in_master_database=no
+reconfigure_services=yes
+ispconfig_port=8080
+create_new_ispconfig_ssl_cert=no
 reconfigure_crontab=yes
\ No newline at end of file
diff --git a/docs/examples/blacklist_helo.master b/docs/examples/blacklist_helo.master
new file mode 100644
index 0000000000000000000000000000000000000000..5d696d44b8747a9bddafa454c11ef8a464fa9809
--- /dev/null
+++ b/docs/examples/blacklist_helo.master
@@ -0,0 +1,74 @@
+# blacklist_helo - after permit_sasl, used to stop common spammers/misconfigurations
+#
+# This file can be used to block hostnames used in smtp HELO command which are known bad.
+# Occasionally you will run into legitimate mail servers which are misconfigured and end
+# up blocked here, so this is not enabled by default, but it is useful if you are prepared
+# to address those cases.  .local is particularly problematic, and commented out by default.
+#
+# Note that any server hitting this check is misconfigured, all of the names below are bogus
+# and not allowed per RFC 2821.
+#
+# If your own users are blocked by this, they are not authenticating to your server when
+# sending (this check is after permit_sasl, which permits authenticated senders).
+#
+# Instructions:
+#
+# Copy this file to /usr/local/ispconfig/server/conf-custom/install/blacklist_helo.master,
+# as well as /etc/postfix/blacklist_helo, so your changes are not overwritten with ispconfig
+# updates.
+
+# probably just put REJECT lines in here,
+# as OK lines will bypass a lot of other checks you may want done
+# (use DUNNO instead of OK)
+#
+
+# common for spammers (check https://data.iana.org/TLD/tlds-alpha-by-domain.txt and remove valid tld's occasionally)
+/.*\.administrator$/    REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.admin$/    REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.adsl$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.arpa$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.bac$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.coma$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.dhcp$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.dlink$/    REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.dns$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.domain$/   REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.dynamic$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.dyndns\.org$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.dyn$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.firewall$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.gateway$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.home$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.internal$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.intern$/   REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.janak$/    REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.kornet$/   REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.lab$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.lan$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.localdomain$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.localhost$/    REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+
+# .local is used by spammers a lot, but too many otherwise legit servers hit it
+# (instead of REJECT, should send to greylisting)
+#/.*\.local$/    REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+
+/.*\.loc$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.lokal$/    REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.mail$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.nat$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.netzwerk$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.pc$/   REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.privat$/   REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.private$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.router$/   REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.setup$/    REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+
+/.*\.119$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.beeline$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.cici$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.gt_3g$/    REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.gt-3g$/    REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.hananet$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.skbroadband$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+/.*\.tbroad$/   REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+
diff --git a/install/dist/lib/gentoo.lib.php b/install/dist/lib/gentoo.lib.php
index 970d83a5e5d32f018b47e508b9210e988a934a18..6e676985b202f4f5e5c27e3c1a50e3eab23267b0 100644
--- a/install/dist/lib/gentoo.lib.php
+++ b/install/dist/lib/gentoo.lib.php
@@ -775,7 +775,11 @@ class installer extends installer_base
 			//$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 			$content = str_replace('{cgi_socket}', $cgi_socket, $content);
-
+			
+			// SSL in apps vhost is off by default. Might change later.
+			$content = str_replace('{ssl_on}', 'off', $content);
+			$content = str_replace('{ssl_comment}', '#', $content);
+			
 			wf($vhost_conf_dir.'/apps.vhost', $content);
 
 			// PHP-FPM
diff --git a/install/install.php b/install/install.php
index cab7069d39807e1c017f63f8743dbc8f36608b38..1c413f97f48944579d393213b80b726a0439bf3f 100644
--- a/install/install.php
+++ b/install/install.php
@@ -188,7 +188,7 @@ do {
 } while (!$check);
 
 // 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.');
+if(!function_exists('mysqli_connect')) die('No PHP MySQLi functions available. Please ensure that the PHP MySQL module is loaded.');
 
 //** Get MySQL root credentials
 $finished = false;
@@ -208,7 +208,7 @@ do {
 	}
 
 	//* Initialize the MySQL server connection
-	if(@mysql_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
+	if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, $tmp_mysql_server_database, (int)$tmp_mysql_server_port)) {
 		$conf['mysql']['host'] = $tmp_mysql_server_host;
 		$conf['mysql']['port'] = $tmp_mysql_server_port;
 		$conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user;
@@ -217,7 +217,7 @@ do {
 		$conf['mysql']['charset'] = $tmp_mysql_server_charset;
 		$finished = true;
 	} else {
-		swriteln($inst->lng('Unable to connect to the specified MySQL server').' '.mysql_error());
+		swriteln($inst->lng('Unable to connect to the specified MySQL server').' '.mysqli_connect_error());
 	}
 } while ($finished == false);
 unset($finished);
@@ -553,7 +553,7 @@ if($install_mode == 'standard') {
 			$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database');
 
 			//* Initialize the MySQL server connection
-			if(@mysql_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
+			if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, $tmp_mysql_server_database, (int)$tmp_mysql_server_port)) {
 				$conf['mysql']['master_host'] = $tmp_mysql_server_host;
 				$conf['mysql']['master_port'] = $tmp_mysql_server_port;
 				$conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user;
@@ -561,7 +561,7 @@ if($install_mode == 'standard') {
 				$conf['mysql']['master_database'] = $tmp_mysql_server_database;
 				$finished = true;
 			} else {
-				swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());
+				swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error());
 			}
 		} while ($finished == false);
 		unset($finished);
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 2522971427734b3dd19541646f5fd90bdd0d365c..9c938ef6b1127975b06c1353346a1267872cf3b0 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -896,6 +896,8 @@ class installer_base {
 		}
 		unset($server_ini_array);
 		
+		$tmp = str_replace('.','\.',$conf['hostname']);
+
 		$postconf_placeholders = array('{config_dir}' => $config_dir,
 			'{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
 			'{vmail_userid}' => $cf['vmail_userid'],
@@ -903,6 +905,7 @@ class installer_base {
 			'{rbl_list}' => $rbl_list,
 			'{greylisting}' => $greylisting,
 			'{reject_slm}' => $reject_sender_login_mismatch,
+			'{myhostname}' => $tmp,
 		);
 
 		$postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_postfix.conf.master', 'tpl/debian_postfix.conf.master');
@@ -933,6 +936,27 @@ class installer_base {
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
 
+		//* Create auxillary postfix conf files
+		$configfile = 'helo_access';
+		if(is_file($config_dir.'/'.$configfile)) {
+			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
+			chmod($config_dir.'/'.$configfile.'~', 0400);
+		}
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
+		$content = strtr($content, $postconf_placeholders);
+		# todo: look up this server's ip addrs and loop through each
+		# todo: look up domains hosted on this server and loop through each
+		wf($config_dir.'/'.$configfile, $content);
+
+		$configfile = 'blacklist_helo';
+		if(is_file($config_dir.'/'.$configfile)) {
+			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
+			chmod($config_dir.'/'.$configfile.'~', 0400);
+		}
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
+		$content = strtr($content, $postconf_placeholders);
+		wf($config_dir.'/'.$configfile, $content);
+
 		//* Make a backup copy of the main.cf file
 		copy($config_dir.'/main.cf', $config_dir.'/main.cf~');
 
@@ -2052,6 +2076,10 @@ Email Address []:
 			}
 			$content = str_replace('{use_tcp}', $use_tcp, $content);
 			$content = str_replace('{use_socket}', $use_socket, $content);
+			
+			// SSL in apps vhost is off by default. Might change later.
+			$content = str_replace('{ssl_on}', 'off', $content);
+			$content = str_replace('{ssl_comment}', '#', $content);
 
 			wf($vhost_conf_dir.'/apps.vhost', $content);
 
diff --git a/install/lib/mysql.lib.php b/install/lib/mysql.lib.php
index 11fd2ec37db8851abe47835b8072c18bb61ba680..7cf06ee044a24aa279bed471210b5224fad490f6 100644
--- a/install/lib/mysql.lib.php
+++ b/install/lib/mysql.lib.php
@@ -776,7 +776,7 @@ class db_result {
 	 *
 	 * @access private
 	 */
-	public function db_result($iResId, $iConnection) {
+	public function __construct($iResId, $iConnection) {
 		$this->_iResId = $iResId;
 		$this->_iConnection = $iConnection;
 	}
@@ -902,7 +902,7 @@ class fakedb_result {
 	 *
 	 * @access private
 	 */
-	public function fakedb_result($aData) {
+	public function __construct($aData) {
 		$this->aResultData = $aData;
 		$this->aLimitedData = $aData;
 		reset($this->aLimitedData);
diff --git a/install/tpl/blacklist_helo.master b/install/tpl/blacklist_helo.master
new file mode 100644
index 0000000000000000000000000000000000000000..f8d9ee27c53c939612b326549b05b9156d94bc9c
--- /dev/null
+++ b/install/tpl/blacklist_helo.master
@@ -0,0 +1,22 @@
+# blacklist_helo - after permit_sasl, used to stop common spammers/misconfigurations
+#
+# This file can be used to block hostnames used in smtp HELO command which are known bad.
+# Occasionally you will run into legitimate mail servers which are misconfigured and end
+# up blocked here, so this is not enabled by default, but it is useful if you are prepared
+# to address those cases.
+#
+# See docs/extras/blacklist_helo.master from ispconfig source for a more complete example list.
+#
+# If you make changes here, also copy them to /usr/local/ispconfig/server/conf-custom/install/blacklist_helo.master,
+# so your changes are not overwritten with ispconfig updates.
+
+
+#/.*\.administrator$/    REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+#/.*\.admin$/    REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+#/.*\.adsl$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+#/.*\.arpa$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+#/.*\.dhcp$/ REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+#/.*\.dns$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+#/.*\.domain$/   REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+#/.*\.dynamic$/  REJECT HELO hostname is using a top level domain that does not exist.  See RFC 2821 section 3.6.
+
diff --git a/install/tpl/debian_postfix.conf.master b/install/tpl/debian_postfix.conf.master
index 911b1cabb9e9bc794541eb476529da276fa0f82c..c518250f5093e4b504bd499c9314498eced0fb67 100644
--- a/install/tpl/debian_postfix.conf.master
+++ b/install/tpl/debian_postfix.conf.master
@@ -24,6 +24,8 @@ relay_domains = mysql:{config_dir}/mysql-virtual_relaydomains.cf
 relay_recipient_maps = mysql:{config_dir}/mysql-virtual_relayrecipientmaps.cf
 smtpd_sender_login_maps = proxy:mysql:{config_dir}/mysql-virtual_sender_login_maps.cf
 proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $sender_bcc_maps $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps
+smtpd_helo_required = yes
+smtpd_helo_restrictions = reject_invalid_helo_hostname, permit_mynetworks, check_helo_access regexp:{config_dir}/helo_access, permit_sasl_authenticated, reject_non_fqdn_helo_hostname, check_helo_access regexp:{config_dir}/blacklist_helo, warn_if_reject reject_unknown_helo_hostname, permit
 smtpd_sender_restrictions = check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf regexp:{config_dir}/tag_as_originating.re{reject_slm}, permit_mynetworks, check_sender_access regexp:{config_dir}/tag_as_foreign.re
 smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
 smtpd_client_message_rate_limit = 100
@@ -41,3 +43,8 @@ smtpd_tls_protocols = !SSLv2,!SSLv3
 smtp_tls_protocols = !SSLv2,!SSLv3
 smtpd_tls_exclude_ciphers = RC4, aNULL
 smtp_tls_exclude_ciphers = RC4, aNULL
+strict_rfc821_envelopes = yes
+disable_vrfy_command = yes
+allow_percent_hack = no
+swap_bangpath = no
+smtpd_reject_unlisted_sender = yes
diff --git a/install/tpl/fedora_postfix.conf.master b/install/tpl/fedora_postfix.conf.master
index 473bbceba8e319354fb7f87b1ebcafca184cc17c..cedaa14849d25d72d23786f2233543f3d439dee8 100644
--- a/install/tpl/fedora_postfix.conf.master
+++ b/install/tpl/fedora_postfix.conf.master
@@ -21,6 +21,8 @@ relay_domains = mysql:{config_dir}/mysql-virtual_relaydomains.cf
 relay_recipient_maps = mysql:{config_dir}/mysql-virtual_relayrecipientmaps.cf
 smtpd_sender_login_maps = proxy:mysql:{config_dir}/mysql-virtual_sender_login_maps.cf
 proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $sender_bcc_maps $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps
+smtpd_helo_required = yes
+smtpd_helo_restrictions = reject_invalid_helo_hostname, permit_mynetworks, check_helo_access regexp:{config_dir}/helo_access, permit_sasl_authenticated, reject_non_fqdn_helo_hostname, check_helo_access regexp:{config_dir}/blacklist_helo, warn_if_reject reject_unknown_helo_hostname, permit
 smtpd_sender_restrictions = check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf regexp:{config_dir}/tag_as_originating.re{reject_slm}, permit_mynetworks, check_sender_access regexp:{config_dir}/tag_as_foreign.re
 smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
 smtpd_client_message_rate_limit = 100
@@ -38,3 +40,8 @@ smtpd_tls_protocols = !SSLv2,!SSLv3
 smtp_tls_protocols = !SSLv2,!SSLv3
 smtpd_tls_exclude_ciphers = RC4, aNULL
 smtp_tls_exclude_ciphers = RC4, aNULL
+strict_rfc821_envelopes = yes
+disable_vrfy_command = yes
+allow_percent_hack = no
+swap_bangpath = no
+smtpd_reject_unlisted_sender = yes
diff --git a/install/tpl/gentoo_postfix.conf.master b/install/tpl/gentoo_postfix.conf.master
index f5730f7e9f90c9c60f0c31baa5db89e1bceab287..5439cc5158f475bcdb105b749fa8ea3ca015bbc3 100644
--- a/install/tpl/gentoo_postfix.conf.master
+++ b/install/tpl/gentoo_postfix.conf.master
@@ -20,6 +20,8 @@ relay_domains = mysql:{config_dir}/mysql-virtual_relaydomains.cf
 relay_recipient_maps = mysql:{config_dir}/mysql-virtual_relayrecipientmaps.cf
 smtpd_sender_login_maps = proxy:mysql:{config_dir}/mysql-virtual_sender_login_maps.cf
 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 $smtpd_sender_login_maps
+smtpd_helo_required = yes
+smtpd_helo_restrictions = reject_invalid_helo_hostname, permit_mynetworks, check_helo_access regexp:{config_dir}/helo_access, permit_sasl_authenticated, reject_non_fqdn_helo_hostname, check_helo_access regexp:{config_dir}/blacklist_helo, warn_if_reject reject_unknown_helo_hostname, permit
 smtpd_sender_restrictions = check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf regexp:{config_dir}/tag_as_originating.re{reject_slm}, permit_mynetworks, check_sender_access regexp:{config_dir}/tag_as_foreign.re
 smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
 smtpd_client_message_rate_limit = 100
@@ -37,3 +39,8 @@ smtpd_tls_protocols = !SSLv2,!SSLv3
 smtp_tls_protocols = !SSLv2,!SSLv3
 smtpd_tls_exclude_ciphers = RC4, aNULL
 smtp_tls_exclude_ciphers = RC4, aNULL
+strict_rfc821_envelopes = yes
+disable_vrfy_command = yes
+allow_percent_hack = no
+swap_bangpath = no
+smtpd_reject_unlisted_sender = yes
diff --git a/install/tpl/helo_access.master b/install/tpl/helo_access.master
new file mode 100644
index 0000000000000000000000000000000000000000..796c3ed52abc04e4421ef2f970335cc258fd775f
--- /dev/null
+++ b/install/tpl/helo_access.master
@@ -0,0 +1,19 @@
+# helo_access - before permit_sasl
+# be sure to list your own hostname(s), domain(s) and IP address(es) here
+
+# Reject others identifying with this machine's hostnames and IP addresses
+/^{myhostname}$/  REJECT
+#/^((smtp|mx|mail)\.domain1\.com$/	REJECT
+#/^mail\.domain2\.com$/		REJECT
+
+# TODO: this server's ip addr loop here
+#/^\[?1\.2\.3\.4\]?$/	REJECT
+#/^\[?12\.34\.56\.78\]?$/	REJECT
+#/^\[?123\.234\.123\.234\]?$/	REJECT
+
+# Reject others identifying as domains we host
+# TODO: this server's hosted mail domains loop here
+#/^domain1\.com$/	REJECT
+#/^domain2\.com$/	REJECT
+#/^domain3\.net$/	REJECT
+
diff --git a/install/tpl/mysql-virtual_outgoing_bcc.cf b/install/tpl/mysql-virtual_outgoing_bcc.cf
index dd2bf9b039e79c8d218aed021120f418f0d8c30c..dfeb04b553ccb54b108c69db1fb652bea93b05af 100644
--- a/install/tpl/mysql-virtual_outgoing_bcc.cf
+++ b/install/tpl/mysql-virtual_outgoing_bcc.cf
@@ -1,8 +1,8 @@
-user = {mysql_server_ispconfig_user}
-password = {mysql_server_ispconfig_password}
-dbname = {mysql_server_database}
-table = mail_user
-select_field = sender_cc
-where_field = email
-additional_conditions = and postfix = 'y' and disabledeliver = 'n' and disables$
+user = {mysql_server_ispconfig_user}
+password = {mysql_server_ispconfig_password}
+dbname = {mysql_server_database}
+table = mail_user
+select_field = sender_cc
+where_field = email
+additional_conditions = and postfix = 'y' and disabledeliver = 'n' and disables$
 hosts = 127.0.0.1
\ No newline at end of file
diff --git a/install/tpl/mysql-virtual_outgoing_bcc.cf.master b/install/tpl/mysql-virtual_outgoing_bcc.cf.master
index 6ca154f3b9fefc2d55610a30ef13c158a826ae1d..fbd82db5c03da7c2ffbb081c38a00634dce13d69 100644
--- a/install/tpl/mysql-virtual_outgoing_bcc.cf.master
+++ b/install/tpl/mysql-virtual_outgoing_bcc.cf.master
@@ -1,8 +1,8 @@
-user = {mysql_server_ispconfig_user}
-password = {mysql_server_ispconfig_password}
-dbname = {mysql_server_database}
-table = mail_user
-select_field = sender_cc
-where_field = email
-additional_conditions = and postfix = 'y' and disabledeliver = 'n' and disablesmtp = 'n'
+user = {mysql_server_ispconfig_user}
+password = {mysql_server_ispconfig_password}
+dbname = {mysql_server_database}
+table = mail_user
+select_field = sender_cc
+where_field = email
+additional_conditions = and postfix = 'y' and disabledeliver = 'n' and disablesmtp = 'n'
 hosts = 127.0.0.1
\ No newline at end of file
diff --git a/install/tpl/opensuse_postfix.conf.master b/install/tpl/opensuse_postfix.conf.master
index f018e23210ad517e3c2c2e824ee5be6f6fd87013..a66536f492bcbafb745a48373ea35203d4f50e80 100644
--- a/install/tpl/opensuse_postfix.conf.master
+++ b/install/tpl/opensuse_postfix.conf.master
@@ -23,6 +23,8 @@ relay_domains = mysql:{config_dir}/mysql-virtual_relaydomains.cf
 relay_recipient_maps = mysql:{config_dir}/mysql-virtual_relayrecipientmaps.cf
 smtpd_sender_login_maps = proxy:mysql:{config_dir}/mysql-virtual_sender_login_maps.cf
 proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $sender_bcc_maps $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps
+smtpd_helo_required = yes
+smtpd_helo_restrictions = reject_invalid_helo_hostname, permit_mynetworks, check_helo_access regexp:{config_dir}/helo_access, permit_sasl_authenticated, reject_non_fqdn_helo_hostname, check_helo_access regexp:{config_dir}/blacklist_helo, warn_if_reject reject_unknown_helo_hostname, permit
 smtpd_sender_restrictions = check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf regexp:{config_dir}/tag_as_originating.re{reject_slm}, permit_mynetworks, check_sender_access regexp:{config_dir}/tag_as_foreign.re
 smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
 smtpd_client_message_rate_limit = 100
@@ -40,3 +42,8 @@ smtpd_tls_protocols = !SSLv2,!SSLv3
 smtp_tls_protocols = !SSLv2,!SSLv3
 smtpd_tls_exclude_ciphers = RC4, aNULL
 smtp_tls_exclude_ciphers = RC4, aNULL
+strict_rfc821_envelopes = yes
+disable_vrfy_command = yes
+allow_percent_hack = no
+swap_bangpath = no
+smtpd_reject_unlisted_sender = yes
diff --git a/install/uninstall-fedora.php b/install/uninstall-fedora.php
index b1d7e47752869511688b72016dc443439dcbd177..8aa5fcf68e2f0f46642eeaa3ba961f5c835b5766 100644
--- a/install/uninstall-fedora.php
+++ b/install/uninstall-fedora.php
@@ -65,16 +65,16 @@ if($do_uninstall == 'yes') {
 	//exec("/etc/init.d/mysqld stop");
 	//exec("rm -rf /var/lib/mysql/".$conf["db_database"]);
 	//exec("/etc/init.d/mysqld start");
-	$link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password);
+	$link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password);
 	if (!$link) {
 		echo "Unable to connect to the database'.mysql_error($link)";
 	} else {
-		$result=mysql_query("DROP DATABASE ".$conf['db_database']."';", $link);
-		if (!$result) echo "Unable to remove the ispconfig-database ".$conf['db_database']." ".mysql_error($link)."\n";
-		$result=mysql_query("DROP USER '".$conf['db_user'] ."';");
-		if (!$result) echo "Unable to remove the ispconfig-database-user ".$conf['db_user']." ".mysql_error($link)."\n";
+		$result=mysqli_query($link,"DROP DATABASE ".$conf['db_database']."';");
+		if (!$result) echo "Unable to remove the ispconfig-database ".$conf['db_database']." ".mysqli_error($link)."\n";
+		$result=mysqli_query($link, "DROP USER '".$conf['db_user'] ."';");
+		if (!$result) echo "Unable to remove the ispconfig-database-user ".$conf['db_user']." ".mysqli_error($link)."\n";
 	}
-	mysql_close($link);
+	mysqli_close($link);
 
 	// Deleting the symlink in /var/www
 	// Apache
diff --git a/install/uninstall.php b/install/uninstall.php
index 111f57466311f6c70f017a4654c192603fc3305c..198a145a5ad7ef2e0fd1f89226f5591f73485398 100644
--- a/install/uninstall.php
+++ b/install/uninstall.php
@@ -60,16 +60,16 @@ if($do_uninstall == 'yes') {
 
 	echo "\n\n>> Uninstalling ISPConfig 3... \n\n";
 
-	$link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password);
+	$link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password);
 	if (!$link) {
 		echo "Unable to connect to the database'.mysql_error($link)";
 	} else {
-		$result=mysql_query("DROP DATABASE ".$conf['db_database']."';", $link);
-		if (!$result) echo "Unable to remove the ispconfig-database ".$conf['db_database']." ".mysql_error($link)."\n";
-		$result=mysql_query("DROP USER '".$conf['db_user'] ."';");
-	        if (!$result) echo "Unable to remove the ispconfig-database-user ".$conf['db_user']." ".mysql_error($link)."\n";
+		$result=mysqli_query($link,"DROP DATABASE ".$conf['db_database']."';");
+		if (!$result) echo "Unable to remove the ispconfig-database ".$conf['db_database']." ".mysqli_error($link)."\n";
+		$result=mysqli_query($link,"DROP USER '".$conf['db_user'] ."';");
+	        if (!$result) echo "Unable to remove the ispconfig-database-user ".$conf['db_user']." ".mysqli_error($link)."\n";
 	}
-	mysql_close($link);
+	mysqli_close($link);
 	
 	// Deleting the symlink in /var/www
 	// Apache
diff --git a/install/update.php b/install/update.php
index 504a63713eab2f85cc62ccb4e23cda0ea866e1ae..9b5b9ba7b6ba16f1bccbb05fe1fd75c120ad0522 100644
--- a/install/update.php
+++ b/install/update.php
@@ -226,10 +226,10 @@ $clientdb_password  = '';
 //** Test mysql root connection
 $finished = false;
 do {
-	if(@mysql_connect($conf["mysql"]["host"], $conf["mysql"]["admin_user"], $conf["mysql"]["admin_password"])) {
+	if(@mysqli_connect($conf["mysql"]["host"], $conf["mysql"]["admin_user"], $conf["mysql"]["admin_password"])) {
 		$finished = true;
 	} else {
-		swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());
+		swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error());
 		$conf["mysql"]["admin_password"] = $inst->free_query('MySQL root password', $conf['mysql']['admin_password'],'mysql_root_password');
 	}
 } while ($finished == false);
@@ -255,7 +255,7 @@ if($conf['mysql']['master_slave_setup'] == 'y') {
 		$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database');
 
 		//* Initialize the MySQL server connection
-		if(@mysql_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
+		if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, $tmp_mysql_server_database, (int)$tmp_mysql_server_port)) {
 			$conf['mysql']['master_host'] = $tmp_mysql_server_host;
 			$conf['mysql']['master_port'] = $tmp_mysql_server_port;
 			$conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user;
@@ -263,7 +263,7 @@ if($conf['mysql']['master_slave_setup'] == 'y') {
 			$conf['mysql']['master_database'] = $tmp_mysql_server_database;
 			$finished = true;
 		} else {
-			swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());
+			swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error());
 		}
 	} while ($finished == false);
 	unset($finished);
diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php
index e23b6cab70bc43149141128677e03a48df73f9b4..f9ef167fa1146fdea9897c232b208e35debda633 100755
--- a/interface/lib/app.inc.php
+++ b/interface/lib/app.inc.php
@@ -71,6 +71,13 @@ class app {
 			$this->uses('session');
 			$sess_timeout = $this->conf('interface', 'session_timeout');
 			$cookie_domain = (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']);
+			
+			// Workaround for Nginx servers
+			if($cookie_domain == '_') {
+				$tmp = explode(':',$_SERVER["HTTP_HOST"]);
+				$cookie_domain = $tmp[0];
+				unset($tmp);
+			}
 			$cookie_secure = ($_SERVER["HTTPS"] == 'on')?true:false;
 			if($sess_timeout) {
 				/* check if user wants to stay logged in */
diff --git a/interface/lib/classes/plugin_directive_snippets.inc.php b/interface/lib/classes/plugin_directive_snippets.inc.php
index dbc7d4887d1f71b2f3fcc0c0fd2c14813b1bee42..41138bca1e5891723289a548b9edb9c4ccf19789 100644
--- a/interface/lib/classes/plugin_directive_snippets.inc.php
+++ b/interface/lib/classes/plugin_directive_snippets.inc.php
@@ -1,72 +1,72 @@
-<?php
-
-
-class plugin_directive_snippets extends plugin_base
-{
-	var $module;
-	var $form;
-	var $tab;
-	var $record_id;
-	var $formdef;
-	var $options;
-
-	public function onShow()
-	{
-		global $app;
-
-		$listTpl = new tpl;
-		$listTpl->newTemplate('templates/web_directive_snippets.htm');
-
-		//* Loading language file
-		$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_directive_snippets.lng";
-
-		include $lng_file;
-		$listTpl->setVar($wb);
-
-		$message = '';
-		$error   = '';
-
-		$server_type = $app->getconf->get_server_config($this->form->dataRecord['server_id'], 'web');
-		$server_type = $server_type['server_type'];
-		$records = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND type = ? ORDER BY name ASC", $server_type);
-
-		for ($i = 0, $c = count($records); $i < $c; $i++)
-		{
-			$records[$i]['is_selected'] = false;
-
-			if ($this->form->dataRecord['directive_snippets_id'] === $records[$i]['directive_snippets_id'])
-				$records[$i]['is_selected'] = true;
-		}
-
-		$listTpl->setLoop('records', $records);
-
-		$list_name = 'directive_snippets_list';
-		$_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
-		$_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
-		$_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
-		$_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
-		$_SESSION["s"]["form"]["return_to"] = $list_name;
-
-		return $listTpl->grab();
-	}
-	
-	public function onUpdate()
-	{
-		global $app, $conf;
-
-		if (isset($this->form->dataRecord['directive_snippets_id']) && $this->form->oldDataRecord['directive_snippets_id'] !== $this->form->dataRecord['directive_snippets_id']) {
-			$app->db->query('UPDATE web_domain SET directive_snippets_id = ? WHERE domain_id = ?', $this->form->dataRecord['directive_snippets_id'], $this->form->id);
-		}
-	}
-
-	public function onInsert()
-	{
-		global $app, $conf;
-
-		if (isset($this->form->dataRecord['directive_snippets_id'])) {
-			$app->db->query('UPDATE web_domain SET directive_snippets_id = ? WHERE domain_id = ?', $this->form->dataRecord['directive_snippets_id'], $this->form->id);
-		}
-	}
-
-}
+<?php
+
+
+class plugin_directive_snippets extends plugin_base
+{
+	var $module;
+	var $form;
+	var $tab;
+	var $record_id;
+	var $formdef;
+	var $options;
+
+	public function onShow()
+	{
+		global $app;
+
+		$listTpl = new tpl;
+		$listTpl->newTemplate('templates/web_directive_snippets.htm');
+
+		//* Loading language file
+		$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_directive_snippets.lng";
+
+		include $lng_file;
+		$listTpl->setVar($wb);
+
+		$message = '';
+		$error   = '';
+
+		$server_type = $app->getconf->get_server_config($this->form->dataRecord['server_id'], 'web');
+		$server_type = $server_type['server_type'];
+		$records = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND type = ? ORDER BY name ASC", $server_type);
+
+		for ($i = 0, $c = count($records); $i < $c; $i++)
+		{
+			$records[$i]['is_selected'] = false;
+
+			if ($this->form->dataRecord['directive_snippets_id'] === $records[$i]['directive_snippets_id'])
+				$records[$i]['is_selected'] = true;
+		}
+
+		$listTpl->setLoop('records', $records);
+
+		$list_name = 'directive_snippets_list';
+		$_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
+		$_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
+		$_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
+		$_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
+		$_SESSION["s"]["form"]["return_to"] = $list_name;
+
+		return $listTpl->grab();
+	}
+	
+	public function onUpdate()
+	{
+		global $app, $conf;
+
+		if (isset($this->form->dataRecord['directive_snippets_id']) && $this->form->oldDataRecord['directive_snippets_id'] !== $this->form->dataRecord['directive_snippets_id']) {
+			$app->db->query('UPDATE web_domain SET directive_snippets_id = ? WHERE domain_id = ?', $this->form->dataRecord['directive_snippets_id'], $this->form->id);
+		}
+	}
+
+	public function onInsert()
+	{
+		global $app, $conf;
+
+		if (isset($this->form->dataRecord['directive_snippets_id'])) {
+			$app->db->query('UPDATE web_domain SET directive_snippets_id = ? WHERE domain_id = ?', $this->form->dataRecord['directive_snippets_id'], $this->form->id);
+		}
+	}
+
+}
 ?>
\ No newline at end of file
diff --git a/interface/web/client/lib/lang/en_client_message_template.lng b/interface/web/client/lib/lang/en_client_message_template.lng
index e2ab2c7970f4bbf4fa96e71911f32c314bbecccc..42cd796047d622304b701aa2aac2e9bd22d01c3f 100644
--- a/interface/web/client/lib/lang/en_client_message_template.lng
+++ b/interface/web/client/lib/lang/en_client_message_template.lng
@@ -1,11 +1,11 @@
-<?php
-$wb["template_type_txt"] = 'Email type';
-$wb["template_name_txt"] = 'Template name';
-$wb["subject_txt"] = 'Subject';
-$wb["message_txt"] = 'Message';
-$wb['Email template'] = 'Email template';
-$wb['Settings'] = 'Setting';
-$wb['variables_txt'] = 'Variables';
-$wb['variables_description_txt'] = '(The username and password variables are only available in welcome emails.)';
-$wb['duplicate_welcome_error'] = 'There can be only one default welcome email template. Please edit the existing template instead of adding a new one.';
+<?php
+$wb["template_type_txt"] = 'Email type';
+$wb["template_name_txt"] = 'Template name';
+$wb["subject_txt"] = 'Subject';
+$wb["message_txt"] = 'Message';
+$wb['Email template'] = 'Email template';
+$wb['Settings'] = 'Setting';
+$wb['variables_txt'] = 'Variables';
+$wb['variables_description_txt'] = '(The username and password variables are only available in welcome emails.)';
+$wb['duplicate_welcome_error'] = 'There can be only one default welcome email template. Please edit the existing template instead of adding a new one.';
 ?>
\ No newline at end of file
diff --git a/interface/web/client/lib/lang/en_client_message_template_list.lng b/interface/web/client/lib/lang/en_client_message_template_list.lng
index 7a78bf08dea0f780adb9d22f462cf43e009dc56b..41acc0c26bc63f124b8637d0fc70d502075c72d2 100644
--- a/interface/web/client/lib/lang/en_client_message_template_list.lng
+++ b/interface/web/client/lib/lang/en_client_message_template_list.lng
@@ -1,5 +1,5 @@
-<?php
-$wb["list_head_txt"] = 'Email templates';
-$wb["template_type_txt"] = 'Message for';
-$wb["template_name_txt"] = 'Template name';
+<?php
+$wb["list_head_txt"] = 'Email templates';
+$wb["template_type_txt"] = 'Message for';
+$wb["template_name_txt"] = 'Template name';
 ?>
\ No newline at end of file
diff --git a/interface/web/client/templates/message_template_list.htm b/interface/web/client/templates/message_template_list.htm
index 98f3284b29ded70b63456e5ef964e9ac32e54bca..5efaf5f23e9d21dfccf7092496ffbabc36fcfe50 100644
--- a/interface/web/client/templates/message_template_list.htm
+++ b/interface/web/client/templates/message_template_list.htm
@@ -11,21 +11,21 @@
 	<table class="table">
         <thead class="dark form-group-sm">
           <tr>
-            <th data-column="template_type"><tmpl_var name="template_type_txt"></th>
-            <th data-column="template_name"><tmpl_var name="template_name_txt"></th>
+            <th data-column="template_type"><tmpl_var name="template_type_txt"></th>
+            <th data-column="template_name"><tmpl_var name="template_name_txt"></th>
             <th class="text-right">&nbsp;</th>
           </tr>
           <tr>
-            <td><select class="form-control" name="search_template_type" onChange="ISPConfig.submitForm('pageForm','billing/invoice_message_template_list.php');">{tmpl_var name='search_template_type'}</select></td>
-            <td><input class="form-control" type="text" name="search_template_name" value="{tmpl_var name='search_template_name'}" /></td>
+            <td><select class="form-control" name="search_template_type" onChange="ISPConfig.submitForm('pageForm','billing/invoice_message_template_list.php');">{tmpl_var name='search_template_type'}</select></td>
+            <td><input class="form-control" type="text" name="search_template_name" value="{tmpl_var name='search_template_name'}" /></td>
             <td class="text-right"><div class="buttons"><button type="button" class="btn btn-default formbutton-default formbutton-narrow" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" data-submit-form="pageForm" data-form-action="billing/invoice_message_template_list.php"><span class="icon icon-filter"></span></button></div></td>
           </tr>
         </thead>
         <tbody>
           <tmpl_loop name="records">
           <tr>
-            <td><a href="#" data-load-content="billing/invoice_message_template_edit.php?id={tmpl_var name='id'}">{tmpl_var name="template_type"}</a></td>
-            <td><a href="#" data-load-content="billing/invoice_message_template_edit.php?id={tmpl_var name='id'}">{tmpl_var name="template_name"}</a></td>
+            <td><a href="#" data-load-content="billing/invoice_message_template_edit.php?id={tmpl_var name='id'}">{tmpl_var name="template_type"}</a></td>
+            <td><a href="#" data-load-content="billing/invoice_message_template_edit.php?id={tmpl_var name='id'}">{tmpl_var name="template_name"}</a></td>
             <td class="text-right">
               <div class="buttons icons16">    
                 <a class="btn btn-default formbutton-danger formbutton-narrow" href="javascript: ISPConfig.confirm_action('billing/invoice_message_template_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span class="icon icon-delete"></span></a>
diff --git a/interface/web/dashboard/lib/lang/bg_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/bg_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/bg_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/bg_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/br_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/br_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/br_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/br_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/cz_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/cz_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/cz_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/cz_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/el_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/el_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/el_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/el_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/en_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/en_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/en_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/en_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/es_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/es_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/es_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/es_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/fi_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/fi_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/fi_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/fi_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/hu_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/hu_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/hu_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/hu_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/id_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/id_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/id_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/id_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/it_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/it_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/it_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/it_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/ja_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/ja_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/ja_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/ja_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/nl_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/nl_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/nl_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/nl_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/pl_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/pl_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/pl_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/pl_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/pt_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/pt_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/pt_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/pt_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/ru_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/ru_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/ru_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/ru_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/se_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/se_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/se_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/se_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/sk_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/sk_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/sk_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/sk_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/dashboard/lib/lang/tr_dashlet_invoice_client_settings.lng b/interface/web/dashboard/lib/lang/tr_dashlet_invoice_client_settings.lng
index d021c17f8a9e7a742a1735dc183edcaab565e3e9..8cae3dfb4f0563e28f98f3cc43f4e0983946e9d6 100644
--- a/interface/web/dashboard/lib/lang/tr_dashlet_invoice_client_settings.lng
+++ b/interface/web/dashboard/lib/lang/tr_dashlet_invoice_client_settings.lng
@@ -1,4 +1,4 @@
-<?php
-$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
-$wb['edit_txt'] = 'Edit';
-?>
+<?php
+$wb['invoice_client_settings_txt'] = 'Invoice Client Settings';
+$wb['edit_txt'] = 'Edit';
+?>
diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php
index a30a9ec0443d39e0faebd36c1760502c4306c65e..d5af589c2385ce57f2bf1efd39df694cca47c4b2 100644
--- a/interface/web/js/scrigo.js.php
+++ b/interface/web/js/scrigo.js.php
@@ -153,9 +153,9 @@ function password(minLength, special, num_special){
 	var maxLength = minLength + 5;
 	var length = getRandomInt(minLength, maxLength);
 	
-	var alphachars = "abcdefghijklmnopqrstuvwxyz";
-	var upperchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-    var numchars = "1234567890";
+	var alphachars = "abcdefghijkmnopqrstuvwxyz";
+	var upperchars = "ABCDEFGHJKLMNPQRSTUVWXYZ";
+    var numchars = "23456789";
     var specialchars = "!@#_";
 	
 	if(num_special == undefined) num_special = 0;
diff --git a/interface/web/sites/lib/lang/bg_web_directive_snippets.lng b/interface/web/sites/lib/lang/bg_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/bg_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/bg_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/br_web_directive_snippets.lng b/interface/web/sites/lib/lang/br_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/br_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/br_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/cz_web_directive_snippets.lng b/interface/web/sites/lib/lang/cz_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/cz_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/cz_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/el_web_directive_snippets.lng b/interface/web/sites/lib/lang/el_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/el_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/el_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/en_web_directive_snippets.lng b/interface/web/sites/lib/lang/en_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/en_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/en_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/es_web_directive_snippets.lng b/interface/web/sites/lib/lang/es_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/es_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/es_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/fi_web_directive_snippets.lng b/interface/web/sites/lib/lang/fi_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/fi_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/fi_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/hu_web_directive_snippets.lng b/interface/web/sites/lib/lang/hu_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/hu_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/hu_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/id_web_directive_snippets.lng b/interface/web/sites/lib/lang/id_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/id_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/id_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/it_web_directive_snippets.lng b/interface/web/sites/lib/lang/it_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/it_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/it_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/ja_web_directive_snippets.lng b/interface/web/sites/lib/lang/ja_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/ja_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/ja_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/nl_web_directive_snippets.lng b/interface/web/sites/lib/lang/nl_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/nl_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/nl_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/pl_web_directive_snippets.lng b/interface/web/sites/lib/lang/pl_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/pl_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/pl_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/pt_web_directive_snippets.lng b/interface/web/sites/lib/lang/pt_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/pt_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/pt_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/ru_web_directive_snippets.lng b/interface/web/sites/lib/lang/ru_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/ru_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/ru_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/se_web_directive_snippets.lng b/interface/web/sites/lib/lang/se_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/se_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/se_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/sk_web_directive_snippets.lng b/interface/web/sites/lib/lang/sk_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/sk_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/sk_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/tr_web_directive_snippets.lng b/interface/web/sites/lib/lang/tr_web_directive_snippets.lng
index 05a004f6549954184012a200707c7c1948a2e9f6..fc74e4cf0c29c6ec3be24096b004586741b64937 100644
--- a/interface/web/sites/lib/lang/tr_web_directive_snippets.lng
+++ b/interface/web/sites/lib/lang/tr_web_directive_snippets.lng
@@ -1,3 +1,3 @@
-<?php
-$wb['directive_snippets_id_txt'] = 'Desired configuration';
+<?php
+$wb['directive_snippets_id_txt'] = 'Desired configuration';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_directive_snippets.htm b/interface/web/sites/templates/web_directive_snippets.htm
index 93e8b94f84f2208b763afcf62514c5670991f8ba..02a14daa0b9b67cb6a671172acd67d2ba514ccdc 100644
--- a/interface/web/sites/templates/web_directive_snippets.htm
+++ b/interface/web/sites/templates/web_directive_snippets.htm
@@ -1,14 +1,14 @@
-<div class="form-group">
-	<label for="directive_snippets_id" class="col-sm-3 control-label">
-		{tmpl_var name='directive_snippets_id_txt'}
-	</label>
-
-	<div class="col-sm-9"><select name="directive_snippets_id" id="directive_snippets_id" class="form-control">
-		<option value="0"></option>
-		<tmpl_loop name="records">
-		<option {tmpl_if name='is_selected' op='==' value='true'}selected="selected" {/tmpl_if}value="{tmpl_var name='directive_snippets_id'}">
-			{tmpl_var name='name'}
-		</option>
-		</tmpl_loop>
-	</select></div>
+<div class="form-group">
+	<label for="directive_snippets_id" class="col-sm-3 control-label">
+		{tmpl_var name='directive_snippets_id_txt'}
+	</label>
+
+	<div class="col-sm-9"><select name="directive_snippets_id" id="directive_snippets_id" class="form-control">
+		<option value="0"></option>
+		<tmpl_loop name="records">
+		<option {tmpl_if name='is_selected' op='==' value='true'}selected="selected" {/tmpl_if}value="{tmpl_var name='directive_snippets_id'}">
+			{tmpl_var name='name'}
+		</option>
+		</tmpl_loop>
+	</select></div>
 </div>
\ No newline at end of file
diff --git a/server/conf/hhvm_monit.master b/server/conf/hhvm_monit.master
index 91642c535a7e084ba51758e687c7dec057966a21..79697eae5874d6fcac9d8143dfea1e11eece10de 100644
--- a/server/conf/hhvm_monit.master
+++ b/server/conf/hhvm_monit.master
@@ -1,3 +1,3 @@
-check process hhvm_{SYSTEM_USER} with pidfile /var/run/hhvm/hhvm_{SYSTEM_USER}.pid
-   start program = "/etc/init.d/hhvm_{SYSTEM_USER} restart"
+check process hhvm_{SYSTEM_USER} with pidfile /var/run/hhvm/hhvm_{SYSTEM_USER}.pid
+   start program = "/etc/init.d/hhvm_{SYSTEM_USER} restart"
    stop  program = "/etc/init.d/hhvm_{SYSTEM_USER} stop"
\ No newline at end of file
diff --git a/server/lib/classes/cron.d/100-monitor_clamav_log.inc.php b/server/lib/classes/cron.d/100-monitor_clamav_log.inc.php
index 208161cc0f1b0570b136abc98778a76bf56a3ed7..162f38c3854c6d5ca118a288ce4f889a618f50c5 100644
--- a/server/lib/classes/cron.d/100-monitor_clamav_log.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_clamav_log.inc.php
@@ -129,7 +129,7 @@ class cronjob_monitor_clamav_log extends cronjob {
 		$clamav_outdated_warning = false;
 		$clamav_bytecode_updated = false;
 		foreach ($lastLog as $line) {
-			if (stristr($line,'outdated')) {
+			if (stristr($line,"Can't download daily.cvd from")) {
 				$clamav_outdated_warning = true;
 			}
 			if(stristr($line,'main.cld is up to date')) {
diff --git a/server/lib/classes/cron.d/550-bind_dnssec.inc.php b/server/lib/classes/cron.d/550-bind_dnssec.inc.php
index a8c643fb65a0d860fe32aea4f9251e94a438de8b..2d238c7f4cc58ba6c7351459c2eb8f567880e675 100644
--- a/server/lib/classes/cron.d/550-bind_dnssec.inc.php
+++ b/server/lib/classes/cron.d/550-bind_dnssec.inc.php
@@ -1,89 +1,89 @@
-<?php
-
-/*
-Copyright (c) 2013, Marius Cramer, pixcept KG
-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.
-
-
-DNSSEC-Implementation by Alexander Täffner aka dark alex
-*/
-
-class cronjob_bind_dnssec extends cronjob {
-
-	// job schedule
-	protected $_schedule = '30 3 * * *'; //daily at 3:30 a.m.
-
-	public function onRunJob() {
-		global $app, $conf;
-
-		//* Load libraries
-		$app->uses("getconf,tpl");
-
-		//* load the server configuration options
-		$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
-		
-		//TODO : change this when distribution information has been integrated into server record
-		$filespre = (file_exists('/etc/gentoo-release')) ? 'pri/' : 'pri.';
-		
-		$soas = $app->db->queryAllRecords('SELECT * FROM dns_soa WHERE dnssec_wanted=\'Y\' AND dnssec_initialized=\'Y\' AND dnssec_last_signed < '.(time()-(3600*24*5)+900)); //Resign zones every 5 days (expiry is 16 days so we have enough safety, 15 minutes tolerance)
-		
-		foreach ($soas as $data) {
-			$domain = substr($data['origin'], 0, strlen($data['origin'])-1);
-			if (!file_exists($dns_config['bind_zonefiles_dir'].'/'.$filespre.$domain)) return false;
-			
-			$app->log('DNSSEC Auto-Resign: Resigning zone '.$domain, LOGLEVEL_INFO);
-			
-			$zonefile = file_get_contents($dns_config['bind_zonefiles_dir'].'/'.$filespre.$domain);
-			$keycount=0;
-			foreach (glob($dns_config['bind_zonefiles_dir'].'/K'.$domain.'*.key') as $keyfile) {
-				$includeline = '$INCLUDE '.basename($keyfile);
-				if (!preg_match('@'.preg_quote($includeline).'@', $zonefile)) $zonefile .= "\n".$includeline."\n";
-				$keycount++;
-			}
-			if ($keycount != 2) $app->log('DNSSEC Warning: There are more or less than 2 keyfiles for zone '.$domain, LOGLEVEL_WARN);
-			file_put_contents($dns_config['bind_zonefiles_dir'].'/'.$filespre.$domain, $zonefile);
-			
-			//Sign the zone and set it valid for max. 16 days
-			exec('cd '.escapeshellcmd($dns_config['bind_zonefiles_dir']).';'.
-				 '/usr/sbin/dnssec-signzone -A -e +1382400 -3 $(head -c 1000 /dev/random | sha1sum | cut -b 1-16) -N increment -o '.escapeshellcmd($domain).' -t '.$filespre.escapeshellcmd($domain));
-				 
-			//Write Data back into DB
-			$dnssecdata = "DS-Records:\n".file_get_contents($dns_config['bind_zonefiles_dir'].'/dsset-'.$domain.'.');
-			$dnssecdata .= "\n------------------------------------\n\nDNSKEY-Records:\n";
-			foreach (glob($dns_config['bind_zonefiles_dir'].'/K'.$domain.'*.key') as $keyfile) {
-				$dnssecdata .= file_get_contents($keyfile)."\n\n";
-			}
-			
-			$app->db->query('UPDATE dns_soa SET dnssec_info=\''.$dnssecdata.'\', dnssec_initialized=\'Y\', dnssec_last_signed=\''.time().'\' WHERE id='.$data['id']);
-			$data = next($soas);
-		}
-		
-		parent::onRunJob();
-	}
-
-}
-
-?>
+<?php
+
+/*
+Copyright (c) 2013, Marius Cramer, pixcept KG
+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.
+
+
+DNSSEC-Implementation by Alexander Täffner aka dark alex
+*/
+
+class cronjob_bind_dnssec extends cronjob {
+
+	// job schedule
+	protected $_schedule = '30 3 * * *'; //daily at 3:30 a.m.
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		//* Load libraries
+		$app->uses("getconf,tpl");
+
+		//* load the server configuration options
+		$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
+		
+		//TODO : change this when distribution information has been integrated into server record
+		$filespre = (file_exists('/etc/gentoo-release')) ? 'pri/' : 'pri.';
+		
+		$soas = $app->db->queryAllRecords('SELECT * FROM dns_soa WHERE dnssec_wanted=\'Y\' AND dnssec_initialized=\'Y\' AND dnssec_last_signed < '.(time()-(3600*24*5)+900)); //Resign zones every 5 days (expiry is 16 days so we have enough safety, 15 minutes tolerance)
+		
+		foreach ($soas as $data) {
+			$domain = substr($data['origin'], 0, strlen($data['origin'])-1);
+			if (!file_exists($dns_config['bind_zonefiles_dir'].'/'.$filespre.$domain)) return false;
+			
+			$app->log('DNSSEC Auto-Resign: Resigning zone '.$domain, LOGLEVEL_INFO);
+			
+			$zonefile = file_get_contents($dns_config['bind_zonefiles_dir'].'/'.$filespre.$domain);
+			$keycount=0;
+			foreach (glob($dns_config['bind_zonefiles_dir'].'/K'.$domain.'*.key') as $keyfile) {
+				$includeline = '$INCLUDE '.basename($keyfile);
+				if (!preg_match('@'.preg_quote($includeline).'@', $zonefile)) $zonefile .= "\n".$includeline."\n";
+				$keycount++;
+			}
+			if ($keycount != 2) $app->log('DNSSEC Warning: There are more or less than 2 keyfiles for zone '.$domain, LOGLEVEL_WARN);
+			file_put_contents($dns_config['bind_zonefiles_dir'].'/'.$filespre.$domain, $zonefile);
+			
+			//Sign the zone and set it valid for max. 16 days
+			exec('cd '.escapeshellcmd($dns_config['bind_zonefiles_dir']).';'.
+				 '/usr/sbin/dnssec-signzone -A -e +1382400 -3 $(head -c 1000 /dev/random | sha1sum | cut -b 1-16) -N increment -o '.escapeshellcmd($domain).' -t '.$filespre.escapeshellcmd($domain));
+				 
+			//Write Data back into DB
+			$dnssecdata = "DS-Records:\n".file_get_contents($dns_config['bind_zonefiles_dir'].'/dsset-'.$domain.'.');
+			$dnssecdata .= "\n------------------------------------\n\nDNSKEY-Records:\n";
+			foreach (glob($dns_config['bind_zonefiles_dir'].'/K'.$domain.'*.key') as $keyfile) {
+				$dnssecdata .= file_get_contents($keyfile)."\n\n";
+			}
+			
+			$app->db->query('UPDATE dns_soa SET dnssec_info=\''.$dnssecdata.'\', dnssec_initialized=\'Y\', dnssec_last_signed=\''.time().'\' WHERE id='.$data['id']);
+			$data = next($soas);
+		}
+		
+		parent::onRunJob();
+	}
+
+}
+
+?>
diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index 52a5e50aa0de7ecbe3d0f0aa74ed21e81a6b3523..da6bff96c05ffbb6d25a6a4328be1a5199050cee 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -556,19 +556,19 @@ class db extends mysqli
 		global $app;
 		include 'lib/mysql_clientdb.conf';
 		/* Connect to the database */
-		$link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password);
+		$link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password);
 		if (!$link) {
-			$app->log('Unable to connect to the database'.mysql_error($link), LOGLEVEL_DEBUG);
+			$app->log('Unable to connect to the database'.mysqli_connect_error(), LOGLEVEL_DEBUG);
 			return;
 		}
 		/* Get database-size from information_schema */
-		$result=mysql_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".mysql_real_escape_string($database_name)."';", $link);
+		$result=mysqli_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".mysqli_real_escape_string($database_name)."';", $link);
 		$this->close;
 		if (!$result) {
-			$app->log('Unable to get the database-size'.mysql_error($link), LOGLEVEL_DEBUG);
+			$app->log('Unable to get the database-size'.mysqli_error($link), LOGLEVEL_DEBUG);
 			return;
 		}
-		$database_size = mysql_fetch_row($result);
+		$database_size = mysqli_fetch_row($result);
 		return $database_size[0];
 	}
 
diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index 739e8220e13cf43fdca96e63d731798e0f503c8c..2c36c3844290879f22c766b864f497dbc6f0e716 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -44,7 +44,7 @@ class system{
 	 */
 
 
-	public function system(){
+	public function __construct(){
 		//global $go_info;
 		//$this->server_id = $go_info['isp']['server_id'];
 		//$this->server_conf = $go_info['isp']['server_conf'];
diff --git a/server/plugins-available/mail_plugin.inc.php b/server/plugins-available/mail_plugin.inc.php
index 20388a4c0fcd73298972c88411cc76e1401e7fe3..8696205a00c64bfd91224434ef56c14d221590be 100644
--- a/server/plugins-available/mail_plugin.inc.php
+++ b/server/plugins-available/mail_plugin.inc.php
@@ -207,7 +207,14 @@ class mail_plugin {
 
 		//* Send the welcome email message
 		$domain = explode('@', $data["new"]["email"])[1];
-		if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt')) {
+		$html = false;
+		if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.html')) {
+			$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.html');
+			$html = true;
+		} elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.html')) {
+			$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.html');
+			$html = true;
+		} elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt')) {
 			$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt');
 		} elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt')) {
 			$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt');
@@ -236,8 +243,13 @@ class mail_plugin {
 		unset($tmp);
 
 		$mailHeaders      = "MIME-Version: 1.0" . "\n";
-		$mailHeaders     .= "Content-type: text/plain; charset=utf-8" . "\n";
-		$mailHeaders     .= "Content-Transfer-Encoding: 8bit" . "\n";
+		if($html) {
+			$mailHeaders     .= "Content-Type: text/html; charset=utf-8" . "\n";
+			$mailHeaders     .= "Content-Transfer-Encoding: quoted-printable" . "\n";
+		} else {
+			$mailHeaders     .= "Content-Type: text/plain; charset=utf-8" . "\n";
+			$mailHeaders     .= "Content-Transfer-Encoding: 8bit" . "\n";
+		}
 		$mailHeaders     .= "From: $welcome_mail_from" . "\n";
 		$mailHeaders     .= "Reply-To: $welcome_mail_from" . "\n";
 		$mailTarget       = $data["new"]["email"];
diff --git a/server/plugins-available/software_update_plugin.inc.php b/server/plugins-available/software_update_plugin.inc.php
index ae6b79cfc4ac42bb6d68355290112f60e6bd53e2..83fb831f7cdfb6c376e6d4cd5de661f530c82fe8 100644
--- a/server/plugins-available/software_update_plugin.inc.php
+++ b/server/plugins-available/software_update_plugin.inc.php
@@ -246,29 +246,29 @@ class software_update_plugin {
 			}
 
 			//* Connect to the database
-			$link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password);
+			$link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password);
 			if (!$link) {
-				$app->log('Unable to connect to the database'.mysql_error($link), LOGLEVEL_ERROR);
+				$app->log('Unable to connect to the database'.mysqli_connect_error(), LOGLEVEL_ERROR);
 				return;
 			}
 
 			$query_charset_table = '';
 
 			//* Create the new database
-			if (mysql_query('CREATE DATABASE '.mysql_real_escape_string($db_config['database_name']).$query_charset_table, $link)) {
+			if (mysqli_query($link,'CREATE DATABASE '.mysqli_real_escape_string($link, $db_config['database_name']).$query_charset_table, $link)) {
 				$app->log('Created MySQL database: '.$db_config['database_name'], LOGLEVEL_DEBUG);
 			} else {
-				$app->log('Unable to connect to the database'.mysql_error($link), LOGLEVEL_ERROR);
+				$app->log('Unable to connect to the database'.mysqli_error($link), LOGLEVEL_ERROR);
 			}
 
-			if(mysql_query("GRANT ALL ON ".mysql_real_escape_string($db_config['database_name'], $link).".* TO '".mysql_real_escape_string($db_config['database_user'], $link)."'@'".$db_config['database_host']."' IDENTIFIED BY '".mysql_real_escape_string($db_config['database_password'], $link)."';", $link)) {
+			if(mysqli_query("GRANT ALL ON ".mysqli_real_escape_string($link, $db_config['database_name']).".* TO '".mysqli_real_escape_string($link, $db_config['database_user'])."'@'".$db_config['database_host']."' IDENTIFIED BY '".mysqli_real_escape_string($link, $db_config['database_password'])."';", $link)) {
 				$app->log('Created MySQL user: '.$db_config['database_user'], LOGLEVEL_DEBUG);
 			} else {
-				$app->log('Unable to create database user'.$db_config['database_user'].' '.mysql_error($link), LOGLEVEL_ERROR);
+				$app->log('Unable to create database user'.$db_config['database_user'].' '.mysqli_error($link), LOGLEVEL_ERROR);
 			}
 
-			mysql_query("FLUSH PRIVILEGES;", $link);
-			mysql_close($link);
+			mysqli_query($link, "FLUSH PRIVILEGES;");
+			mysqli_close($link);
 
 		}