From 1b0931d0ccc4adc9f6409898cf0787b3a4f863cd Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Thu, 4 Feb 2010 22:53:55 +0100 Subject: [PATCH] Catch exceptions. --- framework/Block/lib/Horde/Block/Layout/View.php | 52 +++++++++++++------------ 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/framework/Block/lib/Horde/Block/Layout/View.php b/framework/Block/lib/Horde/Block/Layout/View.php index 540806be8..f897db7ef 100644 --- a/framework/Block/lib/Horde/Block/Layout/View.php +++ b/framework/Block/lib/Horde/Block/Layout/View.php @@ -69,37 +69,39 @@ class Horde_Block_Layout_View extends Horde_Block_Layout } if (is_array($item)) { $this->_applications[$item['app']] = $item['app']; - $block = Horde_Block_Collection::getBlock($item['app'], $item['params']['type'], $item['params']['params'], $row_num, $col_num); - $rowspan = $item['height']; - $colspan = $item['width']; - for ($i = 0; $i < $item['height']; $i++) { - if (!isset($covered[$row_num + $i])) { - $covered[$row_num + $i] = array(); + try { + $block = Horde_Block_Collection::getBlock($item['app'], $item['params']['type'], $item['params']['params'], $row_num, $col_num); + $rowspan = $item['height']; + $colspan = $item['width']; + for ($i = 0; $i < $item['height']; $i++) { + if (!isset($covered[$row_num + $i])) { + $covered[$row_num + $i] = array(); + } + for ($j = 0; $j < $item['width']; $j++) { + $covered[$row_num + $i][$col_num + $j] = true; + } } - for ($j = 0; $j < $item['width']; $j++) { - $covered[$row_num + $i][$col_num + $j] = true; + if ($block instanceof Horde_Block) { + $header = $block->getTitle(); + $content = $block->getContent(); + if ($content instanceof PEAR_Error) { + $content = $content->getMessage(); + } + if ($browser->hasFeature('xmlhttpreq')) { + $refresh_time = isset($item['params']['params']['_refresh_time']) ? $item['params']['params']['_refresh_time'] : $interval; + } + ob_start(); + include $tplDir . '/portal/block.inc'; + $html .= ob_get_clean(); + } else { + $html .= ' '; } - } - if ($block instanceof PEAR_Error) { + } catch (Horde_Exception $e) { $header = _("Error"); - $content = $block->getMessage(); - ob_start(); - include $tplDir . '/portal/block.inc'; - $html .= ob_get_clean(); - } elseif ($block instanceof Horde_Block) { - $header = $block->getTitle(); - $content = $block->getContent(); - if ($content instanceof PEAR_Error) { - $content = $content->getMessage(); - } - if ($browser->hasFeature('xmlhttpreq')) { - $refresh_time = isset($item['params']['params']['_refresh_time']) ? $item['params']['params']['_refresh_time'] : $interval; - } + $content = $e->getMessage(); ob_start(); include $tplDir . '/portal/block.inc'; $html .= ob_get_clean(); - } else { - $html .= ' '; } } else { $html .= ' '; -- 2.11.0