<?php
/*
\* ===========================================
\* 项目: CTB文本论坛
\* 版本: 1.3 
\* 团队: 实易数码
\* 小组: CTB文本论坛小组
\* 作者: 16hot，险情
\* 功能: 版主功能模块
\* ===========================================
\* Copyright (c) 2002 
\* 团队主页: http://www.11cn.org
\* 团队信箱: ------------------
\* 创建日期: 2002.6
\* 修改日期: 2003-4-10
\* 修改说明: 代码整理/优化
\* 版权声明: 这个程序是免费软件.
\* ===========================================
*/


class Module extends CommonClass
{
    
    /**
     *构造函数
     *2002-5-4
     */
    function execute()
    {

        $check = "0";
        $this->file = $this->set[dataPath]."/forums.php";
        $forum = $this->select_line("2",$this->input['forumid']);
        if ($forum[8] != "") {
            $moderators = explode("|",$forum[8]);
            foreach ($moderators as $modId) {
                $modInfo = explode(",",$modId);
                $mod = $modInfo[0];
                if ($mod == $this->sess['sess_uid'] && session_is_registered('sess_ugrade')) {
                    $check  = "1";
                }
            }
        }
        if ($this->sess['sess_ugrade'] == '1' && session_is_registered('sess_ugrade')) {
            $check = "1";
        }

        if ($check == "0") {
			$this->manageLog();
            $this->showMsg("您无权管理这个版块,若想管理，请联系管理员","./index.php?mods=forumdisplay&forumid={$this->input['forumid']}");
        }
        switch($this->input['action']) {
            case 'del':
                $this->showMsg("你确定要删除这个主题吗？","ask");
                break;
            case 'del2':
                $this->mod_del2();
                break;
            case 'addGrade':
                $this->showMsg("你确定要给这个帖子加分吗？","ask");
                break;
            case 'addGrade2':
                $this->addGrade2();
                break;
            case 'top':
                $this->showMsg("你确定要将这个帖子进行置顶操作吗？","ask");
                break;
            case 'top2':
                $this->top2();
                break;
            case 'close':
                $this->showMsg("你确定要将这个帖子进行锁定操作吗？","ask");
                break;
            case 'close2':
                $this->close2();
                break;
            case 'edit':
                $this->showMsg("你确定要将这个帖子主题进行编辑吗？","ask");
                break;
            case 'edit2':
                $this->edit2();
                break;
            case 'top_go':
                $this->showMsg("你确定要将这个帖子主题进行提前吗？","ask");
                break;
            case 'top_go2':
                $this->top_go2();
                break;
            case 'del_go':
                $this->showMsg("你确定要将本主题所有回帖全部删除吗？","ask");
                break;
            case 'del_go2':
                $this->del_go2();
                break;
            case 'move':
                $this->file = $this->set[dataPath]."/forums.php";
                $forums = $this->read_file();
                $optionLine = "";
                foreach ($forums as $line) {
                    $lineCode = $this->make_array($line);
                    if ($lineCode[1] == "forum") {
                        $optionLine.="<option value=".$lineCode[2].">".$lineCode[3]."</option>";
                    }
                }
                $this->showMsg("若你确定要移动帖子，请你选择目标版块！<select name='forumid2'  class='input5'> $optionLine </select>","ask");
                break;
            case 'move2':
                $this->move2();
                break;
            case 'copy':
                $this->file = $this->set[dataPath]."/forums.php";
                $forums = $this->read_file();
                $optionLine = "";
                foreach ($forums as $line) {
                    $lineCode = $this->make_array($line);
                    if ($lineCode[1] == "forum") {
                        $optionLine .= "<option value=".$lineCode[2].">".$lineCode[3]."</option>";
                    }
                }
                $this->showMsg("若你确定要复制帖子，请你选择目标版块！<select name='forumid2'  class='input5'> $optionLine </select>","ask");
                break;
            case 'copy2':
                $this->copy2();
                break;
            case 'good':
                $this->showMsg("你确定要将这个帖子进行精华贴操作吗？","ask");
                break;
            case 'good2':
                $this->good2();
                break;
            case 'lock_poll':
                $this->lockPoll();
                break;
            case 'unlock_poll':
                $this->unlockPoll();
                break;
            case 'edit_poll':
                $this->editPoll();
                break;
            case 'edit_poll_save':
                $this->editPollSave();
                break;
            case 'mark_poll':
                $this->markPoll();
                break; 
            case 'upload':
                $this->showMsg("你确定要将这个帖子主题进行附件上传操作吗？","ask");
                break;
            case 'upload2':
                $this->upload2();
                break;
             case 'download':
                $this->showMsg("你确定要将这个帖子主题进行附件下载操作吗？","ask");
                break;
            case 'download2':
                $this->download2();
                break;
		
		}
    } // end func

    
    
    /**
     *删除主题以及帖子
     *2002-5-4
     */
    function mod_del2()
    {
        
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
        $postnum = $this->get();

		$getUpload = trim($postnum[11]);
        if (!empty($getUpload)) {
		$downloadFile = explode("|",$postnum[11]);
		    for ($j=0; $j<count($downloadFile)-1; $j++){
                $downloadFileOne = explode("%",$downloadFile[$j]);
				$getDownloadFileName = $downloadFileOne[3];
                @unlink ($this->set[dataPath]."/upfile/".$getDownloadFileName);
             }
		 }

        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/status.php";
        $line = $this->get();
        $line[1]--;
        $line[2] = $line[2] - $postnum[3];
        $this->overwrite($line);        

        if (file_exists($this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php")) {
            unlink($this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php");
        }

        if (file_exists($this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php")) {
            unlink($this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php");
        }

        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/list.php";
        $this->delete2("1",$this->input['postid']);
        
		$this->manageLog("删除主题：->".$postnum[2]);

        $this->showMsg("已经删除该主题了!","./index.php?mods=forumdisplay&forumid={$this->input['forumid']}");

    } // end func
  

    
    /**
     *验证用户的权限
     *2002-5-4
     */
    function groupCheck($per)
    {

        $this->file = $this->set[dataPath]."/forums.php";
        $forum = $this->select_line("2",$this->input['forumid']);
        $moderators = explode("|",$forum[8]);
        $ok = 0;    
        foreach ($moderators as $moderator) {
            $mod = explode(",",$moderator);
            if ($mod[0] == $this->sess['sess_uid']) {
                $ok = 1;
            }
        }
        if ($ok == "0") {
            return 0;
            break;
        }
        $this->file = $this->set[dataPath]."/users/".$this->sess['sess_uid'].".php";
        $user = $this->get();
        $this->file = $this->set[dataPath]."/groups.php";
        $group = $this->select_line("1",$user[4]);
        if ($group[$per] == "1") {
            return 1;
        } else {
            return 0;
        }

    }// end func

    /**
     *帖子加分处理函数
     *2002-5-4
     */
    function addGrade2()
    {

        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php";
        $line = $this->select_line("1",$this->input['topicid']);
        $this->file = $this->set[dataPath]."/users/".$line[5].".php";
        $line = $this->get();    
        $line[18] = $this->input['rating'] + $line[18];
        $this->overwrite($line);
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php";
        $line = $this->select_line("1",$this->input['topicid']);    
        $line[8] = "0";
        $this->update("1",$this->input['topicid'],$line);    
 		
		$this->manageLog("加分主题：->".$line[2]."+".$this->input[rating]);
        $this->showMsg("已经成功给该帖子加分了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
                
    }
    
    /**
     *置顶帖子处理函数
     *2002-5-4
     */
    function top2()
    {
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/list.php";
        $line = $this->select_line("1",$this->input['postid']);
        if ($line[5] == "0") {
            $line[5] = "1";
            $this->delete2("1",$this->input['postid']);
            $this->insert_line($line);
			$getTopicName = $this->getTopicNameFromId($this->input['postid']);
		    $this->manageLog("置顶主题：->".$getTopicName); 

            $this->showMsg("已经成功将该帖子置顶了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
 			      
		}
        if ($line[5] == "1") {
            $line[5] = "0";
            $this->delete2("1",$this->input['postid']);
            $this->insertTop($this->file,$line);

			$getTopicName = $this->getTopicNameFromId($this->input['postid']);
		    $this->manageLog("取消置顶主题：->".$getTopicName);
            $this->showMsg("已经成功将该帖子取消置顶了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
        }    
    }    

    /**
     *帖子锁定函数
     *2002-5-4
     */
    function close2()
    {
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/list.php";
        $line = $this->select_line("1",$this->input['postid']);
        if ($line[4] == "0") {
            $line[4]="1";
            $this->update("1",$this->input['postid'],$line);    
			$getTopicName = $this->getTopicNameFromId($this->input['postid']);
		    $this->manageLog("锁定主题：->".$getTopicName);
            $this->showMsg("已经成功将该帖子锁定了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
        }
        if ($line[4] == "1") {
            $line[4]="0";
            $this->update("1",$this->input['postid'],$line);  
			$getTopicName = $this->getTopicNameFromId($this->input['postid']);
		    $this->manageLog("取消锁定主题：->".$getTopicName);
			
            $this->showMsg("已经成功将该帖子取消锁定了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
        }    
    }

    /**
     *帖子主题编辑函数
     *2002-5-4
     */
    function edit2()
    {

        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php";
        if (file_exists($this->file)) {
            $line= $this->select_line("1", "1");
            $topicBody = $this->ctbcode(stripslashes($line[3]));
            $topicTitle = $this->ctbcode(stripslashes($line[2]));
            $topicBody = str_replace("<br />", "\n", $topicBody);  // added by cx for XHTML
            $topicBody = str_replace("<br>", "\n", $topicBody);
            $this->BAN = " &gt; 文章管理";
            $header = $this->header("文章管理");

            $actionModlue = "modetopic";
            $actionType = "mode_save";
            $this->input['topicId'] = 1;
            eval("\$this->outPut(\"".$this->getTemplate("post")."\");");
        } else {
            $this->showMsg("对不起，您要修改的帖子不存在!");
        }
    } // end func

    /**
     *帖子主题提前函数
     *2002-5-4
     */
    function top_go2()
    {
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/list.php";
        $line = $this->select_line("1",$this->input['postid']);
        $this->delete2("1",$this->input['postid']);
        $this->insertTop($this->file,$line);      
		
			$getTopicName = $this->getTopicNameFromId($this->input['postid']);
		    $this->manageLog("提前主题：->".$getTopicName);
        $this->showMsg("已经成功将该帖子提前了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
    } // end func

    /**
     *将本主题所有回帖全部删除函数
     *2002-5-4
     */
    function del_go2()
    {

        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
        $line = $this->get();
        $newNum = $line[3] - 1;
        $line[3] = "1";
        $this->overwrite($line);
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/status.php";
        $line = $this->get();
        $line[2] = $line[2] - $newNum;
        $this->overwrite($line);
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php";
        $oneLine = file($this->file);
        $this->overwrite($this->make_array($oneLine[0]));

			$getTopicName = $this->getTopicNameFromId($this->input['postid']);
		    $this->manageLog("锁定主题：->".$getTopicName);
        $this->showMsg("已经成功将该帖子所有回帖删除了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
    } // end func

    /**
     *复制帖子函数
     *2002-06-27
     */
    function copy2()
    {
   
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/list.php";
        $copyList = $this->select_line(1,$this->input['postid']);
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
        $copyPhp3 = $this->get();
        
        if (file_exists($this->set[dataPath]."/".$this->input['forumid2']."/list.php")) {
            $this->file = $this->set[dataPath]."/".$this->input['forumid2']."/list.php";
            $maxId = $this->get_max_value("1");
            $newPostId = $maxId+1;
        } else {
            $newPostId = 1;
        }
        
        $copyList[1] = $newPostId;
        $copyPhp3[1] = $newPostId;
        $this->insertTop($this->file,$copyList);
        $this->file = $this->set[dataPath]."/".$this->input['forumid2']."/".$newPostId."_.php";
        $this->overwrite($copyPhp3);
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php";
        $fp = @fopen($this->file,"r");
        flock($fp,LOCK_SH);
        $copyPhp = fread($fp, filesize($this->file));
        fclose($fp);
        $this->file = $this->set[dataPath]."/".$this->input['forumid2']."/".$newPostId.".php";
        $fp = @fopen($this->file,"w");
        flock($fp,LOCK_EX);
        fwrite($fp,$copyPhp);
        fclose($fp);
        $pageNum = $this->getlines();
        $this->file = $this->set[dataPath]."/".$this->input['forumid2']."/status.php";
        $newStatus = $this->get();
        $newStatus[1] = $newStatus[1]+1;
        $newStatus[2] = $newStatus[2]+$copyPhp3[3];

        $this->overwrite($newStatus);

		    $this->manageLog("复制主题：->".$copyPhp3[2]);
        $this->showMsg("复制成功!","./index.php?mods=topicdisplay&forumid={$this->input['forumid2']}&postid=$newPostId");
    } // end func

    /**
     *移动帖子函数
     *2002-5-4
     */
    function move2()
    {

        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/list.php";
        $copyList = $this->select_line(1,$this->input['postid']);
        $this->delete2("1",$this->input['postid']); 
        
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
        $copyPhp3 = $this->get();

        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/status.php";
        $line = $this->get();
        $line[1]--;
        $line[2] = $line[2] - $copyPhp3[3];
        $this->overwrite($line);        

        if (file_exists($this->set[dataPath]."/".$this->input['forumid2']."/list.php")) {
            $this->file = $this->set[dataPath]."/".$this->input['forumid2']."/list.php";
            $maxId = $this->get_max_value("1");
            $newPostId = $maxId + 1;
        } else {
            $newPostId = 1;
        }
        
        $copyList[1] = $newPostId;
        $copyPhp3[1] = $newPostId;
        $this->insertTop($this->file,$copyList);
        $this->file = $this->set[dataPath]."/".$this->input['forumid2']."/".$newPostId."_.php";
        $this->overwrite($copyPhp3);
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php";
        $fp = @fopen($this->file,"r");
        flock($fp,LOCK_SH);
        $copyPhp = fread($fp, filesize($this->file));
        fclose($fp);
        $this->file = $this->set[dataPath]."/".$this->input['forumid2']."/".$newPostId.".php";
        $fp = @fopen($this->file,"w");
        flock($fp,LOCK_EX);
        fwrite($fp,$copyPhp);
        fclose($fp);
        $pageNum = $this->getlines();
        $this->file = $this->set[dataPath]."/".$this->input['forumid2']."/status.php";
        $newStatus = $this->get();
        $newStatus[1] = $newStatus[1]+1;
        $newStatus[2] = $newStatus[2]+$copyPhp3[3];
        $this->overwrite($newStatus);

        if (file_exists($this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php")) {
            unlink($this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php");
        }

        if (file_exists($this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php")) {
            unlink($this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php");
        }

        $this->manageLog("复制主题：->".$copyPhp3[2]);

        $this->showMsg("转移成功!","./index.php?mods=forumdisplay&forumid={$this->input['forumid']}");
    } // end func    

    /**
     *帖子精华设置函数
     *2002-5-4
     */
    function good2()
    {
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/list.php";
        $line = $this->select_line("1",$this->input['postid']);
        if ($line[6] == "0") {
            $line[6]="1";
            $this->update("1",$this->input['postid'],$line);  
			
			$getTopicName = $this->getTopicNameFromId($this->input['postid']);
		    $this->manageLog("精华主题：->".$getTopicName); 
            $this->showMsg("已经成功将该帖子设置成精华贴了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
			       
		}
        if ($line[6] == "1") {
            $line[6]="0";
            $this->update("1",$this->input['postid'],$line); 
			
			$getTopicName = $this->getTopicNameFromId($this->input['postid']);
		    $this->manageLog("取消精华主题：->".$getTopicName);
            $this->showMsg("已经成功将该帖子取消精华贴了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
        }    
    }
    
    /**
     *将投票锁定函数
     *2002-5-4
     */
    function lockPoll()
    {
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
        $line = $this->select_line("1",$this->input['postid']);
        if ($line[17] == "0") {
            $line[17]="1";
            $this->update("1",$this->input['postid'],$line); 
			
		    $this->manageLog("锁定投票：->".$line[2]); 

            $this->showMsg("已经成功将该投票锁定了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
        
		}

    }
    /**
     *将投票解锁函数
     *2002-5-4
     */
    function unlockPoll()
    {
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
        $line = $this->select_line("1",$this->input['postid']);
        if ($line[17] == "1") {
            $line[17]="0";
            $this->update("1",$this->input['postid'],$line);  
			
		    $this->manageLog("解锁投票：->".$line[2]); 
            $this->showMsg("已经成功将该投票锁定了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
        }

    }

    /**
     *显示等待编辑投票
     *2002-5-4
     */
    function editPoll()
    {

        $this->file = $this->set[dataPath]."/forums.php";
        $forum = $this->select_line("2",$this->input['forumid']);
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
        $line = $this->get();
        $this->BAN = " &gt; <a href=\"./index.php?mods=forumdisplay&forumid={$this->input['forumid']}\">".$forum[3]."</a> &gt; ".$line[2];
        $header = $this->header($line[2]);
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php4";
        $pollItems = $this->openfile();
        for ($i=1;$i<= (count($pollItems[0])-3)/2;$i++) { 
            if ($pollItems[0][$i*2+1] && $pollItems[0][$i*2]>=0) {
          $pollItemTopic = $pollItems[0][$i*2+1];
          $pollItemNum = $pollItems[0][$i*2];
          $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
          $pollEndTime = $this->get();
          $pollEndYear = date("Y",$pollEndTime[15]);
          $pollEndMonth = date("m",$pollEndTime[15]);
          $pollEndDay = date("d",$pollEndTime[15]);
          if ($line[14] == "1"){
              $dxCheck = "checked";
          }
          $pollShow .= "
            <tr>
            <td>&nbsp;
              序号 <input type=\"text\" name=\"topicId[]\" class=\"input2\" size=\"1\" maxlength=1 value=\"$i\" disabled> 投票选项 <input type=\"text\" name=\"topicTitle[]\" class=\"input2\" size=\"50\" maxlength=38 value=\"$pollItemTopic\">
            </td>
            <td valign=middle>投票数 <input type=\"text\" name=\"topicNum[]\" class=\"input2\" size=\"10\" maxlength=8 value=\"$pollItemNum\">
            </td>
          </tr>";/**/
                }
        }
        eval("\$this->outPut(\"".$this->getTemplate("editPoll")."\");");
    }

    /**
     *将投票选项结果保存
     *2002-5-4
     */
    function editPollSave()
    {

        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php4";
        $pollLine = array(stripslashes($this->code),$this->input['postid'],$this->input['topicNum'][0],
        $this->input['topicTitle'][0],$this->input['topicNum'][1],$this->input['topicTitle'][1],
        $this->input['topicNum'][2],$this->input['topicTitle'][2],$this->input['topicNum'][3],
        $this->input['topicTitle'][3],$this->input['topicNum'][4],$this->input['topicTitle'][4],
        $this->input['topicNum'][5],$this->input['topicTitle'][5],$this->input['topicNum'][6],
        $this->input['topicTitle'][6],$this->input['topicNum'][7],$this->input['topicTitle'][7],"\n");

        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php4";
        $this->update2("1",$this->input['postid'],$pollLine);
        if ("1" == $this->input['multiChoice']) {
            $pollMode = "1";
        }else {
            $pollMode = "0";
        }
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
        $line = $this->get();
        $line[14] = $pollMode;
        $line[15] = mktime(0,0,0,$this->input['timeOutMonth'],$this->input['timeOutDay'],$this->input['timeOutYear']);
        $this->overwrite($line);
        $pollTotalNum = "0";
        for ($i=0;$i<=count($this->input['topicNum']);$i++){
            $pollTotalNum = $pollTotalNum + $this->input['topicNum'][$i];
        }
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
        $pollMulti = $this->get();

        $pollMulti[16] = $pollTotalNum;
        $this->update2("1",$this->input['postid'],$pollMulti);

        
		    $this->manageLog("编辑投票：->".$line[2]); 		
		$this->showMsg("已经成功修改该投票选项!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
    }

    /**
     *显示所有投票用户
     *2002-5-4
     */
    function markPoll()
    {

        $this->file = $this->set[dataPath]."/forums.php";
        $forum = $this->select_line("2",$this->input['forumid']);
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
        $line = $this->get();
        $this->BAN = " &gt; <a href=index.php?mods=forumdisplay&forumid={$this->input['forumid']}>".$forum[3]."</a> &gt; ".$line[2];
        $header = $this->header($line[2]);

        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid'].".php4";
        $pollItems = $this->openfile();
        $userCount = count($pollItems[1]);
        $userVoteNum = $userCount - 3;
        $num = 0;
        for ($i=2;$i<$userCount-1;$i++) { 
            if($pollItems[1][$i]) {
                $this->file = $this->set[dataPath]."/users/".$pollItems[1][$i].".php";
                $userInfo = $this->get();
                $getUserName = $userInfo[3];
                $getPollName = $pollItems[1][$i];
                $num++;
                $pollShow .= "
                    <tr>
                    <td>&nbsp; $num 、
                    </td>
                    <td valign=middle> $getUserName
                    </td>
                    </tr>";
            }
        }
        
        
        eval("\$this->outPut(\"".$this->getTemplate("markPoll")."\");");
    
    } // end func 


    /**
     *帖子上传附件操作函数
     *2002-5-4
     */
    function upload2()
    {
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
        $line = $this->get();
        if ($line[9] == "0") {
            $line[9]="1";
            $this->update("1",$this->input['postid'],$line);    
			

		    $this->manageLog("允许上传附件：->".$line[2]); 
            $this->showMsg("已经成功将该帖子允许上传附件了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
        		
		}
        if ($line[9] == "1" or empty($line[9])) {
            $line[9]="0";
            $this->overwrite($line);
	
		    $this->manageLog("禁止上传附件：->".$line[2]); 

            $this->showMsg("已经成功将该帖子禁止上传附件了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
        }    
    }

    /**
     *帖子下载附件操作函数
     *2002-5-4
     */
    function download2()
    {
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$this->input['postid']."_.php";
        $line = $this->get();
        if ($line[10] == "0") {
            $line[10]="1";
            $this->update("1",$this->input['postid'],$line);        
            
		    $this->manageLog("允许下载附件：->".$line[2]); 
			
			$this->showMsg("已经成功将该帖子允许下载附件了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
        }
        if ($line[10] == "1" or empty($line[9])) {
            $line[10]="0";
            $this->overwrite($line);  

		    $this->manageLog("禁止下载附件：->".$line[2]); 

            $this->showMsg("已经成功将该帖子禁止下载附件了!","./index.php?mods=topicdisplay&forumid={$this->input['forumid']}&postid={$this->input['postid']}");
        }    
    }
    /**
     *帖子下载附件操作函数
     *2002-5-4
     */
    function getTopicNameFromId($postId){
        $this->file = $this->set[dataPath]."/".$this->input['forumid']."/".$postId."_.php";
        $line = $this->get();
        return $line[2];
	}

} // end class

?>