d54a8b6cf2bb0073e9ff6d9ff64ef0d6fd925232
[clearscm.git] / maps / bin / main.cgi
1 #!/usr/bin/perl
2 ################################################################################
3 #
4 # File:         $RCSfile: main.cgi,v $
5 # Revision:     $Revision: 1.1 $
6 # Description:  This is the main or home page for maps. It is presented when the
7 #               user logs in.
8 # Author:       Andrew@DeFaria.com
9 # Created:      Fri Nov 29 14:17:21  2002
10 # Modified:     $Date: 2013/06/12 14:05:47 $
11 # Language:     perl
12 #
13 # (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
14 #
15 ################################################################################
16 use strict;
17 use warnings;
18
19 use FindBin;
20 $0 = $FindBin::Script;
21
22 use lib $FindBin::Bin;
23
24 use MAPS;
25 use MAPSLog;
26 use MAPSUtil;
27 use MAPSWeb;
28
29 use CGI qw (:standard *table start_Tr end_Tr start_div end_div);
30 use CGI::Carp "fatalsToBrowser";
31
32 my $new_userid = param ("userid");
33 my $password   = param ("password");
34
35 sub Body {
36   print
37     h3 ("Welcome to MAPS!"),
38     p  "This is the main or home page of MAPS. To the left
39        you see a menu of choices that you can use to explore MAPS
40        functionality.",
41     a ({-href   => "/maps/bin/stats.cgi"},
42       "Statistics"),
43       "gives you a view of the spam that MAPS has been trapping for you
44        in tabular format. You can use",
45     a ({-href => "/maps/bin/editprofile.cgi"},
46       "Edit Profile"),
47       "to change your profile information or to change your password.";
48   print
49     p "MAPS also offers a series of web based",
50     a ({-href => "/maps/Reports.html"},
51       "Reports"),
52       "to analyze your mail flow. You can manage your",
53     a ({-href => "/maps/bin/list.cgi?type=white"},
54        "White") . ",",
55     a ({-href => "/maps/bin/list.cgi?type=black"},
56        "Black"), "and",
57     a ({-href => "/maps/bin/list.cgi?type=null"},
58        "Null"),
59        "lists although MAPS seeks to put that responsibility on those
60         who wish to email you. You can use this to pre-register somebody
61         or to black or null list somebody. You can also import/export
62         your lists through these pages.";
63   print
64     p a ({-href => "/maps/Admin.html"},
65       "MAPS Administration"),
66       "is to administer MAPS itself and is only available to MAPS
67        Administrators.";
68   print
69     p "Also on the left you will see ", i ("Today's Activity"),
70       "which quickly shows you what mail MAPS processed today for you.";
71 } # Body
72
73 # Main
74 my $action;
75
76 if (defined $new_userid) {
77   my $result = Login $new_userid, $password;
78
79   if ($result == -1) {
80     if ($new_userid eq "") {
81       print redirect ("/maps/?errormsg=Please specify a username");
82       exit $result;
83     } else {
84       print redirect ("/maps/?errormsg=User \"$new_userid\" does not exist");
85       exit $result;
86     } # if
87   } elsif ($result == -2) {
88     print redirect ("/maps/?errormsg=Invalid password");
89     exit $result;
90   } else {
91     $action = "setcookie";
92   } # if
93 } else {
94   $action = "getcookie"
95 } # if
96
97 my $userid = Heading (
98   $action,
99   $new_userid,
100   "Home",
101   "Spam Elimination System"
102 );
103
104 SetContext $userid;
105 NavigationBar $userid;
106 Body;
107 Footing;
108
109 exit;