X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Fspamcop%2Fspamcop.php;h=8324071a3042c2d7e6c758177ed28e31132e3be5;hp=3171109fd1232453837a6813bc450a7c441e66e2;hb=63389330a0372fd52619f6efe7e01db155995ed1;hpb=5682c80142f0c36be32b13574278df09564a7c59 diff --git a/plugins/spamcop/spamcop.php b/plugins/spamcop/spamcop.php index 3171109f..8324071a 100644 --- a/plugins/spamcop/spamcop.php +++ b/plugins/spamcop/spamcop.php @@ -1,134 +1,175 @@ \n"; +} else { + displayPageHeader($color,$mailbox); +} + +/** is spamcop plugin disabled */ +if (! is_plugin_enabled('spamcop')) { + error_box(_("Plugin is disabled.")); + // display footer (closes html tags) and stop script execution + $oTemplate->display('footer.tpl'); + exit(); +} + + $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0); sqimap_mailbox_select($imap_stream, $mailbox); - fputs($imap_stream, 'a010 FETCH ' . $passed_id . ' RFC822' . "\r\n"); - $sid = 'a010'; - if ($uid_support) $sid .= ' UID'; - - $read = sqimap_read_data($imap_stream, 'a010', true, $response, $message); - array_shift($read); - - if ($spamcop_method == 'quick_email' || + + if ($spamcop_method == 'quick_email' || $spamcop_method == 'thorough_email') { // Use email-based reporting -- save as an attachment - if(!isset($composesession)) { - $composesession = 0; - session_register('composesession'); + $session = "$composesession"+1; + $composesession = $session; + sqsession_register($composesession,'composesession'); + if (!isset($compose_messages)) { + $compose_messages = array(); } - if (!isset($session)) { - $session = "$composesession" +1; - $composesession = $session; + if (!isset($compose_messages[$session]) || ($compose_messages[$session] == NULL)) { + $composeMessage = new Message(); + $rfc822_header = new Rfc822Header(); + $composeMessage->rfc822_header = $rfc822_header; + $composeMessage->reply_rfc822_header = ''; + $compose_messages[$session] = $composeMessage; + sqsession_register($compose_messages,'compose_messages'); + } else { + $composeMessage=$compose_messages[$session]; } - if (!isset($attachments)) { - $attachments = array(); - session_register('attachments'); - } - - foreach ($attachments as $info) { - if (file_exists($attachment_dir . $info['localfilename'])) - unlink($attachment_dir . $info['localfilename']); - } - $attachments = array(); - - $file = GenerateRandomString(32, '', 7); - while (file_exists($attachment_dir . $file)) - $file = GenerateRandomString(32, '', 7); - $newAttachment['localfilename'] = $file; - $newAttachment['remotefilename'] = 'email.txt'; - $newAttachment['type'] = 'message/rfc822'; - $newAttachment['session'] = $session; - $fp = fopen($attachment_dir . $file, 'w'); - foreach ($read as $line) { - fputs($fp, $line); - } - $attachments[] = $newAttachment; - - $fn = getPref($data_dir, $username, 'full_name'); - $em = getPref($data_dir, $username, 'email_address'); - - $HowItLooks = $fn . ' '; - if ($em != '') + + $message = sqimap_get_message($imap_stream, $passed_id, $mailbox); + $composeMessage = spamcop_getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, + $passed_ent_id, $imap_stream); + + $compose_messages[$session] = $composeMessage; + sqsession_register($compose_messages, 'compose_messages'); + + $fn = getPref($data_dir, $username, 'full_name'); + $em = getPref($data_dir, $username, 'email_address'); + + $HowItLooks = $fn . ' '; + if ($em != '') $HowItLooks .= '<' . $em . '>'; - } + } -?> -

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.

+echo "

"; +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."); +echo "

"; - +?> + +
- -
-
- - +'; + echo '\n"; } else { - ?> - - - - + + +"; } ?>
- +
- - - - - - - - - - 50000) { + $form_action = sqm_baseuri() . 'src/compose.php'; +?> + + + + + + + +\n"; +} else { + $spam_message = mime_fetch_body ($imap_stream, $passed_id, $passed_ent_id, 50000); + + if (strlen($spam_message) == 50000) { $Warning = "\n[truncated by SpamCop]\n"; - $Message = substr($Message, 0, 50000 - strlen($Warning)) . $Warning; + $spam_message = substr($spam_message, 0, 50000 - strlen($Warning)) . $Warning; } + $action_url="http://members.spamcop.net/sc"; + if (isset($js_web) && $js_web) { -?> \n"; } else { -?> \n"; } ?> - - - - - - + + + \n"; + } ?>
- +