uid fix
[squirrelmail.git] / plugins / spamcop / spamcop.php
index 1822da77ccec432ac90ac0ecdf0d2c48a4724ce8..f43543b0ad4419b5eb14dea9ca481b1b94342c0c 100644 (file)
@@ -1,21 +1,34 @@
 <?php
 
 <?php
 
-    chdir('..');
-    include_once ('../src/validate.php');
-    include_once ('../functions/imap.php');
+define('SM_PATH','../../');
+
+ /* SquirrelMail required files. */
+require_once(SM_PATH . 'include/validate.php');
+require_once(SM_PATH . 'functions/imap.php');
     
     displayPageHeader($color, $mailbox);
 
     $imap_stream = sqimap_login($username, $key, $imapServerAddress, 
        $imapPort, 0);
     sqimap_mailbox_select($imap_stream, $mailbox);
     
     displayPageHeader($color, $mailbox);
 
     $imap_stream = sqimap_login($username, $key, $imapServerAddress, 
        $imapPort, 0);
     sqimap_mailbox_select($imap_stream, $mailbox);
-    fputs($imap_stream, 'a010 FETCH ' . $passed_id . ' RFC822' . "\r\n");
-    $read = sqimap_read_data($imap_stream, 'a010', true, $response, $message);
+    $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);
 
     if ($spamcop_method == 'quick_email' || 
         $spamcop_method == 'thorough_email') {
        // Use email-based reporting -- save as an attachment
     array_shift($read);
 
     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');
+       }
+       if (!isset($session)) {
+         $session = "$composesession" +1;
+           $composesession = $session;
+       }
+
        if (!isset($attachments)) {
           $attachments = array();
           session_register('attachments');
        if (!isset($attachments)) {
           $attachments = array();
           session_register('attachments');
@@ -33,6 +46,7 @@
        $newAttachment['localfilename'] = $file;
        $newAttachment['remotefilename'] = 'email.txt';
        $newAttachment['type'] = 'message/rfc822';
        $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);
        $fp = fopen($attachment_dir . $file, 'w');
        foreach ($read as $line) {
           fputs($fp, $line);
@@ -90,6 +104,7 @@ agree to follow SpamCop's rules/terms of service/etc.</p>
   <input type=hidden name="send_to_bcc" value="">
   <input type=hidden name="subject" value="reply anyway">
   <input type=hidden name="identity" value="default">
   <input type=hidden name="send_to_bcc" value="">
   <input type=hidden name="subject" value="reply anyway">
   <input type=hidden name="identity" value="default">
+  <input type=hidden name="session" value="<?PHP echo $session?>">
   <input type=submit name="send" value="Send Spam Report">
 <?PHP } else {
    $Message = implode('', $read);
   <input type=submit name="send" value="Send Spam Report">
 <?PHP } else {
    $Message = implode('', $read);