Просмотр исходного кода

[Web UI] Add controls to enable/disable File Manager

Allow user to enable/disable File Manager directly from within the control panel web interface.
Kristan Kenney 5 лет назад
Родитель
Сommit
ec4d22f9bb
2 измененных файлов с 35 добавлено и 2 удалено
  1. 21 2
      web/edit/server/index.php
  2. 14 0
      web/templates/admin/edit_server.html

+ 21 - 2
web/edit/server/index.php

@@ -254,10 +254,29 @@ if (!empty($_POST['save'])) {
         }
     }
 
+   // Set File Manager support
+    if (empty($_SESSION['error_msg'])) {
+        if ((!empty($_POST['v_filemanager'])) && ($_SESSION['FILE_MANAGER'] != $_POST['v_filemanager'])) {
+            if ($_POST['v_filemanager'] == 'yes') {
+                $_POST['v_filemanager'] == 'true';
+                exec (HESTIA_CMD."v-add-sys-filemanager", $output, $return_var);
+                check_return_code($return_var,$output);
+                unset($output);
+                if (empty($_SESSION['error_msg'])) $_SESSION['FILE_MANAGER'] = 'yes';
+            } else {
+                $_POST['v_filemanager'] == 'false';
+                exec (HESTIA_CMD."v-delete-sys-filemanager", $output, $return_var);
+                check_return_code($return_var,$output);
+                unset($output);
+                if (empty($_SESSION['error_msg'])) $_SESSION['FILE_MANAGER'] = 'no';
+            }
+        }
+    }
+
     // Set disk_quota support
     if (empty($_SESSION['error_msg'])) {
         if ((!empty($_POST['v_quota'])) && ($_SESSION['DISK_QUOTA'] != $_POST['v_quota'])) {
-            if($_POST['v_quota'] == 'yes') {
+            if ($_POST['v_quota'] == 'yes') {
                 exec (HESTIA_CMD."v-add-sys-quota", $output, $return_var);
                 check_return_code($return_var,$output);
                 unset($output);
@@ -276,7 +295,7 @@ if (!empty($_POST['save'])) {
         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') {
+            if ($_POST['v_firewall'] == 'yes') {
                 exec (HESTIA_CMD."v-add-sys-firewall", $output, $return_var);
                 check_return_code($return_var,$output);
                 unset($output);

+ 14 - 0
web/templates/admin/edit_server.html

@@ -820,6 +820,20 @@
                             <tr>
                                 <td class="vst-text input-label step-left">
                                     <table style="display:<?php if (empty($v_adv)) echo 'none';?> ;" id="hestia">
+                                        <tr>
+                                            <td class="vst-text">
+                                                <?php print __('Fm');?>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <select class="vst-list" name="v_filemanager">
+                                                    <option value='no'><?php print __('no'); ?></option>
+                                                    <option value='yes' <?php if($_SESSION['FILE_MANAGER'] == 'true') echo 'selected' ?> ><?php print __('yes'); ?></option>
+                                                </select>
+                                                <br><br>
+                                            </td>
+                                        </tr>
                                         <tr>
                                             <td class="vst-text">
                                                 <?php print __('FileSystem Disk Quota');?>