if (strlen($fm_initials) < 2) { display_errorbox("You must enter your initials in order to verify compliance with Senate guidelines."); print_verify_form($fm_sessionid, $fm_msgid, $fm_listids, $fm_segids, $fm_year, $fm_month, $fm_day, $fm_district, $fm_fromaddr, $fm_fromname, $fm_replyaddr, $fm_iscc, $fm_ccemail, $fm_notes, $fm_initials); } else { $dbh = open_db(); $session_rec = db_get_session($dbh, $fm_sessionid); if ($session_rec) { $got_error = false; $username = $session_rec['username']; $reviewer = DEFAULT_REVIEWER; $requserinfo = db_get_user($dbh, $username); $revuserinfo = db_get_user($dbh, $reviewer); if ($requserinfo && $revuserinfo && $requserinfo['email'] && $revuserinfo['email']) { $account_id = $session_rec['account_id']; $account_name = get_account_name($bapi, $account_id); $msg_name = get_message_name($bapi, $fm_msgid); $list_names = get_list_names($bapi, $fm_listids); $seg_names = get_segment_names($bapi, $fm_segids); $req_uuid = generate_request_uuid($account_id); $reqinfo = create_request_info(null, $req_uuid, 0, $username, $reviewer, $fm_sessionid, $account_id, $fm_msgid, $account_name, $msg_name, "{$fm_year}-{$fm_month}-{$fm_day}", $fm_district, $fm_fromaddr, $fm_fromname, $fm_replyaddr, $fm_iscc, $fm_ccemail, null, null, null, null, "AWAITING_REVIEW", $fm_notes, null, $fm_listids, $list_names, $fm_segids, $seg_names, null, null); $rc = db_save_request($dbh, $reqinfo); if ($rc === true) { if (send_request_to_reviewer($reqinfo, $requserinfo, $revuserinfo) == true) { print_send_form($reqinfo); } else { display_errorbox("Your request for approval could not be sent to a reviewer."); $got_error = true; } } else { display_errorbox("Unable to save request parameters; request not sent."); $got_error = true;
function print_confirm_form($bapi, $session_id, $msg_id, $list_ids, $seg_ids, $year, $month, $day, $from_addr, $from_name, $reply_addr, $is_ccuser, $user_email, $cc_email) { // Use API to retrieve messages, lists, and segments for client. if (!$bapi) { return false; } if (empty($list_ids)) { $list_ids = array(); } if (empty($seg_ids)) { $seg_ids = array(); } /**** no need to store CC address in cookie any longer, since the user's e-mail address is now stored in the DB. if ($cc_email == null && !empty($_COOKIE['email'])) { $cc_email = $_COOKIE['email']; } *****/ $list_ids_str = implode(",", $list_ids); $seg_ids_str = implode(",", $seg_ids); $msg_name = get_message_name($bapi, $msg_id); $msg_preview = get_message_preview($bapi, $msg_id); ?> <h2><?php echo HEADER_REQUEST; ?> - Confirmation</h2> <iframe id="message_preview" src="<?php echo $msg_preview; ?> "></iframe> <form method="post" action="<?php echo REQUEST_SCRIPT; ?> "> <input type="hidden" name="fm_stage" value="confirm"/> <input type="hidden" name="fm_sessionid" value="<?php echo $session_id; ?> "/> <input type="hidden" name="fm_msgid" value="<?php echo $msg_id; ?> "/> <?php foreach ($list_ids as $id) { echo "<input type=\"hidden\" name=\"fm_listids[]\" value=\"{$id}\"/>\n"; } foreach ($seg_ids as $id) { echo "<input type=\"hidden\" name=\"fm_segids[]\" value=\"{$id}\"/>\n"; } ?> <!-- old way was comma-separated list <input type="hidden" name="fm_listids[]" value="<?php echo $list_ids_str; ?> "/> <input type="hidden" name="fm_segids[]" value="<?php echo $seg_ids_str; ?> "/> --> <input type="hidden" name="fm_year" value="<?php echo $year; ?> "/> <input type="hidden" name="fm_month" value="<?php echo $month; ?> "/> <input type="hidden" name="fm_day" value="<?php echo $day; ?> "/> <input type="hidden" name="fm_fromaddr" value="<?php echo $from_addr; ?> "/> <input type="hidden" name="fm_fromname" value="<?php echo $from_name; ?> "/> <input type="hidden" name="fm_replyaddr" value="<?php echo $reply_addr; ?> "/> <p> Message to be approved: </p> <p> <b><?php echo $msg_name; ?> </b> </p> <?php print_nonmessage_info($bapi, $list_ids, $seg_ids, "{$year}-{$month}-{$day}", $from_addr, $from_name, $reply_addr); $chk_flag = $is_ccuser == true ? "checked" : ""; ?> <p> <input type="checkbox" name="fm_iscc" value="1" <?php echo $chk_flag; ?> /> Send copy of request e-mail to me (<?php echo $user_email; ?> ) </p> <p> Send an (optional) additional copy to the address below: <br/><input type="text" size="40" name="fm_ccemail" value="<?php echo $cc_email; ?> "/> </p> <input type="submit" value="Verify Content"/> <input type="button" value="Go Back" onclick="history.go(-1)"/> </form> <div style="clear:both"></div> <?php }