Maybe fixed the bugs in removing files in the vault?
This commit is contained in:
parent
0a069330d0
commit
38e512a4bb
24
vendors/shells/vault.php
vendored
24
vendors/shells/vault.php
vendored
|
|
@ -13,24 +13,30 @@ class VaultShell extends Shell {
|
||||||
/******************************************************
|
/******************************************************
|
||||||
* Config Variables
|
* Config Variables
|
||||||
* *****************************************************/
|
* *****************************************************/
|
||||||
$testing = 0; //Whether to actually move the emails. 1=test, 0=production
|
$testing = 1; //Whether to actually move the emails. 1=test, 0=production
|
||||||
/* Setup Connection to the IMAP server */
|
/* Setup Connection to the IMAP server */
|
||||||
$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/working';
|
$email_dir = '/var/www/cakephp/app/emails/working';
|
||||||
$temp_filename = 'temp.eml';
|
$temp_filename = 'temp.eml';
|
||||||
|
|
||||||
|
if($testing == 1) {
|
||||||
|
$email_dir = '/var/www/quotenik1.2/app/emails/working';
|
||||||
|
}
|
||||||
|
|
||||||
$mbox = imap_open("{saturn:143/novalidate-cert}INBOX", $username, $password) or die("can't connect: " . imap_last_error());
|
$mbox = imap_open("{saturn:143/novalidate-cert}INBOX", $username, $password) or die("can't connect: " . imap_last_error());
|
||||||
$MC = imap_check($mbox);
|
$MC = imap_check($mbox);
|
||||||
$number_of_messages = $MC->Nmsgs;
|
$number_of_messages = $MC->Nmsgs;
|
||||||
echo "Number of messages to Process ".$number_of_messages;
|
|
||||||
|
echo "Number of messages to Process ".$number_of_messages."\n";
|
||||||
/* Loop through the messages and sort them into ones to be processed or discarded */
|
/* Loop through the messages and sort them into ones to be processed or discarded */
|
||||||
for ($i=1; $i <= $number_of_messages; $i++) {
|
for ($i=1; $i <= $number_of_messages; $i++) {
|
||||||
$this_header = imap_headerinfo($mbox, $i);
|
$this_header = imap_headerinfo($mbox, $i);
|
||||||
$message = $this->getMessage($mbox, $i, $this_header);
|
$message = $this->getMessage($mbox, $i, $this_header);
|
||||||
$enquiry = $this->checkIfValidEnquiry($message['subject'], $testing);
|
$enquiry = $this->checkIfValidEnquiry($message['subject'], $testing);
|
||||||
if($enquiry) {
|
if($enquiry) {
|
||||||
//Process it and store the message and its attachments.
|
//Process it and store the message and its attachments.
|
||||||
|
|
||||||
$this->Email->create();
|
$this->Email->create();
|
||||||
$this->data['Email']['enquiry_id'] = $enquiry['Enquiry']['id'];
|
$this->data['Email']['enquiry_id'] = $enquiry['Enquiry']['id'];
|
||||||
$this->data['Email']['to'] = $message['to'];
|
$this->data['Email']['to'] = $message['to'];
|
||||||
|
|
@ -94,11 +100,12 @@ class VaultShell extends Shell {
|
||||||
echo "Something went wrong saving the file to the DB\n";
|
echo "Something went wrong saving the file to the DB\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unlink($email_dir.'/'.$attachment['name']); #Delete this attachment now we're done with it.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "Email stored in the DB under enquiry ".$enquiry['Enquiry']['title']." Will be moved to the stored folder\n";
|
echo "Email stored in the DB under enquiry ".$enquiry['Enquiry']['title']." Will be moved to the stored folder\n";
|
||||||
|
|
||||||
if($testing == 0) { //Testing Mode. Don't actually move these emails unless we're in production.
|
if($testing == 0) { //Testing Mode. Don't actually move these emails unless we're in production.
|
||||||
imap_mail_move($mbox, $i, 'INBOX/Stored'); //Move it to the stored folder.
|
imap_mail_move($mbox, $i, 'INBOX/Stored'); //Move it to the stored folder.
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +113,8 @@ class VaultShell extends Shell {
|
||||||
|
|
||||||
|
|
||||||
if($attachments != 1) {
|
if($attachments != 1) {
|
||||||
$this->clearEmailAttachmentDirs($email_dir, $temp_filename, $attachments);
|
//$this->clearEmailAttachmentDirs($email_dir, $temp_filename, $attachments);
|
||||||
|
unlink($email_dir.'/'.$temp_filename); #remove the temp email. start again
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -156,6 +164,8 @@ function fetchBodyAttachments($mailbox, $msg_number, $filename, $email_dir) {
|
||||||
$email_file = $email_dir.'/'.$filename;
|
$email_file = $email_dir.'/'.$filename;
|
||||||
imap_savebody($mailbox, $email_file, $msg_number);
|
imap_savebody($mailbox, $email_file, $msg_number);
|
||||||
$command = "/usr/local/bin/ripmime -i $email_file -d $email_dir -v --verbose-contenttype --paranoid --prefix $msg_number";
|
$command = "/usr/local/bin/ripmime -i $email_file -d $email_dir -v --verbose-contenttype --paranoid --prefix $msg_number";
|
||||||
|
|
||||||
|
// $command = "/usr/local/bin/ripmime -i $email_file -d $email_dir --verbose-contenttype --paranoid --prefix $msg_number";
|
||||||
$output = array();
|
$output = array();
|
||||||
exec($command, $output, $status);
|
exec($command, $output, $status);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,11 @@
|
||||||
<?php echo $contact['Contact']['phone']; ?>
|
<?php echo $contact['Contact']['phone']; ?>
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Mobile'); ?></dt>
|
||||||
|
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
||||||
|
<?php echo $contact['Contact']['mobile']; ?>
|
||||||
|
|
||||||
|
</dd>
|
||||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Phone Extension'); ?></dt>
|
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Phone Extension'); ?></dt>
|
||||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
||||||
<?php echo $contact['Contact']['phone_extension']; ?>
|
<?php echo $contact['Contact']['phone_extension']; ?>
|
||||||
|
|
|
||||||
|
|
@ -107,9 +107,10 @@ foreach ($enquiries as $enquiry):
|
||||||
</td>
|
</td>
|
||||||
<td class="contactemail">
|
<td class="contactemail">
|
||||||
<?php if($enquiry['Contact']['direct_phone']) { echo $enquiry['Contact']['direct_phone']; }
|
<?php if($enquiry['Contact']['direct_phone']) { echo $enquiry['Contact']['direct_phone']; }
|
||||||
|
else if($enquiry['Contact']['mobile']) { echo 'mob:'.$enquiry['Contact']['mobile']; }
|
||||||
else {
|
else {
|
||||||
echo $enquiry['Contact']['phone'];
|
echo $enquiry['Contact']['phone'];
|
||||||
if($enquiry['Contact']['phone_extension']) {
|
if($enquiry['Contact']['phone_extension']) {
|
||||||
echo ' ext:'.$enquiry['Contact']['phone_extension'];
|
echo ' ext:'.$enquiry['Contact']['phone_extension'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li><?php echo $html->link(__('Edit Product', true), array('action'=>'edit', $product['Product']['id'])); ?> </li>
|
<li><?php echo $html->link(__('Edit Product', true), array('action'=>'edit', $product['Product']['id'])); ?> </li>
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="related">
|
<div class="related">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue