From ea7c8c9d5776f40d0efddbd8b66ed28a7b4a6722 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 27 Jul 2020 08:07:45 +0200 Subject: [PATCH] replace mail_bo with Api\Mail --- mail/inc/class.mail_integration.inc.php | 18 +++++++++--------- mail/inc/class.mail_tree.inc.php | 4 ++-- mail/inc/class.mail_ui.inc.php | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/mail/inc/class.mail_integration.inc.php b/mail/inc/class.mail_integration.inc.php index 1e1a2a113e..86376c0677 100644 --- a/mail/inc/class.mail_integration.inc.php +++ b/mail/inc/class.mail_integration.inc.php @@ -12,7 +12,7 @@ use EGroupware\Api; use EGroupware\Api\Link; -use EGroupware\Api\Mail as mail_bo; +use EGroupware\Api\Mail; /** * Class cotains methods and functions @@ -153,7 +153,7 @@ class mail_integration { { // initialize mail open connection requirements if (!isset($_icServerID)) $_icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID'); - $mo = mail_bo::getInstance(true,$_icServerID); + $mo = Mail::getInstance(true,$_icServerID); $mo->openConnection(); $messagePartId = $messageFolder = null; foreach ($_attachments as $attachment) @@ -167,7 +167,7 @@ class mail_integration { // instead of fetching only the attachments attached files (as we did previously) $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)); - $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']."_"); $tmpfile = fopen($attachment_file,'w'); fwrite($tmpfile,$message); @@ -239,7 +239,7 @@ class mail_integration { if ($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='add_raw' && $_rawMail && file_exists($_rawMail)) { - $subject = mail_bo::clean_subject_for_filename($_subject); + $subject = Mail::clean_subject_for_filename($_subject); $attachments[] = array( 'name' => trim($subject).'.eml', '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_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), 'CC'=>(!empty($_to_emailAddress['cc'])?implode(',',$_to_emailAddress['cc']):null), 'BCC'=>(!empty($_to_emailAddress['bcc'])?implode(',',$_to_emailAddress['bcc']):null), 'SUBJECT'=>$_subject, - 'DATE'=>mail_bo::_strtotime($_date))).$body_decoded; + 'DATE'=>Mail::_strtotime($_date))).$body_decoded; $mailcontent = array( 'mailaddress' => implode(',',$toaddr), @@ -291,11 +291,11 @@ class mail_integration { if ($uid && $mailbox) { if (!isset($icServerID)) $icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID'); - $mo = mail_bo::getInstance(true,$icServerID); + $mo = Mail::getInstance(true,$icServerID); $mo->openConnection(); $mo->reopen($mailbox); 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 is done to have a simple archive functionality (ToDo: opening .eml in email module) if ($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='add_raw') @@ -308,7 +308,7 @@ class mail_integration { fclose($tmpfile); $size = filesize($attachment_file); $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', 'type' => 'message/rfc822', 'tmp_name' => $attachment_file, diff --git a/mail/inc/class.mail_tree.inc.php b/mail/inc/class.mail_tree.inc.php index 9014e74bd4..9c330849d2 100644 --- a/mail/inc/class.mail_tree.inc.php +++ b/mail/inc/class.mail_tree.inc.php @@ -353,7 +353,7 @@ class mail_tree { // throwing an exeption here seems to be unrecoverable, // 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 // if in shared or others we may proceed as access to folders may very well be limited to // 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 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; } } diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 99f2927291..53a5c7ab53 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -3079,7 +3079,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2); $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') {