;
close D;
} else {
$out .= qq`
Web-FTP $self->{VERSION} $hostname $self->{conf}{lang}{login}
`;
}
$out .= qq`
`;
if(-f qq'$self->{conf}{base}/templates/loginfooter') {
open(D, qq'$self->{conf}{base}/templates/loginfooter') or die $!;
local $/;
$out .= ;
close D;
} else {
$out .= $self->credits();
}
$out .= qq`
`;
return \$out;
}
sub MESSAGES {
my $self = shift;
my $out = qq`
$self->{conf}{lang}{msg_title}
$self->{conf}{lang}{msg_help}
$self->{conf}{lang}{close_window}
`;
for(@{$self->{conf}{messages}}) {
my $d = localtime($_->[0]);
$d =~ /(\d\d:\d\d:\d\d)/;
$out .= "$1: $_->[1]
\n";
}
$out .= qq`
$self->{conf}{lang}{close_window}
`;
\$out;
}
sub ACCT {
my $self = shift;
my $out;
$out = qq`
Web-FTP $self->{VERSION}: $self->{HOSTNAME} $self->{conf}{lang}{login}
`;
if(-f qq'$self->{conf}{base}/templates/loginheader') {
open(D, qq'$self->{conf}{base}/templates/loginheader') or die $!;
local $/;
$out .= ;
close D;
} else {
$out .= qq`
Web-FTP $self->{VERSION}: $self->{HOSTNAME} $self->{conf}{lang}{login}
`;
}
$out .= qq`
`;
if(-f qq'$self->{conf}{base}/templates/loginfooter') {
open(D, qq'$self->{conf}{base}/templates/loginfooter') or die $!;
local $/;
$out .= ;
close D;
} else {
$out .= $self->credits();
}
$out .= qq`
`;
return \$out;
}
sub failLogin {
my $self = shift;
\qq`
$self->{conf}{lang}{login_failed}
$self->{conf}{lang}{login_failed}
$self->{conf}{lang}{login_failed_msg}
$_[0]
`;
}
sub permissionFailure {
my $self = shift;
my $OUT = qq`
$self->{conf}{lang}{access_denied}
$self->{conf}{lang}{unauthorized}
$self->{conf}{lang}{please} $self->{conf}{lang}{login}
$self->{conf}{lang}{with_cookies}.
`;
return \$OUT;
}
sub errorPage {
my $self = shift;
my $OUT = qq`
Error
$self->{conf}{lang}{error}
$_[0]
$self->{conf}{lang}{click_here} $self->{conf}{lang}{to_go}
`;
return \$OUT;
}
sub uploadScreen {
my $self = shift;
\qq`
Web-FTP $self->{VERSION}: $self->{conf}{lang}{file_upload} $self->{HOSTNAME}
web-FTP $self->{VERSION}: $self->{conf}{lang}{file_upload}
$self->{HOSTNAME}:$self->{CURRENTDIR}
`
}
sub HEAD {
my $self = shift;
my $head = qq`
Web-FTP $self->{VERSION} - $self->{conf}{lang}{connected_to} $self->{HOSTNAME}
`;
if(-f qq'$self->{conf}{base}/templates/header') {
open(D, qq'$self->{conf}{base}/templates/header') or die $!;
local $/;
$head = ;
close D;
return \$head if $head =~ /<[Hh][Tt][Mm][Ll]\s*>/;
}
\qq`
$head
`;
}
sub FOOT {
my $self = shift;
\qq`${\($self->credits())}`;
}
sub credits {
my $self = shift;
if(-f qq'$self->{conf}{base}/templates/footer') {
open(D, qq'$self->{conf}{base}/templates/footer') or die $!;
local $/;
my $foot = ;
close D;
return $foot;
}
qq``;
}
sub FILES {
my $self = shift;
my $OUT = qq`
`;
return \$OUT;
}
sub DIRS {
my $self = shift;
my $OUT = qq`
`;
return \$OUT;
}
sub MAIN {
my $self = shift;
\qq`
`;
#
}
sub DIRSINFO {
my $self = shift;
\qq`
`;
}
sub INFO {
my $self = shift;
my($dsf,$link);
for(split '/', $self->{CURRENTDIR}) {
$dsf .= "$_/";
$link .= qq`$_/`;
}
$link ||= '/';
\qq`
`;
}
sub NAVBAR {
my $self = $_[0];
my($OUT);
$OUT = qq`
`;
return \$OUT;
}
sub mkdirScreen {
my $self = shift;
\qq`
$self->{conf}{lang}{version} $self->{VERSION}: $self->{conf}{lang}{new_directory} $self->{HOSTNAME}
$self->{conf}{lang}{version} $self->{VERSION}: $self->{conf}{lang}{new_directory_in} $self->{HOSTNAME}:$self->{CURRENTDIR}
`;
}
sub moveScreen {
my $self = shift;
my $reply = qq`
$self->{conf}{lang}{version} $self->{VERSION}: $self->{conf}{lang}{moving_files_on} $self->{HOSTNAME}
$self->{conf}{lang}{version} $self->{VERSION}: $self->{conf}{lang}{moving_files_within}
$self->{HOSTNAME}:$self->{CURRENTDIR}
`;
\$reply;
}
sub permsScreen {
my $self = shift;
my @colors = ($self->{conf}{oddcolcolor},$self->{conf}{evencolcolor});
my $reply = qq`
$self->{conf}{lang}{version} $self->{VERSION}: $self->{conf}{lang}{altering_permissions_on} $self->{HOSTNAME}
Web-FTP $self->{VERSION}: $self->{conf}{lang}{altering_permissions_within}
$self->{HOSTNAME}:$self->{CURRENTDIR}
`;
\$reply;
}
sub frameset {
my $self = shift;
\qq`
Web-FTP $self->{VERSION}: $self->{HOSTNAME}
`;
}
sub getDirectory {
my $self = shift;
my (@DirEntries, @FileEntries);
%{$self->{PERMISSIONS}} = ();
# print STDERR "Direntries: @_\n";
foreach my $Entry (@_) {
my($pr,$fs,$us,$gr,$sz,$d1,$d2,$d3,$fn);
# This line is FTPD dependant. I hope that doesn't matter too much.
if($self->{conf}{servertype} eq 'MS') {
($d1,$d3,$sz,$fn) = split / +/, $Entry, 4;
} else {
if($self->{dircheck} < 2) {
($pr,$fs,$us,$gr,$sz,$d1,$d2,$d3,$fn) = split / +/, $Entry, 9;
if(!$self->{dircheck} && ($gr || $sz)) {
$self->{dircheck} = ($gr =~ /^\d+$/ && $sz !~ /^\d+$/ ? 2 : 1);
}
}
if($self->{dircheck} == 2) {
($pr,$fs,$us,$sz,$d1,$d2,$d3,$fn) = split / +/, $Entry, 8;
}
}
# Bill Gate's Version
# 10-23-99 02:41PM Anwendungsdaten
$self->{PERMISSIONS}{$fn} = $pr if $pr;
# print STDERR "$pr,$fs,$us,$gr,$sz,$d1,$d2,$d3,$fn\n";
my @colors = ($self->{conf}{oddcolcolor},$self->{conf}{evencolcolor});
if($fn) {
my $i = 0;
my($fnlink,$fnq,@Option);
my $type = 'Files';
if($pr) {
my @pr = unpack('a1a3a3a3', $pr);
$pr = "$pr[0]$pr[1]$pr[2]$pr[3]";
$type = 'Directories' if $pr[0] eq 'd';
if($pr[0] eq 'l') {
my($foo) = 1 if($fn =~ m|/$|);
$fn =~ s/\s+->.*$//;
if ($foo) {
$type = 'Directories';
} else {
$type = 'Directories' unless $self->{conf}{FTP}->size($fn);
}
}
} else {
$type = 'Directories' if $sz eq '';
}
# print STDERR "Type: $type\n";
$fnq = $self->encode($fn);
if($type eq 'Directories') {
$fnlink = qq`$fn`;
} else {
$fnlink = qq`$fn`;
}
push @Option, q``;
push @Option, qq` | ` unless $self->{conf}{hidetag};
push @Option, qq`$fnlink | `;
push @Option, qq`$d1 $d2 $d3 | ` unless $self->{conf}{hidelastmod};
push @Option, qq`$sz | ` unless $self->{conf}{hidesize};
push @Option, qq`$us:$gr | ` unless $self->{conf}{hideowngrp};
my $perm = '';
$perm .= qq`` unless $self->{conf}{hidepermbutton};
$perm .= $pr;
$perm .= q`` unless $self->{conf}{hidepermbutton};
push @Option, qq`$perm | ` unless $self->{conf}{hidepermissions};
push @Option, q`
`;
if($type eq 'Directories') { push @DirEntries, @Option; }
else { push @FileEntries, @Option; }
}
}
$self->{list}{DirEntries} = \@DirEntries;
$self->{list}{FileEntries} = \@FileEntries;
}
sub encode {
$_ = $_[1];
s/(\W)/'%'.sprintf("%lx", ord($1))/ge;
return $_;
}
sub unencode {
$_ = $_[1];
s/\%([\da-fA-F][\da-fA-F])/chr(hex($1))/ge;
return $_;
}
sub html_header {
my $self = shift;
qq``;
}
sub html_footer {
my $self = shift;
q`
`;
}
1;