function getthreadlist($tids, $type, $fids, $sid, $havecover, $withpost, $start = 0, $num = 30)
{
    require_once libfile('function/forum');
    require_once libfile('function/discuzcode');
    global $_G, $block_reply_num, $block_special_data_on, $block_attach_on, $masonry_preread;
    $query = C::t('#singcere_waterfall#dx')->fetch_all_threads($tids, $type, $fids, $sid, $havecover, $withpost, $start, $num);
    $threadlist = $tids = array();
    foreach ($query as $thread) {
        $tids[] = $thread['tid'];
        if ($block_special_data_on && $thread['special']) {
            $thread['sdata'] = getspecialdata($thread['tid'], $thread['special']);
        }
        $thread['coverpath'] = getthreadcover($thread['tid'], $thread['cover']);
        if ($masonry_preread) {
            list($thread['w'], $thread['h']) = getimagesize(($thread['cover'] < 0 ? $thread['coverpath'] : DISCUZ_ROOT . $_G['setting']['attachurl']) . 'forum/' . getthreadcover($thread['tid'], $thread['cover'], 1));
        }
        $thread['collections'] = count(explode("\t", $thread['collection'], -1));
        $thread['forumname'] = $_G['cache']['forums'][$thread['fid']]['name'];
        $thread = procthread($thread);
        $threadlist[$thread[tid]] = $thread;
    }
    if ($block_reply_num > 0) {
        $replies = C::t('#singcere_waterfall#dx')->fetch_all_replies_by_tids($tids, $block_reply_num);
        foreach ($replies as $reply) {
            if (count($threadlist[$reply['tid']]['replylist']) <= $block_reply_num) {
                if ($block_attach_on) {
                    preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $reply['message'], $matchaids);
                    $attachs = parseattach($reply['tid'], $reply['pid'], $matchaids, $reply['message'], $skipaids);
                    $k = $reply['message'] = preg_replace("/\\[attach\\](\\d+)\\[\\/attach\\]/ ", "\$attachs[\\1]", $reply['message']);
                    eval("\$k=\"{$k}\";");
                    $k = discuzcode($k, FALSE, FALSE);
                    $reply['message'] = $k;
                    $reply['message'] = html2txt($reply['message']);
                    $threadlist[$reply['tid']]['replylist'][] = $reply;
                } else {
                    $reply['message'] = discuzcode($reply['message'], false, false);
                    $threadlist[$reply['tid']]['replylist'][] = $reply;
                }
            }
        }
    }
    return $threadlist;
}
Beispiel #2
0
    if ($_G['tpp'] - $stickycount + $start_limit > 0) {
        $query = DB::query("SELECT t.* FROM " . DB::table($threadtable) . " t\r\n\t\t\tWHERE {$fidsql} {$filteradd} AND ({$displayorderadd})\r\n\t\t\tORDER BY displayorder DESC, {$_G['gp_orderby']} {$_G['gp_ascdesc']}\r\n\t\t\tLIMIT " . ($_G['tpp'] - $stickycount + $start_limit));
    } else {
        $query = '';
    }
}
$_G['ppp'] = $_G['forum']['threadcaches'] && !$_G['uid'] ? $_G['setting']['postperpage'] : $_G['ppp'];
$page = $_G['page'];
$todaytime = strtotime(dgmdate(TIMESTAMP, 'Ymd'));
$verify = $verifyuids = $grouptids = array();
while ($querysticky && ($thread = DB::fetch($querysticky)) || $query && ($thread = DB::fetch($query))) {
    if ($_G['forum']['picstyle'] && empty($_G['cookie']['forumdefstyle'])) {
        if ($thread['fid'] != $_G['fid'] && empty($thread['cover'])) {
            continue;
        }
        $thread['coverpath'] = getthreadcover($thread['tid'], $thread['cover']);
        $thread['cover'] = abs($thread['cover']);
    }
    $thread['forumstick'] = in_array($thread['tid'], $forumstickytids);
    $thread['related_group'] = 0;
    if ($_G['forum']['relatedgroup'] && $thread['fid'] != $_G['fid']) {
        if ($thread['closed'] > 1) {
            continue;
        }
        $thread['related_group'] = 1;
        $grouptids[] = $thread['tid'];
    }
    $thread['lastposterenc'] = rawurlencode($thread['lastposter']);
    if ($thread['typeid'] && !empty($_G['forum']['threadtypes']['prefix']) && isset($_G['forum']['threadtypes']['types'][$thread['typeid']])) {
        if ($_G['forum']['threadtypes']['prefix'] == 1) {
            $thread['typehtml'] = '<em>[<a href="forum.php?mod=forumdisplay&fid=' . $_G['fid'] . '&amp;filter=typeid&amp;typeid=' . $thread['typeid'] . '">' . $_G['forum']['threadtypes']['types'][$thread['typeid']] . '</a>]</em>';
Beispiel #3
0
function deletethreadcover($tids)
{
    global $_G;
    loadcache(array('threadtableids', 'posttableids'));
    $threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array(0);
    $deletecover = array();
    foreach ($threadtableids as $tableid) {
        foreach (C::t('forum_thread')->fetch_all_by_tid($tids, 0, 0, $tableid) as $row) {
            if ($row['cover']) {
                $deletecover[$row['tid']] = $row['cover'];
            }
        }
    }
    if ($deletecover) {
        foreach ($deletecover as $tid => $cover) {
            $filename = getthreadcover($tid, 0, 1);
            $remote = $cover < 0 ? 1 : 0;
            dunlink(array('attachment' => $filename, 'remote' => $remote, 'thumb' => 0));
        }
    }
}
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: resourcepush.inc.php 34814 2014-08-07 01:46:48Z nemohou $
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
if ($_G['adminid'] != 1) {
    showmessage('undefined_action');
}
require_once libfile('function/forum');
require_once libfile('function/post');
$thread = get_thread_by_tid($_GET['tid']);
if (!$thread) {
    showmessage('undefined_action');
}
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_GET['tid']);
if ($thread['cover']) {
    $picurl = getthreadcover($thread['tid'], $thread['cover']);
} else {
    $attach = C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $_GET['tid'], 'pid', array($post['pid']), '', true);
    $picurl = '';
    if ($attach) {
        $attach = array_shift($attach);
        $picurl = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/' . $attach['attachment'];
    }
}
$data = array('name' => lang('plugin/wechat', 'resource_thread_push') . ': ' . $thread['subject'], 'data' => array('title' => $thread['subject'], 'pic' => $picurl ? (preg_match('/^http:/', $picurl) ? '' : $_G['siteurl']) . $picurl : '', 'desc' => messagecutstr($post['message'], 0, 120), 'content' => nl2br(messagecutstr($post['message'])), 'url' => $_G['siteurl'] . 'forum.php?mod=viewthread&tid=' . $_GET['tid']));
C::t('#wechat#mobile_wechat_resource')->insert($data);
showmessage('wechat:resource_msg_pushed', '', array(), array('alert' => 'right'));
function deletethreadcover($tids)
{
    global $_G;
    loadcache(array('threadtableids', 'posttableids'));
    $threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array(0);
    $deletecover = array();
    foreach ($threadtableids as $tableid) {
        if (!$tableid) {
            $threadtable = "forum_thread";
        } else {
            $threadtable = "forum_thread_{$tableid}";
        }
        $query = DB::query("SELECT cover, tid FROM " . DB::table($threadtable) . " WHERE tid IN ({$tids})");
        while ($row = DB::fetch($query)) {
            if ($row['cover']) {
                $deletecover[$row['tid']] = $row['cover'];
            }
        }
    }
    if ($deletecover) {
        foreach ($deletecover as $tid => $cover) {
            $filename = getthreadcover($tid, 0, 1);
            $remote = $cover < 0 ? 1 : 0;
            dunlink(array('attachment' => $filename, 'remote' => $remote, 'thumb' => 0));
        }
    }
}
Beispiel #6
0
}
$start = ($pageat - 1) * $pageby;
$limit = $pageby;
$query = C::t('forum_thread')->fetch_all_by_fid_typeid_digest_displayorder(1004, $typeid, null, '=', $start, $limit, $type);
if (!$query) {
    $forumlist['err'] = 2;
    echo json_encode($forumlist);
    exit;
} else {
    $forumlist['err'] = 0;
}
$i = 0;
foreach ($query as $p) {
    $forumlist['thread'][$i]['tid'] = $p['tid'];
    $forumlist['thread'][$i]['subject'] = iconv('gbk', 'utf-8', $p['subject']);
    $forumlist['thread'][$i]['author'] = iconv('gbk', 'utf-8', $p['author']);
    if ($p['typeid'] == 43) {
        $section = 0;
    } elseif ($p['typeid'] == 42) {
        $section = 1;
    } elseif ($p['typeid'] == 44) {
        $section = 2;
    } else {
        $section = 3;
    }
    $forumlist['thread'][$i]['section'] = $section;
    $forumlist['thread'][$i]['replies'] = $p['replies'];
    $forumlist['thread'][$i]['url'] = "http://bbs-test.we54.com/" . getthreadcover($p['tid'], $p['cover']);
    $i++;
}
echo json_encode($forumlist);