diff --git a/dbd/qq/SYS_TEXT_GET_ID.php b/dbd/qq/SYS_TEXT_GET_ID.php new file mode 100644 index 0000000..ede1011 --- /dev/null +++ b/dbd/qq/SYS_TEXT_GET_ID.php @@ -0,0 +1,11 @@ + text) + public static function tag($tag, $lang = NULL) { + if($lang == NULL){ + $lang = \SYSTEM\locale::get();} + + if(!\SYSTEM\locale::isLang($lang)){ + throw new \Exception("The requested language is not supported: ".$lang);} + + $result = array(); + $res = \SYSTEM\DBD\SYS_TEXT_GET_TAG::QQ(array($tag,$lang)); + while($row = $res->next()){ + $result[$row['id']] = $row['text'];} + return $result; + } + //return textstring with certain id and lang + public static function get($id, $lang = NULL,$fallback = true) { + if($lang == NULL){ + $lang = \SYSTEM\locale::get();} + + if(!\SYSTEM\locale::isLang($lang)){ + throw new \Exception("The requested language is not supported: ".$lang);} + + $res = \SYSTEM\DBD\SYS_TEXT_GET_ID::Q1(array($id,$lang)); + if($fallback && !$res && $lang != \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG)){ + new \SYSTEM\LOG\WARNING('Text with id: '.$id.' not found for lang: '.$lang.' - fallback to default lang.'); + return self::get($id, \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG));} + return $res ? $res['text'] : ''; + } +} \ No newline at end of file diff --git a/sai/modules/saimod_sys_login/saimod_sys_login.php b/sai/modules/saimod_sys_login/saimod_sys_login.php index 094e235..7c08f80 100644 --- a/sai/modules/saimod_sys_login/saimod_sys_login.php +++ b/sai/modules/saimod_sys_login/saimod_sys_login.php @@ -10,9 +10,9 @@ class saimod_sys_login extends \SYSTEM\SAI\SaiModule { $vars['login_username_too_short'] = 'Username to short.'; $vars['login_password_too_short'] = 'Password to short.'; $vars['isadmin'] = \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI) ? "yes" : "no"; - $vars = array_merge($vars, \SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI), - \SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI_ERROR), - \SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_BASIC)); + $vars = array_merge($vars, + \SYSTEM\PAGE\text::tag('basic'), + \SYSTEM\PAGE\text::tag('sys_sai')); if(\SYSTEM\SECURITY\Security::isLoggedIn()){ return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/tpl/logout.tpl'), $vars); @@ -38,10 +38,8 @@ class saimod_sys_login extends \SYSTEM\SAI\SaiModule { } public static function sai_mod__SYSTEM_SAI_saimod_sys_login_action_registerform(){ - $vars = \SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI); - $vars = array_merge($vars, \SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI), - \SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI_ERROR), - \SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_BASIC)); + $vars = array_merge(\SYSTEM\PAGE\text::tag('basic'), + \SYSTEM\PAGE\text::tag('sys_sai')); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/tpl/register.tpl'), $vars);} public static function html_li_menu(){return '