Пример #1
0
 */
$neededObjAr = array(AMA_TYPE_STUDENT => array('layout'), AMA_TYPE_VISITOR => array('layout'));
require_once ROOT_DIR . '/include/module_init.inc.php';
include_once ROOT_DIR . '/browsing/include/browsing_functions.inc.php';
include_once ROOT_DIR . '/include/services_functions.inc.php';
include_once ROOT_DIR . '/include/services_class.inc.php';
include_once ROOT_DIR . '/include/token_classes.inc.php';
$self = whoami();
$error_page = HTTP_ROOT_DIR . "/index.php";
$isRegistration = FALSE;
// user is asking  for subscription just after registration ?
$isSubscription = FALSE;
// user is already registered ?
$id_course = DataValidator::is_uinteger($_GET['id_course']);
$r_id_user = DataValidator::is_uinteger($_GET['id_user']);
$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);