From c3189ce6c7301c3ec17878fd3918f31d0d3cb18a Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Wed, 04 May 2016 07:27:53 -0400
Subject: [PATCH] Merge branch 'stable-3.1'

---
 interface/web/sites/templates/web_sites_stats_list.htm         |   16 +-
 server/conf/nginx_vhost.conf.master                            |    8 
 interface/web/dashboard/lib/lang/ja_dashlet_modules.lng        |    1 
 interface/web/dns/form/dns_soa.tform.php                       |    2 
 interface/web/dashboard/lib/lang/el_dashlet_modules.lng        |    1 
 install/tpl/apache_ispconfig.vhost.master                      |   86 +++++++++-------
 interface/web/dashboard/lib/lang/ro_dashlet_modules.lng        |    1 
 interface/lib/classes/json_handler.inc.php                     |    2 
 interface/web/dashboard/lib/lang/se_dashlet_modules.lng        |    1 
 install/update.php                                             |    2 
 interface/web/dashboard/dashlets/templates/modules.htm         |    4 
 interface/web/dashboard/lib/lang/en_dashlet_modules.lng        |    1 
 interface/web/client/templates/domain_list.htm                 |    4 
 interface/web/dashboard/lib/lang/hu_dashlet_modules.lng        |    1 
 interface/web/admin/lib/lang/de_server_config.lng              |    1 
 interface/web/dashboard/lib/lang/ca_dashlet_modules.lng        |    1 
 server/plugins-available/apache2_plugin.inc.php                |   31 ++++-
 interface/web/dashboard/lib/lang/cz_dashlet_modules.lng        |    1 
 interface/web/dashboard/lib/lang/sk_dashlet_modules.lng        |    1 
 server/plugins-available/nginx_plugin.inc.php                  |   31 ++++-
 install/sql/incremental/upd_0082.sql                           |    1 
 interface/web/dashboard/lib/lang/pt_dashlet_modules.lng        |    1 
 interface/web/client/templates/client_template_edit_limits.htm |    2 
 interface/web/dashboard/lib/lang/de_dashlet_modules.lng        |    1 
 interface/web/dashboard/lib/lang/nl_dashlet_modules.lng        |    1 
 interface/web/sites/web_vhost_domain_edit.php                  |    1 
 interface/web/dashboard/lib/lang/id_dashlet_modules.lng        |    1 
 interface/web/dashboard/lib/lang/it_dashlet_modules.lng        |    1 
 server/conf/apache_ispconfig.conf.master                       |   13 +-
 interface/web/client/form/client.tform.php                     |   16 --
 interface/web/admin/templates/system_config_domains_edit.htm   |   12 +-
 interface/web/dashboard/lib/lang/br_dashlet_modules.lng        |    1 
 interface/web/dashboard/lib/lang/bg_dashlet_modules.lng        |    1 
 interface/web/admin/lib/lang/en_server_config.lng              |    1 
 interface/web/dashboard/lib/lang/es_dashlet_modules.lng        |    1 
 interface/web/dashboard/lib/lang/fi_dashlet_modules.lng        |    1 
 interface/web/dashboard/lib/lang/pl_dashlet_modules.lng        |    1 
 install/install.php                                            |    5 
 interface/web/dns/form/dns_alias.tform.php                     |    2 
 interface/web/dashboard/lib/lang/hr_dashlet_modules.lng        |    1 
 interface/lib/classes/tform_base.inc.php                       |   19 +++
 interface/web/dashboard/lib/lang/tr_dashlet_modules.lng        |    1 
 interface/web/dashboard/lib/lang/fr_dashlet_modules.lng        |    1 
 interface/web/client/form/reseller.tform.php                   |   16 --
 interface/web/dashboard/lib/lang/ar_dashlet_modules.lng        |    1 
 interface/web/dashboard/lib/lang/ru_dashlet_modules.lng        |    1 
 46 files changed, 181 insertions(+), 118 deletions(-)

diff --git a/install/install.php b/install/install.php
index 1d0e515..cff2265 100644
--- a/install/install.php
+++ b/install/install.php
@@ -344,12 +344,13 @@
 		$conf['services']['dns'] = true;
 	}
 */
+
 	//* Configure Bind
 	if($conf['bind']['installed']) {
 		swriteln('Configuring BIND');
 		$inst->configure_bind();
 		$conf['services']['dns'] = true;
-		if(!$inst->find_installed_apps('haveged')) {
+		if(!is_installed('haveged')) {
 			swriteln("[INFO] haveged not detected - DNSSEC can fail");
 		}
 	}
@@ -732,7 +733,7 @@
 			swriteln('Configuring BIND');
 			$inst->configure_bind();
 			$conf['services']['dns'] = true;
-			if(!$inst->find_installed_apps('haveged')) {
+			if(!is_installed('haveged')) {
 				swriteln("[INFO] haveged not detected - DNSSEC can fail");
 			}
 		}
diff --git a/install/sql/incremental/upd_0082.sql b/install/sql/incremental/upd_0082.sql
new file mode 100644
index 0000000..f21e06d
--- /dev/null
+++ b/install/sql/incremental/upd_0082.sql
@@ -0,0 +1 @@
+ALTER TABLE `directive_snippets` ADD `master_directive_snippets_id` int(11) unsigned NOT NULL DEFAULT '0' AFTER `active`;
\ No newline at end of file
diff --git a/install/tpl/apache_ispconfig.vhost.master b/install/tpl/apache_ispconfig.vhost.master
index 4503811..6b71378 100644
--- a/install/tpl/apache_ispconfig.vhost.master
+++ b/install/tpl/apache_ispconfig.vhost.master
@@ -8,101 +8,111 @@
 
 <VirtualHost _default_:<tmpl_var name="vhost_port">>
   ServerAdmin webmaster@localhost
-  
+
   <FilesMatch "\.ph(p3?|tml)$">
     SetHandler None
   </FilesMatch>
-  
+
   <IfModule mod_fcgid.c>
     DocumentRoot /var/www/ispconfig/
     SuexecUserGroup ispconfig ispconfig
     <Directory /var/www/ispconfig/>
       Options -Indexes +FollowSymLinks +MultiViews +ExecCGI
       AllowOverride AuthConfig Indexes Limit Options FileInfo
-	  <FilesMatch "\.php$">
-		  SetHandler fcgid-script
-	  </FilesMatch>
+      <FilesMatch "\.php$">
+        SetHandler fcgid-script
+      </FilesMatch>
       FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php
       <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
-	  Require all granted
-	  <tmpl_else>
+      Require all granted
+      <tmpl_else>
       Order allow,deny
       Allow from all
-	  </tmpl_if>
+      </tmpl_if>
     </Directory>
     IPCCommTimeout  7200
-	MaxRequestLen 15728640
+    MaxRequestLen 15728640
   </IfModule>
-  
+
   <IfModule mpm_itk_module>
     DocumentRoot /usr/local/ispconfig/interface/web/
-	AssignUserId ispconfig ispconfig
+    AssignUserId ispconfig ispconfig
     AddType application/x-httpd-php .php
     <Directory /usr/local/ispconfig/interface/web>
       # php_admin_value open_basedir "/usr/local/ispconfig/interface:/usr/share:/tmp"
       Options +FollowSymLinks
       AllowOverride None
       <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
-	  Require all granted
-	  <tmpl_else>
+      Require all granted
+      <tmpl_else>
       Order allow,deny
       Allow from all
-	  </tmpl_if>
-	  php_value magic_quotes_gpc        0
+      </tmpl_if>
+      php_value magic_quotes_gpc        0
     </Directory>
   </IfModule>
-  
+
   # ErrorLog /var/log/apache2/error.log
   # CustomLog /var/log/apache2/access.log combined
   ServerSignature Off
-  
+
   <IfModule mod_security2.c>
     SecRuleEngine Off
   </IfModule>
 
   # SSL Configuration
   <tmpl_var name="ssl_comment">SSLEngine On
+  <tmpl_if name='apache_version' op='>=' value='2.3.16' format='version'>
+  <tmpl_var name="ssl_comment">SSLProtocol All -SSLv3
+  <tmpl_else>
   <tmpl_var name="ssl_comment">SSLProtocol All -SSLv2 -SSLv3
+  </tmpl_if>
   <tmpl_var name="ssl_comment">SSLCertificateFile /usr/local/ispconfig/interface/ssl/ispserver.crt
   <tmpl_var name="ssl_comment">SSLCertificateKeyFile /usr/local/ispconfig/interface/ssl/ispserver.key
   <tmpl_var name="ssl_bundle_comment">SSLCACertificateFile /usr/local/ispconfig/interface/ssl/ispserver.bundle
 
-  <tmpl_var name="ssl_comment">SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4
+  <tmpl_var name="ssl_comment">SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
   <tmpl_var name="ssl_comment">SSLHonorCipherOrder On
+  <tmpl_if name='apache_version' op='>=' value='2.4.3' format='version'>
+  <tmpl_var name="ssl_comment">SSLCompression Off
+  </tmpl_if>
+  <tmpl_if name='apache_version' op='>=' value='2.4.11' format='version'>
+  <tmpl_var name="ssl_comment">SSLSessionTickets Off
+  </tmpl_if>
 
   <IfModule mod_headers.c>
     Header always add Strict-Transport-Security "max-age=15768000"
   </IfModule>
 
-<tmpl_if name='apache_version' op='>=' value='2.4' format='version'>
-  <tmpl_var name="ssl_comment">SSLUseStapling on
+  <tmpl_if name='apache_version' op='>=' value='2.3.3' format='version'>
+  <tmpl_var name="ssl_comment">SSLUseStapling On
   <tmpl_var name="ssl_comment">SSLStaplingResponderTimeout 5
-  <tmpl_var name="ssl_comment">SSLStaplingReturnResponderErrors off
-</tmpl_if>
+  <tmpl_var name="ssl_comment">SSLStaplingReturnResponderErrors Off
+  </tmpl_if>
 </VirtualHost>
 
-<tmpl_if name='apache_version' op='>=' value='2.4' format='version'>
+<tmpl_if name='apache_version' op='>=' value='2.3.3' format='version'>
 <IfModule mod_ssl.c>
   <tmpl_var name="ssl_comment">SSLStaplingCache shmcb:/var/run/ocsp(128000)
 </IfModule>
 </tmpl_if>
 
 <Directory /var/www/php-cgi-scripts>
-    AllowOverride None
-	<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
-	Require all denied
-	<tmpl_else>
-    Order Deny,Allow
-    Deny from all
-	</tmpl_if>
+  AllowOverride None
+  <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
+  Require all denied
+  <tmpl_else>
+  Order Deny,Allow
+  Deny from all
+  </tmpl_if>
 </Directory>
 
 <Directory /var/www/php-fcgi-scripts>
-    AllowOverride None
-    <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
-	Require all denied
-	<tmpl_else>
-    Order Deny,Allow
-    Deny from all
-	</tmpl_if>
-</Directory>
\ No newline at end of file
+  AllowOverride None
+  <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
+  Require all denied
+  <tmpl_else>
+  Order Deny,Allow
+  Deny from all
+  </tmpl_if>
+</Directory>
diff --git a/install/update.php b/install/update.php
index 2dcb53d..94de945 100644
--- a/install/update.php
+++ b/install/update.php
@@ -378,7 +378,7 @@
 		} elseif($conf['bind']['installed'] == true) {
 			swriteln('Configuring BIND');
 			$inst->configure_bind();
-			if(!$inst->find_installed_apps('haveged')) {
+			if(!is_installed('haveged')) {
 				swriteln("[INFO] haveged not detected - DNSSEC can fail");
 			}
 		} else {
diff --git a/interface/lib/classes/json_handler.inc.php b/interface/lib/classes/json_handler.inc.php
index 1df5898..d6d58c3 100644
--- a/interface/lib/classes/json_handler.inc.php
+++ b/interface/lib/classes/json_handler.inc.php
@@ -91,7 +91,7 @@
 
 		if(is_array($_POST)) {
 			foreach($_POST as $key => $val) {
-				$tmp = json_decode($val);
+				$tmp = json_decode($val, true);
 				if(!$tmp) $params[] = $val;
 				else $params[] = (array)$tmp;
 			}
diff --git a/interface/lib/classes/tform_base.inc.php b/interface/lib/classes/tform_base.inc.php
index 1739c1f..599cce4 100644
--- a/interface/lib/classes/tform_base.inc.php
+++ b/interface/lib/classes/tform_base.inc.php
@@ -831,7 +831,7 @@
 				}
 
 				//* Add slashes to all records, when we encode data which shall be inserted into mysql.
-				if($dbencode == true) $new_record[$key] = $app->db->quote($new_record[$key]);
+				if($dbencode == true && !is_null($new_record[$key])) $new_record[$key] = $app->db->quote($new_record[$key]);
 			}
 		}
 		return $new_record;
@@ -973,13 +973,22 @@
 						$this->errorMessage .= $errmsg."<br />\r\n";
 					}
 				}
+				break;
 			case 'ISEMAIL':
+				$error = false;
 				if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
 				if($validator['allowempty'] == 'y' && $field_value == '') {
 					//* Do nothing
 				} else {
 					if(function_exists('filter_var')) {
 						if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) {
+							$error = true;
+						} else {
+							if (!preg_match("/^[^\\+]+$/", $field_value)) { // * disallow + in local-part
+								$error = true;
+							}
+						}
+						if ($error) {
 							$errmsg = $validator['errmsg'];
 							if(isset($this->wordbook[$errmsg])) {
 								$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
@@ -987,8 +996,10 @@
 								$this->errorMessage .= $errmsg."<br />\r\n";
 							}
 						}
+
 					} else $this->errorMessage .= "function filter_var missing <br />\r\n";
 				}
+				unset($error);
 				break;
 			case 'ISINT':
 				if(function_exists('filter_var') && $field_value < 2147483647) {
@@ -1028,7 +1039,7 @@
 				break;
 			case 'V6PREFIXLENGTH':
 				// find shortes ipv6 subnet can`t be longer
-				$sql_v6 = $app->db->queryOneRecord("SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND virtualhost = 'y' ORDER BY CHAR_LENGTH(ip_address) ASC LIMIT 0,1;");
+				$sql_v6 = $app->db->queryOneRecord("SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND virtualhost = 'y' ORDER BY CHAR_LENGTH(ip_address) ASC LIMIT 0,1");
 				$sql_v6_explode=explode(':',$sql_v6['ip_address']);
 				$explode_field_value = explode(':',$field_value);
 				if (count($sql_v6_explode) < count($explode_field_value) && isset($sql_v6['ip_address'])) {
@@ -1233,7 +1244,7 @@
 							}
 						} else {
 							$sql_insert_key .= "`$key`, ";
-							$sql_insert_val .= "'".$record[$key]."', ";
+							$sql_insert_val .= (is_null($record[$key]) ? 'NULL' : "'".$record[$key]."'") . ", ";
 						}
 					} else {
 						if($field['formtype'] == 'PASSWORD') {
@@ -1260,7 +1271,7 @@
 								$sql_update .= "`$key` = '".$record[$key]."', ";
 							}
 						} else {
-							$sql_update .= "`$key` = '".$record[$key]."', ";
+							$sql_update .= "`$key` = " . (is_null($record[$key]) ? 'NULL' : "'".$record[$key]."'") . ", ";
 						}
 					}
 				} else {
diff --git a/interface/web/admin/lib/lang/de_server_config.lng b/interface/web/admin/lib/lang/de_server_config.lng
index 6d3342c..c9fc989 100644
--- a/interface/web/admin/lib/lang/de_server_config.lng
+++ b/interface/web/admin/lib/lang/de_server_config.lng
@@ -173,6 +173,7 @@
 $wb['backup_mode_txt'] = 'Backupmodus';
 $wb['backup_mode_userzip'] = 'Backup Dateien gehören dem Web Benutzer (.zip Datei)';
 $wb['backup_mode_rootgz'] = 'Backup aller Dateien des Webverzeichnisses als Root Benutzer';
+$wb['backup_time_txt'] = 'Backupzeit';
 $wb['firewall_txt'] = 'Firewall';
 $wb['mailbox_quota_stats_txt'] = 'E-Mailkonto Beschränkung Statistiken';
 $wb['enable_ip_wildcard_txt'] = 'IP Adressen Wildcard (*) aktivieren';
diff --git a/interface/web/admin/lib/lang/en_server_config.lng b/interface/web/admin/lib/lang/en_server_config.lng
index 19b08f1..c464ff9 100644
--- a/interface/web/admin/lib/lang/en_server_config.lng
+++ b/interface/web/admin/lib/lang/en_server_config.lng
@@ -101,6 +101,7 @@
 $wb["backup_mode_txt"] = 'Backup mode';
 $wb["backup_mode_userzip"] = 'Backup web files owned by web user as zip';
 $wb["backup_mode_rootgz"] = 'Backup all files in web directory as root user';
+$wb["backup_time_txt"] = 'Backup time';
 $wb["server_type_txt"] = 'Server Type';
 $wb["nginx_vhost_conf_dir_txt"] = 'Nginx Vhost config dir';
 $wb["nginx_vhost_conf_enabled_dir_txt"] = 'Nginx Vhost config enabled dir';
diff --git a/interface/web/admin/templates/system_config_domains_edit.htm b/interface/web/admin/templates/system_config_domains_edit.htm
index c651e42..95cc33b 100644
--- a/interface/web/admin/templates/system_config_domains_edit.htm
+++ b/interface/web/admin/templates/system_config_domains_edit.htm
@@ -6,13 +6,13 @@
 <tmpl_if name="list_desc_txt"><p><tmpl_var name="list_desc_txt"></p></tmpl_if>
 
             <div class="form-group">
-                <div style="float:left;width:100%">
-                    <p class="label" style="width:270px">{tmpl_var name='use_domain_module_txt'}</p>
-                    <div class="col-sm-9">
-                        {tmpl_var name='use_domain_module'}
-                    </div>
+                <div class="col-sm-3 text-right">
+                    {tmpl_var name='use_domain_module'}
                 </div>
-                <div style="float:left;width:500px;margin-top:20px">{tmpl_var name='use_domain_module_hint'}</div>
+                <div class="col-sm-9">
+                    <p><strong>{tmpl_var name='use_domain_module_txt'}</strong></p>
+                    <p>{tmpl_var name='use_domain_module_hint'}</p>
+                </div>
             </div>
             <div class="form-group">
                 <label class="col-sm-3 control-label">{tmpl_var name='new_domain_txt'}</label>
diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php
index 34cdd2e..3a8d4f2 100644
--- a/interface/web/client/form/client.tform.php
+++ b/interface/web/client/form/client.tform.php
@@ -594,9 +594,7 @@
 				'class'=> 'custom_datasource',
 				'function'=> 'client_servers'
 			),
-			'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-					'errmsg'=> 'no_mail_server_error'),
-				1 => array ( 'type' => 'CUSTOM',
+			'validators'    => array (  0 => array ( 'type' => 'CUSTOM',
 					'class' => 'validate_client',
 					'function' => 'check_used_servers',
 					'errmsg'=> 'mail_servers_used'),
@@ -919,9 +917,7 @@
 				'class'=> 'custom_datasource',
 				'function'=> 'client_servers'
 			),
-			'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-					'errmsg'=> 'no_web_server_error'),
-				1 => array ( 'type' => 'CUSTOM',
+			'validators'    => array (  0 => array ( 'type' => 'CUSTOM',
 					'class' => 'validate_client',
 					'function' => 'check_used_servers',
 					'errmsg'=> 'web_servers_used'),
@@ -1141,9 +1137,7 @@
 				'class'=> 'custom_datasource',
 				'function'=> 'client_servers'
 			),
-			'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-					'errmsg'=> 'no_dns_server_error'),
-				1 => array ( 'type' => 'CUSTOM',
+			'validators'    => array (  0 => array ( 'type' => 'CUSTOM',
 					'class' => 'validate_client',
 					'function' => 'check_used_servers',
 					'errmsg'=> 'dns_servers_used'),
@@ -1238,9 +1232,7 @@
 				'class'=> 'custom_datasource',
 				'function'=> 'client_servers'
 			),
-			'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-					'errmsg'=> 'no_db_server_error'),
-				1 => array ( 'type' => 'CUSTOM',
+			'validators'    => array (  0 => array ( 'type' => 'CUSTOM',
 					'class' => 'validate_client',
 					'function' => 'check_used_servers',
 					'errmsg'=> 'db_servers_used'),
diff --git a/interface/web/client/form/reseller.tform.php b/interface/web/client/form/reseller.tform.php
index b41cd53..1c60597 100644
--- a/interface/web/client/form/reseller.tform.php
+++ b/interface/web/client/form/reseller.tform.php
@@ -593,9 +593,7 @@
 				'keyfield'=> 'server_id',
 				'valuefield'=> 'server_name'
 			),
-			'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-					'errmsg'=> 'no_mail_server_error'),
-				1 => array ( 'type' => 'CUSTOM',
+			'validators'    => array (  0 => array ( 'type' => 'CUSTOM',
 					'class' => 'validate_client',
 					'function' => 'check_used_servers',
 					'errmsg'=> 'mail_servers_used'),
@@ -918,9 +916,7 @@
 				'keyfield'=> 'server_id',
 				'valuefield'=> 'server_name'
 			),
-			'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-					'errmsg'=> 'no_web_server_error'),
-				1 => array ( 'type' => 'CUSTOM',
+			'validators'    => array (  0 => array ( 'type' => 'CUSTOM',
 					'class' => 'validate_client',
 					'function' => 'check_used_servers',
 					'errmsg'=> 'web_servers_used'),
@@ -1138,9 +1134,7 @@
 				'keyfield'=> 'server_id',
 				'valuefield'=> 'server_name'
 			),
-			'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-					'errmsg'=> 'no_dns_server_error'),
-				1 => array ( 'type' => 'CUSTOM',
+			'validators'    => array (  0 => array ( 'type' => 'CUSTOM',
 					'class' => 'validate_client',
 					'function' => 'check_used_servers',
 					'errmsg'=> 'dns_servers_used'),
@@ -1238,9 +1232,7 @@
 				'keyfield'=> 'server_id',
 				'valuefield'=> 'server_name'
 			),
-			'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-					'errmsg'=> 'no_db_server_error'),
-				1 => array ( 'type' => 'CUSTOM',
+			'validators'    => array (  0 => array ( 'type' => 'CUSTOM',
 					'class' => 'validate_client',
 					'function' => 'check_used_servers',
 					'errmsg'=> 'db_servers_used'),
diff --git a/interface/web/client/templates/client_template_edit_limits.htm b/interface/web/client/templates/client_template_edit_limits.htm
index 5e0abb9..6a09bb6 100644
--- a/interface/web/client/templates/client_template_edit_limits.htm
+++ b/interface/web/client/templates/client_template_edit_limits.htm
@@ -138,7 +138,7 @@
         </a>
       </h4>
     </div>
-    <div id="collapseMail" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingMail>
+    <div id="collapseMail" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingMail">
       <div class="panel-body">
                 <div class="form-group">
                     <label for="limit_maildomain" class="col-sm-3 control-label">{tmpl_var name='limit_maildomain_txt'}</label>
diff --git a/interface/web/client/templates/domain_list.htm b/interface/web/client/templates/domain_list.htm
index 825b298..8dda689 100644
--- a/interface/web/client/templates/domain_list.htm
+++ b/interface/web/client/templates/domain_list.htm
@@ -45,10 +45,10 @@
 
             <tfoot>
                 <tr>
-                    <td colspan="4"><tmpl_var name="paging"></td>
+                    <td colspan="3"><tmpl_var name="paging"></td>
                 </tr>
             </tfoot>
             </table>
 </div>
         
-    
\ No newline at end of file
+    
diff --git a/interface/web/dashboard/dashlets/templates/modules.htm b/interface/web/dashboard/dashlets/templates/modules.htm
index d42bf2e..0c7322b 100644
--- a/interface/web/dashboard/dashlets/templates/modules.htm
+++ b/interface/web/dashboard/dashlets/templates/modules.htm
@@ -9,8 +9,8 @@
 				<div class='title'>{tmpl_var name='modules_title'}</div>
 			  </div>
 			</div>
-			<a href='#' class='btn btn-default button' data-capp='{tmpl_var name="modules_name"}'>Go to {tmpl_var name='modules_title'}</a>
+			<a href='#' class='btn btn-default button' data-capp='{tmpl_var name="modules_name"}'>{tmpl_var name='go_to_txt'} {tmpl_var name='modules_title'}</a>
 		</li>
 	</tmpl_loop>
 	</ul>
-	</div>
\ No newline at end of file
+	</div>
diff --git a/interface/web/dashboard/lib/lang/ar_dashlet_modules.lng b/interface/web/dashboard/lib/lang/ar_dashlet_modules.lng
index 6a02127..af9fb02 100644
--- a/interface/web/dashboard/lib/lang/ar_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/ar_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Available Modules';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/bg_dashlet_modules.lng b/interface/web/dashboard/lib/lang/bg_dashlet_modules.lng
index 2b0f0e2..6e6cd61 100644
--- a/interface/web/dashboard/lib/lang/bg_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/bg_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Налични Модули';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/br_dashlet_modules.lng b/interface/web/dashboard/lib/lang/br_dashlet_modules.lng
index 11268f7..fab0506 100644
--- a/interface/web/dashboard/lib/lang/br_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/br_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Módulos Disponíveis';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/ca_dashlet_modules.lng b/interface/web/dashboard/lib/lang/ca_dashlet_modules.lng
index 4d6a5d8..f8f0818 100644
--- a/interface/web/dashboard/lib/lang/ca_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/ca_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Modules disponibles';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/cz_dashlet_modules.lng b/interface/web/dashboard/lib/lang/cz_dashlet_modules.lng
index 66275f1..25198e1 100644
--- a/interface/web/dashboard/lib/lang/cz_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/cz_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Dostupné moduly';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/de_dashlet_modules.lng b/interface/web/dashboard/lib/lang/de_dashlet_modules.lng
index 3d2c6c6..0ac708c 100644
--- a/interface/web/dashboard/lib/lang/de_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/de_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Verfügbare Module';
+$wb['go_to_txt'] = 'Gehe zu';
 ?>
diff --git a/interface/web/dashboard/lib/lang/el_dashlet_modules.lng b/interface/web/dashboard/lib/lang/el_dashlet_modules.lng
index 95f750a..6f2064f 100644
--- a/interface/web/dashboard/lib/lang/el_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/el_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Διαθέσιμα αρθρώματα';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/en_dashlet_modules.lng b/interface/web/dashboard/lib/lang/en_dashlet_modules.lng
index 4bc94f7..ef088a3 100644
--- a/interface/web/dashboard/lib/lang/en_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/en_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = "Available Modules";
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/es_dashlet_modules.lng b/interface/web/dashboard/lib/lang/es_dashlet_modules.lng
index 66987b2..d567f09 100755
--- a/interface/web/dashboard/lib/lang/es_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/es_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Módulos disponibles';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/fi_dashlet_modules.lng b/interface/web/dashboard/lib/lang/fi_dashlet_modules.lng
index 6a02127..af9fb02 100644
--- a/interface/web/dashboard/lib/lang/fi_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/fi_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Available Modules';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/fr_dashlet_modules.lng b/interface/web/dashboard/lib/lang/fr_dashlet_modules.lng
index 4d6a5d8..f8f0818 100644
--- a/interface/web/dashboard/lib/lang/fr_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/fr_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Modules disponibles';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/hr_dashlet_modules.lng b/interface/web/dashboard/lib/lang/hr_dashlet_modules.lng
index 76f2a1f..3798185 100644
--- a/interface/web/dashboard/lib/lang/hr_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/hr_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Dostupni moduli';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/hu_dashlet_modules.lng b/interface/web/dashboard/lib/lang/hu_dashlet_modules.lng
index 8d6a994..f5d38b5 100644
--- a/interface/web/dashboard/lib/lang/hu_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/hu_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Elérhető Modulok';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/id_dashlet_modules.lng b/interface/web/dashboard/lib/lang/id_dashlet_modules.lng
index 6a3a48c..7ce7159 100644
--- a/interface/web/dashboard/lib/lang/id_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/id_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Modul yang tersedia';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/it_dashlet_modules.lng b/interface/web/dashboard/lib/lang/it_dashlet_modules.lng
index d9e5cd8..69d5c07 100644
--- a/interface/web/dashboard/lib/lang/it_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/it_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Moduli disponibili';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/ja_dashlet_modules.lng b/interface/web/dashboard/lib/lang/ja_dashlet_modules.lng
index 6a02127..af9fb02 100644
--- a/interface/web/dashboard/lib/lang/ja_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/ja_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Available Modules';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/nl_dashlet_modules.lng b/interface/web/dashboard/lib/lang/nl_dashlet_modules.lng
index 5b8067f..4788b7d 100644
--- a/interface/web/dashboard/lib/lang/nl_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/nl_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Beschikbare modules';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/pl_dashlet_modules.lng b/interface/web/dashboard/lib/lang/pl_dashlet_modules.lng
index fafcc61..6f9b955 100644
--- a/interface/web/dashboard/lib/lang/pl_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/pl_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Dostępne moduły';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/pt_dashlet_modules.lng b/interface/web/dashboard/lib/lang/pt_dashlet_modules.lng
index 6a02127..af9fb02 100644
--- a/interface/web/dashboard/lib/lang/pt_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/pt_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Available Modules';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/ro_dashlet_modules.lng b/interface/web/dashboard/lib/lang/ro_dashlet_modules.lng
index 6a02127..af9fb02 100644
--- a/interface/web/dashboard/lib/lang/ro_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/ro_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Available Modules';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/ru_dashlet_modules.lng b/interface/web/dashboard/lib/lang/ru_dashlet_modules.lng
index f33ae57..e4ff421 100644
--- a/interface/web/dashboard/lib/lang/ru_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/ru_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Доступные модули';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/se_dashlet_modules.lng b/interface/web/dashboard/lib/lang/se_dashlet_modules.lng
index a6f9728..4c77392 100644
--- a/interface/web/dashboard/lib/lang/se_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/se_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Tillgängliga moduler';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/sk_dashlet_modules.lng b/interface/web/dashboard/lib/lang/sk_dashlet_modules.lng
index 6a02127..af9fb02 100644
--- a/interface/web/dashboard/lib/lang/sk_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/sk_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Available Modules';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dashboard/lib/lang/tr_dashlet_modules.lng b/interface/web/dashboard/lib/lang/tr_dashlet_modules.lng
index 90de86f..c551510 100644
--- a/interface/web/dashboard/lib/lang/tr_dashlet_modules.lng
+++ b/interface/web/dashboard/lib/lang/tr_dashlet_modules.lng
@@ -1,3 +1,4 @@
 <?php
 $wb['available_modules_txt'] = 'Kullanılabilecek Modüller';
+$wb['go_to_txt'] = 'Go to';
 ?>
diff --git a/interface/web/dns/form/dns_alias.tform.php b/interface/web/dns/form/dns_alias.tform.php
index defcda0..55833b7 100644
--- a/interface/web/dns/form/dns_alias.tform.php
+++ b/interface/web/dns/form/dns_alias.tform.php
@@ -88,7 +88,7 @@
 			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
 					'errmsg'=> 'name_error_empty'),
 				1 => array ( 'type' => 'REGEX',
-					'regex' => '/^[a-zA-Z0-9\.\-]{1,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-\_]{1,255}$/',
 					'errmsg'=> 'name_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_soa.tform.php b/interface/web/dns/form/dns_soa.tform.php
index 05e9157..d76c403 100644
--- a/interface/web/dns/form/dns_soa.tform.php
+++ b/interface/web/dns/form/dns_soa.tform.php
@@ -137,7 +137,7 @@
 			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
 					'errmsg'=> 'mbox_error_empty'),
 				1 => array ( 'type' => 'REGEX',
-					'regex' => '/^[a-zA-Z0-9\.\-\_]{0,255}\.$/',
+					'regex' => '/^[a-zA-Z0-9\.\-\_\+]{0,255}\.$/',
 					'errmsg'=> 'mbox_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/sites/templates/web_sites_stats_list.htm b/interface/web/sites/templates/web_sites_stats_list.htm
index 7736ac3..3aa1775 100644
--- a/interface/web/sites/templates/web_sites_stats_list.htm
+++ b/interface/web/sites/templates/web_sites_stats_list.htm
@@ -31,10 +31,10 @@
                 <tmpl_loop name="records">
                     <tr>
                         <td><a target="_blank" href="http://{tmpl_var name="domain"}/stats">{tmpl_var name="domain"}</a></td>
-                        <td><a href="#" data-load-content="sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="this_month"} MB</a></td>
-                        <td><a href="#" data-load-content="sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="last_month"} MB</a></td>
-                        <td><a href="#" data-load-content="sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="this_year"} MB</a></td>
-                        <td><a href="#" data-load-content="sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="last_year"} MB</a></td>
+                        <td><a href="#" data-load-content="sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="this_month"}</a></td>
+                        <td><a href="#" data-load-content="sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="last_month"}</a></td>
+                        <td><a href="#" data-load-content="sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="this_year"}</a></td>
+                        <td><a href="#" data-load-content="sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="last_year"}</a></td>
                         <td class="text-right"></td>
                     </tr>
                 </tmpl_loop>
@@ -45,10 +45,10 @@
                 </tmpl_unless>
                     <tr>
                         <td><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_txt"}</a></td>
-                        <td><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_this_month"} MB</a></td>
-                        <td><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_last_month"} MB</a></td>
-                        <td><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_this_year"} MB</a></td>
-                        <td><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_last_year"} MB</a></td>
+                        <td><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_this_month"}</a></td>
+                        <td><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_last_month"}</a></td>
+                        <td><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_this_year"}</a></td>
+                        <td><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_last_year"}</a></td>
                         <td class="text-right"></td>
                     </tr>
                 </tbody>
diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php
index 7d6f17a..3da4823 100644
--- a/interface/web/sites/web_vhost_domain_edit.php
+++ b/interface/web/sites/web_vhost_domain_edit.php
@@ -757,6 +757,7 @@
 		 * Now we have to check, if we should use the domain-module to select the domain
 		 * or not
 		 */
+		$settings = $app->getconf->get_global_config('domains');
 		if ($settings['use_domain_module'] == 'y') {
 			/*
 			 * The domain-module is in use.
diff --git a/server/conf/apache_ispconfig.conf.master b/server/conf/apache_ispconfig.conf.master
index c965e3f..79acb9c 100644
--- a/server/conf/apache_ispconfig.conf.master
+++ b/server/conf/apache_ispconfig.conf.master
@@ -6,6 +6,12 @@
 LogFormat "%v %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_ispconfig
 CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m%d-access.log\" /var/log/ispconfig/httpd" combined_ispconfig
 
+<IfModule mod_headers.c>
+	<LocationMatch "/.well-known/acme-challenge/*">
+		Header set Content-Type "text/plain"
+	</LocationMatch>
+</IfModule>
+
 <Directory /var/www/clients>
     AllowOverride None
 	<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
@@ -14,13 +20,6 @@
 	Order Deny,Allow
 	Deny from all
 	</tmpl_if>
-
- <IfModule mod_headers.c>
-    <LocationMatch "/.well-known/acme-challenge/*">
-      Header set Content-Type "text/plain"
-    </LocationMatch>
-  </IfModule>
-
 </Directory>
 
 # Do not allow access to the root file system of the server for security reasons
diff --git a/server/conf/nginx_vhost.conf.master b/server/conf/nginx_vhost.conf.master
index 67f1ee0..f057088 100644
--- a/server/conf/nginx_vhost.conf.master
+++ b/server/conf/nginx_vhost.conf.master
@@ -263,8 +263,8 @@
         }
 </tmpl_if>
 
-location /\.well-known/acme-challenge {
-	   root /usr/local/ispconfig/interface/acme/.well-known/acme-challenge;
+location ~ /\.well-known/acme-challenge/ {
+	   root /usr/local/ispconfig/interface/acme/;
 	   index index.html index.htm;
 	   try_files $uri =404;
 }
@@ -301,8 +301,8 @@
         
         server_name <tmpl_var name='rewrite_domain'>;
 
-location /\.well-known/acme-challenge {
-	   root /usr/local/ispconfig/interface/acme-challenge;
+location ~ /\.well-known/acme-challenge/ {
+	   root /usr/local/ispconfig/interface/acme/;
 	   index index.html index.htm;
 	   try_files $uri =404;
 }
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index f7dd300..34623c6 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -1232,11 +1232,22 @@
 			//* check if we have already a Let's Encrypt cert
 			if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
 				$app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
-
+				
+				$success = false;
 				if(file_exists("/root/.local/share/letsencrypt/bin/letsencrypt")) {
-					$this->_exec("/root/.local/share/letsencrypt/bin/letsencrypt auth --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("/root/.local/share/letsencrypt/bin/letsencrypt auth --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");
 				}
-			};
+				if(!$success) {
+					// error issuing cert
+					$app->log('Let\'s Encrypt SSL Cert for: ' . $domain . ' could not be issued.', LOGLEVEL_WARN);
+					$data['new']['ssl_letsencrypt'] = 'n';
+					if($data['old']['ssl'] == 'n') $data['new']['ssl'] = 'n';
+					/* Update the DB of the (local) Server */
+					$app->db->query("UPDATE web_domain SET `ssl` = ?, `ssl_letsencrypt` = ? WHERE `domain` = ?", $data['new']['ssl'], 'n', $data['new']['domain']);
+					/* 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)) {
@@ -1279,11 +1290,11 @@
 
 				/* we don't need to store it.
 				/* Update the DB of the (local) Server */
-				$app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key' WHERE domain = '".$data['new']['domain']."'");
-				$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+				$app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = ?", $data['new']['domain']);
+				$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']);
 				/* Update also the master-DB of the Server-Farm */
-				$app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key' WHERE domain = '".$data['new']['domain']."'");
-				$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+				$app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = ?", $data['new']['domain']);
+				$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']);
 			}
 		}
 
@@ -3363,8 +3374,12 @@
 	//* Wrapper for exec function for easier debugging
 	private function _exec($command) {
 		global $app;
+		$out = array();
+		$ret = 0;
 		$app->log('exec: '.$command, LOGLEVEL_DEBUG);
-		exec($command);
+		exec($command, $out, $ret);
+		if($ret != 0) return false;
+		else return true;
 	}
 
 	private function _checkTcp ($host, $port) {
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 2a49504..1c5247d 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -1310,11 +1310,22 @@
 			//* check if we have already a Let's Encrypt cert
 			if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
 				$app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
-
+				
+				$success = false;
 				if(file_exists("/root/.local/share/letsencrypt/bin/letsencrypt")) {
-					$this->_exec("/root/.local/share/letsencrypt/bin/letsencrypt auth --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("/root/.local/share/letsencrypt/bin/letsencrypt auth --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");
 				}
-			};
+				if(!$success) {
+					// error issuing cert
+					$app->log('Let\'s Encrypt SSL Cert for: ' . $domain . ' could not be issued.', LOGLEVEL_WARN);
+					$data['new']['ssl_letsencrypt'] = 'n';
+					if($data['old']['ssl'] == 'n') $data['new']['ssl'] = 'n';
+					/* Update the DB of the (local) Server */
+					$app->db->query("UPDATE web_domain SET `ssl` = ?, `ssl_letsencrypt` = ? WHERE `domain` = ?", $data['new']['ssl'], 'n', $data['new']['domain']);
+					/* 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)) {
@@ -1346,11 +1357,11 @@
 
 				/* we don't need to store it.
 				/* Update the DB of the (local) Server */
-				$app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = '".$data['new']['domain']."'");
-				$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+				$app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = ?", $data['new']['domain']);
+				$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']);
 				/* Update also the master-DB of the Server-Farm */
-				$app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = '".$data['new']['domain']."'");
-				$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+				$app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = ?", $data['new']['domain']);
+				$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']);
 			}
 		};
 
@@ -3103,8 +3114,12 @@
 	//* Wrapper for exec function for easier debugging
 	private function _exec($command) {
 		global $app;
+		$out = array();
+		$ret = 0;
 		$app->log('exec: '.$command, LOGLEVEL_DEBUG);
-		exec($command);
+		exec($command, $out, $ret);
+		if($ret != 0) return false;
+		else return true;
 	}
 
 	private function _checkTcp ($host, $port) {

--
Gitblit v1.9.1