spam-report-iframe.pl 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/perl -wT
  2. require 5.001;
  3. use strict;
  4. use CGI qw/:standard/;
  5. use CGI::Carp qw(fatalsToBrowser);
  6. # my $logfile = '/org/lists.debian.org/spam-log/spam-report.log';
  7. my $logfile = '/tmp/spam-report.log';
  8. umask 002;
  9. print header;
  10. my $listname;
  11. my $date;
  12. my $msg;
  13. my $nominated;
  14. if (param()) {
  15. if (param('listname') =~ /^([0-9a-z\-]+)$/) {
  16. $listname = $1;
  17. }
  18. if (param('date') =~ /^(\d{4}\/\d{2})$/) {
  19. $date = $1;
  20. }
  21. if (param('msg') =~ /^(msg\d+\.html)$/) {
  22. $msg = $1;
  23. }
  24. if (param('nominate')) {
  25. $nominated = 1;
  26. }
  27. if ($listname and $date and $msg) {
  28. if ($nominated) {
  29. print p(strong("reported as Spam"));
  30. } else {
  31. print start_form;
  32. print hidden('listname', $listname);
  33. print hidden('msg', $msg);
  34. print hidden('date', $date);
  35. print submit('nominate', 'Report as Spam');
  36. print end_form;
  37. }
  38. } else {
  39. print p("called incorrectly");
  40. }
  41. } else {
  42. print p("called incorrectly");
  43. }
  44. if (0) {
  45. # log all connections that present sane input
  46. open (LOG, ">>$logfile") ;
  47. my $time = time;
  48. print LOG "time: $time; ";
  49. #if (exists $ENV{'REMOTE_HOST'}) {
  50. # print LOG "host: $ENV{'REMOTE_HOST'}; addr: $ENV{'REMOTE_ADDR'} sub_cnt: $#subscribe unsub_cnt: $#unsubscribe: email: $user_email\n";
  51. #} else {
  52. print LOG "addr: $ENV{'REMOTE_ADDR'}; list: ".param('listname').", date: ".param('date').", msg: ".param('msg')."\n";
  53. #}
  54. close LOG;
  55. my $message = <<SUCCESS
  56. <h2>Report accepted</h2>
  57. <p>
  58. Thank you for reporting this email as a potential spam message. Scores are reviewed regularly, and are used to mark emails as spam.
  59. </p>
  60. SUCCESS
  61. ;
  62. my $title = 'Email status recorded';
  63. }
  64. else {
  65. my $message = <<ERRMSG
  66. <h2>An error occurred</h2>
  67. <p>
  68. Unfortunately, your report could not be recorded. Please try again or contact the listmasters.
  69. </p>
  70. ERRMSG
  71. ;
  72. }
  73. #print start_html(-title=>$title);
  74. print end_html;
  75. exit 0;