From 17c195a19eb9c16a694923987664e0cacef58b57 Mon Sep 17 00:00:00 2001 From: leithoff Date: Tue, 14 Jun 2016 10:50:04 +0200 Subject: [PATCH] handle fatal error on NO mail account available for current user on mail-app-call. call the wizard --- mail/inc/class.mail_tree.inc.php | 1 + mail/inc/class.mail_ui.inc.php | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/mail/inc/class.mail_tree.inc.php b/mail/inc/class.mail_tree.inc.php index 22ed745d03..c4542ef7d3 100644 --- a/mail/inc/class.mail_tree.inc.php +++ b/mail/inc/class.mail_tree.inc.php @@ -168,6 +168,7 @@ class mail_tree { //Init mail folders $tree = array(Tree::ID=> $_parent?$_parent:0,Tree::CHILDREN => array()); + if (!isset($this->ui->mail_bo)) throw new Api\Exception\WrongUserinput(lang('Initialization of mail failed. Please use the Wizard to cope with the problem')); $hDelimiter = $this->ui->mail_bo->getHierarchyDelimiter(); if ($_parent) list($_profileID) = explode(self::DELIMITER, $_parent); diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 27cc68e5bc..258af52c46 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -240,7 +240,7 @@ class mail_ui $this->mail_bo = Mail::getInstance(false,self::$icServerID,true, false, true); if (Mail::$debug) error_log(__METHOD__.__LINE__.' Fetched IC Server:'.self::$icServerID.'/'.$this->mail_bo->profileID.':'.function_backtrace()); // no icServer Object: something failed big time - if (!isset($this->mail_bo->icServer) || $this->mail_bo->icServer->ImapServerId<>$_icServerID) + if (!isset($this->mail_bo) || !isset($this->mail_bo->icServer) || $this->mail_bo->icServer->ImapServerId<>$_icServerID) { self::$icServerID = $_icServerID; throw new Api\Exception('Profile change failed!'); @@ -420,6 +420,7 @@ class mail_ui { //error_log(__METHOD__.__LINE__.array2string($content)); try { + if (!isset($this->mail_bo)) throw new Api\Exception\WrongUserinput(lang('Initialization of mail failed. Please use the Wizard to cope with the problem.')); //error_log(__METHOD__.__LINE__.function_backtrace()); if (Mail::$debugTimes) $starttime = microtime (true); $this->mail_bo->restoreSessionData(); @@ -573,16 +574,19 @@ class mail_ui { // do not exit here. mail-tree should be build. if we exit here, we never get there. error_log(__METHOD__.__LINE__.$e->getMessage().($e->details?', '.$e->details:'').' Menuaction:'.$_GET['menuaction'].'.'.function_backtrace()); - if (empty($etpl)) + if (isset($this->mail_bo)) { - $sel_options[self::$nm_index]['foldertree'] = $this->mail_tree->getInitialIndexTree(null, $this->mail_bo->profileID, null, !$this->mail_bo->mailPreferences['showAllFoldersInFolderPane'],!$this->mail_bo->mailPreferences['showAllFoldersInFolderPane']); - $etpl = new Etemplate('mail.index'); + if (empty($etpl)) + { + $sel_options[self::$nm_index]['foldertree'] = $this->mail_tree->getInitialIndexTree(null, $this->mail_bo->profileID, null, !$this->mail_bo->mailPreferences['showAllFoldersInFolderPane'],!$this->mail_bo->mailPreferences['showAllFoldersInFolderPane']); + $etpl = new Etemplate('mail.index'); + } + $etpl->setElementAttribute(self::$nm_index.'[foldertree]','actions', $this->get_tree_actions(false)); } - $etpl->setElementAttribute(self::$nm_index.'[foldertree]','actions', $this->get_tree_actions(false)); $readonlys = $preserv = array(); if (empty($content)) $content=array(); - self::callWizard($e->getMessage().$e->getMessage().($e->details?', '.$e->details:''),false, 'error',false); + self::callWizard($e->getMessage().($e->details?', '.$e->details:''),(isset($this->mail_bo)?false:true), 'error',false); //return false; } // Check preview pane is enabled, then show spliter