<?php require_once('includes/requirepost.inc.php'); require_once('includes/message.inc.php'); $cs_id=TPOST('cs_id'); $lctr_id=TPOST('lctr_id'); $mb_id_to=TPOST('mb_id_to'); $name=TPOST('name'); $email=TPOST('email'); $fh_brief=TPOST('fh_brief'); $fh_text=TPOST('fh_text'); $mb_id_from=current_mb_id(); $lecture=null; $course=null; $DBConn->connect(); if ($lctr_id) { $lecture=db_load_lecture_by_id($DBConn,$lctr_id); if ($lecture) $course=db_load_course_by_id($DBConn,$cs_id); $mb_id_to=$course['mb_id_owner']; } else if ($cs_id) { $course=db_load_course_by_id($DBConn,$cs_id); $mb_id_to=$course['mb_id_owner']; } if (!$mb_id_from && !$mb_id_to) require_once('includes/requirelogin.inc.php'); $_SESSION['reserv.inputcache.domain']='inquiry'; $_SESSION['reserv.inputcache.errorareas']=iif_array4(array( array(!$mb_id_from && !$name,'ERROR-NO-NAME',array(0)), array(!$mb_id_from && !$email,'ERROR-NO-EMAIL',array(0)), array(!$fh_brief,'ERROR-NO-TITLE',array(0)), array(!$fh_text,'ERROR-NO-CONTENT',array(0)) )); if (count_true_entries($_SESSION['reserv.inputcache.errorareas'])>0) { $target_url="qx-cmd-inquiry-op-revise"; if ($cs_id) $target_url.="-cs_id-".$cs_id; if ($lctr_id) $target_url.="-lctr_id-".$lctr_id; if (!$cs_id && !$lctr_id && $mb_id_to) $target_url.="-mb_id_to-".$mb_id_to; $_SESSION['reserv.inputcache.data']=array( 'cs_id'=>$cs_id, 'lctr_id'=>$lctr_id, 'mb_id_to'=>$mb_id_to, 'name'=>$name, 'email'=>$email, 'fh_brief'=>$fh_brief, 'fh_text'=>$fh_text ); $target_url.='.html'; redirect($target_url); } else { $DBConn->begin(true); send_message( $DBConn, 'INQUIRY', $mb_id_from, ($mb_id_from?'MEMBER':'GUEST'), $mb_id_to, 'COMPERE', $fh_text, $fh_brief, array('msg_lctr_id'=>$lctr_id,'msg_cs_id'=>$cs_id), array('sender.name'=>$name,'sender.email'=>$email) ); $DBConn->commit(); redirect("qx-cmd-inquiry.sent.html"); purge_array_by_key_prefix($_SESSION,'reserv.inputcache.'); } ?>