以下是我的设置:
在newreply.inc.php中- //发帖加分额外条件 by wxyuan90 add
- static $__minlength = 10;//字符数小于此不予加分,注意1中文=2字符(GBK)或3字符(UTF)
- static $__reducesmile = 1;//设为1=去除表情之后计算字数,0=否
- static $__reducequote = 1;//设为1=去除引用之后计算字数,0=否
- static $__reducespace = 1;//设为1=去除空白换行之后计算字数,0=否
- static $__checkattach = 1;//设为1=有附件则直接予以加分,0=否
- static $__updatepostnum =0;//即使不满足条件也加帖子数,0=否
- //设置完毕,以下代码请勿编辑
- $temp = $message;
- if(is_array($smilies))if($__reducesmile) foreach($smilies as $sm) {
- $temp = str_replace($sm['code'], '', $temp);
- }
- if($__reducequote) $temp = preg_replace("/\s*\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s*/is", '', $temp);
- if($__reducespace) $temp = preg_replace("/\s/is", '', $temp);
- $temp = trim($temp);
- $length = strlen($temp);
- unset($temp);
- if($length < $__minlength && (!$__checkattach || !$attachment)) {
- if($__updatepostnum) $db->query("UPDATE {$tablepre}members SET posts=posts+1 WHERE uid = $discuz_uid", 'UNBUFFERED');
- } else
- //发帖加分额外条件 by wxyuan90 end
复制代码 在newthread.inc.php中- //发帖加分额外条件 by wxyuan90 add
- static $__minlength = 10;//字符数小于此不予加分,注意1中文=2字符(GBK)或3字符(UTF)
- static $__reducesmile = 1;//设为1=去除表情之后计算字数,0=否
- static $__reducequote = 1;//设为1=去除引用之后计算字数,0=否
- static $__reducespace = 1;//设为1=去除空白换行之后计算字数,0=否
- static $__checkattach = 1;//设为1=有附件则直接予以加分,0=否
- static $__updatepostnum =0;//即使不满足条件也加帖子数,0=否
- //设置完毕,以下代码请勿编辑
- $temp = $message;
- if(is_array($smilies))if($__reducesmile) foreach($smilies as $sm) {
- $temp = str_replace($sm['code'], '', $temp);
- }
- if($__reducequote) $temp = preg_replace("/\s*\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s*/is", '', $temp);
- if($__reducespace) $temp = preg_replace("/\s/is", '', $temp);
- $temp = trim($temp);
- $length = strlen($temp);
- unset($temp);
- if($length < $__minlength && (!$__checkattach || !$attachment)) {
- if($__updatepostnum) $db->query("UPDATE {$tablepre}members SET posts=posts+1 WHERE uid = $discuz_uid", 'UNBUFFERED');
- } else
- //发帖加分额外条件 by wxyuan90 end
复制代码 在viewthread.php中- //发帖加分额外条件 by wxyuan90 add
- $temp = $post['first'] ? 1 : 0;
- $__minlength = $temp ? 10 : 10;//字符数小于此不予加分,注意1中文=2字符(GBK)或3字符(UTF)
- $__reducesmile = $temp ? 1 : 1;//设为1=去除表情之后计算字数,0=否
- $__reducequote = $temp ? 1 : 1;//设为1=去除引用之后计算字数,0=否
- $__reducespace = $temp ? 1 : 1;//设为1=去除空白换行之后计算字数,0=否
- $__checkattach = $temp ? 1 : 1;//设为1=有附件则直接予以加分,0=否
- //以上设定前一个值填写主题贴用newthread.inc中的,后一个填写回贴用newreply.inc中的,没有的话只要minlength填写0即可
- //设置完毕,以下代码请勿编辑
- $temp = $post['message'];
- if(is_array($smilies))if($__reducesmile) foreach($smilies as $sm) {
- $temp = str_replace($sm['code'], '', $temp);
- }
- if($__reducequote) $temp = preg_replace("/\s*\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s*/is", '', $temp);
- if($__reducespace) $temp = preg_replace("/\s/is", '', $temp);
- $temp = trim($temp);
- $length = strlen($temp);
- unset($temp);
- $post['tooshort'] = ($length < $__minlength && (!$__checkattach || !$post['attach'])) ? TRUE : FALSE;
- //发帖加分额外条件 by wxyuan90 end
复制代码 在viewthread.htm中- <!--{if $post[tooshort]}-->
- <div class='box' style='width:240px; float:right; margin:2px; border:{BORDERWIDTH} {BORDERCOLOR}'>
- <h4>本帖长度未达标</h4>
- $post[author]未得到相应的积分
- </div>
- <!--{/if}-->
复制代码 这样设置完了以后,在发帖或回帖时,如果帖子里有附件,但字符数不够的情况下,依然有“本帖长度未达标,未得到相应的积分”的提示,然而实际上帖数、积分都已经增加了 |