From 912e1a7f0793e4b54088145a56226d35add52d96 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 8 Jun 2010 22:21:23 -0600 Subject: [PATCH] Use listApps() to get app list for listAllApps() --- framework/Core/lib/Horde/Registry.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index 5faf80fcb..9c7974e85 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -599,6 +599,7 @@ class Horde_Registry * returned. Defaults to non-hidden. * @param boolean $assoc Associative array with app names as keys. * @param integer $perms The permission level to check for in the list. + * If null, skips permission check. * * @return array List of apps registered with Horde. If no * applications are defined returns an empty array. @@ -606,14 +607,14 @@ class Horde_Registry public function listApps($filter = null, $assoc = false, $perms = Horde_Perms::SHOW) { - $apps = array(); if (is_null($filter)) { $filter = array('notoolbar', 'active'); } + $apps = array(); foreach ($this->applications as $app => $params) { if (in_array($params['status'], $filter) && - $this->hasPermission($app, $perms)) { + (is_null($perms) || $this->hasPermission($app, $perms))) { $apps[$app] = $app; } } @@ -624,22 +625,18 @@ class Horde_Registry /** * Return a list of all applications, ignoring permissions. * - * @return array + * @return array List of all apps registered with Horde. */ public function listAllApps($filter = null) { // Default to all installed (but possibly not configured) applications) if (is_null($filter)) { - $filter = array('inactive', 'hidden', 'notoolbar', 'active', 'admin'); - } - $apps = array(); - foreach ($this->applications as $app => $params) { - if (in_array($params['status'], $filter)) { - $apps[] = $app; - } + $filter = array( + 'inactive', 'hidden', 'notoolbar', 'active', 'admin' + ); } - return $apps; + return $this->listApps($filter, false, null); } /** -- 2.11.0