From: Michael M Slusarz Date: Sat, 4 Sep 2010 06:35:21 +0000 (-0600) Subject: Code cleanups/phpdoc X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ca13f7da5135ce28875328efad2af0cf1ec96a55;p=horde.git Code cleanups/phpdoc --- diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index 1e9265bf5..1889aa925 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -108,8 +108,13 @@ implements Horde_Interfaces_Registry_Auth * init() will be called after the initialization is completed. * * Global variables defined: + * $browser - Horde_Browser object * $cli - Horde_Cli object (if 'cli' is true) + * $conf - Configuration array + * $injector - Horde_Injector object * $language - Language + * $notification - Horde_Notification object + * $prefs - Horde_Prefs object * $registry - Horde_Registry object * * @param string $app The application to initialize. @@ -347,7 +352,8 @@ implements Horde_Interfaces_Registry_Auth $GLOBALS['registry'] = $this; $injector->setInstance('Horde_Registry', $this); - /* Setup autoloader instance and callbacks. */ + /* Setup autoloader instance and callbacks. + * $__autoloader is defined in horde/lib/core.php */ $injector->setInstance('Horde_Autoloader', $GLOBALS['__autoloader']); foreach ($callbacks as $key => $val) { $GLOBALS['__autoloader']->addCallback($key, array($val, 'callback')); diff --git a/horde/lib/core.php b/horde/lib/core.php index b1d42a195..06059c6c3 100644 --- a/horde/lib/core.php +++ b/horde/lib/core.php @@ -9,6 +9,10 @@ * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. + * + * @category Horde + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @package Horde */ /* Turn PHP stuff off that can really screw things up. */ diff --git a/horde/services/shares/edit.php b/horde/services/shares/edit.php index ee3787f5e..44a11d77a 100644 --- a/horde/services/shares/edit.php +++ b/horde/services/shares/edit.php @@ -27,27 +27,24 @@ $app = Horde_Util::getFormData('app'); $shares = $injector->getInstance('Horde_Share')->getScope($app); $groups = Horde_Group::singleton(); $auth = $injector->getInstance('Horde_Auth')->getAuth(); -if ($registry->hasMethod('shareHelp', $app)) { - $help = $registry->callByPackage($app, 'shareHelp'); -} else { - $help = null; -} +$help = $registry->hasMethod('shareHelp', $app) + ? $registry->callByPackage($app, 'shareHelp') + : null; $form = null; $reload = false; -$actionID = Horde_Util::getFormData('actionID', 'edit'); -switch ($actionID) { +switch (Horde_Util::getFormData('actionID', 'edit')) { case 'edit': try { - $share = &$shares->getShareById(Horde_Util::getFormData('cid')); + $share = $shares->getShareById(Horde_Util::getFormData('cid')); $form = 'edit.inc'; - $perm = &$share->getPermission(); + $perm = $share->getPermission(); } catch (Horde_Share_Exception $e) { if (($category = Horde_Util::getFormData('share')) !== null) { try { $share = $shares->getShare($category); $form = 'edit.inc'; - $perm = &$share->getPermission(); + $perm = $share->getPermission(); } catch (Horde_Share_Exception $e) { $notification->push($e->getMessage(), 'horde.error'); } @@ -55,16 +52,16 @@ case 'edit': } if (!$registry->getAuth() || - (isset($share) && - !$registry->isAdmin() && - $registry->getAuth() != $share->get('owner'))) { - exit('permission denied'); + (isset($share) && + !$registry->isAdmin() && + ($registry->getAuth() != $share->get('owner')))) { + throw new Horde_Exception('Permission denied.'); } break; case 'editform': try { - $share = &$shares->getShareById(Horde_Util::getFormData('cid')); + $share = $shares->getShareById(Horde_Util::getFormData('cid')); } catch (Horde_Share_Exception $e) { $notification->push(_("Attempt to edit a non-existent share."), 'horde.error'); } @@ -72,10 +69,10 @@ case 'editform': if (!empty($share)) { if (!$registry->getAuth() || (!$registry->isAdmin() && - $registry->getAuth() != $share->get('owner'))) { - exit('permission denied'); + ($registry->getAuth() != $share->get('owner')))) { + throw new Horde_Exception('Permission denied.'); } - $perm = &$share->getPermission(); + $perm = $share->getPermission(); // Process owner and owner permissions. $old_owner = $share->get('owner'); @@ -258,11 +255,9 @@ case 'editform': break; } -if (is_a($share, 'PEAR_Error')) { - $title = _("Edit permissions"); -} else { - $title = sprintf(_("Edit permissions for \"%s\""), $share->get('name')); -} +$title = ($share instanceof PEAR_Error) + ? _("Edit permissions") + : sprintf(_("Edit permissions for \"%s\""), $share->get('name')); $userList = array(); if ($auth->hasCapability('list') && diff --git a/horde/templates/shares/edit.inc b/horde/templates/shares/edit.inc index 19aa853d5..76183d149 100644 --- a/horde/templates/shares/edit.inc +++ b/horde/templates/shares/edit.inc @@ -21,11 +21,9 @@