3 # Display the last login locations, tty, login time and duration
5 require './user-lib.pl';
7 if (&foreign_check("mailboxes")) {
8 &foreign_require("mailboxes");
11 # Work out who we can list for
13 if (!$access{'logins'}) {
14 &error($text{'logins_elist'});
16 elsif ($access{'logins'} ne "*") {
17 $u || &error($text{'logins_elist'});
18 local @ul = split(/\s+/, $access{'logins'});
19 &indexof($u,@ul) >= 0 ||
20 &error(&text('logins_elistu', $u));
23 &ui_print_header(undef, $text{'logins_title'}, "", "list_logins");
25 # Build the table data
27 foreach $l (&list_last_logins($u, $config{'last_count'})) {
28 $tm = defined(&mailboxes::parse_mail_date) ?
29 &mailboxes::parse_mail_date($l->[3]) : undef;
31 $u ? ( ) : ( "<tt>".&html_escape($l->[0])."</tt>" ),
32 &html_escape($l->[2]) || $text{'logins_local'},
33 &html_escape($l->[1]),
34 &html_escape($tm ? &make_date($tm) : $l->[3]),
35 $l->[4] ? ( &html_escape($l->[4]),
36 &html_escape($l->[5]) )
37 : ( "<i>$text{'logins_still'}</i>", "" ),
43 print &ui_subheading(&text('logins_head', &html_escape($u)));
45 print &ui_columns_table(
46 [ $u ? ( ) : ( $text{'user'} ), $text{'logins_from'},
47 $text{'logins_tty'}, $text{'logins_in'}, $text{'logins_out'},
48 $text{'logins_for'} ],
57 &ui_print_footer("", $text{'index_return'});