<?php require_once('includes/requirecompere.inc.php'); require_once('includes/requirepost.inc.php'); require_once('includes/message.inc.php'); require_once('includes/validation.inc.php'); $mb_id_leader=current_mb_id(); $action_invite=TPOST('invite'); $action_status=TPOST('status'); if ($action_invite) { $invitedmembers=TPOST('invitedmembers'); $invitationmessage=TPOST('invitationmessage'); $invitation_list=explode("\n",$invitedmembers); $invitation_list=array_map("trim",$invitation_list); $mb_ids=array(); foreach ($invitation_list as $v) { if (ctype_digit($v)) array_push($mb_ids,$v); } $DBConn->connect(); $mb_ids_invited=db_team_invite_members($DBConn,$mb_id_leader,$mb_ids); $compere=db_load_compere($DBConn,$mb_id_leader); foreach ($mb_ids_invited as $mb_id) { $inviteinfostr=serialize(array('from'=>$mb_id_leader,'to'=>$mb_id)); $vcinfo=validation_generate_code($DBConn,$inviteinfostr); $dataset['sender.cp_name']=$compere['cp_name']; $dataset['invitemessage']=$invitationmessage; $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('teaminvite.email.subject','teaminvite.email.content',$dataset); send_message( $DBConn, 'INVITE', $mb_id_leader, 'COMPERE', $mb_ids, 'COMPERE', $mail['body'], $mail['subject']); } member_refresh_login($DBConn); redirect("qx-cmd-team.manage-op-invite.ok-invitecount-".sizeof($mb_ids_invited).".html"); } else if ($action_status) { $DBConn->connect(); $tm_status=TPOST('tm_status'); foreach ($tm_status as $mb_id=>$status) db_update_team_member($DBConn,$mb_id_leader,$mb_id,$status); redirect("qx-cmd-team.manage.html"); } ?>