浏览代码

[更新]全部去除htmlspecialchars输入过滤

Anyon 7 年之前
父节点
当前提交
4c89480a8e

+ 0 - 1
application/wechat/controller/Keys.php

@@ -180,7 +180,6 @@ class Keys extends BasicAdmin
         if ($this->request->isPost() && isset($data['keys'])) {
             $db = Db::name($this->table)->where('keys', $data['keys']);
             !empty($data['id']) && $db->where('id', 'neq', $data['id']);
-            $data['content'] = htmlspecialchars_decode($data['content']);
             $db->count() > 0 && $this->error('关键字已经存在,请使用其它关键字!');
         }
     }

+ 1 - 2
application/wechat/controller/News.php

@@ -172,7 +172,6 @@ class News extends BasicAdmin
         foreach ($data as &$vo) {
             $vo['create_by'] = session('user.id');
             $vo['create_at'] = date('Y-m-d H:i:s');
-            $vo['content'] = htmlspecialchars_decode($vo['content']);
             if (empty($vo['digest'])) {
                 $vo['digest'] = mb_substr(strip_tags(str_replace(["\s", ' '], '', $vo['content'])), 0, 120);
             }
@@ -280,7 +279,7 @@ class News extends BasicAdmin
             $article['content'] = preg_replace_callback("/<img(.*?)src=['\"](.*?)['\"](.*?)\/?>/i", function ($matches) {
                 $src = MediaService::uploadImage($matches[2]);
                 return "<img{$matches[1]}src=\"{$src}\"{$matches[3]}/>";
-            }, htmlspecialchars_decode($article['content']));
+            }, $article['content']);
         }
         $wechat = WechatService::media();
         // 如果已经上传过,先删除之前的历史记录

+ 0 - 1
application/wechat/controller/Review.php

@@ -48,7 +48,6 @@ class Review extends Controller
             if (!empty($article['content_source_url'])) {
                 $this->redirect($article['content_source_url']);
             }
-            $article['content'] = htmlspecialchars_decode($article['content']);
             $this->assign('vo', $article);
         }
         $this->assign('type', $type);