<?php require_once('includes/requirelogin.inc.php'); require_once('includes/validation.inc.php'); $mb_id=current_mb_id(); $authcode=TGET('authcode'); $invitecode=TGET('invitecode'); $vcinfo=unserialize(base64_decode($authcode)); $inviteinfostr=base64_decode($invitecode); $inviteinfo=unserialize($inviteinfostr); if (!$vcinfo || !$inviteinfo) { redirect("qx-cmd-coursecircle.invite.authenticate.failure.html"); return; } $DBConn->connect(); if (!validation_use_code($DBConn,$vcinfo['vc_id'],$inviteinfostr,$vcinfo['vc_seed'])) { redirect("qx-cmd-coursecircle.invite.authenticate.failure.html"); return; } $course=db_load_course_by_id($DBConn,$inviteinfo['cs_id']); $member=db_load_member($DBConn,$mb_id); $compere=db_load_compere($DBConn,$course['mb_id_owner']); db_join_coursecircle($DBConn,$course['cs_id'],$member['mb_id']); $IDR_fields=db_get_course_info_requests($DBConn,$course['cs_id']); db_add_info_disclose($DBConn,$mb_id,$course['mb_id_owner'],array_projection($IDR_fields,'id_field')); $dataset['joiner.mb_nickname']=$member['mb_nickname']; $dataset['circle.cp_name']=$compere['cp_name']; $dataset['circle.cs_name']=$course['cs_name']; $mail=prepare_email_from_templates('circlejoined.email.subject','circlejoined.email.content',$dataset); $mb_emails=db_load_notifying_emails($DBConn,$course['mb_id_owner']); if ($mb_emails) { $to=array_projection($mb_emails,'mb_email'); if ($to) sendmail($Config->MailerAddress,$to,$mail['subject'],$mail['body']); } redirect("qx-cmd-coursecircle.invite.authenticate.success.html"); ?>