From a609599aaecc2d2add98b197b1389eef294b91a5 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 15 Jul 2010 16:33:17 -0600 Subject: [PATCH] Bug #9117: Buffer sidebar output in IMP --- imp/lib/IMP.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index 1489917fa..ee7b9e3b6 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -87,7 +87,14 @@ class IMP * * @var array */ - static private $_menuTemplate = null; + static private $_menu = null; + + /** + * Sidebar buffer. + * + * @var array + */ + static private $_sidebar; /** * Returns the current view mode for IMP. @@ -590,7 +597,7 @@ class IMP */ static public function prepareMenu() { - if (isset(self::$_menuTemplate)) { + if (isset(self::$_menu)) { return; } @@ -610,7 +617,13 @@ class IMP } $t->set('menu_string', self::getMenu()->render()); - self::$_menuTemplate = $t; + self::$_menu = $t; + + /* Need to buffer sidebar output here, because it may add things like + * cookies which need to be sent before output begins. */ + Horde::startBuffer(); + require HORDE_BASE . '/services/portal/sidebar.php'; + self::$_sidebar = Horde::endBuffer(); } /** @@ -619,8 +632,9 @@ class IMP static public function menu() { self::prepareMenu(); - echo self::$_menuTemplate->fetch(IMP_TEMPLATES . '/imp/menu/menu.html'); - require HORDE_BASE . '/services/portal/sidebar.php'; + + echo self::$_menu->fetch(IMP_TEMPLATES . '/imp/menu/menu.html') . + self::$_sidebar; } /** -- 2.11.0