function showsortmodetemplate($sortid, $fid, $sortoptionarray, $templatearray, $threadlist, $threadids = array(), &$verify = array())
{
    global $_G;
    $sorttemplate = $replaces = array();
    $sorttemplate['footer'] = $sorttemplate['body'] = $sorttemplate['header'] = '';
    if (strexists($templatearray[$sortid], '[loop]') && strexists($templatearray[$sortid], '[/loop]')) {
        preg_match('/^(.+?)\\[loop\\](.+?)\\[\\/loop\\](.+?)$/s', $templatearray[$sortid], $r);
        $sorttemplate['header'] = stripslashes($r[1]);
        $templatearray[$sortid] = stripslashes($r[2]);
        $sorttemplate['footer'] = stripslashes($r[3]);
    }
    $rewritespace = is_array($_G['setting']['rewritestatus']) && in_array('home_space', $_G['setting']['rewritestatus']);
    $rewriteviewthread = is_array($_G['setting']['rewritestatus']) && in_array('forum_viewthread', $_G['setting']['rewritestatus']);
    $sortlistarray = showsorttemplate($sortid, $fid, $sortoptionarray, $templatearray, $threadlist, $threadids, true);
    foreach ($threadlist as $thread) {
        foreach ($thread as $k => $v) {
            $replaces['{' . $k . '}'] = $v;
        }
        $body = $sortlistarray['template'][$sortid][$thread['tid']];
        $replaces['{author_url}'] = $rewritespace ? rewriteoutput('home_space', 1, '', $thread['authorid']) : 'home.php?mod=space&uid=' . $thread['authorid'];
        $replaces['{lastposter_url}'] = $rewritespace ? rewriteoutput('home_space', 1, '', '', $thread['lastposter']) : 'home.php?mod=space&username='******'lastposterenc'];
        $replaces['{subject_url}'] = $rewriteviewthread ? rewriteoutput('forum_viewthread', 1, '', $thread['tid']) : 'forum.php?mod=viewthread&tid=' . $thread['tid'];
        $replaces['{lastpost_url}'] = 'forum.php?mod=redirect&tid=' . $thread['tid'] . '&goto=lastpost#lastpost';
        $replaces['{lastpost_url}'] = 'forum.php?mod=redirect&tid=' . $thread['tid'] . '&goto=lastpost#lastpost';
        $sql = "SELECT m.groupid,g.icon FROM " . DB::table('common_member') . " m ," . DB::table('common_usergroup') . " g WHERE m.uid =" . $thread['authorid'] . " and m.groupid=g.groupid LIMIT 0, 1";
        $query = DB::query($sql);
        $vanfon_usergroup = 0;
        while ($result = DB::fetch($query)) {
            $vanfon_usergroup = $result['icon'];
        }
        $replaces['{vanfon_usergroup}'] = $vanfon_usergroup ? '<img src=' . $vanfon_usergroup . ' />' : '<img src=http://static.yylmacro.com/jx3pve/groupicon/LV0.png >';
        $sql = "SELECT c.icon FROM " . DB::table('forum_threadclass') . " c ," . DB::table('forum_thread') . " t WHERE t.tid =" . $thread['tid'] . " and t.typeid=c.typeid LIMIT 0, 1";
        $query = DB::query($sql);
        $vanfon_typeicon = 0;
        while ($result = DB::fetch($query)) {
            $vanfon_typeicon = $result['icon'];
        }
        $replaces['{vanfon_typeicon}'] = $vanfon_typeicon ? $vanfon_typeicon : '';
        $replaces['{avatar_small}'] = avatar($thread['authorid'], 'small', true);
        $replaces['{typename_url}'] = 'forum.php?mod=forumdisplay&fid=' . $fid . '&filter=typeid&typeid=' . $thread['tid'];
        $replaces['{attachment}'] = $thread['attachment'] == 2 ? '<img src="' . STATICURL . 'image/filetype/image_s.gif" align="absmiddle" />' : ($thread['attachment'] == 1 ? '<img src="' . STATICURL . 'image/filetype/common.gif" align="absmiddle" />' : '');
        $replaces['{author_verify}'] = $verify[$thread['authorid']] ? $verify[$thread['authorid']] : '';
        if ($_G['forum']['ismoderator']) {
            if ($thread['fid'] == $fid && $thread['displayorder'] <= 3 || $_G['adminid'] == 1) {
                $replaces['{modcheck}'] = '<input onclick="tmodclick(this)" type="checkbox" name="moderate[]" value="' . $thread['tid'] . '" />';
            } else {
                $replaces['{modcheck}'] = '<input type="checkbox" disabled="disabled" />';
            }
        } else {
            $replaces['{modcheck}'] = '';
        }
        $body = str_replace(array_keys($replaces), $replaces, $body);
        $sorttemplate['body'] .= $body;
    }
    return $sorttemplate;
}
function showsortmodetemplate($sortid, $fid, $sortoptionarray, $templatearray, $threadlist, $threadids = array(), &$verify = array())
{
    global $_G;
    $sorttemplate = $replaces = array();
    $sorttemplate['footer'] = $sorttemplate['body'] = $sorttemplate['header'] = '';
    if (strexists($templatearray[$sortid], '[loop]') && strexists($templatearray[$sortid], '[/loop]')) {
        preg_match('/^(.+?)\\[loop\\](.+?)\\[\\/loop\\](.+?)$/s', $templatearray[$sortid], $r);
        $sorttemplate['header'] = stripslashes($r[1]);
        $templatearray[$sortid] = stripslashes($r[2]);
        $sorttemplate['footer'] = stripslashes($r[3]);
    }
    $rewritespace = is_array($_G['setting']['rewritestatus']) && in_array('home_space', $_G['setting']['rewritestatus']);
    $rewriteviewthread = is_array($_G['setting']['rewritestatus']) && in_array('forum_viewthread', $_G['setting']['rewritestatus']);
    $sortlistarray = showsorttemplate($sortid, $fid, $sortoptionarray, $templatearray, $threadlist, $threadids, true);
    foreach ($threadlist as $thread) {
        foreach ($thread as $k => $v) {
            $replaces['{' . $k . '}'] = $v;
        }
        $body = $sortlistarray['template'][$sortid][$thread['tid']];
        $replaces['{author_url}'] = $rewritespace ? rewriteoutput('home_space', 1, '', $thread['authorid']) : 'home.php?mod=space&amp;uid=' . $thread['authorid'];
        $replaces['{lastposter_url}'] = $rewritespace ? rewriteoutput('home_space', 1, '', '', $thread['lastposter']) : 'home.php?mod=space&amp;username='******'lastposterenc'];
        $replaces['{subject_url}'] = $rewriteviewthread ? rewriteoutput('forum_viewthread', 1, '', $thread['tid']) : 'forum.php?mod=viewthread&amp;tid=' . $thread['tid'];
        $replaces['{lastpost_url}'] = 'forum.php?mod=redirect&tid=' . $thread['tid'] . '&goto=lastpost#lastpost';
        $replaces['{lastpost_url}'] = 'forum.php?mod=redirect&tid=' . $thread['tid'] . '&goto=lastpost#lastpost';
        $replaces['{avatar_small}'] = avatar($thread['authorid'], 'small', true);
        $replaces['{typename_url}'] = 'forum.php?mod=forumdisplay&fid=' . $fid . '&filter=typeid&typeid=' . $thread['tid'];
        $replaces['{attachment}'] = $thread['attachment'] == 2 ? '<img src="' . STATICURL . 'image/filetype/image_s.gif" align="absmiddle" />' : ($thread['attachment'] == 1 ? '<img src="' . STATICURL . 'image/filetype/common.gif" align="absmiddle" />' : '');
        $replaces['{author_verify}'] = $verify[$thread['authorid']] ? $verify[$thread['authorid']] : '';
        if ($_G['forum']['ismoderator']) {
            if ($thread['fid'] == $fid && $thread['displayorder'] <= 3 || $_G['adminid'] == 1) {
                $replaces['{modcheck}'] = '<input onclick="tmodclick(this)" type="checkbox" name="moderate[]" value="' . $thread['tid'] . '" />';
            } else {
                $replaces['{modcheck}'] = '<input type="checkbox" disabled="disabled" />';
            }
        } else {
            $replaces['{modcheck}'] = '';
        }
        $body = str_replace(array_keys($replaces), $replaces, $body);
        $sorttemplate['body'] .= $body;
    }
    return $sorttemplate;
}
Esempio n. 3
0
        }
    }
}
$_G['forum_threadnum'] = count($_G['forum_threadlist']) - $separatepos;
if (!empty($grouptids)) {
    $query = DB::query("SELECT t.tid, t.views, f.name, f.fid FROM " . DB::table('forum_thread') . " t LEFT JOIN " . DB::table('forum_forum') . " f ON f.fid=t.fid WHERE t.tid IN(" . dimplode($grouptids) . ")");
    while ($row = DB::fetch($query)) {
        $groupnames[$row['tid']]['name'] = $row['name'];
        $groupnames[$row['tid']]['fid'] = $row['fid'];
        $groupnames[$row['tid']]['views'] = $row['views'];
    }
}
$stemplate = $sortexpiration = null;
if ($_G['forum']['threadsorts']['types'] && $sortoptionarray && $templatearray) {
    $sortid = intval($_G['gp_sortid']);
    $sortlistarray = showsorttemplate($_G['gp_sortid'], $_G['fid'], $sortoptionarray, $templatearray, $_G['forum_threadlist'], $threadids);
    $stemplate = $sortlistarray['template'];
    $sortexpiration = $sortlistarray['expiration'];
    if (($_G['gp_searchoption'] || $_G['gp_searchsort']) && empty($searchsorttids)) {
        $_G['forum_threadlist'] = $multipage = '';
    }
}
$separatepos = $separatepos ? $separatepos + 1 : 0;
$_G['setting']['visitedforums'] = $_G['setting']['visitedforums'] ? visitedforums() : '';
$oldthreads = array();
$oldtopics = isset($_G['cookie']['oldtopics']) ? $_G['cookie']['oldtopics'] : 'D';
if ($_G['setting']['visitedthreads'] && $oldtopics) {
    $oldtids = array_slice(explode('D', $oldtopics), 0, $_G['setting']['visitedthreads']);
    $oldtidsnew = array();
    foreach ($oldtids as $oldtid) {
        $oldtid && ($oldtidsnew[] = $oldtid);
Esempio n. 4
0
        $recommendlist = recommendsort($sortid, $sortoptionarray, $gid, $rtemplatearray, $districtlist, $modurl);
        $page = $_G['page'];
        $start_limit = ($page - 1) * $_G['tpp'];
        $sortcondition['orderby'] = 'dateline';
        $sortcondition['ascdesc'] = 'DESC';
        $selectadd = array('groupid' => $gid);
        $sortdata = sortsearch($_G['gp_sortid'], $sortoptionarray, $_G['gp_searchoption'], $selectadd, $sortcondition, $start_limit, $_G['tpp']);
        $tidsadd = $sortdata['tids'] ? "tid IN (" . dimplode($sortdata['tids']) . ")" : '';
        $_G['category_threadcount'] = $sortdata['count'];
        $multipage = multi($_G['category_threadcount'], $_G['tpp'], $page, "{$modurl}?mod=usergroup&action=list&sortid={$sortid}&gid={$gid}&cid={$cid}");
        $_G['category_threadlist'] = $sortdata['datalist'];
        $query = DB::query("SELECT * FROM " . DB::table('category_' . $modidentifier . '_thread') . " " . ($tidsadd ? 'WHERE ' . $tidsadd : '') . "");
        while ($thread = DB::fetch($query)) {
            $_G['category_threadlist'][$thread['tid']]['subject'] .= $thread['subject'];
            $_G['category_threadlist'][$thread['tid']]['author'] .= $thread['author'];
            $_G['category_threadlist'][$thread['tid']]['authorid'] .= $thread['authorid'];
        }
        $sortlistarray = showsorttemplate($sortid, $sortoptionarray, $templatearray, $_G['category_threadlist'], $threadids, $arealist, $modurl);
        $stemplate = $sortlistarray['template'];
        $sortexpiration = $sortlistarray['expiration'];
    }
} else {
    $usergrouplist = array();
    $query = DB::query("SELECT * FROM " . DB::table('category_' . $modidentifier . '_usergroup') . " ORDER BY displayorder ");
    while ($group = DB::fetch($query)) {
        $usergrouplist[$group['gid']]['banner'] = $group['banner'] ? $_G['setting']['attachurl'] . 'common/' . $group['banner'] : '';
        $usergrouplist[$group['gid']]['title'] = $group['title'];
        $usergrouplist[$group['gid']]['type'] = $group['type'];
    }
}
include template('diy:category/' . $modidentifier . '_usergroup:' . $gid);