fixing multilingual issues: display languages in native names and fix initialition point of plugins
This commit is contained in:
parent
f9d43d20a3
commit
5c4c11f0b4
@ -400,7 +400,7 @@ function serendipity_login($use_external = true) {
|
|||||||
$user = $serendipity['COOKIE']['author_username'];
|
$user = $serendipity['COOKIE']['author_username'];
|
||||||
$valid_logintoken = serendipity_checkAutologin($user);
|
$valid_logintoken = serendipity_checkAutologin($user);
|
||||||
if ($valid_logintoken === true) {
|
if ($valid_logintoken === true) {
|
||||||
// if we do not tie down the session gere it will be recreated on every page reload, which will fuck op the form token system. That's why we need to load all data that makes the session stick. That's why we call setAuthorToken here.
|
// if we do not tie down the session here it will be recreated on every page reload, which will fuck op the form token system. That's why we need to load all data that makes the session stick. That's why we call setAuthorToken here.
|
||||||
serendipity_setAuthorToken();
|
serendipity_setAuthorToken();
|
||||||
serendipity_load_userdata($user);
|
serendipity_load_userdata($user);
|
||||||
return true;
|
return true;
|
||||||
@ -412,7 +412,7 @@ function serendipity_login($use_external = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data = array('ext' => $use_external, 'mode' => 2, 'user' => $serendipity['POST']['user'], 'pass' => $serendipity['POST']['pass']);
|
$data = array('ext' => $use_external, 'mode' => 2, 'user' => $serendipity['POST']['user'], 'pass' => $serendipity['POST']['pass']);
|
||||||
serendipity_plugin_api::hook_event('backend_loginfail', $data);
|
if ($use_external) serendipity_plugin_api::hook_event('backend_loginfail', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -542,16 +542,12 @@ function serendipity_authenticate_author($username = '', $password = '', $is_has
|
|||||||
|
|
||||||
if ($debug) fwrite($fp, date('Y-m-d H:i') . ' - Login ext check' . "\n");
|
if ($debug) fwrite($fp, date('Y-m-d H:i') . ' - Login ext check' . "\n");
|
||||||
$is_authenticated = false;
|
$is_authenticated = false;
|
||||||
serendipity_plugin_api::hook_event('backend_login', $is_authenticated, NULL);
|
if ($use_external) serendipity_plugin_api::hook_event('backend_login', $is_authenticated, NULL);
|
||||||
if ($is_authenticated) {
|
if ($is_authenticated) return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($debug) fwrite($fp, date('Y-m-d H:i') . ' - Login username check:' . $username . "\n");
|
if ($debug) fwrite($fp, date('Y-m-d H:i') . ' - Login username check:' . $username . "\n");
|
||||||
if (!empty($username) && is_string($username)) {
|
if (!empty($username) && is_string($username)) {
|
||||||
if ($use_external) {
|
if ($use_external) serendipity_plugin_api::hook_event('backend_auth', $is_hashed, array('username' => $username, 'password' => $password));
|
||||||
serendipity_plugin_api::hook_event('backend_auth', $is_hashed, array('username' => $username, 'password' => $password));
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = "SELECT DISTINCT
|
$query = "SELECT DISTINCT
|
||||||
email, password, realname, authorid, userlevel, right_publish, hashtype
|
email, password, realname, authorid, userlevel, right_publish, hashtype
|
||||||
|
@ -32,6 +32,12 @@ if (isset($serendipity['GET']['adminModule']) && $serendipity['GET']['adminModul
|
|||||||
if (!serendipity_userLoggedIn()) {
|
if (!serendipity_userLoggedIn()) {
|
||||||
// Try again to log in, this time with enabled external authentication event hook
|
// Try again to log in, this time with enabled external authentication event hook
|
||||||
serendipity_login(true);
|
serendipity_login(true);
|
||||||
|
if (serendipity_userLoggedIn()) {
|
||||||
|
// login with external authentication - reload page to set language settings correct for user
|
||||||
|
include_once S9Y_INCLUDE_PATH . 'include/functions_routing.inc.php';
|
||||||
|
gotoAdmin();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,42 +156,44 @@ if (!isset($serendipity['dashboardEntriesLimit'])) {
|
|||||||
// Available languages
|
// Available languages
|
||||||
if (!isset($serendipity['languages'])) {
|
if (!isset($serendipity['languages'])) {
|
||||||
$serendipity['languages'] = array('en' => 'English',
|
$serendipity['languages'] = array('en' => 'English',
|
||||||
'de' => 'German',
|
'de' => 'Deutsch',
|
||||||
'da' => 'Danish',
|
'da' => 'Dansk',
|
||||||
'es' => 'Spanish',
|
'es' => 'Español',
|
||||||
'fr' => 'French',
|
'fr' => 'Français',
|
||||||
'fi' => 'Finnish',
|
'fi' => 'Suomalainen',
|
||||||
'cs' => 'Czech (Win-1250)',
|
'cs' => 'čeština (Win-1250)',
|
||||||
'cz' => 'Czech (ISO-8859-2)',
|
'cz' => 'čeština (ISO-8859-2)',
|
||||||
'sk' => 'Slovak',
|
'sk' => 'Slovenský',
|
||||||
'nl' => 'Dutch',
|
'nl' => 'Nederlands',
|
||||||
'is' => 'Icelandic',
|
'is' => 'Íslensku',
|
||||||
'tr' => 'Turkish',
|
'tr' => 'Türk',
|
||||||
'se' => 'Swedish',
|
'se' => 'svenska',
|
||||||
'pt' => 'Portuguese Brazilian',
|
'pt' => 'português brasileiro',
|
||||||
'pt_PT' => 'Portuguese European',
|
'pt_PT' => 'português europeu',
|
||||||
'bg' => 'Bulgarian',
|
'bg' => 'Български',
|
||||||
'hu' => 'Hungarian',
|
'hu' => 'magyar',
|
||||||
'no' => 'Norwegian',
|
'no' => 'norsk',
|
||||||
'pl' => 'Polish',
|
'pl' => 'polski',
|
||||||
'ro' => 'Romanian',
|
'ro' => 'limba română',
|
||||||
'it' => 'Italian',
|
'it' => 'italiano',
|
||||||
'ru' => 'Russian',
|
'ru' => 'Русский язык',
|
||||||
'fa' => 'Persian',
|
'fa' => 'Fārsī',
|
||||||
'tw' => 'Traditional Chinese (Big5)',
|
'tw' => '正體字/繁體字 (Big5)',
|
||||||
'tn' => 'Traditional Chinese (UTF-8)',
|
'tn' => '正體字/繁體字 (UTF-8)',
|
||||||
'zh' => 'Simplified Chinese (GB2312)',
|
'zh' => '简化字 (GB2312)',
|
||||||
'cn' => 'Simplified Chinese (UTF-8)',
|
'cn' => '简化字 (UTF-8)',
|
||||||
'ja' => 'Japanese',
|
'ja' => '日本語',
|
||||||
'ko' => 'Korean',
|
'ko' => '한국어, 조선말',
|
||||||
'sa' => 'Arabic',
|
'sa' => 'العربية',
|
||||||
'ta' => 'Tamil');
|
'ta' => 'தமிழ்');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Available Calendars
|
// Available Calendars
|
||||||
$serendipity['calendars'] = array('gregorian' => 'Gregorian',
|
$serendipity['calendars'] = array('gregorian' => 'Gregorian',
|
||||||
'persian-utf8' => 'Persian (utf8)');
|
'persian-utf8' => 'Persian (utf8)');
|
||||||
// Load main language file
|
// Load main language file
|
||||||
|
// if installed === false language autodetect or 'en', else nothing happens
|
||||||
|
// because serendipity['lang'] is not defined yet
|
||||||
include($serendipity['serendipityPath'] . 'include/lang.inc.php');
|
include($serendipity['serendipityPath'] . 'include/lang.inc.php');
|
||||||
|
|
||||||
$serendipity['charsets'] = array(
|
$serendipity['charsets'] = array(
|
||||||
@ -373,6 +375,9 @@ if (IS_installed === true && php_sapi_name() !== 'cli') {
|
|||||||
|
|
||||||
if (isset($_SESSION['serendipityAuthorid'])) {
|
if (isset($_SESSION['serendipityAuthorid'])) {
|
||||||
serendipity_load_configuration($_SESSION['serendipityAuthorid']);
|
serendipity_load_configuration($_SESSION['serendipityAuthorid']);
|
||||||
|
// load_configuration overwrites $serendipity['lang'], so roll back if another language was detected
|
||||||
|
// in the backend should always the user language be shown
|
||||||
|
// in the frontend logged in same as any other user, exept with fallback to user instead of default
|
||||||
$serendipity['lang'] = serendipity_getPostAuthSessionLanguage();
|
$serendipity['lang'] = serendipity_getPostAuthSessionLanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user