Commit 03b19454 authored by Mathieu Delestre's avatar Mathieu Delestre

fix route handling

parent 996d7131
Pipeline #6432 passed with stage
in 34 seconds
......@@ -15,7 +15,14 @@ define('BOOTSTRAP_LOADED', true);
define('ENV_ROOTPATH', realpath(__DIR__));
define('ENV_BASEPATH', str_replace('/bootstrap.php', '', getField($_SERVER, 'SCRIPT_NAME', getField($_SERVER, 'PHP_SELF'))));
define('ENV_REQUEST', preg_replace('/\/$/','',preg_replace('/^\//','',str_replace(ENV_BASEPATH, '', getField(explode('?',getField($_SERVER, 'REQUEST_URI')), 0)))));
define('ENV_ROUTE', preg_replace('/^[a-z]{2}\/?/', '', ENV_REQUEST) ? preg_replace('/^[a-z]{2}\/?/', '', ENV_REQUEST) : 'index');
$env_route = null;
if(preg_match('/^[a-z]{2}(\/.*)?$/', ENV_REQUEST))
$env_route = preg_replace('/^[a-z]{2}\/?/', '', ENV_REQUEST);
else if(ENV_REQUEST)
$env_route = ENV_REQUEST;
define('ENV_ROUTE', $env_route ? $env_route : 'index');
// extraction de la langue courante
if (preg_match('/^([a-z]{2})(\/.*)?$/', ENV_REQUEST, $reg))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment