$context = $forum->get_context(); $draftid = optional_param('draft', 0, PARAM_INT); if ($draftid) { $draft = forum_draft::get_from_id($draftid); if (!$draft->is_reply() || $draft->get_discussion_id() != $discussionid) { print_error('draft_mismatch', 'forumng', $forum->get_url(forum::PARAM_HTML)); } $root = $discussion->get_root_post(); $inreplyto = $root->find_child($draft->get_parent_post_id(), false); if (!$inreplyto || !$inreplyto->can_reply($whynot) || !$discussion->can_view()) { print_error('draft_cannotreply', 'forumng', $forum->get_url(forum::PARAM_HTML), get_string($whynot, 'forumng')); } $inreplyto->force_expand(); $draftplayspaceid = 0; if ($draft->has_attachments()) { $draftplayspaceid = forum::create_attachment_playspace(); $target = forum::get_attachment_playspace_folder($draftplayspaceid); $source = $draft->get_attachment_folder(); foreach ($draft->get_attachment_names() as $name) { forum_utils::copy("{$source}/{$name}", "{$target}/{$name}"); } } } // Check that discussion can be viewed [Handles all other permissions] $discussion->require_view(); // Search form for header $buttontext = $forum->display_search_form(); // Atom header meta tag $feedtype = $forum->get_effective_feed_option(); if ($feedtype == forum::FEEDTYPE_ALL_POSTS) { $atomurl = $discussion->get_feed_url(forum::FEEDFORMAT_ATOM);
<script type="text/javascript"> window.opener.currentform.addattachment("<?php print addslashes_js($name); ?> "); window.close(); </script><?php print_footer('empty'); exit; } else { print $um->get_errors(); } } $playspaceid = optional_param('attachmentplayspace', 0, PARAM_SEQUENCE); if (!$playspaceid) { $playspaceid = forum::create_attachment_playspace($postid ? $post : null); ?> <script type="text/javascript"> window.opener.currentform.attachmentplayspace.value='<?php print $playspaceid; ?> '; </script><?php } $max = get_string('maxsize', '', display_size($um->config->maxbytes)); ?> <form action="addattachment.php" method="post" accept-charset="utf-8" enctype="multipart/form-data"><div class="forumng-addattachment-file"><?php ?> <h1><?php print_string('choosefile', 'forumng');