Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[整理]全坛置顶+置頂权限限制

[复制链接]
首席路人甲 发表于 2005-6-26 17:41:37 | 显示全部楼层
我是找不到所说的代码
回复

使用道具 举报

首席路人甲 发表于 2005-6-26 17:42:33 | 显示全部楼层

forumdisplay.php内容,哪有啊

<?php

/*
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [DISCUZ!]  Crossday Discuz! Board                                    ::
:: (c) 2001-2005 Comsenz Technology Ltd (www.discuz.com)                ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Author:  Crossday (tech@discuz.com) Cnteacher (cnteacher@discuz.com) ::
:: Version: 2.5F   2004/10/01 05:15                                     ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
*/
//fix:  BY pk0909
/*
1 公告作者连接问题
2 accessmask的问题
*/

define('CURRSCRIPT',  'forumdisplay');

require './include/common.php';
require DISCUZ_ROOT.'./include/forum.php';

$discuz_action = 2;

if(isset($showoldetails)) {
        switch ($showoldetails) {
                case 'no': setcookie('onlinedetail', 0, $timestamp + 86400 * 365, $cookiepath, $cookiedomain); break;
                case 'yes': setcookie('onlinedetail', 1, $timestamp + 86400 * 365, $cookiepath, $cookiedomain); break;
        }
} else {
        $showoldetails = false;
}

if(!$forum['fid'] || $forum['type'] == 'group' || ($adminid<>1 && !$forum[status])) {
        showmessage('forum_nonexistence', NULL, 'HALTED');
}

if($forum['type'] == 'forum') {
        $navigation = "&raquo; $forum[name]";
        $navtitle = ' - '.strip_tags($forum['name']);
} else {
        $forumup = $_DCACHE['forums'][$forum['fup']]['name'];
        $navigation = "&raquo; <a href=\"forumdisplay.php?fid=$forum[fup]\">$forumup</a> &raquo; $forum[name]";
        $navtitle = ' - '.strip_tags($forumup).' - '.strip_tags($forum['name']);
}

if($forum['password'] && $action == 'pwverify') {
        if($pw != $forum['password']) {
                showmessage('forum_passwd_incorrect', NULL, 'HALTED');
        } else {
                setcookie("fidpw$fid", $pw, 0, $cookiepath, $cookiedomain);
                showmessage('forum_passwd_correct', "forumdisplay.php?fid=$fid");
        }
}

if($forum['viewperm'] && !strstr($forum['viewperm'], "\t$groupid\t") && !$forum['allowview']) {
        showmessage('forum_nopermission', NULL, 'NOPERM');
}

if(!empty($forum['password']) && $forum['password'] != $_COOKIE["fidpw$fid"]) {
        include template('forumdisplay_passwd');
        exit();
}
//最近到访论坛 by 凡人
$recentopic = $_COOKIE['recentopic'] ? $_COOKIE['recentopic'] : "\t";
if(!stristr($recentopic, "\t".$forum[name]."\n".$fid."\t")) {
        $recentopic .= "".$forum[name]."\n".$fid."\t";
} else {
  $replacement=explode("\t",$recentopic);
  for($i=1;!empty($replacement[$i]);$i++) {
    if ($replacement[$i] == $forum[name]."\n".$fid) {
    array_splice($replacement,$i,1);
    $recentopic = implode("\t",$replacement);
    $recentopic .= "".$forum[name]."\n".$fid."\t";
    }
  }
}
setcookie('recentopic', $recentopic, $timestamp + 86400 * 7, $cookiepath, $cookiedomain);
$recentopic = explode("\t",$recentopic);
$recentopic = array_reverse($recentopic);
$recentselect = "<select onchange=\"if(this.options[this.selectedIndex].value != '') { window.location=('forumdisplay.php?fid='+this.options[this.selectedIndex].value+'&sid=$sid') }\">";
$recentselect .= "<option value=\"\">最近访问的论坛 ...</option>\n";
for($i=1;!empty($recentopic[$i]);$i++) {
        $rforumid=explode("\n",$recentopic[$i]);
        if($forum[name]!=$rforumid[0]) {
                $recentselect .= "<option value=\"$rforumid[1]\">".$rforumid[0]."</option>\n";
        }
}
$recentselect .= '</select>';
//最近到访论坛 by 凡人 (完毕)

$ismoderator = modcheck($discuz_user);
$moderatedby = moddisplay($forum['moderator'], 'forumdisplay');

$postcredits = $forum['postcredits'] != -1 ? $forum['postcredits'] : $postcredits;
$replycredits = $forum['replycredits'] != -1 ? $forum['replycredits'] : $replycredits;
$postmoney = $forum['postmoney'] != -1 ? $forum['postmoney'] : $postmoney;
$replymoney = $forum['replymoney'] != -1 ? $forum['replymoney'] : $replymoney;
$deletedmoney = $forum['deletedmoney'] != -1 ? $forum['deletedmoney'] : $deletedmoney;
$deletedcredits = $forum['deletedcredits'] != -1 ? $forum['deletedcredits'] : $deletedcredits;

$subexists = 0;
foreach($_DCACHE['forums'] as $sub) {
        if($sub['type'] == 'sub' && $sub['fup'] == $fid && ($accessmasks || !$hideprivate || !$sub['viewperm'] || strstr($sub['viewperm'], "\t$groupid\t") || strstr($sub['users'], "\t$discuz_uid\t"))) {
                $sublist = array();
                $sql = $accessmasks        ? "SELECT f.fid, f.fup, f.type, f.icon, f.name, f.description, f.moderator, f.threads, f.posts, f.lastpost, f.viewperm, a.allowview FROM $table_forums f
                                                LEFT JOIN $table_access a ON a.uid='$discuz_uid' AND a.fid=f.fid
                                                WHERE fup='$fid' AND status='1' AND type='sub' ORDER BY f.displayorder"
                                        : "SELECT fid, fup, type, icon, name, description, moderator, threads, posts, lastpost, viewperm FROM $table_forums WHERE fup='$fid' AND status='1' AND type='sub' ORDER BY displayorder";
                $query = $db->query($sql);
                while($sub = $db->fetch_array($query)) {
                        if(forum($sub)) {
                                $sublist[] = $sub;
                                $subexists = 1;
                        }
                }
                break;
        }
}

$page = intval($page) ? intval($page) : 1;
$start_limit = ($page - 1) * $tpp;

$announcement_list = array();
if($page == 1  && $_DCACHE['announcements_forum']) {
        foreach($_DCACHE['announcements_forum'] as $ann) {
                $ann['authorencode'] = rawurlencode($ann['author']);
                $ann['starttime'] = gmdate("$dateformat $timeformat", $ann['starttime'] + ($timeoffset * 3600));
                $announcement_list[] = $ann ;
        }
}       

$forumdisplayadd = $filteradd = $forum_sort = '';
if (empty($orderby)) {
        $forum_sort = "t.".$forum['threadorder']."";
        $checkshow[$threadorder] = '▼'; $check[$threadorder] = 'selected="selected"';

}else {
        $forumdisplayadd .="&orderby=$orderby";
        switch($orderby) {
                case dateline : $forum_sort = "t.dateline";  break;
                case views : $forum_sort = "t.views"; break;
                case replies : $forum_sort = "t.replies"; break;
                case author : $forum_sort = "t.author"; break;
                case lastpost : $forum_sort = "t.lastpost"; break;
                default: $forum_sort = $forum['threadorder'] ? "t.".$forum['threadorder']."" : $forum_sort = 't.lastpost'; break;
        }
        $checkshow[$orderby] = '▼'; $check[$orderby] = 'selected="selected"';

}
if(!empty($filter)) {
        if(is_numeric($filter)) {
                $forumdisplayadd .= "&filter=$filter";
                $filteradd = "AND lastpost>='".($timestamp - $filter)."'";
        } elseif($filter == 'digest') {
                $forumdisplayadd .= "&filter=digest";
                $filteradd = "AND digest>'0'";
        } elseif($filter == 'noreply') {
                $forumdisplayadd .= "&filter=noreply";
                $filteradd = "AND replies='0'";
        } elseif($filter == 'mythread') {
                $forumdisplayadd .= "&filter=mythread";
                $filteradd = "AND t.authorid=$discuz_uid";
        }
} else {
        $filter = '';
}

$ascdesc == 'ASC' ? $forumdisplayadd .= "&ascdesc=$ascdesc" : $ascdesc = 'DESC';


if($whosonlinestatus == 2 || $whosonlinestatus == 3) {
        $whosonlinestatus = 0;
        $onlineinfo = explode("\t", $onlinerecord);
        $detailstatus = ((!isset($_COOKIE['onlinedetail']) && $onlineinfo[0] < 500) || ($_COOKIE['onlinedetail'] || $showoldetails == 'yes')) && $showoldetails != 'no';

        if($detailstatus) {
                updatesession();
                @include language('actions');

                $whosonline = array();
                $forumname = strip_tags($forum['name']);
                $query = $db->query("SELECT uid, groupid, username, invisible, lastactivity, action FROM $table_sessions WHERE uid>'0' AND fid='$fid' AND invisible='0'");
                if($db->num_rows($query)) {
                        $whosonlinestatus = 1;
                        while($online = $db->fetch_array($query)) {
                                $online['icon'] = isset($_DCACHE['onlinelist'][$online['groupid']]) ? $_DCACHE['onlinelist'][$online['groupid']] : $_DCACHE['onlinelist'][0];
                                $online['action'] = $actioncode[$online['action']];
                                $online['lastactivity'] = gmdate($timeformat, $online['lastactivity'] + ($timeoffset * 3600));
                                $whosonline[] = $online;     
                        }
                }
                unset($online);
        }
} else {
        $whosonlinestatus = 0;
}

if($discuz_uid && $newpm) {
        require DISCUZ_ROOT.'./include/pmprompt.php';
}

if(!empty($filter)) {
        $query = $db->query("SELECT COUNT(*) FROM $table_threads t WHERE t.fid='$fid' AND t.displayorder>='0' $filteradd");
        $threadcount = $db->result($query, 0);
} else {
        $threadcount = $forum['threads'];
}

//仿D4在各版显示今日新帖     
    $todayadd = array();
    $todaypostcheck =mktime(0,0,0);
    $query = $db->query("SELECT p.fid, count(p.pid) as count ,f.fup FROM $table_posts p left join $table_forums f on f.fid=p.fid WHERE p.dateline >='$todaypostcheck' GROUP BY p.fid");
    while($temp = $db->fetch_array($query)) {
        $todayadd[$temp['fid']] = $temp['count'];
        if ($temp['fup']) {
            $todayadd[$temp['fup']] += $temp['count'];
        }
    $todayadd[$forum['fid']] = $todayadd[$temp['fid']];
    }   
    //仿D4在各版显示今日新帖
$multipage = multi($threadcount, $tpp, $page, "forumdisplay.php?fid=$fid$forumdisplayadd");
$showextra = $forumdisplayadd ? rawurlencode(stripslashes($forumdisplayadd)) : '';

$separatepos = 0;
$threadlist = array();
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
$query = $db->query("SELECT  t.*, p.rate FROM $table_threads t USE INDEX(displayorder)
                            LEFT JOIN $table_posts p USING(tid, dateline)
                        WHERE t.fid='$fid' AND t.displayorder>='0' $filteradd
                        ORDER BY t.displayorder DESC, t.lastpost $ascdesc
                        LIMIT $start_limit, $tpp ");

while($thread = $db->fetch_array($query)) {

        $thread['dateline1'] = $thread['dateline'];$thread['icon'] = isset($_DCACHE['icons'][$thread['iconid']]) ? '<img src="'.SMDIR.'/'.$_DCACHE['icons'][$thread['iconid']].'" align="absmiddle">' : '&nbsp;';
        $thread['lastposterenc'] = rawurlencode($thread['lastposter']);

        $postsnum = $thread['replies'] + 1;
        if($postsnum  > $ppp) {
                $pagelinks = '';
                $topicpages = ceil($postsnum / $ppp);
                for ($i = 1; $i <= $topicpages; $i++) {
                        $pagelinks .= "<a href=\"viewthread.php?tid=$thread[tid]&page=$i&extra=page%3D$page$showextra\">$i</a> ";
                        if($i == 6) {
                                $i = $topicpages + 1;
                        }
                }
                if($topicpages > 6) {
                        $pagelinks .= " .. <a href=\"viewthread.php?tid=$thread[tid]&page=$topicpages&extra=page%3D$page$showextra\">$topicpages</a> ";
                }
                $thread['multipage'] = '&nbsp; &nbsp;( <img src="'.IMGDIR.'/multipage.gif" align="absmiddle" boader="0"> '.$pagelinks.')';
        } else {
                $thread['multipage'] = '';
        }

        if($thread['highlight']) {
                $string = sprintf('%02d', $thread['highlight']);
                $stylestr = sprintf('%03b', $string[0]);

                $thread['highlight'] = 'style="';
                $thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
                $thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
                $thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
                $thread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
                $thread['highlight'] .= '"';
        } else {
                $thread['highlight'] = '';
        }

        if($thread['closed']) {
                $thread['new'] = 0;
                if($thread['closed'] > 1) {
                        $thread['moved'] = $thread['tid'];
                        $thread['tid'] = $thread['closed'];
                        $thread['replies'] = '-';
                        $thread['views'] = '-';
                } else {
                        $thread['moved'] = 0;
                }
                $thread['folder'] = 'lock_folder.gif';
        } else {
                $thread['folder'] = 'folder.gif';
                if($lastvisit < $thread['lastpost'] && !strstr($_COOKIE['oldtopics'], "\t$thread[tid]\t")) {
                        $thread['new'] = 1;
                        $thread['folder'] = 'red_'.$thread['folder'];
                } else {
                        $thread['new'] = 0;
                }
                if($thread['replies'] > $thread['views']) {
                        $thread['views'] = $thread['replies'];
                }
                if($thread['replies'] >= $hottopic) {
                        $thread['folder'] = 'hot_'.$thread['folder'];
                }
        }

        if($thread['attachment']) {
                require_once DISCUZ_ROOT.'./include/attachment.php';
                $thread['attachment'] = attachtype($thread['attachment']).' ';
        } else {
                $thread['attachment'] = '';
        }
        $thread[subject] = cutstr($thread[subject],77);
        $thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600);
        $thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);

        if($thread['displayorder'] > 0) {
                $separatepos++;
        }
        $threadlist[] = $thread;

}

$check[$filter] = 'selected="selected"';
$ascdesc == 'ASC' ? $check['asc'] = 'selected="selected"' : $check['desc'] = 'selected="selected"';

$forumselect = $forumjump ? forumselect() : NULL;

$usesigcheck = $signature ? 'checked' : NULL;
$allowpost = (!$forum['postperm'] && $allowpost) || ($forum['postperm'] && strstr($forum['postperm'], "\t$groupid\t")) || $forum['allowpost'];
$rules='';
if($_DCACHE['forums'][$forum['fid']]['rules']!=''){
$rules=$_DCACHE['forums'][$forum['fid']]['rules'];
}
include template('forumdisplay');

?>
回复

使用道具 举报

 楼主| 第┧⑤┟季 发表于 2005-6-26 20:39:56 | 显示全部楼层
应该是这个
  1. $query = $db->query("SELECT COUNT(*) FROM $table_threads t WHERE t.fid='$fid' AND t.displayorder>='0' $filteradd");
复制代码


你决定修改过模板
回复

使用道具 举报

首席路人甲 发表于 2005-6-26 21:18:50 | 显示全部楼层
那其他的呢?也没有啊
回复

使用道具 举报

首席路人甲 发表于 2005-6-26 21:37:59 | 显示全部楼层
谢谢,改好了,不过问一下,能在后台加个控制开关吗?或者给斑竹特定的权限

还有那个2级置顶和1级有什么不一样的?我测试一样啊
回复

使用道具 举报

首席路人甲 发表于 2005-6-30 14:34:53 | 显示全部楼层
谢谢,改好了,不过问一下,能在后台加个控制开关吗?或者给斑竹特定的权限

还有那个2级置顶和1级有什么不一样的?我测试一样啊  

怎么修改超级斑竹也能置顶3
回复

使用道具 举报

xhosa 发表于 2005-6-30 14:44:38 | 显示全部楼层
有简化版吗?
回复

使用道具 举报

8度空间 发表于 2005-6-30 14:49:07 | 显示全部楼层
好帖!虽然之前自己更改了用不着。。
回复

使用道具 举报

首席路人甲 发表于 2005-7-1 18:10:26 | 显示全部楼层
谢谢,改好了,不过问一下,能在后台加个控制开关吗?或者给斑竹特定的权限

还有那个2级置顶和1级有什么不一样的?我测试一样啊  

怎么修改超级斑竹也能置顶3
回复

使用道具 举报

ivyjxb 发表于 2005-7-7 13:14:37 | 显示全部楼层
请问:
topicadmin_topuntop.htm模板
topicadmin_moderate.htm模板

在哪里呀?我ftp上找不到这个文件嘛~
不好意思,我是新手,比较笨的说!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-12-22 20:14 , Processed in 0.028636 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表