From 868092219f1b44b1e7aff8e26abca8cf52dfe8af Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Tue, 3 Nov 2015 01:07:41 +0200 Subject: [PATCH] improved server configuration page --- web/edit/server/index.php | 29 ++++++++-- web/templates/admin/edit_server.html | 79 ++++++++++++---------------- 2 files changed, 57 insertions(+), 51 deletions(-) diff --git a/web/edit/server/index.php b/web/edit/server/index.php index de4990ec4..849657221 100644 --- a/web/edit/server/index.php +++ b/web/edit/server/index.php @@ -157,6 +157,25 @@ if (!empty($_POST['save'])) { } } + // Set firewall support + if (empty($_SESSION['error_msg'])) { + if ($_SESSION['FIREWALL_SYSTEM'] == 'iptables') $v_firewall = 'yes'; + if ($_SESSION['FIREWALL_SYSTEM'] != 'iptables') $v_firewall = 'no'; + if ((!empty($_POST['v_firewall'])) && ($v_firewall != $_POST['v_firewall'])) { + if($_POST['v_firewall'] == 'yes') { + exec (VESTA_CMD."v-add-sys-firewall", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + if (empty($_SESSION['error_msg'])) $_SESSION['FIREWALL_SYSTEM'] = 'iptables'; + } else { + exec (VESTA_CMD."v-delete-sys-firewall", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + if (empty($_SESSION['error_msg'])) $_SESSION['FIREWALL_SYSTEM'] = ''; + } + } + } + // Update mysql pasword if (empty($_SESSION['error_msg'])) { if (!empty($_POST['v_mysql_password'])) { @@ -336,7 +355,7 @@ if (!empty($_POST['save'])) { // activating sftp licence if (empty($_SESSION['error_msg'])) { - if($_SESSION['SFTP_KEY'] != $_POST['v_sftp_licence'] && $_POST['v_sftp'] == 'yes'){ + if($_SESSION['SFTPJAIL_KEY'] != $_POST['v_sftp_licence'] && $_POST['v_sftp'] == 'yes'){ $module = 'sftpjail'; $licence_key = escapeshellarg($_POST['v_sftp_licence']); exec (VESTA_CMD."v-activate-vesta-license ".$module." ".$licence_key, $output, $return_var); @@ -344,22 +363,22 @@ if (!empty($_POST['save'])) { unset($output); if (empty($_SESSION['error_msg'])) { $_SESSION['ok_msg'] = __('Licence Activated'); - $_SESSION['SFTP_KEY'] = $_POST['v_sftp_licence']; + $_SESSION['SFTPJAIL_KEY'] = $_POST['v_sftp_licence']; } } } // cancel sftp licence if (empty($_SESSION['error_msg'])) { - if($_POST['v_sftp'] == 'cancel' && $_SESSION['SFTP_KEY']){ + if($_POST['v_sftp'] == 'cancel' && $_SESSION['SFTPJAIL_KEY']){ $module = 'sftpjail'; - $licence_key = escapeshellarg($_SESSION['SFTP_KEY']); + $licence_key = escapeshellarg($_SESSION['SFTPJAIL_KEY']); exec (VESTA_CMD."v-deactivate-vesta-license ".$module." ".$licence_key, $output, $return_var); check_return_code($return_var,$output); unset($output); if (empty($_SESSION['error_msg'])) { $_SESSION['ok_msg'] = __('Licence Deactivated'); - unset($_SESSION['SFTP_KEY']); + unset($_SESSION['SFTPJAIL_KEY']); } } } diff --git a/web/templates/admin/edit_server.html b/web/templates/admin/edit_server.html index 170da7476..434ec8ef4 100644 --- a/web/templates/admin/edit_server.html +++ b/web/templates/admin/edit_server.html @@ -111,21 +111,6 @@

- - - - - - - - -

- - @@ -623,6 +608,34 @@

+ + + + + + + + +

+ + + + + + + + + + +

+ + @@ -636,32 +649,6 @@

- - - - - - - - -

- - - - - - - - - - -

- - @@ -684,21 +671,21 @@

-
> +
> Licence Key: