require_once libfile('function/discuzcode');
 $ppp = 10;
 $start_limit = ($page - 1) * $ppp;
 $modcount = getcountofposts(DB::table('forum_post'), "invisible='{$displayorder}' AND first='0' {$fidadd['and']}{$fidadd['fids']}");
 $multipage = multi($modcount, $ppp, $page, ADMINSCRIPT . "?action=moderate&operation=replies&filter={$filter}&modfid={$modfid}");
 shownav('topic', $lang['moderate_replies']);
 showsubmenu('nav_moderate_posts', array(array('nav_moderate_threads', 'moderate&operation=threads', 0), array('nav_moderate_replies', 'moderate&operation=replies', 1)));
 showformheader("moderate&operation=replies&page={$page}");
 showhiddenfields(array('filter' => $filter, 'modfid' => $modfid));
 showtableheader("{$lang['select']}: <select style=\"margin: 0px;\" onchange=\"if(this.options[this.selectedIndex].value != '') {window.location='" . ADMINSCRIPT . "?action=moderate&operation=replies&modfid={$modfid}&filter='+this.options[this.selectedIndex].value;}\">{$filteroptions}</select> <select style=\"margin: 0px;\" onchange=\"if(this.options[this.selectedIndex].value != '') {window.location='" . ADMINSCRIPT . "?action=moderate&operation=replies&filter={$filter}&modfid='+this.options[this.selectedIndex].value;}\">{$forumoptions}</select>");
 $postarray = getallwithposts(array('select' => 'f.name AS forumname, f.allowsmilies, f.allowhtml, f.allowbbcode, f.allowimgcode, p.pid, p.fid, p.tid, p.author, p.authorid, p.subject, p.dateline, p.message, p.useip, p.attachment, p.htmlon, p.smileyoff, p.bbcodeoff, t.subject AS tsubject', 'from' => DB::table('forum_post') . " p LEFT JOIN " . DB::table('forum_thread') . " t ON t.tid=p.tid LEFT JOIN " . DB::table('forum_forum') . " f ON f.fid=p.fid", 'where' => "p.invisible='{$displayorder}' AND p.first='0' {$fidadd['and']}{$fidadd['p']}{$fidadd['fids']}", 'order' => "p.dateline DESC", 'limit' => "{$start_limit}, {$ppp}"));
 foreach ($postarray as $post) {
     $post['dateline'] = dgmdate($post['dateline']);
     $post['subject'] = $post['subject'] ? '<b>' . $post['subject'] . '</b>' : '<i>' . $lang['nosubject'] . '</i>';
     $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $post['allowsmilies'], $post['allowbbcode'], $post['allowimgcode'], $post['allowhtml']);
     $post['modthreadkey'] = modthreadkey($post['tid']);
     if ($post['attachment']) {
         require_once libfile('function/attachment');
         $queryattach = DB::query("SELECT aid, filename, filetype, filesize, attachment, isimage, remote FROM " . DB::table('forum_attachment') . " WHERE pid='{$post['pid']}'");
         while ($attach = DB::fetch($queryattach)) {
             $_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
             $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"" . $_G['setting']['attachurl'] . "/{$attach['attachment']}\" onload=\"if(this.width > 400) {this.resized=true; this.width=400;}\">" : "<a href=\"" . $_G['setting']['attachurl'] . "/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")";
             $post['message'] .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($attach['filename']) . "\t" . $attach['filetype']) . $attach['url'];
         }
     }
     showtablerow("id=\"mod_{$post['pid']}_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array("<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_1\" value=\"validate\" checked=\"checked\" onclick=\"mod_setbg({$post['pid']}, 'validate');\"><label for=\"mod_{$post['pid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_2\" value=\"delete\" onclick=\"mod_setbg({$post['pid']}, 'delete');\"><label for=\"mod_{$post['pid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$post['pid']}, 'ignore');\"><label for=\"mod_{$post['pid']}_3\">{$lang['ignore']}</label></li></ul>", "<h3><a href=\"forum.php?mod=forumdisplay&fid={$post['fid']}\" target=\"_blank\">{$post['forumname']}</a> &raquo; <a href=\"forum.php?mod=viewthread&tid={$post['tid']}&modthreadkey={$post['modthreadkey']}\" target=\"_blank\">{$post['tsubject']}</a> &raquo; <b>{$post['subject']}</b></h3><p><span class=\"bold\">{$lang['author']}:</span> {$post['author']} ({$post['useip']}) &nbsp;&nbsp; <span class=\"bold\">{$lang['time']}:</span> {$post['dateline']}</p>"));
     showtablerow("id=\"mod_{$post['pid']}_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:100px; word-break: break-all;">' . $post[message] . '</div>');
     showtablerow("id=\"mod_{$post['pid']}_row3\"", 'class="threadopt threadtitle" colspan="2"', "<a href=\"forum.php?mod=post&action=edit&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}&page=1&modthreadkey={$post['modthreadkey']}\" target=\"_blank\">" . $lang['moderate_edit_post'] . "</a> &nbsp;&nbsp;|&nbsp;&nbsp; " . $lang['moderate_reasonpm'] . "&nbsp; <input type=\"text\" class=\"txt\" name=\"pm_{$post['pid']}\" id=\"pm_{$post['pid']}\" style=\"margin: 0px;\"> &nbsp; <select style=\"margin: 0px;\" onchange=\"\$('pm_{$post['pid']}').value=this.value\">{$modreasonoptions}</select>");
 }
 showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">' . cplang('moderate_all_validate') . '</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">' . cplang('moderate_all_delete') . '</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">' . cplang('moderate_all_ignore') . '</a>', $multipage);
 showtablefooter();
Exemple #2
0
        @extract($_DSESSION);
        $cachelost .= @(include DISCUZ_ROOT . './forumdata/cache/usergroup_' . intval($groupid) . '.php') ? '' : ' usergroup_' . $groupid;
    }
}
$tpp = intval(empty($_DSESSION['tpp']) ? $topicperpage : $_DSESSION['tpp']);
$ppp = intval(empty($_DSESSION['ppp']) ? $postperpage : $_DSESSION['ppp']);
if (!in_array($adminid, array(1, 2, 3))) {
    $alloweditpost = $alloweditpoll = $allowstickthread = $allowmodpost = $allowdelpost = $allowmassprune = $allowrefund = $allowcensorword = $allowviewip = $allowbanip = $allowedituser = $allowmoduser = $allowbanuser = $allowpostannounce = $allowviewlog = $disablepostctrl = 0;
} elseif (isset($radminid) && $adminid != $radminid && $adminid != $groupid) {
    $cachelost .= @(include DISCUZ_ROOT . './forumdata/cache/admingroup_' . intval($adminid) . '.php') ? '' : ' admingroup_' . $groupid;
}
$page = isset($page) ? max(1, intval($page)) : 1;
$tid = isset($tid) && is_numeric($tid) ? $tid : 0;
$fid = isset($fid) && is_numeric($fid) ? $fid : 0;
$typeid = isset($typeid) ? intval($typeid) : 0;
$modthreadkey = isset($modthreadkey) && $modthreadkey == modthreadkey($tid) ? $modthreadkey : '';
$auditstatuson = $modthreadkey ? true : false;
if (!empty($tid) || !empty($fid)) {
    if (empty($tid)) {
        $forum = $db->fetch_first("SELECT f.fid, f.*, ff.* {$accessadd1} {$modadd1}, f.fid AS fid\r\n\t\t\tFROM {$tablepre}forums f\r\n\t\t\tLEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid {$accessadd2} {$modadd2}\r\n\t\t\tWHERE f.fid='{$fid}'");
    } else {
        $forum = $db->fetch_first("SELECT t.tid, t.closed," . (defined('SQL_ADD_THREAD') ? SQL_ADD_THREAD : '') . " f.*, ff.* {$accessadd1} {$modadd1}, f.fid AS fid\r\n\t\t\tFROM {$tablepre}threads t\r\n\t\t\tINNER JOIN {$tablepre}forums f ON f.fid=t.fid\r\n\t\t\tLEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid {$accessadd2} {$modadd2}\r\n\t\t\tWHERE t.tid='{$tid}'" . ($auditstatuson ? '' : " AND t.displayorder>='0'") . " LIMIT 1");
        $tid = $forum['tid'];
    }
    if ($forum) {
        $fid = $forum['fid'];
        $forum['ismoderator'] = !empty($forum['ismoderator']) || $adminid == 1 || $adminid == 2 ? 1 : 0;
        foreach (array('postcredits', 'replycredits', 'threadtypes', 'threadsorts', 'digestcredits', 'postattachcredits', 'getattachcredits') as $key) {
            $forum[$key] = !empty($forum[$key]) ? unserialize($forum[$key]) : array();
        }
    } else {
require_once libfile('function/post');
require_once libfile('function/discuzcode');
cpheader();
if (!$operation) {
    shownav('topic', 'nav_recyclebin');
    if (!submitcheck('delsubmit') && !submitcheck('undelsubmit')) {
        showsubmenu('nav_recyclebin', array(array('recyclebin_list', 'recyclebin', 1), array('search', 'recyclebin&operation=search', 0), array('clean', 'recyclebin&operation=clean', 0)));
        $lpp = empty($_G['gp_lpp']) ? 10 : $_G['gp_lpp'];
        $start = ($page - 1) * $lpp;
        $start_limit = ($page - 1) * $lpp;
        showformheader('recyclebin');
        showtableheader('recyclebin_list');
        showsubtitle(array('', 'thread', 'recyclebin_list_thread', 'recyclebin_list_author', 'recyclebin_list_status', 'recyclebin_list_lastpost', 'recyclebin_list_operation'));
        $query = DB::query("SELECT f.name AS forumname,t.tid, t.fid, t.authorid, t.author, t.subject, t.views, t.replies, t.dateline, t.lastpost, t.lastposter,\n\t\t\t\t\ttm.uid AS moduid, tm.username AS modusername, tm.dateline AS moddateline, tm.action AS modaction\n\t\t\t\t\tFROM " . DB::table('forum_thread') . " t\n\t\t\t\t\tLEFT JOIN " . DB::table('forum_threadmod') . " tm ON tm.tid=t.tid\n\t\t\t\t\tLEFT JOIN " . DB::table('forum_forum') . " f ON f.fid=t.fid\n\t\t\t\t\tWHERE t.displayorder='-1'\n\t\t\t\t\tGROUP BY t.tid ORDER BY t.dateline DESC LIMIT {$start_limit}, {$lpp}");
        while ($thread = DB::fetch($query)) {
            $thread['modthreadkey'] = modthreadkey($thread['tid']);
            showtablerow('', array('class="td25"', '', '', 'class="td28"', 'class="td28"'), array("<input type=\"checkbox\" class=\"checkbox\" name=\"threadlist[]\" value=\"{$thread['tid']}\">", '<a href="forum.php?mod=viewthread&tid=' . $thread['tid'] . '&modthreadkey=' . $thread['modthreadkey'] . '" target="_blank">' . $thread['subject'] . '</a>', '<a href="forum.php?mod=forumdisplay&fid=' . $thread['fid'] . '" target="_blank">' . $thread['forumname'] . '</a>', '<a href="home.php?mod=space&uid=' . $thread['authorid'] . '" target="_blank">' . $thread['author'] . '</a><br /><em style="font-size:9px;color:#999999;">' . dgmdate($thread['dateline'], 'd') . '</em>', $thread['replies'] . ' / ' . $thread['views'], $thread['lastposter'] . '<br /><em style="font-size:9px;color:#999999;">' . dgmdate($thread['lastpost'], 'd') . '</em>', $thread['modusername'] . '<br /><em style="font-size:9px;color:#999999;">' . dgmdate($thread['moddateline'], 'd') . '</em>'));
        }
        $threadcount = DB::result_first("SELECT count(*) FROM " . DB::table('forum_thread') . " t WHERE t.displayorder='-1'");
        $multipage = multi($threadcount, $lpp, $page, ADMINSCRIPT . "?action=recyclebin&lpp={$lpp}", 0, 3);
        showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'threadlist\')" /><label for="chkall">' . cplang('select_all') . '</label>&nbsp;&nbsp;<input type="submit" class="btn" name="delsubmit" value="' . cplang('recyclebin_delete') . '" />&nbsp;<input type="submit" class="btn" name="undelsubmit" value="' . cplang('recyclebin_undelete') . '" />', $multipage);
        showtablefooter();
        showformfooter();
    } else {
        $threadlist = $_G['gp_threadlist'];
        if (empty($threadlist)) {
            cpmsg('recyclebin_none_selected', 'action=recyclebin', 'error');
        }
        $threadsundel = $threadsdel = 0;
        if (submitcheck('undelsubmit')) {
            $threadsundel = undeletethreads($threadlist);
	This is NOT a freeware, use is subject to license terms

	$Id: redirect.php 16688 2008-11-14 06:41:07Z cnteacher $
*/
define('CURSCRIPT', 'viewthread');
require_once './include/common.inc.php';
if ($goto == 'findpost') {
    $pid = intval($pid);
    $ptid = intval($ptid);
    if ($post = $db->fetch_first("SELECT p.tid, p.dateline, t.special FROM {$tablepre}posts p LEFT JOIN {$tablepre}threads t USING(tid) WHERE p.pid='{$pid}'")) {
        $sqladd = $post['special'] ? "AND first=0" : '';
        $page = ceil($db->result_first("SELECT count(*) FROM {$tablepre}posts WHERE tid='{$post['tid']}' AND dateline<='{$post['dateline']}' {$sqladd}") / $ppp);
        if (!empty($special) && $special == 'trade') {
            dheader("Location: viewthread.php?do=tradeinfo&tid={$post['tid']}&pid={$pid}");
        } else {
            dheader("Location: viewthread.php?tid={$post['tid']}&page={$page}" . (isset($_GET['modthreadkey']) && ($modthreadkey = modthreadkey($post['tid'])) ? "&modthreadkey={$modthreadkey}" : '') . "#pid{$pid}");
        }
    } else {
        $ptid = !empty($ptid) ? intval($ptid) : 0;
        showmessage('post_check', NULL, 'HALTED');
    }
}
$tid = $forum['closed'] < 2 ? $tid : $forum['closed'];
if (empty($tid)) {
    showmessage('thread_nonexistence');
}
if (isset($fid) && empty($forum)) {
    showmessage('forum_nonexistence', NULL, 'HALTED');
}
@(include DISCUZ_ROOT . './forumdata/cache/cache_viewthread.php');
if ($goto == 'lastpost') {
			} else {
				$page = 1;
			}
		}
		if(!empty($special) && $special == 'trade') {
			dheader("Location: viewthread.php?do=tradeinfo&tid=$post[tid]&pid=$pid");
		} else {
			$extra = '';
			if($discuz_uid && empty($postno)) {
				if($db->result_first("SELECT count(*) FROM {$tablepre}favoritethreads WHERE tid='$post[tid]' AND uid='$discuz_uid'")) {
					$db->query("UPDATE {$tablepre}favoritethreads SET newreplies=0 WHERE tid='$post[tid]' AND uid='$discuz_uid'", 'UNBUFFERED');
					$db->query("DELETE FROM {$tablepre}promptmsgs WHERE uid='$discuz_uid' AND typeid='".$prompts['threads']['id']."' AND extraid='$post[tid]'", 'UNBUFFERED');
					$extra = '&fav=yes';
				}
			}
			dheader("Location: viewthread.php?tid=$post[tid]&rpid=$pid$extra&ordertype=$ordertype&page=$page".(isset($_GET['modthreadkey']) && ($modthreadkey=modthreadkey($post['tid'])) ? "&modthreadkey=$modthreadkey": '')."#pid$pid");
		}
	} else {
		$ptid = !empty($ptid) ? intval($ptid) : 0;
		if($ptid) {
			dheader("location: viewthread.php?tid=$ptid");
		}
		showmessage('post_check', NULL, 'HALTED');
	}
}

$tid = $forum['closed'] < 2 ? $tid : $forum['closed'];

if(empty($tid)) {
	showmessage('thread_nonexistence');
}
function loadforum()
{
    global $_G;
    $tid = intval(getgpc('tid'));
    $fid = getgpc('fid');
    if ($fid) {
        $fid = is_numeric($fid) ? intval($fid) : (!empty($_G['setting']['forumfids'][$fid]) ? $_G['setting']['forumfids'][$fid] : 0);
    }
    $modthreadkey = isset($_G['gp_modthreadkey']) && $_G['gp_modthreadkey'] == modthreadkey($tid) ? $_G['gp_modthreadkey'] : '';
    $_G['forum_auditstatuson'] = $modthreadkey ? true : false;
    $accessadd1 = $accessadd2 = $modadd1 = $modadd2 = $metadescription = $hookscriptmessage = '';
    $adminid = $_G['adminid'];
    if ($_G['uid']) {
        if ($_G['member']['accessmasks']) {
            $accessadd1 = ', a.allowview, a.allowpost, a.allowreply, a.allowgetattach, a.allowpostattach, a.allowpostimage';
            $accessadd2 = "LEFT JOIN " . DB::table('forum_access') . " a ON a.uid='{$_G['uid']}' AND a.fid=f.fid";
        }
        if ($adminid == 3) {
            $modadd1 = ', m.uid AS ismoderator';
            $modadd2 = "LEFT JOIN " . DB::table('forum_moderator') . " m ON m.uid='{$_G['uid']}' AND m.fid=f.fid";
        }
    }
    if (!empty($tid) || !empty($fid)) {
        if (empty($tid)) {
            $forum = DB::fetch_first("SELECT f.fid, f.*, ff.* {$accessadd1} {$modadd1}, f.fid AS fid\n\t\t\tFROM " . DB::table('forum_forum') . " f\n\t\t\tLEFT JOIN " . DB::table("forum_forumfield") . " ff ON ff.fid=f.fid {$accessadd2} {$modadd2}\n\t\t\tWHERE f.fid='{$fid}'");
        } else {
            loadcache('threadtableids');
            $threadtableids = array(0);
            if (!empty($_G['cache']['threadtableids'])) {
                $threadtableids = array_merge($threadtableids, $_G['cache']['threadtableids']);
            }
            $archiveid = intval($_REQUEST['archiveid']);
            if (!empty($archiveid) && in_array($archiveid, $threadtableids)) {
                $threadtable = $archiveid ? "forum_thread_{$archiveid}" : 'forum_thread';
                $forum = DB::fetch_first("SELECT t.tid, t.closed," . (defined('SQL_ADD_THREAD') ? SQL_ADD_THREAD : '') . " f.*, ff.* {$accessadd1} {$modadd1}, f.fid AS fid\n\t\t\t\t\tFROM " . DB::table($threadtable) . " t\n\t\t\t\t\tINNER JOIN " . DB::table('forum_forum') . " f ON f.fid=t.fid\n\t\t\t\t\tLEFT JOIN " . DB::table('forum_forumfield') . " ff ON ff.fid=f.fid {$accessadd2} {$modadd2}\n\t\t\t\t\tWHERE t.tid='{$tid}'" . ($_G['forum_auditstatuson'] ? '' : " AND t.displayorder>='0'") . " LIMIT 1");
                $forum['threadtableid'] = $archiveid;
            } else {
                foreach ($threadtableids as $tableid) {
                    $threadtable = $tableid ? "forum_thread_{$tableid}" : 'forum_thread';
                    $forum = DB::fetch_first("SELECT t.tid, t.closed," . (defined('SQL_ADD_THREAD') ? SQL_ADD_THREAD : '') . " f.*, ff.* {$accessadd1} {$modadd1}, f.fid AS fid\n\t\t\t\t\tFROM " . DB::table($threadtable) . " t\n\t\t\t\t\tINNER JOIN " . DB::table('forum_forum') . " f ON f.fid=t.fid\n\t\t\t\t\tLEFT JOIN " . DB::table('forum_forumfield') . " ff ON ff.fid=f.fid {$accessadd2} {$modadd2}\n\t\t\t\t\tWHERE t.tid='{$tid}'" . ($_G['forum_auditstatuson'] ? '' : " AND t.displayorder>='0'") . " LIMIT 1");
                    if (!empty($forum)) {
                        $forum['threadtableid'] = $tableid;
                        break;
                    }
                }
            }
            $tid = $forum['tid'];
        }
        if ($forum) {
            $fid = $forum['fid'];
            $gorup_admingroupids = $_G['setting']['group_admingroupids'] ? unserialize($_G['setting']['group_admingroupids']) : array('1' => '1');
            if ($forum['status'] == 3) {
                if (!empty($forum['moderators'])) {
                    $forum['moderators'] = unserialize($forum['moderators']);
                } else {
                    require_once libfile('function/group');
                    $forum['moderators'] = update_groupmoderators($fid);
                }
                if ($_G['uid'] && $_G['adminid'] != 1) {
                    $forum['ismoderator'] = !empty($forum['moderators'][$_G['uid']]) ? 1 : 0;
                    $_G['adminid'] = 0;
                    if ($forum['ismoderator'] || $gorup_admingroupids[$_G['groupid']]) {
                        $_G['adminid'] = $_G['adminid'] ? $_G['adminid'] : 3;
                        if (!empty($gorup_admingroupids[$_G['groupid']])) {
                            $forum['ismoderator'] = 1;
                            $_G['adminid'] = 2;
                        }
                        $group_userperm = unserialize($_G['setting']['group_userperm']);
                        if (is_array($group_userperm)) {
                            $_G['group'] = array_merge($_G['group'], $group_userperm);
                            $_G['group']['allowmovethread'] = $_G['group']['allowcopythread'] = $_G['group']['allowedittypethread'] = 0;
                        }
                    }
                }
            }
            $forum['ismoderator'] = !empty($forum['ismoderator']) || $adminid == 1 || $adminid == 2 ? 1 : 0;
            foreach (array('postcredits', 'replycredits', 'threadtypes', 'threadsorts', 'digestcredits', 'postattachcredits', 'getattachcredits', 'modrecommend') as $key) {
                $forum[$key] = !empty($forum[$key]) ? unserialize($forum[$key]) : array();
            }
            if ($forum['status'] == 3) {
                $_G['basescript'] = 'group';
                if (empty($forum['level'])) {
                    $levelid = DB::result_first("SELECT levelid FROM " . DB::table('forum_grouplevel') . " WHERE creditshigher<='{$forum['commoncredits']}' AND '{$forum['commoncredits']}'<creditslower LIMIT 1");
                    $forum['level'] = $levelid;
                    DB::query("UPDATE " . DB::table('forum_forum') . " SET level='{$levelid}' WHERE fid='{$fid}'");
                }
                loadcache('grouplevels');
                $grouplevel = $_G['grouplevels'][$forum['level']];
                if (!empty($grouplevel['icon'])) {
                    $valueparse = parse_url($grouplevel['icon']);
                    if (!isset($valueparse['host'])) {
                        $grouplevel['icon'] = $_G['setting']['attachurl'] . 'common/' . $grouplevel['icon'];
                    }
                }
                $group_postpolicy = $grouplevel['postpolicy'];
                if (is_array($group_postpolicy)) {
                    $forum = array_merge($forum, $group_postpolicy);
                }
                $forum['metadescription'] = strip_tags($_G['setting']['group_description']);
                $forum['metakeywords'] = $_G['setting']['group_keywords'];
                if ($_G['uid'] && $_G['group']['grouptype'] != 'system') {
                    $isgroupuser = DB::result_first("SELECT level FROM " . DB::table('forum_groupuser') . " WHERE fid='{$fid}' AND uid='{$_G['uid']}' LIMIT 1");
                    if ($isgroupuser <= 0) {
                        $_G['groupid'] = 7;
                        loadcache('usergroup_7');
                    }
                }
            }
        } else {
            $fid = 0;
        }
    }
    $_G['fid'] = $fid;
    $_G['tid'] = $tid;
    $_G['forum'] =& $forum;
    $_G['current_grouplevel'] =& $grouplevel;
}
                $page = 1;
            }
        }
        if (!empty($special) && $special == 'trade') {
            dheader("Location: forum.php?mod=viewthread&do=tradeinfo&tid={$post['tid']}&pid={$pid}{$authoridurl}{$ordertypeurl}");
        } else {
            /*noteX
            		$extra = '';
            		if($_G['uid'] && empty($postno)) {
            			if(DB::result_first("SELECT count(*) FROM ".DB::table('favoritethreads')." WHERE tid='$post[tid]' AND uid='$_G[uid]'")) {
            				DB::query("UPDATE ".DB::table('favoritethreads')." SET newreplies=0 WHERE tid='$post[tid]' AND uid='$_G[uid]'", 'UNBUFFERED');
            				DB::query("DELETE FROM ".DB::table('promptmsgs')." WHERE uid='$_G[uid]' AND typeid='".$prompts['threads']['id']."' AND extraid='$post[tid]'", 'UNBUFFERED');
            				$extra = '&fav=yes';
            			}
            		}*/
            dheader("Location: forum.php?mod=viewthread&tid={$post['tid']}&rpid={$pid}&page={$page}{$authoridurl}{$ordertypeurl}" . (isset($_G['gp_modthreadkey']) && ($modthreadkey = modthreadkey($post['tid'])) ? "&modthreadkey={$modthreadkey}" : '') . "#pid{$pid}");
        }
    } else {
        $ptid = !empty($ptid) ? intval($ptid) : 0;
        if ($ptid) {
            dheader("location: forum.php?mod=viewthread&tid={$ptid}{$authoridurl}{$ordertypeurl}");
        }
        showmessage('post_check', NULL, array('tid' => $ptid));
    }
}
$_G['tid'] = $_G['forum']['closed'] < 2 || $_G['forum']['status'] == 3 ? $_G['tid'] : $_G['forum']['closed'];
if (empty($_G['tid'])) {
    showmessage('thread_nonexistence');
}
if (isset($_G['fid']) && empty($_G['forum'])) {
    showmessage('forum_nonexistence', NULL);