Skip to content

Commit 8680922

Browse files
committed
improved server configuration page
1 parent 899b3d2 commit 8680922

File tree

2 files changed

+39
-33
lines changed

2 files changed

+39
-33
lines changed

web/edit/server/index.php

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,25 @@
157157
}
158158
}
159159

160+
// Set firewall support
161+
if (empty($_SESSION['error_msg'])) {
162+
if ($_SESSION['FIREWALL_SYSTEM'] == 'iptables') $v_firewall = 'yes';
163+
if ($_SESSION['FIREWALL_SYSTEM'] != 'iptables') $v_firewall = 'no';
164+
if ((!empty($_POST['v_firewall'])) && ($v_firewall != $_POST['v_firewall'])) {
165+
if($_POST['v_firewall'] == 'yes') {
166+
exec (VESTA_CMD."v-add-sys-firewall", $output, $return_var);
167+
check_return_code($return_var,$output);
168+
unset($output);
169+
if (empty($_SESSION['error_msg'])) $_SESSION['FIREWALL_SYSTEM'] = 'iptables';
170+
} else {
171+
exec (VESTA_CMD."v-delete-sys-firewall", $output, $return_var);
172+
check_return_code($return_var,$output);
173+
unset($output);
174+
if (empty($_SESSION['error_msg'])) $_SESSION['FIREWALL_SYSTEM'] = '';
175+
}
176+
}
177+
}
178+
160179
// Update mysql pasword
161180
if (empty($_SESSION['error_msg'])) {
162181
if (!empty($_POST['v_mysql_password'])) {
@@ -336,30 +355,30 @@
336355

337356
// activating sftp licence
338357
if (empty($_SESSION['error_msg'])) {
339-
if($_SESSION['SFTP_KEY'] != $_POST['v_sftp_licence'] && $_POST['v_sftp'] == 'yes'){
358+
if($_SESSION['SFTPJAIL_KEY'] != $_POST['v_sftp_licence'] && $_POST['v_sftp'] == 'yes'){
340359
$module = 'sftpjail';
341360
$licence_key = escapeshellarg($_POST['v_sftp_licence']);
342361
exec (VESTA_CMD."v-activate-vesta-license ".$module." ".$licence_key, $output, $return_var);
343362
check_return_code($return_var,$output);
344363
unset($output);
345364
if (empty($_SESSION['error_msg'])) {
346365
$_SESSION['ok_msg'] = __('Licence Activated');
347-
$_SESSION['SFTP_KEY'] = $_POST['v_sftp_licence'];
366+
$_SESSION['SFTPJAIL_KEY'] = $_POST['v_sftp_licence'];
348367
}
349368
}
350369
}
351370

352371
// cancel sftp licence
353372
if (empty($_SESSION['error_msg'])) {
354-
if($_POST['v_sftp'] == 'cancel' && $_SESSION['SFTP_KEY']){
373+
if($_POST['v_sftp'] == 'cancel' && $_SESSION['SFTPJAIL_KEY']){
355374
$module = 'sftpjail';
356-
$licence_key = escapeshellarg($_SESSION['SFTP_KEY']);
375+
$licence_key = escapeshellarg($_SESSION['SFTPJAIL_KEY']);
357376
exec (VESTA_CMD."v-deactivate-vesta-license ".$module." ".$licence_key, $output, $return_var);
358377
check_return_code($return_var,$output);
359378
unset($output);
360379
if (empty($_SESSION['error_msg'])) {
361380
$_SESSION['ok_msg'] = __('Licence Deactivated');
362-
unset($_SESSION['SFTP_KEY']);
381+
unset($_SESSION['SFTPJAIL_KEY']);
363382
}
364383
}
365384
}

web/templates/admin/edit_server.html

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,6 @@
111111
<br><br>
112112
</td>
113113
</tr>
114-
<tr>
115-
<td class="vst-text input-label">
116-
<?php print __('FileSystem Disk Quota');?>
117-
</td>
118-
</tr>
119-
<tr>
120-
<td>
121-
<select class="vst-list" name="v_quota">
122-
<option value='no'><?php print __('no'); ?></option>
123-
<option value='yes' <?php if($_SESSION['DISK_QUOTA'] == 'yes') echo 'selected' ?> ><?php print __('yes'); ?></option>
124-
125-
</select>
126-
<br><br>
127-
</td>
128-
</tr>
129114
<tr>
130115
<td class="vst-text input-label step-top">
131116
<a href="javascript:elementHideShow('web');" class="vst-text">
@@ -624,39 +609,41 @@
624609
</td>
625610
</tr>
626611
<tr>
627-
<td class="vst-text">
628-
<?php print __('Reseller Role') ?>
612+
<td class="vst-text input-label">
613+
<?php print __('FileSystem Disk Quota');?>
629614
</td>
630615
</tr>
631616
<tr>
632617
<td>
633-
<select class="vst-list" name="v_reseller" disabled="disabled">
618+
<select class="vst-list" name="v_quota">
634619
<option value='no'><?php print __('no'); ?></option>
620+
<option value='yes' <?php if($_SESSION['DISK_QUOTA'] == 'yes') echo 'selected' ?> ><?php print __('yes'); ?></option>
635621
</select>
636622
<br><br>
637623
</td>
638624
</tr>
639625
<tr>
640-
<td class="vst-text">
641-
<?php print __('Web Config Editor') ?>
626+
<td class="vst-text input-label">
627+
<?php print __('Firewall');?>
642628
</td>
643629
</tr>
644630
<tr>
645631
<td>
646-
<select class="vst-list" name="v_conf_editor" disabled="disabled">
632+
<select class="vst-list" name="v_firewall">
647633
<option value='no'><?php print __('no'); ?></option>
634+
<option value='yes' <?php if($_SESSION['FIREWALL_SYSTEM'] == 'iptables') echo 'selected' ?> ><?php print __('yes'); ?></option>
648635
</select>
649636
<br><br>
650637
</td>
651638
</tr>
652639
<tr>
653640
<td class="vst-text">
654-
<?php print __('Template Manager') ?>
641+
<?php print __('Reseller Role') ?>
655642
</td>
656643
</tr>
657644
<tr>
658645
<td>
659-
<select class="vst-list" name="v_template_manager" disabled="disabled">
646+
<select class="vst-list" name="v_reseller" disabled="disabled">
660647
<option value='no'><?php print __('no'); ?></option>
661648
</select>
662649
<br><br>
@@ -684,21 +671,21 @@
684671
<td>
685672
<select class="vst-list" name="v_sftp">
686673
<?
687-
if($_SESSION['SFTP_KEY']){
674+
if($_SESSION['SFTPJAIL_KEY']){
688675
echo '<option value="cancel">'.__('Disable and Cancel Licence').'</option>';
689676
} else {
690677
echo '<option value="no">'.__('no').'</option>';
691678
}
692679
?>
693680

694-
<option value='yes' <? if($_GET['lead'] == 'sftp' || $_SESSION['SFTP_KEY'] != '') echo 'selected="selected"'; ?>><?php print __('yes'); ?></option>
681+
<option value='yes' <? if($_GET['lead'] == 'sftp' || $_SESSION['SFTPJAIL_KEY'] != '') echo 'selected="selected"'; ?>><?php print __('yes'); ?></option>
695682
</select>
696683
<br><br>
697-
<div class="sftp description" <? if($_GET['lead'] != 'sftp' && !$_SESSION['SFTP_KEY']) echo 'style="display:none"'; ?>>
684+
<div class="sftp description" <? if($_GET['lead'] != 'sftp' && !$_SESSION['SFTPJAIL_KEY']) echo 'style="display:none"'; ?>>
698685
<?
699686

700-
if($_GET['sftp_licence_key'] != '' || $_SESSION['SFTP_KEY']){
701-
$licence_key = $_GET['sftp_licence_key'] != '' ? $_GET['sftp_licence_key'] : $_SESSION['SFTP_KEY'];
687+
if($_GET['sftp_licence_key'] != '' || $_SESSION['SFTPJAIL_KEY']){
688+
$licence_key = $_GET['sftp_licence_key'] != '' ? $_GET['sftp_licence_key'] : $_SESSION['SFTPJAIL_KEY'];
702689
echo 'Restrict users so that they cannot use SSH and access only their home directory.
703690
<div class="licence">
704691
Licence Key: <input type="text" class="vst-input" name="v_sftp_licence" value="'.$licence_key.'" /><br>

0 commit comments

Comments
 (0)