[-] FO: The dispatcher now load the custom routes prior the defaults to avoid infinite loops

This commit is contained in:
Rémi Gaillard
2012-12-12 11:46:19 +01:00
parent bfff958b1f
commit 1d909b1248
+13 -12
View File
@@ -396,18 +396,7 @@ class DispatcherCore
$this->default_routes[$route] = array_merge($this->default_routes[$route], $route_details); $this->default_routes[$route] = array_merge($this->default_routes[$route], $route_details);
} }
// Set default routes // Load the custom routes prior the defaults to avoid infinite loops
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()
);
if ($this->use_routes) if ($this->use_routes)
{ {
// Get iso lang // Get iso lang
@@ -449,6 +438,18 @@ class DispatcherCore
isset($route_data['params']) ? $route_data['params'] : array() 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()
);
} }
/** /**