|
74 | 74 | $v_stats_user = $data[$v_domain]['STATS_USER']; |
75 | 75 | if (!empty($v_stats_user)) $v_stats_password = ""; |
76 | 76 | $v_custom_doc_root_prepath = '/home/'.$v_username.'/web/'; |
77 | | -$v_custom_doc_root = $data[$v_domain]['CUSTOM_DOCROOT']; |
78 | 77 |
|
79 | | -$m = preg_match('/\/home\/'.$v_username.'\/web\/([[:alnum:]].*)\/public_html\/([[:alnum:]].*)/', $v_custom_doc_root, $matches); |
80 | | -$v_custom_doc_domain = $matches[1]; |
81 | | -$v_custom_doc_folder = $matches[2]; |
82 | | -if(substr($v_custom_doc_folder, -1) == '/'){ |
83 | | - $v_custom_doc_folder = substr($v_custom_doc_folder,0,-1); |
| 78 | +if(!empty($data[$v_domain]['CUSTOM_DOCROOT'])) |
| 79 | + $v_custom_doc_root = realpath($data[$v_domain]['CUSTOM_DOCROOT']) . DIRECTORY_SEPARATOR; |
| 80 | + |
| 81 | +if(!empty($v_custom_doc_root) && |
| 82 | + false !== preg_match('/\/home\/'.$v_username.'\/web\/([[:alnum:]].*)\/public_html\/([[:alnum:]].*)?/', $v_custom_doc_root, $matches) ) { |
| 83 | + |
| 84 | + if(!empty($matches[1])) |
| 85 | + $v_custom_doc_domain = $matches[1]; |
| 86 | + |
| 87 | + if(!empty($matches[2])) |
| 88 | + $v_custom_doc_folder = rtrim($matches[2], '/'); |
| 89 | + |
| 90 | + if($v_custom_doc_domain && !in_array($v_custom_doc_domain, $user_domains)) { |
| 91 | + $v_custom_doc_domain = ''; |
| 92 | + $v_custom_doc_folder = ''; |
| 93 | + } |
84 | 94 | } |
85 | 95 |
|
86 | 96 |
|
|
767 | 777 | check_return_code($return_var,$output); |
768 | 778 | unset($output); |
769 | 779 | }else{ |
770 | | - if(substr($_POST['v-custom-doc-folder'], -1) == '/'){ |
771 | | - $v_custom_doc_folder = escapeshellarg(substr($_POST['v-custom-doc-folder'],0,-1)); |
772 | | - }else{ |
773 | | - $v_custom_doc_folder = escapeshellarg($_POST['v-custom-doc-folder']); |
774 | | - } |
| 780 | + $v_custom_doc_folder = escapeshellarg(rtrim($_POST['v-custom-doc-folder'],'/')); |
775 | 781 | $v_custom_doc_domain = escapeshellarg($_POST['v-custom-doc-domain']); |
776 | 782 |
|
777 | 783 | 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); |
|
0 commit comments