apply code-formating-cleanup-convert-DOS-to-UNIX-text-form from https://github.com/zedzedtop/mailzu

This commit is contained in:
Mario Fetka
2016-02-04 17:26:07 +01:00
parent 180aa514e9
commit 05196e9fb7
17 changed files with 967 additions and 1064 deletions

View File

@@ -20,13 +20,12 @@ include_once('lib/CmnFns.class.php');
* Pear::DB
*/
if ($GLOBALS['conf']['app']['safeMode']) {
ini_set('include_path', ( dirname(__FILE__) . '/pear/' . PATH_SEPARATOR . ini_get('include_path') ));
include_once('pear/PEAR.php');
include_once('pear/Mail/mimeDecode.php');
}
else {
include_once 'PEAR.php';
include_once('Mail/mimeDecode.php');
ini_set('include_path', ( dirname(__FILE__) . '/pear/' . PATH_SEPARATOR . ini_get('include_path') ));
include_once('pear/PEAR.php');
include_once('pear/Mail/mimeDecode.php');
} else {
include_once('PEAR.php');
include_once('Mail/mimeDecode.php');
}
/**
@@ -34,13 +33,12 @@ else {
*/
class MailEngine {
var $raw; // Raw mail contents
var $struct; // The top-level MIME structure
var $recipient; // The recipient of the email
var $msg_found; // Msg found in database
var $msg_error; // Msg has MIME error
var $last_error; // PEAR Error Messages
var $raw; // Raw mail contents
var $struct; // The top-level MIME structure
var $recipient; // The recipient of the email
var $msg_found; // Msg found in database
var $msg_error; // Msg has MIME error
var $last_error; // PEAR Error Messages
/**
* MailEngine object constructor
@@ -49,35 +47,35 @@ class MailEngine {
* $return object MailEngine object
*/
function MailEngine($mail_id, $recip) {
$this->recipient = $recip;
$this->getRawContent($mail_id);
$this->msg_error = false;
if ($this->raw) {
$this->msg_found = true;
$this->struct = $this->getDecodedStruct($this->raw);
if (PEAR::isError($this->struct)) {
$this->msg_error = true;
$this->last_error = $this->struct->getMessage();
}
} else {
$this->msg_found = false;
}
return $this->struct;
$this->recipient = $recip;
$this->getRawContent($mail_id);
$this->msg_error = false;
if ($this->raw) {
$this->msg_found = true;
$this->struct = $this->getDecodedStruct($this->raw);
if (PEAR::isError($this->struct)) {
$this->msg_error = true;
$this->last_error = $this->struct->getMessage();
}
} else {
$this->msg_found = false;
}
return $this->struct;
}
/**
* Decode the raw contents to get the MIME structure
* $param string The complete raw message returned by get_raw_mail
* $return object Mail_mimeDecode::decode object
* $return object Mail_mimeDecode::decode object
*/
function getDecodedStruct($contents) {
$message = new Mail_mimeDecode($contents);
$msg_struct = $message->decode( array ( 'include_bodies' => true,
'decode_bodies' => true,
'decode_headers' => true)
);
return $msg_struct;
$message = new Mail_mimeDecode($contents);
$msg_struct = $message->decode( array ( 'include_bodies' => true,
'decode_bodies' => true,
'decode_headers' => true)
);
return $msg_struct;
}
/**
@@ -86,12 +84,13 @@ class MailEngine {
* $return string The complete raw email
*/
function getRawContent($mail_id) {
$db = new DBEngine();
$this->raw = $db->get_raw_mail($mail_id, $this->recipient);
// Mark read
if (in_array($this->recipient, $_SESSION['sessionMail']) && $this->raw) {
$db->update_msgrcpt_rs($mail_id,$this->recipient,'v');
}
$db = new DBEngine();
$this->raw = $db->get_raw_mail($mail_id, $this->recipient);
// Mark read
if (in_array($this->recipient, $_SESSION['sessionMail']) && $this->raw) {
$db->update_msgrcpt_rs($mail_id,$this->recipient,'v');
}
}
}
?>