From: Michael J. Rubinsky Date: Wed, 19 May 2010 19:59:06 +0000 (-0400) Subject: Track changes to Horde_Share in Ingo X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=471d6e48cd9d12eef526c910c39d50dd50f71362;p=horde.git Track changes to Horde_Share in Ingo --- diff --git a/ingo/lib/Application.php b/ingo/lib/Application.php index 332489310..826919eac 100644 --- a/ingo/lib/Application.php +++ b/ingo/lib/Application.php @@ -177,35 +177,32 @@ class Ingo_Application extends Horde_Registry_Application /* Now remove all shares owned by the user. */ if (!empty($GLOBALS['ingo_shares'])) { /* Get the user's default share. */ - $share = $GLOBALS['ingo_shares']->getShare($user); - if ($share instanceof PEAR_Error) { - Horde::logMessage($share, 'ERR'); - throw new Horde_Auth_Exception($share); - } - - $result = $GLOBALS['ingo_shares']->removeShare($share); - if ($result instanceof PEAR_Error) { - Horde::logMessage($result, 'ERR'); - throw new Horde_Auth_Exception($share); + try { + $share = $GLOBALS['ingo_shares']->getShare($user); + $GLOBALS['ingo_shares']->removeShare($share); + } catch (Horde_Share_Exception $e) { + Horde::logMessage($e->getMessage(), 'ERR'); + throw new Ingo_Exception($e); } /* Get a list of all shares this user has perms to and remove the * perms. */ - $shares = $GLOBALS['ingo_shares']->listShares($user); - if ($shares instanceof PEAR_Error) { - Horde::logMessage($shares, 'ERR'); - } else { + try { + $shares = $GLOBALS['ingo_shares']->listShares($user); foreach ($shares as $share) { $share->removeUser($user); } + } catch (Horde_Shares_Exception $e) { + Horde::logMessage($e, 'ERR'); } /* Get a list of all shares this user owns and has perms to delete * and remove them. */ - $shares = $GLOBALS['ingo_shares']->listShares($user, Horde_Perms::DELETE, $user); - if ($shares instanceof PEAR_Error) { - Horde::logMessage($shares, 'ERR'); - throw new Horde_Auth_Exception($share); + try { + $shares = $GLOBALS['ingo_shares']->listShares($user, Horde_Perms::DELETE, $user); + } catch (Horde_Share_Exception $e) { + Horde::logMessage($e, 'ERR'); + throw new Ingo_Exception($e); } foreach ($shares as $share) { diff --git a/ingo/lib/Ingo.php b/ingo/lib/Ingo.php index bfe3d5e10..4d3d6f595 100644 --- a/ingo/lib/Ingo.php +++ b/ingo/lib/Ingo.php @@ -154,7 +154,7 @@ class Ingo * * @param string $folder The name of the folder to create. * - * @return boolean True on success, false if not created. PEAR_Error on + * @return boolean True on success, false if not created. * @throws Horde_Exception */ static public function createFolder($folder) @@ -376,9 +376,10 @@ class Ingo static public function listRulesets($owneronly = false, $permission = Horde_Perms::SHOW) { - $rulesets = $GLOBALS['ingo_shares']->listShares(Horde_Auth::getAuth(), $permission, $owneronly ? Horde_Auth::getAuth() : null); - if ($rulesets instanceof PEAR_Error) { - Horde::logMessage($rulesets, 'ERR'); + try { + $rulesets = $GLOBALS['ingo_shares']->listShares(Horde_Auth::getAuth(), $permission, $owneronly ? Horde_Auth::getAuth() : null); + } catch (Horde_Share_Exception $e) { + Horde::logMessage($e, 'ERR'); return array(); } @@ -423,12 +424,12 @@ class Ingo static public function getMenu() { $menu = new Horde_Menu(); - $menu->add(Horde::applicationUrl('filters.php'), _("Filter _Rules"), 'ingo.png', null, null, null, basename($_SERVER['PHP_SELF']) == 'index.php' ? 'current' : null); - if (!is_a($whitelist_url = $GLOBALS['registry']->link('mail/showWhitelist'), 'PEAR_Error')) { - $menu->add(Horde::url($whitelist_url), _("_Whitelist"), 'whitelist.png'); - } - if (!is_a($blacklist_url = $GLOBALS['registry']->link('mail/showBlacklist'), 'PEAR_Error')) { - $menu->add(Horde::url($blacklist_url), _("_Blacklist"), 'blacklist.png'); + try { + $menu->add(Horde::applicationUrl('filters.php'), _("Filter _Rules"), 'ingo.png', null, null, null, basename($_SERVER['PHP_SELF']) == 'index.php' ? 'current' : null); + $menu->add(Horde::url($GLOBALS['injector']->getInstance('Horde_Registry')->link('mail/showWhitelist')), _("_Whitelist"), 'whitelist.png'); + $menu->add(Horde::url($GLOBALS['injector']->getInstance('Horde_Registry')->link('mail/showBlacklist')), _("_Blacklist"), 'blacklist.png'); + } catch (Horde_Exception $e) { + Horde::logMessage($e->getMessage(), 'ERR'); } if (in_array(Ingo_Storage::ACTION_VACATION, $_SESSION['ingo']['script_categories'])) { $menu->add(Horde::applicationUrl('vacation.php'), _("_Vacation"), 'vacation.png');