Exemple #1
0
 function _createDBO()
 {
     $JLMS_CONFIG =& JLMSFactory::GetConfig();
     jimport('joomla.database.database');
     //jimport( 'joomla.database.table' );
     $conf =& JFactory::getConfig();
     $driver = $conf->getValue('config.dbtype');
     $debug = $conf->getValue('config.debug');
     require $JLMS_CONFIG->get('forum_path') . '/Settings.php';
     $this->boardurl = $boardurl;
     $this->cookiename = $cookiename;
     $options = array('driver' => $driver, 'host' => $db_server, 'user' => $db_user, 'password' => $db_passwd, 'database' => $db_name, 'prefix' => $db_prefix);
     $this->smf_db =& JDatabase::getInstance($options);
     if (JError::isError($this->smf_db)) {
         jexit('Database Error: ' . $this->smf_db->toString());
     }
     if ($this->smf_db->getErrorNum() > 0) {
         JError::raiseError(500, 'JDatabase::getInstance: Could not connect to database <br />' . 'joomla.library:' . $db->getErrorNum() . ' - ' . $this->smf_db->getErrorMsg());
     }
     $this->smf_db->debug($debug);
 }
function JLMS_processLanguage(&$JLMS_LANGUAGE, $force_utf = false, $client = 'frontend')
{
    $JLMS_CONFIG =& JLMSFactory::GetConfig();
    $do_utf = false;
    $utf_method = '';
    $iso_enc = 'utf-8';
    if (defined('_ISO')) {
        $iso_enc = '';
        $iso = explode('=', _ISO);
        if (isset($iso[1]) && $iso[1]) {
            $iso_enc = $iso[1];
        }
    }
    if ($force_utf) {
        $iso_enc = 'utf-8';
    }
    if ($iso_enc && (strtolower($iso_enc) === 'utf-8' || strtolower($iso_enc) === 'utf8')) {
        $cur_lang = strtolower($JLMS_CONFIG->get('default_language', 'english'));
        if (substr($cur_lang, -4) === '_utf') {
        } else {
            $sup_iso_languages_pre = array('danish', 'french', 'german', 'italian', 'norwegian', 'spanish', 'dutch', 'brazilian');
            $sup_iso_languages = $JLMS_CONFIG->get('iso88591_compat_languages', $sup_iso_languages_pre);
            if (in_array($cur_lang, $sup_iso_languages)) {
                if (function_exists('utf8_encode')) {
                    $do_utf = true;
                    $utf_method = 'utf8_encode';
                }
                if ($cur_lang == 'german' && $client == 'backend') {
                    $utf_method = 'skip_encoding';
                }
            } elseif ($cur_lang == 'russian') {
                $do_utf = true;
                $utf_method = 'cp1251_manual';
            } elseif ($cur_lang == 'bulgarian') {
                $do_utf = true;
                $utf_method = 'cp1251_manual';
            }
        }
    }
    foreach ($JLMS_LANGUAGE as $jl_key => $jl_value) {
        if (!defined($jl_key)) {
            if ($do_utf && $utf_method) {
                if ($utf_method == 'utf8_encode') {
                    $jl_value = utf8_encode($jl_value);
                } elseif ($utf_method == 'cp1251_manual') {
                    $jl_value = JLMS_cp1251_to_utf8($jl_value);
                }
            }
            define($jl_key, $jl_value);
        }
    }
    $isWindows = substr(PHP_OS, 0, 3) == 'WIN';
    if ($isWindows) {
        if (isset($JLMS_LANGUAGE['_JLMS_LOCALE_WIN']) && $JLMS_LANGUAGE['_JLMS_LOCALE_WIN']) {
            setlocale(LC_TIME, $JLMS_LANGUAGE['_JLMS_LOCALE_WIN']);
        }
    } else {
        if (isset($JLMS_LANGUAGE['_JLMS_LOCALE']) && $JLMS_LANGUAGE['_JLMS_LOCALE']) {
            setlocale(LC_TIME, $JLMS_LANGUAGE['_JLMS_LOCALE']);
        }
    }
}