Deprecate the GetLocale class and replace with ACL\Login locales set

If ACL\Login is used, the loginGetLocale() call should be used to fetch
the locale data set during login

Language\L10n now has new encoding/charset optional parameter 4
If the locale does not have a charset set the defautl charset is UTF-8
unless set via the new parameter or setOverrideEncoding()

Because of the deprecation of the getLocales call the following methods
do no longer need $locales
- Admin\Backend
- Admin\EditBase
- Output\Form\Generate
- Template\SmartyExtend

They all use the new l10n->getLocaleAsArray() call to set all the local
variables

* Admin\EditBase has new parameter "options" to set
- cache_id
- compile_id
which must be passed on the SmartyExtend class init
This commit is contained in:
Clemens Schwaighofer
2023-03-10 13:43:43 +09:00
parent ea503fffe9
commit 90a8c5540f
85 changed files with 2943 additions and 164 deletions

View File

@@ -43,23 +43,46 @@ $log = new CoreLibs\Debug\Logging([
// db connection
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
// login page
$login = new CoreLibs\ACL\Login($db, $log, $session);
$login = new CoreLibs\ACL\Login(
$db,
$log,
$session,
[
'auto_login' => true,
'default_acl_level' => DEFAULT_ACL_LEVEL,
'logout_target' => '',
'site_locale' => SITE_LOCALE,
'site_domain' => SITE_DOMAIN,
'site_encoding' => SITE_ENCODING,
'locale_path' => BASE . INCLUDES . LOCALE,
]
);
// space for setting special debug flags
// $login->log->setLogLevelAll('debug', true);
// lang, path, domain
// pre auto detect language after login
$locale = \CoreLibs\Language\GetLocale::setLocale();
$locale = $login->loginGetLocale();
// set lang and pass to smarty/backend
$l10n = new \CoreLibs\Language\L10n(
$locale['locale'],
$locale['domain'],
$locale['path'],
$locale['encoding']
);
// flush and start
ob_end_flush();
// init smarty and form class
$edit_base = new CoreLibs\Admin\EditBase(DB_CONFIG, $log, $l10n, $locale);
$edit_base = new CoreLibs\Admin\EditBase(
DB_CONFIG,
$log,
$l10n,
[
'default_acl_level' => DEFAULT_ACL_LEVEL,
'cache_id' => CACHE_ID,
'compile_id' => COMPILE_ID
]
);
// creates edit pages and runs actions
$edit_base->editBaseRun(
BASE . INCLUDES . TEMPLATES . CONTENT_PATH,