From 5cb4415032836b531b1aec236405447217ab5ac0 Mon Sep 17 00:00:00 2001 From: chicpro Date: Wed, 3 Sep 2014 11:16:06 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EC=A0=84=20=EB=8B=A4=EC=9D=8C=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=20=EB=B2=84=ED=8A=BC=20=EC=B6=9C=EB=A0=A5?= =?UTF-8?q?=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/list.php | 8 ++++++-- lib/common.lib.php | 24 +++++++++++++++--------- 2 files changed, 21 insertions(+), 11 deletions(-) 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 7b668e6d2..ab77afef8 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() 함수의 변형