} // Expand parameter always available $params['expand'] = $expand; $mform = new mod_forumng_editpost_form('editpost.php', array('params' => $params, 'isdiscussion' => $isdiscussion, 'forum' => $forum, 'edit' => $edit, 'ispost' => $ispost, 'islock' => $islock, 'post' => isset($post) ? $post : null, 'isroot' => $isroot, 'iframe' => $iframe ? true : false, 'timelimit' => $ispost && $edit && !$post->can_ignore_edit_time_limit() ? $post->get_edit_time_limit() : 0, 'draft' => $draft)); if ($mform->is_cancelled()) { if ($edit) { redirect('discuss.php?' . $post->get_discussion()->get_link_params(mod_forumng::PARAM_PLAIN) . $expandparam); } else { if ($islock || $replytoid) { redirect('discuss.php?' . $discussion->get_link_params(mod_forumng::PARAM_PLAIN) . $expandparam); } else { redirect('view.php?' . $forum->get_link_params(mod_forumng::PARAM_PLAIN)); } } } else { if ($fromform = $mform->get_data()) { // Set up values which might not be defined if ($ispost) { // Blank subject counts as null if (trim($fromform->subject) === '') { $fromform->subject = null; } if (!isset($fromform->mailnow)) { $fromform->mailnow = false; } if (!isset($fromform->setimportant)) { $fromform->setimportant = false; } } if ($isdiscussion) { if (!isset($fromform->timestart)) {