From 340d6fce11d6a66e042e060c514084a0a8ec8455 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 8 Feb 2013 18:53:43 +0100 Subject: [PATCH 1/2] Better way of getting the navigation entries for an app --- lib/app.php | 17 +++++++++++++++++ settings/ajax/navigationdetect.php | 5 +---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/app.php b/lib/app.php index 3a4e21e8cd1..c7e20a9fa96 100644 --- a/lib/app.php +++ b/lib/app.php @@ -285,6 +285,23 @@ class OC_App{ return true; } + /** + * @brief Get the navigation entries for the $app + * @param string $app app + * @return array of the $data added with addNavigationEntry + */ + public static function getAppNavigationEntries($app) { + if(is_file(self::getAppPath($app).'/appinfo/app.php')) { + $save = self::$navigation; + self::$navigation = array(); + require $app.'/appinfo/app.php'; + $app_entries = self::$navigation; + self::$navigation = $save; + return $app_entries; + } + return array(); + } + /** * @brief gets the active Menu entry * @return string id or empty string diff --git a/settings/ajax/navigationdetect.php b/settings/ajax/navigationdetect.php index 93acb50dc20..d21f774126c 100644 --- a/settings/ajax/navigationdetect.php +++ b/settings/ajax/navigationdetect.php @@ -5,10 +5,7 @@ OCP\JSON::callCheck(); $app = $_GET['app']; -//load the one app and see what it adds to the navigation -OC_App::loadApp($app); - -$navigation = OC_App::getNavigation(); +$navigation = OC_App::getAppNavigationEntries($app); $navIds = array(); foreach ($navigation as $nav) { From fba9739448dfca7234c3910f88ce56f0f28e6bad Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 8 Feb 2013 19:06:59 +0100 Subject: [PATCH 2/2] Always load the apps before trying to match a route --- lib/base.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/base.php b/lib/base.php index 5bfdb0b7c0a..e71928bfc03 100644 --- a/lib/base.php +++ b/lib/base.php @@ -556,6 +556,7 @@ class OC { if (!self::$CLI) { try { + OC_App::loadApps(); OC::getRouter()->match(OC_Request::getPathInfo()); return; } catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {