emlog 大前端回复可见
必须先注册 在 评论才能看到
我不想那么麻烦,那么多的无用用户,自己动手丰衣足食
我测试了测试,可以用~~
原版代码
<?php /* * 文章回复可见 * */ function reply_view($content,$logid){ if(!strstr($content,"hide")){ return $content; } if(ROLE == ROLE_ADMIN){ $content = preg_replace("/\[hide\](.*)\[\/hide\]/Uims", '<div class="hideConBox">\1</div>', $content); return $content; } if(ROLE != ROLE_VISITOR){ //是会员的时候回复可见 global $userData; $user_mail = $userData['email']; //$logid = $logData['logid']; $DB = MySql::getInstance(); $sql = "SELECT * FROM ".DB_PREFIX."comment WHERE gid='$logid' and mail='$user_mail'"; $res = $DB->query($sql); $num = $DB->num_rows($res); if($num>0){ //已经回复过了 $share_view = preg_replace("/\[hide\](.*)\[\/hide\]/Uims", '<div class="hideConBox">\1</div>', $content); }else{ //未回复 $share_view = preg_replace("/\[hide\](.*)\[\/hide\]/Uims", '<div class="hideConBox">此处内容已隐藏,注册会员<a href="#comment-post">评论</a>即可查看</div>', $content); } return $share_view; }else{ //是游客的时候回复可见 $share_view = preg_replace("/\[hide\](.*)\[\/hide\]/Uims", '<div class="hideConBox">此处内容已隐藏,注册会员<a href="#comment-post">评论</a>即可查看</div>', $content); return $share_view; } } ?>
修改后代码
<?php /* * 文章回复可见 * */ function reply_view($content,$logid){ if(!strstr($content,"hide")){ return $content; } if(ROLE == ROLE_ADMIN){ $content = preg_replace("/\[hide\](.*)\[\/hide\]/Uims", '<div class="hideConBox">\1</div>', $content); return $content; } if(ROLE != ROLE_VISITOR){ //是会员的时候回复可见 global $userData; $user_mail = $userData['email']; //$logid = $logData['logid']; $DB = MySql::getInstance(); $sql = "SELECT * FROM ".DB_PREFIX."comment WHERE gid='$logid' and mail='$user_mail'"; $res = $DB->query($sql); $num = $DB->num_rows($res); if($num>0){ //已经回复过了 $share_view = preg_replace("/\[hide\](.*)\[\/hide\]/Uims", '<div class="hideConBox">\1</div>', $content); }else{ //未回复 $share_view = preg_replace("/\[hide\](.*)\[\/hide\]/Uims", '<div class="hideConBox">此处内容已隐藏,赶紧<a href="#comment-post">评论</a>即可查看</div>', $content); } return $share_view; }else{ if($_COOKIE["postermail"]){ $share_view = preg_replace("/\[hide\](.*)\[\/hide\]/Uims", '<div class="hideConBox" id="ae">\1</div>', $content); }else{ $share_view = preg_replace("/\[hide\](.*)\[\/hide\]/Uims", '<div class="hideConBox">此处内容已隐藏,立即<a href="#comment-post">评论</a>即可查看</div>', $content); } return $share_view; } } ?>
转载请注明出处 AE博客|墨渊 » EMLOG扩展 | EMLOG大前端 回复可见问题
发表评论