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