#!/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 (!$tconfig{'inframe'}) { $return = ""; $returnhtml = &text('index_index', "$gconfig{'webprefix'}/")."
";
}
}
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;
$mounting = !$access{'uid'} && &foreign_check("mount") ? 1 : 0;
if ($in{'open'}) {
$open = "";
}
if ($main::session_id) {
$session = "";
}
if (!$access{'noconfig'}) {
$config = "";
}
$iconsize = int($config{'iconsize'});
$root = join(" ", @allowed_roots);
$noroot = join(" ", @denied_roots);
foreach $d (@disallowed_buttons) {
$disallowed .= "\n";
}
# Create parameters for custom colours
foreach $k (keys %tconfig) {
if ($k =~ /^applet_(.*)/) {
$colours .= "\n";
}
}
# Extract classes from jar, if we can
if ($config{'extract'} &&
&has_command("unzip") && !-r "$module_root_directory/FileManager.class") {
system("unzip file.jar >/dev/null 2>&1");
}
print <