<?php require_once('includes/requirelogin.inc.php'); require_once('includes/message.inc.php'); $msg_id=0+TPOST('msg_id'); $replytitle=TPOST('replytitle'); $replycontent=TPOST('replycontent'); $decision=TPOST('decision'); $mb_id=current_mb_id(); $DBConn->connect(); $msg=db_load_message($DBConn,$msg_id); if (!$msg || $msg['mb_id_to']!=$mb_id) { redirect("qx-cmd-message.list.html"); return; } $errorareas=iif_array4(array( array(!$replytitle,'ERROR-NO-REPLYTITLE',array(0)), array(!$replycontent && !$decision,'ERROR-NO-REPLYCONTENT',array(0)) )); if (count_true_entries($errorareas)>0) { $_SESSION['reserv.inputcache.domain']='message.reply'; $_SESSION['reserv.inputcache.data']=array( 'replytitle'=>$replytitle, 'replycontent'=>$replycontent ); $_SESSION['reserv.inputcache.errorareas']=$errorareas; redirect("qx-cmd-message-op-revise-msg_id-".$msg_id.".html"); } else { $DBConn->begin(true); $msg_type='REPLY'; send_message( $DBConn, $msg_type, $mb_id, $msg['msg_to_as'], $msg['mb_id_from']?$msg['mb_id_from']:NULL, $msg['mb_id_from']?$msg['msg_from_as']:'GUEST', $replycontent, $replytitle, array( 'msg_cs_id'=>$msg['msg_cs_id'], 'msg_lctr_id'=>$msg['msg_lctr_id'], 'msg_st_id'=>$msg['msg_st_id'], 'msg_id_replyto'=>$msg_id ) ); $DBConn->commit(); purge_array_by_key_prefix($_SESSION,'reserv.inputcache.'); redirect("qx-cmd-message-op-reply.ok-msg_id-".$msg_id.".html"); } ?>