public static function getLoginedUserInformation() { $acl = MDL_ACL::getInstance(); $user_id = $acl->getUser()->getID(); if ($user_id != 0) { try { $user = MDL_User_Detail::getUser($user_id); BFL_Register::setVar('personal', $user); if (isset($user['identity'])) { $acl->setIdentity($user['identity']); } if (isset($user['preference'])) { $preference = BFL_XML::XML2Array($user['preference']); BFL_Register::setVar('user_preference', $preference); } } catch (MDL_Exception_User $e) { if ($e->testDesc(MDL_Exception_User::FIELD_USER, MDL_Exception_User::INVALID_USER_ID)) { $acl->resetSession(); $acl->initialize(SESSION_PREFIX, 'guest'); } else { throw $e; } } } }
public static function validate($user_name, $validation_code) { $user = MDL_User_Detail::getUserByName($user_name); if ($user['identity'] != 'unvalidated' || !isset($user['validation_code'])) { throw new MDL_Exception_User(MDL_Exception_User::UNVALIDATED_USER); } if ($user['validation_code'] == $validation_code) { $user_meta = new MDL_User_Meta($user['user_id']); $user_meta->setVar('identity', 'general'); $user_meta->unsetVar('validation_code'); MDL_User_Auth::logout(); MDL_ACL::getInstance()->setUser(new MDL_User($rs['user_id'])); } }