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

Fixes issue with pointing custom docroot to default

Jaap Marcus 5 лет назад
Родитель
Сommit
63525df309
1 измененных файлов с 16 добавлено и 12 удалено
  1. 16 12
      web/edit/web/index.php

+ 16 - 12
web/edit/web/index.php

@@ -757,19 +757,23 @@ if (!empty($_POST['save'])) {
         unset($_POST['v-custom-doc-domain'], $_POST['v-custom-doc-folder']);    
     }
 
-    if ( !empty($_POST['v-custom-doc-domain']) && !empty($_POST['v_custom_doc_root_check']) && $v_custom_doc_root_prepath.$v_custom_doc_domain.'/public_html'.$v_custom_doc_folder != $v_custom_doc_root || ($_POST['v-custom-doc-domain'] == $v_domain && !empty($_POST['v-custom-doc-folder']))){
-        
-        $v_custom_doc_domain = escapeshellarg($_POST['v-custom-doc-domain']);
-        $v_custom_doc_folder = escapeshellarg($_POST['v-custom-doc-folder']);
-        
-        exec(HESTIA_CMD."v-change-web-domain-docroot ".$v_username." ".escapeshellarg($v_domain)." ".$v_custom_doc_domain." ".$v_custom_doc_folder,  $output, $return_var);
-        check_return_code($return_var,$output);
-        unset($output);  
-        $v_custom_doc_root = 1;        
-        
+    if ( !empty($_POST['v-custom-doc-domain']) && !empty($_POST['v_custom_doc_root_check']) && $v_custom_doc_root_prepath.$v_custom_doc_domain.'/public_html'.$v_custom_doc_folder != $v_custom_doc_root){
+        if($_POST['v-custom-doc-domain'] == $v_domain && empty($_POST['v-custom-doc-folder'])){
+            exec(HESTIA_CMD."v-change-web-domain-docroot ".$v_username." ".escapeshellarg($v_domain)." default",  $output, $return_var);
+            check_return_code($return_var,$output);
+            unset($output);     
+        }else{
+            $v_custom_doc_domain = escapeshellarg($_POST['v-custom-doc-domain']);
+            $v_custom_doc_folder = escapeshellarg($_POST['v-custom-doc-folder']);
         
-    }    
-    
+            exec(HESTIA_CMD."v-change-web-domain-docroot ".$v_username." ".escapeshellarg($v_domain)." ".$v_custom_doc_domain." ".$v_custom_doc_folder,  $output, $return_var);
+            check_return_code($return_var,$output);
+            unset($output);  
+            $v_custom_doc_root = 1; 
+        }
+    }else{
+        unset($v_custom_doc_root);
+    }   
 
     // Restart web server
     if (!empty($restart_web) && (empty($_SESSION['error_msg']))) {