Initial groundwork to use phpdocumentor.
[squirrelmail.git] / plugins / spamcop / spamcop.php
index c77b822c856c68b20a80c719c962936ebcb5df27..c7b1397c6d20b988fe47a28f8d45d2f9c0dbfe49 100644 (file)
@@ -5,9 +5,12 @@
     **  Copyright (c) 1999-2003 The SquirrelMail development team
     **  Licensed under the GNU GPL. For full terms see the file COPYING.
     **  
-    **  $Id$                                                         
+    **  $Id$
+    * @package plugins
+    * @subpackage spamcop
     **/
 
+/** @ignore */
 define('SM_PATH','../../');
 
  /* SquirrelMail required files. */
@@ -122,12 +125,12 @@ if(! sqgetGlobalVar('composesession', $composesession, SQ_SESSION) ) {
           $HowItLooks .= '<' . $em . '>';
      }
 
-?>
 
-<p>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.</p>
+echo "<p>";
+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 "</p>";
+
+?>
 
 <table align="center" width="75%" border="0" cellpadding="0" cellspacing="0">
 <tr>
@@ -139,10 +142,8 @@ agree to follow SpamCop's rules/terms of service/etc.</p>
    <?PHP
 } else {
    ?><form method="post" action="../../src/right_main.php">
-  <input type="hidden" name="mailbox" value="<?PHP echo
-     htmlspecialchars($mailbox) ?>">
-  <input type="hidden" name="startMessage" value="<?PHP echo
-     htmlspecialchars($startMessage) ?>">
+  <input type="hidden" name="mailbox" value="<?PHP echo htmlspecialchars($mailbox) ?>">
+  <input type="hidden" name="startMessage" value="<?PHP echo htmlspecialchars($startMessage) ?>">
   <input type="submit" value="Cancel / Done">
    <?PHP
 }
@@ -157,40 +158,31 @@ agree to follow SpamCop's rules/terms of service/etc.</p>
       $report_email = 'quick.' . $spamcop_id . '@spam.spamcop.net';
    $form_action = SM_PATH . 'src/compose.php';
 ?>  <form method="post" action="<?PHP echo $form_action?>">
-  <input type="hidden" name="mailbox" value="<?PHP echo
-     htmlspecialchars($mailbox) ?>">
-  <input type="hidden" name="spamcop_is_composing" value="<?PHP echo
-     htmlspecialchars($passed_id) ?>">
+  <input type="hidden" name="mailbox" value="<?PHP echo htmlspecialchars($mailbox) ?>">
+  <input type="hidden" name="spamcop_is_composing" value="<?PHP echo htmlspecialchars($passed_id) ?>">
   <input type="hidden" name="send_to" value="<?PHP echo $report_email?>">
   <input type="hidden" name="subject" value="reply anyway">
-  <input type="hidden" name="identity" value="default">
+  <input type="hidden" name="identity" value="0">
   <input type="hidden" name="session" value="<?PHP echo $session?>">
   <input type="submit" name="send" value="Send Spam Report">
 <?PHP } else {
-   $sid = sqimap_session_id($uid_support);
-   fputs($imap_stream, $sid.' FETCH ' . $passed_id . ' RFC822' . "\r\n");
-    
-   $read = sqimap_read_data($imap_stream, $sid, true, $response, $message);
-   array_shift($read);
+   $spam_message = mime_fetch_body ($imap_stream, $passed_id, 0, 50000);
 
-   $Message = implode('', $read);
-   if (strlen($Message) > 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;
    }
    if (isset($js_web) && $js_web) {
-?>  <form method="post" action="http://spamcop.net/sc" name="submitspam"
+?>  <form method="post" action="http://www.spamcop.net/sc" name="submitspam"
     enctype="multipart/form-data"><?PHP
    } else {
-?>  <form method="post" action="http://spamcop.net/sc" name="submitspam"
+?>  <form method="post" action="http://www.spamcop.net/sc" name="submitspam"
     enctype="multipart/form-data" target="_blank"><?PHP
    } ?>
   <input type="hidden" name="action" value="submit">
   <input type="hidden" name="oldverbose" value="1">
   <input type="hidden" name="code" value="<?PHP echo $spamcop_id ?>">
-  <input type="hidden" name="spam" value="<?PHP
-          echo htmlspecialchars($Message);
-  ?>">
+  <input type="hidden" name="spam" value="<?PHP echo htmlspecialchars($spam_message); ?>">
   <input type="submit" name="x1" value="Send Spam Report">
 <?PHP }
 ?>  </form>