From 1411cc73fb7e6f26ad71e820b0a18a9f24f2158f Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 8 Apr 2014 14:55:43 +0000 Subject: [PATCH] attempt to cleanup regarding old emailadmin/felamimail --- mail/inc/class.mail_bosieve.inc.php | 4 - mail/inc/class.mail_compose.inc.php | 143 ++++------------------------ mail/inc/class.mail_ui.inc.php | 62 +----------- 3 files changed, 18 insertions(+), 191 deletions(-) diff --git a/mail/inc/class.mail_bosieve.inc.php b/mail/inc/class.mail_bosieve.inc.php index 492507f3f2..8ed953966b 100644 --- a/mail/inc/class.mail_bosieve.inc.php +++ b/mail/inc/class.mail_bosieve.inc.php @@ -24,12 +24,8 @@ class mail_bosieve function async_vacation($_vacation) { if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.'('.print_r($_vacation,true).')'); - // unset the fm_preferences session object, to force the reload/rebuild $_restoreSession = false; // as in async, each call may be for a different user - //$bopreferences = CreateObject('felamimail.bopreferences',$_restoreSession); - //$mailPreferences = $bopreferences->getPreferences(); - //$icServer = $mailPreferences->getIncomingServer(0); $icServer = emailadmin_account::search((isset($_vacation['account_id'])&&!empty($_vacation['account_id'])?$_vacation['account_id']:$GLOBALS['egw_info']['user']['account_id']),false,null,0,1)->oldImapServer(); if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.'->LoginName:'.$icServer->loginName); diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index ff345a3c84..b3ddbbbcf0 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -81,7 +81,7 @@ class mail_compose $profileID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $this->mail_bo->profileID; $this->preferences =& $this->mail_bo->mailPreferences; // we should get away from this $this->preferences->preferences should hold the same info - $this->preferencesArray =& $this->preferences; //$GLOBALS['egw_info']['user']['preferences']['felamimail']; + $this->preferencesArray =& $this->preferences; //force the default for the forwarding -> asmail if (is_array($this->preferencesArray)) { if (!array_key_exists('message_forwarding',$this->preferencesArray) @@ -117,115 +117,6 @@ class mail_compose } } -/* - function action() - { - $formData['mailaccount'] = (int)$_POST['mailaccount']; - - foreach((array)$_POST['destination'] as $key => $destination) { - if(!empty($_POST['address'][$key])) { - if($destination == 'folder') { - $formData[$destination][] = $GLOBALS['egw']->translation->convert($_POST['address'][$key], $this->charset, 'UTF7-IMAP'); - } else { - $formData[$destination][] = $_POST['address'][$key]; - } - } - } - - $formData['subject'] = $this->stripSlashes($_POST['subject']); - $formData['body'] = $this->stripSlashes($_POST['body']); - // if the body is empty, maybe someone pasted something with scripts, into the message body - if(empty($formData['body'])) - { - // this is to be found with the egw_unset_vars array for the _POST['body'] array - $name='_POST'; - $key='body'; - #error_log($GLOBALS['egw_unset_vars'][$name.'['.$key.']']); - if (isset($GLOBALS['egw_unset_vars'][$name.'['.$key.']'])) - { - $formData['body'] = bocompose::_getCleanHTML( $GLOBALS['egw_unset_vars'][$name.'['.$key.']']); - } - } - $formData['priority'] = $this->stripSlashes($_POST['priority']); - $formData['signatureid'] = (int)$_POST['signatureid']; - $formData['stationeryID'] = $_POST['stationeryID']; - $formData['mimeType'] = $this->stripSlashes($_POST['mimeType']); - if ($formData['mimeType'] == 'html' && html::htmlarea_availible()===false) - { - $formData['mimeType'] = 'plain'; - $formData['body'] = $this->convertHTMLToText($formData['body']); - } - $formData['disposition'] = (bool)$_POST['disposition']; - $formData['to_infolog'] = $_POST['to_infolog']; - $formData['to_tracker'] = $_POST['to_tracker']; - //$formData['mailbox'] = $_GET['mailbox']; - if((bool)$_POST['printit'] == true) { - $formData['printit'] = 1; - $formData['isDraft'] = 1; - // pint the composed message. therefore save it as draft and reopen it as plain printwindow - $formData['subject'] = "[".lang('printview').":]".$formData['subject']; - $messageUid = $this->saveAsDraft($formData,$destinationFolder); - if (!$messageUid) { - print ""; - return; - } - $uidisplay = CreateObject('felamimail.uidisplay'); - $uidisplay->printMessage($messageUid, $formData['printit'],$destinationFolder); - //egw::link('/index.php',array('menuaction' => 'felamimail.uidisplay.printMessage','uid'=>$messageUid)); - return; - } - if((bool)$_POST['saveAsDraft'] == true) { - $formData['isDraft'] = 1; - // save as draft - $folder = $this->mail_bo->getDraftFolder(); - $this->mail_bo->reopen($folder); - $status = $this->mail_bo->getFolderStatus($folder); - //error_log(__METHOD__.__LINE__.array2string(array('Folder'=>$folder,'Status'=>$status))); - $uidNext = $status['uidnext']; // we may need that, if the server does not return messageUIDs of saved/appended messages - $messageUid = $this->saveAsDraft($formData,$folder); // folder may change - if (!$messageUid) { - print ""; - //try to reopen the mail from session data - $this->compose(null,null,'to',true); - return; - } - // saving as draft, does not mean closing the message - unset($_POST['composeid']); - unset($_GET['composeid']); - $uicompose = CreateObject('felamimail.uicompose'); - $messageUid = ($messageUid===true ? $uidNext : $messageUid); - if (!$uicompose->mail_bo->icServer->_connected) $uicompose->mail_bo->openConnection($uicompose->mail_bo->profileID); - if ($uicompose->mail_bo->getMessageHeader($messageUid)) - { - //error_log(__METHOD__.__LINE__.' (re)open drafted message with new UID: '.$messageUid.' in folder:'.$folder); - $uicompose->bocompose->getDraftData($uicompose->mail_bo->icServer, $folder, $messageUid); - $uicompose->compose(null,null,'to',true); - return; - } - } else { - $cachedComposeID = egw_cache::getCache(egw_cache::SESSION,'email','composeIdCache'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60); - egw_cache::setCache(egw_cache::SESSION,'email','composeIdCache'.trim($GLOBALS['egw_info']['user']['account_id']),$this->composeID,$expiration=60); - //error_log(__METHOD__.__LINE__.' '.$formData['subject'].' '.$cachedComposeID.'<->'.$this->composeID); - if (!empty($cachedComposeID) && $cachedComposeID == $this->composeID) - { - //already send - print ""; - return; - } - if(!$this->send($formData)) { - // reset the cached composeID, as something failed - egw_cache::setCache(egw_cache::SESSION,'email','composeIdCache'.trim($GLOBALS['egw_info']['user']['account_id']),null,$expiration=60); -// print ""; - $this->compose(); - return; - } - } - - #common::egw_exit(); - print ""; - } -*/ - /** * function compose * this function is used to fill the compose dialog with the content provided by $_content @@ -2357,26 +2248,16 @@ class mail_compose $_mailObject->IsHTML(true); if(!empty($signature)) { #$_mailObject->Body = array($_formData['body'], $_signature['signature']); - //if($_formData['stationeryID']) { - // $bostationery = new felamimail_bostationery(); - // $_mailObject->Body = $bostationery->render($_formData['stationeryID'],$_formData['body'],$signature); - //} else { - $_mailObject->Body = $_formData['body'] . - ($disableRuler ?'
':'
'). - $signature; - //} + $_mailObject->Body = $_formData['body'] . + ($disableRuler ?'
':'
'). + $signature; $_mailObject->AltBody = $this->convertHTMLToText($_formData['body'],true,true). ($disableRuler ?"\r\n":"\r\n-- \r\n"). $this->convertHTMLToText($signature,true,true); #print "
$_mailObject->AltBody
"; #print htmlentities($_signature['signature']); } else { - //if($_formData['stationeryID']) { - // $bostationery = new felamimail_bostationery(); - // $_mailObject->Body = $bostationery->render($_formData['stationeryID'],$_formData['body']); - //} else { - $_mailObject->Body = $_formData['body']; - //} + $_mailObject->Body = $_formData['body']; $_mailObject->AltBody = $this->convertHTMLToText($_formData['body'],true,true); } // convert URL Images to inline images - if possible @@ -2674,7 +2555,15 @@ class mail_compose } // check if there are folders to be used - $folder = (array)$this->sessionData['folder']; + $folderToCheck = (array)$this->sessionData['folder']; + $folder = array(); + foreach ($folderToCheck as $k => $f) + { + if ($this->mail_bo->folderExists($f, true)) + { + $folder[] = $f; + } + } $sentFolder = $this->mail_bo->getSentFolder(); if(isset($sentFolder) && $sentFolder != 'none' && $this->preferences->preferences['sendOptions'] != 'send_only' && @@ -2691,13 +2580,13 @@ class mail_compose } else { - if ((!isset($sentFolder) && $this->preferences->preferences['sendOptions'] != 'send_only') || + if (((!isset($sentFolder)||$sentFolder==false) && $this->preferences->preferences['sendOptions'] != 'send_only') || ($this->preferences->preferences['sendOptions'] != 'send_only' && $sentFolder != 'none')) $this->errorInfo = lang("No Send Folder set in preferences"); } if($messageIsDraft == true) { $draftFolder = $this->mail_bo->getDraftFolder(); - if(!empty($draftFolder) && $this->mail_bo->folderExists($draftFolder)) { + if(!empty($draftFolder) && $this->mail_bo->folderExists($draftFolder,true)) { $this->sessionData['folder'] = array($draftFolder); $folder[] = $draftFolder; } diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 221f31c71d..ccb4039788 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -2128,7 +2128,7 @@ unset($query['actions']); $attachmentHTMLBlock=''; if (is_array($attachments) && count($attachments) > 0) { $url_img_vfs = html::image('filemanager','navbar', lang('Filemanager'), ' height="16"'); - $url_img_vfs_save_all = html::image('felamimail','save_all', lang('Save all')); + $url_img_vfs_save_all = html::image('mail','save_all', lang('Save all')); $detectedCharSet=$charset2use=mail_bo::$displayCharset; foreach ($attachments as $key => $value) @@ -2234,7 +2234,7 @@ unset($query['actions']); 'is_winmail' => $value['is_winmail'], 'mailbox' => base64_encode($mailbox), ); - $attachmentHTML[$key]['link_save'] ="".html::image('felamimail','fileexport').""; + $attachmentHTML[$key]['link_save'] ="".html::image('mail','fileexport').""; if ($GLOBALS['egw_info']['user']['apps']['filemanager']) { @@ -2351,40 +2351,7 @@ unset($query['actions']); $newSenderAddress, $realName); -/* - $linkData = array ( - 'menuaction' => 'addressbook.addressbook_ui.edit', - 'presets[email]' => $addressData['EMAIL'], - 'presets[org_name]' => $_organisation, - 'referer' => $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'] - ); -*/ $decodedPersonalName = $realName; -/* - if (!empty($decodedPersonalName)) { - if($spacePos = strrpos($decodedPersonalName, ' ')) { - $linkData['presets[n_family]'] = substr($decodedPersonalName, $spacePos+1); - $linkData['presets[n_given]'] = substr($decodedPersonalName, 0, $spacePos); - } else { - $linkData['presets[n_family]'] = $decodedPersonalName; - } - $linkData['presets[n_fn]'] = $decodedPersonalName; - } - if ($showAddToAdrdessbookLink && $GLOBALS['egw_info']['user']['apps']['addressbook']) { - $urlAddToAddressbook = $GLOBALS['egw']->link('/index.php',$linkData); - $onClick = "window.open(this,this.target,'dependent=yes,width=850,height=440,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes'); return false;"; - $image = $GLOBALS['egw']->common->image('felamimail','sm_envelope'); - $senderAddress .= sprintf(' - %s', - $urlAddToAddressbook, - $onClick, - $image, - lang('add to addressbook'), - lang('add to addressbook')); - } -*/ } else { $addrEMailORG = $addrEMail = $addressData['EMAIL']; $addAction = egw_link::get_registry('mail','add'); @@ -2397,31 +2364,6 @@ unset($query['actions']); $senderEMail = mail_bo::htmlentities($addrEMail); $senderAddress .= sprintf('%s', $link,$senderEMail); - //TODO: This uses old addressbook code, which should be removed in Version 1.4 - //Please use addressbook.addressbook_ui.edit with proper paramenters -/* - $linkData = array - ( - 'menuaction' => 'addressbook.addressbook_ui.edit', - 'presets[email]' => $senderEMail, //$addressData['EMAIL'], - 'presets[org_name]' => $_organisation, - 'referer' => $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'] - ); - if ($showAddToAdrdessbookLink && $GLOBALS['egw_info']['user']['apps']['addressbook']) { - $urlAddToAddressbook = $GLOBALS['egw']->link('/index.php',$linkData); - $onClick = "window.open(this,this.target, 'dependent=yes, width=850, height=440, location=no, menubar=no, toolbar=no, scrollbars=yes, status=yes'); return false;"; - $image = $GLOBALS['egw']->common->image('felamimail','sm_envelope'); - $senderAddress .= sprintf(' - %s', - $urlAddToAddressbook, - $onClick, - $image, - lang('add to addressbook'), - lang('add to addressbook')); - } -*/ } } return $senderAddress;