arteman (arteman) wrote in changelog,
arteman
arteman
changelog

[livejournal] r22047: LJSUP-12275 Some improvements of /manage...

Committer: azateev
LJSUP-12275 Some improvements of /manage/logins.bml
U   trunk/htdocs/manage/logins.bml
Modified: trunk/htdocs/manage/logins.bml
===================================================================
--- trunk/htdocs/manage/logins.bml	2012-05-24 08:30:20 UTC (rev 22046)
+++ trunk/htdocs/manage/logins.bml	2012-05-24 10:40:39 UTC (rev 22047)
@@ -19,6 +19,7 @@
     my $u = LJ::get_remote();
     return "<?needlogin?>" unless $u;
 
+    my $remote_id = $u->id;
     my $body = my $user = '';
     my $adminmode = 0;
     my $can_view_ip = LJ::check_priv($u, 'canview', 'sessions');
@@ -77,13 +78,17 @@
     $body .= "<th>$ML{'.loggedin.table.exptype'}</th><th>$ML{'.loggedin.table.bound'}</th><th>$ML{'.loggedin.table.create'}</th><th>$ML{'.loggedin.table.expire'}</th>" if $adminmode;
     $body .= "<th>$ML{'.loggedin.table.logout'}</th></tr>\n" unless $user;
 
+    my $show_ip;
+    if ($can_view_ip || $remote_id eq $u->id) {
+        $show_ip = 1; 
+    }
     foreach my $login (sort { $a->[1] <=> $b->[1] } @$logins) {
         unless (defined $sessions->{$login->[1]}) {
             push @prior, $login;
             next;
         }
 
-        my $ip = $can_view_ip ? LJ::ehtml($login->[2]) : '***';
+        my $ip = $show_ip ? LJ::ehtml($login->[2]) : '***';
         my $country = LJ::LJcom::country_of_ip($login->[2]) || '-';
         my $isp = LJ::LJcom::isp_of_ip($login->[2]) || '-';
         $body .= "<tr>\n";
@@ -131,7 +136,7 @@
     }
     $body .= "<th width='57%'>$ML{'.prior.table.useragent'}</th></tr>";
     foreach my $login (sort { $b->[1] <=> $a->[1] } @prior) {
-        my $ip = $can_view_ip ? LJ::ehtml($login->[2]) : '***';
+        my $ip = $show_ip ? LJ::ehtml($login->[2]) : '***';
         my $country = LJ::LJcom::country_of_ip($login->[2]) || '-';
         my $isp = LJ::LJcom::isp_of_ip($login->[2]) || '-';
         $body .= "<tr>\n";

Tags: arteman, azateev, bml, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments