function dc_load_locales() { global $_lang, $core; $_lang = $core->auth->getInfo('user_lang'); $_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $_lang) ? $_lang : 'en'; l10n::lang($_lang); if (l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/date') === false && $_lang != 'en') { l10n::set(dirname(__FILE__) . '/../../locales/en/date'); } l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/main'); l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/public'); l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/plugins'); // Set lexical lang dcUtils::setlexicalLang('admin', $_lang); }
# Licensed under the GPL version 2.0 license. # See LICENSE file or # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html # # -- END LICENSE BLOCK ----------------------------------------- require dirname(__FILE__) . '/../inc/admin/prepend.php'; # If we have a session cookie, go to index.php if (isset($_SESSION['sess_user_id'])) { $core->adminurl->redirect('admin.home'); } # Loading locales for detected language # That's a tricky hack but it works ;) $dlang = http::getAcceptLanguage(); $dlang = $dlang == '' ? 'en' : $dlang; if ($dlang != 'en' && preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $dlang)) { l10n::lang($dlang); l10n::set(dirname(__FILE__) . '/../locales/' . $dlang . '/main'); } $page_url = http::getHost() . $_SERVER['REQUEST_URI']; $change_pwd = $core->auth->allowPassChange() && isset($_POST['new_pwd']) && isset($_POST['new_pwd_c']) && isset($_POST['login_data']); $login_data = !empty($_POST['login_data']) ? html::escapeHTML($_POST['login_data']) : null; $recover = $core->auth->allowPassChange() && !empty($_REQUEST['recover']); $safe_mode = !empty($_REQUEST['safe_mode']); $akey = $core->auth->allowPassChange() && !empty($_GET['akey']) ? $_GET['akey'] : null; $user_id = $user_pwd = $user_key = $user_email = null; $err = $msg = null; # Auto upgrade if (empty($_GET) && empty($_POST)) { require dirname(__FILE__) . '/../inc/dbschema/upgrade.php'; try { if (($changes = dotclearUpgrade($core)) !== false) {
# Loading media try { $core->media = new dcMedia($core); } catch (Exception $e) { } # Creating template context $_ctx = new context(); try { $core->tpl = new dcTemplate(DC_TPL_CACHE, '$core->tpl', $core); } catch (Exception $e) { __error(__('Can\'t create template files.'), $e->getMessage(), 640); } # Loading locales $_lang = $core->blog->settings->system->lang; $_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $_lang) ? $_lang : 'en'; l10n::lang($_lang); if (l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/date') === false && $_lang != 'en') { l10n::set(dirname(__FILE__) . '/../../locales/en/date'); } l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/public'); l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/plugins'); // Set lexical lang dcUtils::setlexicalLang('public', $_lang); # Loading plugins try { $core->plugins->loadModules(DC_PLUGINS_ROOT, 'public', $_lang); } catch (Exception $e) { } # Loading themes $core->themes = new dcThemes($core); $core->themes->loadModules($core->blog->themes_path);
function init_prepend_l10n() { # Loading locales for detected language $dlang = http::getAcceptLanguages(); foreach ($dlang as $l) { if ($l == 'en' || l10n::set(dirname(__FILE__) . '/../locales/' . $l . '/main') !== false) { l10n::lang($l); break; } } }