3 ** spamcop.php -- SpamCop plugin
5 ** Copyright (c) 1999-2002 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
11 define('SM_PATH','../../');
13 /* SquirrelMail required files. */
14 require_once(SM_PATH
. 'include/validate.php');
15 require_once(SM_PATH
. 'functions/imap.php');
19 $username = $_SESSION['username'];
20 $key = $_COOKIE['key'];
21 $onetimepad = $_SESSION['onetimepad'];
23 $mailbox = $_GET['mailbox'];
24 $passed_id = $_GET['passed_id'];
25 $startMessage = $_GET['startMessage'];
29 displayPageHeader($color, $mailbox);
31 $imap_stream = sqimap_login($username, $key, $imapServerAddress,
33 sqimap_mailbox_select($imap_stream, $mailbox);
34 $sid = sqimap_session_id($uid_support)
35 fputs($imap_stream, $sid.' FETCH ' . $passed_id . ' RFC822' . "\r\n");
37 $read = sqimap_read_data($imap_stream, $sid, true, $response, $message);
40 if ($spamcop_method == 'quick_email' ||
41 $spamcop_method == 'thorough_email') {
42 // Use email-based reporting -- save as an attachment
43 if(!isset($composesession)) {
45 sqsession_register($composesession, 'composesession');
47 if (!isset($session)) {
48 $session = "$composesession" +
1;
49 $composesession = $session;
52 if (!isset($attachments)) {
53 $attachments = array();
54 sqsession_register($attachments, 'attachments');
57 foreach ($attachments as $info) {
58 if (file_exists($attachment_dir . $info['localfilename']))
59 unlink($attachment_dir . $info['localfilename']);
61 $attachments = array();
63 $file = GenerateRandomString(32, '', 7);
64 while (file_exists($attachment_dir . $file))
65 $file = GenerateRandomString(32, '', 7);
66 $newAttachment['localfilename'] = $file;
67 $newAttachment['remotefilename'] = 'email.txt';
68 $newAttachment['type'] = 'message/rfc822';
69 $newAttachment['session'] = $session;
70 $fp = fopen($attachment_dir . $file, 'w');
71 foreach ($read as $line) {
74 sqsession_unregister('attachments');
75 $attachments[] = $newAttachment;
76 sqsession_register($attachments , 'attachments');
78 $fn = getPref($data_dir, $username, 'full_name');
79 $em = getPref($data_dir, $username, 'email_address');
81 $HowItLooks = $fn . ' ';
83 $HowItLooks .= '<' . $em . '>';
88 <p
>Sending this spam report will give you back a reply with URLs that you
89 can click on to properly report this spam message to the proper authorities
.
90 This is a free service
. By pressing the
"Send Spam Report" button
, you
91 agree to follow SpamCop
's rules/terms of service/etc.</p>
93 <table align=center width="75%" border=0 cellpadding=0 cellspacing=0>
95 <td align=left valign=top>
96 <?PHP if (isset($js_web) && $js_web) {
97 ?><form method=post action="javascript:return false">
98 <input type=button value="Close Window"
99 onClick="window.close(); return true;">
102 ?><form method=post action="../../src/right_main.php">
103 <input type=hidden name="mailbox" value="<?PHP echo
104 htmlspecialchars($mailbox) ?>">
105 <input type=hidden name="startMessage" value="<?PHP echo
106 htmlspecialchars($startMessage) ?>">
107 <input type=submit value="Cancel / Done">
112 <td align=right valign=top>
113 <?PHP if ($spamcop_method == 'thorough_email
' ||
114 $spamcop_method == 'quick_email
') {
115 if ($spamcop_method == 'thorough_email
')
116 $report_email = 'submit
.' . $spamcop_id . '@spam
.spamcop
.net
';
118 $report_email = 'quick
.' . $spamcop_id . '@spam
.spamcop
.net
';
119 ?> <form method=post action="../../src/compose.php">
120 <input type=hidden name="mailbox" value="<?PHP echo
121 htmlspecialchars($mailbox) ?>">
122 <input type=hidden name="spamcop_is_composing" value="<?PHP echo
123 htmlspecialchars($passed_id) ?>">
124 <input type=hidden name="send_to" value="<?PHP echo $report_email ?>">
125 <input type=hidden name="send_to_cc" value="">
126 <input type=hidden name="send_to_bcc" value="">
127 <input type=hidden name="subject" value="reply anyway">
128 <input type=hidden name="identity" value="default">
129 <input type=hidden name="session" value="<?PHP echo $session?>">
130 <input type=submit name="send" value="Send Spam Report">
132 $Message = implode('', $read);
133 if (strlen($Message) > 50000) {
134 $Warning = "\n[truncated by SpamCop]\n";
135 $Message = substr($Message, 0, 50000 - strlen($Warning)) . $Warning;
137 if (isset($js_web) && $js_web) {
138 ?> <form method=post action="http://spamcop.net/sc" name="submitspam"
139 enctype="multipart/form-data"><?PHP
141 ?> <form method=post action="http://spamcop.net/sc" name="submitspam"
142 enctype="multipart/form-data" target="_blank"><?PHP
144 <input type=hidden name=action value=submit>
145 <input type=hidden name=oldverbose value=1>
146 <input type=hidden name=code value="<?PHP echo $spamcop_id ?>">
147 <input type=hidden name=spam value="<?PHP
148 echo htmlspecialchars($Message);
150 <input type=submit name="x1" value="Send Spam Report">