first commit 2

This commit is contained in:
hmw1001
2026-06-11 18:47:38 +09:00
parent c768729ce6
commit 6f534e33a6
11095 changed files with 1595758 additions and 0 deletions
@@ -0,0 +1,33 @@
<?php
include_once('../../../../../common.php');
// 관리자가 아니면 실행 중단
if (!$is_admin) {
die(json_encode(['error' => '관리자만 접근 가능합니다.']));
}
header('Content-Type: application/json');
$bo_table = isset($_POST['bo_table']) ? trim($_POST['bo_table']) : '';
$wr_id = isset($_POST['wr_id']) ? intval($_POST['wr_id']) : 0;
$status = isset($_POST['status']) ? trim($_POST['status']) : '';
if (!$bo_table || !$wr_id || !in_array($status, ['show', 'hide'])) {
die(json_encode(['error' => '필수 정보가 누락되었습니다.']));
}
// '숨김' 상태일 때는 wr_10 필드에 1을, '보임' 상태일 때는 0을 저장합니다.
$new_value = ($status == 'hide') ? '1' : '0';
$write_table = $g5['write_prefix'] . $bo_table;
$sql = " UPDATE {$write_table} SET wr_10 = '{$new_value}' WHERE wr_id = '{$wr_id}' ";
$result = sql_query($sql);
if ($result) {
// 성공 시 새로운 상태를 반환
echo json_encode(['success' => true, 'new_status' => ($new_value == '1' ? 'hidden' : 'visible')]);
} else {
echo json_encode(['error' => '데이터베이스 업데이트에 실패했습니다.']);
}
?>
@@ -0,0 +1,9 @@
<?php
if (!defined('_GNUBOARD_')) exit;
// main_visual 스킨 광고 영역 설정
$main_visual_skin_config = [
'left_ad' => false, // 좌측 광고 사용 안함
'right_ad' => false, // 우측 광고 사용 안함
];
?>
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8" ?>
<dwsync>
<file name="btn_close.gif" server="happyjung.com:5001/www/" local="131979082007552031" remote="131980119000000000" Dst="0" />
<file name="bull_1.gif" server="happyjung.com:5001/www/" local="131979082006962424" remote="131980119000000000" Dst="0" />
<file name="bull_10.gif" server="happyjung.com:5001/www/" local="131979082006772542" remote="131980119000000000" Dst="0" />
<file name="bull_11.gif" server="happyjung.com:5001/www/" local="131979082006232877" remote="131980119000000000" Dst="0" />
<file name="bull_12.gif" server="happyjung.com:5001/www/" local="131979082005803143" remote="131980119000000000" Dst="0" />
<file name="bull_13.gif" server="happyjung.com:5001/www/" local="131979082005253594" remote="131980119000000000" Dst="0" />
<file name="bull_14.gif" server="happyjung.com:5001/www/" local="131979082004743798" remote="131980119000000000" Dst="0" />
<file name="bull_15.gif" server="happyjung.com:5001/www/" local="131979082003824369" remote="131980119000000000" Dst="0" />
<file name="bull_16.gif" server="happyjung.com:5001/www/" local="131979082003684453" remote="131980119000000000" Dst="0" />
<file name="bull_17.gif" server="happyjung.com:5001/www/" local="131979082003164776" remote="131980119000000000" Dst="0" />
<file name="bull_18.gif" server="happyjung.com:5001/www/" local="131979082002515176" remote="131980119000000000" Dst="0" />
<file name="bull_19.gif" server="happyjung.com:5001/www/" local="131979082002055462" remote="131980119000000000" Dst="0" />
<file name="bull_2.gif" server="happyjung.com:5001/www/" local="131979082001565747" remote="131980119000000000" Dst="0" />
<file name="bull_20.gif" server="happyjung.com:5001/www/" local="131979082001026095" remote="131980119000000000" Dst="0" />
<file name="bull_21.gif" server="happyjung.com:5001/www/" local="131979082000586371" remote="131980119000000000" Dst="0" />
<file name="bull_22.gif" server="happyjung.com:5001/www/" local="131979082000106668" remote="131980119000000000" Dst="0" />
<file name="bull_23.gif" server="happyjung.com:5001/www/" local="131979081999616945" remote="131980119000000000" Dst="0" />
<file name="bull_24.gif" server="happyjung.com:5001/www/" local="131979081998767473" remote="131980119000000000" Dst="0" />
<file name="bull_25.gif" server="happyjung.com:5001/www/" local="131979081998677552" remote="131980119000000000" Dst="0" />
<file name="bull_26.gif" server="happyjung.com:5001/www/" local="131979081998177863" remote="131980119000000000" Dst="0" />
<file name="bull_27.gif" server="happyjung.com:5001/www/" local="131979081997628202" remote="131980119000000000" Dst="0" />
<file name="bull_28.gif" server="happyjung.com:5001/www/" local="131979081997108523" remote="131980119000000000" Dst="0" />
<file name="bull_29.gif" server="happyjung.com:5001/www/" local="131979081996478914" remote="131980119000000000" Dst="0" />
<file name="bull_3.gif" server="happyjung.com:5001/www/" local="131979081996059173" remote="131980119000000000" Dst="0" />
<file name="bull_30-1.gif" server="happyjung.com:5001/www/" local="131979081995559497" remote="131980119000000000" Dst="0" />
<file name="bull_30.gif" server="happyjung.com:5001/www/" local="131979081995109763" remote="131980119000000000" Dst="0" />
<file name="bull_4.gif" server="happyjung.com:5001/www/" local="131979081994650045" remote="131980119000000000" Dst="0" />
<file name="bull_5.gif" server="happyjung.com:5001/www/" local="131979081994130368" remote="131980119000000000" Dst="0" />
<file name="bull_6.gif" server="happyjung.com:5001/www/" local="131979081993300882" remote="131980119000000000" Dst="0" />
<file name="bull_7.gif" server="happyjung.com:5001/www/" local="131979081993250910" remote="131980119000000000" Dst="0" />
<file name="bull_8.gif" server="happyjung.com:5001/www/" local="131979081992281511" remote="131980119000000000" Dst="0" />
<file name="bull_9.gif" server="happyjung.com:5001/www/" local="131979081992191568" remote="131980119000000000" Dst="0" />
<file name="bull_a.gif" server="happyjung.com:5001/www/" local="131979081991262143" remote="131980119000000000" Dst="0" />
<file name="cal.gif" server="happyjung.com:5001/www/" local="131979081991202152" remote="131980119000000000" Dst="0" />
<file name="icon.gif" server="happyjung.com:5001/www/" local="131979081990362720" remote="131980119000000000" Dst="0" />
<file name="icon_file.gif" server="happyjung.com:5001/www/" local="131979081990302736" remote="131980119000000000" Dst="0" />
<file name="icon_hot.gif" server="happyjung.com:5001/www/" local="131979081989483215" remote="131980119000000000" Dst="0" />
<file name="icon_img.gif" server="happyjung.com:5001/www/" local="131979081989433276" remote="131980119000000000" Dst="0" />
<file name="icon_link.gif" server="happyjung.com:5001/www/" local="131979081988553808" remote="131980119000000000" Dst="0" />
<file name="icon_mobile.gif" server="happyjung.com:5001/www/" local="131979081988503855" remote="131980119000000000" Dst="0" />
<file name="icon_movie.gif" server="happyjung.com:5001/www/" local="131979081987634370" remote="131980119000000000" Dst="0" />
<file name="icon_new.gif" server="happyjung.com:5001/www/" local="131979081987584419" remote="131980119000000000" Dst="0" />
<file name="icon_reply.gif" server="happyjung.com:5001/www/" local="131979081986765031" remote="131980119000000000" Dst="0" />
<file name="icon_secret.gif" server="happyjung.com:5001/www/" local="131979081986715074" remote="131980119000000000" Dst="0" />
<file name="icon_sound.gif" server="happyjung.com:5001/www/" local="131979081985855489" remote="131980119000000000" Dst="0" />
<file name="m_next.gif" server="happyjung.com:5001/www/" local="131979081985805519" remote="131980119000000000" Dst="0" />
<file name="m_prev.gif" server="happyjung.com:5001/www/" local="131979081985035998" remote="131980119000000000" Dst="0" />
<file name="point.gif" server="happyjung.com:5001/www/" local="131979081984896083" remote="131980119000000000" Dst="0" />
<file name="y_next.gif" server="happyjung.com:5001/www/" local="131979081984436368" remote="131980119000000000" Dst="0" />
<file name="y_prev.gif" server="happyjung.com:5001/www/" local="131979081983207101" remote="131980119000000000" Dst="0" />
</dwsync>
Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

@@ -0,0 +1,203 @@
document.addEventListener('DOMContentLoaded', function() {
const listBody = document.getElementById('bo_list_body');
const toggleBtn = document.getElementById('view-toggle-btn1');
const chkAll = document.getElementById('chkall');
const loadMoreBtn = document.getElementById('btn-load-more'); // 💡 [추가] 더보기 버튼
const pagination = document.querySelector('.bo-pagination'); // 💡 [추가] 페이지네이션
if (!listBody || !toggleBtn) {
return; // 필수 요소가 없으면 스크립트 중단
}
const toggleIcon = toggleBtn.querySelector('i');
// 초기 뷰 모드는 HTML의 data-view-mode 속성에서 가져옴 (PHP에서 설정됨)
let currentViewMode = listBody.dataset.viewMode || 'card';
// 뷰 모드를 설정하고 버튼의 아이콘과 툴팁을 업데이트하는 함수
function setViewMode(mode) {
// data-view-mode 속성 변경
listBody.dataset.viewMode = mode;
if (mode === 'card') {
// 현재 카드뷰 -> 다음 행동은 '목록형 보기'
toggleIcon.className = 'fa fa-bars'; // 목록 아이콘
toggleBtn.title = '목록형으로 보기';
// 💡 [추가] 더보기 버튼 보이기, 페이지네이션 숨기기
if (loadMoreBtn) loadMoreBtn.parentElement.style.display = 'block';
if (pagination) pagination.style.display = 'none';
} else { // 'list'
// 현재 목록뷰 -> 다음 행동은 '카드형 보기'
toggleIcon.className = 'fa fa-th-large'; // 카드 아이콘
toggleBtn.title = '카드형으로 보기';
// 💡 [추가] 더보기 버튼 숨기기, 페이지네이션 보이기
if (loadMoreBtn) loadMoreBtn.parentElement.style.display = 'none';
if (pagination) pagination.style.display = 'flex';
}
// 쿠키에 저장 (PHP와 연동)
set_cookie('board_' + g5_bo_table + '_view_mode', mode, 365);
}
// 토글 버튼 클릭 이벤트
toggleBtn.addEventListener('click', function() {
// 현재 뷰 모드를 확인하고 반대 모드로 전환
const newMode = (listBody.dataset.viewMode === 'card') ? 'list' : 'card';
setViewMode(newMode);
});
// 페이지 로드 시 초기 상태 설정
setViewMode(currentViewMode);
// 체크박스 동기화 및 전체 선택 상태 업데이트
const listCheckboxes = document.querySelectorAll('input[name="chk_wr_id[]"]');
const cardCheckboxes = document.querySelectorAll('input[name="chk_wr_id_card[]"]');
function updateCheckAllState() {
if (!chkAll) return;
const total = listCheckboxes.length;
let checkedCount = 0;
listCheckboxes.forEach(chk => {
if (chk.checked) checkedCount++;
});
chkAll.checked = (total > 0 && total === checkedCount);
}
// 리스트형 체크박스 변경 시
listCheckboxes.forEach((listChk, index) => {
listChk.addEventListener('change', function() {
if (cardCheckboxes[index]) {
cardCheckboxes[index].checked = this.checked;
}
updateCheckAllState();
});
});
// 카드형 체크박스 변경 시
cardCheckboxes.forEach((cardChk, index) => {
cardChk.addEventListener('change', function() {
const listChk = document.getElementById('chk_wr_id_' + index);
if (listChk) {
listChk.checked = this.checked;
}
updateCheckAllState();
});
});
// 전체 선택 체크박스 클릭 시
if (chkAll) {
chkAll.addEventListener('change', function() {
const isChecked = this.checked;
listCheckboxes.forEach(chk => chk.checked = isChecked);
cardCheckboxes.forEach(chk => chk.checked = isChecked);
});
}
// ▼▼▼ [추가] 더보기 버튼 기능 구현 ▼▼▼
if (loadMoreBtn) {
loadMoreBtn.addEventListener('click', function() {
const nextPage = parseInt(this.dataset.page);
const originalText = this.textContent;
this.disabled = true;
this.textContent = '로딩 중...';
// 현재 URL에서 페이지 파라미터만 변경
const url = new URL(window.location.href);
url.searchParams.set('page', nextPage);
fetch(url)
.then(response => response.text())
.then(html => {
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
// 다음 페이지의 카드 아이템들 가져오기
const newItems = doc.querySelectorAll('#bo_list_body .bo-card-item');
if (newItems.length > 0) {
newItems.forEach(item => {
// 💡 [중요] 새로 가져온 아이템의 체크박스 ID 충돌 방지 및 이벤트 연결 필요
// 하지만 여기서는 단순 추가만 하고, 체크박스 기능은 복잡해지므로 생략하거나
// 필요하다면 추가 로직 구현해야 함. (일단은 추가만)
listBody.appendChild(item);
});
// 다음 페이지 번호 업데이트
this.dataset.page = nextPage + 1;
this.disabled = false;
this.textContent = originalText;
// 다음 페이지에 더보기 버튼이 없으면 현재 버튼 숨김
const nextLoadMoreBtn = doc.getElementById('btn-load-more');
if (!nextLoadMoreBtn) {
this.parentElement.style.display = 'none';
}
} else {
this.parentElement.style.display = 'none';
}
})
.catch(error => {
console.error('Error:', error);
this.disabled = false;
this.textContent = originalText;
alert('게시물을 불러오는 중 오류가 발생했습니다.');
});
});
}
// ▲▲▲ 여기까지 ▲▲▲
// 노출 상태 토글 기능
$('#bo_list_body').on('click', '.btn-status-toggle', function(e) {
e.preventDefault();
const button = $(this);
const wr_id = button.data('wr-id');
const is_on = button.hasClass('status-on');
const new_status = is_on ? 'hide' : 'show';
const bo_table = $('input[name="bo_table"]').val();
button.find('i').removeClass('fa-toggle-on fa-toggle-off').addClass('fa-spinner fa-spin');
$.ajax({
url: board_skin_url + '/ajax.status_update.php',
type: 'POST',
data: {
bo_table: bo_table,
wr_id: wr_id,
status: new_status
},
dataType: 'json',
success: function(data) {
if (data.success) {
button.removeClass('status-on status-off');
button.find('i').removeClass('fa-spinner fa-spin');
if (data.new_status === 'hidden') {
button.addClass('status-off').attr('title', '노출 상태로 변경');
button.find('i').addClass('fa-toggle-off');
} else {
button.addClass('status-on').attr('title', '숨김 상태로 변경');
button.find('i').addClass('fa-toggle-on');
}
location.reload();
} else {
alert(data.error || '상태 변경에 실패했습니다.');
button.find('i').removeClass('fa-spinner fa-spin').addClass(is_on ? 'fa-toggle-on' : 'fa-toggle-off');
}
},
error: function() {
alert('서버와 통신 중 오류가 발생했습니다.');
button.find('i').removeClass('fa-spinner fa-spin').addClass(is_on ? 'fa-toggle-on' : 'fa-toggle-off');
}
});
});
});
@@ -0,0 +1,56 @@
// jQuery가 로드된 후 이 스크립트가 실행되어야 합니다.
$(function() {
// Datepicker 초기화
$(".datepicker").datepicker({
dateFormat: "yy-mm-dd",
changeMonth: true,
changeYear: true,
dayNamesMin: ["일", "월", "화", "수", "목", "금", "토"],
monthNamesShort: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"],
});
// ▼▼▼ [핵심 수정] 여러 파일 미리보기 기능 ▼▼▼
const fileWrappers = document.querySelectorAll('.file_preview_wrapper');
fileWrappers.forEach((wrapper, index) => {
const previewBox = wrapper.querySelector('.file_preview');
const fileInput = wrapper.querySelector('input[type="file"]');
const previewText = previewBox.querySelector('.preview_text');
const existingFileInfo = wrapper.querySelector('.preview_info');
if (!previewBox || !fileInput) return;
// 1. 미리보기 박스를 클릭하면 숨겨진 파일 입력 필드가 클릭되도록 함
// previewBox.addEventListener('click', () => {
// fileInput.click();
// });
// 2. 파일이 선택되었을 때의 동작
fileInput.addEventListener('change', (event) => {
const file = event.target.files[0];
if (file) {
// 기존 파일 정보가 있다면 숨김 (새 파일로 교체되므로)
if (existingFileInfo) {
existingFileInfo.style.display = 'none';
}
if (file.type.startsWith('video/')) {
// 동영상은 미리보기를 생성하지 않고 파일 이름만 표시
previewBox.style.backgroundImage = 'none';
previewText.textContent = `동영상: ${file.name}`;
previewText.style.display = 'block';
} else if (file.type.startsWith('image/')) {
// 이미지는 FileReader를 사용해 미리보기 생성
const reader = new FileReader();
reader.onload = function(e) {
console.log("sdfasdfasfd= > ",`url(${e.target.result})`)
previewBox.style.backgroundImage = `url(${e.target.result})`;
previewText.style.display = 'none'; // '클릭하여 파일 업로드' 텍스트 숨김
}
reader.readAsDataURL(file);
}
}
});
});
// ▲▲▲ 여기까지 ▲▲▲
});
@@ -0,0 +1,71 @@
// jQuery가 로드된 후 이 스크립트가 실행되어야 합니다.
$(function() {
// Datepicker 초기화
$(".datepicker").datepicker({
dateFormat: "yy-mm-dd",
changeMonth: true,
changeYear: true,
dayNamesMin: ["일", "월", "화", "수", "목", "금", "토"],
monthNamesShort: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"],
});
// 노출 방식 라디오 버튼 제어
const exposureRadios = $('input[name="wr_9"]');
const reservationFields = $('#reservation_fields');
function toggleReservationFields() {
if ($('input[name="wr_9"]:checked').val() === 'RESERVED') {
reservationFields.slideDown();
} else {
reservationFields.slideUp();
}
}
exposureRadios.on('change', toggleReservationFields);
toggleReservationFields();
// ▼▼▼ [핵심 수정] 여러 파일 미리보기 기능 ▼▼▼
const fileWrappers = document.querySelectorAll('.file_preview_wrapper');
fileWrappers.forEach((wrapper, index) => {
const previewBox = wrapper.querySelector('.file_preview');
const fileInput = wrapper.querySelector('input[type="file"]');
const previewText = previewBox.querySelector('.preview_text');
const existingFileInfo = wrapper.querySelector('.preview_info');
if (!previewBox || !fileInput) return;
// 1. 미리보기 박스를 클릭하면 숨겨진 파일 입력 필드가 클릭되도록 함
previewBox.addEventListener('click', () => {
fileInput.click();
});
// 2. 파일이 선택되었을 때의 동작
fileInput.addEventListener('change', (event) => {
const file = event.target.files[0];
if (file) {
// 기존 파일 정보가 있다면 숨김 (새 파일로 교체되므로)
if (existingFileInfo) {
existingFileInfo.style.display = 'none';
}
if (file.type.startsWith('video/')) {
// 동영상은 미리보기를 생성하지 않고 파일 이름만 표시
previewBox.style.backgroundImage = 'none';
previewText.textContent = `동영상: ${file.name}`;
previewText.style.display = 'block';
} else if (file.type.startsWith('image/')) {
// 이미지는 FileReader를 사용해 미리보기 생성
const reader = new FileReader();
reader.onload = function(e) {
console.log("sdfasdfasfd= > ",`url(${e.target.result})`)
previewBox.style.backgroundImage = `url(${e.target.result})`;
previewText.style.display = 'none'; // '클릭하여 파일 업로드' 텍스트 숨김
}
reader.readAsDataURL(file);
}
}
});
});
// ▲▲▲ 여기까지 ▲▲▲
});
@@ -0,0 +1,357 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 0. 중앙 광고 설정 파일을 로드합니다.
include_once(G5_THEME_PATH . '/skin/board/board_ad_config.php');
// 1. 자식 스킨의 설정 파일을 로드합니다.
$config_path = __DIR__ . '/config.php';
if (file_exists($config_path)) {
include_once($config_path);
}
// 이 스킨의 전용 스타일시트와 자바스크립트를 불러옵니다.
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css?ver='.G5_SERVER_TIME.'">', 0);
add_javascript('<script src="'.$board_skin_url.'/js/list.js?ver='.G5_SERVER_TIME.'"></script>', 0);
// 수정 링크 생성 함수
function write_url($wr_id)
{
global $bo_table, $qstr;
return G5_BBS_URL . "/write.php?w=u&bo_table={$bo_table}&wr_id={$wr_id}&{$qstr}";
}
// 삭제 링크 생성 함수
function delete_url($href)
{
return $href . "&sw=delete";
}
$default_view_mode = isset($board_config['list']['default_view_mode']) ? $board_config['list']['default_view_mode'] : 'card';
$view_mode = get_cookie('board_' . $bo_table . '_view_mode') ?: $default_view_mode;
?>
<!-- ▼▼▼ [핵심 수정] JS에서 사용할 PHP 변수를 전역 JS 변수로 선언합니다. ▼▼▼ -->
<script>
const board_skin_url = "<?php echo $board_skin_url; ?>";
const total_page = <?php echo $total_page; ?>;
const current_page = <?php echo $page; ?>;
</script>
<!-- ▲▲▲ 여기까지 ▲▲▲ -->
<!-- 게시판 목록 시작 -->
<main class="main-content-wrapper">
<div class="three-column-layout container">
<?php if (isset($board_ad_config['list_ad']['left']) && $board_ad_config['list_ad']['left'] === true): ?>
<aside class="layout-sidebar-left reveal-up">
<div class="sidebar-inner">
<!-- <h3 class="sidebar-title">광고 영역</h3>-->
<!-- 💡 [수정] 좌측 모듈 영역에 고유 ID 부여 -->
<div class="flex_box flex_box_l" data-layout="main-left"></div>
</div>
</aside>
<?php endif; ?>
<main class="layout-main-content">
<div id="bo_list" class="bo-list-container">
<!-- 게시판 상단 정보 및 버튼 영역 -->
<div class="bo-list-header">
<div class="bo-list-total">
<span>Total <?php echo number_format($total_count) ?>건</span>
<span class="sound_only"><?php echo $page ?> 페이지</span>
</div>
<div class="bo-list-buttons">
<button type="button" id="view-toggle-btn1" class="btn-view-toggle" title="보기 모드 전환">
<i class="fa <?php echo ($view_mode === 'card') ? 'fa-list' : 'fa-th-large'; ?>" aria-hidden="true"></i>
</button>
<?php if ($admin_href) { ?><a href="<?php echo $admin_href ?>" class="btn-admin">
관리자</a><?php } ?>
<?php if ($write_href) { ?><a href="<?php echo $write_href ?>" class="btn-write">
글쓰기</a><?php } ?>
</div>
</div>
<form name="fboardlist" id="fboardlist" action="<?php echo G5_BBS_URL; ?>/board_list_update.php"
onsubmit="return fboardlist_submit(this);" method="post">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="sw" value="">
<!-- 💡 [수정] 전체 선택 체크박스를 bo_list_body 밖으로 이동 -->
<?php if ($is_checkbox) { ?>
<div class="list-chk-all">
<input type="checkbox" id="chkall"
onclick="if (this.checked) all_checked(true); else all_checked(false);"
class="selec_chk">
<label for="chkall"><span></span> 전체선택</label>
</div>
<?php } ?>
<!-- 💡 [수정] data-view-mode 속성 추가 -->
<div id="bo_list_body" class="list-view" data-view-mode="<?php echo $view_mode; ?>">
<?php
for ($i = 0; $i < count($list); $i++) {
// --- 💡 [핵심 수정] 게시물 상세 정보 및 상태 정보 가져오기 ---
$write_table = $g5['write_prefix'] . $bo_table;
$post_data = get_write($write_table, $list[$i]['wr_id']);
// 1. 썸네일 이미지 가져오기
$thumbnail = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], 280, 180);
// 2. 이미지가 없을 경우, 본문 내용의 일부를 가져오기
$content_preview = '';
if (!$thumbnail['src'] && isset($post_data['wr_content'])) {
$content_preview = cut_str(strip_tags($post_data['wr_content']), 150);
}
// 3. 노출 상태 정보 처리
$status_text = '정보 없음';
$status_class = 'expired';
$reservation_period = '';
$is_hidden = !empty($post_data['wr_10']); // wr_10 필드가 1이면 '숨김' 상태
$today = G5_TIME_YMD;
if ($is_hidden) {
$status_text = '숨김';
$status_class = 'hidden';
} else if (isset($post_data['wr_9'])) {
if ($post_data['wr_9'] == 'RESERVED') {
$start_date = $post_data['wr_2'];
$end_date = $post_data['wr_3'];
$reservation_period = $start_date . ' ~ ' . $end_date;
if ($today >= $start_date && $today <= $end_date) {
$status_text = '노출중';
$status_class = 'active';
} elseif ($today < $start_date) {
$status_text = '예약됨';
$status_class = 'scheduled';
} else {
$status_text = '기간만료';
$status_class = 'expired';
}
} else { // IMMEDIATE
$status_text = '즉시 노출';
$status_class = 'active';
}
}
// --- 데이터 준비 끝 ---
?>
<!-- 1. 목록형 아이템 (bo-list-item) -->
<div class="bo-list-item">
<?php if ($is_checkbox) { ?>
<div class="item-chk">
<input type="checkbox" name="chk_wr_id[]"
value="<?php echo $list[$i]['wr_id'] ?>"
id="chk_wr_id_<?php echo $i ?>" class="selec_chk">
<!-- 💡 [수정] 라벨 추가 -->
<label for="chk_wr_id_<?php echo $i ?>"><span></span><b class="sound_only"><?php echo $list[$i]['subject'] ?></b></label>
</div>
<?php } ?>
<div class="item-main">
<div class="item-subject">
<a href="<?php echo $list[$i]['href'] ?>" class="item-title">
<?php echo $list[$i]['subject'] ?>
</a>
<?php if ($list[$i]['comment_cnt']) { ?><span
class="item-comment-count"><?php echo $list[$i]['wr_comment']; ?></span><?php } ?>
</div>
<div class="item-meta">
<span class="item-author"><?php echo $list[$i]['name'] ?></span>
<span class="item-date"><?php echo $list[$i]['datetime2'] ?></span>
<span class="item-views">조회 <?php echo $list[$i]['wr_hit'] ?></span>
<span class="item-status-wrapper">
<span class="status-badge status-<?php echo $status_class; ?>"><?php echo $status_text; ?></span>
<?php if ($reservation_period) { ?>
<span class="reservation-info">(<?php echo $reservation_period; ?>)</span>
<?php } ?>
</span>
</div>
</div>
<?php if ($is_admin) { ?>
<div class="item-actions">
<div class="actions-group">
<strong class="item-actions-label">노출 여부</strong>
<button type="button"
class="btn-status-toggle <?php echo $is_hidden ? 'status-off' : 'status-on'; ?>"
data-wr-id="<?php echo $list[$i]['wr_id']; ?>"
title="<?php echo $is_hidden ? '노출 상태로 변경' : '숨김 상태로 변경'; ?>">
<i class="fa <?php echo $is_hidden ? 'fa-toggle-off' : 'fa-toggle-on'; ?>"></i>
</button>
</div>
<div class="action-group">
<a href="<?php echo write_url($list[$i]['wr_id']); ?>"
class="btn-action btn-modify">수정</a>
<a href="<?php echo delete_url($list[$i]['href']); ?>"
class="btn-action btn-delete" onclick="return delete_confirm(this);">삭제</a>
</div>
</div>
<?php } ?>
</div>
<!-- 2. 카드형 아이템 (bo-card-item) -->
<div class="bo-card-item">
<a href="<?php echo $list[$i]['href'] ?>" class="card-link">
<div class="card-thumbnail">
<?php if ($thumbnail['src']) { ?>
<img src="<?php echo $thumbnail['src']; ?>"
alt="<?php echo $thumbnail['alt']; ?>">
<?php } else { ?>
<div class="card-content-preview">
<p><?php echo $content_preview ? $content_preview : '내용이 없습니다.'; ?></p>
</div>
<?php } ?>
</div>
<div class="card-info">
<div class="card-subject">
<?php echo $list[$i]['subject'] ?>
<?php if ($list[$i]['comment_cnt']) { ?><span
class="item-comment-count"><?php echo $list[$i]['wr_comment']; ?></span><?php } ?>
</div>
<div class="card-status-wrapper">
<span class="status-badge status-<?php echo $status_class; ?>"><?php echo $status_text; ?></span>
<?php if ($reservation_period) { ?>
<span class="reservation-info"><?php echo $reservation_period; ?></span>
<?php } ?>
</div>
</div>
</a>
<!-- ▼▼▼ [핵심 추가] 카드형 보기용 토글 스위치 ▼▼▼ -->
<?php if ($is_admin) { ?>
<div class="card-actions">
<div class="action-group">
<strong class="item-actions-label">노출 여부</strong>
<button type="button"
class="btn-status-toggle <?php echo $is_hidden ? 'status-off' : 'status-on'; ?>"
data-wr-id="<?php echo $list[$i]['wr_id']; ?>"
title="<?php echo $is_hidden ? '노출 상태로 변경' : '숨김 상태로 변경'; ?>">
<i class="fa <?php echo $is_hidden ? 'fa-toggle-off' : 'fa-toggle-on'; ?>"></i>
</button>
</div>
<div class="action-group">
<a href="<?php echo write_url($list[$i]['wr_id']); ?>"
class="btn-action btn-modify">수정</a>
<a href="<?php echo delete_url($list[$i]['href']); ?>"
class="btn-action btn-delete" onclick="return delete_confirm(this);">삭제</a>
</div>
</div>
<?php } ?>
<!-- ▲▲▲ 여기까지 ▲▲▲ -->
<?php if ($is_checkbox) { ?>
<div class="card-chk">
<input type="checkbox" name="chk_wr_id_card[]"
value="<?php echo $list[$i]['wr_id'] ?>"
id="chk_wr_id_card_<?php echo $i ?>" class="selec_chk">
<!-- 💡 [수정] 라벨 추가 -->
<label for="chk_wr_id_card_<?php echo $i ?>"><span></span><b class="sound_only"><?php echo $list[$i]['subject'] ?></b></label>
</div>
<?php } ?>
</div>
<?php } ?>
<?php if (count($list) == 0) {
echo '<div class="empty-list">게시물이 없습니다.</div>';
} ?>
</div>
<?php if ($is_checkbox) { ?>
<div class="bo-list-footer">
<button type="submit" name="btn_submit" value="선택삭제"
onclick="document.pressed=this.value"
class="btn-admin">선택삭제
</button>
</div>
<?php } ?>
</form>
<div class="bo-list-bottom-wrapper">
<!-- 💡 [수정] 더보기 버튼 추가 (카드형일 때만 표시) -->
<?php if ($page < $total_page): ?>
<div class="load-more-wrapper" style="display: <?php echo ($view_mode === 'card') ? 'block' : 'none'; ?>;">
<button type="button" id="btn-load-more" class="btn btn-primary" data-page="<?php echo $page + 1; ?>">더보기</button>
</div>
<?php endif; ?>
<!-- 💡 [수정] 페이지네이션 (리스트형일 때만 표시) -->
<div class="bo-pagination" style="display: <?php echo ($view_mode === 'list') ? 'flex' : 'none'; ?>;">
<?php echo $write_pages; ?>
</div>
<fieldset id="bo_sch" class="bo-search-box">
<legend class="sound_only">게시물 검색</legend>
<form name="fsearch" method="get">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sop" value="and">
<select name="sfl" id="sfl"><?php echo get_board_sfl_select_options($sfl); ?></select>
<input type="text" name="stx" value="<?php echo stripslashes($stx) ?>" required id="stx"
class="sch-input" size="25" maxlength="20" placeholder="검색어를 입력해주세요">
<button type="submit" class="sch-btn">검색</button>
</form>
</fieldset>
</div>
</div>
</main>
<!-- 3. 우측 사이드바 -->
<?php if (isset($board_ad_config['list_ad']['right']) && $board_ad_config['list_ad']['right'] === true): ?>
<aside class="layout-sidebar-right reveal-up">
<div class="sidebar-inner">
<!-- <h3 class="sidebar-title">광고 영역</h3>-->
<!-- 💡 [수정] 우측 모듈 영역에 고유 ID 부여 -->
<div class="flex_box flex_box_r" data-layout="main-right"></div>
</div>
</aside>
<?php endif; ?>
</div>
</main>
<?php if ($is_checkbox) { ?>
<script>
function all_checked(sw) {
var f = document.fboardlist;
for (var i = 0; i < f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]" || f.elements[i].name == "chk_wr_id_card[]")
f.elements[i].checked = sw;
}
}
function fboardlist_submit(f) {
var chk_count = 0;
for (var i = 0; i < f.length; i++) {
if ((f.elements[i].name == "chk_wr_id[]" || f.elements[i].name == "chk_wr_id_card[]") && f.elements[i].checked)
chk_count++;
}
if (!chk_count) {
alert(document.pressed + "할 게시물을 하나 이상 선택하세요.");
return false;
}
if (document.pressed == "선택삭제") {
if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다."))
return false;
f.removeAttribute("target");
f.action = "<?php echo G5_BBS_URL; ?>/board_list_update.php";
}
return true;
}
function delete_confirm(link) {
if (confirm("한번 삭제한 자료는 복구할 수 없습니다.\n\n정말 삭제하시겠습니까?")) {
window.location.href = link.href;
}
return false;
}
</script>
<?php } ?>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,222 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
// 이 스킨의 전용 스타일시트를 불러옵니다.
$style_ver = file_exists($board_skin_path . '/style.css') ? filemtime($board_skin_path . '/style.css') : G5_CSS_VER;
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css?ver=' . $style_ver . '">', 0);
// 노출 상태 계산
$status_text = '정보 없음';
$status_class = 'expired';
$is_hidden = (isset($view['wr_10']) && $view['wr_10'] == '1');
$today = G5_TIME_YMD;
if ($is_hidden) {
$status_text = '숨김 (노출 안 함)';
$status_class = 'hidden';
} else if (isset($view['wr_9']) && $view['wr_9'] == 'RESERVED') {
$start_date = $view['wr_2'];
$end_date = $view['wr_3'];
if ($today >= $start_date && $today <= $end_date) {
$status_text = '노출중 (예약)';
$status_class = 'active';
} elseif ($today < $start_date) {
$status_text = '예약됨 (대기)';
$status_class = 'scheduled';
} else {
$status_text = '기간만료';
$status_class = 'expired';
}
} else {
$status_text = '즉시 노출';
$status_class = 'active';
}
?>
<div id="bo_v">
<h2>제목</h2>
<h3 id="bo_v_title">
<?php if ($category_name) { ?><span class="item-category"><?php echo $view['ca_name']; ?></span><?php } ?>
<?php echo cut_str(get_text($view['wr_subject']), 70); // 글제목 출력 ?>
<span class="status-badge status-<?php echo $status_class; ?>" style="font-size: 14px; vertical-align: middle; margin-left: 10px;"><?php echo $status_text; ?></span>
</h3>
<div id="bo_v_info">
<fieldset class="write_div">
<h3 class="frm_label" style="margin-bottom: 0;"><strong>노출 설정</strong></h3>
<div class="option_group">
<label>
<input type="radio" name="wr_9_view" value="IMMEDIATE" <?php echo (isset($view['wr_9']) && $view['wr_9'] !== 'RESERVED') ? 'checked' : ''; ?> disabled>
<span class="custom-radio"></span> 즉시 노출
</label>
<label>
<input type="radio" name="wr_9_view" value="RESERVED" <?php echo (isset($view['wr_9']) && $view['wr_9'] === 'RESERVED') ? 'checked' : ''; ?> disabled>
<span class="custom-radio"></span> 예약 노출
</label>
<!-- 💡 [수정] 숨김 설정 표시 -->
<label style="margin-left: 20px;">
<input type="checkbox" name="wr_10_view" value="1" <?php echo $is_hidden ? 'checked': '0' ; ?> disabled>
<span class="custom-checkbox"></span> 숨김 (노출 안 함)
</label>
</div>
</fieldset>
<?php if (isset($view['wr_9']) && $view['wr_9'] === 'RESERVED') { ?>
<div id="reservation_fields" class="write_div">
<div class="date_picker_group">
<div class="date_item">
<label class="frm_label"><?php echo $board['bo_2_subj'] ?: '시작일' ?></label>
<div class="frm_static"><?php echo $view['wr_2']; ?></div>
</div>
<span class="date_divider">~</span>
<div class="date_item">
<label class="frm_label"><?php echo $board['bo_3_subj'] ?: '종료일' ?></label>
<div class="frm_static"><?php echo $view['wr_3']; ?></div>
</div>
</div>
</div>
<?php } ?>
<!-- 💡 [추가] 제품 마스터 맵 설정 표시 (wr_4, wr_5, wr_6) -->
<div class="write_div" style="background: #f8f9fa; padding: 20px; border-radius: 10px; border: 1px solid #e9ecef; margin-bottom: 20px;">
<h3 style="font-size: 15px; margin-bottom: 15px; color: #007bff;"><i class="fa fa-crosshairs"></i> 제품 마스터 맵 설정</h3>
<div class="write_div">
<label class="frm_label">연결 페이지명 (wr_4)</label>
<div class="frm_static"><?php echo isset($view['wr_4']) ? get_text($view['wr_4']) : '-'; ?></div>
</div>
<div style="display: flex; gap: 20px;">
<div style="flex: 1;">
<label class="frm_label">X 좌표 % (wr_5)</label>
<div class="frm_static"><?php echo isset($view['wr_5']) ? get_text($view['wr_5']) : '0'; ?>%</div>
</div>
<div style="flex: 1;">
<label class="frm_label">Y 좌표 % (wr_6)</label>
<div class="frm_static"><?php echo isset($view['wr_6']) ? get_text($view['wr_6']) : '0'; ?>%</div>
</div>
</div>
<div class="write_div">
<label class="frm_label">제품번호 (wr_7)</label>
<div class="frm_static"><?php echo isset($view['wr_7']) ? get_text($view['wr_7']) : '-'; ?></div>
</div>
</div>
<!-- 💡 [추가] 링크 정보 표시 -->
<?php if (isset($view['wr_link1']) && $view['wr_link1']) { ?>
<div class="write_div">
<h3 class="frm_label"><strong>링크 #1</strong></h3>
<div class="frm_static">
<a href="<?php echo $view['wr_link1']; ?>" target="_blank"><?php echo $view['wr_link1']; ?></a>
</div>
</div>
<?php } ?>
</div>
<div id="bo_v_atc">
<!-- 본문 내용 -->
<div id="write_div">
<h3 >상세 내용</h3>
<div class="view_content">
<?php echo conv_content($view['wr_content'], 1); ?>
</div>
</div>
<?php
// 📌 [핵심] 첨부파일을 하단에 갤러리 형태로 표시합니다.
if (isset($view['file']) && count($view['file']) > 0) {
echo "<div id=\"bo_v_gallery\">\n";
echo "<h3>첨부 파일</h3>";
echo "<div class='gallery_grid'>";
for ($i = 0; $i < $view['file']['count']; $i++) {
$file = $view['file'][$i];
if (empty($file['file'])) continue;
$file_ext = strtolower(pathinfo($file['file'], PATHINFO_EXTENSION));
$is_image = in_array($file_ext, ['gif', 'jpg', 'jpeg', 'png', 'webp']);
$file_url = $file['path'].'/'.$file['file'];
if ($is_image) {
// 썸네일 생성
$source_path = G5_DATA_PATH.'/file/'.$bo_table;
$thumb = thumbnail($file['file'], $source_path, $source_path, 200, 200, false, true);
$thumb_url = G5_DATA_URL.'/file/'.$bo_table.'/'.$thumb;
echo '<a href="'.$file_url.'" class="view_image_link">';
echo '<img src="'.$thumb_url.'" alt="'.get_text($file['source']).'">';
echo '</a>';
} else {
// 이미지가 아닌 파일은 다운로드 링크 제공
echo '<div class="gallery_item_other">';
echo '<a href="'.$file['href'].'" class="view_file_link" download>';
echo '<i class="fa fa-download"></i> '.get_text($file['source']);
echo '</a>';
echo '</div>';
}
}
echo "</div>"; // .gallery_grid
echo "</div>\n"; // #bo_v_gallery
}
?>
</div>
<div id="bo_v_bot">
<div class="btn_area">
<?php if ($update_href) { ?><a href="<?php echo $update_href ?>" class="btn_b02 btn">수정</a><?php } ?>
<?php if ($delete_href) { ?><a href="<?php echo $delete_href ?>" onclick="del(this.href); return false;" class="btn_b02 btn">삭제</a><?php } ?>
<?php if ($write_href) { ?><a href="<?php echo $write_href ?>" class="btn_b02 btn">글쓰기</a><?php } ?>
<a href="<?php echo $list_href ?>" class="btn_b01 btn">목록</a>
</div>
</div>
</div>
<!-- 이미지 팝업(라이트박스) HTML과 스크립트 -->
<div id="image_lightbox" class="image_lightbox">
<span class="lightbox_close">&times;</span>
<img class="lightbox_content" id="lightbox_image">
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const lightbox = document.getElementById('image_lightbox');
const lightboxImage = document.getElementById('lightbox_image');
const imageLinks = document.querySelectorAll('.view_image_link');
const closeBtn = document.querySelector('.lightbox_close');
if (!lightbox || !imageLinks.length) return;
imageLinks.forEach(link => {
// 💡 [개선] 이미지 파일이 아닌 경우 라이트박스 이벤트를 적용하지 않습니다.
if (!link.hasAttribute('download')) {
link.addEventListener('click', function(e) {
e.preventDefault();
lightboxImage.src = this.href;
lightbox.style.display = 'flex';
});
}
});
function closeModal() {
lightbox.style.display = 'none';
lightboxImage.src = '';
}
if(closeBtn) {
closeBtn.addEventListener('click', closeModal);
}
lightbox.addEventListener('click', function(e) {
if (e.target === lightbox) {
closeModal();
}
});
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape' && lightbox.style.display === 'flex') {
closeModal();
}
});
});
</script>
@@ -0,0 +1,355 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
?>
<script>
// 글자수 제한
var char_min = parseInt(<?php echo $comment_min ?>); // 최소
var char_max = parseInt(<?php echo $comment_max ?>); // 최대
</script>
<button type="button" class="cmt_btn"><span class="total"><b>댓글</b> <?php echo $view['wr_comment']; ?></span><span class="cmt_more"></span></button>
<!-- 댓글 시작 { -->
<section id="bo_vc">
<h2>댓글목록</h2>
<?php
$cmt_amt = count($list);
for ($i=0; $i<$cmt_amt; $i++) {
$comment_id = $list[$i]['wr_id'];
$cmt_depth = strlen($list[$i]['wr_comment_reply']) * 50;
$comment = $list[$i]['content'];
/*
if (strstr($list[$i]['wr_option'], "secret")) {
$str = $str;
}
*/
$comment = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $comment);
$cmt_sv = $cmt_amt - $i + 1; // 댓글 헤더 z-index 재설정 ie8 이하 사이드뷰 겹침 문제 해결
$c_reply_href = $comment_common_url.'&amp;c_id='.$comment_id.'&amp;w=c#bo_vc_w';
$c_edit_href = $comment_common_url.'&amp;c_id='.$comment_id.'&amp;w=cu#bo_vc_w';
$is_comment_reply_edit = ($list[$i]['is_reply'] || $list[$i]['is_edit'] || $list[$i]['is_del']) ? 1 : 0;
?>
<article id="c_<?php echo $comment_id ?>" <?php if ($cmt_depth) { ?>style="margin-left:<?php echo $cmt_depth ?>px;border-top-color:#e0e0e0"<?php } ?>>
<div class="pf_img"><?php echo get_member_profile_img($list[$i]['mb_id']); ?></div>
<div class="cm_wrap">
<header style="z-index:<?php echo $cmt_sv; ?>">
<h2><?php echo get_text($list[$i]['wr_name']); ?>님의 <?php if ($cmt_depth) { ?><span class="sound_only">댓글의</span><?php } ?> 댓글</h2>
<?php echo $list[$i]['name'] ?>
<?php if ($is_ip_view) { ?>
<span class="sound_only">아이피</span>
<span>(<?php echo $list[$i]['ip']; ?>)</span>
<?php } ?>
<span class="sound_only">작성일</span>
<span class="bo_vc_hdinfo"><i class="fa fa-clock-o" aria-hidden="true"></i> <time datetime="<?php echo date('Y-m-d\TH:i:s+09:00', strtotime($list[$i]['datetime'])) ?>"><?php echo $list[$i]['datetime'] ?></time></span>
<?php
include(G5_SNS_PATH.'/view_comment_list.sns.skin.php');
?>
</header>
<!-- 댓글 출력 -->
<div class="cmt_contents">
<p>
<?php if (strstr($list[$i]['wr_option'], "secret")) { ?><img src="<?php echo $board_skin_url; ?>/img/icon_secret.gif" alt="비밀글"><?php } ?>
<?php echo $comment ?>
</p>
<?php if($is_comment_reply_edit) {
if($w == 'cu') {
$sql = " select wr_id, wr_content, mb_id from $write_table where wr_id = '$c_id' and wr_is_comment = '1' ";
$cmt = sql_fetch($sql);
if (isset($cmt)) {
if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id']))) {
$cmt['wr_content'] = '';
}
$c_wr_content = $cmt['wr_content'];
}
}
?>
<?php } ?>
</div>
<span id="edit_<?php echo $comment_id ?>" class="bo_vc_w"></span><!-- 수정 -->
<span id="reply_<?php echo $comment_id ?>" class="bo_vc_w"></span><!-- 답변 -->
<input type="hidden" value="<?php echo strstr($list[$i]['wr_option'],"secret") ?>" id="secret_comment_<?php echo $comment_id ?>">
<textarea id="save_comment_<?php echo $comment_id ?>" style="display:none"><?php echo get_text($list[$i]['content1'], 0) ?></textarea>
</div>
<?php if($is_comment_reply_edit) { ?>
<div class="bo_vl_opt">
<button type="button" class="btn_cm_opt btn_b01 btn"><i class="fa fa-ellipsis-v" aria-hidden="true"></i><span class="sound_only">댓글 옵션</span></button>
<ul class="bo_vc_act">
<?php if ($list[$i]['is_reply']) { ?><li><a href="<?php echo $c_reply_href; ?>" onclick="comment_box('<?php echo $comment_id ?>', 'c'); return false;">답변</a></li><?php } ?>
<?php if ($list[$i]['is_edit']) { ?><li><a href="<?php echo $c_edit_href; ?>" onclick="comment_box('<?php echo $comment_id ?>', 'cu'); return false;">수정</a></li><?php } ?>
<?php if ($list[$i]['is_del']) { ?><li><a href="<?php echo $list[$i]['del_link']; ?>" onclick="return comment_delete();">삭제</a></li><?php } ?>
</ul>
</div>
<?php } ?>
<script>
$(function() {
// 댓글 옵션창 열기
$(".btn_cm_opt").on("click", function(){
$(this).parent("div").children(".bo_vc_act").show();
});
// 댓글 옵션창 닫기
$(document).mouseup(function (e){
var container = $(".bo_vc_act");
if( container.has(e.target).length === 0)
container.hide();
});
});
</script>
</article>
<?php } ?>
<?php if ($i == 0) { //댓글이 없다면 ?><p id="bo_vc_empty">등록된 댓글이 없습니다.</p><?php } ?>
</section>
<!-- } 댓글 끝 -->
<?php if ($is_comment_write) {
if($w == '')
$w = 'c';
?>
<!-- 댓글 쓰기 시작 { -->
<aside id="bo_vc_w" class="bo_vc_w">
<h2>댓글쓰기</h2>
<form name="fviewcomment" id="fviewcomment" action="<?php echo $comment_action_url; ?>" onsubmit="return fviewcomment_submit(this);" method="post" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w ?>" id="w">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="comment_id" value="<?php echo $c_id ?>" id="comment_id">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="is_good" value="">
<span class="sound_only">내용</span>
<?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?>
<textarea id="wr_content" name="wr_content" maxlength="10000" required class="required" title="내용" placeholder="댓글내용을 입력해주세요"
<?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?>><?php echo $c_wr_content; ?></textarea>
<?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?>
<script>
$(document).on("keyup change", "textarea#wr_content[maxlength]", function() {
var str = $(this).val()
var mx = parseInt($(this).attr("maxlength"))
if (str.length > mx) {
$(this).val(str.substr(0, mx));
return false;
}
});
</script>
<div class="bo_vc_w_wr">
<div class="bo_vc_w_info">
<?php if ($is_guest) { ?>
<label for="wr_name" class="sound_only">이름<strong> 필수</strong></label>
<input type="text" name="wr_name" value="<?php echo get_cookie("ck_sns_name"); ?>" id="wr_name" required class="frm_input required" size="25" placeholder="이름">
<label for="wr_password" class="sound_only">비밀번호<strong> 필수</strong></label>
<input type="password" name="wr_password" id="wr_password" required class="frm_input required" size="25" placeholder="비밀번호">
<?php
}
?>
<?php
if($board['bo_use_sns'] && ($config['cf_facebook_appid'] || $config['cf_twitter_key'])) {
?>
<span class="sound_only">SNS 동시등록</span>
<span id="bo_vc_send_sns"></span>
<?php } ?>
<?php if ($is_guest) { ?>
<?php echo $captcha_html; ?>
<?php } ?>
</div>
<div class="btn_confirm">
<span class="secret_cm chk_box">
<input type="checkbox" name="wr_secret" value="secret" id="wr_secret" class="selec_chk">
<label for="wr_secret"><span></span>비밀글</label>
</span>
<button type="submit" id="btn_submit" class="btn_submit">댓글등록</button>
</div>
</div>
</form>
</aside>
<script>
var save_before = '';
var save_html = document.getElementById('bo_vc_w').innerHTML;
function good_and_write()
{
var f = document.fviewcomment;
if (fviewcomment_submit(f)) {
f.is_good.value = 1;
f.submit();
} else {
f.is_good.value = 0;
}
}
function fviewcomment_submit(f)
{
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
f.is_good.value = 0;
var subject = "";
var content = "";
$.ajax({
url: g5_bbs_url+"/ajax.filter.php",
type: "POST",
data: {
"subject": "",
"content": f.wr_content.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
subject = data.subject;
content = data.content;
}
});
if (content) {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다");
f.wr_content.focus();
return false;
}
// 양쪽 공백 없애기
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
document.getElementById('wr_content').value = document.getElementById('wr_content').value.replace(pattern, "");
if (char_min > 0 || char_max > 0)
{
check_byte('wr_content', 'char_count');
var cnt = parseInt(document.getElementById('char_count').innerHTML);
if (char_min > 0 && char_min > cnt)
{
alert("댓글은 "+char_min+"글자 이상 쓰셔야 합니다.");
return false;
} else if (char_max > 0 && char_max < cnt)
{
alert("댓글은 "+char_max+"글자 이하로 쓰셔야 합니다.");
return false;
}
}
else if (!document.getElementById('wr_content').value)
{
alert("댓글을 입력하여 주십시오.");
return false;
}
if (typeof(f.wr_name) != 'undefined')
{
f.wr_name.value = f.wr_name.value.replace(pattern, "");
if (f.wr_name.value == '')
{
alert('이름이 입력되지 않았습니다.');
f.wr_name.focus();
return false;
}
}
if (typeof(f.wr_password) != 'undefined')
{
f.wr_password.value = f.wr_password.value.replace(pattern, "");
if (f.wr_password.value == '')
{
alert('비밀번호가 입력되지 않았습니다.');
f.wr_password.focus();
return false;
}
}
<?php if($is_guest) echo chk_captcha_js(); ?>
set_comment_token(f);
document.getElementById("btn_submit").disabled = "disabled";
return true;
}
function comment_box(comment_id, work)
{
var el_id,
form_el = 'fviewcomment',
respond = document.getElementById(form_el);
// 댓글 아이디가 넘어오면 답변, 수정
if (comment_id)
{
if (work == 'c')
el_id = 'reply_' + comment_id;
else
el_id = 'edit_' + comment_id;
}
else
el_id = 'bo_vc_w';
if (save_before != el_id)
{
if (save_before)
{
document.getElementById(save_before).style.display = 'none';
}
document.getElementById(el_id).style.display = '';
document.getElementById(el_id).appendChild(respond);
//입력값 초기화
document.getElementById('wr_content').value = '';
// 댓글 수정
if (work == 'cu')
{
document.getElementById('wr_content').value = document.getElementById('save_comment_' + comment_id).value;
if (typeof char_count != 'undefined')
check_byte('wr_content', 'char_count');
if (document.getElementById('secret_comment_'+comment_id).value)
document.getElementById('wr_secret').checked = true;
else
document.getElementById('wr_secret').checked = false;
}
document.getElementById('comment_id').value = comment_id;
document.getElementById('w').value = work;
if(save_before)
$("#captcha_reload").trigger("click");
save_before = el_id;
}
}
function comment_delete()
{
return confirm("이 댓글을 삭제하시겠습니까?");
}
comment_box('', 'c'); // 댓글 입력폼이 보이도록 처리하기위해서 추가 (root님)
<?php if($board['bo_use_sns'] && ($config['cf_facebook_appid'] || $config['cf_twitter_key'])) { ?>
$(function() {
// sns 등록
$("#bo_vc_send_sns").load(
"<?php echo G5_SNS_URL; ?>/view_comment_write.sns.skin.php?bo_table=<?php echo $bo_table; ?>",
function() {
save_html = document.getElementById('bo_vc_w').innerHTML;
}
);
});
<?php } ?>
</script>
<?php } ?>
<!-- } 댓글 쓰기 끝 -->
<script>
jQuery(function($) {
//댓글열기
$(".cmt_btn").click(function(e){
e.preventDefault();
$(this).toggleClass("cmt_btn_op");
$("#bo_vc").toggle();
});
});
</script>
@@ -0,0 +1,257 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// jQuery UI의 CSS와 JS를 불러와 달력(Datepicker) 기능을 사용합니다.
add_stylesheet('<link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">', 0);
add_javascript('<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>', 0);
// 이 스킨의 전용 스타일시트를 불러옵니다.
$style_ver = file_exists($board_skin_path . '/style.css') ? filemtime($board_skin_path . '/style.css') : G5_CSS_VER;
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css?ver=' . $style_ver . '">', 0);
// 이 스킨의 전용 자바스크립트 파일을 불러옵니다.
$write_js_path = $board_skin_path . '/js/write.js';
$write_js_ver = file_exists($write_js_path) ? filemtime($write_js_path) : G5_JS_VER;
add_javascript('<script src="' . $board_skin_url . '/js/write.js?ver=' . $write_js_ver . '"></script>', 0);
// 💡 [추가] 메인 노출 관련 로직
$main_view_max = null;
// 게시판 여분필드(bo_1 ~ bo_10) 중 제목이 'main_view_max'인 필드의 값을 가져옵니다.
for ($i = 1; $i <= 10; $i++) {
if (isset($board['bo_'.$i.'_subj']) && $board['bo_'.$i.'_subj'] == 'main_view_max') {
$main_view_max = $board['bo_'.$i];
break;
}
}
$main_display_count = 0;
$main_display_titles = '';
// main_view_max가 숫자이거나, 비어있거나, null일 때만 유효한 것으로 간주
$is_main_view_max_valid = ($main_view_max === null || $main_view_max === '' || is_numeric($main_view_max));
if ($is_main_view_max_valid && is_numeric($main_view_max) && $main_view_max !== '') {
// wr_10 != '1' 인 글 (숨김 처리되지 않은 글)을 카운트
$sql = "SELECT wr_subject FROM {$g5['write_prefix']}{$bo_table} WHERE (wr_10 != '1' OR wr_10 IS NULL)";
if ($w == 'u') {
// 수정 모드에서는 현재 글을 제외하고 카운트
$sql .= " AND wr_id != '{$wr_id}'";
}
$result = sql_query($sql);
$titles = array();
while ($row = sql_fetch_array($result)) {
$titles[] = $row['wr_subject'];
}
$main_display_count = count($titles);
$main_display_titles = implode(', ', $titles);
}
?>
<div id="bo_w">
<form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);"
method="post" enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<?php
// 스마트에디터를 사용하기 위해 html1로 고정
$option_hidden = '<input type="hidden" name="html" value="1">';
echo $option_hidden;
?>
<div class="write_div">
<label for="wr_subject" class="frm_label">제목</label>
<input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required
class="frm_input" size="50" maxlength="255" placeholder="메인 화면에 노출될 제목을 입력하세요.">
</div>
<div class="write_div">
<label class="frm_label">노출 설정</label>
<div class="option_group">
<label>
<input type="radio" name="wr_9"
value="IMMEDIATE" <?php if ($w == '' || (isset($write['wr_9']) && $write['wr_9'] != 'RESERVED')) echo 'checked'; ?>>
<span class="custom-radio"></span> 즉시 노출
</label>
<label>
<input type="radio" name="wr_9"
value="RESERVED" <?php if ($w == 'u' && isset($write['wr_9']) && $write['wr_9'] == 'RESERVED') echo 'checked'; ?>>
<span class="custom-radio"></span> 예약 노출
</label>
<!-- 💡 [수정] 숨김 설정을 체크박스로 변경 -->
<label style="margin-left: 20px;">
<input type="hidden" name="wr_10" value="0">
<input type="checkbox" name="wr_10" id="wr_10" value="1" <?php echo (isset($write['wr_10']) && $write['wr_10'] == '1') ? 'checked' : ''; ?>>
<span class="custom-checkbox"></span> 숨김 (노출 안 함)
</label>
</div>
</div>
<div id="reservation_fields" class="write_div"
style="display: <?php echo ($w == 'u' && isset($write['wr_9']) && $write['wr_9'] == 'RESERVED') ? 'block' : 'none'; ?>;">
<div class="date_picker_group">
<div class="date_item">
<label for="wr_2" class="frm_label"><?php echo $board['bo_2_subj'] ?: '시작일' ?></label>
<input type="text" name="wr_2" value="<?php echo $wr_2 ?>" id="wr_2" class="frm_input datepicker"
maxlength="10" placeholder="YYYY-MM-DD">
</div>
<span class="date_divider">~</span>
<div class="date_item">
<label for="wr_3" class="frm_label"><?php echo $board['bo_3_subj'] ?: '종료일' ?></label>
<input type="text" name="wr_3" value="<?php echo $wr_3 ?>" id="wr_3" class="frm_input datepicker"
maxlength="10" placeholder="YYYY-MM-DD">
</div>
</div>
</div>
<!-- 💡 [추가] 링크 입력 필드 -->
<!-- <div class="write_div">
<label for="wr_link1" class="frm_label">링크 #1</label>
<input type="text" name="wr_link1" value="<?php /*echo isset($write['wr_link1']) ? get_text($write['wr_link1']) : ''; */?>" id="wr_link1" class="frm_input" size="50" placeholder="http://...">
<span class="text-muted font-12">링크를 입력하면 '자세히 보기' 클릭 시 해당 URL로 이동합니다. (입력하지 않으면 이미지 팝업)</span>
</div>
-->
<!-- 💡 제품 맵 좌표 및 페이지 설정 추가 -->
<div class="write_div" style="background: #f8f9fa; padding: 20px; border-radius: 10px; border: 1px solid #e9ecef; margin-bottom: 20px;">
<h3 style="font-size: 15px; margin-bottom: 15px; color: #007bff;"><i class="fa fa-crosshairs"></i> 제품 마스터 맵 설정</h3>
<div class="write_div">
<label for="wr_4" class="frm_label">연결 페이지명 (wr_4)</label>
<input type="text" name="wr_4" value="<?php echo isset($write['wr_4']) ? get_text($write['wr_4']) : ''; ?>" id="wr_4" class="frm_input" size="30" placeholder="예: 거실창, 주방창 등">
</div>
<div style="display: flex; gap: 20px;">
<div style="flex: 1;">
<label for="wr_5" class="frm_label">X 좌표 % (wr_5)</label>
<input type="text" name="wr_5" value="<?php echo isset($write['wr_5']) ? get_text($write['wr_5']) : ''; ?>" id="wr_5" class="frm_input" size="10" placeholder="예: 45.5">
</div>
<div style="flex: 1;">
<label for="wr_6" class="frm_label">Y 좌표 % (wr_6)</label>
<input type="text" name="wr_6" value="<?php echo isset($write['wr_6']) ? get_text($write['wr_6']) : ''; ?>" id="wr_6" class="frm_input" size="10" placeholder="예: 62.1">
</div>
</div>
<p class="text-muted font-12" style="margin-top: 10px;">* X, Y 좌표는 0~100 사이의 숫자로 입력하세요.</p>
<!-- 💡 제품 번호 설정 추가 (wr_7) -->
<div class="write_div">
<label for="wr_7" class="frm_label">제품 번호 (wr_7)</label>
<input type="text" name="wr_7" value="<?php echo isset($write['wr_7']) ? get_text($write['wr_7']) : ''; ?>" id="wr_7" class="frm_input" size="30" placeholder="예: 1">
<p class="text-muted font-12">제품 식별을 위한 고유 번호를 입력하세요
</div>
<div class="write_div">
<label for="wr_1" class="form-label">요약 내용</label>
<textarea name="wr_1" id="wr_1" class="form-control" rows="3" placeholder="목록에 표시될 핵심 요약 내용을 입력하세요."><?php echo isset($write['wr_1']) ? get_text($write['wr_1']) : ''; ?></textarea>
</div>
<div class="write_div">
<label for="wr_content" class="frm_label">상세 내용</label>
<?php echo $editor_html; // 스마트에디터 출력 ?>
</div>
<?php // 💡 [Accessibility Improvement] Use <fieldset> and <legend> for the file upload group. ?>
<fieldset class="write_div">
<legend class="frm_label">이미지 또는 동영상 (최대 <?php echo $board['bo_upload_count']; ?>개, 각 10MB 이하)</legend>
<div class="file_upload_grid">
<?php
for ($i = 0; $i < $board['bo_upload_count']; $i++) {
$file_label_id = 'bf_file_' . $i;
$is_existing_file = ($w == 'u' && isset($file[$i]['file']) && $file[$i]['file']);
$preview_class = '';
$preview_style = '';
$preview_text_style = '';
if ($is_existing_file) {
$file_url = $file[$i]['path'] . '/' . $file[$i]['file'];
$file_ext = strtolower(pathinfo($file_url, PATHINFO_EXTENSION));
if (in_array($file_ext, ['mp4', 'mov', 'webm'])) {
$preview_class = 'is-video';
} else {
$preview_style = "background-image: url('{$file_url}');";
}
$preview_text_style = 'display:none;';
}
?>
<div class="file_preview_wrapper">
<div class="file_preview <?php echo $preview_class; ?>" id="preview_<?php echo $i; ?>"
style="<?php echo $preview_style; ?>">
<span class="preview_text" style="<?php echo $preview_text_style; ?>">클릭하여 파일 업로드</span>
</div>
<?php if ($is_existing_file) { ?>
<div class="preview_info">
<span class="current_file_name" title="<?php echo $file[$i]['source'] ?>">
<?php echo $file[$i]['source'] ?>
</span>
<span class="file_del">
<input type="checkbox" id="bf_file_del_<?php echo $i ?>"
name="bf_file_del[<?php echo $i ?>]" value="1">
<label for="bf_file_del_<?php echo $i ?>">삭제</label>
</span>
</div>
<?php } ?>
<input type="file" name="bf_file[]" id="<?php echo $file_label_id; ?>" style="display:none;"
accept="image/*, video/mp4, video/mov, video/webm">
</div>
<?php } ?>
</div>
</fieldset>
<div class="btn_confirm">
<a href="<?php echo get_pretty_url($bo_table); ?>" class="btn btn_cancel">취소</a>
<input type="submit" value="작성완료" id="btn_submit" accesskey="s" class="btn btn_submit">
</div>
</form>
</div>
<script>
function fwrite_submit(f) {
<?php echo $editor_js; // 에디터 사용시 자바스크립트 부분 ?>
// 💡 [추가] 메인 노출 개수 제한 검사
const isHiddenCheckbox = document.getElementById('wr_10');
// 숨김 체크박스가 체크되어 있지 않으면 '노출' 상태임
if (isHiddenCheckbox && !isHiddenCheckbox.checked) {
const mainViewMax = <?php echo json_encode($main_view_max); ?>;
const isMainViewMaxValid = <?php echo json_encode($is_main_view_max_valid); ?>;
if (!isMainViewMaxValid) {
alert('게시판의 "main_view_max" 여분 필드 설정값이 숫자가 아닙니다. 관리자에게 문의하여 설정을 수정해주세요.');
return false;
}
if (mainViewMax !== null && mainViewMax !== '' && !isNaN(parseInt(mainViewMax))) {
const mainViewMaxInt = parseInt(mainViewMax, 10);
const mainDisplayCount = <?php echo (int)$main_display_count; ?>;
if (mainDisplayCount >= mainViewMaxInt) {
const mainDisplayTitles = <?php echo json_encode($main_display_titles); ?>;
alert('메인 노출 최대 개수(' + mainViewMaxInt + '개)를 초과하여 더 이상 설정할 수 없습니다.\n\n현재 노출 중인 글:\n' + mainDisplayTitles + '\n\n"숨김 (노출 안 함)"을 체크하거나 기존 글을 숨김 처리해주세요.');
return false;
}
}
}
// 예약 노출 선택 시 날짜 입력 유효성 검사
if (document.querySelector('input[name="wr_9"]:checked').value === 'RESERVED') {
if (f.wr_2.value === '' || f.wr_3.value === '') {
alert('예약 시작일과 종료일을 모두 선택해주세요.');
return false;
}
if (f.wr_2.value > f.wr_3.value) {
alert('예약 종료일은 시작일보다 빠를 수 없습니다.');
return false;
}
}
return true;
}
</script>
@@ -0,0 +1,68 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
/*
|--------------------------------------------------------------------------
| 💡 [핵심] 메인 비주얼 게시판 전용 백엔드 유효성 검사
|--------------------------------------------------------------------------
| 이 파일은 그누보드의 write_update.php 파일이 실행되기 직전에 자동으로
| 실행되어, 우리가 원하는 추가 규칙을 검사할 수 있게 해줍니다.
*/
// -----------------------------------------------------------------------------
// 규칙 1: 하루 최대 등록 개수 제한 (새 글 작성 시에만 적용)
// -----------------------------------------------------------------------------
if ($w == '') { // $w가 ''이면 '새 글 작성'을 의미합니다.
$daily_limit = 3; // 하루 최대 등록 개수를 3으로 설정합니다.
// 오늘 날짜(00:00:00 ~ 23:59:59)를 기준으로 작성된 게시물 수를 센다.
$sql = " SELECT count(*) as cnt FROM {$write_table}
WHERE wr_is_comment = 0
AND wr_datetime BETWEEN '".G5_TIME_YMD." 00:00:00' AND '".G5_TIME_YMD." 23:59:59' ";
$row = sql_fetch($sql);
// 만약 오늘 작성된 글이 3개 이상이면, 오류 메시지를 띄우고 중단합니다.
if ($row['cnt'] >= $daily_limit) {
alert("하루에 등록 가능한 비주얼은 최대 {$daily_limit}개입니다. 내일 다시 시도해주세요.");
}
}
// -----------------------------------------------------------------------------
// 규칙 2: 예약 기간 중복 검사
// -----------------------------------------------------------------------------
// '예약 노출'을 선택했을 때만 검사합니다.
if (isset($_POST['wr_9']) && $_POST['wr_9'] == 'RESERVED') {
// 폼에서 전송된 시작일과 종료일을 가져옵니다.
$start_date = isset($_POST['wr_2']) ? trim($_POST['wr_2']) : '';
$end_date = isset($_POST['wr_3']) ? trim($_POST['wr_3']) : '';
// 두 날짜가 모두 입력되었을 때만 검사를 실행합니다.
if ($start_date && $end_date) {
// '예약 노출'로 설정된 다른 게시물 중, 날짜가 겹치는 것이 있는지 찾습니다.
// (신규 시작일 <= 기존 종료일) AND (신규 종료일 >= 기존 시작일) -> 이 조건이 참이면 겹치는 것입니다.
$sql = " SELECT wr_id, wr_subject FROM {$write_table}
WHERE wr_is_comment = 0
AND wr_9 = 'RESERVED'
AND (
'{$start_date}' <= wr_3 AND '{$end_date}' >= wr_2
) ";
// 글 수정($w == 'u') 시에는, 현재 수정 중인 자기 자신은 검사 대상에서 제외합니다.
if ($w == 'u' && $wr_id) {
$sql .= " AND wr_id != '{$wr_id}' ";
}
$sql .= " LIMIT 1 "; // 겹치는 것이 하나라도 있으면 바로 찾기를 중단합니다.
$row = sql_fetch($sql);
// 만약 겹치는 게시물이 발견되면, 오류 메시지를 띄우고 중단합니다.
if (isset($row['wr_id']) && $row['wr_id']) {
$colliding_subject = get_text(cut_str($row['wr_subject'], 30));
alert("선택하신 예약 기간에 이미 다른 비주얼이 등록되어 있습니다.\\n\\n[중복된 게시물: {$colliding_subject}]\\n\\n날짜를 다시 확인해주세요.");
}
}
}
?>