$thread['rate'] = $thread['displayorder'] = $thread['attachment'] = 0;
    $thread['typeid'] = $_GET['threadtypeid'];
    $thread = daddslashes($thread);
    $thread['posttableid'] = 0;
    $threadid = C::t('forum_thread')->insert($thread, true);
    if ($post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid'])) {
        $post['pid'] = '';
        $post['tid'] = $threadid;
        $post['fid'] = $copyto;
        $post['dateline'] = TIMESTAMP;
        $post['attachment'] = 0;
        $post['invisible'] = $post['rate'] = $post['ratetimes'] = 0;
        $post['message'] .= "\n" . lang('forum/thread', 'source') . ": [url=forum.php?mod=viewthread&tid={$sourcetid}]{$thread['subject']}[/url]";
        $post = daddslashes($post);
        $pid = insertpost($post);
    }
    $class_tag = new tag();
    $class_tag->copy_tag($_G['tid'], $threadid, 'tid');
    if ($typeoptionvar) {
        foreach ($typeoptionvar as $key => $value) {
            $value['tid'] = $threadid;
            $value['fid'] = $toforum['fid'];
            C::t('forum_typeoptionvar')->insert($value);
        }
    }
    updatepostcredits('+', $post['authorid'], 'post', $copyto);
    updateforumcount($copyto);
    updateforumcount($_G['fid']);
    $modpostsnum++;
    $resultarray = array('redirect' => "forum.php?mod=forumdisplay&fid={$_G['fid']}", 'reasonpm' => $sendreasonpm ? array('data' => array($thread), 'var' => 'thread', 'item' => 'reason_copy', 'notictype' => 'post') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason, 'threadid' => $threadid), 'modtids' => $thread['tid'], 'modlog' => array($thread, $other));
}