Fix login at column display in user list
authorJamie Cameron <jcameron@webmin.com>
Tue, 2 Nov 2010 23:26:02 +0000 (16:26 -0700)
committerJamie Cameron <jcameron@webmin.com>
Tue, 2 Nov 2010 23:26:02 +0000 (16:26 -0700)
mailboxes/boxes-lib.pl
useradmin/list_logins.cgi

index 19ea8cd..8f135f0 100755 (executable)
@@ -2556,6 +2556,13 @@ my $rv = eval {
                                      $now[5]);
                return $tm;
                }
+       elsif ($str =~ /^(\S+)\s+(\S+)\s+(\d{1,2})\s+(\d+):(\d+)/) {
+               # 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+)\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),
index d8011f0..73f67f7 100755 (executable)
@@ -4,6 +4,7 @@
 
 require './user-lib.pl';
 &ReadParse();
+&foreign_require("mailboxes");
 
 # Work out who we can list for
 $u = $in{'username'};
@@ -22,15 +23,15 @@ elsif ($access{'logins'} ne "*") {
 # Build the table data
 @table = ( );
 foreach $l (&list_last_logins($u, $config{'last_count'})) {
+       $tm = &mailboxes::parse_mail_date($l->[3]);
        push(@table, [
                $u ? ( ) : ( "<tt>".&html_escape($l->[0])."</tt>" ),
                &html_escape($l->[2]) || $text{'logins_local'},
                &html_escape($l->[1]),
-               &html_escape($l->[3]),
+               &make_date($tm),
                $l->[4] ? ( &html_escape($l->[4]),
                            &html_escape($l->[5]) )
-                       : { 'type' => 'string', 'columns' => 2,
-                           'value' => "<i>$text{'logins_still'}</i>" },
+                       : ( "<i>$text{'logins_still'}</i>", "" ),
                ]);
        }