Fixed loop and message numbers

This commit is contained in:
Karl Cordes 2010-04-27 15:45:18 +10:00
parent 65489b8684
commit 9c061d50d0

View file

@ -18,7 +18,7 @@ class VaultShell extends Shell {
$username = 'vault'; $username = 'vault';
$password = 'xjdYOsmJWc37'; /* The password for the account to be checked */ $password = 'xjdYOsmJWc37'; /* The password for the account to be checked */
$email_dir = '/var/www/cakephp/app/emails'; $email_dir = '/var/www/cakephp/app/emails';
$ripmime_path = '/usr/local/bin/ripmime'; $ripmime_path = '/usr/local/bin/ripmime';
@ -66,7 +66,7 @@ class VaultShell extends Shell {
$this->data['Email']['subject'] = $message['subject']; $this->data['Email']['subject'] = $message['subject'];
$this->data['Email']['body'] = ""; $this->data['Email']['body'] = "";
$this->data['Email']['plainbody'] = ""; $this->data['Email']['plainbody'] = "";
$structure = imap_fetchstructure($mbox, $i); $structure = imap_fetchstructure($mbox, $i);
$attachments = 1; $attachments = 1;
if (empty($structure->parts)) { /* A single part message. No attachments and is plain text */ 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') && if( ($attachment['type'] != 'text/html') && ($attachment['type'] != 'multipart/mixed') &&
($attachment['type'] != 'multipart/alternative') && ($attachment['type'] != 'multipart/alternative') &&
($attachment['type'] != 'multipart/report') ($attachment['type'] != 'multipart/report')
) { ) {
$this->EmailAttachment->create(); $this->EmailAttachment->create();
$this->data['EmailAttachment']['email_id'] = $email_id; $this->data['EmailAttachment']['email_id'] = $email_id;
$this->data['EmailAttachment']['name'] = $attachment['name']; $this->data['EmailAttachment']['name'] = $attachment['name'];
@ -133,7 +133,7 @@ class VaultShell extends Shell {
//$stored_msgs[] = imap_uid($mbox,$i); //$stored_msgs[] = imap_uid($mbox,$i);
if($testing == 0) { 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. * 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) { function fetchBodyAttachments($mailbox, $msg_number, $email_dir, $uniqid, $ripmime_path) {
$email_file = $email_dir.'/'.$uniqid.'.eml'; $email_file = $email_dir.'/'.$uniqid.'.eml';
imap_savebody($mailbox, $email_file, $msg_number); imap_savebody($mailbox, $email_file, $msg_number);
@ -297,16 +297,16 @@ class VaultShell extends Shell {
} }
/** /**
* Generate a uniq id. * Generate a uniq id.
* *
* *
*/ */
function getUniqId($email_dir) { function getUniqId($email_dir) {
$uniqid = uniqid(null,TRUE); $uniqid = uniqid(null,TRUE);
return $uniqid; return $uniqid;
} }