mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-25 06:31:59 +01:00
adapt moving/copy of mails from folder to folder; fix fetch all available accounts with servers; fix missing emailaddress in mail-account-foldertree (first level) needed htmlspecialchars
This commit is contained in:
parent
0e765f8566
commit
03327b4bb1
@ -491,14 +491,15 @@ class mail_bo
|
||||
$allAccountData = emailadmin_account::search($only_current_user=true, $just_name=false, $order_by=null);
|
||||
if ($allAccountData) {
|
||||
$rememberFirst=$selectedFound=null;
|
||||
foreach ($allAccountData as $tmpkey => $prof)
|
||||
foreach ($allAccountData as $tmpkey => $icServers)
|
||||
{
|
||||
if (is_null($rememberFirst)) $rememberFirst = $tmpkey;
|
||||
if ($tmpkey == $selectedID) $selectedFound=true;
|
||||
//error_log(__METHOD__.__LINE__.' Key:'.$tmpkey.'->'.array2string($icServers[$tmpkey]->acc_imap_host));
|
||||
$host = $icServers[$tmpkey]->acc_imap_host;
|
||||
//error_log(__METHOD__.__LINE__.' Key:'.$tmpkey.'->'.array2string($icServers->acc_imap_host));
|
||||
$host = $icServers->acc_imap_host;
|
||||
if (empty($host)) continue;
|
||||
$identities[$icServers[$tmpkey]->acc_id] = $icServers[$tmpkey]->ident_realname.' '.$icServers[$tmpkey]->ident_org.' <'.$icServers[$tmpkey]->ident_email.'>';
|
||||
$identities[$icServers->acc_id] = $icServers['ident_realname'].' '.$icServers['ident_org'].' <'.$icServers['ident_email'].'>';
|
||||
//error_log(__METHOD__.__LINE__.' Key:'.$tmpkey.'->'.array2string($identities[$icServers->acc_id]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -542,7 +543,7 @@ class mail_bo
|
||||
*/
|
||||
function closeConnection() {
|
||||
//if ($icServer->_connected) error_log(__METHOD__.__LINE__.' disconnect from Server');
|
||||
error_log(__METHOD__."() ".function_backtrace());
|
||||
//error_log(__METHOD__."() ".function_backtrace());
|
||||
$this->icServer->disconnect();
|
||||
}
|
||||
|
||||
@ -2491,7 +2492,7 @@ class mail_bo
|
||||
*/
|
||||
function deleteMessages($_messageUID, $_folder=NULL, $_forceDeleteMethod='no')
|
||||
{
|
||||
error_log(__METHOD__.__LINE__.'->'.array2string($_messageUID).','.array2string($_folder).', '.$_forceDeleteMethod);
|
||||
//error_log(__METHOD__.__LINE__.'->'.array2string($_messageUID).','.array2string($_folder).', '.$_forceDeleteMethod);
|
||||
$msglist = '';
|
||||
$oldMailbox = '';
|
||||
if (is_null($_folder) || empty($_folder)) $_folder = $this->sessionData['mailbox'];
|
||||
@ -2793,22 +2794,36 @@ class mail_bo
|
||||
$msglist = '';
|
||||
|
||||
$deleteOptions = $GLOBALS['egw_info']["user"]["preferences"]["mail"]["deleteOptions"];
|
||||
$retUid = $this->icServer->copyMessages($_foldername, $_messageUID, (!empty($currentFolder)?$currentFolder: $this->sessionData['mailbox']), true, $returnUIDs);
|
||||
if ( PEAR::isError($retUid) ) {
|
||||
error_log(__METHOD__.__LINE__."Copying to Folder $_foldername failed! PEAR::Error:".array2string($retUid->message));
|
||||
throw new egw_exception("Copying to Folder $_foldername failed! PEAR::Error:".array2string($retUid->message));
|
||||
if(!is_array($_messageUID) || count($_messageUID) === 0)
|
||||
{
|
||||
if ($_messageUID=='all')
|
||||
{
|
||||
$uidsToMove= null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (self::$debug) error_log(__METHOD__." no messages Message(s): ".implode(',',$_messageUID));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$uidsToMove = new Horde_Imap_Client_Ids();
|
||||
$uidsToMove->add($_messageUID);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$retUid = $this->icServer->copy((!empty($currentFolder)?$currentFolder: $this->sessionData['mailbox']), $_foldername, array('ids'=>$uidsToMove,'move'=>$deleteAfterMove));
|
||||
}
|
||||
catch (exception $e)
|
||||
{
|
||||
error_log(__METHOD__.__LINE__."Copying to Folder $_foldername failed! Error:".$e->getMessage());
|
||||
throw new egw_exception("Copying to Folder $_foldername failed! Error:".$e->getMessage());
|
||||
return false;
|
||||
}
|
||||
if ($deleteAfterMove === true)
|
||||
{
|
||||
$retValue = $this->icServer->deleteMessages($_messageUID, true);
|
||||
if ( PEAR::isError($retValue))
|
||||
{
|
||||
error_log(__METHOD__.__LINE__."Delete After Move PEAR::Error:".array2string($retValue->message));
|
||||
throw new egw_exception("Delete After Move PEAR::Error:".array2string($retValue->message));
|
||||
return false;
|
||||
}
|
||||
|
||||
if($deleteOptions != "mark_as_deleted")
|
||||
{
|
||||
$structure = egw_cache::getCache(egw_cache::INSTANCE,'email','structureCache'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*1);
|
||||
|
@ -1855,14 +1855,17 @@ class mail_compose
|
||||
{
|
||||
$mail_bo = $this->mail_bo;
|
||||
$_mailObject->PluginDir = EGW_SERVER_ROOT."/phpgwapi/inc/";
|
||||
$activeMailProfile = array();//$this->preferences->getIdentity($this->mail_bo->profileID, true);
|
||||
$activeMailProfile = emailadmin_account::read($this->mail_bo->profileID);
|
||||
$_mailObject->IsSMTP();
|
||||
$_mailObject->CharSet = $this->displayCharset;
|
||||
// you need to set the sender, if you work with different identities, since most smtp servers, dont allow
|
||||
// sending in the name of someone else
|
||||
if ($_identity->id != $activeMailProfile->id && strtolower($activeMailProfile->emailAddress) != strtolower($_identity->emailAddress)) error_log(__METHOD__.__LINE__.' Faking From/SenderInfo for '.$activeMailProfile->emailAddress.' with ID:'.$activeMailProfile->id.'. Identitiy to use for sending:'.array2string($_identity));
|
||||
$_mailObject->Sender = ($_identity->id<0 && $activeMailProfile->id < 0 ? $_identity->emailAddress : $activeMailProfile->emailAddress);
|
||||
$_mailObject->From = $_identity->emailAddress;
|
||||
if ($_identity['ident_id'] != $activeMailProfile['ident_id'] && !empty($_identity['ident_email']) && strtolower($activeMailProfile['ident_email']) != strtolower($_identity['ident_email']))
|
||||
{
|
||||
error_log(__METHOD__.__LINE__.' Faking From/SenderInfo for '.$activeMailProfile['ident_email'].' with ID:'.$activeMailProfile['ident_id'].'. Identitiy to use for sending:'.array2string($_identity));
|
||||
}
|
||||
$_mailObject->Sender = (!empty($_identity['ident_email'])? $_identity['ident_email'] : $activeMailProfile['ident_email']);
|
||||
$_mailObject->From = $_identity['ident_email'];
|
||||
$_mailObject->FromName = $_mailObject->EncodeHeader(mail_bo::generateIdentityString($_identity,false));
|
||||
$_mailObject->Priority = $_formData['priority'];
|
||||
$_mailObject->Encoding = 'quoted-printable';
|
||||
@ -1871,11 +1874,11 @@ class mail_compose
|
||||
$_mailObject->AddCustomHeader('In-Reply-To: '. $_formData['in-reply-to']);
|
||||
}
|
||||
if($_formData['disposition']) {
|
||||
$_mailObject->AddCustomHeader('Disposition-Notification-To: '. $_identity->emailAddress);
|
||||
$_mailObject->AddCustomHeader('Disposition-Notification-To: '. $_identity['ident_email']);
|
||||
}
|
||||
if(!empty($_identity->organization) && (mail_bo::$mailConfig['how2displayIdentities'] == '' || mail_bo::$mailConfig['how2displayIdentities'] == 'orgNemail')) {
|
||||
#$_mailObject->AddCustomHeader('Organization: '. $mail_bo->encodeHeader($_identity->organization, 'q'));
|
||||
$_mailObject->AddCustomHeader('Organization: '. $_identity->organization);
|
||||
$_mailObject->AddCustomHeader('Organization: '. $_identity['ident_org']);
|
||||
}
|
||||
|
||||
foreach((array)$_formData['to'] as $address) {
|
||||
|
@ -573,7 +573,7 @@ class mail_ui
|
||||
if ($_profileID && $acc_id != $_profileID) continue;
|
||||
|
||||
$oA = array('id' => $acc_id,
|
||||
'text' => $identity_name,
|
||||
'text' => htmlspecialchars($identity_name),
|
||||
'tooltip' => '('.$acc_id.') '.htmlspecialchars_decode($identity_name),
|
||||
'im0' => 'thunderbird.png',
|
||||
'im1' => 'thunderbird.png',
|
||||
|
Loading…
Reference in New Issue
Block a user