From 9c061d50d0035bbbcd51a76b6a5f67294cfaa525 Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Tue, 27 Apr 2010 15:45:18 +1000 Subject: [PATCH] Fixed loop and message numbers --- vendors/shells/vault.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/vendors/shells/vault.php b/vendors/shells/vault.php index b38949b5..d4477886 100755 --- a/vendors/shells/vault.php +++ b/vendors/shells/vault.php @@ -18,7 +18,7 @@ class VaultShell extends Shell { $username = 'vault'; $password = 'xjdYOsmJWc37'; /* The password for the account to be checked */ $email_dir = '/var/www/cakephp/app/emails'; - + $ripmime_path = '/usr/local/bin/ripmime'; @@ -66,7 +66,7 @@ class VaultShell extends Shell { $this->data['Email']['subject'] = $message['subject']; $this->data['Email']['body'] = ""; $this->data['Email']['plainbody'] = ""; - + $structure = imap_fetchstructure($mbox, $i); $attachments = 1; if (empty($structure->parts)) { /* A single part message. No attachments and is plain text */ @@ -109,8 +109,8 @@ class VaultShell extends Shell { if( ($attachment['type'] != 'text/html') && ($attachment['type'] != 'multipart/mixed') && ($attachment['type'] != 'multipart/alternative') && ($attachment['type'] != 'multipart/report') - - ) { + + ) { $this->EmailAttachment->create(); $this->data['EmailAttachment']['email_id'] = $email_id; $this->data['EmailAttachment']['name'] = $attachment['name']; @@ -133,7 +133,7 @@ class VaultShell extends Shell { //$stored_msgs[] = imap_uid($mbox,$i); if($testing == 0) { - imap_mail_move($mbox, $no, 'INBOX/Stored'); + imap_mail_move($mbox, $i, 'INBOX/Stored'); } @@ -152,10 +152,10 @@ class VaultShell extends Shell { * I may change this to simply delete the emails. This will do for now, but it's doubling up on the storage for useless files. * */ - if($testing == 0 ) { + if($testing == 0 ) { - imap_mail_move($mbox, $no, 'INBOX/Discard'); - } + imap_mail_move($mbox, $i, 'INBOX/Discard'); + } } @@ -178,7 +178,7 @@ class VaultShell extends Shell { function fetchBodyAttachments($mailbox, $msg_number, $email_dir, $uniqid, $ripmime_path) { - + $email_file = $email_dir.'/'.$uniqid.'.eml'; imap_savebody($mailbox, $email_file, $msg_number); @@ -297,16 +297,16 @@ class VaultShell extends Shell { } - + /** * Generate a uniq id. - * + * * */ function getUniqId($email_dir) { $uniqid = uniqid(null,TRUE); - + return $uniqid; }