diff --git a/felamimail/inc/class.ajaxfelamimail.inc.php b/felamimail/inc/class.ajaxfelamimail.inc.php index 7075e89b40..d79024ccde 100644 --- a/felamimail/inc/class.ajaxfelamimail.inc.php +++ b/felamimail/inc/class.ajaxfelamimail.inc.php @@ -1067,7 +1067,7 @@ class ajaxfelamimail ); $headerData = $headerData['header'][0]; //error_log(__METHOD__.__LINE__.print_r($headerData,true)); - foreach ($headerData as $key => $val) + foreach ((array)$headerData as $key => $val) { if (is_array($val)) { diff --git a/felamimail/inc/class.felamimail_activesync.inc.php b/felamimail/inc/class.felamimail_activesync.inc.php index 48b0aa6031..9235cd41fb 100644 --- a/felamimail/inc/class.felamimail_activesync.inc.php +++ b/felamimail/inc/class.felamimail_activesync.inc.php @@ -277,7 +277,11 @@ class felamimail_activesync implements activesync_plugin_write, activesync_plugi //error_log(__METHOD__.__LINE__.' create object with ProfileID:'.array2string(self::$profileID)); if (!$this->mail->openConnection(self::$profileID,false)) { - error_log(__METHOD__.__LINE__."($account) can not open connection!".$this->mail->getErrorMessage()); + error_log(date('Y-m-d H:i:s').' '.__METHOD__.__LINE__."($account) can not open connection!".$this->mail->getErrorMessage()."\n",3,'/var/lib/egroupware/esync-imap.log'); + error_log('# Instance='.$GLOBALS['egw_info']['user']['domain'].', User='.$GLOBALS['egw_info']['user']['account_lid'].', URL='. + ($_SERVER['HTTPS']?'https://':'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n\n",3,'/var/lib/egroupware/esync-imap.log'); + header("HTTP/1.1 500 Internal Server Error"); + //die('Mail not or mis-configured!'); throw new egw_exception_not_found(__METHOD__."($account) can not open connection!"); } } @@ -288,7 +292,11 @@ class felamimail_activesync implements activesync_plugin_write, activesync_plugi { if (!$this->mail->openConnection(self::$profileID,false)) { - error_log(__METHOD__.__LINE__."($account) can not open connection!".$this->mail->getErrorMessage()); + error_log(date('Y-m-d H:i:s').' '.__METHOD__.__LINE__."($account) can not open connection!".$this->mail->getErrorMessage()."\n",3,'/var/lib/egroupware/esync-imap.log'); + error_log('# Instance='.$GLOBALS['egw_info']['user']['domain'].', User='.$GLOBALS['egw_info']['user']['account_lid'].', URL='. + ($_SERVER['HTTPS']?'https://':'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n\n",3,'/var/lib/egroupware/esync-imap.log'); + header("HTTP/1.1 500 Internal Server Error"); + //die('Mail not or mis-configured!'); throw new egw_exception_not_found(__METHOD__."($account) can not open connection!"); } } diff --git a/felamimail/inc/class.felamimail_bo.inc.php b/felamimail/inc/class.felamimail_bo.inc.php index 1fa63c6c27..26d9d0670f 100644 --- a/felamimail/inc/class.felamimail_bo.inc.php +++ b/felamimail/inc/class.felamimail_bo.inc.php @@ -1165,7 +1165,7 @@ class felamimail_bo { static $structure; if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox()); - //error_log(__METHOD__.__LINE__." UID: $_uid, ".$this->icServer->ImapServerId.','.$_folder); + //error_log(__METHOD__.__LINE__.'User:'.trim($GLOBALS['egw_info']['user']['account_id'])." UID: $_uid, ".$this->icServer->ImapServerId.','.$_folder); if (is_null($structure)) $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); if (isset($structure[$this->icServer->ImapServerId]) && !empty($structure[$this->icServer->ImapServerId]) && isset($structure[$this->icServer->ImapServerId][$_folder]) && !empty($structure[$this->icServer->ImapServerId][$_folder]) && diff --git a/felamimail/inc/class.uifelamimail.inc.php b/felamimail/inc/class.uifelamimail.inc.php index ddd1c14b03..5ea20cab34 100644 --- a/felamimail/inc/class.uifelamimail.inc.php +++ b/felamimail/inc/class.uifelamimail.inc.php @@ -181,13 +181,17 @@ class uifelamimail if (isset($GLOBALS['egw_info']['user']['preferences']['felamimail']['ActiveProfileID'])) self::$icServerID = (int)$GLOBALS['egw_info']['user']['preferences']['felamimail']['ActiveProfileID']; //_debug_array(self::$icServerID); + if (is_object($preferences)) $imapServer = $preferences->getIncomingServer(self::$icServerID); + if (isset($imapServer->ImapServerId) && !empty($imapServer->ImapServerId)) + { + self::$icServerID = $GLOBALS['egw_info']['user']['preferences']['felamimail']['ActiveProfileID'] = $imapServer->ImapServerId; + } echo "