diff --git a/bbs/list.php b/bbs/list.php index b7d37a50c..c55ed71e9 100644 --- a/bbs/list.php +++ b/bbs/list.php @@ -195,16 +195,20 @@ $next_part_href = ''; if ($sca || $stx) { $list_href = './board.php?bo_table='.$bo_table; + $patterns = array('#&page=[0-9]*#', '#&spt=[0-9\-]*#'); + //if ($prev_spt >= $min_spt) $prev_spt = $spt - $config['cf_search_part']; if (isset($min_spt) && $prev_spt >= $min_spt) { - $prev_part_href = './board.php?bo_table='.$bo_table.$qstr.'&spt='.$prev_spt.'&page=1'; + $qstr1 = preg_replace($patterns, '', $qstr); + $prev_part_href = './board.php?bo_table='.$bo_table.$qstr1.'&spt='.$prev_spt.'&page=1'; $write_pages = page_insertbefore($write_pages, '이전검색'); } $next_spt = $spt + $config['cf_search_part']; if ($next_spt < 0) { - $next_part_href = './board.php?bo_table='.$bo_table.$qstr.'&spt='.$next_spt.'&page=1'; + $qstr1 = preg_replace($patterns, '', $qstr); + $next_part_href = './board.php?bo_table='.$bo_table.$qstr1.'&spt='.$next_spt.'&page=1'; $write_pages = page_insertafter($write_pages, '다음검색'); } } diff --git a/lib/common.lib.php b/lib/common.lib.php index 759c76601..73b57c2e7 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -54,21 +54,27 @@ function get_paging($write_pages, $cur_page, $total_page, $url, $add="") return ""; } -// 페이징 코드의
태그 다음에 코드를 삽입 +// 페이징 코드의
태그 이전에 코드를 삽입 +// 페이징 코드의 태그 이전에 코드를 삽입 function page_insertafter($paging_html, $insert_html) { - if ($paging_html) { - //return preg_replace("/(<\/span><\/div>)$/", $insert_html.'$1', $paging_html); - return preg_replace("#()$#", $insert_html.'$1', $paging_html); - } + if(!$paging_html) + $paging_html = ''; + + if(preg_match("#".PHP_EOL."#", $paging_html)) + $php_eol = ''; + else + $php_eol = PHP_EOL; + + return preg_replace("#()$#", $php_eol.$insert_html.'$1', $paging_html); } // 변수 또는 배열의 이름과 값을 얻어냄. print_r() 함수의 변형