Exemplo n.º 1
0
function locale_negotiate_language($available_language_config, $override_langage)
{
    global $langs, $langmap, $lang;
    $opt_langs = explode('|', $available_language_config);
    $langs = array();
    $langmap = array();
    foreach ($opt_langs as $opt_lang) {
        list($code, $verbose, $locale) = explode(',', $opt_lang);
        $langs[$code] = $verbose;
        $langmap[$code] = $locale;
    }
    if ($override_langage && array_key_exists($override_langage, $langs)) {
        $lang = $override_langage;
    } else {
        $lang = negotiateLanguage($langs);
        # local copy, see further down this file
        if ($lang == 'en-US' || !$lang || !array_key_exists($lang, $langmap)) {
            $lang = 'en-gb';
            # Default override
        }
    }
}
Exemplo n.º 2
0
while ($db->next_record()) {
    $tmp_idlang = $db->f('idlang');
    $sf_lang_stack[$tmp_idlang]['idlang'] = $tmp_idlang;
    $sf_lang_stack[$tmp_idlang]['charset'] = $db->f('charset');
    $sf_lang_stack[$tmp_idlang]['name'] = $db->f('name');
    $sf_lang_stack[$tmp_idlang]['iso_3166_code'] = $db->f('iso_3166_code');
    $sf_lang_stack[$tmp_idlang]['rewrite_key'] = $db->f('rewrite_key');
    $sf_lang_stack[$tmp_idlang]['rewrite_mapping'] = $db->f('rewrite_mapping');
    if ($db->f('is_start') == 1) {
        $lang_global_startlang = $tmp_idlang;
    }
    if (strlen($sf_lang_stack[$tmp_idlang]['iso_3166_code']) >= 2) {
        $langarray[$sf_lang_stack[$tmp_idlang]['iso_3166_code']] = $tmp_idlang;
    }
}
$neg = negotiateLanguage($langarray, 'xx');
if ($neg != 'xx') {
    $startlang = $langarray[$neg];
} else {
    $startlang = $lang_global_startlang;
}
//
// REWRITE
//
if ($_REQUEST['sf_rewrite'] && $cfg_client['url_rewrite'] == '2' && !isset($view)) {
    include_once $cfg_cms['cms_path'] . 'inc/fnc.mod_rewrite.php';
    $sf_rewrite_raw = mysql_escape_string($_REQUEST['sf_rewrite']);
    $sf_rw_pieces = explode('/', $sf_rewrite_raw);
    $_sf_rewrite_session = true;
    if (preg_match('/^[0-9abcdef]{32}$/', $sf_rw_pieces['0'])) {
        $_GET['sid'] = $_GET['sid'] = $_REQUEST['sid'] = $sf_rw_pieces['0'];
Exemplo n.º 3
0
    protected function _initLang($db, $cms_db, $client)
    {
        // Sprache aushandeln
        $sql = 'SELECT
					L.idlang, L.charset, L.name, L.iso_3166_code, L.is_start, L.rewrite_key, L.rewrite_mapping
				FROM
					' . $cms_db['lang'] . ' L
					LEFT JOIN ' . $cms_db['clients_lang'] . ' CL USING(idlang)
				WHERE
					CL.idclient = ' . $client;
        $db->query($sql);
        $langarray = array();
        while ($db->next_record()) {
            $tmp_idlang = $db->f('idlang');
            $sf_lang_stack[$tmp_idlang]['idlang'] = $tmp_idlang;
            $sf_lang_stack[$tmp_idlang]['charset'] = $db->f('charset');
            $sf_lang_stack[$tmp_idlang]['name'] = $db->f('name');
            $sf_lang_stack[$tmp_idlang]['iso_3166_code'] = $db->f('iso_3166_code');
            $sf_lang_stack[$tmp_idlang]['rewrite_key'] = $db->f('rewrite_key');
            $sf_lang_stack[$tmp_idlang]['rewrite_mapping'] = $db->f('rewrite_mapping');
            if ($db->f('is_start') == 1) {
                $lang_global_startlang = $tmp_idlang;
            }
            if (strlen($sf_lang_stack[$tmp_idlang]['iso_3166_code']) >= 2) {
                $langarray[$sf_lang_stack[$tmp_idlang]['iso_3166_code']] = $tmp_idlang;
            }
        }
        $neg = negotiateLanguage($langarray, 'xx');
        if ($neg != 'xx') {
            $startlang = $langarray[$neg];
        } else {
            $startlang = $lang_global_startlang;
        }
        $this->controller_cfg['sf_lang_stack'] = $sf_lang_stack;
        $this->controller_cfg['lang_global_startlang'] = $lang_global_startlang;
        $this->controller_cfg['langarray'] = $langarray;
        $this->controller_cfg['startlang'] = $startlang;
    }