function finish($postid, $cloneid, $url, $fromform, $ajaxdata = '', $iframeredirect = false)
{
    global $ajax, $iframe;
    if ($ajax) {
        if ($ajaxdata) {
            // Print AJAX data if specified
            header('Content-Type: text/plain');
            print $ajaxdata;
            exit;
        } else {
            // Default otherwise is to print post
            mod_forumng_post::print_for_ajax_and_exit($postid, $cloneid, array(mod_forumng_post::OPTION_DISCUSSION_SUBJECT => true));
        }
    }
    if ($iframe) {
        if ($iframeredirect) {
            // Still redirect, even though it's in an iframe.
            redirect($url . '&iframe=1');
        } else {
            // Do not redirect, just output new post.
            mod_forumng_post::print_for_iframe_and_exit($postid, $cloneid, array(mod_forumng_post::OPTION_DISCUSSION_SUBJECT => true));
        }
    }
    redirect($url);
}