Welcome to MAPS 2.0
[clearscm.git] / maps / bin / registerform.cgi
index eb762c6..25e2c63 100755 (executable)
@@ -2,8 +2,8 @@
 ################################################################################
 #
 # File:         $RCSfile: registerform.cgi,v $
-# Revision:    $Revision: 1.1 $
-# Description: Register a MAPS user
+# Revision:     $Revision: 1.1 $
+# Description:  Register a MAPS user
 # Author:       Andrew@DeFaria.com
 # Created:      Mon Jan 16 20:25:32 PST 2006
 # Modified:     $Date: 2013/06/12 14:05:47 $
@@ -16,93 +16,94 @@ use strict;
 use warnings;
 
 use FindBin;
-$0 = $FindBin::Script;
+local $0 = $FindBin::Script;
 
 use CGI qw/:standard *table start_div end_div/;
 
+use lib "$FindBin::Bin/../lib";
+
 use MAPS;
 use MAPSWeb;
 
-my $userid     = param ("userid");
-my $Userid     = ucfirst $userid;
-my $sender     = param ("sender");
-my $errormsg   = param ("errormsg");
+my $userid   = param ('userid');
+my $Userid   = ucfirst $userid;
+my $sender   = param ('sender');
+my $errormsg = param ('errormsg');
 
-sub Heading {
+sub MyHeading {
   print
-    header     (-title => "MAPS Registration"),
+    header     (-title  => "MAPS Registration"),
     start_html (-title  => "MAPS Registration",
-               -author => "Andrew\@DeFaria.com",
-               -style  => {-src        => "/maps/css/MAPSPlain.css"},
-               -script => [{ -language => "JavaScript1.2",
-                             -src      => "/maps/JavaScript/MAPSUtils.js"},
-                           { -language => "JavaScript1.2",
-                             -src      => "/maps/JavaScript/CheckRegistration.js"}
-                          ]);
+                -author => "Andrew\@DeFaria.com",
+                -style  => {-src => "/maps/css/MAPSPlain.css"},
+                -script => [{ -language => "JavaScript1.2",
+                -src    => "/maps/JavaScript/MAPSUtils.js"},
+                  { -language => "JavaScript1.2",
+                -src    => "/maps/JavaScript/CheckRegistration.js"}
+                ]);
   print
     h2 ({-class => "header", -align => "center"},
-      font ({-class => "standout"}, "MAPS"),
-        "Mail Authorization and Permission System");
+      "Mail Authorization and Permission System");
 
-  if (defined $errormsg) {
+  if ($errormsg) {
     DisplayError $errormsg;
     exit;
   } # if
-} # Heading
+} # MyHeading
 
 sub Body {
   print start_div {-class => "content"};
   print p ("${Userid}'s email is protected by MAPS, a spam elimination
-          system. In order to email $Userid you must register. You need
-          only register once to be added to ${Userid}'s <i>white list</i>,
-          thereafter you should have no problems emailing them. This is not
-          unlike the acceptance procedure for many instant messaging clients.");
+            system. In order to email $Userid you must register. You need
+            only register once to be added to ${Userid}'s <i>white list</i>,
+            thereafter you should have no problems emailing them. This is not
+            unlike the acceptance procedure for many instant messaging clients.");
   print p ("Please enter your full name and click on Register to complete the
-          registration.");
+            registration.");
   print start_form {
-    -method    => "post",
-    -action    => "register.cgi",
-    -onSubmit  => "return validate (this);"
+    -method   => "post",
+    -action   => "register.cgi",
+    -onSubmit => "return validate (this);"
   };
   print start_table {
-    -cellpadding       => 2,
-    -cellspacing       => 0,
-    -border            => 0,
-    -align             => "center",
-    -width             => "360"
+    -cellpadding => 2,
+    -cellspacing => 0,
+    -border      => 0,
+    -align       => "center",
+    -width       => "360"
   };
-  print hidden (-name  => "userid",
-               -value  => "$userid");
+  print hidden (-name  => "userid",
+                -value => "$userid");
   print Tr [
     td ({-class => "header"}, "Full name:") .
-    td (textfield {-class      => "inputfield",
-                  -size        => 50,
-                  -name        => "fullname"})
+    td (textfield {-class => "inputfield",
+                   -size  => 50,
+                   -name  => "fullname"})
   ];
-  print hidden (-name  => "sender",
-               -value  => "$userid");
+  print hidden (-name  => "sender",
+                -value => "$userid");
   print end_table;
-  print p {-align      => "center"},
-    submit (-name      => "submit",
-           -value      => "Register");
+  print p {-align  => "center"},
+    submit (-name  => "submit",
+            -value => "Register");
   print end_form;
   print p ("Tired of dealing with unsolicited email (AKA SPAM)? Want to know
-           more about MAPS, the Mail Authorization and Permission System for
-           eliminating SPAM? Click",
-       a ({-href       => "/maps/",
-           -target     => "_blank"},
-          "here"),
-          "to find out more.");
+            more about MAPS, the Mail Authorization and Permission System for
+            eliminating SPAM? Click",
+            a ({-href   => "/maps/",
+                -target => "_blank"},
+                "here"),
+            "to find out more.");
   print start_table {
-    -cellpadding       => 2,
-    -cellspacing       => 0,
-    -border            => 1,
-    -align             => "center",
-    -width             => "50%"
+    -cellpadding => 2,
+    -cellspacing => 0,
+    -border      => 1,
+    -align       => "center",
+    -width       => "50%"
   };
   print Tr [
     td ({-class => "note",
-        -align => "center"}, "Note")
+         -align => "center"}, "Note")
   ];
   print Tr [
     td ({-class => "notetext"}, 
@@ -112,9 +113,11 @@ sub Body {
   ];
   print end_table;
   print end_div;
+
+  return;
 } # Body
 
-if (!defined $userid) {
+if (!$userid) {
   $errormsg = "Internal error: Userid not specified";
 } else {
   if (!UserExists ($userid)) {
@@ -122,6 +125,6 @@ if (!defined $userid) {
   } # if
 }
 
-Heading;
+MyHeading;
 Body;
 Footing;