Skip to content

Commit 1913b75

Browse files
committed
Fix issue with folder part got missing
1 parent cb926ec commit 1913b75

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

web/add/web/index.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@
238238

239239
}else{
240240
$v_custom_doc_domain = escapeshellarg($_POST['v-custom-doc-domain']);
241+
if(substr($_POST['v-custom-doc-folder'], -1) == '/'){
242+
$v_custom_doc_folder = escapeshellarg(substr($_POST['v-custom-doc-folder'],0,-1));
243+
}else{
244+
$v_custom_doc_folder = escapeshellarg($_POST['v-custom-doc-folder']);
245+
}
241246
$v_custom_doc_folder = escapeshellarg($_POST['v-custom-doc-folder']);
242247
$v_domain = escapeshellarg(trim($_POST['v_domain']));
243248

web/edit/web/index.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,11 @@
7676
$v_custom_doc_root_prepath = '/home/'.$v_username.'/web/';
7777
$v_custom_doc_root = $data[$v_domain]['CUSTOM_DOCROOT'];
7878

79-
$m = preg_match('/\/home\/'.$v_username.'\/web\/([A-Za-z0-9.-].*)\/([A-Za-z0-9.-\/].*)/', $v_custom_doc_root, $matches);
79+
$m = preg_match('/\/home\/demo\/web\/([[:alnum:]].*)\/public_html\/([[:alnum:]].*)/', $v_custom_doc_root, $matches);
8080
$v_custom_doc_domain = $matches[1];
81-
$v_custom_doc_folder = str_replace('public_html/','',$matches[2]);
81+
$v_custom_doc_folder = $matches[2];
82+
83+
8284

8385
$v_ftp_user = $data[$v_domain]['FTP_USER'];
8486
$v_ftp_path = $data[$v_domain]['FTP_PATH'];
@@ -763,9 +765,13 @@
763765
check_return_code($return_var,$output);
764766
unset($output);
765767
}else{
768+
if(substr($_POST['v-custom-doc-folder'], -1) == '/'){
769+
$v_custom_doc_folder = escapeshellarg(substr($_POST['v-custom-doc-folder'],0,-1));
770+
}else{
771+
$v_custom_doc_folder = escapeshellarg($_POST['v-custom-doc-folder']);
772+
}
766773
$v_custom_doc_domain = escapeshellarg($_POST['v-custom-doc-domain']);
767-
$v_custom_doc_folder = escapeshellarg($_POST['v-custom-doc-folder']);
768-
774+
769775
exec(HESTIA_CMD."v-change-web-domain-docroot ".$v_username." ".escapeshellarg($v_domain)." ".$v_custom_doc_domain." ".$v_custom_doc_folder ." yes", $output, $return_var);
770776
check_return_code($return_var,$output);
771777
unset($output);

0 commit comments

Comments
 (0)