<?php require_once('includes/requirecompere.inc.php'); require_once('includes/message.inc.php'); require_once('includes/validation.inc.php'); $cs_id=TPOST('cs_id'); $mb_id=current_mb_id(); $action=TPOST('action'); $mb_id_typed=TPOST('mb_id_typed'); $mb_id_selected=TPOST('mb_id_selected'); $DBConn->connect(); $course=db_load_course_by_id($DBConn,$cs_id); if (!$course || $course['mb_id_owner']!=$mb_id) { redirect("./"); return; } if (!$mb_id_selected) $mb_id_selected=array(); $typed_member=db_load_member($DBConn,$mb_id_typed); if ($typed_member) array_push($mb_id_selected,$typed_member['mb_id']); if (!$mb_id_selected) { redirect("qx-cmd-coursecircle.manage-cs_id-".$cs_id.".html"); return; } $DBConn->begin(true); if ($action=='add' && $typed_member['mb_id']) { $inviteinfostr=serialize(array('cs_id'=>$cs_id,'mb_id'=>$typed_member['mb_id'])); $vcinfo=validation_generate_code($DBConn,$inviteinfostr); $compere=db_load_compere($DBConn,$mb_id); $dataset['sender.cp_name']=$compere['cp_name']; $dataset['circle.cs_name']=$course['cs_name']; $dataset['server.name']=$Config->SERVER_DOMAIN; $dataset['invitecode']=base64_encode($inviteinfostr); $dataset['authcode']=base64_encode(serialize($vcinfo)); $dataset['expire.days']=$Config->VALIDATION_LIFE_DAYS; $mail=prepare_email_from_templates('circleinvite.email.subject','circleinvite.email.content',$dataset); send_message( $DBConn, 'INVITE', $mb_id, 'COMPERE', $typed_member['mb_id'], 'MEMBER', $mail['body'], $mail['subject']); redirect("qx-cmd-coursecircle.manage-cs_id-".$cs_id."-op-invite.ok.html"); } else if ($action=='del') { db_delete_circle_member($DBConn,$cs_id,$mb_id_selected); redirect("qx-cmd-coursecircle.manage-cs_id-".$cs_id.".html"); } else redirect("qx-cmd-coursecircle.manage-cs_id-".$cs_id.".html"); $DBConn->commit(); ?>