From 5770a31ef82cfff9e824870587717912d3da2ff4 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 11 Jun 2016 00:22:02 +0200 Subject: [PATCH] #3 docu system --- ...ut.php => autoload_exception_shortcut.inc} | 0 ...rtcut.php => autoload_result_shortcut.inc} | 0 system/HEADER.php | 13 +++ system/autoload.php | 61 +++++++------- system/locale.php | 44 ++++++++-- system/qq/SYS_LOCALE_SET_LOCALE.php | 14 ++++ system/system.php | 82 +++++++++++++++---- system/time.php | 37 ++++++++- 8 files changed, 197 insertions(+), 54 deletions(-) rename log/{register_exception_shortcut.php => autoload_exception_shortcut.inc} (100%) rename log/{register_result_shortcut.php => autoload_result_shortcut.inc} (100%) diff --git a/log/register_exception_shortcut.php b/log/autoload_exception_shortcut.inc similarity index 100% rename from log/register_exception_shortcut.php rename to log/autoload_exception_shortcut.inc diff --git a/log/register_result_shortcut.php b/log/autoload_result_shortcut.inc similarity index 100% rename from log/register_result_shortcut.php rename to log/autoload_result_shortcut.inc diff --git a/system/HEADER.php b/system/HEADER.php index 77cd9cf..92ac5ff 100644 --- a/system/HEADER.php +++ b/system/HEADER.php @@ -1,6 +1,19 @@ locale = $lang; - \SYSTEM\SQL\SYS_LOCALE_SET_LOCALE::Q1(array($lang, $user->id)); + if($user->locale != $lang){ + $user->locale = $lang; + \SYSTEM\SQL\SYS_LOCALE_SET_LOCALE::Q1(array($lang, $user->id));} } - return true; } + /** + * Get the Session language + * If no language is saved in the Session it is set to the + * System-Default-Session defined in the config. + * + * @return string Returns Session Language + */ public static function get(){ $value = \SYSTEM\SECURITY\security::load(self::SESSION_KEY); if($value == NULL){ return \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG);} - return $value; } + /** + * Checks Language against languages defined in the config. + * + * @param string $lang Language to be checked + * @return bool Returns true if Language is within the configured Languages + */ public static function isLang($lang){ if(!\in_array($lang, \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS))){ return false;} diff --git a/system/qq/SYS_LOCALE_SET_LOCALE.php b/system/qq/SYS_LOCALE_SET_LOCALE.php index 3894a63..c349e8e 100644 --- a/system/qq/SYS_LOCALE_SET_LOCALE.php +++ b/system/qq/SYS_LOCALE_SET_LOCALE.php @@ -1,5 +1,19 @@