public static function login($username, $password_sha, $password_md5, $locale = NULL, $advancedResult = false, $password_sha_new = NULL) { self::startSession(); $_SESSION[\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL)] = NULL; //Database check if (isset($password_md5)) { $row = \SYSTEM\SQL\SYS_SECURITY_LOGIN_MD5::Q1(array($username, $username, $password_sha, $password_md5)); } else { $row = \SYSTEM\SQL\SYS_SECURITY_LOGIN_SHA1::Q1(array($username, $username, $password_sha)); } if (!$row) { new \SYSTEM\LOG\WARNING("Login Failed, User was not found in db"); return self::FAIL; } //todo: move to da-sense // set password_sha if it is empty or if it length is < 40 -> SHA1 Androidappbugfix if (!$row[\SYSTEM\SQL\system_user::FIELD_PASSWORD_SHA] || strlen($row[\SYSTEM\SQL\system_user::FIELD_PASSWORD_SHA]) < 40) { if ($password_sha_new != NULL) { $pw = $password_sha_new; } else { $pw = $password_sha; } \SYSTEM\SQL\SYS_SECURITY_UPDATE_PW::QQ(array($pw, $row[\SYSTEM\SQL\system_user::FIELD_ID])); $row[\SYSTEM\SQL\system_user::FIELD_PASSWORD_SHA] = $pw; } // set session variables $_SESSION[\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL)] = new User($row[\SYSTEM\SQL\system_user::FIELD_ID], $row[\SYSTEM\SQL\system_user::FIELD_USERNAME], $row[\SYSTEM\SQL\system_user::FIELD_EMAIL], $row[\SYSTEM\SQL\system_user::FIELD_JOINDATE], time(), getenv('REMOTE_ADDR'), 0, NULL, $row[\SYSTEM\SQL\system_user::FIELD_LOCALE], \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL)); if (isset($locale)) { \SYSTEM\locale::set($locale); } \SYSTEM\SQL\SYS_SECURITY_UPDATE_LASTACTIVE::QI(array($row[\SYSTEM\SQL\system_user::FIELD_ID])); return $advancedResult ? $row : self::OK; }
public static function get_adv($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\SQL\SYS_TEXT_GET_ID_ADV::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_adv($id, \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG)); } return $res; }
public static function LANG($param) { return \SYSTEM\locale::isLang($param); }
public static function static__lang($lang) { \SYSTEM\locale::set($lang); }