$dbmessage["meta"]["edit_user_id"] = $PHORUM["user"]["user_id"]; // perform diff if edit tracking is enabled if (!empty($PHORUM["track_edits"])) { $edit_data = array("diff_body" => $diff_body, "diff_subject" => $diff_subject, "time" => $dbmessage["meta"]["edit_date"], "user_id" => $PHORUM["user"]["user_id"], "message_id" => $dbmessage['message_id']); $PHORUM['DB']->add_message_edit($edit_data); } } // Update attachments in the meta data, link active attachments // to the message and delete stale attachments. $dbmessage["meta"]["attachments"] = array(); foreach ($message["attachments"] as $info) { if ($info["keep"]) { // Because there might be inconsistencies in the list due to going // backward in the browser after deleting attachments, a check is // needed to see if the attachments are really in the database. if (!phorum_api_file_exists($info["file_id"])) { continue; } $dbmessage["meta"]["attachments"][] = array("file_id" => $info["file_id"], "name" => $info["name"], "size" => $info["size"]); $PHORUM['DB']->file_link($info["file_id"], $message["message_id"], PHORUM_LINK_MESSAGE); } else { if (phorum_api_file_check_delete_access($info["file_id"])) { phorum_api_file_delete($info["file_id"]); } } } if (!count($dbmessage["meta"]["attachments"])) { unset($dbmessage["meta"]["attachments"]); } /* * [hook]
} // Put messages on hold in case the forum is moderated. if ($PHORUM["DATA"]["MODERATED"]) { $message["status"] = PHORUM_STATUS_HOLD; } else { $message["status"] = PHORUM_STATUS_APPROVED; } // Create a unique message id. $suffix = preg_replace("/[^a-z0-9]/i", "", $PHORUM["name"]); $message["msgid"] = md5(uniqid(rand())) . ".{$suffix}"; // Add attachments to meta data. Because there might be inconsistencies in // the list due to going backward in the browser after deleting attachments, // a check is needed to see if the attachments are really in the database. $message["meta"]["attachments"] = array(); foreach ($message["attachments"] as $info) { if ($info["keep"] && phorum_api_file_exists($info["file_id"])) { $message["meta"]["attachments"][] = array("file_id" => $info["file_id"], "name" => $info["name"], "size" => $info["size"]); } } if (!count($message["meta"]["attachments"])) { unset($message["meta"]["attachments"]); } /* * [hook] * before_post * * [description] * This hook can be used to change the new message data before storing it in * the database. * * [category]