arteman (arteman) wrote in changelog,
arteman
arteman
changelog

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

Committer: azateev
LJSUP-12275 Some improvements of /manage/logins.bml
U   trunk/htdocs/manage/logins.bml
U   trunk/htdocs/manage/logins.bml.text
Modified: trunk/htdocs/manage/logins.bml
===================================================================
--- trunk/htdocs/manage/logins.bml	2012-05-22 12:06:06 UTC (rev 22024)
+++ trunk/htdocs/manage/logins.bml	2012-05-22 13:03:03 UTC (rev 22025)
@@ -19,8 +19,9 @@
 
     my $body = my $user = '';
     my $adminmode = 0;
-    if (LJ::check_priv($u, 'canview', 'sessions') ||
-        LJ::check_priv($u, 'canview', '*')) {
+    my $can_view_ip = LJ::check_priv($u, 'canview', 'sessions');
+    if ($can_view_ip ||
+        LJ::check_priv($u, 'canview', 'sessions-sup')) {
         $user = LJ::canonical_username($GET{'user'} || $POST{'user'});
         $body .= "<form method='GET' action='logins.bml'>\n";
         $body .= "<label for='user'>$ML{'.user'} ";
@@ -63,7 +64,14 @@
     } else {
         $body .= "<?h1 $ML{'.loggedin.header'} h1?>";
     }
-    $body .= "<table width='100%'><tr><th>$ML{'.loggedin.table.time'}</th><th>$ML{'.loggedin.table.ip'}</th><th width='45%'>$ML{'.loggedin.table.useragent'}</th>";
+    $body .= "<table width='100%'><tr>\n";
+    $body .= "<th>$ML{'.loggedin.table.time'}</th>";
+    $body .= "<th>$ML{'.loggedin.table.ip'}</th>";
+    $body .= "<th>$ML{'.loggedin.table.country'}</th>";
+    if ($adminmode) {
+        $body .= "<th>$ML{'.loggedin.table.isp'}</th>";
+    }
+    $body .= "<th width='45%'>$ML{'.loggedin.table.useragent'}</th>";
     $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;
 
@@ -73,9 +81,16 @@
             next;
         }
 
+        my $ip = $can_view_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";
         $body .= "<td>" . LJ::ehtml(LJ::TimeUtil->time_to_http($login->[0])) . "</td>\n";
-        $body .= "<td>" . LJ::ehtml($login->[2]) . "</td>\n";
+        $body .= "<td>" . $ip . "</td>\n";
+        $body .= "<td>" . $country . "</td>\n";
+        if ($adminmode) {
+           $body .= "<td>" . $isp . "</td>\n";
+        }
         $body .= "<td>" . LJ::ehtml($login->[3]) . "</td>\n";
         if ($adminmode) {
             my $sid = $login->[1];
@@ -106,11 +121,24 @@
     } else {
         $body .= "<?h1 $ML{'.prior.header'} h1?>\n";
     }
-    $body .= "<table width='100%'><tr><th>$ML{'.prior.table.time'}</th><th>$ML{'.prior.table.ip'}</th><th width='57%'>$ML{'.prior.table.useragent'}</th></tr>";
+    $body .= "<table width='100%'><tr><th>$ML{'.prior.table.time'}</th>";
+    $body .= "<th>$ML{'.loggedin.table.ip'}</th>";
+    $body .= "<th>$ML{'.loggedin.table.country'}</th>";
+    if ($adminmode) {
+        $body .= "<th>$ML{'.loggedin.table.isp'}</th>";
+    }
+    $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 $country = LJ::LJcom::country_of_ip($login->[2]) || '-';
+        my $isp = LJ::LJcom::isp_of_ip($login->[2]) || '-';
         $body .= "<tr>\n";
         $body .= "<td>" . LJ::ehtml(LJ::TimeUtil->time_to_http($login->[0])) . "</td>\n";
-        $body .= "<td>" . LJ::ehtml($login->[2]) . "</td>\n";
+        $body .= "<td>" . $ip . "</td>\n";
+        $body .= "<td>" . $country . "</td>\n";
+        if ($adminmode) {
+           $body .= "<td>" . $isp . "</td>\n";
+        }
         $body .= "<td>" . LJ::ehtml($login->[3]) . "</td>\n";
         $body .= "</tr>\n";
     }

Modified: trunk/htdocs/manage/logins.bml.text
===================================================================
--- trunk/htdocs/manage/logins.bml.text	2012-05-22 12:06:06 UTC (rev 22024)
+++ trunk/htdocs/manage/logins.bml.text	2012-05-22 13:03:03 UTC (rev 22025)
@@ -7,6 +7,8 @@
 
 .loggedin.table.bound=Bound to IP
 
+.loggedin.table.country=Country
+
 .loggedin.table.create=Creation Time
 
 .loggedin.table.current=Current Session
@@ -17,6 +19,8 @@
 
 .loggedin.table.ip=IP Address
 
+.loggedin.table.isp=ISP
+
 .loggedin.table.logout=Log Out
 
 .loggedin.table.time=Login Time

Tags: arteman, azateev, bml, livejournal, text
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