寒假写的一些代码

@Ta 2013-04-27 1887点击
底层是用面向对象的类写的,好多方法自己都忘记了。我不知道还有没有做下去的意义。还是做一些其他东西。

<?php
//readTopic

$dot=$_SERVER['DOCUMENT_ROOT'].'/';
include $dot.'config.php';
// print_r($site_check);
 require_once $dot.'lib/bbs.class.php';
require_once $dot.'lib/io.class.php';
$io=new io();
$bbs=new bbs();
$tid=$_GET['tid'];
$pid=$_GET['pid'];
if(!$bbs->getPartName($pid)) $pid=$bbs->getPid($tid) ; 

if(!$tid) $msg='Sorry ,不允许这样的访问.';
else{
$cr=$bbs->countReply($tid);
$re=$bbs->readTopic($tid);
if(!$re) $msg='Sorry,你要查看的帖子不存在或已被删除.';
else {
 $title=$re['title']; 
 $rest=$bbs->get3Reply($tid);
 if(!$rest) $reply='暂无回复,快抢沙发!';
 else{
 
 $cra=$cr+1;
 foreach($rest as $v=> $k){
 $k['by']=$bbs->getName($k['by']);
 $cra--;
 $u= $k['by']?'<a href="'.$dot.'usercenter.php?user='.$k['by'].$_q.'">'.$k['by'].'</a>|'.$bbs->state( $k['by']) :'临时用户' ;
 $reply.='<div class="mt">'.$cra.'楼. '.$k['con'].'
('. $u.' /'.date('Y-m-d H:i:s',$k['time']).')</div>';
 }
 $reply= '【 <a href="'.$fore.'bbs-reply/'.$pid.'.'.$tid.'/">回复列表('.$cr.')</a> 】<hr>'.$reply; 
 }
 $edit='';
 if(($bbs->selfId()==$re['by'])||( $bbs->selfGrade()>0 )){
 $edit=' <a href="./admin.php?ctl=edit&amp;pid='.$pid.'&amp;tid='.$tid.$_q.'" class="btn">编辑</a>  <a href="./admin.php?ctl=xu&amp;pid='.$pid.'&amp;tid='.$tid.$_q.'" class="btn">续贴</a>  <a href="./admin.php?ctl=del&amp;pid='.$_GET['pid'].'&amp;tid='.$_GET['tid'] .$_q.'" class="btn">删除</a>   ';
 }
 if($bbs->selfGrade()>0){
   $edit.=' 
 
<a href="./admin.php?ctl=setgood&amp;pid='.$_GET['pid'].'&amp;tid='.$_GET['tid'].$_q.'" class="btn">加精</a>  <a href="./admin.php?ctl=bottom&amp;pid='.$_GET['pid'].'&amp;tid='.$_GET['tid'] .$_q.'" class="btn">固底</a>  <a href="./admin.php?ctl=top&amp; pid='.$_GET['pid'].'&amp;tid='.$_GET['tid'].$_q.'" class="btn">置顶</a>

   ';
 
 }
 
 $reply.='<form action="index.php/!/bbs-reply/" method="POST"><textarea name="con" ></textarea><input type="hidden" name="pid" value="'.$_GET['pid'].'" /> <input type="hidden" name="tid" value="'.$_GET['tid'].'" /> <input type="hidden" name="sid" value="'.$_GET['sid'].'" />
<input type="submit" name="sub" value="快速回复" /> ';
$ul=intval($re['upLabel']);
 $ul=($ul<=0)?'':'[更新'.$ul.']';
 $re['by']=$bbs->getName($re['by']);
$body= ' <div class="dotbdm"> <div class="mt"> 标题:'.$ul.'  '.$title.'
楼主  :   <a href="'.$dot.'usercenter.php?user='.$re['by'].$_q.'">'. $re['by']. '</a> ('.$bbs->state($re['by']).')'.$showedit.'
时间 : '.date('Y-m-d H:i:s',$re['time']).'
浏览  :   '.$re['readCount'].'</div></div><div class="addotbdm">  '.$io->cutPage($re['con']).'                   (共<font color=green><caption align=right>'.mb_strlen($re['con']).'</font>字)</caption>
</div><!--  >><a href="./listTopic.php?pid='.$_GET['pid'].$_q.'">返回列表</a>   -->
'.$edit.$reply; 

}
}

 $title2='
<!-- <a href="partList.php?'.$_q.'">论坛</a> --> <a href="listTopic.php?pid='.$pid.$_q.'">'.$bbs->getPartName($pid).'</a> > <a href="add.php?pid='.$_GET['pid'].$_q.'">发帖</a> > <a href="'.$_SERVER['REQUEST_URI'].'">'.$title.'</a>

 ';
 include $dot.'inc/mySmarty.php'; 
 $s->display('bbs_topic.html');
回复列表(5|隐藏机器人聊天)
添加新回复
回复需要登录