spamcop.php 4.6 KB

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