function thread_check_flood($gid, $fid, $subject)
{
    global $sid, $uid, $conf;
    if (!$conf['check_flood_on']) {
        return FALSE;
    }
    if ($gid > 0 and $gid < 5) {
        return FALSE;
    }
    $threads = 0;
    $threadlist = thread_find_by_fid($fid, 1, 10, 'tid');
    if (empty($threadlist)) {
        return FALSE;
    }
    foreach ($threadlist as $thread) {
        if ($thread['uid'] == $uid || $uid == 0 && $thread['sid'] == $sid) {
            $threads++;
            if ($thread['subject'] == $subject) {
                return TRUE;
            }
        }
    }
    if ($threads > $conf['check_flood']['threads']) {
        return TRUE;
    }
    return FALSE;
}
Example #2
0
<?php

!defined('DEBUG') and exit('Access Denied.');
// 模板初始化依赖
$fid = param(1, 0);
$page = param(2, 1);
$order = param(3);
!in_array($order, array('tid', 'lastpid', 'agrees')) and $order = $conf['order_default'];
// 默认按照顶贴时间排序
$forum = forum_read($fid);
empty($forum) and message(3, '板块不存在' . $fid);
forum_access_user($fid, $gid, 'allowread') or message(-1, '您所在的用户组无权访问该板块。');
$pagesize = $conf['pagesize'];
$pages = pages("forum-{$fid}-{page}-{$order}.htm", $forum['threads'], $page, $pagesize);
$threadlist = thread_find_by_fid($fid, $page, $pagesize, $order);
$onlinelist = online_find_cache($fid);
$header['title'] = $forum['seo_title'] ? $forum['seo_title'] : $forum['name'] . '-' . $conf['sitename'];
// 网站标题
$header['keywords'] = $forum['seo_keywords'];
// 关键词
$header['navs'][] = "<a href=\"forum-{$fid}.htm\">{$forum['name']}</a>";
include './pc/view/forum.htm';