|
104 | 104 | $v_ftp_email = $_POST['v_ftp_email']; |
105 | 105 | if (!empty($v_domain)) $v_ftp_user_prepath .= $v_domain; |
106 | 106 |
|
| 107 | + exec (HESTIA_CMD."v-list-user ".$user." json", $output, $return_var); |
| 108 | + $user_config = json_decode(implode('', $output), true); |
| 109 | + unset($output); |
| 110 | + |
| 111 | + $v_template = $user_config[$user]['TEMPLATE']; |
| 112 | + $v_backend_template = $user_config[$user]['BACKEND_TEMPLATE']; |
| 113 | + $v_proxy_template = $user_config[$user]['PROXY_TEMPLATE']; |
| 114 | + |
107 | 115 | // Set advanced option checkmark |
108 | | - if (!empty($_POST['v_proxy'])) $v_adv = 'yes'; |
| 116 | + if (!empty($_POST['v_proxy'])) $v_adv = 'yes'; $v_proxy = "yes"; |
109 | 117 | if (!empty($_POST['v_ftp'])) $v_adv = 'yes'; |
110 | 118 | if ($_POST['v_proxy_ext'] != $v_proxy_ext) $v_adv = 'yes'; |
111 | 119 | if ((!empty($_POST['v_aliases'])) && ($_POST['v_aliases'] != 'www.'.$_POST['v_domain'])) $v_adv = 'yes'; |
|
161 | 169 | check_return_code($return_var,$output); |
162 | 170 | unset($output); |
163 | 171 | } |
| 172 | + |
| 173 | + // Change template |
| 174 | + if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) { |
| 175 | + exec (HESTIA_CMD."v-change-web-domain-tpl ".$user." ".escapeshellarg($v_domain)." ".escapeshellarg($_POST['v_template'])." 'no'", $output, $return_var); |
| 176 | + check_return_code($return_var,$output); |
| 177 | + unset($output); |
| 178 | + $restart_web = 'yes'; |
| 179 | + } |
| 180 | + // Change backend template |
| 181 | + if ((!empty($_SESSION['WEB_BACKEND'])) && ( $v_backend_template != $_POST['v_backend_template']) && ( $_SESSION['user'] == 'admin') && (empty($_SESSION['error_msg']))) { |
| 182 | + $v_backend_template = $_POST['v_backend_template']; |
| 183 | + exec (HESTIA_CMD."v-change-web-domain-backend-tpl ".$user." ".escapeshellarg($v_domain)." ".escapeshellarg($v_backend_template), $output, $return_var); |
| 184 | + check_return_code($return_var,$output); |
| 185 | + unset($output); |
| 186 | + } |
| 187 | + // Change proxy template / Update extension list |
| 188 | + if ((!empty($_SESSION['PROXY_SYSTEM'])) && (!empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg'])) ) { |
| 189 | + $ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']); |
| 190 | + $ext = preg_replace("/,/", " ", $ext); |
| 191 | + $ext = preg_replace('/\s+/', ' ',$ext); |
| 192 | + $ext = trim($ext); |
| 193 | + $ext = str_replace(' ', ", ", $ext); |
| 194 | + if (( $v_proxy_template != $_POST['v_proxy_template']) || ($v_proxy_ext != $ext)) { |
| 195 | + $ext = str_replace(', ', ",", $ext); |
| 196 | + if (!empty($_POST['v_proxy_template'])) $v_proxy_template = $_POST['v_proxy_template']; |
| 197 | + exec (HESTIA_CMD."v-change-web-domain-proxy-tpl ".$user." ".escapeshellarg($v_domain)." ".escapeshellarg($v_proxy_template)." ".escapeshellarg($ext)." 'no'", $output, $return_var); |
| 198 | + check_return_code($return_var,$output); |
| 199 | + $v_proxy_ext = str_replace(',', ', ', $ext); |
| 200 | + unset($output); |
| 201 | + $restart_proxy = 'yes'; |
| 202 | + } |
| 203 | + } |
| 204 | + |
164 | 205 |
|
165 | 206 | // Add Lets Encrypt support |
166 | 207 | if ((!empty($_POST['v_letsencrypt'])) && (empty($_SESSION['error_msg']))) { |
|
403 | 444 | $v_ssl_forcessl = 'no'; |
404 | 445 | } |
405 | 446 |
|
| 447 | +// List web templates and set default values |
| 448 | +exec (HESTIA_CMD."v-list-web-templates json", $output, $return_var); |
| 449 | +$templates = json_decode(implode('', $output), true); |
| 450 | +unset($output); |
| 451 | +$v_template = (!empty($_POST['v_template'])) ? $_POST['v_template'] : $user_config['WEB_TEMPLATE']; |
| 452 | + |
| 453 | +// List backend templates |
| 454 | +if (!empty($_SESSION['WEB_BACKEND'])) { |
| 455 | + exec (HESTIA_CMD."v-list-web-templates-backend json", $output, $return_var); |
| 456 | + $backend_templates = json_decode(implode('', $output), true); |
| 457 | + unset($output); |
| 458 | + $v_backend_template = (!empty($_POST['v_backend_template'])) ? $_POST['v_backend_template'] : $user_config['BACKEND_TEMPLATE']; |
| 459 | +} |
| 460 | + |
| 461 | +// List proxy templates |
| 462 | +if (!empty($_SESSION['PROXY_SYSTEM'])) { |
| 463 | + exec (HESTIA_CMD."v-list-web-templates-proxy json", $output, $return_var); |
| 464 | + $proxy_templates = json_decode(implode('', $output), true); |
| 465 | + unset($output); |
| 466 | + $v_proxy_template = (!empty($_POST['v_proxy_template'])) ? $_POST['v_proxy_template'] : $user_config['PROXY_TEMPLATE']; |
| 467 | + |
| 468 | +} |
| 469 | + |
406 | 470 | // List IP addresses |
407 | 471 | exec (HESTIA_CMD."v-list-user-ips ".$user." json", $output, $return_var); |
408 | 472 | $ips = json_decode(implode('', $output), true); |
|
0 commit comments