nominate-for-review.pl 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/perl -wT
  2. # cord@debian.org
  3. use strict;
  4. use CGI qw/:standard/;
  5. use CGI::Carp qw(fatalsToBrowser);
  6. my $logfile = '/org/lists.debian.org/spam-log/msgid-nominator.log';
  7. my $output;
  8. print header;
  9. unless (param('Quiet')) {
  10. open (HEADER, "/org/lists.debian.org/html/header.in") or
  11. die ("$0: can't open /org/lists.debian.org/html/header.in: $!\n");
  12. while (<HEADER>) {
  13. s/u_TITLE_u/Listarchive Review Nomination/;
  14. print;
  15. }
  16. close (HEADER);
  17. print "<h2>Nominate</h2>\n";
  18. print "<hr noshade width=\"100%\" size=\"1\">\n";
  19. print p("Please enter a Message-Id to nominate a post for the review process.");
  20. print start_form(-method=>'GET');
  21. print p("Message-ID:", textfield('msgid'),
  22. checkbox(-name=>'Quiet'));
  23. print submit('Nominate for Review');
  24. print end_form;
  25. }
  26. if (param()) {
  27. if ($ENV{'REMOTE_ADDR'} =~ m#^195.154.75.109$#) {
  28. $output = "FAIL: you are blocked from reporting - Please contact listmaster\@lists.debian.org";
  29. } elsif (param('msgid') =~ m#^\s*(<?[-\w\d\.%@]+>?).*\s*$#) {
  30. open (LOG, ">>$logfile") or die ("$0: can't open $logfile for writing: $!\n");
  31. print LOG "time: " . time . "; addr: $ENV{'REMOTE_ADDR'}; msg-id: $1\n";
  32. close LOG;
  33. $output = "OK: nominated $1";
  34. } else {
  35. $output = "FAIL: invalid characters - Please contact listmaster\@lists.debian.org with your message-id";
  36. }
  37. unless (param('Quiet')) {
  38. print p($output);
  39. open (FOOTER, "/org/lists.debian.org/html/footer.in") or
  40. die ("$0: can't open /org/lists.debian.org/html/footer.in: $!\n");
  41. while (<FOOTER>) {
  42. print;
  43. }
  44. close (FOOTER);
  45. } else {
  46. print "$output\n";
  47. }
  48. }