From 49441bdd0f3ff75d5092d5b832b97ea722a66363 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Fri, 01 Jul 2016 03:53:30 -0400
Subject: [PATCH] Merge branch 'stable-3.1'

---
 interface/web/tools/lib/lang/ca_usersettings.lng             |    2 
 interface/web/tools/lib/lang/it_usersettings.lng             |    2 
 interface/web/dns/lib/lang/de_dns_wizard.lng                 |    3 
 interface/web/mail/mail_user_edit.php                        |    9 
 interface/web/sites/aps_install_package.php                  |    2 
 server/conf/vhost.conf.master                                |   14 
 interface/web/admin/lib/lang/de_server_config.lng            |    2 
 interface/web/sites/list/webdav_user.list.php                |    2 
 interface/web/mail/list/mail_blacklist.list.php              |    2 
 interface/web/mail/list/spamfilter_blacklist.list.php        |    2 
 interface/web/tools/lib/lang/nl_usersettings.lng             |    2 
 interface/web/tools/lib/lang/ro_usersettings.lng             |    2 
 server/plugins-available/backup_plugin.inc.php               |    1 
 interface/web/mail/list/mail_whitelist.list.php              |    2 
 interface/web/sites/web_vhost_domain_edit.php                |   35 +
 interface/web/tools/lib/lang/tr_usersettings.lng             |    2 
 interface/web/mail/list/mail_forward.list.php                |    2 
 interface/web/client/templates/client_del.htm                |   12 
 interface/web/sites/list/web_folder.list.php                 |    2 
 server/lib/classes/cron.d/500-backup_mail.inc.php            |    2 
 interface/web/mail/list/spamfilter_whitelist.list.php        |    2 
 interface/web/dns/dns_import.php                             |   14 
 interface/web/tools/lib/lang/es_usersettings.lng             |    2 
 interface/web/tools/lib/lang/hr_usersettings.lng             |    2 
 server/server.php                                            |   37 
 interface/lib/classes/tform_base.inc.php                     |   18 
 interface/web/mail/list/mail_domain_catchall.list.php        |    2 
 interface/web/vm/list/openvz_vm.list.php                     |    2 
 interface/web/vm/list/openvz_ostemplate.list.php             |    4 
 interface/web/tools/lib/lang/el_usersettings.lng             |    2 
 interface/web/tools/templates/import_ispconfig.htm           |    6 
 interface/web/mail/list/spamfilter_policy.list.php           |    8 
 interface/web/mail/list/mail_alias.list.php                  |    2 
 install/tpl/helo_access.master                               |    2 
 interface/web/sites/templates/web_vhost_domain_edit.htm      |    4 
 install/lib/install.lib.php                                  |    2 
 interface/web/tools/lib/lang/bg_usersettings.lng             |    2 
 interface/web/mail/list/xmpp_domain.list.php                 |    2 
 server/lib/classes/system.inc.php                            |    4 
 interface/web/tools/lib/lang/pt_usersettings.lng             |    2 
 interface/web/tools/lib/lang/se_usersettings.lng             |    2 
 interface/web/mail/list/mail_relay_recipient.list.php        |    2 
 server/plugins-available/shelluser_jailkit_plugin.inc.php    |   14 
 interface/lib/classes/tform.inc.php                          |   18 
 interface/web/sites/ajax_get_ip.php                          |   10 
 interface/web/sites/database_quota_stats.php                 |    5 
 install/install.php                                          |  658 ++++++++-------------------
 interface/web/mail/xmpp_domain_edit.php                      |    2 
 interface/web/sites/list/cron.list.php                       |    2 
 interface/web/vm/list/openvz_template.list.php               |    2 
 interface/web/tools/lib/lang/sk_usersettings.lng             |    2 
 interface/web/sites/list/web_folder_user.list.php            |    2 
 interface/web/tools/lib/lang/id_usersettings.lng             |    2 
 install/tpl/config.inc.php.master                            |    2 
 install/dist/lib/fedora.lib.php                              |   12 
 interface/web/admin/list/server_ip_map.list.php              |    2 
 interface/web/tools/lib/lang/hu_usersettings.lng             |    2 
 install/tpl/pureftpd_mysql.conf.master                       |   20 
 interface/web/login/index.php                                |    1 
 interface/web/vm/list/openvz_ip.list.php                     |    2 
 server/cron.php                                              |   24 +
 install/lib/installer_base.lib.php                           |   15 
 install/sql/ispconfig3.sql                                   |   19 
 install/sql/incremental/upd_dev_collection.sql               |   15 
 server/plugins-available/apache2_plugin.inc.php              |   31 +
 interface/web/dns/dns_wizard.php                             |   14 
 interface/web/monitor/lib/lang/pl.lng                        |    2 
 interface/web/mail/list/mail_content_filter.list.php         |    2 
 interface/web/themes/default/assets/javascripts/ispconfig.js |   91 +--
 interface/web/mail/list/spamfilter_users.list.php            |    2 
 server/lib/classes/db_mysql.inc.php                          |   16 
 interface/lib/classes/session.inc.php                        |    4 
 interface/web/tools/lib/lang/ja_usersettings.lng             |    2 
 interface/web/sites/list/ftp_user.list.php                   |    2 
 install/dist/lib/centos72.lib.php                            |   40 +
 interface/web/tools/lib/lang/fi_usersettings.lng             |    2 
 interface/web/mail/list/mail_user.list.php                   |   10 
 interface/web/admin/templates/directive_snippets_edit.htm    |    4 
 interface/web/mail/list/mail_transport.list.php              |    2 
 interface/web/sites/list/database.list.php                   |    4 
 interface/web/sites/list/shell_user.list.php                 |    2 
 interface/web/sites/list/web_childdomain.list.php            |    2 
 interface/web/tools/lib/lang/en_usersettings.lng             |    2 
 interface/web/tools/lib/lang/br_usersettings.lng             |    2 
 interface/web/themes/default/templates/error.tpl.htm         |    1 
 interface/web/tools/lib/lang/cz_usersettings.lng             |    2 
 interface/web/tools/lib/lang/pl_usersettings.lng             |    2 
 interface/web/mail/list/mail_spamfilter.list.php             |    2 
 interface/web/login/logout.php                               |    4 
 interface/web/tools/lib/lang/ar_usersettings.lng             |    2 
 interface/web/tools/lib/lang/de_usersettings.lng             |    2 
 server/plugins-available/maildrop_plugin.inc.php             |    2 
 server/plugins-available/nginx_plugin.inc.php                |   28 
 interface/web/mail/list/mail_aliasdomain.list.php            |    2 
 install/dist/lib/centos_base.lib.php                         |    8 
 interface/web/login/login_as.php                             |    4 
 interface/web/mail/list/mail_domain.list.php                 |    2 
 interface/web/sites/list/web_vhost_domain.list.php           |    2 
 interface/web/themes/default/templates/main_login.tpl.htm    |    4 
 interface/web/tools/lib/lang/fr_usersettings.lng             |    2 
 interface/web/themes/default/templates/main.tpl.htm          |    2 
 interface/lib/classes/quota_lib.inc.php                      |    4 
 interface/web/dns/lib/lang/en_dns_wizard.lng                 |    1 
 interface/web/mail/list/mail_get.list.php                    |    2 
 server/plugins-available/maildeliver_plugin.inc.php          |    2 
 interface/web/client/form/client_template.tform.php          |   19 
 interface/web/tools/lib/lang/ru_usersettings.lng             |    2 
 107 files changed, 659 insertions(+), 734 deletions(-)

diff --git a/install/dist/lib/centos72.lib.php b/install/dist/lib/centos72.lib.php
new file mode 100644
index 0000000..3dcd749
--- /dev/null
+++ b/install/dist/lib/centos72.lib.php
@@ -0,0 +1,40 @@
+<?php
+
+/*
+Copyright (c) 2014, Till Brehm, ISPConfig UG
+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.
+*/
+
+require_once realpath(dirname(__FILE__)) . '/centos_base.lib.php';
+
+class installer extends installer_centos {
+
+	protected $clamav_socket = '/var/run/clamd.amavisd/clamd.sock';
+	
+	// everything else is inherited from installer_centos class
+}
+
+?>
diff --git a/install/dist/lib/centos_base.lib.php b/install/dist/lib/centos_base.lib.php
index 74ff8be..d6deb7e 100644
--- a/install/dist/lib/centos_base.lib.php
+++ b/install/dist/lib/centos_base.lib.php
@@ -33,7 +33,7 @@
 	protected $clamav_socket = '/tmp/clamd.socket';
 	
 	public function configure_amavis() {
-		global $conf;
+		global $conf, $dist;
 
 		// amavisd user config file
 		$configfile = 'fedora_amavisd_conf';
@@ -50,6 +50,12 @@
 		$content = str_replace('/var/spool/amavisd/clamd.sock', $this->clamav_socket, $content);
 		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
 		chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0640);
+		
+		// for CentOS 7.2 only
+		if($dist['confid'] == 'centos72') {
+			chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0750);
+			chgrp($conf['amavis']['config_dir'].'/amavisd.conf', 'amavis');
+		}
 
 
 		// Adding the amavisd commands to the postfix configuration
diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php
index 11ce420..4b6dcd3 100644
--- a/install/dist/lib/fedora.lib.php
+++ b/install/dist/lib/fedora.lib.php
@@ -89,6 +89,9 @@
 
 		//* mysql-virtual_relayrecipientmaps.cf
 		$this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
+		
+		//* mysql-virtual_outgoing_bcc.cf
+		$this->process_postfix_config('mysql-virtual_outgoing_bcc.cf');
 
 		//* mysql-virtual_policy_greylist.cf
 		$this->process_postfix_config('mysql-virtual_policy_greylist.cf');
@@ -179,6 +182,7 @@
 		//if(!is_file('/var/lib/mailman/data/aliases')) touch('/var/lib/mailman/data/aliases');
 		if(is_file('/var/lib/mailman/data/aliases')) unlink('/var/lib/mailman/data/aliases');
 		if(!is_link('/var/lib/mailman/data/aliases')) symlink('/etc/mailman/aliases', '/var/lib/mailman/data/aliases');
+		if(!is_file('/etc/mailman/aliases')) touch('/etc/mailman/aliases');
 		exec('postalias /var/lib/mailman/data/aliases');
 		if(!is_file('/etc/mailman/virtual-mailman')) touch('/etc/mailman/virtual-mailman');
 		exec('postmap /etc/mailman/virtual-mailman');
@@ -476,7 +480,7 @@
 	}
 
 	public function configure_amavis() {
-		global $conf;
+		global $conf, $dist;
 
 		// amavisd user config file
 		$configfile = 'fedora_amavisd_conf';
@@ -491,6 +495,12 @@
 		$content = str_replace('{hostname}', $conf['hostname'], $content);
 		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
 		chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0640);
+		
+		// for CentOS 7.2 only
+		if($dist['confid'] == 'centos72') {
+			chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0750);
+			chgrp($conf['amavis']['config_dir'].'/amavisd.conf', 'amavis');
+		}
 
 
 		// Adding the amavisd commands to the postfix configuration
diff --git a/install/install.php b/install/install.php
index 14c9815..1e0899f 100644
--- a/install/install.php
+++ b/install/install.php
@@ -246,41 +246,99 @@
 $conf['services']['proxy'] = false;
 $conf['services']['xmpp'] = false;
 
-if($install_mode == 'standard') {
+//** Get Server ID
+// $conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1');
+// Server ID is an autoInc value of the mysql database now
+if($install_mode == 'expert' && strtolower($inst->simple_query('Shall this server join an existing ISPConfig multiserver setup', array('y', 'n'), 'n','join_multiserver_setup')) == 'y') {
+	$conf['mysql']['master_slave_setup'] = 'y';
 
+	//** Get MySQL root credentials
+	$finished = false;
+	do {
+		$tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname'); 
+		$tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port');
+		$tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user');	 
+		$tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password'); 
+		$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(@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;
+			$conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password;
+			$conf['mysql']['master_database'] = $tmp_mysql_server_database;
+			$finished = true;
+		} else {
+			swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error());
+		}
+	} while ($finished == false);
+	unset($finished);
+
+	// initialize the connection to the master database
+	$inst->dbmaster = new db();
+	if($inst->dbmaster->linkId) $inst->dbmaster->closeConn();
+	$inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_admin_user"], $conf['mysql']["master_admin_password"]);
+	$inst->dbmaster->setDBName($conf['mysql']["master_database"]);
+
+} else {
+	// the master DB is the same then the slave DB
 	$inst->dbmaster = $inst->db;
-	
-	//* Create the MySQL database
-	$inst->configure_database();
+}
 
-	//* Insert the Server record into the database
-	$inst->add_database_server_record();
+//* Create the mysql database
+$inst->configure_database();
+
+//* Check for Web-Server
+if(!$conf['apache']['installed'] && !$conf['nginx']['installed']) {
+	$conf['apache']['installed'] = $inst->force_configure_app('Apache', ($install_mode == 'expert'));
+	$conf['nginx']['installed'] = $inst->force_configure_app('nginx', ($install_mode == 'expert'));
+}
+
+//* Configure Webserver - Apache or nginx
+if($conf['apache']['installed'] == true && $conf['nginx']['installed'] == true) {
+	$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache', 'nginx'), 'apache','http_server');
+	if($http_server_to_use == 'apache'){
+		$conf['nginx']['installed'] = false;
+		$conf['services']['file'] = true;
+	} else {
+		$conf['apache']['installed'] = false;
+	}
+}
+
+//* Insert the Server record into the database
+if($install_mode == 'expert') {
+	swriteln('Adding ISPConfig server record to database.');
+	swriteln('');
+}
+$inst->add_database_server_record();
+
+if($install_mode == 'standard' || strtolower($inst->simple_query('Configure Mail', array('y', 'n') , 'y','configure_mail') ) == 'y') {
 
 	//* Configure Postgrey
-	$force = @($conf['postgrey']['installed']) ? true : $inst->force_configure_app('Postgrey', false);
+	$force = @($conf['postgrey']['installed']) ? true : $inst->force_configure_app('Postgrey', ($install_mode == 'expert'));
 	if($force) swriteln('Configuring Postgrey');
 
 	//* Configure Postfix
-	$force = @($conf['postfix']['installed']) ? true : $inst->force_configure_app('Postfix', false);
+	$force = @($conf['postfix']['installed']) ? true : $inst->force_configure_app('Postfix', ($install_mode == 'expert'));
 	if($force) {
 		swriteln('Configuring Postfix');
-		$inst->configure_postfix();
 		$conf['services']['mail'] = true;
+		$inst->configure_postfix();
 	}
 
 	if($conf['services']['mail']) {
-
 		//* Configure Mailman
-		$force = @($conf['mailman']['installed']) ? true : $inst->force_configure_app('Mailman', false);
+		$force = @($conf['mailman']['installed']) ? true : $inst->force_configure_app('Mailman', ($install_mode == 'expert'));
 		if($force) {
 			swriteln('Configuring Mailman');
 			$inst->configure_mailman();
-		} 
+		}
 
 		//* Check for Dovecot and Courier
 		if(!$conf['dovecot']['installed'] && !$conf['courier']['installed']) {
-			$conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot', false);
-			$conf['courier']['installed'] = $inst->force_configure_app('Courier', false);
+			$conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot', ($install_mode == 'expert'));
+			$conf['courier']['installed'] = $inst->force_configure_app('Courier', ($install_mode == 'expert'));
 		}
 		//* Configure Mailserver - Dovecot or Courier
 		if($conf['dovecot']['installed'] && $conf['courier']['installed']) {
@@ -307,44 +365,58 @@
 		}
 
 		//* Configure Spamasassin
-		$force = @($conf['spamassassin']['installed']) ? true : $inst->force_configure_app('Spamassassin', false);
+		$force = @($conf['spamassassin']['installed']) ? true : $inst->force_configure_app('Spamassassin', ($install_mode == 'expert'));
 		if($force) {
 			swriteln('Configuring Spamassassin');
 			$inst->configure_spamassassin();
 		}
-    
+
 		//* Configure Amavis
-		$force = @($conf['amavis']['installed']) ? true : $inst->force_configure_app('Amavisd', false);
+		$force = @($conf['amavis']['installed']) ? true : $inst->force_configure_app('Amavisd', ($install_mode == 'expert'));
 		if($force) {
 			swriteln('Configuring Amavisd');
 			$inst->configure_amavis();
 		}
 
 		//* Configure Getmail
-		$force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail', false);
+		$force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail', ($install_mode == 'expert'));
 		if($force) {
 			swriteln('Configuring Getmail');
 			$inst->configure_getmail();
 		}
+	} else {
+		swriteln('[ERROR] Postfix not installed - skipping Mail');
+	}
+}
 
-	} else swriteln('[ERROR] Postfix not installed - skipping Mail');
+//* Configure Jailkit
+$force = @($conf['jailkit']['installed']) ? true : $inst->force_configure_app('Jailkit', ($install_mode == 'expert'));
+if($force) {
+	swriteln('Configuring Jailkit');
+	$inst->configure_jailkit();
+}
 
+//* Configure Pureftpd
+$force = @($conf['pureftpd']['installed']) ? true : $inst->force_configure_app('pureftpd', ($install_mode == 'expert'));
+if($force) {
+	swriteln('Configuring Pureftpd');
+	$inst->configure_pureftpd();
+}
+
+//** Configure DNS
+if($install_mode == 'standard' || strtolower($inst->simple_query('Configure DNS Server', array('y', 'n'), 'y','configure_dns')) == 'y') {
 	//* Check for DNS
-//	if(!$conf['powerdns']['installed'] && !$conf['bind']['installed'] && !$conf['mydns']['installed']) {
-	if(!$conf['bind']['installed'] && !$conf['mydns']['installed']) {
-//		$conf['powerdns']['installed'] = $inst->force_configure_app('PowerDNS', false);
-		$conf['bind']['installed'] = $inst->force_configure_app('BIND', false);
-		$conf['mydns']['installed'] = $inst->force_configure_app('MyDNS', false);
+	if(!$conf['powerdns']['installed'] && !$conf['bind']['installed'] && !$conf['mydns']['installed']) {
+		if($install_mode == 'expert') $conf['powerdns']['installed'] = $inst->force_configure_app('PowerDNS', ($install_mode == 'expert'));
+		$conf['bind']['installed'] = $inst->force_configure_app('BIND', ($install_mode == 'expert'));
+		$conf['mydns']['installed'] = $inst->force_configure_app('MyDNS', ($install_mode == 'expert'));
 	}
 	//* Configure PowerDNS
-/*
-	if($conf['powerdns']['installed']) {
+	if($install_mode == 'expert' && $conf['powerdns']['installed']) {
 		swriteln('Configuring PowerDNS');
 		$inst->configure_powerdns();
 		$conf['services']['dns'] = true;
 	}
-*/
-
 	//* Configure Bind
 	if($conf['bind']['installed']) {
 		swriteln('Configuring BIND');
@@ -361,36 +433,9 @@
 		$conf['services']['dns'] = true;
 	}
 
-	//* Configure Jailkit
-	$force = @($conf['jailkit']['installed']) ? true : $inst->force_configure_app('Jailkit', false);
-	if($force) {
-		swriteln('Configuring Jailkit');
-		$inst->configure_jailkit();
-	}
+}
 
-	//* Configure Pureftpd
-	$force = @($conf['pureftpd']['installed']) ? true : $inst->force_configure_app('pureftpd', false);
-	if($force) {
-		swriteln('Configuring Pureftpd');
-		$inst->configure_pureftpd();
-	}
-
-	//* Check for Web-Server
-	if(!$conf['apache']['installed'] && !$conf['nginx']['installed']) {
-		$conf['apache']['installed'] = $inst->force_configure_app('Apache', false);
-		$conf['nginx']['installed'] = $inst->force_configure_app('nginx', false);
-	}
-
-	//* Configure Webserver - Apache or nginx
-	if($conf['apache']['installed'] && $conf['nginx']['installed']) {
-		$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache', 'nginx'), 'apache','http_server');
-		if($http_server_to_use == 'apache'){
-			$conf['nginx']['installed'] = false;
-		} else {
-			$conf['apache']['installed'] = false;
-		}
-	}
-
+if($install_mode == 'standard' || strtolower($inst->simple_query('Configure Web Server', array('y', 'n'), 'y','configure_webserver')) == 'y') {
 	//* Configure Apache
 	if($conf['apache']['installed']){
 		swriteln('Configuring Apache');
@@ -398,41 +443,42 @@
 		$conf['services']['web'] = true;
 		$conf['services']['file'] = true;
 		//* Configure Vlogger
-		$force = @($conf['vlogger']['installed']) ? true : $inst->force_configure_app('vlogger', false);
+		$force = @($conf['vlogger']['installed']) ? true : $inst->force_configure_app('vlogger', ($install_mode == 'expert'));
 		if($force) {
 			swriteln('Configuring vlogger');
 			$inst->configure_vlogger();
 		}
 		//* Configure squid
 /*
-		$force = @($conf['squid']['installed']) ? true : $inst->force_configure_app('squid');
+		$force = @($conf['squid']['installed']) ? true : $inst->force_configure_app('squid', ($install_mode == 'expert'));
 		if($force) {
 			swriteln('Configuring Squid');
 			$inst->configure_squid();
 			$conf['services']['proxy'] = true;
+			if($conf['squid']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['squid']['init_script']))system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
 		}
 */
 	}
-
 	//* Configure nginx
 	if($conf['nginx']['installed']){
 		swriteln('Configuring nginx');
 		$inst->configure_nginx();
 		$conf['services']['web'] = true;
 	}
+}
 
-    //* Configure XMPP
-	$force = @($conf['xmpp']['installed']) ? true : $inst->force_configure_app('Metronome XMPP Server', false);
-	if($force) {
-        swriteln('Configuring Metronome XMPP Server');
-        $inst->configure_xmpp();
-	    $conf['services']['xmpp'] = true;
-	}
+//* Configure OpenVZ
+$force = @($conf['openvz']['installed']) ? true : $inst->force_configure_app('OpenVZ', ($install_mode == 'expert'));
+if($force) {
+	$conf['services']['vserver'] = true;
+	swriteln('Configuring OpenVZ');
+}
 
+if($install_mode == 'standard' || strtolower($inst->simple_query('Configure Firewall Server', array('y', 'n'), 'y','configure_firewall')) == 'y') {
 	//* Check for Firewall
 	if(!$conf['ufw']['installed'] && !$conf['firewall']['installed']) {
-		$conf['ufw']['installed'] = $inst->force_configure_app('Ubuntu Firewall', false);
-		$conf['firewall']['installed'] = $inst->force_configure_app('Bastille Firewall', false);
+		$conf['ufw']['installed'] = $inst->force_configure_app('Ubuntu Firewall', ($install_mode == 'expert'));
+		$conf['firewall']['installed'] = $inst->force_configure_app('Bastille Firewall', ($install_mode == 'expert'));
 	}
 	//* Configure Firewall - Ubuntu or Bastille
 	if($conf['ufw']['installed'] && $conf['firewall']['installed']) {
@@ -456,29 +502,49 @@
 		$conf['services']['firewall'] = true;
 		$conf['bastille']['installed'] = true;
 	}
+}
 
-	//* Configure Fail2ban
-	$force = @($conf['fail2ban']['installed']) ? true : $inst->force_configure_app('Fail2ban', false);
-	if($force) {
-		swriteln('Configuring Fail2ban');
-		$inst->configure_fail2ban();
-	}
+//* Configure XMPP
+$force = @($conf['xmpp']['installed']) ? true : $inst->force_configure_app('Metronome XMPP Server', ($install_mode == 'expert'));
+if($force) {
+	swriteln('Configuring Metronome XMPP Server');
+	$inst->configure_xmpp();
+	$conf['services']['xmpp'] = true;
+}
 
-	//* Configure OpenVZ
-	$force = @($conf['openvz']['installed']) ? true : $inst->force_configure_app('OpenVZ', false);
-	if($force) {
-		$conf['services']['vserver'] = true;
-		swriteln('Configuring OpenVZ');
-	}
+//* Configure Fail2ban
+$force = @($conf['fail2ban']['installed']) ? true : $inst->force_configure_app('Fail2ban', ($install_mode == 'expert'));
+if($force) {
+	swriteln('Configuring Fail2ban');
+	$inst->configure_fail2ban();
+}
 
+if($conf['services']['web'] == true) {
 	//** Configure apps vhost
 	swriteln('Configuring Apps vhost');
 	$inst->configure_apps_vhost();
+}
 
-	//* Configure ISPConfig
+//** Configure ISPConfig :-)
+$install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y';
+if($install_mode == 'standard' || strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') {
 	swriteln('Installing ISPConfig');
 
-	//** Customize the port ISPConfig runs on
+	//** We want to check if the server is a module or cgi based php enabled server
+	//** TODO: Don't always ask for this somehow ?
+	/*
+	$fast_cgi = $inst->simple_query('CGI PHP Enabled Server?', array('yes','no'),'no');
+
+	if($fast_cgi == 'yes') {
+		$alias = $inst->free_query('Script Alias', '/php/');
+		$path = $inst->free_query('Script Alias Path', '/path/to/cgi/bin');
+		$conf['apache']['vhost_cgi_alias'] = sprintf('ScriptAlias %s %s', $alias, $path);
+	} else {
+		$conf['apache']['vhost_cgi_alias'] = "";
+	}
+	*/
+
+	//** Customise the port ISPConfig runs on
 	$ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080','ispconfig_port');
 	$conf['interface_password'] = $inst->free_query('Admin password', 'admin');
 	if($conf['interface_password'] != 'admin') {
@@ -499,398 +565,58 @@
 	if(strtolower($inst->simple_query('Do you want a secure (SSL) connection to the ISPConfig web interface', array('y', 'n'), 'y','ispconfig_use_ssl')) == 'y') {	 
 		$inst->make_ispconfig_ssl_cert();
 	}
+	$inst->install_ispconfig_interface = true;
 
-	$inst->install_ispconfig();
+} else {
+	$inst->install_ispconfig_interface = false;
+}
 
-	//* Configure DBServer
-	swriteln('Configuring DBServer');
-	$inst->configure_dbserver();
+$inst->install_ispconfig();
 
-	//* Configure ISPConfig
-	if($conf['cron']['installed']) {
-		swriteln('Installing ISPConfig crontab');
-		$inst->install_crontab();
-	} else swriteln('[ERROR] Cron not found');
+//* Configure DBServer
+swriteln('Configuring DBServer');
+$inst->configure_dbserver();
 
-	swriteln('Detect IP addresses');
-	$inst->detect_ips();
-
-	swriteln('Restarting services ...');
-	if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart').' >/dev/null 2>&1');
-	if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart'));
-	if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart'));
-	if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart'));
-	if($conf['clamav']['installed'] == true && $conf['clamav']['init_script'] != '') system($inst->getinitcommand($conf['clamav']['init_script'], 'restart'));
-	if($conf['courier']['installed'] == true){
-		if($conf['courier']['courier-authdaemon'] != '') system($inst->getinitcommand($conf['courier']['courier-authdaemon'], 'restart'));
-		if($conf['courier']['courier-imap'] != '') system($inst->getinitcommand($conf['courier']['courier-imap'], 'restart'));
-		if($conf['courier']['courier-imap-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-imap-ssl'], 'restart'));
-		if($conf['courier']['courier-pop'] != '') system($inst->getinitcommand($conf['courier']['courier-pop'], 'restart'));
-		if($conf['courier']['courier-pop-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-pop-ssl'], 'restart'));
-	}
-	if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart'));
-	if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &');
-	if($conf['apache']['installed'] == true && $conf['apache']['init_script'] != '') system($inst->getinitcommand($conf['apache']['init_script'], 'restart'));
-	//* Reload is enough for nginx
-	if($conf['nginx']['installed'] == true){
-		if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload'));
-		if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload'));
-	}
-	if($conf['pureftpd']['installed'] == true && $conf['pureftpd']['init_script'] != '') system($inst->getinitcommand($conf['pureftpd']['init_script'], 'restart'));
-	if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '') system($inst->getinitcommand($conf['mydns']['init_script'], 'restart').' &> /dev/null');
-	if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '') system($inst->getinitcommand($conf['powerdns']['init_script'], 'restart').' &> /dev/null');
-	if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null');
-	//if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['squid']['init_script']))     system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
-	if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null');
-	if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '') system($inst->getinitcommand($conf['ufw']['init_script'], 'restart').' &> /dev/null');
-    if($conf['xmpp']['installed'] == true && $conf['xmpp']['init_script'] != '') system($inst->getinitcommand($conf['xmpp']['init_script'], 'restart').' &> /dev/null');
-
-} else { //* expert mode
-
-	//** Get Server ID
-	// $conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1');
-	// Server ID is an autoInc value of the mysql database now
-	if(strtolower($inst->simple_query('Shall this server join an existing ISPConfig multiserver setup', array('y', 'n'), 'n','join_multiserver_setup')) == 'y') {
-		$conf['mysql']['master_slave_setup'] = 'y';
-
-		//** Get MySQL root credentials
-		$finished = false;
-		do {
-			$tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname'); 
-			$tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port');
-			$tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user');	 
-			$tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password'); 
-			$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(@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;
-				$conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password;
-				$conf['mysql']['master_database'] = $tmp_mysql_server_database;
-				$finished = true;
-			} else {
-				swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error());
-			}
-		} while ($finished == false);
-		unset($finished);
-
-		// initialize the connection to the master database
-		$inst->dbmaster = new db();
-		if($inst->dbmaster->linkId) $inst->dbmaster->closeConn();
-		$inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_admin_user"], $conf['mysql']["master_admin_password"]);
-		$inst->dbmaster->setDBName($conf['mysql']["master_database"]);
-
-	} else {
-		// the master DB is the same then the slave DB
-		$inst->dbmaster = $inst->db;
-	}
-
-	//* Create the mysql database
-	$inst->configure_database();
-
-	//* Check for Web-Server
-	if($conf['apache']['installed'] != true && $conf['nginx']['installed'] != true) {
-		$conf['apache']['installed'] = $inst->force_configure_app('Apache');
-		$conf['nginx']['installed'] = $inst->force_configure_app('nginx');
-	}
-	//* Configure Webserver - Apache or nginx
-	if($conf['apache']['installed'] == true && $conf['nginx']['installed'] == true) {
-		$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache', 'nginx'), 'apache','http_server');
-		if($http_server_to_use == 'apache'){
-			$conf['nginx']['installed'] = false;
-			$conf['services']['file'] = true;
-		} else {
-			$conf['apache']['installed'] = false;
-		}
-	}
-
-	//* Insert the Server record into the database
-	swriteln('Adding ISPConfig server record to database.');
-	swriteln('');
-	$inst->add_database_server_record();
-
-	if(strtolower($inst->simple_query('Configure Mail', array('y', 'n') , 'y','configure_mail') ) == 'y') {
-
-		$conf['services']['mail'] = true;
-
-		//* Configure Postgrey
-		$force = @($conf['postgrey']['installed']) ? true : $inst->force_configure_app('Postgrey');
-		if($force) swriteln('Configuring Postgrey');
-
-		//* Configure Postfix
-		$force = @($conf['postfix']['installed']) ? true : $inst->force_configure_app('Postfix');
-		if($force) {
-			swriteln('Configuring Postfix');
-			$inst->configure_postfix();
-		}
-
-		//* Configure Mailman
-		$force = @($conf['mailman']['installed']) ? true : $inst->force_configure_app('Mailman');
-		if($force) {
-			swriteln('Configuring Mailman');
-			$inst->configure_mailman();
-		}
-
-		//* Check for Dovecot and Courier
-		if(!$conf['dovecot']['installed'] && !$conf['courier']['installed']) {
-			$conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot');
-			$conf['courier']['installed'] = $inst->force_configure_app('Courier');
-		}
-		//* Configure Mailserver - Dovecot or Courier
-		if($conf['dovecot']['installed'] && $conf['courier']['installed']) {
-			$mail_server_to_use = $inst->simple_query('Dovecot and Courier detected. Select server to use with ISPConfig:', array('dovecot', 'courier'), 'dovecot','mail_server');
-			if($mail_server_to_use == 'dovecot'){
-				$conf['courier']['installed'] = false;
-			} else {
-				$conf['dovecot']['installed'] = false;
-			}
-		}
-		//* Configure Dovecot
-		if($conf['dovecot']['installed']) {
-			swriteln('Configuring Dovecot');
-			$inst->configure_dovecot();
-		}
-		//* Configure Courier
-		if($conf['courier']['installed']) {
-			swriteln('Configuring Courier');
-			$inst->configure_courier();
-			swriteln('Configuring SASL');
-			$inst->configure_saslauthd();
-			swriteln('Configuring PAM');
-			$inst->configure_pam();
-		}
-
-		//* Configure Spamasassin
-		$force = @($conf['spamassassin']['installed']) ? true : $inst->force_configure_app('Spamassassin');
-		if($force) {
-			swriteln('Configuring Spamassassin');
-			$inst->configure_spamassassin();
-		}
-    
-		//* Configure Amavis
-		$force = @($conf['amavis']['installed']) ? true : $inst->force_configure_app('Amavisd');
-		if($force) {
-			swriteln('Configuring Amavisd');
-			$inst->configure_amavis();
-		}
-
-		//* Configure Getmail
-		$force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail');
-		if($force) {
-			swriteln('Configuring Getmail');
-			$inst->configure_getmail();
-		}
-
-		if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart'));
-		if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart'));
-		if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart'));
-		if($conf['clamav']['installed'] == true && $conf['clamav']['init_script'] != '') system($inst->getinitcommand($conf['clamav']['init_script'], 'restart'));
-		if($conf['courier']['installed'] == true){
-			if($conf['courier']['courier-authdaemon'] != '') system($inst->getinitcommand($conf['courier']['courier-authdaemon'], 'restart'));
-			if($conf['courier']['courier-imap'] != '') system($inst->getinitcommand($conf['courier']['courier-imap'], 'restart'));
-			if($conf['courier']['courier-imap-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-imap-ssl'], 'restart'));
-			if($conf['courier']['courier-pop'] != '') system($inst->getinitcommand($conf['courier']['courier-pop'], 'restart'));
-			if($conf['courier']['courier-pop-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-pop-ssl'], 'restart'));
-		}
-		if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart'));
-		if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &');
-	}
-
-	//* Configure Jailkit
-	$force = @($conf['jailkit']['installed']) ? true : $inst->force_configure_app('Jailkit');
-	if($force) {
-		swriteln('Configuring Jailkit');
-		$inst->configure_jailkit();
-	}
-
-	//* Configure Pureftpd
-	$force = @($conf['pureftpd']['installed']) ? true : $inst->force_configure_app('pureftpd');
-	if($force) {
-		swriteln('Configuring Pureftpd');
-		$inst->configure_pureftpd();
-	}
-	
-	//** Configure DNS
-	if(strtolower($inst->simple_query('Configure DNS Server', array('y', 'n'), 'y','configure_dns')) == 'y') {
-		$conf['services']['dns'] = true;
-
-		//* Check for DNS
-		if(!$conf['powerdns']['installed'] && !$conf['bind']['installed'] && !$conf['mydns']['installed']) {
-			$conf['powerdns']['installed'] = $inst->force_configure_app('PowerDNS');
-			$conf['bind']['installed'] = $inst->force_configure_app('BIND');
-			$conf['mydns']['installed'] = $inst->force_configure_app('MyDNS');
-		}
-		//* Configure PowerDNS
-		if($conf['powerdns']['installed']) {
-			swriteln('Configuring PowerDNS');
-			$inst->configure_powerdns();
-			$conf['services']['dns'] = true;
-		}
-		//* Configure Bind
-		if($conf['bind']['installed']) {
-			swriteln('Configuring BIND');
-			$inst->configure_bind();
-			$conf['services']['dns'] = true;
-			if(!is_installed('haveged')) {
-				swriteln("[INFO] haveged not detected - DNSSEC can fail");
-			}
-		}
-		//* Configure MyDNS
-		if($conf['mydns']['installed']) {
-			swriteln('Configuring MyDNS');
-			$inst->configure_mydns();
-			$conf['services']['dns'] = true;
-		}
-
-	}
-
-	if(strtolower($inst->simple_query('Configure Web Server', array('y', 'n'), 'y','configure_webserver')) == 'y') {
-		$conf['services']['web'] = true;
-
-		//* Configure Apache
-		if($conf['apache']['installed']){
-			swriteln('Configuring Apache');
-			$inst->configure_apache();
-			$conf['services']['file'] = true;
-			//* Configure Vlogger
-			$force = @($conf['vlogger']['installed']) ? true : $inst->force_configure_app('vlogger');
-			if($force) {
-				swriteln('Configuring vlogger');
-				$inst->configure_vlogger();
-			}
-			//* Configure squid
-/*
-			$force = @($conf['squid']['installed']) ? true : $inst->force_configure_app('squid');
-			if($force) {
-				swriteln('Configuring Squid');
-				$inst->configure_squid();
-				$conf['services']['proxy'] = true;
-				if($conf['squid']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['squid']['init_script']))system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
-			}
-*/
-		}
-		//* Configure nginx
-		if($conf['nginx']['installed']){
-			swriteln('Configuring nginx');
-			$inst->configure_nginx();
-		}
-	}
-
-	//* Configure OpenVZ
-	$force = @($conf['openvz']['installed']) ? true : $inst->force_configure_app('OpenVZ');
-	if($force) {
-		$conf['services']['vserver'] = true;
-		swriteln('Configuring OpenVZ');
-	}
-
-	if(strtolower($inst->simple_query('Configure Firewall Server', array('y', 'n'), 'y','configure_firewall')) == 'y') {
-		//* Check for Firewall
-		if(!$conf['ufw']['installed'] && !$conf['firewall']['installed']) {
-			$conf['ufw']['installed'] = $inst->force_configure_app('Ubuntu Firewall');
-			$conf['firewall']['installed'] = $inst->force_configure_app('Bastille Firewall');
-		}
-		//* Configure Firewall - Ubuntu or Bastille
-		if($conf['ufw']['installed'] && $conf['firewall']['installed']) {
-			$firewall_to_use = $inst->simple_query('Ubuntu and Bastille Firewall detected. Select firewall to use with ISPConfig:', array('bastille', 'ubuntu'), 'bastille','firewall_server');
-			if($firewall_to_use == 'bastille'){
-				$conf['ufw']['installed'] = false;
-			} else {
-				$conf['firewall']['installed'] = false;
-			}
-		}
-		//* Configure Ubuntu Firewall
-		if($conf['ufw']['installed']){
-			swriteln('Configuring Ubuntu Firewall');
-			$inst->configure_ufw_firewall();
-			$conf['services']['firewall'] = true;
-		}
-		//* Configure Bastille Firewall
-		if($conf['firewall']['installed']){
-			swriteln('Configuring Bastille Firewall');
-			$inst->configure_bastille_firewall();
-			$conf['services']['firewall'] = true;
-		}
-	}
-
-    //* Configure XMPP
-	$force = @($conf['xmpp']['installed']) ? true : $inst->force_configure_app('Metronome XMPP Server');
-	if($force) {
-        swriteln('Configuring Metronome XMPP Server');
-        $inst->configure_xmpp();
-	    $conf['services']['xmpp'] = true;
-	}
-
-	//** Configure ISPConfig :-)
-	$install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y';
-	if(strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') {
-		swriteln('Installing ISPConfig');
-
-		//** We want to check if the server is a module or cgi based php enabled server
-		//** TODO: Don't always ask for this somehow ?
-		/*
-		$fast_cgi = $inst->simple_query('CGI PHP Enabled Server?', array('yes','no'),'no');
-
-		if($fast_cgi == 'yes') {
-	 		$alias = $inst->free_query('Script Alias', '/php/');
-	 		$path = $inst->free_query('Script Alias Path', '/path/to/cgi/bin');
-	 		$conf['apache']['vhost_cgi_alias'] = sprintf('ScriptAlias %s %s', $alias, $path);
-		} else {
-	 		$conf['apache']['vhost_cgi_alias'] = "";
-		}
-		*/
-
-		//** Customise the port ISPConfig runs on
-		$ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080','ispconfig_port');
-		$conf['interface_password'] = $inst->free_query('Admin password', 'admin');
-		if($conf['interface_password'] != 'admin') {
-			$check = false;
-			do {
-				unset($temp_password);
-				$temp_password = $inst->free_query('Re-enter admin password', '');
-				$check = @($temp_password == $conf['interface_password'])?true:false;
-				if(!$check) swriteln('Passwords do not match.');
-			} while (!$check);
-		}
-		unset($check);
-		unset($temp_password);
-		if($conf['apache']['installed'] == true) $conf['apache']['vhost_port']  = $ispconfig_vhost_port;
-		if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port']  = $ispconfig_vhost_port;
-		unset($ispconfig_vhost_port);
-
-		if(strtolower($inst->simple_query('Enable SSL for the ISPConfig web interface', array('y', 'n'), 'y','ispconfig_use_ssl')) == 'y') {
-			$inst->make_ispconfig_ssl_cert();
-		}
-
-		$inst->install_ispconfig_interface = true;
-
-	} else {
-		$inst->install_ispconfig_interface = false;
-	}
-
-	$inst->install_ispconfig();
-
-	//* Configure DBServer
-	swriteln('Configuring DBServer');
-	$inst->configure_dbserver();
-
-	//* Configure ISPConfig
+//* Configure ISPConfig
+swriteln('Installing ISPConfig crontab');
+if($conf['cron']['installed']) {
 	swriteln('Installing ISPConfig crontab');
 	$inst->install_crontab();
-	if($conf['apache']['installed'] == true && $conf['apache']['init_script'] != '') system($inst->getinitcommand($conf['apache']['init_script'], 'restart'));
-	//* Reload is enough for nginx
-	if($conf['nginx']['installed'] == true){
-		if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload'));
-		if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload'));
-	}
-	
-	swriteln('Detect IP addresses');
-	$inst->detect_ips();
+} else swriteln('[ERROR] Cron not found');
 
+swriteln('Detect IP addresses');
+$inst->detect_ips();
 
+swriteln('Restarting services ...');
+if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart').' >/dev/null 2>&1');
+if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart'));
+if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart'));
+if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart'));
+if($conf['clamav']['installed'] == true && $conf['clamav']['init_script'] != '') system($inst->getinitcommand($conf['clamav']['init_script'], 'restart'));
+if($conf['courier']['installed'] == true){
+	if($conf['courier']['courier-authdaemon'] != '') system($inst->getinitcommand($conf['courier']['courier-authdaemon'], 'restart'));
+	if($conf['courier']['courier-imap'] != '') system($inst->getinitcommand($conf['courier']['courier-imap'], 'restart'));
+	if($conf['courier']['courier-imap-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-imap-ssl'], 'restart'));
+	if($conf['courier']['courier-pop'] != '') system($inst->getinitcommand($conf['courier']['courier-pop'], 'restart'));
+	if($conf['courier']['courier-pop-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-pop-ssl'], 'restart'));
+}
+if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart'));
+if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &');
+if($conf['apache']['installed'] == true && $conf['apache']['init_script'] != '') system($inst->getinitcommand($conf['apache']['init_script'], 'restart'));
+//* Reload is enough for nginx
+if($conf['nginx']['installed'] == true){
+	if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload'));
+	if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload'));
+}
+if($conf['pureftpd']['installed'] == true && $conf['pureftpd']['init_script'] != '') system($inst->getinitcommand($conf['pureftpd']['init_script'], 'restart'));
+if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '') system($inst->getinitcommand($conf['mydns']['init_script'], 'restart').' &> /dev/null');
+if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '') system($inst->getinitcommand($conf['powerdns']['init_script'], 'restart').' &> /dev/null');
+if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null');
+//if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['squid']['init_script']))     system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
+if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null');
+if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '') system($inst->getinitcommand($conf['ufw']['init_script'], 'restart').' &> /dev/null');
+if($conf['xmpp']['installed'] == true && $conf['xmpp']['init_script'] != '') system($inst->getinitcommand($conf['xmpp']['init_script'], 'restart').' &> /dev/null');
 
-} //* << $install_mode / 'Standard' or Genius
 
 $inst->create_mount_script();
 
diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index f670261..c19736a 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -296,7 +296,7 @@
 		} elseif(stristr($content, 'CentOS Linux release 7.2')) {
 			$distname = 'CentOS';
 			$distver = 'Unknown';
-			$distid = 'centos70';
+			$distid = 'centos72';
 			$distconfid = 'centos72';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: CentOS 7.2\n");
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 49b0e3d..c437ea3 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -171,14 +171,19 @@
 		if(is_installed('named') || is_installed('bind') || is_installed('bind9')) $conf['bind']['installed'] = true;
 		if(is_installed('squid')) $conf['squid']['installed'] = true;
 		if(is_installed('nginx')) $conf['nginx']['installed'] = true;
-		if(is_installed('iptables') && is_installed('ufw')) $conf['ufw']['installed'] = true;
-		if(is_installed('iptables') && is_installed('bastille-netfilter')) $conf['firewall']['installed'] = true;
+		if(is_installed('iptables') && is_installed('ufw')) {
+			$conf['ufw']['installed'] = true;
+		} elseif(is_installed('iptables')) {
+			$conf['firewall']['installed'] = true;
+		}
 		if(is_installed('fail2ban-server')) $conf['fail2ban']['installed'] = true;
 		if(is_installed('vzctl')) $conf['openvz']['installed'] = true;
 		if(is_installed('metronome') && is_installed('metronomectl')) $conf['xmpp']['installed'] = true;
 		if(is_installed('spamassassin')) $conf['spamassassin']['installed'] = true;
-		if(is_installed('vlogger')) $conf['vlogger']['installed'] = true;
-		if(is_installed('cron')) $conf['cron']['installed'] = true;
+		// if(is_installed('vlogger')) $conf['vlogger']['installed'] = true;
+		// ISPConfig ships with vlogger, so it is always installed.
+		$conf['vlogger']['installed'] = true;
+		if(is_installed('cron') || is_installed('anacron')) $conf['cron']['installed'] = true;
 
 		if ($conf['services']['web'] && (($conf['apache']['installed'] && is_file($conf['apache']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost")) || ($conf['nginx']['installed'] && is_file($conf['nginx']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost")))) $this->ispconfig_interface_installed = true;
 	}
@@ -1686,7 +1691,7 @@
 		if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
 
 		if(is_file('/etc/suphp/suphp.conf')) {
-			replaceLine('/etc/suphp/suphp.conf', 'php=php:/usr/bin', 'x-httpd-suphp="php:/usr/bin/php-cgi"', 0);
+			replaceLine('/etc/suphp/suphp.conf', 'php="php:/usr/bin', 'x-httpd-suphp="php:/usr/bin/php-cgi"', 0);
 			//replaceLine('/etc/suphp/suphp.conf','docroot=','docroot=/var/clients',0);
 			replaceLine('/etc/suphp/suphp.conf', 'umask=0077', 'umask=0022', 0);
 		}
diff --git a/install/sql/incremental/upd_dev_collection.sql b/install/sql/incremental/upd_dev_collection.sql
index e69de29..f0a3df8 100644
--- a/install/sql/incremental/upd_dev_collection.sql
+++ b/install/sql/incremental/upd_dev_collection.sql
@@ -0,0 +1,15 @@
+ALTER TABLE `client` CHANGE `web_servers` `web_servers` TEXT NULL DEFAULT NULL;
+ALTER TABLE `client` CHANGE `mail_servers` `mail_servers` TEXT NULL DEFAULT NULL;
+ALTER TABLE `client` CHANGE `xmpp_servers` `xmpp_servers` TEXT NULL DEFAULT NULL;
+ALTER TABLE `client` CHANGE `db_servers` `db_servers` TEXT NULL DEFAULT NULL;
+ALTER TABLE `client` CHANGE `dns_servers` `dns_servers` TEXT NULL DEFAULT NULL;
+UPDATE client SET web_servers = default_webserver WHERE (web_servers = '' OR web_servers IS NULL);
+UPDATE client SET mail_servers = default_mailserver WHERE (mail_servers = '' OR mail_servers IS NULL);
+UPDATE client SET xmpp_servers = default_xmppserver WHERE (xmpp_servers = '' OR xmpp_servers IS NULL);
+UPDATE client SET db_servers = default_dbserver WHERE (db_servers = '' OR db_servers IS NULL);
+UPDATE client SET dns_servers = default_dnsserver WHERE (dns_servers = '' OR dns_servers IS NULL);
+ALTER TABLE `client_template` ADD `default_slave_dnsserver` INT NOT NULL DEFAULT '0' AFTER `limit_dns_slave_zone`;
+ALTER TABLE `client_template` ADD `mail_servers` TEXT NULL DEFAULT NULL AFTER `template_type`;
+ALTER TABLE `client_template` ADD `web_servers` TEXT NULL DEFAULT NULL AFTER `limit_xmpp_httparchive`;
+ALTER TABLE `client_template` ADD `dns_servers` TEXT NULL DEFAULT NULL AFTER `limit_aps`;
+ALTER TABLE `client_template` ADD `db_servers` TEXT NULL DEFAULT NULL AFTER `limit_dns_record`;
\ No newline at end of file
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index a14a0d6..eaf060a 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -170,7 +170,7 @@
   `bank_account_swift` varchar(255) DEFAULT NULL,
   `paypal_email` varchar(255) DEFAULT NULL,
   `default_mailserver` int(11) unsigned NOT NULL DEFAULT '1',
-  `mail_servers` blob,
+  `mail_servers` text,
   `limit_maildomain` int(11) NOT NULL DEFAULT '-1',
   `limit_mailbox` int(11) NOT NULL DEFAULT '-1',
   `limit_mailalias` int(11) NOT NULL DEFAULT '-1',
@@ -185,7 +185,7 @@
   `limit_spamfilter_user` int(11) NOT NULL DEFAULT '0',
   `limit_spamfilter_policy` int(11) NOT NULL DEFAULT '0',
   `default_xmppserver` int(11) unsigned NOT NULL DEFAULT '1',
-  `xmpp_servers` blob,
+  `xmpp_servers` text,
   `limit_xmpp_domain` int(11) NOT NULL DEFAULT '-1',
   `limit_xmpp_user` int(11) NOT NULL DEFAULT '-1',
   `limit_xmpp_muc` ENUM( 'n', 'y' ) NOT NULL default 'n',
@@ -197,7 +197,7 @@
   `limit_xmpp_pastebin` ENUM( 'n', 'y' ) NOT NULL default 'n',
   `limit_xmpp_httparchive` ENUM( 'n', 'y' ) NOT NULL default 'n',
   `default_webserver` int(11) unsigned NOT NULL DEFAULT '1',
-  `web_servers` blob,
+  `web_servers` text,
   `limit_web_ip` text,
   `limit_web_domain` int(11) NOT NULL DEFAULT '-1',
   `limit_web_quota` int(11) NOT NULL DEFAULT '-1',
@@ -222,13 +222,13 @@
   `limit_directive_snippets` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'n',
   `limit_aps` int(11) NOT NULL DEFAULT '-1',
   `default_dnsserver` int(11) unsigned NOT NULL DEFAULT '1',
-  `db_servers` blob,
+  `db_servers` text,
   `limit_dns_zone` int(11) NOT NULL DEFAULT '-1',
   `default_slave_dnsserver` int(11) unsigned NOT NULL DEFAULT '1',
   `limit_dns_slave_zone` int(11) NOT NULL DEFAULT '-1',
   `limit_dns_record` int(11) NOT NULL DEFAULT '-1',
   `default_dbserver` int(11) NOT NULL DEFAULT '1',
-  `dns_servers` blob,
+  `dns_servers` text,
   `limit_database` int(11) NOT NULL DEFAULT '-1',
   `limit_database_user` int(11) NOT NULL DEFAULT '-1',
   `limit_database_quota` int(11) NOT NULL default '-1',
@@ -301,6 +301,7 @@
   `sys_perm_other` varchar(5) default NULL,
   `template_name` varchar(64) NOT NULL DEFAULT '',
   `template_type` varchar(1) NOT NULL default 'm',
+  `mail_servers` text,
   `limit_maildomain` int(11) NOT NULL default '-1',
   `limit_mailbox` int(11) NOT NULL default '-1',
   `limit_mailalias` int(11) NOT NULL default '-1',
@@ -315,7 +316,7 @@
   `limit_spamfilter_user` int(11) NOT NULL default '0',
   `limit_spamfilter_policy` int(11) NOT NULL default '0',
   `default_xmppserver` int(11) unsigned NOT NULL DEFAULT '1',
-  `xmpp_servers` blob,
+  `xmpp_servers` text,
   `limit_xmpp_domain` int(11) NOT NULL DEFAULT '-1',
   `limit_xmpp_user` int(11) NOT NULL DEFAULT '-1',
   `limit_xmpp_muc` ENUM( 'n', 'y' ) NOT NULL default 'n',
@@ -325,6 +326,7 @@
   `limit_xmpp_status` ENUM( 'n', 'y' ) NOT NULL default 'n',
   `limit_xmpp_pastebin` ENUM( 'n', 'y' ) NOT NULL default 'n',
   `limit_xmpp_httparchive` ENUM( 'n', 'y' ) NOT NULL default 'n',
+  `web_servers` text,
   `limit_web_ip` text,
   `limit_web_domain` int(11) NOT NULL default '-1',
   `limit_web_quota` int(11) NOT NULL default '-1',
@@ -348,9 +350,12 @@
   `limit_backup` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'y',
   `limit_directive_snippets` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'n',
   `limit_aps` int(11) NOT NULL DEFAULT '-1',
+  `dns_servers` text,
   `limit_dns_zone` int(11) NOT NULL default '-1',
+  `default_slave_dnsserver` int(11) NOT NULL DEFAULT '0',
   `limit_dns_slave_zone` int(11) NOT NULL default '-1',
   `limit_dns_record` int(11) NOT NULL default '-1',
+  `db_servers` text,
   `limit_database` int(11) NOT NULL default '-1',
   `limit_database_user` int(11) NOT NULL DEFAULT '-1',
   `limit_database_quota` int(11) NOT NULL default '-1',
@@ -2477,7 +2482,7 @@
 -- Dumping data for table `sys_config`
 --
 
-INSERT INTO sys_config VALUES ('db','db_version','3.1b1');
+INSERT INTO sys_config VALUES ('db','db_version','3.1dev');
 INSERT INTO sys_config VALUES ('interface','session_timeout','0');
 
 SET FOREIGN_KEY_CHECKS = 1;
diff --git a/install/tpl/config.inc.php.master b/install/tpl/config.inc.php.master
index 2ba18f3..02a7b2f 100644
--- a/install/tpl/config.inc.php.master
+++ b/install/tpl/config.inc.php.master
@@ -56,7 +56,7 @@
 
 //** Application
 define('ISPC_APP_TITLE', 'ISPConfig');
-define('ISPC_APP_VERSION', '3.1b1');
+define('ISPC_APP_VERSION', '3.1dev');
 define('DEVSYSTEM', 0);
 
 
diff --git a/install/tpl/helo_access.master b/install/tpl/helo_access.master
index 796c3ed..41f182e 100644
--- a/install/tpl/helo_access.master
+++ b/install/tpl/helo_access.master
@@ -2,7 +2,7 @@
 # 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
+#/^{myhostname}$/  REJECT
 #/^((smtp|mx|mail)\.domain1\.com$/	REJECT
 #/^mail\.domain2\.com$/		REJECT
 
diff --git a/install/tpl/pureftpd_mysql.conf.master b/install/tpl/pureftpd_mysql.conf.master
index 32d2159..484f105 100644
--- a/install/tpl/pureftpd_mysql.conf.master
+++ b/install/tpl/pureftpd_mysql.conf.master
@@ -59,12 +59,12 @@
 
 # Query to execute in order to fetch the password
 
-MYSQLGetPW      SELECT password FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L" AND (expires IS NULL OR expires > NOW())
+MYSQLGetPW      SELECT password FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
 
 
 # Query to execute in order to fetch the system user name or uid
 
-MYSQLGetUID     SELECT uid FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L" AND (expires IS NULL OR expires > NOW())
+MYSQLGetUID     SELECT uid FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
 
 
 # Optional : default UID - if set this overrides MYSQLGetUID
@@ -74,7 +74,7 @@
 
 # Query to execute in order to fetch the system user group or gid
 
-MYSQLGetGID     SELECT gid FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L" AND (expires IS NULL OR expires > NOW())
+MYSQLGetGID     SELECT gid FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
 
 
 # Optional : default GID - if set this overrides MYSQLGetGID
@@ -84,34 +84,34 @@
 
 # Query to execute in order to fetch the home directory
 
-MYSQLGetDir     SELECT dir FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L" AND (expires IS NULL OR expires > NOW())
+MYSQLGetDir     SELECT dir FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
 
 
 # Optional : query to get the maximal number of files 
 # Pure-FTPd must have been compiled with virtual quotas support.
 
-MySQLGetQTAFS  SELECT quota_files FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_files != '-1' AND username="\L" AND (expires IS NULL OR expires > NOW())
+MySQLGetQTAFS  SELECT quota_files FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_files != '-1' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
 
 
 # Optional : query to get the maximal disk usage (virtual quotas)
 # The number should be in Megabytes.
 # Pure-FTPd must have been compiled with virtual quotas support.
 
-MySQLGetQTASZ  SELECT quota_size FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_size != '-1' AND username="\L" AND (expires IS NULL OR expires > NOW())
+MySQLGetQTASZ  SELECT quota_size FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_size != '-1' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
 
 
 # Optional : ratios. The server has to be compiled with ratio support.
 
-MySQLGetRatioUL SELECT ul_ratio FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND ul_ratio != '-1' AND username="\L" AND (expires IS NULL OR expires > NOW())
-MySQLGetRatioDL SELECT dl_ratio FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND dl_ratio != '-1' AND username="\L" AND (expires IS NULL OR expires > NOW())
+MySQLGetRatioUL SELECT ul_ratio FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND ul_ratio != '-1' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
+MySQLGetRatioDL SELECT dl_ratio FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND dl_ratio != '-1' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
 
 
 # Optional : bandwidth throttling.
 # The server has to be compiled with throttling support.
 # Values are in KB/s .
 
-MySQLGetBandwidthUL SELECT ul_bandwidth FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND ul_bandwidth != '-1' AND username="\L" AND (expires IS NULL OR expires > NOW())
-MySQLGetBandwidthDL SELECT dl_bandwidth FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND dl_bandwidth != '-1' AND username="\L" AND (expires IS NULL OR expires > NOW())
+MySQLGetBandwidthUL SELECT ul_bandwidth FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND ul_bandwidth != '-1' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
+MySQLGetBandwidthDL SELECT dl_bandwidth FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND dl_bandwidth != '-1' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
 
 # Enable ~ expansion. NEVER ENABLE THIS BLINDLY UNLESS :
 # 1) You know what you are doing.
diff --git a/interface/lib/classes/quota_lib.inc.php b/interface/lib/classes/quota_lib.inc.php
index 0455dc9..b6d2240 100644
--- a/interface/lib/classes/quota_lib.inc.php
+++ b/interface/lib/classes/quota_lib.inc.php
@@ -312,13 +312,13 @@
 	
 				$databases[$i]['quota_raw'] = $databases[$i]['database_quota'];
 				$databases[$i]['used_raw'] = $databases[$i]['used'] / 1024 / 1024; //* quota is stored as MB - calculated bytes
-				$databases[$i]['used_percentage'] = (($databases[$i]['database_quota'] > 0) && ($databases[$i]['used'] > 0)) ? round($databases[$i]['used'] * 100 / $databases[$i]['database_quota']) : 0;
+				$databases[$i]['used_percentage'] = (($databases[$i]['database_quota'] > 0) && ($databases[$i]['used'] > 0)) ? round($databases[$i]['used_raw'] * 100 / $databases[$i]['database_quota']) : 0;
 	
 				if ($readable) {
 					// colours
 					$databases[$i]['display_colour'] = '#000000';
 					if($databases[$i]['database_quota'] > 0){
-						$used_ratio = $databases[$i]['used']/$databases[$i]['database_quota'];
+						$used_ratio = $databases[$i]['used'] / $databases[$i]['database_quota'];
 					} else {
 						$used_ratio = 0;
 					}
diff --git a/interface/lib/classes/session.inc.php b/interface/lib/classes/session.inc.php
index bef2a10..f4a90be 100644
--- a/interface/lib/classes/session.inc.php
+++ b/interface/lib/classes/session.inc.php
@@ -93,8 +93,8 @@
 
 
 		if (@$this->session_array['session_id'] == '') {
-			$sql = "REPLACE INTO sys_session (session_id,date_created,last_updated,session_data,permanent) VALUES (?,NOW(),NOW(),'$session_data',?)";
-			$this->db->query($sql, $session_id, ($this->permanent ? 'y' : 'n'));
+			$sql = "REPLACE INTO sys_session (session_id,date_created,last_updated,session_data,permanent) VALUES (?,NOW(),NOW(),?,?)";
+			$this->db->query($sql, $session_id, $session_data, ($this->permanent ? 'y' : 'n'));
 
 		} else {
 			$sql = "UPDATE sys_session SET last_updated = NOW(), session_data = ?" . ($this->permanent ? ", `permanent` = 'y'" : "") . " WHERE session_id = ?";
diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 1376d7d..503bd24 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -235,6 +235,24 @@
 		return $diffrec;
 
 	}
+	
+	/**
+	 * Generate HTML for DATE fields.
+	 *
+	 * @access private
+	 * @param string $form_element Name of the form element.
+	 * @param string $default_value Selected value for fields.
+	 * @return string HTML
+	 */
+	function _getDateHTML($form_element, $default_value)
+	{
+		$_date = ($default_value && $default_value != '0000-00-00' ? strtotime($default_value) : false);
+		$_showdate = ($_date === false) ? false : true;
+		
+		$tmp_dt = strtr($this->dateformat,array('d' => 'dd', 'm' => 'mm', 'Y' => 'yyyy', 'y' => 'yy'));
+		
+		return '<input type="text" class="form-control" name="' . $form_element . '" value="' . ($_showdate ? date($this->dateformat, $_date) : '') . '"  data-input-element="date" data-date-format="' . $tmp_dt . '" />'; 
+	}
 
 
 	/**
diff --git a/interface/lib/classes/tform_base.inc.php b/interface/lib/classes/tform_base.inc.php
index 5adbdf7..0c9cda5 100644
--- a/interface/lib/classes/tform_base.inc.php
+++ b/interface/lib/classes/tform_base.inc.php
@@ -562,6 +562,18 @@
 						$new_record[$key] = $this->_getDateTimeHTML($key, $dt_value, $display_seconds);
 						break;
 
+					case 'DATE':
+						if (strtotime($val) !== false) {
+							$dt_value = $val;
+						} elseif ( isset($field['default']) && (strtotime($field['default']) !== false) ) {
+							$dt_value = $field['default'];
+						} else {
+							$dt_value = 0;
+						}
+
+						$new_record[$key] = $this->_getDateHTML($key, $dt_value);
+						break;
+					
 					default:
 						if(isset($record[$key])) {
 							$new_record[$key] = htmlspecialchars($record[$key]);
@@ -672,6 +684,12 @@
 
 					$new_record[$key] = $this->_getDateTimeHTML($key, $dt_value, $display_seconds);
 					break;
+				
+				case 'DATE':
+					$dt_value = (isset($field['default'])) ? $field['default'] : 0;
+
+					$new_record[$key] = $this->_getDateHTML($key, $dt_value);
+					break;
 
 				default:
 					$new_record[$key] = htmlspecialchars($field['default']);
diff --git a/interface/web/admin/lib/lang/de_server_config.lng b/interface/web/admin/lib/lang/de_server_config.lng
index c9fc989..06384d5 100644
--- a/interface/web/admin/lib/lang/de_server_config.lng
+++ b/interface/web/admin/lib/lang/de_server_config.lng
@@ -26,7 +26,7 @@
 $wb['mailuser_name_txt'] = 'Mailbenutzer Name';
 $wb['mailuser_group_txt'] = 'Mailbenutzer Gruppe';
 $wb['mailbox_virtual_uidgid_maps_txt'] = 'Website Linux Uid für Mailboxen';
-$wb['mailbox_virtual_uidgid_maps_info_txt'] = 'nur wenn beides auf gleichem Server';
+$wb['mailbox_virtual_uidgid_maps_info_txt'] = 'nur für einzel-Server Installationen.';
 $wb['mailbox_virtual_uidgid_maps_error_nosingleserver'] = 'Uid kann in Multiserver-Umgebung nicht gemappt werden.';
 $wb['mailbox_virtual_uidgid_maps_error_nodovecot'] = 'Uid Mapping funktioniert nur in Verbindung mit dovecot.';
 $wb['mailbox_virtual_uidgid_maps_error_alreadyusers'] = 'Uid Mapping kann nur umgeschaltet werden, wenn noch keine Mailuser angelegt sind.';
diff --git a/interface/web/admin/list/server_ip_map.list.php b/interface/web/admin/list/server_ip_map.list.php
index 95ac17c..c17aecb 100644
--- a/interface/web/admin/list/server_ip_map.list.php
+++ b/interface/web/admin/list/server_ip_map.list.php
@@ -18,7 +18,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 $liste['item'][] = array( 'field'  => 'server_id',
 	'datatype' => 'INTEGER',
diff --git a/interface/web/admin/templates/directive_snippets_edit.htm b/interface/web/admin/templates/directive_snippets_edit.htm
index b5adc58..eab53c7 100644
--- a/interface/web/admin/templates/directive_snippets_edit.htm
+++ b/interface/web/admin/templates/directive_snippets_edit.htm
@@ -17,8 +17,8 @@
             </div>
 			<div class="form-group">
                 <label for="snippet" class="col-sm-3 control-label">{tmpl_var name='snippet_txt'}</label>
-                <tmpl_if name='is_master'><div class="col-sm-9 col-text"><pre>{tmpl_var name='snippet'}</pre></div></tmpl_else><div class="col-sm-9"><textarea class="form-control" name="snippet" id="snippet" rows='10' cols='50'>{tmpl_var name='snippet'}</textarea></div>
-                <div class="col-sm-3 col-text nginx"></div><div class="col-sm-9 col-text nginx"> &nbsp;{tmpl_var name='variables_txt'}: <a href="javascript:void(0);" class="addPlaceholder">{DOCROOT}</a>, <a href="javascript:void(0);" class="addPlaceholder">{FASTCGIPASS}</a>, <a href="javascript:void(0);" class="addPlaceholder">{PHPFALLBACKFASTCGIPASS}</a></div></tmpl_if>
+                <tmpl_if name='is_master'><div class="col-sm-9 col-text"><pre>{tmpl_var name='snippet'}</pre></div></tmpl_else><div class="col-sm-9"><textarea class="form-control" name="snippet" id="snippet" rows='10' cols='50'>{tmpl_var name='snippet'}</textarea>
+                &nbsp; Nginx {tmpl_var name='variables_txt'}: <a href="javascript:void(0);" class="addPlaceholder">{DOCROOT}</a>, <a href="javascript:void(0);" class="addPlaceholder">{FASTCGIPASS}</a>, <a href="javascript:void(0);" class="addPlaceholder">{PHPFALLBACKFASTCGIPASS}</a></div></tmpl_if>
             </div>
             <tmpl_if name='is_master'></tmpl_else>
 			<div class="form-group php">
diff --git a/interface/web/client/form/client_template.tform.php b/interface/web/client/form/client_template.tform.php
index a16d21f..0fccee9 100644
--- a/interface/web/client/form/client_template.tform.php
+++ b/interface/web/client/form/client_template.tform.php
@@ -114,7 +114,7 @@
 			'maxlength' => '10',
 			'rows'  => '',
 			'cols'  => ''
-		),
+		),/*
 		'default_mailserver' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'SELECT',
@@ -125,7 +125,7 @@
 			),
 			'value'  => array(''),
 			'name'  => 'default_mailserver'
-		),
+		),*/
 		'limit_maildomain' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
@@ -321,7 +321,7 @@
 			'maxlength' => '10',
 			'rows'  => '',
 			'cols'  => ''
-		),
+		),/*
         'default_xmppserver' => array (
             'datatype' => 'INTEGER',
             'formtype' => 'SELECT',
@@ -332,7 +332,7 @@
             ),
             'value'  => '',
             'name'  => 'default_xmppserver'
-        ),
+        ),*/
         'xmpp_servers' => array (
             'datatype' => 'VARCHAR',
             'formtype' => 'MULTIPLE',
@@ -420,7 +420,7 @@
             'formtype' => 'CHECKBOX',
             'default' => 'n',
             'value'  => array(0 => 'n', 1 => 'y')
-        ),
+        ),/*
 		'default_webserver' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'SELECT',
@@ -431,7 +431,7 @@
 			),
 			'value'  => array(''),
 			'name'  => 'default_webserver'
-		),
+		),*/
 		'limit_web_domain' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
@@ -623,7 +623,7 @@
 			'formtype' => 'CHECKBOX',
 			'default' => 'n',
 			'value'  => array(0 => 'n', 1 => 'y')
-		),
+		),/*
 		'default_dnsserver' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'SELECT',
@@ -634,7 +634,7 @@
 			),
 			'value'  => array(''),
 			'name'  => 'default_dnsserver'
-		),
+		),*/
 		'limit_dns_zone' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
@@ -704,6 +704,7 @@
 			'cols'		=> ''
 		),
 		*/
+		/*
 		'default_dbserver' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'SELECT',
@@ -714,7 +715,7 @@
 			),
 			'value'  => array(''),
 			'name'  => 'default_dbserver'
-		),
+		),*/
 		'limit_database' => array (
 			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
diff --git a/interface/web/client/templates/client_del.htm b/interface/web/client/templates/client_del.htm
index 2ae0a8e..e24ca76 100644
--- a/interface/web/client/templates/client_del.htm
+++ b/interface/web/client/templates/client_del.htm
@@ -3,8 +3,6 @@
 </div>
 <p><tmpl_var name="list_desc_txt"></p>
 
-
-		
         <div id="OKMsg">
 			<tmpl_if name='number_records'>
             <tmpl_var name="delete_explanation">:<br /><br />
@@ -12,15 +10,15 @@
                     <tmpl_var name="table">, 
                 </tmpl_loop>
 			</tmpl_else>
-				<tmpl_var name="confirm_client_delete_txt">
+				<h3><tmpl_var name="confirm_client_delete_txt"></h3>
 			</tmpl_if>
         </div>
-		
-        <div class="col-sm-9"><input class="form-control" type="checkbox" name="confirm" value="yes" /></div><b><tmpl_var name="confirm_action_txt"></b>
-
+		&nbsp;
+		<div> <input type="checkbox" name="confirm" value="yes" /> <b><tmpl_var name="confirm_action_txt"></b></div>
+		&nbsp;
         <input type="hidden" name="id" value="{tmpl_var name='id'}">
 
-        <div class="clear"><div class="right">
+        <div class="clear"><div class="left">
             <button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="client/client_del.php">{tmpl_var name='btn_save_txt'}</button>
             <button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="client/client_list.php">{tmpl_var name='btn_cancel_txt'}</button>
         </div></div>
\ No newline at end of file
diff --git a/interface/web/dns/dns_import.php b/interface/web/dns/dns_import.php
index bd8cc84..6bb738e 100644
--- a/interface/web/dns/dns_import.php
+++ b/interface/web/dns/dns_import.php
@@ -38,11 +38,23 @@
 $error = '';
 
 // Loading the template
-$app->uses('tpl,validate_dns');
+$app->uses('tform,tpl,validate_dns');
 $app->tpl->newTemplate("form.tpl.htm");
 $app->tpl->setInclude('content_tpl', 'templates/dns_import.htm');
 $app->load_language_file('/web/dns/lib/lang/'.$_SESSION['s']['language'].'_dns_wizard.lng');
 
+// Check if dns record limit has been reached. We will check only users, not admins
+if($_SESSION["s"]["user"]["typ"] == 'user') {
+	$app->tform->formDef['db_table_idx'] = 'id';
+	$app->tform->formDef['db_table'] = 'dns_soa';
+	if(!$app->tform->checkClientLimit('limit_dns_zone')) {
+		$app->error($app->lng('limit_dns_zone_txt'));
+	}
+	if(!$app->tform->checkResellerLimit('limit_dns_zone')) {
+		$app->error('Reseller: '.$app->lng('limit_dns_zone_txt'));
+	}
+}
+
 // import variables
 $template_id = (isset($_POST['template_id']))?$app->functions->intval($_POST['template_id']):0;
 $sys_groupid = (isset($_POST['client_group_id']))?$app->functions->intval($_POST['client_group_id']):0;
diff --git a/interface/web/dns/dns_wizard.php b/interface/web/dns/dns_wizard.php
index 3cfc397..a0fd131 100644
--- a/interface/web/dns/dns_wizard.php
+++ b/interface/web/dns/dns_wizard.php
@@ -36,11 +36,23 @@
 
 
 // Loading the template
-$app->uses('tpl,validate_dns');
+$app->uses('tpl,validate_dns,tform');
 $app->tpl->newTemplate("form.tpl.htm");
 $app->tpl->setInclude('content_tpl', 'templates/dns_wizard.htm');
 $app->load_language_file('/web/dns/lib/lang/'.$_SESSION['s']['language'].'_dns_wizard.lng');
 
+// Check if dns record limit has been reached. We will check only users, not admins
+if($_SESSION["s"]["user"]["typ"] == 'user') {
+	$app->tform->formDef['db_table_idx'] = 'id';
+	$app->tform->formDef['db_table'] = 'dns_soa';
+	if(!$app->tform->checkClientLimit('limit_dns_zone')) {
+		$app->error($app->lng('limit_dns_zone_txt'));
+	}
+	if(!$app->tform->checkResellerLimit('limit_dns_zone')) {
+		$app->error('Reseller: '.$app->lng('limit_dns_zone_txt'));
+	}
+}
+
 // import variables
 $template_id = (isset($_POST['template_id']))?$app->functions->intval($_POST['template_id']):0;
 $sys_groupid = (isset($_POST['client_group_id']))?$app->functions->intval($_POST['client_group_id']):0;
diff --git a/interface/web/dns/lib/lang/de_dns_wizard.lng b/interface/web/dns/lib/lang/de_dns_wizard.lng
index 7f664ca..e34604a 100644
--- a/interface/web/dns/lib/lang/de_dns_wizard.lng
+++ b/interface/web/dns/lib/lang/de_dns_wizard.lng
@@ -40,5 +40,6 @@
 $wb['globalsearch_searchfield_watermark_txt'] = 'Suche';
 $wb['globalsearch_suggestions_text_txt'] = 'Vorschläge';
 $wb['error_no_server_id'] = 'No server provided.';
-$wb['error_not_allowed_server_id'] = 'The selected server is not allowed for this account.';
+$wb['error_not_allowed_server_id'] = 'Der ausgewählte Server ist in diesem Konto nicht verfügbar.';
+$wb['limit_dns_zone_txt'] = 'Die maximale Anzahl an DNS Einträgen für Ihr Konto wurde erreicht.';
 ?>
diff --git a/interface/web/dns/lib/lang/en_dns_wizard.lng b/interface/web/dns/lib/lang/en_dns_wizard.lng
index a2cec08..6a63e21 100644
--- a/interface/web/dns/lib/lang/en_dns_wizard.lng
+++ b/interface/web/dns/lib/lang/en_dns_wizard.lng
@@ -41,4 +41,5 @@
 $wb['globalsearch_suggestions_text_txt'] = "Suggestions";
 $wb['error_no_server_id'] = 'No server provided.';
 $wb['error_not_allowed_server_id'] = 'The selected server is not allowed for this account.';
+$wb["limit_dns_zone_txt"] = 'The max. number of DNS zones for your account is reached.';
 ?>
diff --git a/interface/web/login/index.php b/interface/web/login/index.php
index a1da652..2ecf4ac 100644
--- a/interface/web/login/index.php
+++ b/interface/web/login/index.php
@@ -217,6 +217,7 @@
 						$_SESSION['s']['user']['theme'] = isset($user['app_theme']) ? $user['app_theme'] : 'default';
 						$_SESSION['s']['language'] = $user['language'];
 						$_SESSION["s"]['theme'] = $_SESSION['s']['user']['theme'];
+						if ($loginAs) $_SESSION['s']['plugin_cache'] = $_SESSION['s_old']['plugin_cache'];
 						
 						if(is_file(ISPC_WEB_PATH . '/' . $_SESSION['s']['user']['startmodule'].'/lib/module.conf.php')) {
 							include_once ISPC_WEB_PATH . '/' . $_SESSION['s']['user']['startmodule'].'/lib/module.conf.php';
diff --git a/interface/web/login/login_as.php b/interface/web/login/login_as.php
index a17d5ba..4b78c6c 100644
--- a/interface/web/login/login_as.php
+++ b/interface/web/login/login_as.php
@@ -98,8 +98,8 @@
 	<input type="hidden" name="s_pg" value="dashboard" />
 	<input type="hidden" name="login_as" value="1" />
     <div class="wf_actions buttons">
-      <button class="positive iconstxt icoPositive" type="button" value="'.$wb['btn_yes_txt'].'" data-submit-form="pageForm" data-form-action="/login/index.php"><span>'.$wb['btn_yes_txt'].'</span></button>
-      <button class="negative iconstxt icoNegative" type="button" value="'.$wb['btn_back_txt'].'" data-load-content="'.$backlink.'"><span>'.$wb['btn_back_txt'].'</span></button>
+      <button class="btn btn-default formbutton-success" type="button" value="'.$wb['btn_yes_txt'].'" data-submit-form="pageForm" data-form-action="/login/index.php"><span>'.$wb['btn_yes_txt'].'</span></button>
+      <button class="btn btn-default formbutton-default" value="'.$wb['btn_back_txt'].'" data-load-content="'.$backlink.'"><span>'.$wb['btn_back_txt'].'</span></button>
     </div>
 ';
 ?>
diff --git a/interface/web/login/logout.php b/interface/web/login/logout.php
index ee6fffa..a4a127f 100644
--- a/interface/web/login/logout.php
+++ b/interface/web/login/logout.php
@@ -56,8 +56,8 @@
 		<input type="hidden" name="s_pg" value="index" />
 		<input type="hidden" name="login_as" value="1" />
 	    <div class="wf_actions buttons">
-	      <button class="positive iconstxt icoPositive" type="button" value="Yes, re-login as ' . $utype . '" data-submit-form="pageForm" data-form-action="/login/index.php"><span>Yes, re-login as ' . $utype . '</span></button>
-	      <button class="negative iconstxt icoNegative" type="button" value="No, logout" data-load-content="login/logout.php?l=1"><span>No, logout</span></button>
+	      <button class="btn btn-default formbutton-success" type="button" value="Yes, re-login as ' . $utype . '" data-submit-form="pageForm" data-form-action="/login/index.php"><span>Yes, re-login as ' . $utype . '</span></button>
+	      <button class="btn btn-default formbutton-default" type="button" value="No, logout" data-load-content="login/logout.php?l=1"><span>No, logout</span></button>
 	    </div>
 	';
 	exit;
diff --git a/interface/web/mail/list/mail_alias.list.php b/interface/web/mail/list/mail_alias.list.php
index fcbfb94..044fc84 100644
--- a/interface/web/mail/list/mail_alias.list.php
+++ b/interface/web/mail/list/mail_alias.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "source",
diff --git a/interface/web/mail/list/mail_aliasdomain.list.php b/interface/web/mail/list/mail_aliasdomain.list.php
index 8408e9e..b97d265 100644
--- a/interface/web/mail/list/mail_aliasdomain.list.php
+++ b/interface/web/mail/list/mail_aliasdomain.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "source",
diff --git a/interface/web/mail/list/mail_blacklist.list.php b/interface/web/mail/list/mail_blacklist.list.php
index 3e92cae..45a3a99 100644
--- a/interface/web/mail/list/mail_blacklist.list.php
+++ b/interface/web/mail/list/mail_blacklist.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 
diff --git a/interface/web/mail/list/mail_content_filter.list.php b/interface/web/mail/list/mail_content_filter.list.php
index 18b0cf2..c585a16 100644
--- a/interface/web/mail/list/mail_content_filter.list.php
+++ b/interface/web/mail/list/mail_content_filter.list.php
@@ -55,7 +55,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 
diff --git a/interface/web/mail/list/mail_domain.list.php b/interface/web/mail/list/mail_domain.list.php
index c2005ae..7946f4c 100644
--- a/interface/web/mail/list/mail_domain.list.php
+++ b/interface/web/mail/list/mail_domain.list.php
@@ -59,7 +59,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 if($_SESSION['s']['user']['typ'] == 'admin') {
diff --git a/interface/web/mail/list/mail_domain_catchall.list.php b/interface/web/mail/list/mail_domain_catchall.list.php
index 4413c49..e2aa2d6 100644
--- a/interface/web/mail/list/mail_domain_catchall.list.php
+++ b/interface/web/mail/list/mail_domain_catchall.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "source",
diff --git a/interface/web/mail/list/mail_forward.list.php b/interface/web/mail/list/mail_forward.list.php
index 831e8b4..bd334d7 100644
--- a/interface/web/mail/list/mail_forward.list.php
+++ b/interface/web/mail/list/mail_forward.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "source",
diff --git a/interface/web/mail/list/mail_get.list.php b/interface/web/mail/list/mail_get.list.php
index d027110..3163f4e 100644
--- a/interface/web/mail/list/mail_get.list.php
+++ b/interface/web/mail/list/mail_get.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/mail/list/mail_relay_recipient.list.php b/interface/web/mail/list/mail_relay_recipient.list.php
index 8b7e308..3e3fd91 100644
--- a/interface/web/mail/list/mail_relay_recipient.list.php
+++ b/interface/web/mail/list/mail_relay_recipient.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/mail/list/mail_spamfilter.list.php b/interface/web/mail/list/mail_spamfilter.list.php
index 0db3e7c..f1f4e61 100644
--- a/interface/web/mail/list/mail_spamfilter.list.php
+++ b/interface/web/mail/list/mail_spamfilter.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/mail/list/mail_transport.list.php b/interface/web/mail/list/mail_transport.list.php
index 6cbc2df..9124b93 100644
--- a/interface/web/mail/list/mail_transport.list.php
+++ b/interface/web/mail/list/mail_transport.list.php
@@ -55,7 +55,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/mail/list/mail_user.list.php b/interface/web/mail/list/mail_user.list.php
index fd15658..1c56140 100644
--- a/interface/web/mail/list/mail_user.list.php
+++ b/interface/web/mail/list/mail_user.list.php
@@ -87,7 +87,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width' => "",
-	'value' => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value' => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 $liste["item"][] = array( 'field'  => "postfix",
 	'datatype' => "VARCHAR",
@@ -96,7 +96,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 $liste["item"][] = array( 'field'  => "disablesmtp",
 	'datatype' => "VARCHAR",
@@ -105,7 +105,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('n' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'y' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('n' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'y' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 $liste["item"][] = array( 'field'  => "disableimap",
 	'datatype' => "VARCHAR",
@@ -114,7 +114,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('n' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'y' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('n' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'y' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 $liste["item"][] = array( 'field'  => "disablepop3",
 	'datatype' => "VARCHAR",
@@ -123,6 +123,6 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('n' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'y' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('n' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'y' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 ?>
diff --git a/interface/web/mail/list/mail_whitelist.list.php b/interface/web/mail/list/mail_whitelist.list.php
index 0d8a0ff..321db85 100644
--- a/interface/web/mail/list/mail_whitelist.list.php
+++ b/interface/web/mail/list/mail_whitelist.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/mail/list/spamfilter_blacklist.list.php b/interface/web/mail/list/spamfilter_blacklist.list.php
index cdf5a0e..b4be804 100644
--- a/interface/web/mail/list/spamfilter_blacklist.list.php
+++ b/interface/web/mail/list/spamfilter_blacklist.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/mail/list/spamfilter_policy.list.php b/interface/web/mail/list/spamfilter_policy.list.php
index eeb8746..e7e0def 100644
--- a/interface/web/mail/list/spamfilter_policy.list.php
+++ b/interface/web/mail/list/spamfilter_policy.list.php
@@ -65,7 +65,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "spam_lover",
@@ -75,7 +75,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "banned_files_lover",
@@ -85,7 +85,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "bad_header_lover",
@@ -95,7 +95,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 
diff --git a/interface/web/mail/list/spamfilter_users.list.php b/interface/web/mail/list/spamfilter_users.list.php
index efd74f6..e9d703b 100644
--- a/interface/web/mail/list/spamfilter_users.list.php
+++ b/interface/web/mail/list/spamfilter_users.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/mail/list/spamfilter_whitelist.list.php b/interface/web/mail/list/spamfilter_whitelist.list.php
index 3082329..713187e 100644
--- a/interface/web/mail/list/spamfilter_whitelist.list.php
+++ b/interface/web/mail/list/spamfilter_whitelist.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/mail/list/xmpp_domain.list.php b/interface/web/mail/list/xmpp_domain.list.php
index 21257e4..be87ec7 100644
--- a/interface/web/mail/list/xmpp_domain.list.php
+++ b/interface/web/mail/list/xmpp_domain.list.php
@@ -59,7 +59,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 if($_SESSION['s']['user']['typ'] == 'admin') {
diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php
index a155cbd..aedcd22 100644
--- a/interface/web/mail/mail_user_edit.php
+++ b/interface/web/mail/mail_user_edit.php
@@ -237,8 +237,13 @@
 			$this->dataRecord["homedir"] = $mail_config["homedir_path"];
 			
 			// Will be overwritten by mail_plugin
-			$this->dataRecord['uid'] = -1;
-			$this->dataRecord['gid'] = -1;
+			if ($mail_config["mailbox_virtual_uidgid_maps"] == 'y') {
+				$this->dataRecord['uid'] = -1;
+				$this->dataRecord['gid'] = -1;
+			} else {
+				$this->dataRecord['uid'] = intval($mail_config["mailuser_uid"]);
+				$this->dataRecord['gid'] = intval($mail_config["mailuser_gid"]);
+			}
 				
 			//* Check if there is no alias or forward with this address
 			$tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE active = 'y' AND source = ?", $this->dataRecord["email"]);
diff --git a/interface/web/mail/xmpp_domain_edit.php b/interface/web/mail/xmpp_domain_edit.php
index b5858e0..16046db 100644
--- a/interface/web/mail/xmpp_domain_edit.php
+++ b/interface/web/mail/xmpp_domain_edit.php
@@ -402,7 +402,7 @@
         //    $this->desyncMailusers($this->dataRecord['domain']);
         // Update DNS Records
         // TODO: Update gets only triggered from main form. WHY?
-        $soa = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other FROM dns_soa WHERE active = 'Y' AND  = ?", $this->dataRecord['domain'].'.');
+        $soa = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other FROM dns_soa WHERE active = 'Y' AND `origin` = ?", $this->dataRecord['domain'].'.');
         if ( isset($soa) && !empty($soa) ) $this->update_dns($this->dataRecord, $soa);
 	}
 
diff --git a/interface/web/monitor/lib/lang/pl.lng b/interface/web/monitor/lib/lang/pl.lng
index c2629c4..4ce642f 100644
--- a/interface/web/monitor/lib/lang/pl.lng
+++ b/interface/web/monitor/lib/lang/pl.lng
@@ -24,7 +24,7 @@
 $wb['No Refresh'] = 'Nie odświeżaj';
 $wb['minutes'] = 'minuty';
 $wb['Show Overview'] = 'Pokaż wszystko';
-$wb['System State (All Servers)'] = 'Status systemu (Wszystkie serwery)';
+$wb['System State (All Servers)'] = 'Status systemu';
 $wb['Hardware-Information'] = 'Informacje o sprzęcie';
 $wb['Show CPU info'] = 'Pokaż informacje o procesorze';
 $wb['Server State'] = 'Status serwera';
diff --git a/interface/web/sites/ajax_get_ip.php b/interface/web/sites/ajax_get_ip.php
index 205be48..8c83191 100644
--- a/interface/web/sites/ajax_get_ip.php
+++ b/interface/web/sites/ajax_get_ip.php
@@ -39,13 +39,15 @@
 $client_group_id = $app->functions->intval($_GET["client_group_id"]);
 $ip_type = $_GET['ip_type'];
 
-if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+//if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 
 	//* Get global web config
 	$web_config = $app->getconf->get_server_config($server_id, 'web');
+	
+	$tmp = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $client_group_id);
+	$sql = "SELECT ip_address FROM server_ip WHERE ip_type = ? AND server_id = ? AND (client_id = 0 OR client_id=?)";
 
-	$sql = "SELECT ip_address FROM server_ip WHERE ip_type = ? AND server_id = ?";
-	$ips = $app->db->queryAllRecords($sql, $ip_type, $server_id);
+	$ips = $app->db->queryAllRecords($sql, $ip_type, $server_id, $tmp['groupid']);
 	// $ip_select = "<option value=''></option>";
 	if($ip_type == 'IPv4'){
 		$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"*#":"";
@@ -60,7 +62,7 @@
 	}
 	unset($tmp);
 	unset($ips);
-}
+//}
 
 echo substr($ip_select, 0, -1);
 ?>
diff --git a/interface/web/sites/aps_install_package.php b/interface/web/sites/aps_install_package.php
index bcd4184..19ab785 100644
--- a/interface/web/sites/aps_install_package.php
+++ b/interface/web/sites/aps_install_package.php
@@ -129,7 +129,7 @@
 if(!empty($domains))
 {
 	$set = array();
-	$set[] = '<select name="main_domain" id="main_domain" class="form-control">';
+	$set[] = '<select name="main_domain" id="main_domain" class="form-control" style="width:100%; height:100%; min-width:170px;">';
 	foreach($domains as $domain)
 	{
 		$selected = '';
diff --git a/interface/web/sites/database_quota_stats.php b/interface/web/sites/database_quota_stats.php
index 5e95fdc..a87a33d 100644
--- a/interface/web/sites/database_quota_stats.php
+++ b/interface/web/sites/database_quota_stats.php
@@ -29,7 +29,7 @@
 		foreach($tmp_array as $database_name => $data) {
 			$db_name = $data['database_name'];
 
-			$temp = $app->db->queryOneRecord("SELECT client.username, web_database.database_quota FROM web_database, sys_group, client WHERE sys_group.client_id = client.client_id AND web_database.database_name = ?", $db_name);
+			$temp = $app->db->queryOneRecord("SELECT client.username, web_database.database_quota FROM web_database, sys_group, client WHERE sys_group.groupid = web_database.sys_groupid AND sys_group.client_id = client.client_id AND web_database.database_name = ?", $db_name);
 			if(is_array($temp) && !empty($temp)) {
 				$monitor_data[$server_id.'.'.$db_name]['database_name'] = $data['database_name'];
 				$monitor_data[$server_id.'.'.$db_name]['client'] = isset($temp['username']) ? $temp['username'] : '';
@@ -80,7 +80,8 @@
 			$client = $app->db->queryOneRecord("SELECT * FROM client WHERE client_id = ?", $sys_group['client_id']);
 			$rec['client'] = $client['username'];
 			$rec['used'] = 'n/a';
-			$rec['quota'] = 'n/a';
+			if (empty($rec['database_quota'])) $rec['database_quota'] = 0;
+			$rec['quota'] = $rec['database_quota'];
 		}
 		$rec['id'] = $rec[$this->idx_key];
 
diff --git a/interface/web/sites/list/cron.list.php b/interface/web/sites/list/cron.list.php
index 311af32..7679a2e 100644
--- a/interface/web/sites/list/cron.list.php
+++ b/interface/web/sites/list/cron.list.php
@@ -55,7 +55,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/sites/list/database.list.php b/interface/web/sites/list/database.list.php
index 22694aa..b4d1196 100644
--- a/interface/web/sites/list/database.list.php
+++ b/interface/web/sites/list/database.list.php
@@ -59,7 +59,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 $liste["item"][] = array( 'field'  => "remote_access",
 	'datatype' => "VARCHAR",
@@ -68,7 +68,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 $liste["item"][] = array( 'field'  => "type",
 	'datatype' => "VARCHAR",
diff --git a/interface/web/sites/list/ftp_user.list.php b/interface/web/sites/list/ftp_user.list.php
index 9742a24..7657406 100644
--- a/interface/web/sites/list/ftp_user.list.php
+++ b/interface/web/sites/list/ftp_user.list.php
@@ -55,7 +55,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/sites/list/shell_user.list.php b/interface/web/sites/list/shell_user.list.php
index 61c774d..9ea244e 100644
--- a/interface/web/sites/list/shell_user.list.php
+++ b/interface/web/sites/list/shell_user.list.php
@@ -55,7 +55,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/sites/list/web_childdomain.list.php b/interface/web/sites/list/web_childdomain.list.php
index f938bee..1e38b24 100644
--- a/interface/web/sites/list/web_childdomain.list.php
+++ b/interface/web/sites/list/web_childdomain.list.php
@@ -55,7 +55,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/sites/list/web_folder.list.php b/interface/web/sites/list/web_folder.list.php
index af74d8e..fce8cfd 100644
--- a/interface/web/sites/list/web_folder.list.php
+++ b/interface/web/sites/list/web_folder.list.php
@@ -55,7 +55,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/sites/list/web_folder_user.list.php b/interface/web/sites/list/web_folder_user.list.php
index 454e2c4..c8f078a 100644
--- a/interface/web/sites/list/web_folder_user.list.php
+++ b/interface/web/sites/list/web_folder_user.list.php
@@ -57,7 +57,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "web_folder_id",
diff --git a/interface/web/sites/list/web_vhost_domain.list.php b/interface/web/sites/list/web_vhost_domain.list.php
index ddeaacc..1d167a7 100644
--- a/interface/web/sites/list/web_vhost_domain.list.php
+++ b/interface/web/sites/list/web_vhost_domain.list.php
@@ -78,7 +78,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 if($_SESSION['s']['user']['typ'] == 'admin' && $vhostdomain_type == 'domain') {
 	$liste["item"][] = array( 'field'  => "sys_groupid",
diff --git a/interface/web/sites/list/webdav_user.list.php b/interface/web/sites/list/webdav_user.list.php
index 52a3ab9..5d1aeec 100644
--- a/interface/web/sites/list/webdav_user.list.php
+++ b/interface/web/sites/list/webdav_user.list.php
@@ -55,7 +55,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('Yes')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('No')."</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "server_id",
diff --git a/interface/web/sites/templates/web_vhost_domain_edit.htm b/interface/web/sites/templates/web_vhost_domain_edit.htm
index ec9005a..22a1952 100644
--- a/interface/web/sites/templates/web_vhost_domain_edit.htm
+++ b/interface/web/sites/templates/web_vhost_domain_edit.htm
@@ -432,8 +432,8 @@
 		
     function reloadFastcgiPHPVersions(noFormChange) {
         jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, php_type : jQuery('#php').val(), type : "getphpfastcgi", client_group_id : clientGroupId}, function(data) {
-            //var options = '<option value="">Default</option>';
-			var options = '';
+            var options = '<option value="">Default</option>';
+			//var options = '';
             var phpfastcgiselected = '';
             $.each(data, function(key, val) {
 				<tmpl_if name="id">
diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php
index 647061e..6f84357 100644
--- a/interface/web/sites/web_vhost_domain_edit.php
+++ b/interface/web/sites/web_vhost_domain_edit.php
@@ -188,7 +188,7 @@
 				}
 				$server_id = intval(@$this->dataRecord["server_id"]);
 			} else {
-				$server_id = (isset($web_servers[0])) ? intval($web_servers[0]) : 0;
+				$server_id = (isset($web_servers[0])) ? intval($web_servers[0]['server_id']) : 0;
 			}
 			
 			if($app->functions->intval($this->dataRecord["server_id"]) > 0) {
@@ -200,9 +200,9 @@
 				}
 			}
 			
-			//* Fill the IPv4 select field with the IP addresses that are allowed for this client
-			$sql = "SELECT ip_address FROM server_ip WHERE server_id IN ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
-			$ips = $app->db->queryAllRecords($sql, explode(',', $client['web_servers']));
+			//* Fill the IPv4 select field with the IP addresses that are allowed for this client on the current server
+			$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
+			$ips = $app->db->queryAllRecords($sql, $server_id);
 			$ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
 			//if(!in_array($this->dataRecord["ip_address"], $ips)) $ip_select .= "<option value='".$this->dataRecord["ip_address"]."' SELECTED>".$this->dataRecord["ip_address"]."</option>\r\n";
 			//$ip_select = "";
@@ -217,8 +217,8 @@
 			unset($ips);
 
 			//* Fill the IPv6 select field with the IP addresses that are allowed for this client
-			$sql = "SELECT ip_address FROM server_ip WHERE server_id IN ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)";
-			$ips = $app->db->queryAllRecords($sql, explode(',', $client['web_servers']), $_SESSION['s']['user']['client_id']);
+			$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)";
+			$ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']);
 			//$ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
 			//$ip_select = "";
 			$ip_select = "<option value=''></option>";
@@ -305,6 +305,17 @@
 
 			$app->tpl->setVar("server_id", $options_web_servers);
 			unset($options_web_servers);
+			
+			if($this->id > 0) {
+				if(!isset($this->dataRecord["server_id"])){
+					$tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ?", $this->id);
+					$this->dataRecord["server_id"] = $tmp["server_id"];
+					unset($tmp);
+				}
+				$server_id = intval(@$this->dataRecord["server_id"]);
+			} else {
+				$server_id = (isset($web_servers[0])) ? intval($web_servers[0]['server_id']) : 0;
+			}
 
 			if ($settings['use_domain_module'] != 'y') {
 				// Fill the client select field
@@ -335,8 +346,8 @@
 			}
 			
 			//* Fill the IPv4 select field with the IP addresses that are allowed for this client
-			$sql = "SELECT ip_address FROM server_ip WHERE server_id IN ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=?)";
-			$ips = $app->db->queryAllRecords($sql, explode(',', $client['web_servers']), $_SESSION['s']['user']['client_id']);
+			$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=?)";
+			$ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']);
 			$ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
 			//if(!in_array($this->dataRecord["ip_address"], $ips)) $ip_select .= "<option value='".$this->dataRecord["ip_address"]."' SELECTED>".$this->dataRecord["ip_address"]."</option>\r\n";
 			//$ip_select = "";
@@ -351,8 +362,8 @@
 			unset($ips);
 
 			//* Fill the IPv6 select field with the IP addresses that are allowed for this client
-			$sql = "SELECT ip_address FROM server_ip WHERE server_id IN ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)";
-			$ips = $app->db->queryAllRecords($sql, $client['web_servers'], $_SESSION['s']['user']['client_id']);
+			$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)";
+			$ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']);
 			$ip_select = "<option value=''></option>";
 			//$ip_select = "";
 			if(is_array($ips)) {
@@ -1460,9 +1471,13 @@
 					$this->dataRecord["domain"] = $rec['domain'];
 				}
 				if(isset($this->dataRecord["ip_address"]) && $rec['ip_address'] != $this->dataRecord["ip_address"] && $rec['sys_perm_group'] != 'riud') {
+					//* Add a error message and switch back to old server
+					$app->tform->errorMessage .= $app->lng('The IP can not be changed. Please ask your Administrator if you want to change the IPv4-Address.');
 					$this->dataRecord["ip_address"] = $rec['ip_address'];
 				}
 				if(isset($this->dataRecord["ipv6_address"]) && $rec['ipv6_address'] != $this->dataRecord["ipv6_address"] && $rec['sys_perm_group'] != 'riud') {
+					//* Add a error message and switch back to old server
+					$app->tform->errorMessage .= $app->lng('The IP can not be changed. Please ask your Administrator if you want to change the IPv6-Address.');
 					$this->dataRecord["ipv6_address"] = $rec['ipv6_address'];
 				}
 				unset($rec);
diff --git a/interface/web/themes/default/assets/javascripts/ispconfig.js b/interface/web/themes/default/assets/javascripts/ispconfig.js
index 21c8c1b..a726d0a 100644
--- a/interface/web/themes/default/assets/javascripts/ispconfig.js
+++ b/interface/web/themes/default/assets/javascripts/ispconfig.js
@@ -23,11 +23,7 @@
 	},
 	
 	reportError: function(request) {
-		/* Error reporting is disabled by default as some browsers like safari
-		   sometimes throw errors when a ajax request is delayed even if the
-		   ajax request worked. */
-
-		/*alert(request);*/
+		
 	},
 	
 	registerHook: function(name, callback) {
@@ -141,55 +137,6 @@
 		
 		ISPConfig.callHook('onAfterContentLoad', {'url': url, 'data': data });
 	},
-
-	/* THIS ONE SHOULD BE REMOVED AFTER CREATING THE STATIC LOGIN PAGE!!! */
-	/*submitLoginForm: function(formname) {
-		//* Validate form. TODO: username and password with strip();
-		var frm = document.getElementById(formname);
-		var userNameObj = frm.username;
-		if(userNameObj.value == ''){
-			userNameObj.focus();
-			return;
-		}
-		var passwordObj = frm.passwort;
-		if(passwordObj.value == ''){
-			passwordObj.focus();
-			return;
-		}
-
-		$('#dummy_username').val(userNameObj.value);
-		$('#dummy_passwort').val(passwordObj.value);
-		$('#dummy_login_form').submit();
-
-		var submitFormObj = $.ajax({
-			type: "POST",
-			url: "content.php",
-			data: $('#'+formname).serialize(),
-			dataType: "html",
-			beforeSend: function() {
-				ISPConfig.showLoadIndicator();
-			},
-			success: function(data, textStatus, jqXHR) {
-				if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
-					var parts = jqXHR.responseText.split(':');
-					ISPConfig.loadContent(parts[1]);
-				} else if (jqXHR.responseText.indexOf('LOGIN_REDIRECT:') > -1) {
-					// Go to the login page
-					document.location.href = 'index.php';
-				} else {
-					$('#pageContent').html(jqXHR.responseText);
-					ISPConfig.onAfterContentLoad('content.php', $('#'+formname).serialize());
-					ISPConfig.pageFormChanged = false;
-				}
-				ISPConfig.loadMenus();
-				ISPConfig.hideLoadIndicator();
-			},
-			error: function() {
-				ISPConfig.hideLoadIndicator();
-				ISPConfig.reportError('Ajax Request was not successful.110');
-			}
-		});
-	},*/
 
 	submitForm: function(formname, target, confirmation) {
 		var successMessage = arguments[3];
@@ -320,11 +267,6 @@
 					var newUrl= jqXHR.responseText.substr(jqXHR.responseText.indexOf('URL_REDIRECT:') + "URL_REDIRECT:".length);
 					document.location.href = newUrl;
 				} else {
-					//document.getElementById('pageContent').innerHTML = jqXHR.responseText;
-					//var reponse = $(jqXHR.responseText);
-					//var reponseScript = reponse.filter("script");
-					//$.each(reponseScript, function(idx, val) { eval(val.text); } );
-
 					$('#pageContent').html(jqXHR.responseText);
 					ISPConfig.onAfterContentLoad(pagename, (params ? params : null));
 					ISPConfig.pageFormChanged = false;
@@ -444,7 +386,10 @@
 	},
 
 	changeTab: function(tab, target, force) {
-		if(ISPConfig.requestsRunning > 0) return false;
+		if(ISPConfig.requestsRunning > 0) {
+			console.log('tab change interrupted, request still running.');
+			return false;
+		}
 	
 		document.pageForm.next_tab.value = tab;
 
@@ -618,9 +563,17 @@
 	}
 });
 
+var $page = $('html, body');
+
 $(document).on('click', 'a[data-load-content],button[data-load-content]', function(e) {
 	e.preventDefault();
-	$('html, body').animate({scrollTop: 0}, 1000);
+	if(ISPConfig.requestsRunning > 0) {
+		console.log('preventing click because there is still a request running.');
+		return;
+	}
+	
+	$page.on('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); });
+	$page.animate({scrollTop: 0}, 1000, function() { $page.off('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); }); });
 	
 	var content_to_load = $(this).attr('data-load-content');
 	if(!content_to_load) return this;
@@ -630,7 +583,13 @@
 
 $(document).on('click', 'a[data-capp],button[data-capp]', function(e) {
 	e.preventDefault();
-	$('html, body').animate({scrollTop: 0}, 1000);
+	if(ISPConfig.requestsRunning > 0) {
+		console.log('preventing click because there is still a request running.');
+		return;
+	}
+	
+	$page.on('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); });
+	$page.animate({scrollTop: 0}, 1000, function() { $page.off('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); }); });
 	
 	var content_to_load = $(this).attr('data-capp');
 	if(!content_to_load) return this;
@@ -640,7 +599,13 @@
 
 $(document).on('click', 'a[data-submit-form],button[data-submit-form]', function(e) {
 	e.preventDefault();
-	$('html, body').animate({scrollTop: 0}, 1000);
+	if(ISPConfig.requestsRunning > 0) {
+		console.log('preventing click because there is still a request running.');
+		return;
+	}
+	
+	$page.on('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); });
+	$page.animate({scrollTop: 0}, 1000, function() { $page.off('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); }); });
 	
 	var $el = $(this);
 	var act = $el.attr('data-form-action');
diff --git a/interface/web/themes/default/templates/error.tpl.htm b/interface/web/themes/default/templates/error.tpl.htm
index f0c1081..dbb730f 100644
--- a/interface/web/themes/default/templates/error.tpl.htm
+++ b/interface/web/themes/default/templates/error.tpl.htm
@@ -4,6 +4,5 @@
 	<ol>
 		<li>###ERRORMSG###</li>
 	</ol>
-	<div>TODO: WRONG HTML ELEMENTS</div>
   </div>
 </div>
diff --git a/interface/web/themes/default/templates/main.tpl.htm b/interface/web/themes/default/templates/main.tpl.htm
index 058eec3..24a84c5 100644
--- a/interface/web/themes/default/templates/main.tpl.htm
+++ b/interface/web/themes/default/templates/main.tpl.htm
@@ -84,7 +84,7 @@
   <script type="text/javascript" src="js/jquery.min.js"></script>
   <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/bootstrap.min.js'></script>
   <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/bootstrap-datetimepicker.min.js'></script>
-  <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/ispconfig.min.js'></script>
+  <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/ispconfig.js'></script>
   <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/modernizr.custom.min.js'></script>
   <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/pushy.min.js'></script>
   <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/responsive.min.js'></script>
diff --git a/interface/web/themes/default/templates/main_login.tpl.htm b/interface/web/themes/default/templates/main_login.tpl.htm
index afcf4cf..129633e 100644
--- a/interface/web/themes/default/templates/main_login.tpl.htm
+++ b/interface/web/themes/default/templates/main_login.tpl.htm
@@ -27,7 +27,7 @@
   <div class="row" style="margin: auto; width:100%;">
     	<div class="col-md-4 col-md-offset-4">
     		<div class="panel panel-default">
-			  	<div class="panel-heading" style="background: linear-gradient(to bottom, white, #eef0f2);">
+			  	<div class="panel-heading" style="background: linear-gradient(to bottom, white, #eef0f2);text-align:center;">
 					<img src="{tmpl_var name='base64_logo_txt'}">
 			 	</div>
 			  	<div class="panel-body">
@@ -41,7 +41,7 @@
   <script type="text/javascript" src="../js/jquery.min.js"></script>
   <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/bootstrap.min.js'></script>
   <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/bootstrap-datetimepicker.min.js'></script>
-  <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/ispconfig.min.js'></script>
+  <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/ispconfig.js'></script>
   <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/modernizr.custom.min.js'></script>
   <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/pushy.min.js'></script>
   <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/responsive.min.js'></script>
diff --git a/interface/web/tools/lib/lang/ar_usersettings.lng b/interface/web/tools/lib/lang/ar_usersettings.lng
index a1f3bd2..4ac506a 100644
--- a/interface/web/tools/lib/lang/ar_usersettings.lng
+++ b/interface/web/tools/lib/lang/ar_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Password';
+$wb['password_txt'] = 'Password';
 $wb['password_strength_txt'] = 'Password strength';
 $wb['language_txt'] = 'Language';
 $wb['password_mismatch'] = 'The password in the second password field does not match the first password.';
diff --git a/interface/web/tools/lib/lang/bg_usersettings.lng b/interface/web/tools/lib/lang/bg_usersettings.lng
index b8e6a86..838053f 100644
--- a/interface/web/tools/lib/lang/bg_usersettings.lng
+++ b/interface/web/tools/lib/lang/bg_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Парола';
+$wb['password_txt'] = 'Парола';
 $wb['password_strength_txt'] = 'Сила на паролата';
 $wb['language_txt'] = 'Език';
 $wb['password_mismatch'] = 'Паролите в двете полета не съвпадат.';
diff --git a/interface/web/tools/lib/lang/br_usersettings.lng b/interface/web/tools/lib/lang/br_usersettings.lng
index cf4242d..41de100 100644
--- a/interface/web/tools/lib/lang/br_usersettings.lng
+++ b/interface/web/tools/lib/lang/br_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Senha';
+$wb['password_txt'] = 'Senha';
 $wb['password_strength_txt'] = 'Segurança de Senha';
 $wb['language_txt'] = 'Idioma';
 $wb['password_mismatch'] = 'As senhas não conhecidem';
diff --git a/interface/web/tools/lib/lang/ca_usersettings.lng b/interface/web/tools/lib/lang/ca_usersettings.lng
index 85c8e75..fa40272 100644
--- a/interface/web/tools/lib/lang/ca_usersettings.lng
+++ b/interface/web/tools/lib/lang/ca_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Mot de passe';
+$wb['password_txt'] = 'Mot de passe';
 $wb['password_strength_txt'] = 'Force du mot de passe';
 $wb['language_txt'] = 'Langue';
 $wb['password_mismatch'] = 'Le mot de passe de confirmation ne correspond avec le premier.';
diff --git a/interface/web/tools/lib/lang/cz_usersettings.lng b/interface/web/tools/lib/lang/cz_usersettings.lng
index dec46b7..98dd4ed 100644
--- a/interface/web/tools/lib/lang/cz_usersettings.lng
+++ b/interface/web/tools/lib/lang/cz_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Heslo';
+$wb['password_txt'] = 'Heslo';
 $wb['password_strength_txt'] = 'Bezpečnost hesla';
 $wb['language_txt'] = 'Jazyk';
 $wb['password_mismatch'] = 'Hesla se neshodují.';
diff --git a/interface/web/tools/lib/lang/de_usersettings.lng b/interface/web/tools/lib/lang/de_usersettings.lng
index 908bbf6..c643d38 100644
--- a/interface/web/tools/lib/lang/de_usersettings.lng
+++ b/interface/web/tools/lib/lang/de_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Passwort';
+$wb['password_txt'] = 'Passwort';
 $wb['language_txt'] = 'Sprache';
 $wb['password_mismatch'] = 'Die Passwörter stimmen nicht überein.';
 $wb['password_strength_txt'] = 'Passwortkomplexität';
diff --git a/interface/web/tools/lib/lang/el_usersettings.lng b/interface/web/tools/lib/lang/el_usersettings.lng
index d2321b0..57e8bcb 100644
--- a/interface/web/tools/lib/lang/el_usersettings.lng
+++ b/interface/web/tools/lib/lang/el_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Συνθηματικό';
+$wb['password_txt'] = 'Συνθηματικό';
 $wb['password_strength_txt'] = 'Δύναμη συνθηματικού';
 $wb['language_txt'] = 'Γλώσσα';
 $wb['password_mismatch'] = 'Το συνθηματικό στο δεύτερο πεδίο δεν ταιριάζει με το συνθηματικό στο πρώτο πεδίο.';
diff --git a/interface/web/tools/lib/lang/en_usersettings.lng b/interface/web/tools/lib/lang/en_usersettings.lng
index efbe6c3..e882321 100644
--- a/interface/web/tools/lib/lang/en_usersettings.lng
+++ b/interface/web/tools/lib/lang/en_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb["passwort_txt"] = 'Password';
+$wb["password_txt"] = 'Password';
 $wb["password_strength_txt"] = 'Password strength';
 $wb["language_txt"] = 'Language';
 $wb["password_mismatch"] = 'The password in the second password field does not match the first password.';
diff --git a/interface/web/tools/lib/lang/es_usersettings.lng b/interface/web/tools/lib/lang/es_usersettings.lng
index c9bc3db..9b2de57 100644
--- a/interface/web/tools/lib/lang/es_usersettings.lng
+++ b/interface/web/tools/lib/lang/es_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Contraseña';
+$wb['password_txt'] = 'Contraseña';
 $wb['password_strength_txt'] = 'Fortaleza de la contraseña';
 $wb['language_txt'] = 'Idioma';
 $wb['password_mismatch'] = 'La contraseña del primer y segundo campo no coinciden.';
diff --git a/interface/web/tools/lib/lang/fi_usersettings.lng b/interface/web/tools/lib/lang/fi_usersettings.lng
index c869888..8267c81 100755
--- a/interface/web/tools/lib/lang/fi_usersettings.lng
+++ b/interface/web/tools/lib/lang/fi_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Salasana';
+$wb['password_txt'] = 'Salasana';
 $wb['language_txt'] = 'Kieli';
 $wb['password_mismatch'] = 'Salasanat eivät täsmää.';
 $wb['password_strength_txt'] = 'Salasanan vahvuus';
diff --git a/interface/web/tools/lib/lang/fr_usersettings.lng b/interface/web/tools/lib/lang/fr_usersettings.lng
index fda69f9..c93a244 100644
--- a/interface/web/tools/lib/lang/fr_usersettings.lng
+++ b/interface/web/tools/lib/lang/fr_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Mot de passe';
+$wb['password_txt'] = 'Mot de passe';
 $wb['password_strength_txt'] = 'Force du mot de passe';
 $wb['language_txt'] = 'Langue';
 $wb['password_mismatch'] = 'Le mot de passe de confirmation ne correspond avec le premier.';
diff --git a/interface/web/tools/lib/lang/hr_usersettings.lng b/interface/web/tools/lib/lang/hr_usersettings.lng
index 64b33d5..50759d4 100644
--- a/interface/web/tools/lib/lang/hr_usersettings.lng
+++ b/interface/web/tools/lib/lang/hr_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Šifra';
+$wb['password_txt'] = 'Šifra';
 $wb['password_strength_txt'] = 'Jačina šifre';
 $wb['language_txt'] = 'Jezik';
 $wb['password_mismatch'] = 'Šifra u drugom polju ne odgovara šifri iz prvog polja.';
diff --git a/interface/web/tools/lib/lang/hu_usersettings.lng b/interface/web/tools/lib/lang/hu_usersettings.lng
index 51fe50e..49aa755 100644
--- a/interface/web/tools/lib/lang/hu_usersettings.lng
+++ b/interface/web/tools/lib/lang/hu_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Jelszó';
+$wb['password_txt'] = 'Jelszó';
 $wb['language_txt'] = 'Nyelv';
 $wb['password_mismatch'] = 'Jelszavak nem egyeznek meg.';
 $wb['Form to edit the user password and language.'] = 'Jelszó, nyelv és hitelesítés beállító oldal.';
diff --git a/interface/web/tools/lib/lang/id_usersettings.lng b/interface/web/tools/lib/lang/id_usersettings.lng
index 19ecb54..7b1bc22 100644
--- a/interface/web/tools/lib/lang/id_usersettings.lng
+++ b/interface/web/tools/lib/lang/id_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Kata Sandi';
+$wb['password_txt'] = 'Kata Sandi';
 $wb['password_strength_txt'] = 'Kekuatan Sandi';
 $wb['language_txt'] = 'Bahasa';
 $wb['password_mismatch'] = 'Kata sandi di kolom kata sandi kedua tidak cocok dengan kata sandi pertama.';
diff --git a/interface/web/tools/lib/lang/it_usersettings.lng b/interface/web/tools/lib/lang/it_usersettings.lng
index 6e671a3..e75e8d2 100644
--- a/interface/web/tools/lib/lang/it_usersettings.lng
+++ b/interface/web/tools/lib/lang/it_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Password';
+$wb['password_txt'] = 'Password';
 $wb['language_txt'] = 'Lingua';
 $wb['password_mismatch'] = 'Il secondo campo password non corrisponde con il primo.';
 $wb['Form to edit the user password and language.'] = 'Form per modificare la password e la lingua dellutente.';
diff --git a/interface/web/tools/lib/lang/ja_usersettings.lng b/interface/web/tools/lib/lang/ja_usersettings.lng
index e4b4a4c..443a451 100644
--- a/interface/web/tools/lib/lang/ja_usersettings.lng
+++ b/interface/web/tools/lib/lang/ja_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'パスワード';
+$wb['password_txt'] = 'パスワード';
 $wb['password_strength_txt'] = 'パスワードの強度';
 $wb['language_txt'] = '言語';
 $wb['password_mismatch'] = 'パスワードの1つめの欄と2つめの欄が一致していません。';
diff --git a/interface/web/tools/lib/lang/nl_usersettings.lng b/interface/web/tools/lib/lang/nl_usersettings.lng
index ec8be95..0a95f7f 100644
--- a/interface/web/tools/lib/lang/nl_usersettings.lng
+++ b/interface/web/tools/lib/lang/nl_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Wachtwoord';
+$wb['password_txt'] = 'Wachtwoord';
 $wb['password_strength_txt'] = 'Wachtwoord sterkte';
 $wb['language_txt'] = 'Taal';
 $wb['password_mismatch'] = 'De door u ingevulde wachtwoorden komen niet overeen.';
diff --git a/interface/web/tools/lib/lang/pl_usersettings.lng b/interface/web/tools/lib/lang/pl_usersettings.lng
index addd42b..45081f6 100644
--- a/interface/web/tools/lib/lang/pl_usersettings.lng
+++ b/interface/web/tools/lib/lang/pl_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Hasło';
+$wb['password_txt'] = 'Hasło';
 $wb['password_strength_txt'] = 'Siła hasła';
 $wb['language_txt'] = 'Język';
 $wb['password_mismatch'] = 'Hasła nie pasują do siebie.';
diff --git a/interface/web/tools/lib/lang/pt_usersettings.lng b/interface/web/tools/lib/lang/pt_usersettings.lng
index b622c66..81fd824 100644
--- a/interface/web/tools/lib/lang/pt_usersettings.lng
+++ b/interface/web/tools/lib/lang/pt_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Senha';
+$wb['password_txt'] = 'Senha';
 $wb['password_strength_txt'] = 'Segurança de Senha';
 $wb['language_txt'] = 'Idioma';
 $wb['password_mismatch'] = 'As senhas não coincidem';
diff --git a/interface/web/tools/lib/lang/ro_usersettings.lng b/interface/web/tools/lib/lang/ro_usersettings.lng
index c0d3724..fae890f 100644
--- a/interface/web/tools/lib/lang/ro_usersettings.lng
+++ b/interface/web/tools/lib/lang/ro_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Password';
+$wb['password_txt'] = 'Password';
 $wb['password_strength_txt'] = 'Password strength';
 $wb['language_txt'] = 'Limba';
 $wb['password_mismatch'] = 'Parola in al doilea camp nu coincide cu primul.';
diff --git a/interface/web/tools/lib/lang/ru_usersettings.lng b/interface/web/tools/lib/lang/ru_usersettings.lng
index a26c048..ba6784d 100644
--- a/interface/web/tools/lib/lang/ru_usersettings.lng
+++ b/interface/web/tools/lib/lang/ru_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Пароль';
+$wb['password_txt'] = 'Пароль';
 $wb['password_strength_txt'] = 'Сложность пароля';
 $wb['language_txt'] = 'Язык';
 $wb['password_mismatch'] = 'Введенные пароли не совпадают.';
diff --git a/interface/web/tools/lib/lang/se_usersettings.lng b/interface/web/tools/lib/lang/se_usersettings.lng
index f7e05e9..4461fff 100644
--- a/interface/web/tools/lib/lang/se_usersettings.lng
+++ b/interface/web/tools/lib/lang/se_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Lösenord';
+$wb['password_txt'] = 'Lösenord';
 $wb['password_strength_txt'] = 'Lösenordsstyrka';
 $wb['language_txt'] = 'Språk';
 $wb['password_mismatch'] = 'The password in the second password field does not match the first password.';
diff --git a/interface/web/tools/lib/lang/sk_usersettings.lng b/interface/web/tools/lib/lang/sk_usersettings.lng
index 5545950..4c8bcb9 100644
--- a/interface/web/tools/lib/lang/sk_usersettings.lng
+++ b/interface/web/tools/lib/lang/sk_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Heslo';
+$wb['password_txt'] = 'Heslo';
 $wb['password_strength_txt'] = 'Pevnosť hesla';
 $wb['language_txt'] = 'Jazyk';
 $wb['password_mismatch'] = 'Heslo v overovacom poli nezodpovedá prvému heslu.';
diff --git a/interface/web/tools/lib/lang/tr_usersettings.lng b/interface/web/tools/lib/lang/tr_usersettings.lng
index ce7770c..cfc5a0d 100644
--- a/interface/web/tools/lib/lang/tr_usersettings.lng
+++ b/interface/web/tools/lib/lang/tr_usersettings.lng
@@ -1,5 +1,5 @@
 <?php
-$wb['passwort_txt'] = 'Parola';
+$wb['password_txt'] = 'Parola';
 $wb['password_strength_txt'] = 'Parola Güçlüğü';
 $wb['language_txt'] = 'Dil';
 $wb['password_mismatch'] = 'Parola ile onayı aynı değil.';
diff --git a/interface/web/tools/templates/import_ispconfig.htm b/interface/web/tools/templates/import_ispconfig.htm
index 83d79e6..1d63df2 100644
--- a/interface/web/tools/templates/import_ispconfig.htm
+++ b/interface/web/tools/templates/import_ispconfig.htm
@@ -3,15 +3,13 @@
 </div>
 <p><tmpl_var name="list_desc_txt"></p>
 
-<div class="panel panel_language_import">
+<div class="panel panel_language_import" style="padding:20px;">
   
     <div class="pnl_formsarea">
         <legend>{tmpl_var name="legend_txt"}</legend>
             <div class="form-group">
                 <label class="col-sm-3 control-label">Remote API URL</label>
-                <div class="col-sm-9">
-                    <div class="col-sm-6"><input class="form-control" type="text" id="remote_server" value="{tmpl_var name='remote_server'}" name="remote_server" /></div><div class="col-sm-3 input-sm"> (e.g. https://www.example.com:8080/remote/ )
-                </div></div>
+                <div class="col-sm-9"><input class="form-control" type="text" id="remote_server" value="{tmpl_var name='remote_server'}" placeholder="https://www.example.com:8080/remote/" name="remote_server" /></div>
             </div>
             <div class="form-group">
                 <label class="col-sm-3 control-label">Remote User</label>
diff --git a/interface/web/vm/list/openvz_ip.list.php b/interface/web/vm/list/openvz_ip.list.php
index 9184aa7..77a52db 100644
--- a/interface/web/vm/list/openvz_ip.list.php
+++ b/interface/web/vm/list/openvz_ip.list.php
@@ -91,7 +91,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 
diff --git a/interface/web/vm/list/openvz_ostemplate.list.php b/interface/web/vm/list/openvz_ostemplate.list.php
index cf49055..ca6132d 100644
--- a/interface/web/vm/list/openvz_ostemplate.list.php
+++ b/interface/web/vm/list/openvz_ostemplate.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 $liste["item"][] = array( 'field'  => "ostemplate_id",
 	'datatype' => "INTEGER",
@@ -96,7 +96,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 
diff --git a/interface/web/vm/list/openvz_template.list.php b/interface/web/vm/list/openvz_template.list.php
index 6ba7faf..e87314e 100644
--- a/interface/web/vm/list/openvz_template.list.php
+++ b/interface/web/vm/list/openvz_template.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 
 $liste["item"][] = array( 'field'  => "template_name",
diff --git a/interface/web/vm/list/openvz_vm.list.php b/interface/web/vm/list/openvz_vm.list.php
index ad490ed..51e23b3 100644
--- a/interface/web/vm/list/openvz_vm.list.php
+++ b/interface/web/vm/list/openvz_vm.list.php
@@ -54,7 +54,7 @@
 	'prefix' => "",
 	'suffix' => "",
 	'width'  => "",
-	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>".$app->lng('yes_txt')."</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>".$app->lng('no_txt')."</span></div>"));
 
 $liste["item"][] = array( 'field'  => "veid",
 	'datatype' => "VARCHAR",
diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master
index 66b4608..bb2d71d 100644
--- a/server/conf/vhost.conf.master
+++ b/server/conf/vhost.conf.master
@@ -350,15 +350,20 @@
                 Action php5-fcgi /php5-fcgi virtual
 				Alias /php5-fcgi {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'}
 <tmpl_if name='use_tcp'>
-                FastCgiExternalServer {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'} -idle-timeout 300 -host 127.0.0.1:<tmpl_var name='fpm_port'> -pass-header Authorization
-                <IfModule mod_proxy_fcgi.c>
-			ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ fcgi://127.0.0.1:<tmpl_var name='fpm_port'><tmpl_var name='web_document_root'>/$1
-                </IfModule>
+                FastCgiExternalServer {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'} -idle-timeout 300 -host 127.0.0.1:<tmpl_var name='fpm_port'> -pass-header Authorization             
 </tmpl_if>
 <tmpl_if name='use_socket'>
                 FastCgiExternalServer {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'} -idle-timeout 300 -socket <tmpl_var name='fpm_socket'> -pass-header Authorization
 </tmpl_if>
 		</IfModule>
+		<IfModule mod_proxy_fcgi.c>
+<tmpl_if name='use_tcp'>
+			ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ fcgi://127.0.0.1:<tmpl_var name='fpm_port'><tmpl_var name='web_document_root'>/$1
+</tmpl_if>
+<tmpl_if name='use_socket'>
+			ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ unix://<tmpl_var name='fpm_socket'>|fcgi://localhost/<tmpl_var name='web_document_root'>/$1
+</tmpl_if>
+			</IfModule>
 </tmpl_if>
 
 <tmpl_if name='php' op='==' value='hhvm'>
@@ -396,7 +401,6 @@
 <tmpl_if name="rewrite_enabled">
 		RewriteEngine on
 <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
-		RewriteEngine on
 		RewriteCond %{REQUEST_URI} ^/\.well-known/acme-challenge/
 		RewriteRule ^ - [END]
 </tmpl_if>
diff --git a/server/cron.php b/server/cron.php
index c197da9..58d48ec 100644
--- a/server/cron.php
+++ b/server/cron.php
@@ -30,6 +30,26 @@
 
 define('SCRIPT_PATH', dirname($_SERVER["SCRIPT_FILENAME"]));
 require SCRIPT_PATH."/lib/config.inc.php";
+
+// Check whether another instance of this script is already running
+if (is_file($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock')) {
+	clearstatcache();
+	$pid = trim(file_get_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock'));
+	if(preg_match('/^[0-9]+$/', $pid)) {
+		if(file_exists('/proc/' . $pid)) {
+			print @date('d.m.Y-H:i').' - WARNING - There is already an instance of server.php running with pid ' . $pid . '.' . "\n";
+			exit;
+		}
+	}
+	print @date('d.m.Y-H:i').' - WARNING - There is already a lockfile set, but no process running with this pid (' . $pid . '). Continuing.' . "\n";
+}
+
+// Set Lockfile
+@file_put_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock', getmypid());
+
+if($conf['log_priority'] <= LOGLEVEL_DEBUG) print 'Set Lock: ' . $conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock' . "\n";
+
+
 require SCRIPT_PATH."/lib/app.inc.php";
 
 set_time_limit(0);
@@ -85,6 +105,10 @@
 }
 unset($files);
 
+// Remove lock
+@unlink($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock');
+$app->log('Remove Lock: ' . $conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock', LOGLEVEL_DEBUG);
+
 die("finished.\n");
 
 ?>
diff --git a/server/lib/classes/cron.d/500-backup_mail.inc.php b/server/lib/classes/cron.d/500-backup_mail.inc.php
index 04a4249..2eacaed 100644
--- a/server/lib/classes/cron.d/500-backup_mail.inc.php
+++ b/server/lib/classes/cron.d/500-backup_mail.inc.php
@@ -176,7 +176,7 @@
 						$dir_handle = dir($mail_backup_dir);
 						$files = array();
 						while (false !== ($entry = $dir_handle->read())) {
-							if($entry != '.' && $entry != '..' && substr($entry,0,4+strlen($rec['mailuser_id'])) == 'mail'.$rec['mailuser_id'] && is_file($mail_backup_dir.'/'.$entry)) {
+							if($entry != '.' && $entry != '..' && substr($entry,0,5+strlen($rec['mailuser_id'])) == 'mail'.$rec['mailuser_id'].'_' && is_file($mail_backup_dir.'/'.$entry)) {
 								$files[] = $entry;
 							}
 						}
diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index 7c46820..64ba44e 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -87,12 +87,12 @@
 
 		if(!is_object($this->_iConnId) || mysqli_connect_error()) {
 			$this->_iConnId = null;
-			$this->_sqlerror('Zugriff auf Datenbankserver fehlgeschlagen! / Database server not accessible!');
+			$this->_sqlerror('Zugriff auf Datenbankserver fehlgeschlagen! / Database server not accessible!', '', true);
 			return false;
 		}
 		if(!((bool)mysqli_query( $this->_iConnId, 'USE `' . $this->dbName . '`'))) {
 			$this->close();
-			$this->_sqlerror('Datenbank nicht gefunden / Database not found');
+			$this->_sqlerror('Datenbank nicht gefunden / Database not found', '', true);
 			return false;
 		}
 
@@ -210,7 +210,7 @@
 					}
 
 					if($try > 9) {
-						$this->_sqlerror('DB::query -> reconnect');
+						$this->_sqlerror('DB::query -> reconnect', '', true);
 						return false;
 					} else {
 						sleep(($try > 7 ? 5 : 1));
@@ -464,7 +464,7 @@
 	 *
 	 * @access private
 	 */
-	private function _sqlerror($sErrormsg = 'Unbekannter Fehler', $sAddMsg = '') {
+	private function _sqlerror($sErrormsg = 'Unbekannter Fehler', $sAddMsg = '', $bNoLog = false) {
 		global $app, $conf;
 
 		$mysql_error = (is_object($this->_iConnId) ? mysqli_error($this->_iConnId) : mysqli_connect_error());
@@ -475,9 +475,11 @@
 
 		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 . ' -> ' . $mysql_errno . ' (' . $mysql_error . ')', LOGLEVEL_WARN);
-			}
+		} elseif(is_object($app) && method_exists($app, 'log') && $bNoLog == false) {
+			$app->log($sErrormsg . $sAddMsg . ' -> ' . $mysql_errno . ' (' . $mysql_error . ')', LOGLEVEL_WARN);
+		} elseif(php_sapi_name() == 'cli') {
+			echo $sErrormsg . $sAddMsg;
+		}
 	}
 
 	public function affectedRows() {
diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index 93cd524..978a891 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -1803,7 +1803,9 @@
 
 	function mount_backup_dir($backup_dir, $mount_cmd = '/usr/local/ispconfig/server/scripts/backup_dir_mount.sh'){
 		global $app, $conf;
-
+		
+		if($this->is_mounted($backup_dir)) return true;
+		
 		$mounted = true;
 		if ( 	is_file($mount_cmd) &&
 				is_executable($mount_cmd) &&
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 6763399..01362f5 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -36,6 +36,7 @@
 	// private variables
 	var $action = '';
 	var $ssl_certificate_changed = false;
+	var $update_letsencrypt = false;
 
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
@@ -504,6 +505,7 @@
 			$data['new'] = $tmp;
 			$data['old'] = $tmp;
 			$this->action = 'update';
+			$this->update_letsencrypt = true;
 		}
 
 		// load the server configuration options
@@ -1177,8 +1179,7 @@
 			($data['old']['ssl'] == 'n' || $data['old']['ssl_letsencrypt'] == 'n') // we have new let's encrypt configuration
 			|| ($data['old']['domain'] != $data['new']['domain']) // we have domain update
 			|| ($data['old']['subdomain'] != $data['new']['subdomain']) // we have new or update on "auto" subdomain
-			|| ($data['new']['type'] == 'subdomain') // we have new or update on subdomain
-			|| ($data['old']['type'] == 'alias' || $data['new']['type'] == 'alias') // we have new or update on aliasdomain
+			|| $this->update_letsencrypt == true
 		)) {
 			// default values
 			$temp_domains = array();
@@ -1230,13 +1231,15 @@
 			$webroot = $data['new']['document_root']."/web";
 
 			//* check if we have already a Let's Encrypt cert
-			if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
+			//if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
+				// we must not skip if cert exists, otherwise changed domains (alias or sub) won't make it to the cert
 				$app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
 				
 				$success = false;
-				$letsencrypt = array_shift( explode("\n", shell_exec('which letsencrypt certbot /root/.local/share/letsencrypt/bin/letsencrypt')) );
+				$letsencrypt = explode("\n", shell_exec('which letsencrypt certbot /root/.local/share/letsencrypt/bin/letsencrypt'));
+				$letsencrypt = reset($letsencrypt);
 				if(is_executable($letsencrypt)) {
-					$success = $this->_exec($letsencrypt . " certonly --text --agree-tos --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain --domains $lddomain --webroot-path /usr/local/ispconfig/interface/acme");
+					$success = $this->_exec($letsencrypt . " certonly -n --text --agree-tos --expand --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain --domains $lddomain --webroot-path /usr/local/ispconfig/interface/acme");
 				}
 				if(!$success) {
 					// error issuing cert
@@ -1248,7 +1251,7 @@
 					/* Update also the master-DB of the Server-Farm */
 					$app->dbmaster->query("UPDATE web_domain SET `ssl` = ?, `ssl_letsencrypt` = ? WHERE `domain` = ?", $data['new']['ssl'], 'n', $data['new']['domain']);
 				}
-			}
+			//}
 
 			//* check is been correctly created
 			if(file_exists($crt_tmp_file) OR file_exists($key_tmp_file)) {
@@ -1494,7 +1497,7 @@
 		
 		if (count($rewrite_wildcard_rules) > 0) $rewrite_rules = array_merge($rewrite_rules, $rewrite_wildcard_rules); // Append wildcard rules to the end of rules
 
-		if(count($rewrite_rules) > 0 || $vhost_data['seo_redirect_enabled'] > 0 || count($alias_seo_redirects) > 0) {
+		if(count($rewrite_rules) > 0 || $vhost_data['seo_redirect_enabled'] > 0 || count($alias_seo_redirects) > 0 || $data['new']['rewrite_to_https'] == 'y') {
 			$tpl->setVar('rewrite_enabled', 1);
 		} else {
 			$tpl->setVar('rewrite_enabled', 0);
@@ -2102,6 +2105,19 @@
 				//exec('fuser -km '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null');
 				exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null');
 			}
+			
+			// remove letsencrypt if it exists (renew will always fail otherwise)
+			
+			$domain = $data['old']['ssl_domain'];
+			if(!$domain) $domain = $data['old']['domain'];
+			if(substr($domain, 0, 2) === '*.') {
+				// wildcard domain not yet supported by letsencrypt!
+				$domain = substr($domain, 2);
+			}
+			//$crt_tmp_file = "/etc/letsencrypt/live/".$domain."/cert.pem";
+			//$key_tmp_file = "/etc/letsencrypt/live/".$domain."/privkey.pem";
+			$le_conf_file = '/etc/letsencrypt/renewal/' . $domain . '.conf';
+			@rename('/etc/letsencrypt/renewal/' . $domain . '.conf', '/etc/letsencrypt/renewal/' . $domain . '.conf~backup');
 		}
 
 		//* remove mountpoint from fstab
@@ -2123,6 +2139,7 @@
 			$data['new'] = $tmp;
 			$data['old'] = $tmp;
 			$this->action = 'update';
+			$this->update_letsencrypt = true;
 			// just run the update function
 			$this->update($event_name, $data);
 
diff --git a/server/plugins-available/backup_plugin.inc.php b/server/plugins-available/backup_plugin.inc.php
index 3e4fad6..7ae4660 100644
--- a/server/plugins-available/backup_plugin.inc.php
+++ b/server/plugins-available/backup_plugin.inc.php
@@ -87,6 +87,7 @@
 					if(file_exists($backup_dir.'/'.$backup['filename']) && file_exists($web['document_root'].'/backup/') && !stristr($backup_dir.'/'.$backup['filename'], '..') && !stristr($backup_dir.'/'.$backup['filename'], 'etc')) {
 						copy($backup_dir.'/'.$backup['filename'], $web['document_root'].'/backup/'.$backup['filename']);
 						chgrp($web['document_root'].'/backup/'.$backup['filename'], $web['system_group']);
+						chmod($web['document_root'].'/backup/'.$backup['filename'],0600);
 						$app->log('cp '.$backup_dir.'/'.$backup['filename'].' '.$web['document_root'].'/backup/'.$backup['filename'], LOGLEVEL_DEBUG);
 					}
 				}
diff --git a/server/plugins-available/maildeliver_plugin.inc.php b/server/plugins-available/maildeliver_plugin.inc.php
index 35001a4..2c16601 100644
--- a/server/plugins-available/maildeliver_plugin.inc.php
+++ b/server/plugins-available/maildeliver_plugin.inc.php
@@ -132,7 +132,7 @@
 
 			// Custom filters
 			if($data["new"]["custom_mailfilter"] == 'NULL') $data["new"]["custom_mailfilter"] = '';
-			$tpl->setVar('custom_mailfilter', $data["new"]["custom_mailfilter"]);
+			$tpl->setVar('custom_mailfilter', str_replace("\r\n","\n",$data["new"]["custom_mailfilter"]));
 
 			// Move junk
 			$tpl->setVar('move_junk', $data["new"]["move_junk"]);
diff --git a/server/plugins-available/maildrop_plugin.inc.php b/server/plugins-available/maildrop_plugin.inc.php
index 1ebb677..2fefa26 100644
--- a/server/plugins-available/maildrop_plugin.inc.php
+++ b/server/plugins-available/maildrop_plugin.inc.php
@@ -211,7 +211,7 @@
 						$mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n";
 					}
 				}
-				$mailfilter_content .= $data["new"]["custom_mailfilter"];
+				$mailfilter_content .= str_replace("\r\n","\n",$data["new"]["custom_mailfilter"]);
 
 				// Replace windows linebreaks in mailfilter file
 				$mailfilter_content = str_replace("\r\n", "\n", $mailfilter_content);
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index b2262b0..e658487 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -36,6 +36,7 @@
 	// private variables
 	var $action = '';
 	var $ssl_certificate_changed = false;
+	var $update_letsencrypt = false;
 
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
@@ -354,6 +355,7 @@
 			$data['new'] = $tmp;
 			$data['old'] = $tmp;
 			$this->action = 'update';
+			$this->update_letsencrypt = true;
 		}
 
 		// load the server configuration options
@@ -1251,8 +1253,7 @@
 			($data['old']['ssl'] == 'n' || $data['old']['ssl_letsencrypt'] == 'n') // we have new let's encrypt configuration
 			|| ($data['old']['domain'] != $data['new']['domain']) // we have domain update
 			|| ($data['old']['subdomain'] != $data['new']['subdomain']) // we have new or update on "auto" subdomain
-			|| ($data['new']['type'] == 'subdomain') // we have new or update on subdomain
-			|| ($data['old']['type'] == 'alias' || $data['new']['type'] == 'alias') // we have new or update on alias domain
+			|| $this->update_letsencrypt == true
 		)) {
 			// default values
 			$temp_domains = array();
@@ -1309,13 +1310,15 @@
 			$webroot = $data['new']['document_root']."/web";
 
 			//* check if we have already a Let's Encrypt cert
-			if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
+			//if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
+				// we must not skip if cert exists, otherwise changed domains (alias or sub) won't make it to the cert
 				$app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
 				
 				$success = false;
-				$letsencrypt = array_shift( explode("\n", shell_exec('which letsencrypt certbot /root/.local/share/letsencrypt/bin/letsencrypt')) );
+				$letsencrypt = explode("\n", shell_exec('which letsencrypt certbot /root/.local/share/letsencrypt/bin/letsencrypt'));
+				$letsencrypt = reset($letsencrypt);
 				if(is_executable($letsencrypt)) {
-					$success = $this->_exec($letsencrypt . " certonly --text --agree-tos --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain --domains $lddomain --webroot-path /usr/local/ispconfig/interface/acme");
+					$success = $this->_exec($letsencrypt . " certonly -n --text --agree-tos --expand --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain --domains $lddomain --webroot-path /usr/local/ispconfig/interface/acme");
 				}
 				if(!$success) {
 					// error issuing cert
@@ -1327,7 +1330,7 @@
 					/* Update also the master-DB of the Server-Farm */
 					$app->dbmaster->query("UPDATE web_domain SET `ssl` = ?, `ssl_letsencrypt` = ? WHERE `domain` = ?", $data['new']['ssl'], 'n', $data['new']['domain']);
 				}
-			}
+			//}
 
 			//* check is been correctly created
 			if(file_exists($crt_tmp_file) OR file_exists($key_tmp_file)) {
@@ -2124,6 +2127,18 @@
 				//exec('fuser -km '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null');
 				exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null');
 			}
+
+			// remove letsencrypt if it exists (renew will always fail otherwise)
+			$domain = $data['old']['ssl_domain'];
+			if(!$domain) $domain = $data['old']['domain'];
+			if(substr($domain, 0, 2) === '*.') {
+				// wildcard domain not yet supported by letsencrypt!
+				$domain = substr($domain, 2);
+			}
+			//$crt_tmp_file = "/etc/letsencrypt/live/".$domain."/cert.pem";
+			//$key_tmp_file = "/etc/letsencrypt/live/".$domain."/privkey.pem";
+			$le_conf_file = '/etc/letsencrypt/renewal/' . $domain . '.conf';
+			@rename('/etc/letsencrypt/renewal/' . $domain . '.conf', '/etc/letsencrypt/renewal/' . $domain . '.conf~backup');
 		}
 
 		//* remove mountpoint from fstab
@@ -2145,6 +2160,7 @@
 			$data['new'] = $tmp;
 			$data['old'] = $tmp;
 			$this->action = 'update';
+			$this->update_letsencrypt = true;
 			// just run the update function
 			$this->update($event_name, $data);
 
diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php
index 5645953..16dbcc7 100755
--- a/server/plugins-available/shelluser_jailkit_plugin.inc.php
+++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php
@@ -245,13 +245,17 @@
 			//exec('rm -rf '.$data['old']['dir'].$jailkit_chroot_userhome);
 
 			$app->system->web_folder_protection($web['document_root'], false);
+			
+			$userid = intval($app->system->getuid($data['old']['username']));
+			$command = 'killall -u '.escapeshellcmd($data['old']['username']).' ; ';
+			$command .= 'userdel -f '.escapeshellcmd($data['old']['username']).' &> /dev/null';
+			exec($command);
+			
+			// Remove the jailed user from passwd and shadow file inside the jail
+			$app->system->removeLine($data['old']['dir'].'/etc/passwd', $data['old']['username']);
+			$app->system->removeLine($data['old']['dir'].'/etc/shadow', $data['old']['username']);
 
 			if(@is_dir($data['old']['dir'].$jailkit_chroot_userhome)) {
-				$userid = intval($app->system->getuid($data['old']['username']));
-				$command = 'killall -u '.escapeshellcmd($data['old']['username']).' ; userdel -f';
-				$command .= ' '.escapeshellcmd($data['old']['username']).' &> /dev/null';
-				exec($command);
-				
 				$this->_delete_homedir($data['old']['dir'].$jailkit_chroot_userhome,$userid,$data['old']['parent_domain_id']);
 				
 				$app->log("Jailkit Plugin -> delete chroot home:".$data['old']['dir'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG);
diff --git a/server/server.php b/server/server.php
index 4479b14..689cb17 100644
--- a/server/server.php
+++ b/server/server.php
@@ -29,6 +29,25 @@
 
 define('SCRIPT_PATH', dirname($_SERVER["SCRIPT_FILENAME"]));
 require SCRIPT_PATH."/lib/config.inc.php";
+
+// Check whether another instance of this script is already running
+if (is_file($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock')) {
+	clearstatcache();
+	$pid = trim(file_get_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock'));
+	if(preg_match('/^[0-9]+$/', $pid)) {
+		if(file_exists('/proc/' . $pid)) {
+			print @date('d.m.Y-H:i').' - WARNING - There is already an instance of server.php running with pid ' . $pid . '.' . "\n";
+			exit;
+		}
+	}
+	print @date('d.m.Y-H:i').' - WARNING - There is already a lockfile set, but no process running with this pid (' . $pid . '). Continuing.' . "\n";
+}
+
+// Set Lockfile
+@file_put_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock', getmypid());
+
+if($conf['log_priority'] <= LOGLEVEL_DEBUG) print 'Set Lock: ' . $conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock' . "\n";
+
 require SCRIPT_PATH."/lib/app.inc.php";
 
 $app->setCaller('server');
@@ -124,24 +143,6 @@
 	// we do not need this variable anymore
 	unset($tmp);
 }
-
-
-// Check whether another instance of this script is already running
-if (is_file($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock')) {
-	clearstatcache();
-	$pid = trim(file_get_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock'));
-	if(preg_match('/^[0-9]+$/', $pid)) {
-		if(file_exists('/proc/' . $pid)) {
-			$app->log('There is already an instance of server.php running with pid ' . $pid . '.', LOGLEVEL_DEBUG);
-			exit;
-		}
-	}
-	$app->log('There is already a lockfile set, but no process running with this pid (' . $pid . '). Continuing.', LOGLEVEL_WARN);
-}
-
-// Set Lockfile
-@file_put_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock', getmypid());
-$app->log('Set Lock: ' . $conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock', LOGLEVEL_DEBUG);
 
 /** Do we need to start the core-modules */
 

--
Gitblit v1.9.1