-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.cgi
83 lines (66 loc) · 2.69 KB
/
index.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/perl
# vsftpd Webmin module, $Date: 2009-04-30
# Copyright (C) 2009 MagicWave Systems
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
use strict;
use vars qw(%text %config);
use libvsftpdconfig::ConfigManager;
use libvsftpdconfig::Util;
require "vsftpd-lib.pl";
my $permission = Util::get_permission();
ui_print_header($text{'index_version'} . " " . version(), $text{'index_title'}, "", "intro", 1, 1);
if (!has_command($config{'vsftpd_path'})) {
error_setup($text{'index_config_invalid'});
error($text{'index_config_invalid_msg'});
print ui_print_footer("/", $text{"index_title"});
exit;
}
my @links = ('manual.cgi?permission=1', 'additional_config.cgi', 'view_logs.cgi?file=vsftpd_log_file');
my @names = ($text{'index_link_manual'}, $text{'index_link_additional'}, $text{'index_link_view_logs'});
my @images = ('images/index_manual.png', 'images/misc.gif.png', 'images/log.png');
if ($permission == 7) {
push @links, 'select_config.cgi', 'edit_config.cgi';
push @names, $text{'index_link_select'}, $text{'index_link_edit_config'};
push @images, 'images/kernel.gif.png', 'images/manual.gif.png';
}
icons_table(\@links, \@names, \@images);
print ui_hr();
my $status;
my $running;
my $standalone = ConfigManager::instance()->config_instance('listen')->value() ||
ConfigManager::instance()->config_instance('listen_ipv6')->value();
if ($standalone) {
$running = get_vsftpd_pid();
$status = $running ? $text{'index_status_running'} : $text{'index_status_stopped'};
}
else {
$status = $text{'index_status_notlisten'};
}
print text('index_status_msg', "<tt>$status</tt>");
print ui_buttons_start();
if ($standalone) {
if ($running) {
print ui_buttons_row("cmd_restart.cgi",
$text{'running_restart'}, $text{'index_cmd_restart_msg'});
print ui_buttons_row("cmd_stop.cgi",
$text{'running_stop'}, $text{'index_cmd_stop_msg'});
}
else {
print ui_buttons_row("cmd_start.cgi", $text{'running_start'}, $text{'index_cmd_start_msg'});
}
}
print ui_buttons_row("cmd_kill.cgi", $text{'running_kill'}, $text{'index_cmd_kill_msg'});
print ui_buttons_end();