瀏覽代碼

Update Search\Execute

Add ESCAPE for LIKE for CJK.
Visman 3 年之前
父節點
當前提交
e7a04c18cd
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      app/Models/Search/Execute.php

+ 3 - 3
app/Models/Search/Execute.php

@@ -235,7 +235,7 @@ class Execute extends Method
                 $whereCJK[]          = 'p.message LIKE ?s:word';
                 $usePCJK             = true;
                 if (isset($vars[':author'])) {
-                    $whereCJK[]      = 'p.poster LIKE ?s:author';
+                    $whereCJK[]      = 'p.poster LIKE ?s:author ESCAPE \'#\'';
                 }
                 break;
             case 2:
@@ -243,14 +243,14 @@ class Execute extends Method
                 $whereCJK[]          = 't.subject LIKE ?s:word';
                 $useTCJK             = true;
                 if (isset($vars[':author'])) {
-                    $whereCJK[]      = 't.poster LIKE ?s:author';
+                    $whereCJK[]      = 't.poster LIKE ?s:author ESCAPE \'#\'';
                 }
                 // при поиске в заголовках результат только в виде списка тем
                 $this->model->showAs = 1;
                 break;
             default:
                 if (isset($vars[':author'])) {
-                    $whereCJK[]      = '((p.message LIKE ?s:word AND p.poster LIKE ?s:author) OR (t.subject LIKE ?s:word AND t.poster LIKE ?s:author))';
+                    $whereCJK[]      = '((p.message LIKE ?s:word AND p.poster LIKE ?s:author ESCAPE \'#\') OR (t.subject LIKE ?s:word AND t.poster LIKE ?s:author ESCAPE \'#\'))';
                 } else {
                     $whereCJK[]      = '(p.message LIKE ?s:word OR t.subject LIKE ?s:word)';
                 }