Commit 44f421ef authored by Mathieu Delestre's avatar Mathieu Delestre

Encore un fix du BASEPATH

ça marche pas souvent du premier coup (on va espérer que le second sera le bon)
parent ec6fb5e4
Pipeline #4628 passed with stage
in 1 minute and 5 seconds
......@@ -13,7 +13,7 @@ use Gettext\Translator;
define('BOOTSTRAP_LOADED', true);
define('ENV_ROOTPATH', realpath(__DIR__));
$temp = str_replace('bootstrap.php', '', getField($_SERVER, 'SCRIPT_NAME', getField($_SERVER, 'PHP_SELF')));
$temp = str_replace('/bootstrap.php', '', getField($_SERVER, 'SCRIPT_NAME', getField($_SERVER, 'PHP_SELF')));
if($temp)
define('ENV_BASEPATH', $temp.'/');
else
......@@ -25,6 +25,12 @@ define('ENV_ROUTE', preg_replace('/^[a-z]{2}\/?/', '', ENV_REQUEST) ? preg_repla
if (preg_match('/^([a-z]{2})(\/.*)?$/', ENV_REQUEST, $reg))
define('ENV_LNG', $reg[1]);
else
define('ENV_LNG', false);
// Debug ENV
//echo '<pre>'.print_r(array('ENV_BASEPATH'=>ENV_BASEPATH,'ENV_REQUEST'=>ENV_REQUEST,'ENV_ROUTE'=>ENV_ROUTE,'ENV_LNG'=>ENV_LNG),1).'</pre>'; die();
if(!ENV_LNG)
{
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
if(__locale($lang))
......@@ -34,9 +40,6 @@ else
exit();
}
// Debug ENV
// echo '<pre>'.print_r(array('ENV_BASEPATH'=>ENV_BASEPATH,'ENV_REQUEST'=>ENV_REQUEST,'ENV_ROUTE'=>ENV_ROUTE,'ENV_LNG'=>ENV_LNG),1).'</pre>'; die();
// Translator
$t = new Translator();
// create global function to handle translation as described bellow
......
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