From 4bbda170bd2e4a676abe480d6694c4792d326ad6 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Fri, 14 Feb 2014 12:20:25 +0000 Subject: [PATCH] try to catch exeptions on ->no mail-accounts available at all<- --- mail/inc/class.mail_bo.inc.php | 24 +++++++++++++++++++----- mail/inc/class.mail_ui.inc.php | 6 +++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/mail/inc/class.mail_bo.inc.php b/mail/inc/class.mail_bo.inc.php index c659aa5f05..f3adfa4599 100644 --- a/mail/inc/class.mail_bo.inc.php +++ b/mail/inc/class.mail_bo.inc.php @@ -243,7 +243,14 @@ class mail_bo error_log(__METHOD__.__LINE__." Loading the Profile for ProfileID ".$_profileID.' failed for icServer; '.$e->getMessage().' Trigger new instance for Default-Profile '.$newprofileID.'. called from:'.function_backtrace()); if ($newprofileID) { - self::$instances[$newprofileID] = new mail_bo('utf-8',false,$newprofileID); + try + { + self::$instances[$newprofileID] = new mail_bo('utf-8',false,$newprofileID); + } + catch (Exception $e) + { + throw new egw_exception(__METHOD__." failed to instanciate mail_bo for $newprofileID with error:".$e->getMessage());; + } $_profileID = $newprofileID; } } @@ -323,11 +330,18 @@ class mail_bo $this->sessionData = array(); $this->forcePrefReload(); } - $this->profileID = self::validateProfileID($_profileID); - $this->accountid = $GLOBALS['egw_info']['user']['account_id']; + try + { + $this->profileID = self::validateProfileID($_profileID); + $this->accountid = $GLOBALS['egw_info']['user']['account_id']; - //error_log(__METHOD__.__LINE__." ProfileID ".$this->profileID.' called from:'.function_backtrace()); - $acc = emailadmin_account::read($this->profileID); + //error_log(__METHOD__.__LINE__." ProfileID ".$this->profileID.' called from:'.function_backtrace()); + $acc = emailadmin_account::read($this->profileID); + } + catch (Exception $e) + { + throw new egw_exception(__METHOD__." failed to instanciate mail_bo for $_profileID / ".$this->profileID." with error:".$e->getMessage());; + } //error_log(__METHOD__.__LINE__.array2string($acc->imapServer())); $this->icServer = ($_oldImapServerObject?$acc->oldImapServer():$acc->imapServer()); $this->ogServer = $acc->smtpServer(); diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 9bcf747e07..199680b73e 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -2588,7 +2588,7 @@ unset($query['actions']); */ function vfsSaveAttachment($ids,$path) { - error_log(__METHOD__.__LINE__.'("'.array2string($ids).'","'.$path."\")');"); + //error_log(__METHOD__.__LINE__.'("'.array2string($ids).'","'.$path."\")');"); if (is_array($ids) && !egw_vfs::is_writable($path) || !is_array($ids) && !egw_vfs::is_writable(dirname($path))) { @@ -2603,8 +2603,8 @@ unset($query['actions']); $mailbox = $hA['folder']; //error_log(__METHOD__.__LINE__.array2string($hA)); $this->mail_bo->reopen($mailbox); - $attachment = $this->mail_bo->getAttachment($uid,$part,$is_winmail); - + $attachment = $this->mail_bo->getAttachment($uid,$part,$is_winmail,false); + //error_log(__METHOD__.__LINE__.array2string($attachment)); if (!($fp = egw_vfs::fopen($file=$path.($name ? '/'.$name : ''),'wb')) || !fwrite($fp,$attachment['attachment'])) {