3 * spamcop.php -- SpamCop plugin -- main page
5 * @copyright (c) 1999-2005 The SquirrelMail Project Team
6 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
13 define('SM_PATH','../../');
15 /* SquirrelMail required files. */
16 require_once(SM_PATH
. 'include/validate.php');
17 include_once(SM_PATH
. 'functions/display_messages.php');
18 include_once(SM_PATH
. 'functions/imap.php');
19 /* plugin functions */
20 include_once(SM_PATH
. 'plugins/spamcop/functions.php');
24 sqgetGlobalVar('username', $username, SQ_SESSION
);
25 sqgetGlobalVar('key', $key, SQ_COOKIE
);
26 sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION
);
28 sqgetGlobalVar('mailbox', $mailbox, SQ_GET
);
29 sqgetGlobalVar('passed_id', $passed_id, SQ_GET
);
30 sqgetGlobalVar('js_web', $js_web, SQ_GET
);
32 if (! sqgetGlobalVar('startMessage', $startMessage, SQ_GET
) ) {
35 if (! sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET
) ) {
38 if (! sqgetGlobalVar('js_web', $js_web, SQ_GET
) ) {
42 sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION
);
44 if(! sqgetGlobalVar('composesession', $composesession, SQ_SESSION
) ) {
46 sqsession_register($composesession, 'composesession');
50 // js_web variable is 1 only when link opens web based report page in new window
51 // and in new window menu line or extra javascript code is not needed.
53 displayHTMLHeader(_("SpamCop reporting"));
54 echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\">\n";
56 displayPageHeader($color,$mailbox);
59 /** is spamcop plugin disabled */
60 if (! is_plugin_enabled('spamcop')) {
61 error_box(_("Plugin is disabled."),$color);
62 echo "\n</body></html>\n";
66 $imap_stream = sqimap_login($username, $key, $imapServerAddress,
68 sqimap_mailbox_select($imap_stream, $mailbox);
70 if ($spamcop_method == 'quick_email' ||
71 $spamcop_method == 'thorough_email') {
72 // Use email-based reporting -- save as an attachment
73 $session = "$composesession"+
1;
74 $composesession = $session;
75 sqsession_register($composesession,'composesession');
76 if (!isset($compose_messages)) {
77 $compose_messages = array();
79 if (!isset($compose_messages[$session]) ||
($compose_messages[$session] == NULL)) {
80 $composeMessage = new Message();
81 $rfc822_header = new Rfc822Header();
82 $composeMessage->rfc822_header
= $rfc822_header;
83 $composeMessage->reply_rfc822_header
= '';
84 $compose_messages[$session] = $composeMessage;
85 sqsession_register($compose_messages,'compose_messages');
87 $composeMessage=$compose_messages[$session];
91 $message = sqimap_get_message($imap_stream, $passed_id, $mailbox);
92 $composeMessage = getMessage_RFC822_Attachment($message, $composeMessage, $passed_id,
93 $passed_ent_id, $imap_stream);
95 $compose_messages[$session] = $composeMessage;
96 sqsession_register($compose_messages, 'compose_messages');
98 $fn = getPref($data_dir, $username, 'full_name');
99 $em = getPref($data_dir, $username, 'email_address');
101 $HowItLooks = $fn . ' ';
103 $HowItLooks .= '<' . $em . '>';
108 echo _("Sending this spam report will give you back a reply with URLs that you can click on to properly report this spam message to the proper authorities. This is a free service. By pressing the \"Send Spam Report\" button, you agree to follow SpamCop's rules/terms of service/etc.");
113 <table align
="center" width
="75%" border
="0" cellpadding
="0" cellspacing
="0">
115 <td align
="left" valign
="top">
116 <?php
if (isset($js_web) && $js_web) {
117 echo '<form method="post" action="javascript:return false">';
118 echo '<input type="button" value="' . _("Close Window") . "\" onclick=\"window.close(); return true;\" />\n";
120 ?
><form method
="post" action
="../../src/right_main.php">
121 <input type
="hidden" name
="mailbox" value
="<?php echo htmlspecialchars($mailbox) ?>" />
122 <input type
="hidden" name
="startMessage" value
="<?php echo htmlspecialchars($startMessage) ?>" />
124 echo '<input type="submit" value="' . _("Cancel / Done") . "\" />";
128 <td align
="right" valign
="top">
129 <?php
if ($spamcop_method == 'thorough_email' ||
130 $spamcop_method == 'quick_email') {
131 if ($spamcop_method == 'thorough_email')
132 $report_email = 'submit.' . $spamcop_id . '@spam.spamcop.net';
134 $report_email = 'quick.' . $spamcop_id . '@spam.spamcop.net';
135 $form_action = SM_PATH
. 'src/compose.php';
136 ?
> <form method
="post" action
="<?php echo $form_action?>">
137 <input type
="hidden" name
="mailbox" value
="<?php echo htmlspecialchars($mailbox) ?>" />
138 <input type
="hidden" name
="spamcop_is_composing" value
="<?php echo htmlspecialchars($passed_id) ?>" />
139 <input type
="hidden" name
="send_to" value
="<?php echo htmlspecialchars($report_email)?>" />
140 <input type
="hidden" name
="subject" value
="reply anyway" />
141 <input type
="hidden" name
="identity" value
="0" />
142 <input type
="hidden" name
="session" value
="<?php echo $session?>" />
144 echo '<input type="submit" name="send" value="' . _("Send Spam Report") . "\" />\n";
146 $spam_message = mime_fetch_body ($imap_stream, $passed_id, $passed_ent_id, 50000);
148 if (strlen($spam_message) == 50000) {
149 $Warning = "\n[truncated by SpamCop]\n";
150 $spam_message = substr($spam_message, 0, 50000 - strlen($Warning)) . $Warning;
152 if ($spamcop_type=='member') {
153 $action_url="http://members.spamcop.net/sc";
155 $action_url="http://www.spamcop.net/sc";
157 if (isset($js_web) && $js_web) {
158 echo "<form method=\"post\" action=\"$action_url\" name=\"submitspam\"".
159 " enctype=\"multipart/form-data\">\n";
161 echo "<form method=\"post\" action=\"$action_url\" name=\"submitspam\"".
162 " enctype=\"multipart/form-data\" target=\"_blank\">\n";
164 <input type
="hidden" name
="action" value
="submit" />
165 <input type
="hidden" name
="oldverbose" value
="1" />
166 <input type
="hidden" name
="code" value
="<?php echo htmlspecialchars($spamcop_id) ?>" />
167 <input type
="hidden" name
="spam" value
="<?php echo htmlspecialchars($spam_message); ?>" />
169 echo '<input type="submit" name="x1" value="' . _("Send Spam Report") . "\" />\n";