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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[插件] 论坛问卷 For 5.0

[复制链接]
闪电 发表于 2007-3-23 07:37:17 | 显示全部楼层
老龙帮我改下forumdisplay.php文件吧,我改了问卷错误,点击问卷出现了发布新帖

  1. <?php

  2. /*
  3.         [Discuz!] (C)2001-2006 Comsenz Inc.
  4.         This is NOT a freeware, use is subject to license terms

  5.         $RCSfile: forumdisplay.php,v $
  6.         $Revision: 1.48.2.1 $
  7.         $Date: 2006/09/01 06:15:00 $
  8. */

  9. define('CURSCRIPT', 'forumdisplay');

  10. require_once './include/common.inc.php';
  11. require_once DISCUZ_ROOT.'./include/forum.func.php';

  12. $discuz_action = 2;

  13. if($forum['redirect']) {
  14.         header("Location: $forum[redirect]");
  15.         exit();
  16. }

  17. if(isset($showoldetails)) {
  18.         switch($showoldetails) {
  19.                 case 'no': dsetcookie('onlineforum', 0, 86400 * 365); break;
  20.                 case 'yes': dsetcookie('onlineforum', 1, 86400 * 365); break;
  21.         }
  22. } else {
  23.         $showoldetails = false;
  24. }

  25. if(!$forum['fid'] || $forum['type'] == 'group') {
  26.         showmessage('forum_nonexistence', NULL, 'HALTED');
  27. }

  28. if($forum['type'] == 'forum') {
  29.         $navigation = "&raquo; $forum[name]";
  30.         $navtitle = strip_tags($forum['name']);
  31. } else {
  32.         $forumup = $_DCACHE['forums'][$forum['fup']]['name'];
  33.         $navigation = "&raquo; <a href="forumdisplay.php?fid=$forum[fup]">$forumup</a> &raquo; $forum[name]";
  34.         $navtitle = strip_tags($forum['name']).' - '.strip_tags($forumup);
  35. }
  36. $navtitle .= ' - ';

  37. if($forum['password'] && $action == 'pwverify') {
  38.         if($pw != $forum['password']) {
  39.                 showmessage('forum_passwd_incorrect', NULL, 'HALTED');
  40.         } else {
  41.                 dsetcookie('fidpw'.$fid, $pw);
  42.                 showmessage('forum_passwd_correct', "forumdisplay.php?fid=$fid");
  43.         }
  44. }

  45. if($forum['rules']) {
  46.         if(empty($_COOKIE['discuz_collapse']) || strpos($_COOKIE['discuz_collapse'], 'rules_'.$forum['fid'].' ') === FALSE) {
  47.                 $rulescollapseimg = 'collapsed_no.gif';
  48.                 $collapserules = '';
  49.         } else {
  50.                 $rulescollapseimg = 'collapsed_yes.gif';
  51.                 $collapserules = 'display: none';
  52.         }
  53.         $forum['rules'] = nl2br($forum['rules']);
  54. }

  55. if($forum['viewperm'] && !forumperm($forum['viewperm']) && !$forum['allowview']) {
  56.         showmessage('forum_nopermission', NULL, 'NOPERM');
  57. }

  58. if(!empty($forum['password']) && $forum['password'] != $_DCOOKIE['fidpw'.$fid]) {
  59.         include template('forumdisplay_passwd');
  60.         exit();
  61. }

  62. $moderatedby = moddisplay($forum['moderators'], 'forumdisplay');

  63. if($forum['autoclose']) {
  64.         $closedby = $forum['autoclose'] > 0 ? 'dateline' : 'lastpost';
  65.         $forum['autoclose'] = abs($forum['autoclose']) * 86400;
  66. }

  67. $subexists = 0;
  68. foreach($_DCACHE['forums'] as $sub) {
  69.         if($sub['type'] == 'sub' && $sub['fup'] == $fid && (!$hideprivate || !$sub['viewperm'] || forumperm($sub['viewperm']) || strstr($sub['users'], "\t$discuz_uid\t"))) {
  70.                 $subexists = 1;
  71.                 $sublist = array();
  72.                 $sql = $accessmasks ? "SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, ff.description, ff.moderators, ff.icon, ff.viewperm, a.allowview FROM {$tablepre}forums f
  73.                                                 LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid
  74.                                                 LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid
  75.                                                 WHERE fup='$fid' AND status='1' AND type='sub' ORDER BY f.displayorder"
  76.                                         : "SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, ff.description, ff.moderators, ff.icon, ff.viewperm FROM {$tablepre}forums f
  77.                                                 LEFT JOIN {$tablepre}forumfields ff USING(fid)
  78.                                                 WHERE f.fup='$fid' AND f.status='1' AND f.type='sub' ORDER BY f.displayorder";
  79.                 $query = $db->query($sql);
  80.                 while($sub = $db->fetch_array($query)) {
  81.                         if(forum($sub)) {
  82.                                 $sub['orderid'] = count($sublist);
  83.                                 $sublist[] = $sub;
  84.                         }
  85.                 }
  86.                 break;
  87.         }
  88. }

  89. if($subexists && $forum['forumcolumns']) {
  90.         $forum['forumcolwidth'] = floor(100 / $forum['forumcolumns']).'%';
  91.         $forum['subscount'] = count($sublist);
  92.         $forum['endrows'] = '';
  93.         if($colspan = $forum['subscount'] % $forum['forumcolumns']) {
  94.                 while(($forum['forumcolumns'] - $colspan) > 0) {
  95.                         $forum['endrows'] .= '<td class="altbg2"></td>';
  96.                         $colspan ++;
  97.                 }
  98.                 $forum['endrows'] .= '</tr>';
  99.         }
  100. }

  101. $page = empty($page) || !ispage($page) || ($threadmaxpages && $page > $threadmaxpages) ? 1 : $page;
  102. $start_limit = ($page - 1) * $tpp;

  103. if($page == 1) {
  104.         if($_DCACHE['announcements_forum']) {
  105.                 $announcement = $_DCACHE['announcements_forum'];
  106.                 $announcement['starttime'] = gmdate($dateformat, $announcement['starttime'] + ($timeoffset * 3600));
  107.         } else {
  108.                 $announcement = NULL;
  109.         }
  110. }

  111. $forumdisplayadd = $filteradd = '';
  112. if(isset($filter)) {
  113.         if($filter == 'digest') {
  114.                 $forumdisplayadd .= '&amp;filter=digest';
  115.                 $filteradd = "AND digest>'0'";
  116.         } elseif($filter == 'type' && $forum['threadtypes']['listable'] && $typeid && isset($forum['threadtypes']['types'][$typeid])) {
  117.                 $forumdisplayadd .= "&amp;filter=type&amp;typeid=$typeid";
  118.                 $filteradd = "AND typeid='$typeid'";
  119.         } elseif(preg_match("/^\d+$/", $filter)) {
  120.                 $forumdisplayadd .= "&amp;filter=$filter";
  121.                 $filteradd = $filter ? "AND lastpost>='".($timestamp - $filter)."'" : '';
  122.         } elseif($filter == 'poll') {
  123.                 $forumdisplayadd .= "&amp;filter=$filter";
  124.                 $filteradd = 'AND special = 1';
  125.         } elseif($filter == 'trade') {
  126.                 $forumdisplayadd .= "&amp;filter=$filter";
  127.                 $filteradd = 'AND special = 2';
  128.         } elseif($filter == 'reward') {
  129.                 $forumdisplayadd .= "&amp;filter=$filter";
  130.                 $filteradd = 'AND special = 3';
  131.         } elseif($filter == 'activity') {
  132.                 $forumdisplayadd .= "&amp;filter=$filter";
  133.                 $filteradd = 'AND special = 4';
  134.         } else {
  135.                 $filter = '';
  136.         }
  137. } else {
  138.         $filter = '';
  139. }

  140. isset($orderby) && in_array($orderby, array('dateline', 'replies', 'views')) ? $forumdisplayadd .= "&amp;orderby=$orderby" : $orderby = 'lastpost';
  141. isset($ascdesc) && $ascdesc == 'ASC' ? $forumdisplayadd .= '&amp;ascdesc=ASC' : $ascdesc = 'DESC';

  142. $dotadd1 = $dotadd2 = '';
  143. if($dotfolders && $discuz_uid) {
  144.         $dotadd1 = 'DISTINCT p.authorid AS dotauthor, ';
  145.         $dotadd2 = "LEFT JOIN {$tablepre}posts p ON (t.tid=p.tid AND p.authorid='$discuz_uid')";
  146. }

  147. if($whosonlinestatus == 2 || $whosonlinestatus == 3) {
  148.         $whosonlinestatus = 1;
  149.         $onlineinfo = explode("\t", $onlinerecord);
  150.         $detailstatus = ((!isset($_DCOOKIE['onlineforum']) && $onlineinfo[0] < 500) || (!empty($_DCOOKIE['onlineforum']) || $showoldetails == 'yes')) && $showoldetails != 'no';

  151.         if($detailstatus) {
  152.                 updatesession();
  153.                 @include language('actions');
  154.                 $whosonline = array();
  155.                 $forumname = strip_tags($forum['name']);
  156.                 $guestwhere = isset($_DCACHE['onlinelist'][7]) ? '' : "uid>'0' AND";

  157.                 $query = $db->query("SELECT uid, groupid, username, invisible, lastactivity, action FROM {$tablepre}sessions WHERE $guestwhere fid='$fid' AND invisible='0'");
  158.                 if($db->num_rows($query)) {
  159.                         $whosonlinestatus = 1;
  160.                         while($online = $db->fetch_array($query)) {
  161.                                 if($online['uid']) {
  162.                                         $online['icon'] = isset($_DCACHE['onlinelist'][$online['groupid']]) ? $_DCACHE['onlinelist'][$online['groupid']] : $_DCACHE['onlinelist'][0];
  163.                                         $online['action'] = $actioncode[$online['action']];
  164.                                         $online['lastactivity'] = gmdate($timeformat, $online['lastactivity'] + ($timeoffset * 3600));
  165.                                         $whosonline[] = $online;
  166.                                 } else {
  167.                                         if(isset($_DCACHE['onlinelist'][7])) {
  168.                                                 $online['icon'] = $_DCACHE['onlinelist'][7];
  169.                                                 $online['username'] = 'Guest';
  170.                                                 $online['fid'] = $online['fid'] ? $forumname[$online['fid']] : 0;
  171.                                                 $online['action'] = $actioncode[$online['action']];
  172.                                                 $online['lastactivity'] = gmdate($timeformat, $online['lastactivity'] + ($timeoffset * 3600));
  173.                                                 $whosonline[] = $online;
  174.                                         }
  175.                                 }
  176.                         }
  177.                 }
  178.                 unset($online);
  179.         }
  180. } else {
  181.         $whosonlinestatus = 0;
  182. }

  183. if($discuz_uid && $newpm) {
  184.         require_once DISCUZ_ROOT.'./include/pmprompt.inc.php';
  185. }

  186. if(empty($filter)) {
  187.         $threadcount = $forum['threads'];
  188. } else {
  189.         $query = $db->query("SELECT COUNT(*) FROM {$tablepre}threads WHERE fid='$fid' $filteradd AND displayorder>='0'");
  190.         $threadcount = $db->result($query, 0);
  191. }
  192. if($globalstick) {
  193.         $thisgid = $forum['type'] == 'forum' ? $forum['fup'] : $_DCACHE['forums'][$forum['fup']]['fup'];
  194.         $stickytids = $_DCACHE['globalstick']['global']['tids'].(empty($_DCACHE['globalstick']['categories'][$thisgid]['count']) ? '' : ','.$_DCACHE['globalstick']['categories'][$thisgid]['tids']);

  195.         $stickycount = $_DCACHE['globalstick']['global']['count'] + $_DCACHE['globalstick']['categories'][$thisgid]['count'];
  196. } else {
  197.         $thisgid = $stickycount = $stickytids = 0;
  198. }

  199. $filterbool = !empty($filter) && in_array($filter, array('digest', 'type', 'activity', 'poll', 'trade', 'reward'));
  200. $threadcount += $filterbool ? 0 : $stickycount;
  201. $multipage = multi($threadcount, $tpp, $page, "forumdisplay.php?fid=$fid$forumdisplayadd", $threadmaxpages);
  202. $extra = rawurlencode("page=$page$forumdisplayadd");

  203. $separatepos = 0;
  204. $threadlist = array();
  205. $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');

  206. $displayorderadd = !$filterbool && $stickycount ? 't.displayorder IN (0, 1)' : 't.displayorder>=0';

  207. if(($start_limit && $start_limit > $stickycount) || !$stickycount || $filterbool) {

  208.         $querysticky = '';
  209.         $query = $db->query("SELECT $dotadd1 t.* FROM {$tablepre}threads t $dotadd2
  210.                 WHERE t.fid='$fid' $filteradd AND $displayorderadd
  211.                 ORDER BY t.displayorder DESC, t.$orderby $ascdesc
  212.                 LIMIT ".($filterbool ? $start_limit : $start_limit - $stickycount).", $tpp");

  213. } else {

  214.         $querysticky = $db->query("SELECT $dotadd1 t.* FROM {$tablepre}threads t $dotadd2
  215.                 WHERE t.tid IN ($stickytids) AND t.displayorder IN (2, 3)
  216.                 ORDER BY displayorder DESC, $orderby $ascdesc
  217.                 LIMIT $start_limit, ".($stickycount - $start_limit < $tpp ? $stickycount - $start_limit : $tpp));

  218.         if($tpp - $stickycount + $start_limit > 0) {
  219.                 $query = $db->query("SELECT $dotadd1 t.* FROM {$tablepre}threads t $dotadd2
  220.                         WHERE t.fid='$fid' $filteradd AND $displayorderadd
  221.                         ORDER BY displayorder DESC, $orderby $ascdesc
  222.                         LIMIT ".($tpp - $stickycount + $start_limit));
  223.         } else {
  224.                 $query = '';
  225.         }

  226. }

  227. $ppp = $forum['threadcaches'] ? $_DCACHE['settings']['postperpage'] : $ppp;

  228. while(($querysticky && $thread = $db->fetch_array($querysticky)) || ($query && $thread = $db->fetch_array($query))) {
  229.         $thread['icon'] = isset($_DCACHE['icons'][$thread['iconid']]) ? '<img src="'.SMDIR.'/'.$_DCACHE['icons'][$thread['iconid']].'" alt="" />' : '&nbsp;';
  230.         $thread['lastposterenc'] = rawurlencode($thread['lastposter']);

  231.         $thread['typeid'] = $thread['typeid'] && !empty($forum['threadtypes']['prefix']) && isset($forum['threadtypes']['types'][$thread['typeid']]) ?
  232.                 '['.$forum['threadtypes']['types'][$thread['typeid']].'] ' : '';

  233.         $topicposts = $thread['replies'] + 1;
  234.         if($topicposts > $ppp) {
  235.                 $pagelinks = '';
  236.                 $topicpages = ceil($topicposts / $ppp);
  237.                 for($i = 1; $i <= $topicpages; $i++) {
  238.                         $pagelinks .= "<a href="viewthread.php?tid=$thread[tid]&amp;extra=$extra&amp;page=$i">$i</a> ";
  239.                         if($i == 6) {
  240.                                 $i = $topicpages + 1;
  241.                         }
  242.                 }
  243.                 if($topicpages > 6) {
  244.                         $pagelinks .= " .. <a href="viewthread.php?tid=$thread[tid]&amp;page=$topicpages&amp;extra=$extra">$topicpages</a> ";
  245.                 }
  246.                 $thread['multipage'] = ' &nbsp;<img src="'.IMGDIR.'/multipage.gif"  border="0" alt="" /> '.$pagelinks;
  247.         } else {
  248.                 $thread['multipage'] = '';
  249.         }

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

  253.                 $thread['highlight'] = ' style="';
  254.                 $thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  255.                 $thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  256.                 $thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  257.                 $thread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  258.                 $thread['highlight'] .= '"';
  259.         } else {
  260.                 $thread['highlight'] = '';
  261.         }

  262.         $thread['moved'] = 0;
  263.         if($thread['closed'] || ($forum['autoclose'] && $timestamp - $thread[$closedby] > $forum['autoclose'])) {
  264.                 $thread['new'] = 0;
  265.                 if($thread['closed'] > 1) {
  266.                         $thread['moved'] = $thread['tid'];
  267.                         $thread['tid'] = $thread['closed'];
  268.                         $thread['replies'] = '-';
  269.                         $thread['views'] = '-';
  270.                 }
  271.                 $thread['folder'] = 'lock_folder.gif';
  272.         } else {
  273.                 $thread['folder'] = 'folder.gif';
  274.                 if($lastvisit < $thread['lastpost'] && (empty($_DCOOKIE['oldtopics']) || strpos($_DCOOKIE['oldtopics'], 'D'.$thread['tid'].'D') === FALSE)) {
  275.                         $thread['new'] = 1;
  276.                         $thread['folder'] = 'red_'.$thread['folder'];
  277.                 } else {
  278.                         $thread['new'] = 0;
  279.                 }
  280.                 if($thread['replies'] > $thread['views']) {
  281.                         $thread['views'] = $thread['replies'];
  282.                 }
  283.                 if($thread['replies'] >= $hottopic) {
  284.                         $thread['folder'] = 'hot_'.$thread['folder'];
  285.                 }
  286.                 if($dotfolders && $thread['dotauthor'] == $discuz_uid && $discuz_uid) {
  287.                         $thread['folder'] = 'dot_'.$thread['folder'];
  288.                 }
  289.         }

  290.         $thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600);
  291.         $thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);

  292.         if($thread['displayorder'] > 0) {
  293.                 $separatepos++;
  294.         }

  295.         $threadlist[] = $thread;

  296. }

  297. $separatepos = $separatepos ? $separatepos + 1 : ($announcement ? 1 : 0);

  298. $check = array();
  299. $check[$filter] = $check[$orderby] = $check[$ascdesc] = 'selected="selected"';

  300. $visitedforums = $visitedforums ? visitedforums() : '';
  301. $forumselect = $forummenu = '';
  302. if($forumjump && empty($jsmenu[1])) {
  303.         $forumselect = forumselect();
  304. }
  305. $typeselect = typeselect($typeid);

  306. $usesigcheck = $discuz_uid && $sigstatus ? 'checked' : '';
  307. $allowpost = (!$forum['postperm'] && $allowpost) || ($forum['postperm'] && forumperm($forum['postperm'])) || !empty($forum['allowpost']);

  308. $showpoll = $showtrade = $showreward = $showactivity = 0;
  309. if($forum['allowpostspecial']) {
  310.         $showpoll = substr(sprintf('%04b', $forum['allowpostspecial']), -1, 1);
  311.         $showtrade = substr(sprintf('%04b', $forum['allowpostspecial']), -2, 1);
  312.         $showreward = substr(sprintf('%04b', $forum['allowpostspecial']), -3, 1) && isset($extcredits[$creditstrans]);
  313.         $showactivity = substr(sprintf('%04b', $forum['allowpostspecial']), -4, 1);
  314. }

  315. if($allowpost) {
  316.         $allowpostpoll = $allowpostpoll && $showpoll;
  317.         $allowposttrade = $allowposttrade && $showtrade;
  318.         $allowpostreward = $allowpostreward && $showreward && isset($extcredits[$creditstrans]);
  319.         $allowpostactivity = $allowpostactivity && $showactivity;
  320. }

  321. $searchboxstatus = substr(sprintf('%03b', $qihoo_searchbox), -2, 1);

  322. if($fastpost && $allowpost) {
  323.         $editorid = 'fastpost';
  324.         $smcols = $smcols ? $smcols : 4;
  325.         $smileyinsert = $smileyinsert && is_array($_DCACHE['smilies_display']) ? 1 : 0;
  326.         $smilies = $smileyinsert ? smiliestable($_DCACHE['smilies_display'], $smcols, 4, $editorid) : '';
  327.         $moresmilies = $smileyinsert && count($_DCACHE['smilies_display']) > $smcols * 4 ? 1 : 0;
  328. }

  329. $threadsticky = explode(',', $threadsticky);

  330. $forumselect = $forummenu = '';
  331. if($forumjump) {
  332.         if($jsmenu[1]) {
  333.                 $forummenu = forumselect(FALSE, 1);
  334.         } else {
  335.                 $forumselect = forumselect();
  336.         }
  337. }

  338. include template('forumdisplay');

  339. ?>
复制代码
回复

使用道具 举报

闪电 发表于 2007-3-26 00:49:31 | 显示全部楼层
没有人理我??????????????????
回复

使用道具 举报

闪电 发表于 2007-3-26 00:50:47 | 显示全部楼层
$showpoll = $showtrade = $showreward = $showactivity = 0;
if($forum['allowpostspecial']) {
        $showpoll = substr(sprintf('%04b', $forum['allowpostspecial']), -1, 1);
        $showtrade = substr(sprintf('%04b', $forum['allowpostspecial']), -2, 1);
        $showreward = substr(sprintf('%04b', $forum['allowpostspecial']), -3, 1) && isset($extcredits[$creditstrans]);
        $showactivity = substr(sprintf('%04b', $forum['allowpostspecial']), -4, 1);
}

这里不知道怎么修改了???/
回复

使用道具 举报

lffly 发表于 2007-3-26 16:28:19 | 显示全部楼层
谢谢老龙!很好用的一个HACK!
好像存在一些不足之处,当我编辑完问卷提交后,再次编辑问卷,就看不到上次所设置的问题了,就是说不能修改原来设置好的问卷。不知道是不是我安装的问题。请老龙看一下
:)
回复

使用道具 举报

hetoo 发表于 2007-3-26 23:27:05 | 显示全部楼层
5.5中的好几个文件改动太大
希望老龙还是给个修改方法
回复

使用道具 举报

hetoo 发表于 2007-3-27 22:52:06 | 显示全部楼层
老龙啊老龙
还是修改一个for 5.5的吧
折腾了半宿,发现5.5改动太多了
回复

使用道具 举报

xuezhou118 发表于 2007-3-28 22:38:04 | 显示全部楼层
还是给个5.5的修改方法吧。弄了半天也搞不定~~~
回复

使用道具 举报

hetoo 发表于 2007-3-31 13:19:43 | 显示全部楼层
老龙怎么还不来处理问题
回复

使用道具 举报

 楼主| sw08 发表于 2007-4-1 14:03:48 | 显示全部楼层

回复 #115 lffly 的帖子

有意这样设置的,因为发现那样会导致分数计算错误。
回复

使用道具 举报

 楼主| sw08 发表于 2007-4-1 14:04:52 | 显示全部楼层

回复 #117 hetoo 的帖子

涉及的核心太多了,有时间会尽量完成的。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-17 14:46 , Processed in 0.127689 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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