- 积分
- 990
- 在线时间
- 小时
- 注册时间
- 2011-10-8
- 最后登录
- 1970-1-1
|
|
9 k. p8 [ k" o4 v. Y模块化发表主题功能& R; a7 c$ m+ \4 E) q" h1 u8 U! u
发表主题的方法只实现最简单的普通主题的发表功能,其它主题功能如特殊主题、抢楼帖、分类信息等均以扩展方式实现1 O( V8 R' ^* u5 @4 ?, u
具体实现方法是:给model_forum_thread->newthread()方法的执行前后绑定相应的扩展方法,部分代码如下:( c3 n) }$ Q" Z+ S! N
6 o% P, ~( ~6 n& W* W/ k $modthread = C::m('forum_thread');
, |# V2 ?1 g+ ~5 @# h( |% l8 Z: p$ N
$bfmethods = $afmethods = array();
9 [6 h; q/ B% z4 r: k
1 V! r0 [# m& ? //note 抢楼贴
3 U) |0 a: ]& K. p+ g6 U if($_GET['rushreply']) {+ d! j5 h- d4 O/ \
$bfmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'before_newthread');, ]0 P4 k S8 i' N4 }
$afmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'after_newthread');+ k; b; \. n! s6 ~. U
}0 i& u! @! `" C% b2 W- _
$ f7 M. |& }6 Y4 e4 u
//noteX 回帖送积分(不使用标志位)# I( W. W$ Q; k
$bfmethods[] = array('class' => 'extend_thread_replycredit', 'method' => 'before_newthread');
- X& C0 n v; E2 P/ K% _# E $afmethods[] = array('class' => 'extend_thread_replycredit', 'method' => 'after_newthread');* y( H/ M; q/ O8 `! {; e
( _2 o3 i- k, a
if($sortid) {
1 K$ J# W' W5 F& w' ?' E $bfmethods[] = array('class' => 'extend_thread_sort', 'method' => 'before_newthread');
! ]# J8 `6 m0 E0 u' L $afmethods[] = array('class' => 'extend_thread_sort', 'method' => 'after_newthread');- a4 A3 H: D0 o! Y
}
/ F J% Q7 k$ V& y( c! T' @ $bfmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'before_newthread');
. \5 M+ U9 j2 ~: Y+ e. b9 H $afmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'after_newthread');
2 E: F# G: Y) H, V $afmethods[] = array('class' => 'extend_thread_image', 'method' => 'after_newthread');
* d; d1 `: `' n, }) l& P
- [! g' c, p/ q% j, z! w. Y if(!empty($_GET['adddynamic'])) {
* d$ ]: H, q- K+ d, R" p: O, b; ] $afmethods[] = array('class' => 'extend_thread_follow', 'method' => 'after_newthread');
& N2 H- x X9 x$ E. J5 r }2 v2 `) ]- z* |& J/ ]7 W @
: {# t* c% D2 b- {+ |& }- F $modthread->attach_before_methods('newthread', $bfmethods);' ?1 p0 H0 v B/ ]& j9 g, Z
$modthread->attach_after_methods('newthread', $afmethods); |
|