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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[9.22更新,增加文字底色][原创]10种自定义参数标题醒目高亮

[复制链接]
GTO014 发表于 2005-11-3 14:44:47 | 显示全部楼层
哦,可以了,谢谢你哦,我很喜欢~~

[ 本帖最后由 GTO014 于 2005-11-3 14:58 编辑 ]
回复

使用道具 举报

Berial 发表于 2005-11-3 17:20:30 | 显示全部楼层
核對完成,還是不能使用
代碼修改的部分如下。
不過我都是按步走複製過去的,應該不會有錯誤才對啊?難道有什麽需要找的其他輔助插件我沒裝?
還是因爲之前裝過高亮的需要卸載掉?
無限鬱悶中~~~


  1.             }
  2.                 $db->query("UPDATE $table_threads SET highlight='$highlight_style$highlight_color' WHERE tid in($tids)");

  3.                 modlog();
  4.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  5. }

  6. //=====°ËÖÖ×Ô¶¨Òå²ÎÊý±êÌâÐÑÄ¿+ÈÎÒâÑÕÉ«¸ßÁÁ==start==By www.5466.ik8.com==============

  7. elseif($action == 'xm_highlight' && $allowhighlight) {
  8.         if(!submitcheck('xm_highlightsubmit')) {
  9.       
  10.                 $xm_hl_string=explode(',',$thread['xm_hl']);
  11.                
  12.                 for($i = 1; $i <=10; $i++) {
  13.                         $xu_check[$i] =$i==$xm_hl_string[0] ?  'checked' : NULL;
  14.                                                                         
  15.            }

  16.           if($xm_hl_string[0]){            
  17.            switch($xm_hl_string[0]){
  18.            
  19.            case 1: $xm_id_11=$xm_hl_string[1];$xm_id_12=$xm_hl_string[2];$xm_id_13=$xm_hl_string[3];$xm_id_14=$xm_hl_string[4];
  20.                    break;                                    
  21.            
  22.            case 2:
  23.                    $xm_id_21=$xm_hl_string[1];$xm_id_22=$xm_hl_string[2];$xm_id_23=$xm_hl_string[3];$xm_id_24=$xm_hl_string[4];                  
  24.                    break;
  25.                               
  26.            case 3:
  27.                    $xm_id_31=$xm_hl_string[1];$xm_id_32=$xm_hl_string[2];$xm_id_33=$xm_hl_string[3];$xm_id_34=$xm_hl_string[4];                           
  28.                    break;           
  29.            
  30.            case 4:
  31.                    $xm_id_41=$xm_hl_string[1];$xm_id_42=$xm_hl_string[2];$xm_id_43=$xm_hl_string[3];$xm_id_44=$xm_hl_string[4];                     
  32.                    break;           
  33.                      
  34.            case 5:
  35.                    $xm_id_51=$xm_hl_string[1];$xm_id_52=$xm_hl_string[2];               
  36.                    break;   
  37.            
  38.            case 6:
  39.                    $xm_id_61=$xm_hl_string[1];$xm_id_62=$xm_hl_string[2];$xm_id_63=$xm_hl_string[3];                             
  40.                    break;
  41.            case 7:
  42.                    $xm_id_71=$xm_hl_string[1];$xm_id_72=$xm_hl_string[2];$xm_id_73=$xm_hl_string[3];                             
  43.                    break;
  44.            case 8:
  45.                    $xm_id_81=$xm_hl_string[1];$xm_id_82=$xm_hl_string[2];$xm_id_83=$xm_hl_string[3];                             
  46.                    break;
  47.            case 9:
  48.                    $xm_id_91=$xm_hl_string[1];$xm_id_92=$xm_hl_string[2];                             
  49.                    break;                                                           
  50.                      
  51.            default: break;         
  52.               }
  53.            
  54.            }
  55.         include template('topicadmin_xm_highlight');

  56.         } else {

  57.                 $xm_hl_str = '';
  58.                
  59.                 if($xm_hl_id==1){$xm_hl_str=$xm_hl_id.','.$font_color.','.$font_size.','.$font_style.','.$font_underline;
  60.                
  61.                 }
  62.                
  63.                 else if($xm_hl_id==2){$xm_hl_str=$xm_hl_id.','.$text_color1.','.$text_color2.','.$speed_1.','.$pause_1;
  64.                
  65.                 }
  66.                
  67.                 else if($xm_hl_id==3){ $xm_hl_str=$xm_hl_id.','.$textoffset1.','.$textoffset2.','.$speed_2.','.$pause_2;
  68.                
  69.                 }
  70.                
  71.                 else if($xm_hl_id==4){ $xm_hl_str=$xm_hl_id.','.$textcolor.','.$textsize1.','.$speed_3.','.$pause_3;
  72.                
  73.                 }
  74.                
  75.                 else if($xm_hl_id==5){ $xm_hl_str=$xm_hl_id.','.$sider_color.','.$text_color;
  76.                  
  77.                 }
  78.                
  79.                 else if($xm_hl_id==6){ $xm_hl_str=$xm_hl_id.','.$start_color.','.$start_n.','.$end_color;
  80.                  
  81.                 }
  82.                 else if($xm_hl_id==7){ $xm_hl_str=$xm_hl_id.','.$glow_color1.','.$glow_pow.','.$glow_color2;
  83.                  
  84.                 }
  85.                 else if($xm_hl_id==8){ $xm_hl_str=$xm_hl_id.','.$shadow_color1.','.$shadow_view.','.$shadow_color2;
  86.                  
  87.                 }
  88.                 else if($xm_hl_id==9){ $xm_hl_str=$xm_hl_id.','.$bg_color.','.$face_color;
  89.                  
  90.                 }                                                        
  91.                 else if($xm_hl_id==10){ $xm_hl_str=$xm_hl_id;
  92.                  
  93.                 }                        
  94.                
  95.                 else if($xm_hl_id==11){ $xm_hl_str='';
  96.                
  97.                 }        
  98.                         
  99.                 else showmessage('undefined_action');
  100.                
  101.                
  102.                 if(strlen($xm_hl_str)>25){ $xm_hl_str=substr($xm_hl_str,0, 25);}
  103.                
  104.                
  105.                 $db->query("UPDATE $table_threads SET xm_hl='$xm_hl_str' WHERE tid='$tid'");

  106.                 modlog();
  107.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");
  108.    
  109.         }

  110. }

  111. //=====°&Euml;&Ouml;&Ouml;×&Ocirc;&para;¨&Ograve;&aring;&sup2;&Icirc;&Ecirc;&yacute;±ê&Igrave;&acirc;&ETH;&Ntilde;&Auml;&iquest;+&Egrave;&Icirc;&Ograve;&acirc;&Ntilde;&Otilde;&Eacute;&laquo;&cedil;&szlig;&Aacute;&Aacute;==end==By lu5266=====================


  112. elseif($action == 'digest' && $allowdigest) {
  113.         if(!submitcheck('digestsubmit')) {
复制代码


  1. $thread['multipage'] = '&nbsp; &nbsp;( <img src="'.IMGDIR.'/multipage.gif" align="absmiddle" boader="0"> '.$pagelinks.')';
  2.         } else {
  3.                 $thread['multipage'] = '';
  4.         }
  5.        
  6. //=====???????????+??????==start==By www.5466.ik8.com==============


  7.    
  8.    if($thread['xm_hl']) {
  9.         
  10.            $xm_hl_string=explode(',',$thread['xm_hl']);
  11.            
  12.            switch($xm_hl_string[0]){
  13.            
  14.            case 1:
  15.                   $xm_hl_style  = '<font style="';
  16.                   $xm_hl_style .= $xm_hl_string[1] ? 'color: #'.$xm_hl_string[1].'; ' : '';        
  17.                       $xm_hl_style .= $xm_hl_string[2] ? 'font-weight: bold;' : '';
  18.                       $xm_hl_style .= $xm_hl_string[3] ? 'font-style: italic;' : '';
  19.                       $xm_hl_style .= $xm_hl_string[4] ? 'text-decoration: underline;' : '';               
  20.                       $xm_hl_style .= '">';
  21.                       $thread[subject]=$xm_hl_style.$thread[subject].'</font>';
  22.                       break;
  23.            case 2:
  24.                   $xm_hl_style  = '<font textcolor1="#'.$xm_hl_string[1].'"  textbkcolor1="transparent" textcolor2="#'.$xm_hl_string[2];
  25.                   $xm_hl_style .='" textbkcolor2="transparent" speed="'.$xm_hl_string[3].'" letters1="1" letters2="1" pause="'.$xm_hl_string[4];
  26.                   $xm_hl_style .='" style="behavior:url(include/z_FlashText.htc);color:#c000c0;background-color:transparent">';
  27.                       $thread[subject]=$xm_hl_style.$thread[subject].'</font>';
  28.                       break;
  29.            case 3:
  30.                   $xm_hl_style  = '<font textoffset1="'.$xm_hl_string[1].'" textoffset2="'.$xm_hl_string[2];
  31.                   $xm_hl_style .='" speed="'.$xm_hl_string[3].'" letters1="1" letters2="1" pause="'.$xm_hl_string[4];
  32.                   $xm_hl_style .='" style="behavior:url(include/z_WaveText.htc);color:#FF5500;background-color:transparent">';
  33.                       $thread[subject]=$xm_hl_style.$thread[subject].'</font>';
  34.                       break;                     
  35.            case 4:
  36.                   $xm_hl_style  = '<font textcolor="#'.$xm_hl_string[1].'" basesize="12" textsize1="'.$xm_hl_string[2];
  37.                   $xm_hl_style .='" textsize2="14" speed="'.$xm_hl_string[3].'" letters1="1" letters2="1" pause="'.$xm_hl_string[4];
  38.                   $xm_hl_style .='" style="behavior:url(include/z_ResizeText.htc);color:#993300;background-color:transparent;">';
  39.                       $thread[subject]=$xm_hl_style.$thread[subject].'</font>';
  40.                       break;                           
  41.            case 5:
  42.                   $xm_hl_style  = '<span style=\'border:solid 1px #'.$xm_hl_string[1].';border-left-width:5px;border-left-color:#'.$xm_hl_string[1];
  43.                   $xm_hl_style .=';background:#ffffff;padding:1px 5px 2px 5px;font-size: 8pt\'><font color="#'.$xm_hl_string[2];
  44.                   $xm_hl_style .='">';
  45.                       $thread[subject]=$xm_hl_style.$thread[subject].'</font></span>';
  46.                       break;
  47.            case 6:
  48.                   $start_str=substr($thread[subject],0,$xm_hl_string[2]);
  49.                   $end_str=substr($thread[subject],$xm_hl_string[2]);
  50.                   if($xm_hl_string[3])
  51.                   $thread[subject]  = '<font color="'.$xm_hl_string[1].'">'.$start_str.'</font><font color="'.$xm_hl_string[3].'">'.$end_str.'</font>';                     
  52.               else
  53.               $thread[subject]  = '<font color="'.$xm_hl_string[1].'">'.$start_str.'</font>'.$end_str;
  54.               break;
  55.            case 7:
  56.                   $xm_hl_style  = '<font style="filter: glow(color=#'.$xm_hl_string[1].',strength='.$xm_hl_string[2];
  57.                   $xm_hl_style .='); height:20px; color: #'.$xm_hl_string[3];
  58.                   $xm_hl_style .='">';
  59.                       $thread[subject]=$xm_hl_style.$thread[subject].'</font>';
  60.                       break;
  61.            case 8:
  62.                   $xm_hl_style  = '<font style="filter: shadow(color=#'.$xm_hl_string[1].',direction='.$xm_hl_string[2];
  63.                   $xm_hl_style .='); height:20px; color: #'.$xm_hl_string[3];
  64.                   $xm_hl_style .='">';
  65.                       $thread[subject]=$xm_hl_style.$thread[subject].'</font>';
  66.                       break;
  67.            case 9:
  68.                   $xm_hl_style  = '<font style="background-color: #'.$xm_hl_string[1].';" color="#'.$xm_hl_string[2].'"><b>';
  69.                   $thread[subject]=$xm_hl_style.$thread[subject].'</b></font>';
  70.                       break;                                            
  71.            case 10:                  
  72.                       $thread[subject]='<span style="behavior:url(./include/rainbow.htc)">'.$thread[subject].'</span>';
  73.                       break;              
  74.          default:  $thread[subject]=$thread[subject];   
  75.                    }   
  76.         
  77.         
  78.         }
  79. //=====???????????+??????==end==By lu5266=====================
  80.        
  81. if($thread['closed']) {
  82.                 $thread['new'] = 0;
复制代码


  1. $thread['attachment'] = '';
  2.         }
  3.         //$thread[subject] = cutstr($thread[subject],77);
  4.         $thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600);code]


  5. [code]<!--{if $allowhighlight}-->
  6.         <option value="xm_highlight">??????</option>
  7.         <option value="highlight">{lang admin_highlight}</option>
复制代码
回复

使用道具 举报

 楼主| lu5266 发表于 2005-11-3 18:32:06 | 显示全部楼层
原帖由 Berial 于 2005-11-3 17:20 发表
核對完成,還是不能使用
代碼修改的部分如下。
不過我都是按步走複製過去的,應該不會有錯誤才對啊?難道有什麽需要找的其他輔助插件我沒裝?
還是因爲之前裝過高亮的需要卸載掉?
無限鬱悶中~~~


[co ...


你的出错提示是什么?


还有你最后的那段代码怎么有[code]

还有最后的那段代码是加在那个文件的?
回复

使用道具 举报

Berial 发表于 2005-11-3 23:25:13 | 显示全部楼层
最后那段代码是在模板里的
那个[code]估计是些标签的时候多写了的
代码里没有

请原谅我这个小白吧[果然是我的RP问题]   
已经可以用了    ||| OPL
谢谢大人的插件
效果非常漂亮


[ 本帖最后由 Berial 于 2005-11-3 23:41 编辑 ]
回复

使用道具 举报

Berial 发表于 2005-11-4 00:05:24 | 显示全部楼层
新的问题出现了
我选取消高亮,结果变成了彩虹
我选彩虹,变成了黑色粗体
郁郁~~~~
这肯定不是我得RP问题了
是不是8字不合?多灾多难呢~~T^T~~~
回复

使用道具 举报

 楼主| lu5266 发表于 2005-11-4 10:38:26 | 显示全部楼层
原帖由 Berial 于 2005-11-4 00:05 发表
新的问题出现了
我选取消高亮,结果变成了彩虹
我选彩虹,变成了黑色粗体
郁郁~~~~
这肯定不是我得RP问题了
是不是8字不合?多灾多难呢~~T^T~~~



哈哈

不是8字不合

好象你用错模版了

应该是一楼的模版
回复

使用道具 举报

Berial 发表于 2005-11-4 17:12:19 | 显示全部楼层
·o·!! 哦~~~~
原来这样啊
谢谢大人
我去改过先~~~
回复

使用道具 举报

 楼主| lu5266 发表于 2005-11-4 17:28:35 | 显示全部楼层
原帖由 Berial 于 2005-11-4 17:12 发表
·o·!! 哦~~~~
原来这样啊
谢谢大人
我去改过先~~~


好了吧
回复

使用道具 举报

西龙 发表于 2005-11-11 13:58:28 | 显示全部楼层
topicadmin.php

  1. <?php

  2. /*
  3. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4. :: [DISCUZ!]  Crossday Discuz! Board                                    ::
  5. :: (c) 2001-2005 Comsenz Technology Ltd (www.discuz.com)                ::
  6. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7. :: Author:  Crossday (tech@discuz.com) Cnteacher (cnteacher@discuz.com) ::
  8. :: Version: 2.5F   2004/10/01 05:15                                     ::
  9. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10. */
  11. //fix:  BY pk0909
  12. /*
  13. 1 癸だ澄???肈?ぶhtml锣竡矪瞶
  14. 2 铬锣?url把计拜肈
  15. 3 у秖?埃?肈??⊿Τ?埃癸莱?ン
  16. */

  17. require './include/common.php';
  18. require_once DISCUZ_ROOT.'./include/post.php';
  19. //pk top hack 2005-3-20
  20. require_once DISCUZ_ROOT.'./include/cache.php';

  21. $discuz_action = 151;

  22. $tid   = $tid ? $tid :'';
  23. $page  = intval($page);
  24. $fpage = intval($fpage);

  25. if($tid) {
  26.         $query = $db->query("SELECT * FROM $table_threads WHERE tid='$tid'");
  27.         $thread = $db->fetch_array($query);
  28.         $thread['subject'] .= $action == 'delthread' ? ", etc." : NULL;
  29. }

  30. if($forum['type'] == 'forum') {
  31.         $navigation = "&raquo; <a href="forumdisplay.php?fid=$fid&page=$fpage">$forum[name]</a> &raquo; <a href="viewthread.php?tid=$tid">$thread[subject]</a> ";
  32.         $navtitle = ' - '.strip_tags($forum['name']).' - '.$thread['subject'];
  33. } else {
  34.         $query = $db->query("SELECT name, fid, moderator FROM $table_forums WHERE fid='$forum[fup]'");
  35.         $fup = $db->fetch_array($query);
  36.         $navigation = "&raquo; <a href="forumdisplay.php?fid=$fup[fid]">$fup[name]</a> &raquo; <a href="forumdisplay.php?fid=$fid&page=$fpage">$forum[name]</a> &raquo; <a href="viewthread.php?tid=$tid">$thread[subject]</a> ";
  37.         $navtitle = ' - '.strip_tags($fup['name']).' - '.strip_tags($forum['name']).' - '.$thread['subject'];
  38. }

  39. if(!$discuz_user || !$discuz_pw || !modcheck($discuz_user)) {
  40.         showmessage('admin_nopermission', NULL, 'HALTED');
  41. }

  42. $fupadd = $fup ? "OR (fid='$fup[fid]' && type<>'group')" : NULL;

  43. if($action == 'moderate') {
  44.         if(!is_array($moderate) || !count($moderate)) {
  45.                 showmessage('admin_moderate_nothread');
  46.         }elseif(!$operation){
  47.                 showmessage('admin_moderate_nooperation');
  48.         }
  49.         $tids = implode_ids($moderate);
  50.         $query = $db->query("SELECT * FROM $table_threads WHERE tid IN($tids) ");
  51.         if(!submitcheck('moderatesubmit')){
  52.                 $threadlist = array();
  53.                 while($thread = $db->fetch_array($query)) {
  54.                         if($thread['fid'] == $fid){
  55.                                 $thread['lastposterenc'] = rawurlencode($thread['lastposter']);
  56.                                 if($thread['attachment']) {
  57.                                         require_once DISCUZ_ROOT.'./include/attachment.php';
  58.                                         $thread['attachment'] = attachtype($thread['attachment']).' ';
  59.                                 } else {
  60.                                         $thread['attachment'] = '';
  61.                                 }
  62.                                 $thread[subject] = cutstr($thread[subject],77);
  63.                                 $thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600);
  64.                                 $thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);
  65.                                 $threadlist[] = $thread;
  66.                         }
  67.                 }
  68.                
  69.                 if(!$threadlist) showmessage('admin_moderate_nothread');

  70.                 if($operation == 'move') {
  71.                         require_once DISCUZ_ROOT.'./include/forum.php';
  72.                         $forumselect = forumselect();
  73.                 }
  74.                 include template('topicadmin_moderate');
  75.        
  76.         }else{
  77.        
  78.                 if($operation == 'move' && $allowmove) {
  79.                         if(!$moveto) {
  80.                                 showmessage('admin_move_invalid');
  81.                         }

  82.                         accesscheck($query);

  83.                         $displayorderadd = !$adminglobal ? ", displayorder='0'" : NULL;

  84.                         $db->query("UPDATE $table_threads SET fid='$moveto' $displayorderadd WHERE tid IN($tids)");
  85.                         $db->query("UPDATE $table_posts SET fid='$moveto' WHERE tid IN($tids) ");

  86.                         if ($forum['type'] == 'sub') {
  87.                                 $query= $db->query("SELECT fup FROM $table_forums WHERE fid='$fid' LIMIT 1");
  88.                                 $fup = $db->result($query, 0);
  89.                                 updateforumcount($fup);
  90.                         }
  91.                         modlog();
  92.                         updateforumcount($moveto);
  93.                         updateforumcount($fid);
  94.                         showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$page");

  95.                 }elseif($operation == 'stick' && $allowtop){
  96.                         accesscheck($query);
  97.                         if($level < 0 || $level > 3 || ($level == 2 && $adminid != 1 && $adminid != 2) || ($level == 3 && $adminid != 1)) {
  98.                                 showmessage('undefined_action');
  99.                         }
  100.                         $db->query("UPDATE $table_threads SET displayorder='$level' WHERE tid IN ($tids)");
  101.                      //pk top hack 2005-3-20
  102. if ($level < 2) {
  103.         $db->query("DELETE FROM {$tablepre}topthreads WHERE tid IN ($tids)");
  104.         if ($db->affected_rows()) updatecache('topthreads');
  105. } else {
  106.         $tidArray = explode(',', $tids);
  107.         foreach ($tidArray as $tmp) {
  108.                 $db->query("INSERT INTO {$tablepre}topthreads (tid) VALUES ($tmp)", 'SILENT');
  109.         }
  110.         updatecache('topthreads');
  111. }
  112.                         modlog();
  113.                         showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$page");

  114.                 }elseif($operation == 'delete' && $allowdelpost) {
  115.                         accesscheck($query);
  116.                         $uids = $comma = '';
  117.                         $haveattach = 0;
  118.                         $query = $db->query("SELECT authorid ,aid FROM $table_posts WHERE tid IN ($tids)");
  119.                         while($post = $db->fetch_array($query)) {
  120.                                 $uids .= "$comma$post[authorid]";
  121.                                 $comma = ',';
  122.                                 if ($post['aid']) $haveattach++;
  123.                         }
  124.                         updatemember('-', $uids, $deletedcredits);

  125.                         if ($haveattach){
  126.                                 $query = $db->query("SELECT attachment FROM $table_attachments WHERE tid IN ($tids)");
  127.                                 while($attach = $db->fetch_array($query)) {
  128.                                         @unlink(DISCUZ_ROOT.'./'.$attachdir.'/'.$attach['attachment']);
  129.                                 }
  130.                                 $db->query("DELETE FROM $table_attachments WHERE tid IN ($tids)");
  131.                         }
  132.                        
  133.                         $db->query("DELETE FROM $table_threads WHERE tid IN ($tids)");
  134.                         $db->query("DELETE FROM $table_polls WHERE tid IN ($tids)");
  135.                         $db->query("DELETE FROM $table_posts WHERE tid IN ($tids)");
  136.                      //pk top hack 2005-3-20
  137. $db->query("DELETE FROM {$tablepre}topthreads WHERE tid IN ($tids)");
  138. if ($db->affected_rows()) updatecache('topthreads');

  139.                         updateforumcount($fid);

  140.                         modlog();
  141.                         showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$page");

  142.                 }elseif($operation == 'close' && $allowclose){
  143.                         accesscheck($query);
  144.                         $close = $type ? 1 : 0;
  145.                         $db->query("UPDATE $table_threads SET closed='$close' WHERE tid in($tids)");
  146.                         modlog();
  147.                         showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$page");

  148.                 }elseif($operation == 'digest' && $allowdigest){
  149.                         if($level < 0 || $level > 3) {
  150.                                 showmessage('undefined_action', NULL, 'HALTED');
  151.                         }
  152.                         while($thread = $db->fetch_array($query)) {
  153.                                 if ($thread['fid'] == $fid && $thread['digest']<>$level){
  154.                                         $digest_mark=($level-intval($thread['digest']))*$digestcredits;
  155.                                         $db->query("UPDATE $table_threads SET digest='$level' WHERE tid='$thread[tid]'");
  156.                                         if($digest_mark && $discuz_uid != $thread[authorid]) {
  157.                                                 $db->query("UPDATE $table_members SET credit=credit".($digest_mark > 0 ? '+' : '')."$digest_mark WHERE uid='$thread[authorid]'");
  158.                                         }
  159.                                 }
  160.                         }
  161.                         modlog();
  162.                         showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$page");
  163.                 }else{
  164.                         showmessage('admin_nopermission', NULL, 'HALTED');
  165.                 }
  166.         }

  167. } elseif($action == 'delpost' && $allowdelpost) {

  168.         if(!is_array($delete) || !count($delete)) {
  169.                 showmessage('admin_delpost_invalid');
  170.         }

  171.         if(!submitcheck('delpostsubmit')) {

  172.                 $query = $db->query("SELECT COUNT(*) FROM $table_posts WHERE tid='$tid'");
  173.                 if(count($delete) < $db->result($query, 0)) {

  174.                         $deleteid = '';
  175.                         foreach($delete as $id) {
  176.                                 $deleteid .= '<input type="hidden" name="delete[]" value="'.$id.'">';
  177.                         }

  178.                         include template('topicadmin_delpost');
  179.                        
  180.                 } else {
  181.                         header("Location: {$boardurl}topicadmin.php?action=delete&fid=$fid&tid=$tid&page=$page&fpage=$fpage");
  182.                 }

  183.         } else {

  184.                 $pids = implode_ids( $delete );

  185.                 $uids = $comma = '';
  186.                 $actionpost = $totalpost = $aids = 0;
  187.                 $query = $db->query("SELECT pid, authorid, aid FROM $table_posts WHERE tid='$tid'");
  188.                 $totalpost = $db->num_rows($query);
  189.                 while($post = $db->fetch_array($query)) {
  190.                         if (in_array($post[pid], $delete)){
  191.                                 $uids .= "$comma$post[authorid]";
  192.                                 $comma = ',';
  193.                                 $actionpost ++;
  194.                                 if ($post['aid']) $aids .=','.$post[pid];
  195.                         }
  196.                 }

  197.                 if ($actionpost < 1) {
  198.                         showmessage('admin_delpost_invalid');
  199.                 }elseif($actionpost <> count($delete)){
  200.                         showmessage('admin_moderate_accesserror', NULL, 'HALTED');
  201.                 }elseif($actionpost >= $totalpost ){
  202.                         header("Location: {$boardurl}topicadmin.php?action=delete&fid=$fid&tid=$tid&page=$page&fpage=$fpage");
  203.                 }
  204.                
  205.                 updatemember('-', $uids, $deletedcredits);

  206.                 if ($aids){
  207.                         require_once DISCUZ_ROOT.'./include/attachment.php';
  208.                         $query = $db->query("SELECT pid, attachment, filetype FROM $table_attachments WHERE pid IN ($aids)");
  209.                         while($attach = $db->fetch_array($query)) {
  210.                                         @unlink(DISCUZ_ROOT.'./'.$attachdir.'/'.$attach['attachment']);
  211.                         }
  212.                         $db->query("DELETE FROM $table_attachments WHERE pid IN ($aids)");
  213.                         updatethread_type($tid , $thread['attachment']);
  214.                 }

  215.                 $db->query("DELETE FROM $table_posts WHERE pid IN ($pids)");
  216.                 updatethreadcount($tid);
  217.                 updateforumcount($fid);

  218.                 modlog();
  219.                 showmessage('admin_succeed', "viewthread.php?tid=$tid&page=$page&fpage=$fpage");

  220.         }

  221. } elseif($action == 'highlight' && $allowhighlight) {
  222.         if(!submitcheck('highlightsubmit')) {

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

  225.                 for($i = 1; $i <= 3; $i++) {
  226.                         $stylecheck[$i] = $stylestr[$i - 1] ? 'checked' : NULL;
  227.                 }
  228.                 $colorcheck = array($string[1] => 'checked');
  229.                
  230.                 include template('topicadmin_highlight');

  231.         } else {

  232.                 $stylebin = '';
  233.                 for($i = 1; $i <= 3; $i++) {
  234.                         $stylebin .= empty($highlight_style[$i]) ? '0' : '1';
  235.                 }
  236.                 $highlight_style = bindec($stylebin);

  237.                 if($highlight_style < 0 || $highlight_style > 7 || $highlight_color < 0 || $highlight_color > 8) {
  238.                         showmessage('undefined_action', NULL, 'HALTED');
  239.                 }
  240.                 $db->query("UPDATE $table_threads SET highlight='$highlight_style$highlight_color' WHERE tid='$tid'");

  241.                 modlog();
  242.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  243.         }

  244. } elseif($action == 'digest' && $allowdigest) {
  245.         if(!submitcheck('digestsubmit')) {

  246.                 include template('topicadmin_digest');

  247.         } else {

  248.                 if($level < 0 || $level > 3) {
  249.                         showmessage('undefined_action', NULL, 'HALTED');
  250.                 }
  251.                 $digest_mark=($level-intval($thread['digest']))*$digestcredits;

  252.                 $db->query("UPDATE $table_threads SET digest='$level' WHERE tid='$tid'");

  253.                 if($digest_mark && $discuz_uid != $thread['authorid'] ) {
  254.                         $db->query("UPDATE $table_members SET credit=credit".($digest_mark > 0 ? '+' : '')."$digest_mark WHERE uid='$thread[authorid]'");
  255.                 }
  256.                 modlog();
  257.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  258.         }

  259. } elseif($action == 'recount') {

  260.         $query = $db->query("SELECT COUNT(*) FROM $table_posts WHERE tid='$tid'");
  261.         $replies = $db->result($query, 0) - 1;

  262.         $query  = $db->query("SELECT author, dateline FROM $table_posts WHERE tid='$tid' ORDER BY dateline DESC LIMIT 1");
  263.         $post = $db->fetch_array($query);

  264.         $db->query("UPDATE $table_threads SET replies='$replies', lastpost='$post[dateline]', lastposter='".addslashes($post['author'])."' WHERE tid='$tid'");
  265.         showmessage('admin_succeed', "viewthread.php?tid=$tid&fpage=$fpage");

  266. } elseif($action == 'delete'  && $allowdelpost) {
  267.         if(!submitcheck('deletesubmit')) {

  268.                 include template('topicadmin_delete');

  269.         } else {

  270.                 $uids = $comma = '';
  271.                 $query = $db->query("SELECT authorid,aid FROM $table_posts WHERE tid='$tid'");
  272.                 $aids = 0;
  273.                 while($post = $db->fetch_array($query)) {
  274.                         $uids .= "$comma$post[authorid]";
  275.                         $comma = ',';
  276.                         if ($post['aid']) $aids++;
  277.                 }
  278.                 updatemember('-', $uids, $deletedcredits);

  279.                 $db->query("DELETE FROM $table_threads WHERE tid='$tid'");
  280.                 $db->query("DELETE FROM $table_posts WHERE tid='$tid'");
  281.                
  282.                 if ($aids){
  283.                         $query = $db->query("SELECT attachment FROM $table_attachments WHERE tid='$tid'");
  284.                         while($attach = $db->fetch_array($query)) {
  285.                                 @unlink(DISCUZ_ROOT.'./'.$attachdir.'/'.$attach['attachment']);
  286.                         }
  287.                         $db->query("DELETE FROM $table_attachments WHERE tid='$tid'");
  288.                 }
  289.                
  290.                 updateforumcount($fid);
  291.                 if ($forum['type'] == 'sub') {
  292.                         updateforumcount($fup['fid']);
  293.                 }

  294.                 modlog();
  295.               //pk top hack 2005-3-20
  296. $db->query("DELETE FROM {$tablepre}topthreads WHERE tid='$tid'");
  297. if ($db->affected_rows()) updatecache('topthreads');
  298.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  299.         }

  300. } elseif($action == 'close' && $allowclose) {

  301.         if(!submitcheck('closesubmit')) {

  302.                 include template('topicadmin_openclose');

  303.         } else {
  304.                 $openclose = $thread['closed'] ? 0 : 1;
  305.                 $db->query("UPDATE $table_threads SET closed='$openclose' WHERE tid='$tid' AND fid='$fid'");
  306.                 modlog();
  307.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");
  308.         }

  309. } elseif($action == 'move'  && $allowmove) {

  310.         if(!submitcheck('movesubmit')) {

  311.                 require_once DISCUZ_ROOT.'./include/forum.php';

  312.                 $forumselect = forumselect();
  313.                 include template('topicadmin_move');

  314.         } else {

  315.                 if(!$moveto) {
  316.                         showmessage('admin_move_invalid');
  317.                 }

  318.                 $displayorderadd = !$adminglobal ? ", displayorder='0'" : NULL;
  319.                 if($type == 'normal') {
  320.                         $db->query("UPDATE $table_threads SET fid='$moveto' $displayorderadd WHERE tid='$tid' AND fid='$fid'");
  321.                         $db->query("UPDATE $table_posts SET fid='$moveto' WHERE tid='$tid' AND fid='$fid'");
  322.                 } else {
  323.                         $db->query("INSERT INTO $table_threads (fid, creditsrequire, iconid, author, authorid, subject, dateline, lastpost, lastposter, views, replies, displayorder, digest, closed, poll, attachment)
  324.                                 VALUES ('$thread[fid]', '$thread[creditsrequire]', '$thread[iconid]', '".addslashes($thread['author'])."', '$thread[authorid]', '$thread[subject]', '$thread[dateline]', '$thread[lastpost]', '$thread[lastposter]', '0', '0', '0', '0', '$thread[tid]', '0', '0')");

  325.                         $db->query("UPDATE $table_threads SET fid='$moveto' $displayorderadd WHERE tid='$tid' AND fid='$fid'");
  326.                         $db->query("UPDATE $table_posts SET fid='$moveto' WHERE tid='$tid' AND fid='$fid'");
  327.                 }

  328.                 if ($forum['type'] == 'sub') {
  329.                         $query= $db->query("SELECT fup FROM $table_forums WHERE fid='$fid' LIMIT 1");
  330.                         $fup = $db->result($query, 0);
  331.                         updateforumcount($fup);
  332.                 }

  333.                 modlog();
  334.                 updateforumcount($moveto);
  335.                 updateforumcount($fid);
  336.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");
  337.         }

  338. } elseif($action == 'top' && $allowtop) {

  339.         if(!submitcheck('topsubmit')) {

  340.                 include template('topicadmin_topuntop');

  341.         } else {

  342.                 if($level < 0 || $level > 3 || ($level == 2 && $adminid != 1 && $adminid != 2) || ($level == 3 && $adminid != 1)) {
  343.                         showmessage('undefined_action');
  344.                 }
  345.                 $db->query("UPDATE $table_threads SET displayorder='$level' WHERE tid='$tid' AND fid='$fid'");

  346.                 modlog();
  347.               //pk top hack 2005-3-20
  348. if ($level > 1) {
  349.         $db->query("INSERT INTO {$tablepre}topthreads (tid) VALUES ('$tid')", 'SILENT');
  350.         updatecache('topthreads');
  351. } else {
  352.         $db->query("DELETE FROM {$tablepre}topthreads WHERE tid='$tid'");
  353.         if ($db->affected_rows()) updatecache('topthreads');
  354. }
  355.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  356.         }

  357. } elseif($action == 'getip' && $allowviewip) {

  358.         require_once DISCUZ_ROOT.'./include/misc.php';

  359.         $query = $db->query("SELECT m.adminid, p.useip FROM $table_posts p
  360.                                 LEFT JOIN $table_members m ON m.uid=p.authorid
  361.                                 WHERE pid='$pid' AND tid='$tid'");
  362.         if(!$member = $db->fetch_array($query)) {
  363.                 showmessage('thread_nonexistence', NULL, 'HALTED');
  364.         } elseif(($member['adminid'] == 1 && $adminid > 1) || ($member['adminid'] == 2 && $adminid > 2)) {
  365.                 showmessage('admin_getip_nopermission', NULL, 'HALTED');
  366.         }

  367.         $member['iplocation'] = convertip($member['useip']);

  368.         include template('topicadmin_getip');

  369. } elseif($action == 'bump') {

  370.         if(!submitcheck('bumpsubmit')) {

  371.                 include template('topicadmin_bump');

  372.         } else {

  373.                 $query = $db->query("SELECT subject, lastposter, lastpost FROM $table_threads WHERE tid='$tid' LIMIT 1");
  374.                 $thread = $db->fetch_array($query);
  375.                 $thread[lastposter] = addslashes($thread['lastposter']);
  376.                 $db->query("UPDATE $table_threads SET lastpost='$timestamp' WHERE tid='$tid' AND fid='$fid'");
  377.                 $db->query("UPDATE $table_forums SET lastpost='$thread[subject]\t$timestamp\t$thread[lastposter]' WHERE fid='$fid' $fupadd");

  378.                 modlog();
  379.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  380.         }

  381. } elseif($action == 'split' && $allowsplit) {

  382.         if(!submitcheck('splitsubmit')) {

  383.                 require_once DISCUZ_ROOT.'./include/discuzcode.php';

  384.                 $replies = $thread['replies'];
  385.                 if($replies <= 0) {
  386.                         showmessage('admin_split_invalid');
  387.                 }

  388.                 $postlist = array();
  389.                 $query = $db->query("SELECT * FROM $table_posts WHERE tid='$tid' ORDER BY dateline");
  390.                 while($post = $db->fetch_array($query)) {
  391.                         $post['message'] = postify($post['message'], $post['smileyoff'], $post['bbcodeoff']);
  392.                         $postlist[] = $post;
  393.                 }

  394.                 include template('topicadmin_split');

  395.         } else {

  396.                 if(!trim($subject)) {
  397.                         showmessage('admin_split_subject_invalid');
  398.                 }
  399.                 $subject = $subject ? dhtmlspecialchars(censor(trim($subject))) :'';

  400.                 $pids = implode_ids( $split );

  401.                 if($pids) {

  402.                         $db->query("INSERT INTO $table_threads (fid, subject) VALUES ('$fid', '$subject')");
  403.                         $newtid = $db->insert_id();

  404.                         $db->query("UPDATE $table_posts SET tid='$newtid' WHERE pid IN ($pids)");
  405.                         $db->query("UPDATE $table_attachments SET tid='$newtid' WHERE pid IN ($pids)");

  406.                         $query = $db->query("SELECT author, authorid, dateline FROM $table_posts WHERE tid='$tid' ORDER BY dateline ASC LIMIT 1");
  407.                         $fpost = $db->fetch_array($query);
  408.                         $db->query("UPDATE $table_threads SET author='$fpost[author]', authorid='$fpost[authorid]', dateline='$fpost[dateline]' WHERE tid='$tid'");

  409.                         $query = $db->query("SELECT author, authorid, dateline FROM $table_posts WHERE tid='$newtid' ORDER BY dateline ASC LIMIT 1");
  410.                         $fpost = $db->fetch_array($query);
  411.                         $db->query("UPDATE $table_threads SET author='$fpost[author]', authorid='$fpost[authorid]', dateline='$fpost[dateline]' WHERE tid='$newtid'");

  412.                         updatethreadcount($tid);
  413.                         updatethreadcount($newtid);
  414.                         updateforumcount($fid);

  415.                         modlog();
  416.                         showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  417.                 } else {
  418.                         showmessage('admin_split_new_invalid');
  419.                 }
  420.         }

  421. } elseif($action == 'merge' && $allowmerge) {

  422.         if(!submitcheck('mergesubmit')) {

  423.                 include template('topicadmin_merge');

  424.         } else {

  425.                 $query = $db->query("SELECT fid, views, replies FROM $table_threads WHERE tid='$othertid'");
  426.                 if(!$other = $db->fetch_array($query)) {
  427.                         showmessage('admin_merge_nonexistence');
  428.                 }
  429.                 if(!$adminglobal && $other['fid'] != $forum['fid']) {
  430.                         showmessage('admin_merge_invalid');
  431.                 }

  432.                 $other['views'] = intval($other['views']);
  433.                 $other['replies']++;

  434.                 $db->query("UPDATE $table_posts SET tid='$tid' WHERE tid='$othertid'");
  435.                 $postsmerged = $db->affected_rows();

  436.                 $db->query("UPDATE $table_attachments SET tid='$tid' WHERE tid='$othertid'");
  437.                 $db->query("DELETE FROM $table_threads WHERE tid='$othertid'");
  438.                 $db->query("UPDATE $table_threads SET views=views+$other[views], replies=replies+$other[replies] WHERE tid='$tid'");
  439.                
  440.                 if($fid == $other['fid']) {
  441.                         $db->query("UPDATE $table_forums SET threads=threads-1 WHERE fid='$fid' $fupadd");
  442.                 } else {
  443.                         $db->query("UPDATE $table_forums SET threads=threads-1, posts=posts-$postsmerged WHERE fid='$other[fid]'");
  444.                         $db->query("UPDATE $table_forums SET posts=$posts+$postsmerged WHERE fid='$fid' $fupadd");
  445.                 }

  446.                 modlog();
  447.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  448.         }

  449. } else {

  450.         showmessage('admin_nopermission', NULL, 'HALTED');

  451. }

  452. function modlog($action = '') {
  453.         global $discuz_user, $groupid, $adminid, $onlineip, $timestamp, $forum, $thread, $operation, $tids;

  454.         if(!$action) {
  455.                 $action = $GLOBALS['action'];
  456.         }
  457.         if (!$thread['tid']) $thread['tid']=intval($GLOBALS['tid']);
  458.         if ($action == 'moderate'){
  459.                 $action .='_'.$operation;
  460.                 $thread[subject] = $tids;
  461.                 $thread[tid] = 0;
  462.         }
  463.         @$fp = fopen(DISCUZ_ROOT.'./forumdata/modslog.php', 'a');
  464.         @flock($fp, 2);
  465.         @fwrite($fp, "$timestamp\t$discuz_user\t$groupid\t$onlineip\t$forum[fid]\t$forum[name]\t$thread[tid]\t$thread[subject]\t$action\n");
  466.         @fclose($fp);
  467. }

  468. function accesscheck($query) {
  469.         global $db,$fid;
  470.         while($thread = $db->fetch_array($query)) {
  471.                 if($thread['fid'] <> $fid){
  472.                         showmessage('admin_moderate_accesserror', NULL, 'HALTED');
  473.                 }
  474.         }
  475. }

  476. ?>
复制代码



forumdisplay.php

  1. <?php

  2. /*
  3. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4. :: [DISCUZ!]  Crossday Discuz! Board                                    ::
  5. :: (c) 2001-2005 Comsenz Technology Ltd (www.discuz.com)                ::
  6. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7. :: Author:  Crossday (tech@discuz.com) Cnteacher (cnteacher@discuz.com) ::
  8. :: Version: 2.5F   2004/10/01 05:15                                     ::
  9. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10. */
  11. //fix:  BY pk0909
  12. /*
  13. 1 そ???硈钡拜肈
  14. 2 accessmask?拜肈
  15. */

  16. define('CURRSCRIPT',  'forumdisplay');

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

  19. $discuz_action = 2;

  20. if(isset($showoldetails)) {
  21.         switch ($showoldetails) {
  22.                 case 'no': setcookie('onlinedetail', 0, $timestamp + 86400 * 365, $cookiepath, $cookiedomain); break;
  23.                 case 'yes': setcookie('onlinedetail', 1, $timestamp + 86400 * 365, $cookiepath, $cookiedomain); break;
  24.         }
  25. } else {
  26.         $showoldetails = false;
  27. }

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

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

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

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

  50. if(!empty($forum['password']) && $forum['password'] != $_COOKIE["fidpw$fid"]) {
  51.         include template('forumdisplay_passwd');
  52.         exit();
  53. }

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

  56. $postcredits = $forum['postcredits'] != -1 ? $forum['postcredits'] : $postcredits;
  57. $replycredits = $forum['replycredits'] != -1 ? $forum['replycredits'] : $replycredits;

  58. $subexists = 0;
  59. foreach($_DCACHE['forums'] as $sub) {
  60.         if($sub['type'] == 'sub' && $sub['fup'] == $fid && ($accessmasks || !$hideprivate || !$sub['viewperm'] || strstr($sub['viewperm'], "\t$groupid\t") || strstr($sub['users'], "\t$discuz_uid\t"))) {
  61.                 $sublist = array();
  62.                 $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
  63.                                                 LEFT JOIN $table_access a ON a.uid='$discuz_uid' AND a.fid=f.fid
  64.                                                 WHERE fup='$fid' AND status='1' AND type='sub' ORDER BY f.displayorder"
  65.                                         : "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";
  66.                 $query = $db->query($sql);
  67.                 while($sub = $db->fetch_array($query)) {
  68.                         if(forum($sub)) {
  69.                                 $sublist[] = $sub;
  70.                                 $subexists = 1;
  71.                         }
  72.                 }
  73.                 break;
  74.         }
  75. }

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

  78. $announcement_list = array();
  79. if($page == 1  && $_DCACHE['announcements_forum']) {
  80.         foreach($_DCACHE['announcements_forum'] as $ann) {
  81.                 $ann['authorencode'] = rawurlencode($ann['author']);
  82.                 $ann['starttime'] = gmdate("$dateformat $timeformat", $ann['starttime'] + ($timeoffset * 3600));
  83.                 $announcement_list[] = $ann ;
  84.         }
  85. }       

  86. $forumdisplayadd = $filteradd = '';
  87. if(!empty($filter)) {
  88.         if(is_numeric($filter)) {
  89.                 $forumdisplayadd .= "&filter=$filter";
  90.                 $filteradd = "AND lastpost>='".($timestamp - $filter)."'";
  91.         } elseif($filter == 'digest') {
  92.                 $forumdisplayadd .= "&filter=digest";
  93.                 $filteradd = "AND digest>'0'";
  94.         }
  95. } else {
  96.         $filter = '';
  97. }

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


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

  103.         if($detailstatus) {
  104.                 updatesession();
  105.                 @include language('actions');

  106.                 $whosonline = array();
  107.                 $forumname = strip_tags($forum['name']);
  108.                 $query = $db->query("SELECT uid, groupid, username, invisible, lastactivity, action FROM $table_sessions WHERE uid>'0' AND fid='$fid' AND invisible='0'");
  109.                 if($db->num_rows($query)) {
  110.                         $whosonlinestatus = 1;
  111.                         while($online = $db->fetch_array($query)) {
  112.                                 $online['icon'] = isset($_DCACHE['onlinelist'][$online['groupid']]) ? $_DCACHE['onlinelist'][$online['groupid']] : $_DCACHE['onlinelist'][0];
  113.                                 $online['action'] = $actioncode[$online['action']];
  114.                                 $online['lastactivity'] = gmdate($timeformat, $online['lastactivity'] + ($timeoffset * 3600));
  115.                                 $whosonline[] = $online;     
  116.                         }
  117.                 }
  118.                 unset($online);
  119.         }
  120. } else {
  121.         $whosonlinestatus = 0;
  122. }

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

  126. if(!empty($filter)) {
  127.         $query = $db->query("SELECT COUNT(*) FROM $table_threads WHERE fid='$fid' $filteradd");
  128.         $threadcount = $db->result($query, 0);
  129. } else {
  130.         $threadcount = $forum['threads'];
  131. }

  132. $multipage = multi($threadcount, $tpp, $page, "forumdisplay.php?fid=$fid$forumdisplayadd");

  133. $separatepos = 0;
  134. $threadlist = array();
  135. $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  136. $toptids = '0';
  137. $topcount = 0;
  138. if (!$filter && $page == 1) {
  139.         foreach ($_DCACHE['topthreads'] as $topthread) {
  140.                 $toptids .= ',' . $topthread['tid'];
  141.                 $topcount++;
  142.         }
  143. }
  144. if ($topcount) {
  145.         $tfids = '0';
  146.         $tForumArray = array();
  147.         if ($forum['type'] == 'forum') {
  148.                 $groupfid = $forum['fup'];
  149.         } elseif ($forum['type'] == 'sub') {
  150.                 $groupfid = $_DCACHE['forums'][$forum['fup']]['fup'];
  151.         }
  152.         foreach($_DCACHE['forums'] as $key => $value) {
  153.                 if ($value['type'] == 'forum' && $value['fup'] == $groupfid) {
  154.                         $tfids .= ','.$key;
  155.                         $tForumArray[] = $key;
  156.                 }
  157.         }
  158.         foreach($_DCACHE['forums'] as $key => $value) {
  159.                 if ($value['type'] == 'sub' && in_array($value['fup'],$tForumArray)) {
  160.                         $tfids .= ','.$key;
  161.                 }
  162.         }
  163.         $sql = "SELECT t.* FROM $table_threads t
  164.                         WHERE tid IN ($toptids)
  165.                         AND (t.displayorder=3 OR (t.displayorder=2 AND t.fid IN ($tfids)))
  166.                         ORDER BY t.displayorder DESC, t.lastpost DESC";
  167.         $query = $db->query($sql);
  168.         while($thread = $db->fetch_array($query)) {
  169.                 if($thread['attachment']) {
  170.                         require_once DISCUZ_ROOT.'./include/attachment.php';
  171.                 }
  172.                 parseThread();
  173.                 $threadlist[] = $thread;
  174.         }
  175. }

  176. $sql = "SELECT t.* FROM $table_threads t
  177.                         WHERE t.fid='$fid' $filteradd
  178.                         ORDER BY t.displayorder DESC, t.lastpost $ascdesc
  179.                         LIMIT $start_limit, $tpp ";

  180. $query = $db->query($sql);


  181. while($thread = $db->fetch_array($query)) {
  182.         if($thread['attachment']) {
  183.                 require_once DISCUZ_ROOT.'./include/attachment.php';
  184.         }
  185.         if ($thread['displayorder'] < 2 || !$topcount) {
  186.                 parseThread();
  187.                 $threadlist[] = $thread;
  188.         }
  189. }

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

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

  193. $usesigcheck = $signature ? 'checked' : NULL;
  194. $allowpost = (!$forum['postperm'] && $allowpost) || ($forum['postperm'] && strstr($forum['postperm'], "\t$groupid\t")) || $forum['allowpost'];

  195. include template('forumdisplay');
  196. function parseThread() {
  197.         global $thread, $_DCACHE, $postsnum, $ppp, $pagelinks, $topicpages, $string, $colorarray, $dateformat, $timeformat, $timeoffset, $separatepos, $hottopic;
  198.         $thread['icon'] = isset($_DCACHE['icons'][$thread['iconid']]) ? '<img src="'.SMDIR.'/'.$_DCACHE['icons'][$thread['iconid']].'" align="absmiddle">' : '&nbsp;';
  199.         $thread['lastposterenc'] = rawurlencode($thread['lastposter']);

  200.         $postsnum = $thread['replies'] + 1;
  201.         if($postsnum  > $ppp) {
  202.                 $pagelinks = '';
  203.                 $topicpages = ceil($postsnum / $ppp);
  204.                 for ($i = 1; $i <= $topicpages; $i++) {
  205.                         $pagelinks .= "<a href="viewthread.php?tid=$thread[tid]&page=$i&fpage=$page">$i</a> ";
  206.                         if($i == 6) {
  207.                                 $i = $topicpages + 1;
  208.                         }
  209.                 }
  210.                 if($topicpages > 6) {
  211.                         $pagelinks .= " .. <a href="viewthread.php?tid=$thread[tid]&page=$topicpages&fpage=$page">$topicpages</a> ";
  212.                 }
  213.                 $thread['multipage'] = '&nbsp; &nbsp;( <img src="'.IMGDIR.'/multipage.gif" align="absmiddle" boader="0"> '.$pagelinks.')';
  214.         } else {
  215.                 $thread['multipage'] = '';
  216.         }

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

  220.                 $thread['highlight'] = 'style="';
  221.                 $thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  222.                 $thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  223.                 $thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  224.                 $thread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  225.                 $thread['highlight'] .= '"';
  226.         } else {
  227.                 $thread['highlight'] = '';
  228.         }

  229.         if($thread['closed']) {
  230.                 $thread['new'] = 0;
  231.                 if($thread['closed'] > 1) {
  232.                         $thread['moved'] = $thread['tid'];
  233.                         $thread['tid'] = $thread['closed'];
  234.                         $thread['replies'] = '-';
  235.                         $thread['views'] = '-';
  236.                 } else {
  237.                         $thread['moved'] = 0;
  238.                 }
  239.                 $thread['folder'] = 'lock_folder.gif';
  240.         } else {
  241.                 $thread['folder'] = 'folder.gif';
  242.                 if($lastvisit < $thread['lastpost'] && !strstr($_COOKIE['oldtopics'], "\t$thread[tid]\t")) {
  243.                         $thread['new'] = 1;
  244.                         $thread['folder'] = 'red_'.$thread['folder'];
  245.                 } else {
  246.                         $thread['new'] = 0;
  247.                 }
  248.                 if($thread['replies'] > $thread['views']) {
  249.                         $thread['views'] = $thread['replies'];
  250.                 }
  251.                 if($thread['replies'] >= $hottopic) {
  252.                         $thread['folder'] = 'hot_'.$thread['folder'];
  253.                 }
  254.         }

  255.         if($thread['attachment']) {
  256.                 $thread['attachment'] = attachtype($thread['attachment']).' ';
  257.         } else {
  258.                 $thread['attachment'] = '';
  259.         }
  260.         $thread[subject] = cutstr($thread[subject],77);
  261.         $thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600);
  262.         $thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);

  263.         if($thread['displayorder'] > 0) {
  264.                 $separatepos++;
  265.         }
  266. }

  267. ?>
复制代码
回复

使用道具 举报

 楼主| lu5266 发表于 2005-11-11 16:27:02 | 显示全部楼层

回复 #279 西龙 的帖子

topicadmin.php


  1. <?php

  2. /*
  3. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4. :: [DISCUZ!]  Crossday Discuz! Board                                    ::
  5. :: (c) 2001-2005 Comsenz Technology Ltd (www.discuz.com)                ::
  6. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7. :: Author:  Crossday (tech@discuz.com) Cnteacher (cnteacher@discuz.com) ::
  8. :: Version: 2.5F   2004/10/01 05:15                                     ::
  9. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10. */
  11. //fix:  BY pk0909
  12. /*
  13. 1 癸だ澄???肈?ぶhtml锣竡矪瞶
  14. 2 铬锣?url把计拜肈
  15. 3 у秖?埃?肈??⊿Τ?埃癸莱?ン
  16. */

  17. require './include/common.php';
  18. require_once DISCUZ_ROOT.'./include/post.php';
  19. //pk top hack 2005-3-20
  20. require_once DISCUZ_ROOT.'./include/cache.php';

  21. $discuz_action = 151;

  22. $tid   = $tid ? $tid :'';
  23. $page  = intval($page);
  24. $fpage = intval($fpage);

  25. if($tid) {
  26.         $query = $db->query("SELECT * FROM $table_threads WHERE tid='$tid'");
  27.         $thread = $db->fetch_array($query);
  28.         $thread['subject'] .= $action == 'delthread' ? ", etc." : NULL;
  29. }

  30. if($forum['type'] == 'forum') {
  31.         $navigation = "&raquo; <a href="forumdisplay.php?fid=$fid&page=$fpage">$forum[name]</a> &raquo; <a href="viewthread.php?tid=$tid">$thread[subject]</a> ";
  32.         $navtitle = ' - '.strip_tags($forum['name']).' - '.$thread['subject'];
  33. } else {
  34.         $query = $db->query("SELECT name, fid, moderator FROM $table_forums WHERE fid='$forum[fup]'");
  35.         $fup = $db->fetch_array($query);
  36.         $navigation = "&raquo; <a href="forumdisplay.php?fid=$fup[fid]">$fup[name]</a> &raquo; <a href="forumdisplay.php?fid=$fid&page=$fpage">$forum[name]</a> &raquo; <a href="viewthread.php?tid=$tid">$thread[subject]</a> ";
  37.         $navtitle = ' - '.strip_tags($fup['name']).' - '.strip_tags($forum['name']).' - '.$thread['subject'];
  38. }

  39. if(!$discuz_user || !$discuz_pw || !modcheck($discuz_user)) {
  40.         showmessage('admin_nopermission', NULL, 'HALTED');
  41. }

  42. $fupadd = $fup ? "OR (fid='$fup[fid]' && type<>'group')" : NULL;

  43. if($action == 'moderate') {
  44.         if(!is_array($moderate) || !count($moderate)) {
  45.                 showmessage('admin_moderate_nothread');
  46.         }elseif(!$operation){
  47.                 showmessage('admin_moderate_nooperation');
  48.         }
  49.         $tids = implode_ids($moderate);
  50.         $query = $db->query("SELECT * FROM $table_threads WHERE tid IN($tids) ");
  51.         if(!submitcheck('moderatesubmit')){
  52.                 $threadlist = array();
  53.                 while($thread = $db->fetch_array($query)) {
  54.                         if($thread['fid'] == $fid){
  55.                                 $thread['lastposterenc'] = rawurlencode($thread['lastposter']);
  56.                                 if($thread['attachment']) {
  57.                                         require_once DISCUZ_ROOT.'./include/attachment.php';
  58.                                         $thread['attachment'] = attachtype($thread['attachment']).' ';
  59.                                 } else {
  60.                                         $thread['attachment'] = '';
  61.                                 }
  62.                                 $thread[subject] = cutstr($thread[subject],77);
  63.                                 $thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600);
  64.                                 $thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);
  65.                                 $threadlist[] = $thread;
  66.                         }
  67.                 }
  68.                
  69.                 if(!$threadlist) showmessage('admin_moderate_nothread');

  70.                 if($operation == 'move') {
  71.                         require_once DISCUZ_ROOT.'./include/forum.php';
  72.                         $forumselect = forumselect();
  73.                 }
  74.                 include template('topicadmin_moderate');
  75.         
  76.         }else{
  77.         
  78.                 if($operation == 'move' && $allowmove) {
  79.                         if(!$moveto) {
  80.                                 showmessage('admin_move_invalid');
  81.                         }

  82.                         accesscheck($query);

  83.                         $displayorderadd = !$adminglobal ? ", displayorder='0'" : NULL;

  84.                         $db->query("UPDATE $table_threads SET fid='$moveto' $displayorderadd WHERE tid IN($tids)");
  85.                         $db->query("UPDATE $table_posts SET fid='$moveto' WHERE tid IN($tids) ");

  86.                         if ($forum['type'] == 'sub') {
  87.                                 $query= $db->query("SELECT fup FROM $table_forums WHERE fid='$fid' LIMIT 1");
  88.                                 $fup = $db->result($query, 0);
  89.                                 updateforumcount($fup);
  90.                         }
  91.                         modlog();
  92.                         updateforumcount($moveto);
  93.                         updateforumcount($fid);
  94.                         showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$page");

  95.                 }elseif($operation == 'stick' && $allowtop){
  96.                         accesscheck($query);
  97.                         if($level < 0 || $level > 3 || ($level == 2 && $adminid != 1 && $adminid != 2) || ($level == 3 && $adminid != 1)) {
  98.                                 showmessage('undefined_action');
  99.                         }
  100.                         $db->query("UPDATE $table_threads SET displayorder='$level' WHERE tid IN ($tids)");
  101.                      //pk top hack 2005-3-20
  102. if ($level < 2) {
  103.         $db->query("DELETE FROM {$tablepre}topthreads WHERE tid IN ($tids)");
  104.         if ($db->affected_rows()) updatecache('topthreads');
  105. } else {
  106.         $tidArray = explode(',', $tids);
  107.         foreach ($tidArray as $tmp) {
  108.                 $db->query("INSERT INTO {$tablepre}topthreads (tid) VALUES ($tmp)", 'SILENT');
  109.         }
  110.         updatecache('topthreads');
  111. }
  112.                         modlog();
  113.                         showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$page");

  114.                 }elseif($operation == 'delete' && $allowdelpost) {
  115.                         accesscheck($query);
  116.                         $uids = $comma = '';
  117.                         $haveattach = 0;
  118.                         $query = $db->query("SELECT authorid ,aid FROM $table_posts WHERE tid IN ($tids)");
  119.                         while($post = $db->fetch_array($query)) {
  120.                                 $uids .= "$comma$post[authorid]";
  121.                                 $comma = ',';
  122.                                 if ($post['aid']) $haveattach++;
  123.                         }
  124.                         updatemember('-', $uids, $deletedcredits);

  125.                         if ($haveattach){
  126.                                 $query = $db->query("SELECT attachment FROM $table_attachments WHERE tid IN ($tids)");
  127.                                 while($attach = $db->fetch_array($query)) {
  128.                                         @unlink(DISCUZ_ROOT.'./'.$attachdir.'/'.$attach['attachment']);
  129.                                 }
  130.                                 $db->query("DELETE FROM $table_attachments WHERE tid IN ($tids)");
  131.                         }
  132.                         
  133.                         $db->query("DELETE FROM $table_threads WHERE tid IN ($tids)");
  134.                         $db->query("DELETE FROM $table_polls WHERE tid IN ($tids)");
  135.                         $db->query("DELETE FROM $table_posts WHERE tid IN ($tids)");
  136.                      //pk top hack 2005-3-20
  137. $db->query("DELETE FROM {$tablepre}topthreads WHERE tid IN ($tids)");
  138. if ($db->affected_rows()) updatecache('topthreads');

  139.                         updateforumcount($fid);

  140.                         modlog();
  141.                         showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$page");

  142.                 }elseif($operation == 'close' && $allowclose){
  143.                         accesscheck($query);
  144.                         $close = $type ? 1 : 0;
  145.                         $db->query("UPDATE $table_threads SET closed='$close' WHERE tid in($tids)");
  146.                         modlog();
  147.                         showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$page");

  148.                 }elseif($operation == 'digest' && $allowdigest){
  149.                         if($level < 0 || $level > 3) {
  150.                                 showmessage('undefined_action', NULL, 'HALTED');
  151.                         }
  152.                         while($thread = $db->fetch_array($query)) {
  153.                                 if ($thread['fid'] == $fid && $thread['digest']<>$level){
  154.                                         $digest_mark=($level-intval($thread['digest']))*$digestcredits;
  155.                                         $db->query("UPDATE $table_threads SET digest='$level' WHERE tid='$thread[tid]'");
  156.                                         if($digest_mark && $discuz_uid != $thread[authorid]) {
  157.                                                 $db->query("UPDATE $table_members SET credit=credit".($digest_mark > 0 ? '+' : '')."$digest_mark WHERE uid='$thread[authorid]'");
  158.                                         }
  159.                                 }
  160.                         }
  161.                         modlog();
  162.                         showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$page");
  163.                 }else{
  164.                         showmessage('admin_nopermission', NULL, 'HALTED');
  165.                 }
  166.         }

  167. } elseif($action == 'delpost' && $allowdelpost) {

  168.         if(!is_array($delete) || !count($delete)) {
  169.                 showmessage('admin_delpost_invalid');
  170.         }

  171.         if(!submitcheck('delpostsubmit')) {

  172.                 $query = $db->query("SELECT COUNT(*) FROM $table_posts WHERE tid='$tid'");
  173.                 if(count($delete) < $db->result($query, 0)) {

  174.                         $deleteid = '';
  175.                         foreach($delete as $id) {
  176.                                 $deleteid .= '<input type="hidden" name="delete[]" value="'.$id.'">';
  177.                         }

  178.                         include template('topicadmin_delpost');
  179.                         
  180.                 } else {
  181.                         header("Location: {$boardurl}topicadmin.php?action=delete&fid=$fid&tid=$tid&page=$page&fpage=$fpage");
  182.                 }

  183.         } else {

  184.                 $pids = implode_ids( $delete );

  185.                 $uids = $comma = '';
  186.                 $actionpost = $totalpost = $aids = 0;
  187.                 $query = $db->query("SELECT pid, authorid, aid FROM $table_posts WHERE tid='$tid'");
  188.                 $totalpost = $db->num_rows($query);
  189.                 while($post = $db->fetch_array($query)) {
  190.                         if (in_array($post[pid], $delete)){
  191.                                 $uids .= "$comma$post[authorid]";
  192.                                 $comma = ',';
  193.                                 $actionpost ++;
  194.                                 if ($post['aid']) $aids .=','.$post[pid];
  195.                         }
  196.                 }

  197.                 if ($actionpost < 1) {
  198.                         showmessage('admin_delpost_invalid');
  199.                 }elseif($actionpost <> count($delete)){
  200.                         showmessage('admin_moderate_accesserror', NULL, 'HALTED');
  201.                 }elseif($actionpost >= $totalpost ){
  202.                         header("Location: {$boardurl}topicadmin.php?action=delete&fid=$fid&tid=$tid&page=$page&fpage=$fpage");
  203.                 }
  204.                
  205.                 updatemember('-', $uids, $deletedcredits);

  206.                 if ($aids){
  207.                         require_once DISCUZ_ROOT.'./include/attachment.php';
  208.                         $query = $db->query("SELECT pid, attachment, filetype FROM $table_attachments WHERE pid IN ($aids)");
  209.                         while($attach = $db->fetch_array($query)) {
  210.                                         @unlink(DISCUZ_ROOT.'./'.$attachdir.'/'.$attach['attachment']);
  211.                         }
  212.                         $db->query("DELETE FROM $table_attachments WHERE pid IN ($aids)");
  213.                         updatethread_type($tid , $thread['attachment']);
  214.                 }

  215.                 $db->query("DELETE FROM $table_posts WHERE pid IN ($pids)");
  216.                 updatethreadcount($tid);
  217.                 updateforumcount($fid);

  218.                 modlog();
  219.                 showmessage('admin_succeed', "viewthread.php?tid=$tid&page=$page&fpage=$fpage");

  220.         }

  221. } elseif($action == 'highlight' && $allowhighlight) {
  222.         if(!submitcheck('highlightsubmit')) {

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

  225.                 for($i = 1; $i <= 3; $i++) {
  226.                         $stylecheck[$i] = $stylestr[$i - 1] ? 'checked' : NULL;
  227.                 }
  228.                 $colorcheck = array($string[1] => 'checked');
  229.                
  230.                 include template('topicadmin_highlight');

  231.         } else {

  232.                 $stylebin = '';
  233.                 for($i = 1; $i <= 3; $i++) {
  234.                         $stylebin .= empty($highlight_style[$i]) ? '0' : '1';
  235.                 }
  236.                 $highlight_style = bindec($stylebin);

  237.                 if($highlight_style < 0 || $highlight_style > 7 || $highlight_color < 0 || $highlight_color > 8) {
  238.                         showmessage('undefined_action', NULL, 'HALTED');
  239.                 }
  240.                 $db->query("UPDATE $table_threads SET highlight='$highlight_style$highlight_color' WHERE tid='$tid'");

  241.                 modlog();
  242.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  243.         }

  244. }
  245. //=====十种自定义参数标题醒目+任意颜色高亮==start==By www.5466.ik8.com==============
  246. elseif($action == 'xm_highlight' && $allowhighlight) {
  247.         if(!submitcheck('xm_highlightsubmit')) {
  248.       
  249.                 $xm_hl_string=explode(',',$thread['xm_hl']);
  250.                
  251.                 for($i = 1; $i <=10; $i++) {
  252.                         $xu_check[$i] =$i==$xm_hl_string[0] ?  'checked' : NULL;
  253.                                                                         
  254.            }

  255.           if($xm_hl_string[0]){            
  256.            switch($xm_hl_string[0]){
  257.            
  258.            case 1: $xm_id_11=$xm_hl_string[1];$xm_id_12=$xm_hl_string[2];$xm_id_13=$xm_hl_string[3];$xm_id_14=$xm_hl_string[4];
  259.                    break;                                    
  260.            
  261.            case 2:
  262.                    $xm_id_21=$xm_hl_string[1];$xm_id_22=$xm_hl_string[2];$xm_id_23=$xm_hl_string[3];$xm_id_24=$xm_hl_string[4];                  
  263.                    break;
  264.                               
  265.            case 3:
  266.                    $xm_id_31=$xm_hl_string[1];$xm_id_32=$xm_hl_string[2];$xm_id_33=$xm_hl_string[3];$xm_id_34=$xm_hl_string[4];                           
  267.                    break;           
  268.            
  269.            case 4:
  270.                    $xm_id_41=$xm_hl_string[1];$xm_id_42=$xm_hl_string[2];$xm_id_43=$xm_hl_string[3];$xm_id_44=$xm_hl_string[4];                     
  271.                    break;           
  272.                      
  273.            case 5:
  274.                    $xm_id_51=$xm_hl_string[1];$xm_id_52=$xm_hl_string[2];               
  275.                    break;   
  276.            
  277.            case 6:
  278.                    $xm_id_61=$xm_hl_string[1];$xm_id_62=$xm_hl_string[2];$xm_id_63=$xm_hl_string[3];                             
  279.                    break;
  280.            case 7:
  281.                    $xm_id_71=$xm_hl_string[1];$xm_id_72=$xm_hl_string[2];$xm_id_73=$xm_hl_string[3];                             
  282.                    break;
  283.            case 8:
  284.                    $xm_id_81=$xm_hl_string[1];$xm_id_82=$xm_hl_string[2];$xm_id_83=$xm_hl_string[3];                             
  285.                    break;
  286.            case 9:
  287.                    $xm_id_91=$xm_hl_string[1];$xm_id_92=$xm_hl_string[2];                             
  288.                    break;                                                           
  289.                      
  290.            default: break;         
  291.               }
  292.            
  293.            }
  294.         include template('topicadmin_xm_highlight');

  295.         } else {

  296.                 $xm_hl_str = '';
  297.                
  298.                 if($xm_hl_id==1){$xm_hl_str=$xm_hl_id.','.$font_color.','.$font_size.','.$font_style.','.$font_underline;
  299.                
  300.                 }
  301.                
  302.                 else if($xm_hl_id==2){$xm_hl_str=$xm_hl_id.','.$text_color1.','.$text_color2.','.$speed_1.','.$pause_1;
  303.                
  304.                 }
  305.                
  306.                 else if($xm_hl_id==3){ $xm_hl_str=$xm_hl_id.','.$textoffset1.','.$textoffset2.','.$speed_2.','.$pause_2;
  307.                
  308.                 }
  309.                
  310.                 else if($xm_hl_id==4){ $xm_hl_str=$xm_hl_id.','.$textcolor.','.$textsize1.','.$speed_3.','.$pause_3;
  311.                
  312.                 }
  313.                
  314.                 else if($xm_hl_id==5){ $xm_hl_str=$xm_hl_id.','.$sider_color.','.$text_color;
  315.                  
  316.                 }
  317.                
  318.                 else if($xm_hl_id==6){ $xm_hl_str=$xm_hl_id.','.$start_color.','.$start_n.','.$end_color;
  319.                  
  320.                 }
  321.                 else if($xm_hl_id==7){ $xm_hl_str=$xm_hl_id.','.$glow_color1.','.$glow_pow.','.$glow_color2;
  322.                  
  323.                 }
  324.                 else if($xm_hl_id==8){ $xm_hl_str=$xm_hl_id.','.$shadow_color1.','.$shadow_view.','.$shadow_color2;
  325.                  
  326.                 }
  327.                 else if($xm_hl_id==9){ $xm_hl_str=$xm_hl_id.','.$bg_color.','.$face_color;
  328.                  
  329.                 }                                                        
  330.                 else if($xm_hl_id==10){ $xm_hl_str=$xm_hl_id;
  331.                  
  332.                 }                        
  333.                
  334.                 else if($xm_hl_id==11){ $xm_hl_str='';
  335.                
  336.                 }        
  337.                         
  338.                 else showmessage('undefined_action');
  339.                
  340.                
  341.                 if(strlen($xm_hl_str)>25){ $xm_hl_str=substr($xm_hl_str,0, 25);}
  342.                
  343.                
  344.                 $db->query("UPDATE $table_threads SET xm_hl='$xm_hl_str' WHERE tid='$tid'");

  345.                 modlog();
  346.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");
  347.    
  348.         }

  349. }

  350. //=====十种自定义参数标题醒目+任意颜色高亮==end==By lu5266=====================
  351. elseif($action == 'digest' && $allowdigest) {
  352.         if(!submitcheck('digestsubmit')) {

  353.                 include template('topicadmin_digest');

  354.         } else {

  355.                 if($level < 0 || $level > 3) {
  356.                         showmessage('undefined_action', NULL, 'HALTED');
  357.                 }
  358.                 $digest_mark=($level-intval($thread['digest']))*$digestcredits;

  359.                 $db->query("UPDATE $table_threads SET digest='$level' WHERE tid='$tid'");

  360.                 if($digest_mark && $discuz_uid != $thread['authorid'] ) {
  361.                         $db->query("UPDATE $table_members SET credit=credit".($digest_mark > 0 ? '+' : '')."$digest_mark WHERE uid='$thread[authorid]'");
  362.                 }
  363.                 modlog();
  364.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  365.         }

  366. } elseif($action == 'recount') {

  367.         $query = $db->query("SELECT COUNT(*) FROM $table_posts WHERE tid='$tid'");
  368.         $replies = $db->result($query, 0) - 1;

  369.         $query  = $db->query("SELECT author, dateline FROM $table_posts WHERE tid='$tid' ORDER BY dateline DESC LIMIT 1");
  370.         $post = $db->fetch_array($query);

  371.         $db->query("UPDATE $table_threads SET replies='$replies', lastpost='$post[dateline]', lastposter='".addslashes($post['author'])."' WHERE tid='$tid'");
  372.         showmessage('admin_succeed', "viewthread.php?tid=$tid&fpage=$fpage");

  373. } elseif($action == 'delete'  && $allowdelpost) {
  374.         if(!submitcheck('deletesubmit')) {

  375.                 include template('topicadmin_delete');

  376.         } else {

  377.                 $uids = $comma = '';
  378.                 $query = $db->query("SELECT authorid,aid FROM $table_posts WHERE tid='$tid'");
  379.                 $aids = 0;
  380.                 while($post = $db->fetch_array($query)) {
  381.                         $uids .= "$comma$post[authorid]";
  382.                         $comma = ',';
  383.                         if ($post['aid']) $aids++;
  384.                 }
  385.                 updatemember('-', $uids, $deletedcredits);

  386.                 $db->query("DELETE FROM $table_threads WHERE tid='$tid'");
  387.                 $db->query("DELETE FROM $table_posts WHERE tid='$tid'");
  388.                
  389.                 if ($aids){
  390.                         $query = $db->query("SELECT attachment FROM $table_attachments WHERE tid='$tid'");
  391.                         while($attach = $db->fetch_array($query)) {
  392.                                 @unlink(DISCUZ_ROOT.'./'.$attachdir.'/'.$attach['attachment']);
  393.                         }
  394.                         $db->query("DELETE FROM $table_attachments WHERE tid='$tid'");
  395.                 }
  396.                
  397.                 updateforumcount($fid);
  398.                 if ($forum['type'] == 'sub') {
  399.                         updateforumcount($fup['fid']);
  400.                 }

  401.                 modlog();
  402.               //pk top hack 2005-3-20
  403. $db->query("DELETE FROM {$tablepre}topthreads WHERE tid='$tid'");
  404. if ($db->affected_rows()) updatecache('topthreads');
  405.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  406.         }

  407. } elseif($action == 'close' && $allowclose) {

  408.         if(!submitcheck('closesubmit')) {

  409.                 include template('topicadmin_openclose');

  410.         } else {
  411.                 $openclose = $thread['closed'] ? 0 : 1;
  412.                 $db->query("UPDATE $table_threads SET closed='$openclose' WHERE tid='$tid' AND fid='$fid'");
  413.                 modlog();
  414.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");
  415.         }

  416. } elseif($action == 'move'  && $allowmove) {

  417.         if(!submitcheck('movesubmit')) {

  418.                 require_once DISCUZ_ROOT.'./include/forum.php';

  419.                 $forumselect = forumselect();
  420.                 include template('topicadmin_move');

  421.         } else {

  422.                 if(!$moveto) {
  423.                         showmessage('admin_move_invalid');
  424.                 }

  425.                 $displayorderadd = !$adminglobal ? ", displayorder='0'" : NULL;
  426.                 if($type == 'normal') {
  427.                         $db->query("UPDATE $table_threads SET fid='$moveto' $displayorderadd WHERE tid='$tid' AND fid='$fid'");
  428.                         $db->query("UPDATE $table_posts SET fid='$moveto' WHERE tid='$tid' AND fid='$fid'");
  429.                 } else {
  430.                         $db->query("INSERT INTO $table_threads (fid, creditsrequire, iconid, author, authorid, subject, dateline, lastpost, lastposter, views, replies, displayorder, digest, closed, poll, attachment)
  431.                                 VALUES ('$thread[fid]', '$thread[creditsrequire]', '$thread[iconid]', '".addslashes($thread['author'])."', '$thread[authorid]', '$thread[subject]', '$thread[dateline]', '$thread[lastpost]', '$thread[lastposter]', '0', '0', '0', '0', '$thread[tid]', '0', '0')");

  432.                         $db->query("UPDATE $table_threads SET fid='$moveto' $displayorderadd WHERE tid='$tid' AND fid='$fid'");
  433.                         $db->query("UPDATE $table_posts SET fid='$moveto' WHERE tid='$tid' AND fid='$fid'");
  434.                 }

  435.                 if ($forum['type'] == 'sub') {
  436.                         $query= $db->query("SELECT fup FROM $table_forums WHERE fid='$fid' LIMIT 1");
  437.                         $fup = $db->result($query, 0);
  438.                         updateforumcount($fup);
  439.                 }

  440.                 modlog();
  441.                 updateforumcount($moveto);
  442.                 updateforumcount($fid);
  443.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");
  444.         }

  445. } elseif($action == 'top' && $allowtop) {

  446.         if(!submitcheck('topsubmit')) {

  447.                 include template('topicadmin_topuntop');

  448.         } else {

  449.                 if($level < 0 || $level > 3 || ($level == 2 && $adminid != 1 && $adminid != 2) || ($level == 3 && $adminid != 1)) {
  450.                         showmessage('undefined_action');
  451.                 }
  452.                 $db->query("UPDATE $table_threads SET displayorder='$level' WHERE tid='$tid' AND fid='$fid'");

  453.                 modlog();
  454.               //pk top hack 2005-3-20
  455. if ($level > 1) {
  456.         $db->query("INSERT INTO {$tablepre}topthreads (tid) VALUES ('$tid')", 'SILENT');
  457.         updatecache('topthreads');
  458. } else {
  459.         $db->query("DELETE FROM {$tablepre}topthreads WHERE tid='$tid'");
  460.         if ($db->affected_rows()) updatecache('topthreads');
  461. }
  462.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  463.         }

  464. } elseif($action == 'getip' && $allowviewip) {

  465.         require_once DISCUZ_ROOT.'./include/misc.php';

  466.         $query = $db->query("SELECT m.adminid, p.useip FROM $table_posts p
  467.                                 LEFT JOIN $table_members m ON m.uid=p.authorid
  468.                                 WHERE pid='$pid' AND tid='$tid'");
  469.         if(!$member = $db->fetch_array($query)) {
  470.                 showmessage('thread_nonexistence', NULL, 'HALTED');
  471.         } elseif(($member['adminid'] == 1 && $adminid > 1) || ($member['adminid'] == 2 && $adminid > 2)) {
  472.                 showmessage('admin_getip_nopermission', NULL, 'HALTED');
  473.         }

  474.         $member['iplocation'] = convertip($member['useip']);

  475.         include template('topicadmin_getip');

  476. } elseif($action == 'bump') {

  477.         if(!submitcheck('bumpsubmit')) {

  478.                 include template('topicadmin_bump');

  479.         } else {

  480.                 $query = $db->query("SELECT subject, lastposter, lastpost FROM $table_threads WHERE tid='$tid' LIMIT 1");
  481.                 $thread = $db->fetch_array($query);
  482.                 $thread[lastposter] = addslashes($thread['lastposter']);
  483.                 $db->query("UPDATE $table_threads SET lastpost='$timestamp' WHERE tid='$tid' AND fid='$fid'");
  484.                 $db->query("UPDATE $table_forums SET lastpost='$thread[subject]\t$timestamp\t$thread[lastposter]' WHERE fid='$fid' $fupadd");

  485.                 modlog();
  486.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  487.         }

  488. } elseif($action == 'split' && $allowsplit) {

  489.         if(!submitcheck('splitsubmit')) {

  490.                 require_once DISCUZ_ROOT.'./include/discuzcode.php';

  491.                 $replies = $thread['replies'];
  492.                 if($replies <= 0) {
  493.                         showmessage('admin_split_invalid');
  494.                 }

  495.                 $postlist = array();
  496.                 $query = $db->query("SELECT * FROM $table_posts WHERE tid='$tid' ORDER BY dateline");
  497.                 while($post = $db->fetch_array($query)) {
  498.                         $post['message'] = postify($post['message'], $post['smileyoff'], $post['bbcodeoff']);
  499.                         $postlist[] = $post;
  500.                 }

  501.                 include template('topicadmin_split');

  502.         } else {

  503.                 if(!trim($subject)) {
  504.                         showmessage('admin_split_subject_invalid');
  505.                 }
  506.                 $subject = $subject ? dhtmlspecialchars(censor(trim($subject))) :'';

  507.                 $pids = implode_ids( $split );

  508.                 if($pids) {

  509.                         $db->query("INSERT INTO $table_threads (fid, subject) VALUES ('$fid', '$subject')");
  510.                         $newtid = $db->insert_id();

  511.                         $db->query("UPDATE $table_posts SET tid='$newtid' WHERE pid IN ($pids)");
  512.                         $db->query("UPDATE $table_attachments SET tid='$newtid' WHERE pid IN ($pids)");

  513.                         $query = $db->query("SELECT author, authorid, dateline FROM $table_posts WHERE tid='$tid' ORDER BY dateline ASC LIMIT 1");
  514.                         $fpost = $db->fetch_array($query);
  515.                         $db->query("UPDATE $table_threads SET author='$fpost[author]', authorid='$fpost[authorid]', dateline='$fpost[dateline]' WHERE tid='$tid'");

  516.                         $query = $db->query("SELECT author, authorid, dateline FROM $table_posts WHERE tid='$newtid' ORDER BY dateline ASC LIMIT 1");
  517.                         $fpost = $db->fetch_array($query);
  518.                         $db->query("UPDATE $table_threads SET author='$fpost[author]', authorid='$fpost[authorid]', dateline='$fpost[dateline]' WHERE tid='$newtid'");

  519.                         updatethreadcount($tid);
  520.                         updatethreadcount($newtid);
  521.                         updateforumcount($fid);

  522.                         modlog();
  523.                         showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  524.                 } else {
  525.                         showmessage('admin_split_new_invalid');
  526.                 }
  527.         }

  528. } elseif($action == 'merge' && $allowmerge) {

  529.         if(!submitcheck('mergesubmit')) {

  530.                 include template('topicadmin_merge');

  531.         } else {

  532.                 $query = $db->query("SELECT fid, views, replies FROM $table_threads WHERE tid='$othertid'");
  533.                 if(!$other = $db->fetch_array($query)) {
  534.                         showmessage('admin_merge_nonexistence');
  535.                 }
  536.                 if(!$adminglobal && $other['fid'] != $forum['fid']) {
  537.                         showmessage('admin_merge_invalid');
  538.                 }

  539.                 $other['views'] = intval($other['views']);
  540.                 $other['replies']++;

  541.                 $db->query("UPDATE $table_posts SET tid='$tid' WHERE tid='$othertid'");
  542.                 $postsmerged = $db->affected_rows();

  543.                 $db->query("UPDATE $table_attachments SET tid='$tid' WHERE tid='$othertid'");
  544.                 $db->query("DELETE FROM $table_threads WHERE tid='$othertid'");
  545.                 $db->query("UPDATE $table_threads SET views=views+$other[views], replies=replies+$other[replies] WHERE tid='$tid'");
  546.                
  547.                 if($fid == $other['fid']) {
  548.                         $db->query("UPDATE $table_forums SET threads=threads-1 WHERE fid='$fid' $fupadd");
  549.                 } else {
  550.                         $db->query("UPDATE $table_forums SET threads=threads-1, posts=posts-$postsmerged WHERE fid='$other[fid]'");
  551.                         $db->query("UPDATE $table_forums SET posts=$posts+$postsmerged WHERE fid='$fid' $fupadd");
  552.                 }

  553.                 modlog();
  554.                 showmessage('admin_succeed', "forumdisplay.php?fid=$fid&page=$fpage");

  555.         }

  556. } else {

  557.         showmessage('admin_nopermission', NULL, 'HALTED');

  558. }

  559. function modlog($action = '') {
  560.         global $discuz_user, $groupid, $adminid, $onlineip, $timestamp, $forum, $thread, $operation, $tids;

  561.         if(!$action) {
  562.                 $action = $GLOBALS['action'];
  563.         }
  564.         if (!$thread['tid']) $thread['tid']=intval($GLOBALS['tid']);
  565.         if ($action == 'moderate'){
  566.                 $action .='_'.$operation;
  567.                 $thread[subject] = $tids;
  568.                 $thread[tid] = 0;
  569.         }
  570.         @$fp = fopen(DISCUZ_ROOT.'./forumdata/modslog.php', 'a');
  571.         @flock($fp, 2);
  572.         @fwrite($fp, "$timestamp\t$discuz_user\t$groupid\t$onlineip\t$forum[fid]\t$forum[name]\t$thread[tid]\t$thread[subject]\t$action\n");
  573.         @fclose($fp);
  574. }

  575. function accesscheck($query) {
  576.         global $db,$fid;
  577.         while($thread = $db->fetch_array($query)) {
  578.                 if($thread['fid'] <> $fid){
  579.                         showmessage('admin_moderate_accesserror', NULL, 'HALTED');
  580.                 }
  581.         }
  582. }

  583. ?>
复制代码
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-29 23:07 , Processed in 0.125090 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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