Просмотр исходного кода

Fixed nameserver validation on add new user packages

Raphael Schneeberger 6 лет назад
Родитель
Сommit
a29ab989f0
2 измененных файлов с 7 добавлено и 2 удалено
  1. 1 0
      CHANGELOG.md
  2. 6 2
      web/add/package/index.php

+ 1 - 0
CHANGELOG.md

@@ -38,6 +38,7 @@ All notable changes to this project will be documented in this file.
 - Fixed issue #569 Remote backup hostname would reject ip addr without reverse dns (PTR record).
 - Create a couple of writeable folders in each user home directory (#580).
 - Added gnupg2 check to prevent issues with pubkey installation.
+- Fixed nameserver validation on add new user packages.
 
 ## [1.0.5] - 2019-08-06 - Hotfix
 ### Bugfixes

+ 6 - 2
web/add/package/index.php

@@ -43,8 +43,12 @@ if (!empty($_POST['ok'])) {
     if (!isset($_POST['v_backups'])) $errors[] = __('backups');
     if (!isset($_POST['v_disk_quota'])) $errors[] = __('quota');
     if (!isset($_POST['v_bandwidth'])) $errors[] = __('bandwidth');
-    if (empty($_POST['v_ns1'])) $errors[] = __('ns1');
-    if (empty($_POST['v_ns2'])) $errors[] = __('ns2');
+    
+    // Check if name server entries are blank if DNS server is installed
+    if ((isset($_SESSION['DNS_SYSTEM'])) && (!empty($_SESSION['DNS_SYSTEM']))) {
+        if (empty($_POST['v_ns1'])) $errors[] = __('ns1');
+        if (empty($_POST['v_ns2'])) $errors[] = __('ns2');
+    }
     if (!empty($errors[0])) {
         foreach ($errors as $i => $error) {
             if ( $i == 0 ) {