{
local ($str) = @_;
$str =~ s/^[, \t]+//;
+$str =~ s/\s+$//;
open(OLDSTDERR, ">&STDERR"); # suppress STDERR from Time::Local
close(STDERR);
my $rv = eval {
$7 < 50 ? $7+100 : $7 < 1000 ? $7 : $7-1900);
return $tm;
}
- elsif ($str =~ /^(\S+)\s+(\S+)\s+(\d{1,2})\s+(\d+):(\d+):(\d+)/) {
+ elsif ($str =~ /^(\S+)\s+(\S+)\s+(\d{1,2})\s+(\d+):(\d+):(\d+)/ &&
+ &month_to_number($2)) {
# Format like Tue Dec 7 12:58:52
local @now = localtime(time());
local $tm = timelocal($6, $5, $4, $3, &month_to_number($2),
$now[5]);
return $tm;
}
- elsif ($str =~ /^(\S+)\s+(\S+)\s+(\d{1,2})\s+(\d+):(\d+)/) {
+ elsif ($str =~ /^(\S+)\s+(\S+)\s+(\d{1,2})\s+(\d+):(\d+)$/ &&
+ defined(&month_to_number($2))) {
# Format like Tue Dec 7 12:58
local @now = localtime(time());
local $tm = timelocal(0, $5, $4, $3, &month_to_number($2),
$now[5]);
return $tm;
}
+ elsif ($str =~ /^(\S+)\s+(\d{1,2})\s+(\d+):(\d+)$/ &&
+ defined(&month_to_number($1))) {
+ # Format like Dec 7 12:58
+ local @now = localtime(time());
+ local $tm = timelocal(0, $4, $3, $2, &month_to_number($1),
+ $now[5]);
+ return $tm;
+ }
elsif ($str =~ /^(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s+(\d+)\s+(\S+)/) {
# Format like Dec 7 12:58:52 2004 GMT
local $tm = timegm($5, $4, $3, $2, &month_to_number($1),
require './user-lib.pl';
&ReadParse();
-&foreign_require("mailboxes");
+if (&foreign_check("mailboxes")) {
+ &foreign_require("mailboxes");
+ }
# Work out who we can list for
$u = $in{'username'};
# Build the table data
@table = ( );
foreach $l (&list_last_logins($u, $config{'last_count'})) {
- $tm = &mailboxes::parse_mail_date($l->[3]);
+ $tm = defined(&mailboxes::parse_mail_date) ?
+ &mailboxes::parse_mail_date($l->[3]) : undef;
push(@table, [
$u ? ( ) : ( "<tt>".&html_escape($l->[0])."</tt>" ),
&html_escape($l->[2]) || $text{'logins_local'},
&html_escape($l->[1]),
- &make_date($tm),
+ &html_escape($tm ? &make_date($tm) : $l->[3]),
$l->[4] ? ( &html_escape($l->[4]),
&html_escape($l->[5]) )
: ( "<i>$text{'logins_still'}</i>", "" ),
require './user-lib.pl';
$access{'logins'} || &error($text{'who_ecannot'});
+if (&foreign_check("mailboxes")) {
+ &foreign_require("mailboxes");
+ }
&ui_print_header(undef, $text{'who_title'}, "");
@whos = &logged_in_users();
@table = ( );
foreach $w (@whos) {
+ $tm = defined(&mailboxes::parse_mail_date) ?
+ &mailboxes::parse_mail_date($w->{'when'}) : undef;
push(@table, [
"<a href='list_logins.cgi?username=".&urlize($w->{'user'})."'>".
&html_escape($w->{'user'})."</a>",
&html_escape($w->{'tty'}),
- &html_escape($w->{'when'}),
+ &html_escape($tm ? &make_date($tm) : $w->{'when'}),
$w->{'from'} ? &html_escape($w->{'from'})
: $text{'logins_local'},
]);