From a371287d0847a8d6108dae9cb5421112d6ea1252 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 4 Aug 2009 02:45:38 -0600 Subject: [PATCH] Add IMP::getViewMode(). --- imp/lib/IMP.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index c15924e42..3a75cf891 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -90,9 +90,7 @@ class IMP } $GLOBALS['notification'] = Horde_Notification::singleton(); - $viewmode = isset($_SESSION['imp']['view']) - ? $_SESSION['imp']['view'] - : 'imp'; + $viewmode = self::getViewMode(); if ($viewmode == 'mimp') { $GLOBALS['imp_notify'] = $GLOBALS['notification']->attach('status', null, 'Horde_Notification_Listener_Mobile'); @@ -111,6 +109,18 @@ class IMP } /** + * Returns the current view mode for IMP. + * + * @return string Either 'dimp', 'imp', or 'mimp'. + */ + static public function getViewMode() + { + return isset($_SESSION['imp']['view']) + ? $_SESSION['imp']['view'] + : 'imp'; + } + + /** * Returns the plain text label that is displayed for the current mailbox, * replacing virtual search mailboxes with an appropriate description and * removing namespace and mailbox prefix information from what is shown to @@ -386,10 +396,7 @@ class IMP $args = self::composeLinkArgs($args, $extra); if (is_null($view)) { - /* Default to 'imp' if not currently logged-in. */ - $view = empty($_SESSION['imp']['view']) - ? 'imp' - : $_SESSION['imp']['view']; + $view = self::getViewMode(); } if ($view == 'dimp') { -- 2.11.0