spamcop.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. chdir('..');
  3. include_once ('../src/validate.php');
  4. include_once ('../functions/imap.php');
  5. displayPageHeader($color, $mailbox);
  6. $imap_stream = sqimap_login($username, $key, $imapServerAddress,
  7. $imapPort, 0);
  8. sqimap_mailbox_select($imap_stream, $mailbox);
  9. fputs($imap_stream, 'a010 FETCH ' . $passed_id . ' RFC822' . "\r\n");
  10. $read = sqimap_read_data($imap_stream, 'a010', true, $response, $message);
  11. array_shift($read);
  12. if ($spamcop_method == 'quick_email' ||
  13. $spamcop_method == 'thorough_email') {
  14. // Use email-based reporting -- save as an attachment
  15. if (!isset($attachments)) {
  16. $attachments = array();
  17. session_register('attachments');
  18. }
  19. foreach ($attachments as $info) {
  20. if (file_exists($attachment_dir . $info['localfilename']))
  21. unlink($attachment_dir . $info['localfilename']);
  22. }
  23. $attachments = array();
  24. $file = GenerateRandomString(32, '', 7);
  25. while (file_exists($attachment_dir . $file))
  26. $file = GenerateRandomString(32, '', 7);
  27. $newAttachment['localfilename'] = $file;
  28. $newAttachment['remotefilename'] = 'email.txt';
  29. $newAttachment['type'] = 'message/rfc822';
  30. $fp = fopen($attachment_dir . $file, 'w');
  31. foreach ($read as $line) {
  32. fputs($fp, $line);
  33. }
  34. $attachments[] = $newAttachment;
  35. $fn = getPref($data_dir, $username, 'full_name');
  36. $em = getPref($data_dir, $username, 'email_address');
  37. $HowItLooks = $fn . ' ';
  38. if ($em != '')
  39. $HowItLooks .= '<' . $em . '>';
  40. }
  41. ?>
  42. <p>Sending this spam report will give you back a reply with URLs that you
  43. can click on to properly report this spam message to the proper authorities.
  44. This is a free service. By pressing the "Send Spam Report" button, you
  45. agree to follow SpamCop's rules/terms of service/etc.</p>
  46. <table align=center width="75%" border=0 cellpadding=0 cellspacing=0>
  47. <tr>
  48. <td align=left valign=top>
  49. <?PHP if (isset($js_web) && $js_web) {
  50. ?><form method=post action="javascript:return false">
  51. <input type=button value="Close Window"
  52. onClick="window.close(); return true;">
  53. <?PHP
  54. } else {
  55. ?><form method=post action="../../src/right_main.php">
  56. <input type=hidden name="mailbox" value="<?PHP echo
  57. htmlspecialchars($mailbox) ?>">
  58. <input type=hidden name="startMessage" value="<?PHP echo
  59. htmlspecialchars($startMessage) ?>">
  60. <input type=submit value="Cancel / Done">
  61. <?PHP
  62. }
  63. ?></form>
  64. </td>
  65. <td align=right valign=top>
  66. <?PHP if ($spamcop_method == 'thorough_email' ||
  67. $spamcop_method == 'quick_email') {
  68. if ($spamcop_method == 'thorough_email')
  69. $report_email = 'submit.' . $spamcop_id . '@spam.spamcop.net';
  70. else
  71. $report_email = 'quick.' . $spamcop_id . '@spam.spamcop.net';
  72. ?> <form method=post action="../../src/compose.php">
  73. <input type=hidden name="mailbox" value="<?PHP echo
  74. htmlspecialchars($mailbox) ?>">
  75. <input type=hidden name="spamcop_is_composing" value="<?PHP echo
  76. htmlspecialchars($passed_id) ?>">
  77. <input type=hidden name="send_to" value="<?PHP echo $report_email ?>">
  78. <input type=hidden name="send_to_cc" value="">
  79. <input type=hidden name="send_to_bcc" value="">
  80. <input type=hidden name="subject" value="reply anyway">
  81. <input type=hidden name="identity" value="default">
  82. <input type=submit name="send" value="Send Spam Report">
  83. <?PHP } else {
  84. $Message = implode('', $read);
  85. if (strlen($Message) > 50000) {
  86. $Warning = "\n[truncated by SpamCop]\n";
  87. $Message = substr($Message, 0, 50000 - strlen($Warning)) . $Warning;
  88. }
  89. if (isset($js_web) && $js_web) {
  90. ?> <form method=post action="http://spamcop.net/sc" name="submitspam"
  91. enctype="multipart/form-data"><?PHP
  92. } else {
  93. ?> <form method=post action="http://spamcop.net/sc" name="submitspam"
  94. enctype="multipart/form-data" target="_blank"><?PHP
  95. } ?>
  96. <input type=hidden name=action value=submit>
  97. <input type=hidden name=oldverbose value=1>
  98. <input type=hidden name=code value="<?PHP echo $spamcop_id ?>">
  99. <input type=hidden name=spam value="<?PHP
  100. echo htmlspecialchars($Message);
  101. ?>">
  102. <input type=submit name="x1" value="Send Spam Report">
  103. <?PHP }
  104. ?> </form>
  105. </td>
  106. </tr>
  107. </table>
  108. </body>
  109. </html>