From 1d909b12484bf32796d4e0bc7e3eb663faf57482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Wed, 12 Dec 2012 11:46:19 +0100 Subject: [PATCH] [-] FO: The dispatcher now load the custom routes prior the defaults to avoid infinite loops --- classes/Dispatcher.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/classes/Dispatcher.php b/classes/Dispatcher.php index 48fe6f224..756893238 100644 --- a/classes/Dispatcher.php +++ b/classes/Dispatcher.php @@ -396,18 +396,7 @@ class DispatcherCore $this->default_routes[$route] = array_merge($this->default_routes[$route], $route_details); } - // Set default routes - foreach (Language::getLanguages() as $lang) - foreach ($this->default_routes as $id => $route) - $this->addRoute( - $id, - $route['rule'], - $route['controller'], - $lang['id_lang'], - $route['keywords'], - isset($route['params']) ? $route['params'] : array() - ); - + // Load the custom routes prior the defaults to avoid infinite loops if ($this->use_routes) { // Get iso lang @@ -449,6 +438,18 @@ class DispatcherCore isset($route_data['params']) ? $route_data['params'] : array() ); } + + // Set default routes + foreach (Language::getLanguages() as $lang) + foreach ($this->default_routes as $id => $route) + $this->addRoute( + $id, + $route['rule'], + $route['controller'], + $lang['id_lang'], + $route['keywords'], + isset($route['params']) ? $route['params'] : array() + ); } /**