X-Git-Url: https://git-public.kairo.at/?a=blobdiff_plain;f=app%2Fauthsystem.inc.php;h=17ff7002557bf2ab0efcbe4b31c6a40cd54f42a5;hb=7be13777491767920a76f854c8e8160fe04c4851;hp=372c4db9c19b9c51afd220828a3ff9df4e5175dc;hpb=8b69f29ccce4f236a8954a80c837bcd20987ca53;p=authserver.git diff --git a/app/authsystem.inc.php b/app/authsystem.inc.php index 372c4db..17ff700 100644 --- a/app/authsystem.inc.php +++ b/app/authsystem.inc.php @@ -20,9 +20,9 @@ $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-utils/document.php-class'); +require_once('../php-utility-classes/classes/document.php-class'); // Class for sending emails -require_once('../kairo-utils/email.php-class'); +require_once('../php-utility-classes/classes/email.php-class'); // Class for sending emails require_once(__DIR__.'/authutils.php-class'); @@ -31,13 +31,25 @@ $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('en', 'de')); -putenv('LC_ALL='.$textlocale); +$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); +// Sanitize settings. +$settings['piwik_enabled'] = (@$settings['piwik_enabled']) ? true : false; +$settings['piwik_site_id'] = intval(@$settings['piwik_site_id']); +$settings['piwik_url'] = strlen($settings['piwik_url']) ? $settings['piwik_url'] : '/piwik/'; + /* Creating the DB tables: CREATE TABLE `auth_sessions` ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ,