You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB

<?php
define('OK', 'ok');
define('ERR', 'err');
define('HOST_DEV', 'http://127.0.0.1:8080');
$env = 'prod';
if (getenv('ENV') !== false && in_array(getenv('ENV'), ['prod', 'dev']))
$env = getenv('ENV');
define('ENV', $env);
# 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='') { echo lr($key, $default); }
function lr($key, $default='') {
global $locales;
$parts = explode('.', $key);
if (isset($locales[$parts[0]][$parts[1]]))
return $locales[$parts[0]][$parts[1]];
return $default;
}
# read config
$config = [];
require_once '/config/config.default.php';
if (file_exists('/config/config.php')) {
require_once '/config/config.php';
}
function conf($key, $default='') {
global $config;
global $default_config;
if (isset($config[$key]))
return $config[$key];
if (!empty($default))
return $default;
return $default_config[$key];
}
require_once '/src/base.methods.php';
require_once '/src/base.auth.php';
require_once '/src/base.user.php';