Esempio n. 1
0
 /**
  * Gettext-like interface for the i18n of interface strings.
  *
  * @param string $str string to translate
  * @return string translated version
  */
 public static function _($str)
 {
     return Registry::get('translate')->text($str);
 }
Esempio n. 2
0
 * Sesión.
 */
session_name('goteo');
session_start();
// set Lang
Lang::set();
// change current locale
$locale_name = Lang::locale();
$locale = new Locale($config['locale']);
// avoid Fatal Error if $local_name is empty.
if ($locale_name) {
    $locale->set($locale_name);
} else {
    $locale->set('en_GB');
}
Registry::set('locale', $locale);
// Get URI without query string
$uri = strtok($_SERVER['REQUEST_URI'], '?');
// Get requested segments
$segments = preg_split('!\\s*/+\\s*!', $uri, -1, \PREG_SPLIT_NO_EMPTY);
// Normalize URI
$uri = '/' . implode('/', $segments);
try {
    // Check permissions on requested URI
    if (!ACL::check($uri)) {
        Message::Info(Text::get('user-login-required-access'));
        //si es un cron (ejecutandose) con los parámetros adecuados, no redireccionamos
        if (strpos($uri, 'cron') !== false && strcmp($_GET[md5(CRON_PARAM)], md5(CRON_VALUE)) === 0) {
            define('CRON_EXEC', true);
        } else {
            throw new Redirection("/user/login/?return=" . rawurlencode($uri));