-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpure-conf.cgi
executable file
·55 lines (43 loc) · 1.72 KB
/
pure-conf.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
#!/usr/bin/perl
# Edit inetd Pure-FTPd configuration file
do '../web-lib.pl';
&init_config();
&error_setup($text{'pure-conf_err'});
&ReadParse();
if ($in{'ftpdconf'}) {
# A new configuration file had been send, save it
$in{'ftpdconf'} =~ s/\r//g; # Remove Mac line-endings
&lock_file($file);
open(FILE, ">$config{'conf_pureftpd'}");
print FILE $in{'ftpdconf'};
close(FILE);
&unlock_file($file);
}
# Display the form
&header($text{'pure-conf_title'}, undef, "conf", 1, 1, undef, $text{'index_mail'});
# Check if there is CSS styles
if ($config{'conf_pureCSS'}) { print "<STYLE type=\"text/css\">
$config{'conf_pureCSS'}\n</STYLE>\n\n"; }
# If init script specified then build a "restart" button
# then if inetd is required, restart
if ($config{'init_script'}) {
$restart = "<input type=submit name=save class=submit value=\"$text{'index_apply'}\">";
if ($in{'save'} eq $text{'index_apply'}) { system("$config{'init_script'}");
print "<center><h2>$text{'index_restarted'}</h2></center>\n";} }
# Display the inetd configuration file inside the form
$lines = &read_file_lines("$config{'conf_pureftpd'}");
$lines = join("\n", @{$lines}); print <<EOF;
<hr><form action=pure-conf.cgi method=POST>
<center><table border width=70%>
<tr $tb> <td><b>$text{'pure-conf_header'}</b></td> </tr>
<tr $cb> <td><table width=100%>
<tr> <td valign=top nowrap><b>$text{'pure-conf_ftpwelcome'}</b>
<br><br><input type=submit name=save value="$text{'save'}">
<br>$restart</td>
<td><table border width=100%>
<tr $tb> <td><b>$text{'pure-conf_filecontents'}</b></td></tr>
<tr $cb><td><textarea name=ftpdconf rows=30 cols=90>$lines
</textarea></td></tr></table></td> </tr>
</table></td></tr></table></center></form><hr>
EOF
&footer("", $text{'index_return'});