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 static__lang($lang) { \SYSTEM\locale::set($lang); }