mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-02 12:09:04 +01:00
replace mail_bo with Api\Mail
This commit is contained in:
parent
7c0e53e29e
commit
45caead02b
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
use EGroupware\Api;
|
use EGroupware\Api;
|
||||||
use EGroupware\Api\Link;
|
use EGroupware\Api\Link;
|
||||||
use EGroupware\Api\Mail as mail_bo;
|
use EGroupware\Api\Mail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class cotains methods and functions
|
* Class cotains methods and functions
|
||||||
@ -153,7 +153,7 @@ class mail_integration {
|
|||||||
{
|
{
|
||||||
// initialize mail open connection requirements
|
// initialize mail open connection requirements
|
||||||
if (!isset($_icServerID)) $_icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID');
|
if (!isset($_icServerID)) $_icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID');
|
||||||
$mo = mail_bo::getInstance(true,$_icServerID);
|
$mo = Mail::getInstance(true,$_icServerID);
|
||||||
$mo->openConnection();
|
$mo->openConnection();
|
||||||
$messagePartId = $messageFolder = null;
|
$messagePartId = $messageFolder = null;
|
||||||
foreach ($_attachments as $attachment)
|
foreach ($_attachments as $attachment)
|
||||||
@ -167,7 +167,7 @@ class mail_integration {
|
|||||||
// instead of fetching only the attachments attached files (as we did previously)
|
// instead of fetching only the attachments attached files (as we did previously)
|
||||||
$message = $mo->getMessageRawBody($attachment['uid'],$attachment['partID'],($attachment['folder']?$attachment['folder']:$mailbox));
|
$message = $mo->getMessageRawBody($attachment['uid'],$attachment['partID'],($attachment['folder']?$attachment['folder']:$mailbox));
|
||||||
$headers = $mo->getMessageHeader($attachment['uid'],$attachment['partID'],true,false,($attachment['folder']?$attachment['folder']:$mailbox));
|
$headers = $mo->getMessageHeader($attachment['uid'],$attachment['partID'],true,false,($attachment['folder']?$attachment['folder']:$mailbox));
|
||||||
$subject = mail_bo::clean_subject_for_filename($headers['SUBJECT']);
|
$subject = Mail::clean_subject_for_filename($headers['SUBJECT']);
|
||||||
$attachment_file =tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
|
$attachment_file =tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
|
||||||
$tmpfile = fopen($attachment_file,'w');
|
$tmpfile = fopen($attachment_file,'w');
|
||||||
fwrite($tmpfile,$message);
|
fwrite($tmpfile,$message);
|
||||||
@ -239,7 +239,7 @@ class mail_integration {
|
|||||||
if ($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='add_raw' &&
|
if ($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='add_raw' &&
|
||||||
$_rawMail && file_exists($_rawMail))
|
$_rawMail && file_exists($_rawMail))
|
||||||
{
|
{
|
||||||
$subject = mail_bo::clean_subject_for_filename($_subject);
|
$subject = Mail::clean_subject_for_filename($_subject);
|
||||||
$attachments[] = array(
|
$attachments[] = array(
|
||||||
'name' => trim($subject).'.eml',
|
'name' => trim($subject).'.eml',
|
||||||
'mimeType' => 'message/rfc822',
|
'mimeType' => 'message/rfc822',
|
||||||
@ -260,12 +260,12 @@ class mail_integration {
|
|||||||
}
|
}
|
||||||
$body_striped = strip_tags($_body); //we need to fix broken tags (or just stuff like "<800 USD/p" )
|
$body_striped = strip_tags($_body); //we need to fix broken tags (or just stuff like "<800 USD/p" )
|
||||||
$body_decoded = htmlspecialchars_decode($body_striped,ENT_QUOTES);
|
$body_decoded = htmlspecialchars_decode($body_striped,ENT_QUOTES);
|
||||||
$body = mail_bo::createHeaderInfoSection(array('FROM'=>$_to_emailAddress['from'],
|
$body = Mail::createHeaderInfoSection(array('FROM'=>$_to_emailAddress['from'],
|
||||||
'TO'=>(!empty($_to_emailAddress['to'])?implode(',',$_to_emailAddress['to']):null),
|
'TO'=>(!empty($_to_emailAddress['to'])?implode(',',$_to_emailAddress['to']):null),
|
||||||
'CC'=>(!empty($_to_emailAddress['cc'])?implode(',',$_to_emailAddress['cc']):null),
|
'CC'=>(!empty($_to_emailAddress['cc'])?implode(',',$_to_emailAddress['cc']):null),
|
||||||
'BCC'=>(!empty($_to_emailAddress['bcc'])?implode(',',$_to_emailAddress['bcc']):null),
|
'BCC'=>(!empty($_to_emailAddress['bcc'])?implode(',',$_to_emailAddress['bcc']):null),
|
||||||
'SUBJECT'=>$_subject,
|
'SUBJECT'=>$_subject,
|
||||||
'DATE'=>mail_bo::_strtotime($_date))).$body_decoded;
|
'DATE'=>Mail::_strtotime($_date))).$body_decoded;
|
||||||
|
|
||||||
$mailcontent = array(
|
$mailcontent = array(
|
||||||
'mailaddress' => implode(',',$toaddr),
|
'mailaddress' => implode(',',$toaddr),
|
||||||
@ -291,11 +291,11 @@ class mail_integration {
|
|||||||
if ($uid && $mailbox)
|
if ($uid && $mailbox)
|
||||||
{
|
{
|
||||||
if (!isset($icServerID)) $icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID');
|
if (!isset($icServerID)) $icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID');
|
||||||
$mo = mail_bo::getInstance(true,$icServerID);
|
$mo = Mail::getInstance(true,$icServerID);
|
||||||
$mo->openConnection();
|
$mo->openConnection();
|
||||||
$mo->reopen($mailbox);
|
$mo->reopen($mailbox);
|
||||||
try {
|
try {
|
||||||
$mailcontent = mail_bo::get_mailcontent($mo,$uid,'',$mailbox,null,true,(!($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='text_only')));
|
$mailcontent = Mail::get_mailcontent($mo,$uid,'',$mailbox,null,true,(!($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='text_only')));
|
||||||
// this one adds the mail itself (as message/rfc822 (.eml) file) to the app as additional attachment
|
// this one adds the mail itself (as message/rfc822 (.eml) file) to the app as additional attachment
|
||||||
// this is done to have a simple archive functionality (ToDo: opening .eml in email module)
|
// this is done to have a simple archive functionality (ToDo: opening .eml in email module)
|
||||||
if ($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='add_raw')
|
if ($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='add_raw')
|
||||||
@ -308,7 +308,7 @@ class mail_integration {
|
|||||||
fclose($tmpfile);
|
fclose($tmpfile);
|
||||||
$size = filesize($attachment_file);
|
$size = filesize($attachment_file);
|
||||||
$mailcontent['attachments'][] = array(
|
$mailcontent['attachments'][] = array(
|
||||||
'name' => mail_bo::clean_subject_for_filename($headers['SUBJECT']).'.eml',
|
'name' => Mail::clean_subject_for_filename($headers['SUBJECT']).'.eml',
|
||||||
'mimeType' => 'message/rfc822',
|
'mimeType' => 'message/rfc822',
|
||||||
'type' => 'message/rfc822',
|
'type' => 'message/rfc822',
|
||||||
'tmp_name' => $attachment_file,
|
'tmp_name' => $attachment_file,
|
||||||
|
@ -353,7 +353,7 @@ class mail_tree
|
|||||||
{
|
{
|
||||||
// throwing an exeption here seems to be unrecoverable,
|
// throwing an exeption here seems to be unrecoverable,
|
||||||
// even if the cause is a something that can be handeled by the mailserver
|
// even if the cause is a something that can be handeled by the mailserver
|
||||||
if (mail_bo::$debug) error_log(__METHOD__.':'.__LINE__." id=$data[id]: Parent '$parent' of '$component' not found!");
|
if (Mail::$debug) error_log(__METHOD__.':'.__LINE__." id=$data[id]: Parent '$parent' of '$component' not found!");
|
||||||
// should we hit the break? if in personal: sure, something is wrong with the folderstructure
|
// should we hit the break? if in personal: sure, something is wrong with the folderstructure
|
||||||
// if in shared or others we may proceed as access to folders may very well be limited to
|
// if in shared or others we may proceed as access to folders may very well be limited to
|
||||||
// a single folder within the tree
|
// a single folder within the tree
|
||||||
@ -364,7 +364,7 @@ class mail_tree
|
|||||||
// we want to create the node in question as we meet the above considerations
|
// we want to create the node in question as we meet the above considerations
|
||||||
if ($nsp['type']!='personal' && $nsp['prefix_present'] && stripos($parent,$data['path'][0].self::DELIMITER.$nsp['prefix'])===0)
|
if ($nsp['type']!='personal' && $nsp['prefix_present'] && stripos($parent,$data['path'][0].self::DELIMITER.$nsp['prefix'])===0)
|
||||||
{
|
{
|
||||||
if (mail_bo::$debug) error_log(__METHOD__.__LINE__.' about to create:'.$parent.' in '.$data['path'][0].self::DELIMITER.$nsp['prefix']);
|
if (Mail::$debug) error_log(__METHOD__.__LINE__.' about to create:'.$parent.' in '.$data['path'][0].self::DELIMITER.$nsp['prefix']);
|
||||||
$break=false;
|
$break=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3079,7 +3079,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
|||||||
$attachment = $this->mail_bo->getAttachment($params['uid'],$params['part'],$params['is_winmail'],false);
|
$attachment = $this->mail_bo->getAttachment($params['uid'],$params['part'],$params['is_winmail'],false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = $dir. '/' . ($filename ? $filename : mail_bo::clean_subject_for_filename($attachment['filename']));
|
$file = $dir. '/' . ($filename ? $filename : Mail::clean_subject_for_filename($attachment['filename']));
|
||||||
|
|
||||||
if ($savemode != 'overwrite')
|
if ($savemode != 'overwrite')
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user