|
231 | 231 | } |
232 | 232 | } |
233 | 233 |
|
234 | | - // Change template |
235 | | - if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) { |
236 | | - exec (HESTIA_CMD."v-change-web-domain-tpl ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($_POST['v_template'])." 'no'", $output, $return_var); |
237 | | - check_return_code($return_var,$output); |
238 | | - unset($output); |
239 | | - $restart_web = 'yes'; |
240 | | - } |
241 | 234 |
|
| 235 | + if (($_SESSION['POLICY_USER_EDIT_WEB_TEMPLATES'] == 'yes') || ($_SESSION['userContext'] === "admin")){ |
| 236 | + // Change template |
| 237 | + if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) { |
| 238 | + exec (HESTIA_CMD."v-change-web-domain-tpl ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($_POST['v_template'])." 'no'", $output, $return_var); |
| 239 | + check_return_code($return_var,$output); |
| 240 | + unset($output); |
| 241 | + $restart_web = 'yes'; |
| 242 | + } |
| 243 | + |
| 244 | + // Change backend template |
| 245 | + if ((!empty($_SESSION['WEB_BACKEND'])) && ( $v_backend_template != $_POST['v_backend_template']) && (empty($_SESSION['error_msg']))) { |
| 246 | + $v_backend_template = $_POST['v_backend_template']; |
| 247 | + exec (HESTIA_CMD."v-change-web-domain-backend-tpl ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($v_backend_template), $output, $return_var); |
| 248 | + check_return_code($return_var,$output); |
| 249 | + unset($output); |
| 250 | + } |
| 251 | + |
| 252 | + // Enable/Disable nginx cache |
| 253 | + if (($_SESSION['WEB_SYSTEM'] == 'nginx') && ($v_nginx_cache_check != $_POST['v_nginx_cache_check'] ) || ($v_nginx_cache_duration != $_POST['v_nginx_cache_duration'] && $_POST['v_nginx_cache'] = "yes" ) && (empty($_SESSION['error_msg']))) { |
| 254 | + if ( $_POST['v_nginx_cache_check'] == 'on' ) { |
| 255 | + if (empty ($_POST['v_nginx_cache_duration'])){ |
| 256 | + echo $_POST['v_nginx_cache_duration'] = "2m"; |
| 257 | + } |
| 258 | + exec (HESTIA_CMD."v-add-fastcgi-cache ".$v_username." ".escapeshellarg($v_domain).' '. escapeshellarg($_POST['v_nginx_cache_duration']) , $output, $return_var); |
| 259 | + check_return_code($return_var,$output); |
| 260 | + unset($output); |
| 261 | + } else { |
| 262 | + exec (HESTIA_CMD."v-delete-fastcgi-cache ".$v_username." ".escapeshellarg($v_domain), $output, $return_var); |
| 263 | + check_return_code($return_var,$output); |
| 264 | + unset($output); |
| 265 | + } |
| 266 | + $restart_web = 'yes'; |
| 267 | + } |
| 268 | + |
| 269 | + // Delete proxy support |
| 270 | + if ((!empty($_SESSION['PROXY_SYSTEM'])) && (!empty($v_proxy)) && (empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) { |
| 271 | + exec (HESTIA_CMD."v-delete-web-domain-proxy ".$v_username." ".escapeshellarg($v_domain)." 'no'", $output, $return_var); |
| 272 | + check_return_code($return_var,$output); |
| 273 | + unset($output); |
| 274 | + unset($v_proxy); |
| 275 | + $restart_web = 'yes'; |
| 276 | + } |
| 277 | + |
| 278 | + // Change proxy template / Update extension list |
| 279 | + if ((!empty($_SESSION['PROXY_SYSTEM'])) && (!empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg'])) ) { |
| 280 | + $ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']); |
| 281 | + $ext = preg_replace("/,/", " ", $ext); |
| 282 | + $ext = preg_replace('/\s+/', ' ',$ext); |
| 283 | + $ext = trim($ext); |
| 284 | + $ext = str_replace(' ', ", ", $ext); |
| 285 | + if (( $v_proxy_template != $_POST['v_proxy_template']) || ($v_proxy_ext != $ext)) { |
| 286 | + $ext = str_replace(', ', ",", $ext); |
| 287 | + if (!empty($_POST['v_proxy_template'])) $v_proxy_template = $_POST['v_proxy_template']; |
| 288 | + exec (HESTIA_CMD."v-change-web-domain-proxy-tpl ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($v_proxy_template)." ".escapeshellarg($ext)." 'no'", $output, $return_var); |
| 289 | + check_return_code($return_var,$output); |
| 290 | + $v_proxy_ext = str_replace(',', ', ', $ext); |
| 291 | + unset($output); |
| 292 | + $restart_proxy = 'yes'; |
| 293 | + } |
| 294 | + } |
| 295 | + |
| 296 | + // Add proxy support |
| 297 | + if ((!empty($_SESSION['PROXY_SYSTEM'])) && (empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) { |
| 298 | + $v_proxy_template = $_POST['v_proxy_template']; |
| 299 | + if (!empty($_POST['v_proxy_ext'])) { |
| 300 | + $ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']); |
| 301 | + $ext = preg_replace("/,/", " ", $ext); |
| 302 | + $ext = preg_replace('/\s+/', ' ',$ext); |
| 303 | + $ext = trim($ext); |
| 304 | + $ext = str_replace(' ', ",", $ext); |
| 305 | + $v_proxy_ext = str_replace(',', ', ', $ext); |
| 306 | + } |
| 307 | + exec (HESTIA_CMD."v-add-web-domain-proxy ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($v_proxy_template)." ".escapeshellarg($ext)." 'no'", $output, $return_var); |
| 308 | + check_return_code($return_var,$output); |
| 309 | + unset($output); |
| 310 | + $restart_proxy = 'yes'; |
| 311 | + } |
| 312 | + |
| 313 | + |
| 314 | + } |
242 | 315 | // Change aliases |
243 | 316 | if (empty($_SESSION['error_msg'])) { |
244 | 317 | $waliases = preg_replace("/\n/", " ", $_POST['v_aliases']); |
|
330 | 403 | unset($output); |
331 | 404 | } |
332 | 405 | } |
333 | | - |
334 | | - // Change backend template |
335 | | - if ((!empty($_SESSION['WEB_BACKEND'])) && ( $v_backend_template != $_POST['v_backend_template']) && (empty($_SESSION['error_msg']))) { |
336 | | - $v_backend_template = $_POST['v_backend_template']; |
337 | | - exec (HESTIA_CMD."v-change-web-domain-backend-tpl ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($v_backend_template), $output, $return_var); |
338 | | - check_return_code($return_var,$output); |
339 | | - unset($output); |
340 | | - } |
341 | | - |
342 | | - // Enable/Disable nginx cache |
343 | | - if (($_SESSION['WEB_SYSTEM'] == 'nginx') && ($v_nginx_cache_check != $_POST['v_nginx_cache_check'] ) || ($v_nginx_cache_duration != $_POST['v_nginx_cache_duration'] && $_POST['v_nginx_cache'] = "yes" ) && (empty($_SESSION['error_msg']))) { |
344 | | - if ( $_POST['v_nginx_cache_check'] == 'on' ) { |
345 | | - if (empty ($_POST['v_nginx_cache_duration'])){ |
346 | | - echo $_POST['v_nginx_cache_duration'] = "2m"; |
347 | | - } |
348 | | - exec (HESTIA_CMD."v-add-fastcgi-cache ".$v_username." ".escapeshellarg($v_domain).' '. escapeshellarg($_POST['v_nginx_cache_duration']) , $output, $return_var); |
349 | | - check_return_code($return_var,$output); |
350 | | - unset($output); |
351 | | - } else { |
352 | | - exec (HESTIA_CMD."v-delete-fastcgi-cache ".$v_username." ".escapeshellarg($v_domain), $output, $return_var); |
353 | | - check_return_code($return_var,$output); |
354 | | - unset($output); |
355 | | - } |
356 | | - $restart_web = 'yes'; |
357 | | - } |
358 | | - |
359 | | - // Delete proxy support |
360 | | - if ((!empty($_SESSION['PROXY_SYSTEM'])) && (!empty($v_proxy)) && (empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) { |
361 | | - exec (HESTIA_CMD."v-delete-web-domain-proxy ".$v_username." ".escapeshellarg($v_domain)." 'no'", $output, $return_var); |
362 | | - check_return_code($return_var,$output); |
363 | | - unset($output); |
364 | | - unset($v_proxy); |
365 | | - $restart_web = 'yes'; |
366 | | - } |
367 | | - |
368 | | - // Change proxy template / Update extension list |
369 | | - if ((!empty($_SESSION['PROXY_SYSTEM'])) && (!empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg'])) ) { |
370 | | - $ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']); |
371 | | - $ext = preg_replace("/,/", " ", $ext); |
372 | | - $ext = preg_replace('/\s+/', ' ',$ext); |
373 | | - $ext = trim($ext); |
374 | | - $ext = str_replace(' ', ", ", $ext); |
375 | | - if (( $v_proxy_template != $_POST['v_proxy_template']) || ($v_proxy_ext != $ext)) { |
376 | | - $ext = str_replace(', ', ",", $ext); |
377 | | - if (!empty($_POST['v_proxy_template'])) $v_proxy_template = $_POST['v_proxy_template']; |
378 | | - exec (HESTIA_CMD."v-change-web-domain-proxy-tpl ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($v_proxy_template)." ".escapeshellarg($ext)." 'no'", $output, $return_var); |
379 | | - check_return_code($return_var,$output); |
380 | | - $v_proxy_ext = str_replace(',', ', ', $ext); |
381 | | - unset($output); |
382 | | - $restart_proxy = 'yes'; |
383 | | - } |
384 | | - } |
385 | | - |
386 | | - // Add proxy support |
387 | | - if ((!empty($_SESSION['PROXY_SYSTEM'])) && (empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) { |
388 | | - $v_proxy_template = $_POST['v_proxy_template']; |
389 | | - if (!empty($_POST['v_proxy_ext'])) { |
390 | | - $ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']); |
391 | | - $ext = preg_replace("/,/", " ", $ext); |
392 | | - $ext = preg_replace('/\s+/', ' ',$ext); |
393 | | - $ext = trim($ext); |
394 | | - $ext = str_replace(' ', ",", $ext); |
395 | | - $v_proxy_ext = str_replace(',', ', ', $ext); |
396 | | - } |
397 | | - exec (HESTIA_CMD."v-add-web-domain-proxy ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($v_proxy_template)." ".escapeshellarg($ext)." 'no'", $output, $return_var); |
398 | | - check_return_code($return_var,$output); |
399 | | - unset($output); |
400 | | - $restart_proxy = 'yes'; |
401 | | - } |
402 | 406 |
|
403 | 407 | // Change document root for ssl domain |
404 | 408 | if (( $v_ssl == 'yes') && (!empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) { |
|
0 commit comments