} } $data = file_postupdate_standard_editor($data, 'message', $editor_options, $context, 'block_clampmail', $table, $data->id); $DB->update_record('block_clampmail_' . $table, $data); $prepender = $config['prepend_class']; if (!empty($prepender) and !empty($course->{$prepender})) { $subject = "[{$course->{$prepender}}] {$data->subject}"; } else { $subject = $data->subject; } // An instance id is needed before storing the file repository. file_save_draft_area_files($data->attachments, $context->id, 'block_clampmail', 'attachment_' . $table, $data->id); // Send emails if (isset($data->send)) { if ($type == 'drafts') { clampmail::draft_cleanup($typeid); } list($filename, $file, $actual_file) = clampmail::process_attachments($context, $data, $table, $data->id); if (!empty($sigs) and $data->sigid > -1) { $sig = $sigs[$data->sigid]; $signaturetext = file_rewrite_pluginfile_urls($sig->signature, 'pluginfile.php', $context->id, 'block_clampmail', 'signature', $sig->id, $editor_options); $data->message .= $signaturetext; } // Prepare html content of message. $data->message = file_rewrite_pluginfile_urls($data->message, 'pluginfile.php', $context->id, 'block_clampmail', $table, $data->id, $editor_options); // Same user, alternate email. if (!empty($data->alternateid)) { $user = clone $USER; $user->email = $alternates[$data->alternateid]; } else { $user = $USER;
} } $data = file_postupdate_standard_editor($data, 'message', $editor_options, $context, 'block_clampmail', $table, $data->id); $DB->update_record('block_clampmail_' . $table, $data); $prepender = $config['prepend_class']; if (!empty($prepender) and !empty($course->{$prepender})) { $subject = "[{$course->{$prepender}}] {$data->subject}"; } else { $subject = $data->subject; } // An instance id is needed before storing the file repository. file_save_draft_area_files($data->attachments, $context->id, 'block_clampmail', 'attachment_' . $table, $data->id); // Send emails if (isset($data->send)) { if ($type == 'drafts') { clampmail::draft_cleanup($context->id, $typeid); } list($filename, $file, $actual_file) = clampmail::process_attachments($context, $data, $table, $data->id); if (!empty($sigs) and $data->sigid > -1) { $sig = $sigs[$data->sigid]; $signaturetext = file_rewrite_pluginfile_urls($sig->signature, 'pluginfile.php', $context->id, 'block_clampmail', 'signature', $sig->id, $editor_options); $data->message .= $signaturetext; } // Prepare html content of message. $data->message = file_rewrite_pluginfile_urls($data->message, 'pluginfile.php', $context->id, 'block_clampmail', $table, $data->id, $editor_options); // Same user, alternate email. if (!empty($data->alternateid)) { $user = clone $USER; $user->email = $alternates[$data->alternateid]; } else { $user = $USER;