forked from webmin/webmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.cgi.bak
executable file
·79 lines (71 loc) · 2.01 KB
/
index.cgi.bak
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
#!/usr/local/bin/perl
# index.cgi
# Output HTML for the file manager applet
require './file-lib.pl';
&ReadParse();
$theme_no_table = 1;
if ($access{'uid'} < 0 && !defined(getpwnam($remote_user))) {
&error(&text('index_eremote', $remote_user));
}
# Display header, depending on how many modules the user has
&read_acl(undef, \%acl);
$mc = @{$acl{$base_remote_user}} == 1;
$nolo = $ENV{'ANONYMOUS_USER'} ||
$ENV{'SSL_USER'} || $ENV{'LOCAL_USER'} ||
$ENV{'HTTP_USER_AGENT'} =~ /webmin/i;
if ($gconfig{'gotoone'} && $mc == 1 && !$nolo) {
&header($text{'index_title'}, "", undef, 0, 1);
$w = 100;
$h = 80;
}
else {
&header($text{'index_title'});
$w = 100;
$h = 100;
}
if ($gconfig{'referers_none'}) {
# Because java applet HTTP requests don't always include a referer:
# header, we need to use a DBM of trust keys to identify trusted applets
if (defined(&seed_random)) { &seed_random(); }
else { srand(time() ^ $$); }
$trust = int(rand(1000000000));
local $now = time();
&open_trust_db();
foreach $k (keys %trustdb) {
if ($now - $trustdb{$k} > 30*24*60*60) {
delete($trustdb{$k});
}
}
$trustdb{$trust} = $now;
dbmclose(%trustdb);
}
$sharing = $access{'uid'} ? 0 : 1;
&read_acl(undef, \%acl);
$mc = @{$acl{$base_remote_user}};
if (!$gconfig{'gotoone'} || $mc > 1) {
%minfo = &get_module_info();
$return = "<param name=return value=\"$gconfig{'webprefix'}/?cat=$minfo{'category'}\">";
}
if ($in{'open'}) {
$open = "<param name=open value=\"$in{'open'}\">\n";
}
print <<EOF;
<script>
function upload(dir)
{
open("upform.cgi?dir="+dir+"&trust=$trust", "upload", "toolbar=no,menubar=no,scrollbar=no,width=450,height=200");
}
</script>
<applet code=FileManager name=FileManager width=$w% height=$h% MAYSCRIPT>
<param name=root value="$access{'root'}">
<param name=follow value="$access{'follow'}">
<param name=ro value="$access{'ro'}">
<param name=sharing value="$sharing">
<param name=trust value="$trust">
<param name=goto value="$access{'goto'}">
$open
$return
$text{'index_nojava'} <p>
</applet>
EOF
&footer();