$token = DataValidator::validate_action_token($_GET['token']); /* * If a valid course id was not given, do not proceed. * (Note: we are not checking $id_course !== false, * since we do not accept as valid a course id set to 0) */ if ($id_course != false) { if ($r_id_user != false && $token !== false) { /* * Handle a subscription request made by a user that has also asked for registration. * To proceed, we have to check that the given token exists for this user and that * the token is valid too. * Additionally we have to check that the user has been correctly registered and * that needs to confirm his/her registration. */ $tokenObj = TokenFinder::findTokenForUserRegistration($r_id_user, $token); if ($tokenObj === false || !$tokenObj->isValid()) { /* * There isn't a token corresponding to input data, do not proceed. */ $message = translateFN('An error occurred while processing your request. Try later'); header('Location: ' . HTTP_ROOT_DIR . '/index.php?message=' . urlencode($message)); exit; } $userObj = MultiPort::findUser($r_id_user); if ($userObj instanceof ADAUser && $userObj->getStatus() == ADA_STATUS_PRESUBSCRIBED) { $isRegistration = TRUE; } else { /* * Wrong type of user or wrong user status. Do not proceed. */
/* * first time here: we show only the password and passwordcheck fields */ /* * Data validation */ $token = DataValidator::validate_action_token($_GET['tok']); $userid = DataValidator::is_uinteger($_GET['uid']); if ($token == false || $userid == false) { /* * Token or userid not valid, do not proceed. */ header('Location: ' . HTTP_ROOT_DIR); exit; } $tokenObj = TokenFinder::findTokenForUserRegistration($userid, $token); if ($tokenObj == false) { /* * There isn't a token corresponding to input data, do not proceed. */ $message = translateFN('Did not find a token that matches your request'); header('Location: ' . HTTP_ROOT_DIR . '/index.php?message=' . urlencode($message)); exit; } $userObj = MultiPort::findUser($userid); if ($userObj instanceof ADAUser) { // se stato != preiscritto mostrare un messaggio adeguato if ($userObj->getStatus() != ADA_STATUS_PRESUBSCRIBED) { $message = translateFN('Forse un utente con questi dati ha giĆ confermato la tua registrazione'); // $message = translateFN('Maybe a user with these data has already confirmed his/her registration to ADA'); header('Location: ' . HTTP_ROOT_DIR . '/index.php?message=' . urlencode($message));