|
94 | 94 | } |
95 | 95 | } |
96 | 96 |
|
| 97 | +$redirect_code_options = array(301,302); |
| 98 | +$v_redirect = $data[$v_domain]['REDIRECT']; |
| 99 | +$v_redirect_code = $data[$v_domain]['REDIRECT_CODE']; |
| 100 | +if ( !in_array($v_redirect, array('www.'.$v_domain, $v_domain))){ |
| 101 | + $v_redirect_custom = $v_redirect; |
| 102 | +} |
97 | 103 |
|
98 | 104 | $v_ftp_user = $data[$v_domain]['FTP_USER']; |
99 | 105 | $v_ftp_path = $data[$v_domain]['FTP_PATH']; |
|
567 | 573 | check_return_code($return_var,$output); |
568 | 574 | unset($output); |
569 | 575 | $v_ssl_forcessl = 'yes'; |
| 576 | + $restart_web = 'yes'; |
| 577 | + $restart_proxy = 'yes'; |
570 | 578 | } |
571 | 579 |
|
572 | 580 | // Add SSL HSTS |
|
575 | 583 | check_return_code($return_var,$output); |
576 | 584 | unset($output); |
577 | 585 | $v_ssl_hsts = 'yes'; |
| 586 | + $restart_web = 'yes'; |
| 587 | + $restart_proxy = 'yes'; |
578 | 588 | } |
579 | 589 |
|
580 | 590 | // Delete Force SSL |
581 | 591 | if (( $v_ssl_forcessl == 'yes' ) && (empty($_POST['v_ssl_forcessl'])) && (empty($_SESSION['error_msg']))) { |
582 | | - exec (HESTIA_CMD."v-delete-web-domain-ssl-force ".$user." ".escapeshellarg($v_domain)." yes", $output, $return_var); |
| 592 | + exec (HESTIA_CMD."v-delete-web-domain-ssl-force ".$user." ".escapeshellarg($v_domain), $output, $return_var); |
583 | 593 | check_return_code($return_var,$output); |
584 | 594 | unset($output); |
585 | 595 | $v_ssl_forcessl = 'no'; |
| 596 | + $restart_web = 'yes'; |
| 597 | + $restart_proxy = 'yes'; |
586 | 598 | } |
587 | 599 |
|
588 | 600 | // Delete SSL HSTS |
589 | 601 | if (( $v_ssl_hsts == 'yes' ) && (empty($_POST['v_ssl_hsts'])) && (empty($_SESSION['error_msg']))) { |
590 | | - exec (HESTIA_CMD."v-delete-web-domain-ssl-hsts ".$user." ".escapeshellarg($v_domain)." yes", $output, $return_var); |
| 602 | + exec (HESTIA_CMD."v-delete-web-domain-ssl-hsts ".$user." ".escapeshellarg($v_domain), $output, $return_var); |
591 | 603 | check_return_code($return_var,$output); |
592 | 604 | unset($output); |
593 | 605 | $v_ssl_hsts = 'no'; |
| 606 | + $restart_web = 'yes'; |
| 607 | + $restart_proxy = 'yes'; |
594 | 608 | } |
595 | 609 |
|
596 | 610 | // Delete web stats |
|
816 | 830 | exec(HESTIA_CMD."v-change-web-domain-docroot ".$v_username." ".escapeshellarg($v_domain)." default", $output, $return_var); |
817 | 831 | check_return_code($return_var,$output); |
818 | 832 | unset($output); |
819 | | - unset($_POST['v-custom-doc-domain'], $_POST['v-custom-doc-folder']); |
| 833 | + unset($_POST['v-custom-doc-domain'], $_POST['v-custom-doc-folder']); |
| 834 | + $restart_web = 'yes'; |
| 835 | + $restart_proxy = 'yes'; |
820 | 836 | } |
821 | 837 |
|
822 | 838 | 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){ |
|
832 | 848 | check_return_code($return_var,$output); |
833 | 849 | unset($output); |
834 | 850 | $v_custom_doc_root = 1; |
| 851 | + |
835 | 852 | } |
| 853 | + $restart_web = 'yes'; |
| 854 | + $restart_proxy = 'yes'; |
836 | 855 | }else{ |
837 | 856 | unset($v_custom_doc_root); |
838 | 857 | } |
| 858 | + |
| 859 | + if ( !empty($v_redirect) && empty($_POST['v-redirect-checkbox']) ) { |
| 860 | + exec(HESTIA_CMD."v-delete-web-domain-redirect ".$v_username." ".escapeshellarg($v_domain), $output, $return_var); |
| 861 | + check_return_code($return_var,$output); |
| 862 | + unset($output); |
| 863 | + unset($_POST['v-redirect']); |
| 864 | + $restart_web = 'yes'; |
| 865 | + $restart_proxy = 'yes'; |
| 866 | + } |
| 867 | + |
| 868 | + if (!empty($_POST['v-redirect']) && !empty($_POST['v-redirect-checkbox']) ){ |
| 869 | + if (empty($v_redirect)){ |
| 870 | + if ($_POST['v-redirect'] == 'custom' && empty($_POST['v-redirect-custom'])){ |
| 871 | + }else{ |
| 872 | + if($_POST['v-redirect'] == 'custom'){ |
| 873 | + $_POST['v-redirect'] = $_POST['v-redirect-custom']; |
| 874 | + } |
| 875 | + exec(HESTIA_CMD."v-add-web-domain-redirect ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($_POST['v-redirect'])." ".escapeshellarg($_POST['v-redirect-code']), $output, $return_var); |
| 876 | + check_return_code($return_var,$output); |
| 877 | + unset($output); |
| 878 | + $restart_web = 'yes'; |
| 879 | + $restart_proxy = 'yes'; |
| 880 | + } |
839 | 881 |
|
| 882 | + }else { |
| 883 | + if ($_POST['v-redirect'] == 'custom') { |
| 884 | + $_POST['v-redirect'] = $_POST['v-redirect-custom']; |
| 885 | + } |
| 886 | + if ( $_POST['v-redirect'] != $v_redirect || $_POST['v-redirect-code'] != $v_redirect_code ) { |
| 887 | + exec(HESTIA_CMD."v-add-web-domain-redirect ".$v_username." ".escapeshellarg($v_domain)." ".escapeshellarg($_POST['v-redirect'])." ".escapeshellarg($_POST['v-redirect-code']), $output, $return_var); |
| 888 | + check_return_code($return_var,$output); |
| 889 | + unset($output); |
| 890 | + $restart_web = 'yes'; |
| 891 | + $restart_proxy = 'yes'; |
| 892 | + } |
| 893 | + } |
| 894 | + |
| 895 | + } |
840 | 896 | // Restart web server |
841 | 897 | if (!empty($restart_web) && (empty($_SESSION['error_msg']))) { |
842 | 898 | exec (HESTIA_CMD."v-restart-web", $output, $return_var); |
|
0 commit comments