2021-11-24 20:50:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$env = 'prod';
|
|
|
|
if (getenv('ENV') !== false && in_array(getenv('ENV'), ['prod', 'dev']))
|
|
|
|
$env = getenv('ENV');
|
|
|
|
define('ENV', $env);
|
2021-11-25 00:01:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
# load locales
|
|
|
|
$lang = 'es';
|
|
|
|
$lang_file = '/src/locales/'.$lang.'.json';
|
|
|
|
$locales = (object)[];
|
|
|
|
if (file_exists($lang_file))
|
|
|
|
$locales = json_decode(file_get_contents($lang_file), true);
|
|
|
|
|
|
|
|
function l($key, $default='') {
|
|
|
|
global $locales;
|
|
|
|
$parts = explode('.', $key);
|
|
|
|
if (isset($locales[$parts[0]][$parts[1]]))
|
|
|
|
echo $locales[$parts[0]][$parts[1]];
|
|
|
|
else echo $default;
|
|
|
|
}
|
2021-11-25 13:33:49 +00:00
|
|
|
|
|
|
|
# read config
|
|
|
|
$config = [];
|
|
|
|
if (file_exists('/config/config.php')) {
|
|
|
|
require_once '/config/config.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
function conf($key, $default='') {
|
|
|
|
global $config;
|
|
|
|
if (isset($config[$key]))
|
|
|
|
return $config[$key];
|
|
|
|
return $default;
|
|
|
|
}
|