2022-09-17 20:50:50 +09:00
|
|
|
<?php
|
|
|
|
|
include_once('./_common.php');
|
|
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
if ($is_guest)
|
|
|
|
|
alert('회원이시라면 로그인 후 이용해 보십시오.', './login.php?url=' . urlencode(G5_BBS_URL . '/qalist.php'));
|
2022-09-17 20:50:50 +09:00
|
|
|
|
|
|
|
|
$qaconfig = get_qa_config();
|
|
|
|
|
|
|
|
|
|
$g5['title'] = $qaconfig['qa_title'];
|
|
|
|
|
include_once('./qahead.php');
|
|
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$skin_file = $qa_skin_path . '/list.skin.php';
|
2022-09-17 20:50:50 +09:00
|
|
|
|
|
|
|
|
$category_option = '';
|
|
|
|
|
if ($qaconfig['qa_category']) {
|
2024-09-19 20:57:39 +09:00
|
|
|
$category_href = G5_BBS_URL . '/qalist.php';
|
|
|
|
|
|
|
|
|
|
$category_option .= '<li><a href="' . $category_href . '"';
|
|
|
|
|
if ($sca == '')
|
|
|
|
|
$category_option .= ' id="bo_cate_on"';
|
|
|
|
|
$category_option .= '>전체</a></li>';
|
|
|
|
|
|
|
|
|
|
$categories = explode('|', $qaconfig['qa_category']); // 구분자가 | 로 되어 있음
|
|
|
|
|
for ($i = 0; $i < count($categories); $i++) {
|
|
|
|
|
$category = trim($categories[$i]);
|
|
|
|
|
if ($category == '')
|
|
|
|
|
continue;
|
|
|
|
|
$category_msg = '';
|
|
|
|
|
$category_option .= '<li><a href="' . ($category_href . "?sca=" . urlencode($category)) . '"';
|
|
|
|
|
if ($category == $sca) { // 현재 선택된 카테고리라면
|
|
|
|
|
$category_option .= ' id="bo_cate_on"';
|
|
|
|
|
$category_msg = '<span class="sound_only">열린 분류 </span>';
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
2024-09-19 20:57:39 +09:00
|
|
|
$category_option .= '>' . $category_msg . $category . '</a></li>';
|
|
|
|
|
}
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
if (is_file($skin_file)) {
|
|
|
|
|
$sql_common = " from {$g5['qa_content_table']} ";
|
|
|
|
|
$sql_search = " where qa_type = '0' ";
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
if (!$is_admin)
|
|
|
|
|
$sql_search .= " and mb_id = '{$member['mb_id']}' ";
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
if ($sca) {
|
|
|
|
|
if (preg_match("/[a-zA-Z]/", $sca))
|
|
|
|
|
$sql_search .= " and INSTR(LOWER(qa_category), LOWER('$sca')) > 0 ";
|
|
|
|
|
else
|
|
|
|
|
$sql_search .= " and INSTR(qa_category, '$sca') > 0 ";
|
|
|
|
|
}
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$stx = trim($stx);
|
|
|
|
|
if ($stx) {
|
|
|
|
|
if (preg_match("/[a-zA-Z]/", $stx))
|
|
|
|
|
$sql_search .= " and ( INSTR(LOWER(qa_subject), LOWER('$stx')) > 0 or INSTR(LOWER(qa_content), LOWER('$stx')) > 0 )";
|
|
|
|
|
else
|
|
|
|
|
$sql_search .= " and ( INSTR(qa_subject, '$stx') > 0 or INSTR(qa_content, '$stx') > 0 ) ";
|
|
|
|
|
}
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$sql_order = " order by qa_num ";
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$sql = " select count(*) as cnt
|
2022-09-17 20:50:50 +09:00
|
|
|
$sql_common
|
|
|
|
|
$sql_search ";
|
2024-09-19 20:57:39 +09:00
|
|
|
$row = sql_fetch($sql);
|
|
|
|
|
$total_count = $row['cnt'];
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$page_rows = $qaconfig['qa_page_rows'];
|
|
|
|
|
$total_page = ceil($total_count / $page_rows); // 전체 페이지 계산
|
|
|
|
|
if ($page < 1) {
|
|
|
|
|
$page = 1;
|
|
|
|
|
} // 페이지가 없으면 첫 페이지 (1 페이지)
|
|
|
|
|
$from_record = ($page - 1) * $page_rows; // 시작 열을 구함
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$sql = " select *
|
2022-09-17 20:50:50 +09:00
|
|
|
$sql_common
|
|
|
|
|
$sql_search
|
|
|
|
|
$sql_order
|
|
|
|
|
limit $from_record, $page_rows ";
|
2024-09-19 20:57:39 +09:00
|
|
|
$result = sql_query($sql);
|
|
|
|
|
|
2024-09-23 09:37:13 +09:00
|
|
|
$list = [];
|
2024-09-19 20:57:39 +09:00
|
|
|
$num = $total_count - ($page - 1) * $page_rows;
|
|
|
|
|
$subject_len = $qaconfig['qa_subject_len'];
|
|
|
|
|
for ($i = 0; $row = sql_fetch_array($result); $i++) {
|
|
|
|
|
$list[$i] = $row;
|
|
|
|
|
|
|
|
|
|
$list[$i]['category'] = get_text($row['qa_category']);
|
|
|
|
|
$list[$i]['subject'] = conv_subject($row['qa_subject'], $subject_len, '…');
|
|
|
|
|
if ($stx) {
|
|
|
|
|
$list[$i]['subject'] = search_font($stx, $list[$i]['subject']);
|
|
|
|
|
}
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$list[$i]['view_href'] = G5_BBS_URL . '/qaview.php?qa_id=' . $row['qa_id'] . $qstr;
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$list[$i]['icon_file'] = '';
|
|
|
|
|
if (trim($row['qa_file1']) || trim($row['qa_file2']))
|
|
|
|
|
$list[$i]['icon_file'] = '<img src="' . $qa_skin_url . '/img/icon_file.gif">';
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$list[$i]['name'] = get_text($row['qa_name']);
|
|
|
|
|
$list[$i]['date'] = substr($row['qa_datetime'], 2, 8);
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$list[$i]['num'] = $num - $i;
|
|
|
|
|
}
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$is_checkbox = false;
|
|
|
|
|
$admin_href = '';
|
|
|
|
|
if ($is_admin) {
|
|
|
|
|
$is_checkbox = true;
|
|
|
|
|
$admin_href = G5_ADMIN_URL . '/qa_config.php';
|
|
|
|
|
}
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$list_href = G5_BBS_URL . '/qalist.php';
|
|
|
|
|
$write_href = G5_BBS_URL . '/qawrite.php';
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$list_pages = preg_replace('/(\.php)(&|&)/i', '$1?', get_paging($qaconfig['qa_page_rows'], $page, $total_page, './qalist.php' . $qstr . '&page='));
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$stx = get_text(stripslashes($stx));
|
|
|
|
|
include_once($skin_file);
|
2022-09-17 20:50:50 +09:00
|
|
|
} else {
|
2024-09-19 20:57:39 +09:00
|
|
|
echo '<div>' . str_replace(G5_PATH . '/', '', $skin_file) . '이 존재하지 않습니다.</div>';
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
include_once('./qatail.php');
|