Esempio n. 1
0
if (!file_exists($rootpath . 'lang/' . $lang . '/' . $style . '/')) {
    $style = 'ocstyle';
}
if (!file_exists($rootpath . 'lang/' . $lang . '/' . $style . '/')) {
    die('Critical Error: The specified style does not exist!');
}
//set up the language path
if (!isset($langpath)) {
    $langpath = $rootpath . 'lang/' . $lang;
}
//set up the style path
if (!isset($stylepath)) {
    $stylepath = $langpath . '/' . $style;
}
//load gettext translation
load_gettext();
//open a databse connection
db_connect();
require $opt['rootpath'] . 'lib/auth.inc.php';
require_once $opt['rootpath'] . 'lib2/translate.class.php';
//load language specific strings
require_once $langpath . '/expressions.inc.php';
//set up the defaults for the main template
require_once $stylepath . '/varset.inc.php';
if ($dblink === false) {
    //error while connecting to the database
    $error = true;
    //set up error report
    tpl_set_var('error_msg', htmlspecialchars(mysql_error(), ENT_COMPAT, 'UTF-8'));
    tpl_set_var('tplname', $tplname);
    $tplname = 'error';
Esempio n. 2
0
<?php

defined('BASEPATH') or exit('No direct script access allowed');
/**
 * Auto-detect browser language
 */
load_gettext('auto');
/**
 * Set language
 *
 * @param   string  $language   Values: 'auto' | 'xx_YY' | 'xx_YY.utf8'
 */
function load_gettext($language)
{
    $CI =& get_instance();
    $CI->config->load('language_conf', TRUE);
    $locales_dir = $CI->config->item('locale_dir', 'language_conf');
    $domain = $CI->config->item('domain', 'language_conf');
    if (!$CI->input->is_cli_request()) {
        // Try auto-detection if asked for. Set default language if it fails
        if ($language === 'auto') {
            $CI->load->library('session');
            if ($CI->session->userdata('locale')) {
                $language = $CI->session->userdata('locale');
            } else {
                $language = $CI->lang->autodetect();
                $CI->session->set_userdata('locale', $language);
            }
        }
    }
    if ($language && !in_array($language, $CI->config->item('available_locales', 'language_conf'))) {