More fixes
authorAndrew DeFaria <Andrew@DeFaria.com>
Wed, 21 Jul 2021 05:19:55 +0000 (22:19 -0700)
committerAndrew DeFaria <Andrew@DeFaria.com>
Wed, 21 Jul 2021 05:19:55 +0000 (22:19 -0700)
. Fixed bug in maps where people pretending to me were getting through
. Changed table formatting to be more similar

maps/bin/detail.cgi
maps/bin/maps
maps/css/MAPSStyle.css
maps/lib/MAPS.pm
maps/php/MAPS.php
maps/php/list.php

index 53fc47e..f4885fd 100755 (executable)
@@ -9,7 +9,7 @@
 # Modified:     $Date: 2013/06/12 14:05:47 $
 # Language:     perl
 #
-# (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
+# (c) Copyright 2000-2021, Andrew@DeFaria.com, all rights reserved.
 #
 ################################################################################
 use strict;
@@ -177,21 +177,42 @@ sub Body($) {
       th {-class  => 'tablebordertopright'}, 'Comment',
     ];
 
-  for my $sender (ReturnSenders(
+  my @senders = ReturnSenders(
     userid   => $userid,
     type     => $type,
     start_at => $next,
     lines    => $lines,
     date     => $date
-  )) {
+  );
+
+  for my $sender (@senders) {
     my $msgs = ReturnMessages(
       userid => $userid,
       sender => $sender,
     );
 
+    my $leftclass    = 'tableleftdata';
+    my $dataclass    = 'tabledata';
+    my $rightclass   = 'tablerightdata';
+    my $senderclass  = 'sender';
+    my $subjectclass = 'subject';
+
+    # Check to see if this is the last line
+    if ((($next + 1) % $lines) == (@senders % $lines)) {
+      # We always "bottom" the first column
+      $leftclass = 'tablebottomleft';
+
+      # Check to see if there any message lines to display
+      unless (@$msgs) {
+        $dataclass   = 'tablebottomdata';
+        $rightclass  = 'tablebottomright';
+        $senderclass = 'senderbottom';
+      } # unless
+    } # if
+
     # This is for the purposes of supplying a subject line if the mailto address
     # is clicked on. It's kludgy because we are simply grabbing the subject line
-    # of the first email sent where there may be many emails from this sender.
+    # of the first email sent where there may be many emails from this sender
     # Still it is often the right subject (or a good enough one)
     #
     # A little tricky here because of transliteration. If I test for
@@ -245,47 +266,59 @@ sub Body($) {
 
     print start_Tr {-valign => 'middle'};
     print td {
-      -class => 'tableborder',
+      -class   => $leftclass,
+      -align   => 'right',
+      -valign  => 'middle',
       -rowspan => $rowspan,
-    }, small ($next,
+    }, $next,
       checkbox {
-        -name  => "action$next",
-        -label => ''
-      }), hidden({
+        -name   => "action$next",
+        -label  => '',
+        -valign => 'middle',
+      };
+
+      print hidden({
         -name    => "email$next",
-        -default => $sender
+        -default => $sender,
       });
 
     # Get subject line
     $heading = "?subject=$heading" if $heading;
 
     print td {
-      -class => 'sender',
+      -class => $senderclass,
     }, a {
       -href  => "mailto:$sender$heading",
-    }, " $sender";
+    }, "&nbsp;$sender";
 
     my $listlink = ($list and $sequence) ? "$list:$sequence" : '&nbsp;';
 
     print td {
-      -class => 'tabledata',
+      -class => $dataclass,
       -align => 'right',
     }, a {
       href  => "/maps/php/list.php?type=$list&next=" . ($sequence - 1),
     }, $listlink,
     td {
-      -class => 'tabledata',
+      -class => $dataclass,
       -align => 'right',
     }, "$hit_count&nbsp;",
     td {
-      -class => 'tabledata',
+      -class => $dataclass,
     }, $rule,
     td {
-      -class => 'tablerightdata',
+      -class => $rightclass,
     }, $comment;
     print end_Tr;
 
     for my $rec (@$msgs) {
+      # We increased $next earlier so do not add 1 here
+      if (($next % $lines) == (@senders % $lines)) {
+        $dataclass    = 'tablebottomdata';
+        $rightclass   = 'tablebottomright';
+        $subjectclass = 'subjectbottom';
+      } # if
+
       if ($date eq substr ($rec->{timestamp}, 0, 10)) {
         $rec->{date} = b font {-color => 'green'}, SQLDatetime2UnixDatetime $rec->{timestamp};
       } else {
@@ -300,29 +333,18 @@ sub Body($) {
       print
         Tr [
           td {
-            -class   => 'subject',
-            -valign  => 'middle',
-            -bgcolor => '#ffffff',
+            -class   => $subjectclass,
             -colspan => 4,
-          }, a {-href    => "display.cgi?sender=$sender;msg_date=$rec->{timestamp}"
+          }, a {
+            -href  => "display.cgi?sender=$sender;msg_date=$rec->{timestamp}",
            }, '&nbsp;&nbsp;&nbsp;&nbsp;' . $rec->{subject},
-          td {-class   => 'tablerightdata',
+          td {-class   => $rightclass,
               -width   => '150',
-              -valign  => 'middle',
-              -align   => 'right'}, span {-class => 'date'}, $rec->{date},
+              -align   => 'right'}, span {-class => 'date'}, $rec->{date} . '&nbsp',
         ];
     } # for
   } # for
 
-  print
-    Tr [
-      td {-class  => 'tableborderbottomleft'},  '&nbsp;',
-      th {-class  => 'tableborder'},            '&nbsp;',
-      th {-class  => 'tableborder'},            '&nbsp;',
-      th {-class  => 'tableborder'},            '&nbsp;',
-      th {-class  => 'tableborder'},            '&nbsp;',
-      th {-class  => 'tableborderbottomright'}, '&nbsp;'
-    ];
   print end_table;
   print end_form;
 
index 854316b..223cda6 100755 (executable)
@@ -120,8 +120,8 @@ sub ProcessMsgs ($$$) {
 
   return unless $execute;
 
-  while (!eof *$msgfile) {
-    my ($sender, $sender_long, $reply_to, $subject, $data) = ReadMsg (*$msgfile);
+  while (!eof $msgfile) {
+    my ($sender, $sender_long, $reply_to, $subject, $data) = ReadMsg ($msgfile);
 
     my ($onlist, $rule, $sequence, $hit_count);
 
@@ -232,6 +232,6 @@ verbose "Starting MAPS....";
 my %userOptions = SetContext $userid
   or die "$userid is not a registered MAPS user\n";
 
-ProcessMsgs $msgfile, $userOptions{name}, $userOptions{email};
+ProcessMsgs $msgfile, $userOptions{name}, lc $userOptions{email};
 
 exit 0;
index f7be5a6..ca8c491 100644 (file)
@@ -294,7 +294,7 @@ img {
   background:                 SteelBlue;
   color:                      white;
   font-style:                 bold;
-  font-size:                  14;
+  font-size:                  14px;
   text-align:                 center;
   -moz-border-radius-topleft: 7px;
   border-top-left-radius:     7px;
@@ -304,7 +304,7 @@ img {
   background:                  SteelBlue;
   color:                       white;
   font-style:                  bold;
-  font-size:                   14;
+  font-size:                   14px;
   text-align:                  center;
   -moz-border-radius-topright: 7px;
   border-top-right-radius:     7px;
@@ -314,7 +314,7 @@ img {
   background:                 SteelBlue;
   color:                      white;
   font-style:                 bold;
-  font-size:                  14;
+  font-size:                  14px;
   text-align:                 center;
   -moz-border-radius-topleft: 7px;
   border-top-left-radius:     7px;
@@ -324,7 +324,7 @@ img {
   background:                 SteelBlue;
   color:                       white;
   font-style:                  bold;
-  font-size:                   14;
+  font-size:                   14px;
   text-align:                  center;
   -moz-border-radius-topright: 7px;
   border-top-right-radius:     7px;
@@ -334,7 +334,7 @@ img {
   background:                    SteelBlue;
   color:                         white;
   font-style:                    bold;
-  font-size:                     14;
+  font-size:                     14px;
   text-align:                    center;
   -moz-border-radius-bottomleft: 7px;
   border-bottom-left-radius:     7px;
@@ -344,7 +344,7 @@ img {
   background:                     SteelBlue;
   color:                          white;
   font-style:                     bold;
-  font-size:                      14;
+  font-size:                      14px;
   text-align:                     center;
   -moz-border-radius-bottomright: 7px;
   border-bottom-right-radius:     7px;
@@ -354,7 +354,7 @@ img {
   background: SteelBlue;
   color:      white;
   font-style: bold;
-  font-size:  14;
+  font-size:  14px;
   text-align: center;
 }
 
@@ -404,39 +404,39 @@ img {
 
 .tableleftdata {
   background:    White;
-  color:         Red;
+  color:         black;
   border-left:   solid 3px SteelBlue;
   border-bottom: 1px dotted #ccc;
-  font-size:     14;
+  font-size:     12px;
 }
 .tableleftrightdata {
   background:    #c1dffc;
   border-right:  solid 3px SteelBlue;
   border-left:   solid 1px SteelBlue;
   border-bottom: 1px dotted #ccc;
-  font-size:     14;
+  font-size:     12px;
 }
 .tablerightleftdata {
   background:    #c1dffc;
   border-right:  solid 1px SteelBlue;
   border-left:   solid 3px SteelBlue;
   border-bottom: 1px dotted #ccc;
-  font-size:     14;
+  font-size:     12px;
 }
 .tablerightdata {
   background:    White;
   border-right:  solid 3px SteelBlue;
   border-left:   1px dotted #ccc;
   border-bottom: 1px dotted #ccc;
-  font-size:     14;
+  font-size:     12px;
 }
 .tablebottomleft {
   background:                    White;
-  color:                         Red;
+  color:                         black;
   border-left:                   solid 3px SteelBlue;
   border-right:                  1px dotted #ccc;
   border-bottom:                 solid 3px SteelBlue;
-  font-size:                     14;
+  font-size:                     14px;
   -moz-border-radius-bottomleft: 7px;
   border-bottom-left-radius:     7px;
 }
@@ -445,7 +445,7 @@ img {
   border-right:                   solid 3px SteelBlue;
   border-left:                    1px dotted #ccc;
   border-bottom:                  solid 3px SteelBlue;
-  font-size:                      14;
+  font-size:                      14px;
   -moz-border-radius-bottomright: 7px;
   border-bottom-right-radius:     7px;
 }
@@ -453,14 +453,14 @@ img {
   background:    White;
   border-left:   1px dotted #ccc;
   border-bottom: solid 3px SteelBlue;
-  font-size:     14;
+  font-size:     14px;
 }
 .tablebottomlefttotal {
   background:                    #c1dffc;
   border-left:                   solid 3px SteelBlue;
   border-bottom:                 solid 3px SteelBlue;
   border-right:                  1px dotted #ccc;
-  font-size:                     14;
+  font-size:                     14px;
   -moz-border-radius-bottomleft: 7px;
   border-bottom-left-radius:     7px;
 }
@@ -468,7 +468,7 @@ img {
   background:                     #c1dffc;
   border-right:                   solid 3px SteelBlue;
   border-bottom:                  solid 3px SteelBlue;
-  font-size:                      14;
+  font-size:                      14px;
   -moz-border-radius-bottomright: 7px;
   border-bottom-right-radius:     7px;
 }
@@ -477,17 +477,18 @@ img {
   border-bottom: solid 3px SteelBlue;
   border-top:    solid 1px SteelBlue;
   border-right:  1px dotted #ccc;
-  font-size:     14;
+  font-size:     14px;
 }
 .tabledata {
   background:    White;
   border-left:   1px dotted #ccc;
   border-bottom: 1px dotted #ccc;
-  font-size:     14;
+  font-size:     14px;
 }
+
 .date {
   background: White;
-  font-size:  10px;
+  font-size:  12px;
 }
 
 .dateright {
@@ -501,50 +502,68 @@ img {
 /* Special anchor effects */
 .sender {
   background:  White;
+  border-top:  1px dotted #ccc;
+  border-left: 1px dotted #ccc;
   font-family: arial, sans-serif;
-  font-size:   12px;
-  font-weight: bold;
+  font-size:   14px;
 }
-
 .sender a:link {
-  color: Red;
+  color: steelblue;
 }
-
-.sender a:visited {
-  color: #0054e3;
-}
-
 .sender a:hover {
-  color:      White;
-  background: Red;
+  color:      red;
+  background: white;
 }
 
-.sender a:active {
-  color: Yellow;
+.senderbottom {
+  background:    White;
+  border-top:    1px dotted #ccc;
+  border-left:   1px dotted #ccc;
+  border-bottom: solid 3px SteelBlue;
+  font-size:     14px;
+}
+.senderbottom a:link {
+  color: steelblue;
+}
+.senderbottom a:hover {
+  color:      red;
+  background: white;
 }
 
 .subject {
-  background:  White;
-  font-family: arial, sans-serif;
-  font-size:   10px;
-  font-weight: bold;
+  background:     white;
+  border-top:     1px dotted #ccc;
+  border-left:    1px dotted #ccc;
+  font-family:    arial, sans-serif;
+  font-size:      16px;
 }
-
 .subject a:link {
-  color: #0000ee;
+  color: #b11;
 }
-
 .subject a:visited {
-  color: #cc33cc;
+  color: grey;
 }
-
 .subject a:hover {
-  color:      White;
-  background: #0054e3;
+  color:      blue;
+  background: white;
 }
 
-.subject a:active {
-  color: #ff0000;
+.subjectbottom {
+  background:    White;
+  border-top:    1px dotted #ccc;
+  border-left:   1px dotted #ccc;
+  border-bottom: solid 3px SteelBlue;
+  font-size:     16px;
+}
+.subjectbottom a:link {
+  color: #b11;
+}
+.subjectbottom a:visited {
+  color: grey;
+}
+.subjectbottom a:hover {
+  color:      blue;
+  background: white;
 }
 
 /* Menu anchors */
index c0e3448..3e0b066 100644 (file)
@@ -629,7 +629,7 @@ sub CountLog(%) {
   my $condition  = "userid='$userid'";
      $condition .= " and $additional_condition" if $additional_condition;
 
-  return $db->count_distinct('log', 'sender', $condition);
+  return $db->count('log', $condition);
 } # CountLog
 
 sub Decrypt ($$) {
index 589e74d..3816c00 100755 (executable)
@@ -405,9 +405,9 @@ function DisplayList($type, $next, $lines) {
     or DBError("DisplayList: Unable to execute query: ", $statement);
 
   for ($i = 0; $i < $lines; $i++) {
-    $row = mysqli_fetch_array ($result);
+    $row = mysqli_fetch_array($result);
 
-    if (!isset ($row ["sequence"])) {
+    if (!isset ($row["sequence"])) {
       break;
     } // if
 
@@ -433,8 +433,7 @@ function DisplayList($type, $next, $lines) {
     $rightclass = ($i == $lines || $sequence == $total || $sequence == $last) ?
       "tablebottomright" : "tablerightdata";
 
-    print "<td class=$leftclass align=center>"  . $sequence  . "</td>";
-    print "<td class=$dataclass align=center><input type=checkbox name=action" . $sequence . " value=on></td>\n";
+    print "<td class=$leftclass align=right>"   . $sequence  . "<input type=checkbox name=action" . $sequence . " value=on></td>\n";
     print "<td class=$dataclass align=right>"   . $username  . "</td>";
     print "<td class=$dataclass align=center>@</td>";
     print "<td class=$dataclass align=left><a href=\"http://$domain\" target=_blank>$domain</a></td>";
index bc38d99..964f061 100755 (executable)
@@ -103,8 +103,7 @@ $this_page = $next / $lines + 1;
   </div>
   <table border="0" cellspacing="0" cellpadding="4" width="100%" align="center" name="list">
     <tr>
-      <th class="tableleftend">Seq</th>
-      <th class="tableheader">Mark</th>
+      <th class="tableleftend">&nbsp;</th>
       <th class="tableheader">Username</th>
       <th class="tableheader">@</th>
       <th class="tableheader">Domain</th>
@@ -114,7 +113,7 @@ $this_page = $next / $lines + 1;
       <th class="tablerightend">Comments</th>
     </tr>
 
-    <?php DisplayList ($type, $next, $lines)?>
+    <?php DisplayList($type, $next, $lines)?>
 
   </table>
   <br>