业务经理

微信扫描以上二维码

028-61286886

技术咨询

评论输入框改为百度编辑器以后,输入内容提交,html标签会被转义掉。

迅睿框架 更新 2021-01-30 17:13:48 56756565ma

评论输入框改为百度编辑器以后,输入内容提交,html标签会被转义掉。

控件代码里取消了xss过滤还是不行。这是代码,帮忙看下如何设置修改。

<?php echo str_replace("data[content]", "content",dr_fieldform('{"name":"简单编辑器","fieldname":"content","ismain":"1","fieldtype":"Ueditor","setting":{"option":{"down_img":"1","watermark":"0","show_bottom_boot":"0","autofloat":"0","remove_style":"0","div2p":"0","autoheight":"0","page":"0","mode":"1","tool":"\'bold\', \'italic\', \'underline\'","mode2":"3","tool2":"\'bold\', \'forecolor\', \'link\',   \'simpleupload\',  \'underline\', \'source\',  \'blockquote\'","mode3":"1","tool3":"\'bold\', \'italic\', \'underline\'","attachment":"0","image_reduce":"","value":"","width":"100%","height":"300","css":""},"validate":{"required":"0","pattern":"","errortips":"","xss":"1","check":"","filter":"","formattr":"","tips":""}},"ismember":"1"}', ""));?>



插件版权:官方插件
插件名称:评论

方案

  • 官方插件技术-周若尘 #1 · 2021-01-14 19:09:15
    编辑器本身就会转义,输出的时候使用函数dr_code2html就可以了
  • 56756565ma #2 · 2021-01-14 19:20:40
    官方插件技术-周若尘 这个是不是得在评论内容入库的时候做处理?
  • 守望天空 #3 · 2021-01-14 19:32:45
    用一楼的函数做显示就对了,入库肯定要被转义啊,任何一个cms多要转义
  • 56756565ma #4 · 2021-01-14 19:34:24
    守望天空 帮我看一下输出代码怎么写,一知半解试了一下不管用 😀 😀 下面是调用的输入内容的原代码。
     {dr_replace_emotion($t.content)}
  • 可怜的码农 #5 · 2021-01-14 19:57:16
     {dr_replace_emotion(dr_code2html($t.content))}
  • 56756565ma #6 · 2021-01-14 20:19:47
    可怜的码农 测试了还是有问题,不知道是不是我没说清楚问题。重新整理下问题:评论区的输入框改为了百度编辑器输入框,输入内容比如:

    提交之后显示的评论内容为这样:

    也就是 < >都没有了,只留下了其他的。评论内容输入框的代码为:
    <?php echo str_replace("data[content]", "content",dr_fieldform('{"name":"简单编辑器","fieldname":"content","ismain":"1","fieldtype":"Ueditor","setting":{"option":{"down_img":"1","watermark":"0","show_bottom_boot":"0","autofloat":"0","remove_style":"0","div2p":"0","autoheight":"0","page":"0","mode":"1","tool":"\'bold\', \'italic\', \'underline\'","mode2":"3","tool2":"\'bold\', \'forecolor\', \'link\',   \'simpleupload\',  \'underline\', \'source\',  \'blockquote\'","mode3":"1","tool3":"\'bold\', \'italic\', \'underline\'","attachment":"0","image_reduce":"","value":"","width":"100%","height":"300","css":""},"validate":{"required":"0","pattern":"","errortips":"","xss":"1","check":"","filter":"","formattr":"","tips":""}},"ismember":"1"}', ""));?>
    评论内容显示的代码按上述已修改为;
    <div class="ds-comment-body">
                        <p>
                            {dr_replace_emotion(dr_code2html($t.content))}
                        </p>                
                        <div class="ds-replybox ds-replybox2 ds-inline-replybox " id="dr_reply_{$t.id}" style="display:none;">
                        </div>
    </div>
  • 司马老贼 #7 · 2021-01-14 20:22:24
    {dr_code2html($t.content)}
  • 56756565ma #8 · 2021-01-14 20:37:24
    司马老贼 改过测试了还是一样的问题,< 符号掉了,其他原样子输出
  • 易学习 #9 · 2021-01-14 21:15:53
    用我群里的论坛BBS模块的代码就可以了
  • 夜游神 #10 · 2021-01-15 09:30:51
    技术大大帮我看看
  • 夜游神 #11 · 2021-01-15 13:50:25
    确认了下,数据库内的内容已经是不带转义字符的了,应该是前台的百度编辑器过滤掉了html的<和>符号
  • 小船无桨全靠浪 #12 · 2021-01-15 14:03:16
    我在9楼大哥群里下载的代码就可以完美入库编辑器评论
  • 夜游神 #13 · 2021-01-15 14:04:06
    满意答案
    小船无桨全靠浪 好的,我去看看
  • 56756565ma #14 · 2021-01-30 17:13:48
    @夜游神:已经解决。取消百度编辑器了。

迅睿系统漏洞

GEO系统
GEO系统(2026-09-15)
运营客户端,防止误触阴影处关闭对话框
独立站群系统
独立站群系统(2026-09-14)
子站独立部署时修复同步附件失败问题
在线客服
在线客服(2026-09-13)
修复删除会话报错问题 删除会话时联动删除聊天图片
在线考试竞赛系统
在线考试竞赛系统(2026-09-12)
增加投票功能 考试功能拓展 注意:更新后需要执行系统更新,更新数...
网上信箱
网上信箱(2026-09-12)
修复新版本兼容问题
GeoSeo收录宝
GeoSeo收录宝(2026-09-12)
1 优化Update.php文件,解决版本在线升级不完整问题 2 ...
GeoSeo工具箱
GeoSeo工具箱(2026-09-11)
修正历史记录推送
微信系统
微信系统(2026-09-11)
增加数据统计总览界面 账号管理增加服务和公众号的区别 菜单管理支持更...
答题系统
答题系统(2026-09-11)
一站式在线答题系统,支持真题考试、题库练习和错题本,适合培训、考证、...
阿里云滑动验证码
阿里云滑动验证码(2026-09-10)
采用阿里云验证码替换迅睿系统自带的图片验证码和滑动验证码。后台设置方...