stx 문자열에서 특수문자 제거 코드 추가

This commit is contained in:
chicpro
2014-05-28 17:31:18 +09:00
parent 9388ad70b3
commit f733f8c5d9
2 changed files with 21 additions and 1 deletions

View File

@ -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 {

View File

@ -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)
{