MAPS fixes and reformating
authorAndrew DeFaria <Andrew@DeFaria.com>
Thu, 23 Jun 2016 06:06:59 +0000 (23:06 -0700)
committerAndrew DeFaria <Andrew@DeFaria.com>
Thu, 23 Jun 2016 06:06:59 +0000 (23:06 -0700)
maps/bin/MAPS.pm
maps/bin/MAPSDB.pm
maps/bin/MAPSDeliver
maps/php/list.php
maps/register.html

index 824a2cb..1c85e83 100644 (file)
@@ -2,7 +2,7 @@
 #################################################################################
 #
 # File:         $RCSfile: MAPS.pm,v $
-# Revision:    $Revision: 1.1 $
+# Revision:  $Revision: 1.1 $
 # Description:  Main module for Mail Authentication and Permission System (MAPS)
 # Author:       Andrew@DeFaria.com
 # Created:      Fri Nov 29 14:17:21  2002
@@ -208,8 +208,8 @@ sub Add2Whitelist ($$;$) {
   my ($dbsender, $subject, $timestamp, $message);
 
   # Deliver old emails
-  my $messages         = 0;
-  my $return_status    = 0;
+  my $messages    = 0;
+  my $return_status  = 0;
 
   while (($userid, $dbsender, $subject, $timestamp, $message) = GetEmail $handle) {
     last 
@@ -468,12 +468,12 @@ sub ReadMsg ($) {
   # date and data, which is a copy of the entire message.
   my ($input) = @_;
 
-  my $sender           = "";
-  my $sender_long      = "";
-  my $envelope_sender  = "";
-  my $reply_to         = "";
-  my $subject          = "";
-  my $data             = "";
+  my $sender           = "";
+  my $sender_long      = "";
+  my $envelope_sender  = "";
+  my $reply_to         = "";
+  my $subject          = "";
+  my $data             = "";
   my @data;
 
   # Find first message's "From " line indicating start of message
@@ -505,27 +505,27 @@ sub ReadMsg ($) {
     # Extract sender's address
     if (/^from: .*/i) {
       $_ = substr ($_, 6);
+      
       $sender_long = $_;
+      
       if (/<(\S*)@(\S*)>/) {
-       $sender = lc ("$1\@$2");
+        $sender = lc ("$1\@$2");
       } elsif (/(\S*)@(\S*)\ /) {
-       $sender = lc ("$1\@$2");
+        $sender = lc ("$1\@$2");
       } elsif (/(\S*)@(\S*)/) {
-       $sender = lc ("$1\@$2");
+        $sender = lc ("$1\@$2");
       } # if
     } elsif (/^subject: .*/i) {
       $subject = substr ($_, 9);
     } elsif (/^reply-to: .*/i) {
       $_ = substr ($_, 10);
       if (/<(\S*)@(\S*)>/) {
-       $reply_to = lc ("$1\@$2");
+        $reply_to = lc ("$1\@$2");
       } elsif (/(\S*)@(\S*)\ /) {
-       $reply_to = lc ("$1\@$2");
+        $reply_to = lc ("$1\@$2");
       } elsif (/(\S*)@(\S*)/) {
-       $reply_to = lc ("$1\@$2");
+        $reply_to = lc ("$1\@$2");
       } # if
-    } else {
-      next;
     } # if
   } # while
 
@@ -541,29 +541,24 @@ sub ReadMsg ($) {
   seek ($input, -length () - 1, 1) if !eof $input;
 
   # Sanitize email addresses
-  $envelope_sender     =~ s/\<//g;
-  $envelope_sender     =~ s/\>//g;
-  $envelope_sender     =~ s/\"//g;
-  $envelope_sender     =~ s/\'//g;
-  $sender              =~ s/\<//g;
-  $sender              =~ s/\>//g;
-  $sender              =~ s/\"//g;
-  $sender              =~ s/\'//g;
-  $reply_to            =~ s/\<//g;
-  $reply_to            =~ s/\>//g;
-  $reply_to            =~ s/\"//g;
-  $reply_to            =~ s/\'//g;
-
-  # Now let's pack the @data array to a scalar
-  foreach (@data) {
-    $data = $data . $_ . "\n";
-  } # foreach
+  $envelope_sender =~ s/\<//g;
+  $envelope_sender =~ s/\>//g;
+  $envelope_sender =~ s/\"//g;
+  $envelope_sender =~ s/\'//g;
+  $sender          =~ s/\<//g;
+  $sender          =~ s/\>//g;
+  $sender          =~ s/\"//g;
+  $sender          =~ s/\'//g;
+  $reply_to        =~ s/\<//g;
+  $reply_to        =~ s/\>//g;
+  $reply_to        =~ s/\"//g;
+  $reply_to        =~ s/\'//g;
 
   # Determine best addresses
-  $sender      = $envelope_sender      if $sender eq "";
-  $reply_to    = $sender               if $reply_to eq "";
+  $sender    = $envelope_sender if $sender eq "";
+  $reply_to  = $sender          if $reply_to eq "";
 
-  return $sender, $sender_long, $reply_to, $subject, $data;
+  return $sender, $sender_long, $reply_to, $subject, join "\n", @data;
 } # ReadMsg
 
 sub ResequenceList ($$) {
@@ -585,7 +580,7 @@ sub ReturnSenders ($$$;$$) {
 } # ReturnSenders
 
 sub ReturnList ($$$) {
-  my ($type, $start_at, $lines)        = @_;
+  my ($type, $start_at, $lines)  = @_;
 
   return MAPSDB::ReturnList $type, $start_at, $lines;
 } # ReturnList
@@ -653,11 +648,11 @@ sub ForwardMsg ($$$) {
   my $to = "renn.leech\@compassbank.com";
 
   my $msg = MIME::Entity->build (
-    From       => $sender,
-    To         => $to,
-    Subject    => $subject,
-    Type       => "text/html",
-    Data       => \@lines,
+    From  => $sender,
+    To    => $to,
+    Subject  => $subject,
+    Type  => "text/html",
+    Data  => \@lines,
   );
 
   # Send it
@@ -695,18 +690,18 @@ sub SendMsg ($$$$@) {
 
   # Create the message, and set up the mail headers:
   my $msg = MIME::Entity->build (
-    From       => "MAPS\@DeFaria.com",
-    To         => $sender,
-    Subject    => $subject,
-    Type       => "text/html",
-    Data       => \@lines
+    From  => "MAPS\@DeFaria.com",
+    To    => $sender,
+    Subject  => $subject,
+    Type  => "text/html",
+    Data  => \@lines
   );
 
   # Need to obtain the spam message here...
   $msg->attach (
-    Type       => "message",
-    Disposition        => "attachment",
-    Data       => \@spammsg
+    Type  => "message",
+    Disposition  => "attachment",
+    Data  => \@spammsg
   );
 
   # Send it
@@ -741,7 +736,7 @@ sub UpdateUser ($$$$) {
 } # UpdateUser
 
 sub UpdateUserOptions ($@) {
-  my ($userid, %options)       = @_;
+  my ($userid, %options)  = @_;
 
   my $status;
 
index 8dd79ac..d454ee2 100644 (file)
@@ -814,7 +814,7 @@ sub OpenDB ($$) {
 
   my $dbname   = 'MAPS';
   my $dbdriver = 'mysql';
-  my $dbserver = $ENV{MAPS_SERVER} || 'jupiter';
+  my $dbserver = $ENV{MAPS_SERVER} || 'localhost';
 
   if (!$DB || $DB eq '') {
     #$dbserver='localhost';
index 954847b..e58126c 100755 (executable)
@@ -59,6 +59,7 @@ sub DeliverMail ($$) {
   Lock $maildrop;
 
   # Write msgfile -> $maildrop
+  print $maildrop "\n";
   print $maildrop $_
     while (<$msgfile>);
 
index 4050d33..9ca33b7 100755 (executable)
   $next = (isset ($_GET ["next"])) ? $_GET ["next"] : 0;
 //  $prev;
   $type = $_GET ["type"];
-  $message = $_GET ["message"];
+  if (isset($_GET['message'])) {
+    $message = $_GET["message"];
+  } else {
+    $message = '';
+  } // if
   $Type = ucfirst ($type);
   $Userid = ucfirst ($userid);
 ?>
index 17b5503..a2f5ddb 100644 (file)
@@ -13,9 +13,8 @@ Permission System</font></h1>
 
 <div class=rightbox>
 
-<font color="#007777" size=+1></b>To register and send your previous
-email click <a
-href="http://defaria.com/maps/bin/registerform.cgi?userid=$userid;sender=$sender">here</a></b></font>
+<h1><font color="#ff0000"><a
+href="http://defaria.com/maps/bin/registerform.cgi?userid=$userid;sender=$sender">To register and send your previous email click here</a></font></h1>
 
 <p>For your convenience you email message is attached to this
 message. Note that if you register your previous emails will be