From f733f8c5d91222af0532ddf01de2d2ca9bc580ca Mon Sep 17 00:00:00 2001 From: chicpro Date: Wed, 28 May 2014 17:31:18 +0900 Subject: [PATCH] =?UTF-8?q?stx=20=EB=AC=B8=EC=9E=90=EC=97=B4=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=ED=8A=B9=EC=88=98=EB=AC=B8=EC=9E=90=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common.php | 2 +- lib/common.lib.php | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/common.php b/common.php index 99765e440..0ba43ce95 100644 --- a/common.php +++ b/common.php @@ -227,7 +227,7 @@ if (isset($_REQUEST['sfl'])) { if (isset($_REQUEST['stx'])) { // search text (검색어) - $stx = trim($_REQUEST['stx']); + $stx = get_search_string(trim($_REQUEST['stx'])); if ($stx) $qstr .= '&stx=' . urlencode(cut_str($stx, 20, '')); } else { diff --git a/lib/common.lib.php b/lib/common.lib.php index 84fd0b4ad..5c043678f 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -2662,6 +2662,26 @@ function conv_date_format($format, $date, $add='') return date($format, $timestamp); } +// 검색어 특수문자 제거 +function get_search_string($stx) +{ + $stx_pattern = array(); + $stx_pattern[] = '#\.*/+#'; + $stx_pattern[] = '#\\\*#'; + $stx_pattern[] = '#\.{2,}#'; + $stx_pattern[] = '#[/\'\"%=*\#\(\)\|\+\-\&\!\$@~\{\}\[\]`]+#'; + + $stx_replace = array(); + $stx_replace[] = ''; + $stx_replace[] = ''; + $stx_replace[] = '.'; + $stx_replace[] = ''; + + $stx = preg_replace($stx_pattern, $stx_replace, $stx); + + return $stx; +} + // unescape nl 얻기 function conv_unescape_nl($str) {