mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
attempt to cleanup regarding old emailadmin/felamimail
This commit is contained in:
parent
c97452e940
commit
1411cc73fb
@ -24,12 +24,8 @@ class mail_bosieve
|
|||||||
function async_vacation($_vacation)
|
function async_vacation($_vacation)
|
||||||
{
|
{
|
||||||
if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.'('.print_r($_vacation,true).')');
|
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
|
$_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();
|
$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);
|
if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.'->LoginName:'.$icServer->loginName);
|
||||||
|
@ -81,7 +81,7 @@ class mail_compose
|
|||||||
$profileID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $this->mail_bo->profileID;
|
$profileID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $this->mail_bo->profileID;
|
||||||
$this->preferences =& $this->mail_bo->mailPreferences;
|
$this->preferences =& $this->mail_bo->mailPreferences;
|
||||||
// we should get away from this $this->preferences->preferences should hold the same info
|
// 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
|
//force the default for the forwarding -> asmail
|
||||||
if (is_array($this->preferencesArray)) {
|
if (is_array($this->preferencesArray)) {
|
||||||
if (!array_key_exists('message_forwarding',$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 "<script type=\"text/javascript\">alert('".lang("Error: Could not save Message as Draft")."');</script>";
|
|
||||||
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 "<script type=\"text/javascript\">alert('".lang("Error: Could not save Message as Draft")." ".lang("Trying to recover from session data")."');</script>";
|
|
||||||
//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 "<script type=\"text/javascript\">window.close();</script>";
|
|
||||||
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 "<script type=\"text/javascript\">alert('".lang("Error: Could not send Message.")." ".lang("Trying to recover from session data")."');</script>";
|
|
||||||
$this->compose();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#common::egw_exit();
|
|
||||||
print "<script type=\"text/javascript\">window.close();</script>";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function compose
|
* function compose
|
||||||
* this function is used to fill the compose dialog with the content provided by $_content
|
* 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);
|
$_mailObject->IsHTML(true);
|
||||||
if(!empty($signature)) {
|
if(!empty($signature)) {
|
||||||
#$_mailObject->Body = array($_formData['body'], $_signature['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'] .
|
$_mailObject->Body = $_formData['body'] .
|
||||||
($disableRuler ?'<br>':'<hr style="border:1px dotted silver; width:90%;">').
|
($disableRuler ?'<br>':'<hr style="border:1px dotted silver; width:90%;">').
|
||||||
$signature;
|
$signature;
|
||||||
//}
|
|
||||||
$_mailObject->AltBody = $this->convertHTMLToText($_formData['body'],true,true).
|
$_mailObject->AltBody = $this->convertHTMLToText($_formData['body'],true,true).
|
||||||
($disableRuler ?"\r\n":"\r\n-- \r\n").
|
($disableRuler ?"\r\n":"\r\n-- \r\n").
|
||||||
$this->convertHTMLToText($signature,true,true);
|
$this->convertHTMLToText($signature,true,true);
|
||||||
#print "<pre>$_mailObject->AltBody</pre>";
|
#print "<pre>$_mailObject->AltBody</pre>";
|
||||||
#print htmlentities($_signature['signature']);
|
#print htmlentities($_signature['signature']);
|
||||||
} else {
|
} 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);
|
$_mailObject->AltBody = $this->convertHTMLToText($_formData['body'],true,true);
|
||||||
}
|
}
|
||||||
// convert URL Images to inline images - if possible
|
// convert URL Images to inline images - if possible
|
||||||
@ -2674,7 +2555,15 @@ class mail_compose
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if there are folders to be used
|
// 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();
|
$sentFolder = $this->mail_bo->getSentFolder();
|
||||||
if(isset($sentFolder) && $sentFolder != 'none' &&
|
if(isset($sentFolder) && $sentFolder != 'none' &&
|
||||||
$this->preferences->preferences['sendOptions'] != 'send_only' &&
|
$this->preferences->preferences['sendOptions'] != 'send_only' &&
|
||||||
@ -2691,13 +2580,13 @@ class mail_compose
|
|||||||
}
|
}
|
||||||
else
|
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' &&
|
($this->preferences->preferences['sendOptions'] != 'send_only' &&
|
||||||
$sentFolder != 'none')) $this->errorInfo = lang("No Send Folder set in preferences");
|
$sentFolder != 'none')) $this->errorInfo = lang("No Send Folder set in preferences");
|
||||||
}
|
}
|
||||||
if($messageIsDraft == true) {
|
if($messageIsDraft == true) {
|
||||||
$draftFolder = $this->mail_bo->getDraftFolder();
|
$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);
|
$this->sessionData['folder'] = array($draftFolder);
|
||||||
$folder[] = $draftFolder;
|
$folder[] = $draftFolder;
|
||||||
}
|
}
|
||||||
|
@ -2128,7 +2128,7 @@ unset($query['actions']);
|
|||||||
$attachmentHTMLBlock='';
|
$attachmentHTMLBlock='';
|
||||||
if (is_array($attachments) && count($attachments) > 0) {
|
if (is_array($attachments) && count($attachments) > 0) {
|
||||||
$url_img_vfs = html::image('filemanager','navbar', lang('Filemanager'), ' height="16"');
|
$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;
|
$detectedCharSet=$charset2use=mail_bo::$displayCharset;
|
||||||
foreach ($attachments as $key => $value)
|
foreach ($attachments as $key => $value)
|
||||||
@ -2234,7 +2234,7 @@ unset($query['actions']);
|
|||||||
'is_winmail' => $value['is_winmail'],
|
'is_winmail' => $value['is_winmail'],
|
||||||
'mailbox' => base64_encode($mailbox),
|
'mailbox' => base64_encode($mailbox),
|
||||||
);
|
);
|
||||||
$attachmentHTML[$key]['link_save'] ="<a href='".egw::link('/index.php',$linkData)."' title='".$attachmentHTML[$key]['filename']."'>".html::image('felamimail','fileexport')."</a>";
|
$attachmentHTML[$key]['link_save'] ="<a href='".egw::link('/index.php',$linkData)."' title='".$attachmentHTML[$key]['filename']."'>".html::image('mail','fileexport')."</a>";
|
||||||
|
|
||||||
if ($GLOBALS['egw_info']['user']['apps']['filemanager'])
|
if ($GLOBALS['egw_info']['user']['apps']['filemanager'])
|
||||||
{
|
{
|
||||||
@ -2351,40 +2351,7 @@ unset($query['actions']);
|
|||||||
$newSenderAddress,
|
$newSenderAddress,
|
||||||
$realName);
|
$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;
|
$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('<a href="%s" onClick="%s">
|
|
||||||
<img src="%s" width="10" height="8" border="0"
|
|
||||||
align="absmiddle" alt="%s"
|
|
||||||
title="%s"></a>',
|
|
||||||
$urlAddToAddressbook,
|
|
||||||
$onClick,
|
|
||||||
$image,
|
|
||||||
lang('add to addressbook'),
|
|
||||||
lang('add to addressbook'));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
} else {
|
} else {
|
||||||
$addrEMailORG = $addrEMail = $addressData['EMAIL'];
|
$addrEMailORG = $addrEMail = $addressData['EMAIL'];
|
||||||
$addAction = egw_link::get_registry('mail','add');
|
$addAction = egw_link::get_registry('mail','add');
|
||||||
@ -2397,31 +2364,6 @@ unset($query['actions']);
|
|||||||
$senderEMail = mail_bo::htmlentities($addrEMail);
|
$senderEMail = mail_bo::htmlentities($addrEMail);
|
||||||
$senderAddress .= sprintf('<a href="%s">%s</a>',
|
$senderAddress .= sprintf('<a href="%s">%s</a>',
|
||||||
$link,$senderEMail);
|
$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('<a href="%s" onClick="%s">
|
|
||||||
<img src="%s" width="10" height="8" border="0"
|
|
||||||
align="absmiddle" alt="%s"
|
|
||||||
title="%s"></a>',
|
|
||||||
$urlAddToAddressbook,
|
|
||||||
$onClick,
|
|
||||||
$image,
|
|
||||||
lang('add to addressbook'),
|
|
||||||
lang('add to addressbook'));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $senderAddress;
|
return $senderAddress;
|
||||||
|
Loading…
Reference in New Issue
Block a user