X-Git-Url: https://git-public.kairo.at/?p=authserver.git;a=blobdiff_plain;f=app%2Fauthsystem.inc.php;h=39e43f00a2f6945ceda991dc532aa17c90ab1f19;hp=17818efe758d995d3eb47660401461f02ec97a02;hb=4e765d998029d80d9fd78ce08671cee3f985438d;hpb=04116cc5dabb951023fb511fda0dc36956d6a84a diff --git a/app/authsystem.inc.php b/app/authsystem.inc.php index 17818ef..39e43f0 100644 --- a/app/authsystem.inc.php +++ b/app/authsystem.inc.php @@ -20,20 +20,31 @@ $settings = json_decode(file_get_contents('/etc/kairo/auth_settings.json'), true if (!is_array($settings)) { trigger_error('Auth settings not found', E_USER_ERROR); } // Extended DOM document class -require_once('../kairo/include/cbsm/util/document.php-class'); +require_once('../php-utility-classes/classes/document.php-class'); // Class for sending emails -require_once('../kairo/include/classes/email.php-class'); +require_once('../php-utility-classes/classes/email.php-class'); // Class for sending emails require_once(__DIR__.'/authutils.php-class'); -bindtextdomain('kairo_auth', 'en'); // XXX: Should negotiate locale. -bind_textdomain_codeset('kairo_auth', 'utf-8'); - // Connect to our MySQL DB $db = new PDO($dbdata['dsn'], $dbdata['username'], $dbdata['password']); // Instantiate auth utils. $utils = new AuthUtils($settings, $db); +// This is an array of locale tags in browser style mapping to unix system locale codes to use with gettext. +$supported_locales = array( + 'en-US' => 'en_US', + 'de' => 'de_DE', +); + +$textdomain = 'kairo_auth'; +$textlocale = $utils->negotiateLocale(array_keys($supported_locales)); +putenv('LC_ALL='.$supported_locales[$textlocale]); +$selectedlocale = setlocale(LC_ALL, $supported_locales[$textlocale]); +bindtextdomain($textdomain, '../locale'); +bind_textdomain_codeset($textdomain, 'utf-8'); +textdomain($textdomain); + /* Creating the DB tables: CREATE TABLE `auth_sessions` ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ,