===================================================================
说明:
简单的悬赏主题功能
欢迎使用^___^
====================================================================
1--修改showthread.php
找
====================================================================
include $forums->func->load_template('showthread');
exit;
}
====================================================================
前面加上
====================================================================
//悬赏开始
$ofd = $DB->query_first('select * from '.TABLE_PREFIX.'offerareward where tid='.intval($_INPUT['t']));
if ($ofd['tid']) {
if (TIMENOW > $ofd['etime']) $ofd['end'] = '本悬赏主题已于 '.gmdate("M d Y H:i:s", $ofd['etime']).' 结束'; else $ofd['end'] = '本悬赏主题从 '.gmdate("M d Y H:i:s", $ofd['stime']).' 开始 , 将于 '.gmdate("M d Y H:i:s", $ofd['etime']).' 结束';
if ($ofd['doneid']) {
$tmp = $DB->query_first('select name from '.TABLE_PREFIX.'user where id='.$ofd['doneid'].';');
$ofd['state'] = '楼主将正确答案给予了 '.$tmp['name'].' , 悬赏论坛币为 '
.$ofd['price'].' , 系统扣除服务费20% , 该用户最后获得论坛币 '.$ofd['price'] * 0.8
.'<br /><br /><a href='./../../&'quot;redirect.php?goto=findpost&p='.$ofd['pid'].'">点击这里查看获得悬赏的帖子</a>';
} else $ofd['state'] = '楼主花费论坛币 '.$ofd['price'].' 悬赏此主题 , 本悬赏主题至今仍没有答案...';
}
//悬赏结束
====================================================================
2--修改newthread.php
找
$forums->func->fetch_query_sql( $this->thread, 'thread' );
$this->post['threadid'] = $DB->insert_id();
$this->thread['tid'] = $this->post['threadid'];
$this->post['posthash'] = $this->posthash;
$this->post['newthread'] = 1;
$this->post['moderate'] = 0;
$forums->func->fetch_query_sql( $this->post, 'post' );
$this->post['pid'] = $DB->insert_id();
====================================================================
后面添加
====================================================================
//悬赏开始
if (intval($_INPUT['offerareward']) and $price = intval($_INPUT['t_price']) and $price < 1000 and intval($_INPUT['t_days']) and $bbuserinfo['cash'] > $price) {
$tid = intval($this->post['threadid']);
$stime = time();
$etime = $stime + intval($_INPUT['t_days']) * 24 * 60 * 60;
$DB->query_unbuffered('insert into '.TABLE_PREFIX."offerareward (`tid`, `userid`, `price`, `stime`, `etime`) values ($tid, ".$bbuserinfo['id'].", $price, $stime, $etime);");
$DB->query_unbuffered('update '.TABLE_PREFIX.'user set cash=cash-'.$price.' where id='.$bbuserinfo['id'].';');
}
//悬赏结束
====================================================================
3--上传offerareward.php文件到论坛根目录
====================================================================
4--导入sql.sql数据库文件
====================================================================
5--修改showthread_post模板
====================================================================
找到
<div id="show{$post['row']['pid']}" class="postcontent">{$post['row']['pagetext']}</div>
====================================================================
前面加上
====================================================================
<!-- 悬赏开始 -->
<if="$ofd['tid']">
<if="1 == $post['row']['postcount']">
<div align=center style="background-color: #FFFFCC;">
<p>{$ofd['state']}</p>
<p>{$ofd['end']}</p>
</div>
<else>
<if="$post['poster']['id'] != $ofd['userid'] and $bbuserinfo['id'] == $ofd['userid'] and !$ofd['doneid']">
<div align=center style="background-color: #FFFFCC;">
此帖是否为你要的答案? <a href='./../../offerareward.php?tid={$_INPUT['t']}&pid={$post['row']['pid']}' target='_blank'>是</a>
</div>
</if>
</if>
</if>
<!-- 悬赏结束 -->
====================================================================
6--修改newpost_header模板
====================================================================
找
<if="$bboptions['showdescription']">
<tr>
<td class='row1'>{$lang['threaddesc']}</td>
<td class='row2'><input type='text' size='40' maxlength='40' name='description' value='{$description}' tabindex='2' class='bginput' /></td>
</tr>
</if>
====================================================================
后面添加
====================================================================
<!-- 悬赏开始 -->
<if="in_array($bbuserinfo['usergroupid'], explode(',', $bboptions['canviewspechide'])) or in_array($bbuserinfo['membergroupids'], explode(',', $bboptions['canviewspechide']))">
<tr><td></td><td><input type="checkbox" name='offerareward' value='1' /> 是否悬赏主题 请输入:<input type='text' size='4' name='t_price'>论坛币 <input type='text' size='4' name='t_days' value='1' />天<br />( 请正确填写全部,否则系统不通过。论坛币请限制在1000以内,不包括1000 )</td></tr>
</if>
<!-- 悬赏结束 -->
====================================================================
7。后台常规设置->发帖选项->创建新设置
具体设置如图
====================================================================
8--更新系统缓存。
====================================================================
完。
看看吧。。。丑陋。。。
貌似不错的样子,不知道功能怎么样,另2.7有此相关功能吗?
或者2.7出来后升级此插件麻烦吗?
貌似不错的样子,不知道功能怎么样,另2.7有此相关功能吗?
或者2.7出来后升级此插件麻烦吗?
[/quote]基本上没有关系。。。
后台设置方法是,用户组id用半角逗号隔开
管理员用户组id为:4
版主:6
超版:7
其他得自己看看把。。。。
ok,从现在开始继续完善~
此插件没有认真完善。切勿实际使用。
有能力者可以考虑完善一下