게시판 order by 지정시 오류 수정
This commit is contained in:
+17
-19
@@ -1114,25 +1114,23 @@ $pg_anchor = '<ul class="anchor">
|
||||
<td>
|
||||
<?php echo help('리스트에서 기본으로 정렬에 사용할 필드를 선택합니다. "기본"으로 사용하지 않으시는 경우 속도가 느려질 수 있습니다.') ?>
|
||||
<select id="bo_sort_field" name="bo_sort_field">
|
||||
<option value="" <?php echo get_selected($board['bo_sort_field'], ""); ?>>wr_num, wr_reply : 기본</option>
|
||||
<option value="wr_datetime asc" <?php echo get_selected($board['bo_sort_field'], "wr_datetime asc"); ?>>wr_datetime asc : 날짜 이전것 부터</option>
|
||||
<option value="wr_datetime desc" <?php echo get_selected($board['bo_sort_field'], "wr_datetime desc"); ?>>wr_datetime desc : 날짜 최근것 부터</option>
|
||||
<option value="wr_hit asc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "wr_hit asc, wr_num, wr_reply"); ?>>wr_hit asc : 조회수 낮은것 부터</option>
|
||||
<option value="wr_hit desc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "wr_hit desc, wr_num, wr_reply"); ?>>wr_hit desc : 조회수 높은것 부터</option>
|
||||
<option value="wr_last asc" <?php echo get_selected($board['bo_sort_field'], "wr_last asc"); ?>>wr_last asc : 최근글 이전것 부터</option>
|
||||
<option value="wr_last desc" <?php echo get_selected($board['bo_sort_field'], "wr_last desc"); ?>>wr_last desc : 최근글 최근것 부터</option>
|
||||
<option value="wr_comment asc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "wr_comment asc, wr_num, wr_reply"); ?>>wr_comment asc : 댓글수 낮은것 부터</option>
|
||||
<option value="wr_comment desc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "wr_comment desc, wr_num, wr_reply"); ?>>wr_comment desc : 댓글수 높은것 부터</option>
|
||||
<option value="wr_good asc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "wr_good asc, wr_num, wr_reply"); ?>>wr_good asc : 추천수 낮은것 부터</option>
|
||||
<option value="wr_good desc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "wr_good desc, wr_num, wr_reply"); ?>>wr_good desc : 추천수 높은것 부터</option>
|
||||
<option value="wr_nogood asc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "wr_nogood asc, wr_num, wr_reply"); ?>>wr_nogood asc : 비추천수 낮은것 부터</option>
|
||||
<option value="wr_nogood desc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "wr_nogood desc, wr_num, wr_reply"); ?>>wr_nogood desc : 비추천수 높은것 부터</option>
|
||||
<option value="wr_subject asc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "wr_subject asc, wr_num, wr_reply"); ?>>wr_subject asc : 제목 오름차순</option>
|
||||
<option value="wr_subject desc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "wr_subject desc, wr_num, wr_reply"); ?>>wr_subject desc : 제목 내림차순</option>
|
||||
<option value="wr_name asc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "wr_name asc, wr_num, wr_reply"); ?>>wr_name asc : 글쓴이 오름차순</option>
|
||||
<option value="wr_name desc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "wr_name desc, wr_num, wr_reply"); ?>>wr_name desc : 글쓴이 내림차순</option>
|
||||
<option value="ca_name asc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "ca_name asc, wr_num, wr_reply"); ?>>ca_name asc : 분류명 오름차순</option>
|
||||
<option value="ca_name desc, wr_num, wr_reply" <?php echo get_selected($board['bo_sort_field'], "ca_name desc, wr_num, wr_reply"); ?>>ca_name desc : 분류명 내림차순</option>
|
||||
<?php foreach( get_board_sort_fields($board) as $v ){
|
||||
|
||||
$option_value = $order_by_str = $v[0];
|
||||
if( $v[0] === 'wr_num, wr_reply' ){
|
||||
$selected = (! $board['bo_sort_field']) ? 'selected="selected"' : '';
|
||||
$option_value = '';
|
||||
} else {
|
||||
$selected = ($board['bo_sort_field'] === $v[0]) ? 'selected="selected"' : '';
|
||||
}
|
||||
|
||||
if( $order_by_str !== 'wr_num, wr_reply' ){
|
||||
$tmp = explode(',', $v[0]);
|
||||
$order_by_str = $tmp[0];
|
||||
}
|
||||
|
||||
echo '<option value="'.$option_value.'" '.$selected.' >'.$order_by_str.' : '.$v[1].'</option>';
|
||||
} //end foreach ?>
|
||||
</select>
|
||||
</td>
|
||||
<td class="td_grpset">
|
||||
|
||||
+9
-4
@@ -153,10 +153,15 @@ if (!$sst) {
|
||||
$sod = "";
|
||||
}
|
||||
} else {
|
||||
// 게시물 리스트의 정렬 대상 필드가 아니라면 공백으로 (nasca 님 09.06.16)
|
||||
// 리스트에서 다른 필드로 정렬을 하려면 아래의 코드에 해당 필드를 추가하세요.
|
||||
// $sst = preg_match("/^(wr_subject|wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";
|
||||
$sst = preg_match("/^(wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";
|
||||
$board_sort_fields = get_board_sort_fields($board, 1);
|
||||
if (!$sod && array_key_exists($sst, $board_sort_fields)) {
|
||||
$sst = $board_sort_fields[$sst];
|
||||
} else {
|
||||
// 게시물 리스트의 정렬 대상 필드가 아니라면 공백으로 (nasca 님 09.06.16)
|
||||
// 리스트에서 다른 필드로 정렬을 하려면 아래의 코드에 해당 필드를 추가하세요.
|
||||
// $sst = preg_match("/^(wr_subject|wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";
|
||||
$sst = preg_match("/^(wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";
|
||||
}
|
||||
}
|
||||
|
||||
if(!$sst)
|
||||
|
||||
@@ -351,6 +351,42 @@ function get_bo_table_banned_word(){
|
||||
return run_replace('get_bo_table_banned_word', $folders);
|
||||
}
|
||||
|
||||
function get_board_sort_fields($board=array(), $make_key_return=''){
|
||||
$bo_sort_fields = run_replace('get_board_sort_fields', array(
|
||||
array('wr_num, wr_reply', '기본'),
|
||||
array('wr_datetime asc', '날짜 이전것 부터'),
|
||||
array('wr_datetime desc', '날짜 최근것 부터'),
|
||||
array('wr_hit asc, wr_num, wr_reply', '조회수 낮은것 부터'),
|
||||
array('wr_hit desc, wr_num, wr_reply', '조회수 높은것 부터'),
|
||||
array('wr_last asc', '최근글 이전것 부터'),
|
||||
array('wr_last desc', '최근글 최근것 부터'),
|
||||
array('wr_comment asc, wr_num, wr_reply', '댓글수 낮은것 부터'),
|
||||
array('wr_comment desc, wr_num, wr_reply', '댓글수 높은것 부터'),
|
||||
array('wr_good asc, wr_num, wr_reply', '추천수 낮은것 부터'),
|
||||
array('wr_good desc, wr_num, wr_reply', '추천수 높은것 부터'),
|
||||
array('wr_nogood asc, wr_num, wr_reply', '비추천수 낮은것 부터'),
|
||||
array('wr_nogood desc, wr_num, wr_reply', '비추천수 높은것 부터'),
|
||||
array('wr_subject asc, wr_num, wr_reply', '제목 오름차순'),
|
||||
array('wr_subject desc, wr_num, wr_reply', '제목 내림차순'),
|
||||
array('wr_name asc, wr_num, wr_reply', '글쓴이 오름차순'),
|
||||
array('wr_name desc, wr_num, wr_reply', '글쓴이 내림차순'),
|
||||
array('ca_name asc, wr_num, wr_reply', '분류명 오름차순'),
|
||||
array('ca_name desc, wr_num, wr_reply', '분류명 내림차순'),
|
||||
), $board, $make_key_return);
|
||||
|
||||
if( $make_key_return ){
|
||||
|
||||
$returns = array();
|
||||
foreach( $bo_sort_fields as $v ){
|
||||
$key = preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\/\^\*\s]/", "", $v[0]);
|
||||
$returns[$key] = $v[0];
|
||||
}
|
||||
|
||||
return $returns;
|
||||
}
|
||||
return $bo_sort_fields;
|
||||
}
|
||||
|
||||
function get_board_sfl_select_options($sfl){
|
||||
|
||||
global $is_admin;
|
||||
|
||||
Reference in New Issue
Block a user