- A+
所属分类:Emlog
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;
- }
- }
- ?>
具体在模板根目录下的 function.php 文件中修改。
历史上的今天:
- 2018: 分享一款素描风格的 Win10 主题(0)