+ $body = defaults($_REQUEST, 'body', '');
+ $has_attachment = defaults($_REQUEST, 'has_attachment', 0);
+
+ // If we have a speparate attachment, we need to add it to the body.
+ if (!empty($has_attachment)) {
+ $attachment_type = defaults($_REQUEST, 'attachment_type', '');
+ $attachment_title = defaults($_REQUEST, 'attachment_title', '');
+ $attachment_text = defaults($_REQUEST, 'attachment_text', '');
+
+ $attachment_url = hex2bin(defaults($_REQUEST, 'attachment_url', ''));
+ $attachment_img_src = hex2bin(defaults($_REQUEST, 'attachment_img_src', ''));
+
+ $attachment_img_width = defaults($_REQUEST, 'attachment_img_width', 0);
+ $attachment_img_height = defaults($_REQUEST, 'attachment_img_height', 0);
+ $attachment = [
+ 'type' => $attachment_type,
+ 'title' => $attachment_title,
+ 'text' => $attachment_text,
+ 'url' => $attachment_url,
+ ];
+
+ if (!empty($attachment_img_src)) {
+ $attachment['images'] = [
+ 0 => [
+ 'src' => $attachment_img_src,
+ 'width' => $attachment_img_width,
+ 'height' => $attachment_img_height
+ ]
+ ];
+ }
+
+ $att_bbcode = add_page_info_data($attachment);
+ $body .= $att_bbcode;
+ }