コード例 #1
0
ファイル: thread.php プロジェクト: xiuno/xiunobbs
     // 帖子详情
     // $action == 'seo' 也会跳到此处
 } else {
     // 支持自定义的 SEO URL: http://x.com/xxx-xxx-xxx
     // Rewrite 以后:http://x.com/thread-seo-xxx-xxx-xxxx-xxx.htm
     // index 中如果开启了 rewrite, $tid, $thread 会被初始化!
     $conf['seo_url_rewrite'] and $tid == -1 and exit(header("HTTP/1.1 404 Not Found"));
     if (!$conf['seo_url_rewrite'] || $conf['seo_url_rewrite'] && isset($tid) && $tid == 0) {
         $tid = param(1, 0);
         $thread = thread_read($tid);
         empty($thread) and exit(header("HTTP/1.1 404 Not Found"));
     }
     $fid = $thread['fid'];
     $forum = forum_read($fid);
     empty($forum) and message(3, '板块不存在' . $fid);
     $postlist = post_find_by_tid($tid);
     empty($postlist) and message(4, '帖子不存在');
     empty($postlist[$thread['firstpid']]) and message(-1, '数据有问题。');
     $first = $postlist[$thread['firstpid']];
     unset($postlist[$thread['firstpid']]);
     $header['title'] = $thread['subject'] . '-' . $forum['name'] . '-' . $conf['sitename'];
     // 网站标题
     $header['keywords'] = $header['title'];
     // 关键词
     $keyword = param('keyword');
     // 可能有关键字需要高亮显示
     if ($keyword) {
         $thread['subject'] = post_highlight_keyword($thread['subject'], $keyword);
         //$first['message'] = post_highlight_keyword($first['subject']);
     }
     $allowpost = forum_access_user($fid, $gid, 'allowpost') ? 1 : 0;
コード例 #2
0
ファイル: post.func.php プロジェクト: 994724435/Ride
function post_check_flood($gid, $tid, $message)
{
    global $sid, $uid, $conf;
    if (!$conf['check_flood_on']) {
        return FALSE;
    }
    if ($gid > 0 and $gid < 5) {
        return FALSE;
    }
    $posts = 0;
    $postlist = post_find_by_tid($tid);
    if (empty($postlist)) {
        return FALSE;
    }
    $postlist = array_slice($postlist, -20, 20);
    foreach ($postlist as $post) {
        if ($post['uid'] == $uid || $uid == 0 && $post['sid'] == $sid) {
            $posts++;
            if ($post['message'] == $message) {
                return TRUE;
            }
        }
    }
    if ($posts > $conf['check_flood']['posts']) {
        return TRUE;
    }
    return FALSE;
}