function finish($postid, $cloneid, $url, $fromform, $uploadfolder, $ajaxdata = '')
{
    // Clear out used playspace and/or uploadfolder
    if (isset($fromform->attachmentplayspace)) {
        // Unless we're keeping it, wipe the playspace
        forum::delete_attachment_playspace($fromform->attachmentplayspace, optional_param('keepplayspace', 0, PARAM_INT));
    }
    // Get rid of temporary upload folder
    if ($uploadfolder) {
        remove_dir($uploadfolder);
    }
    global $ajax;
    if ($ajax) {
        if ($ajaxdata) {
            // Print AJAX data if specified
            header('Content-Type: text/plain');
            print $ajaxdata;
            exit;
        } else {
            // Default otherwise is to print post
            forum_post::print_for_ajax_and_exit($postid, $cloneid, array(forum_post::OPTION_DISCUSSION_SUBJECT => true));
        }
    }
    redirect($url);
}
 }
 // Is this the actual delete?
 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
     // Delete counts as edit to a post
     if (class_exists('ouflags')) {
         $DASHBOARD_COUNTER = DASHBOARD_FORUMNG_POST;
     }
     // Delete or undelete the post
     if ($delete) {
         $post->delete();
     } else {
         $post->undelete();
     }
     // Redirect back
     if ($ajax) {
         forum_post::print_for_ajax_and_exit($postid, $cloneid);
     }
     redirect('discuss.php?' . $discussion->get_link_params(forum::PARAM_PLAIN) . '#p' . $post->get_id());
 }
 if (class_exists('ouflags') && ou_get_is_mobile()) {
     ou_mobile_configure_theme();
 }
 // Confirm page. Work out navigation for header
 $pagename = get_string($delete ? 'deletepost' : 'undeletepost', 'forumng', $post->get_effective_subject(true));
 $discussion->print_subpage_header($pagename);
 // Show confirm option
 if ($delete) {
     $confirmstring = get_string('confirmdelete', 'forumng');
     if ($post->is_root_post()) {
         $confirmstring .= ' ' . get_string('confirmdelete_nodiscussion', 'forumng');
     }
<?php

require_once '../../config.php';
require_once 'forum.php';
if (class_exists('ouflags')) {
    $DASHBOARD_COUNTER = DASHBOARD_FORUMNG_AJAX;
}
// Script retrieves content of a single post (plain). Intended for use only
// by AJAX calls.
// Post ID
$postid = required_param('p', PARAM_INT);
$cloneid = optional_param('clone', 0, PARAM_INT);
$raw = optional_param('raw', 0, PARAM_INT);
try {
    // Get post
    $post = forum_post::get_from_id($postid, $cloneid, true, true);
    // Do all access security checks
    $post->require_view();
    // Display post
    if ($raw) {
        print $post->get_json_format();
    } else {
        forum_post::print_for_ajax_and_exit($post);
    }
} catch (forum_exception $e) {
    header('Content-Type: text/plain', true, 500);
    print $e->getMessage();
}