first commit 2
@@ -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;
|
||||
|
||||
// construction 스킨 광고 영역 설정
|
||||
$construction_skin_config = [
|
||||
'left_ad' => false, // 좌측 광고 사용 안함
|
||||
'right_ad' => false, // 우측 광고 사용 안함
|
||||
];
|
||||
?>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 339 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 318 B |
@@ -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>
|
||||
|
After Width: | Height: | Size: 211 B |
|
After Width: | Height: | Size: 136 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 204 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 857 B |
|
After Width: | Height: | Size: 141 B |
|
After Width: | Height: | Size: 138 B |
|
After Width: | Height: | Size: 105 B |
|
After Width: | Height: | Size: 97 B |
|
After Width: | Height: | Size: 107 B |
|
After Width: | Height: | Size: 155 B |
|
After Width: | Height: | Size: 139 B |
|
After Width: | Height: | Size: 381 B |
|
After Width: | Height: | Size: 206 B |
|
After Width: | Height: | Size: 324 B |
|
After Width: | Height: | Size: 323 B |
|
After Width: | Height: | Size: 102 B |
|
After Width: | Height: | Size: 73 B |
|
After Width: | Height: | Size: 80 B |
|
After Width: | Height: | Size: 102 B |
|
After Width: | Height: | Size: 105 B |
|
After Width: | Height: | Size: 105 B |
|
After Width: | Height: | Size: 207 B |
|
After Width: | Height: | Size: 138 B |
|
After Width: | Height: | Size: 76 B |
|
After Width: | Height: | Size: 105 B |
|
After Width: | Height: | Size: 305 B |
|
After Width: | Height: | Size: 100 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 931 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 107 B |
|
After Width: | Height: | Size: 97 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 104 B |
|
After Width: | Height: | Size: 62 B |
|
After Width: | Height: | Size: 110 B |
|
After Width: | Height: | Size: 71 B |
|
After Width: | Height: | Size: 77 B |
|
After Width: | Height: | Size: 97 B |
|
After Width: | Height: | Size: 113 B |
|
After Width: | Height: | Size: 908 B |
|
After Width: | Height: | Size: 909 B |
|
After Width: | Height: | Size: 67 B |
|
After Width: | Height: | Size: 77 B |
|
After Width: | Height: | Size: 78 B |
@@ -0,0 +1,105 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const listBody = document.getElementById('bo_list_body');
|
||||
const toggleBtn = document.getElementById('view-toggle-btn');
|
||||
|
||||
if (!listBody || !toggleBtn) {
|
||||
return; // 필수 요소가 없으면 스크립트 중단
|
||||
}
|
||||
|
||||
const toggleIcon = toggleBtn.querySelector('i');
|
||||
const savedViewMode = localStorage.getItem('board_view_mode') || 'list'; // 기본값은 'list'
|
||||
|
||||
// 뷰 모드를 설정하고 버튼의 아이콘과 툴팁을 업데이트하는 함수
|
||||
function setViewMode(mode) {
|
||||
if (mode === 'card') {
|
||||
listBody.classList.remove('list-view');
|
||||
listBody.classList.add('card-view');
|
||||
// 현재 카드뷰 -> 다음 행동은 '목록형 보기'
|
||||
toggleIcon.className = 'fa fa-bars';
|
||||
toggleBtn.title = '목록형으로 보기';
|
||||
} else { // 'list'
|
||||
listBody.classList.remove('card-view');
|
||||
listBody.classList.add('list-view');
|
||||
// 현재 목록뷰 -> 다음 행동은 '카드형 보기'
|
||||
toggleIcon.className = 'fa fa-th-large';
|
||||
toggleBtn.title = '카드형으로 보기';
|
||||
}
|
||||
// 사용자의 선택을 로컬 스토리지에 저장
|
||||
localStorage.setItem('board_view_mode', mode);
|
||||
}
|
||||
|
||||
|
||||
// 토글 버튼 클릭 이벤트
|
||||
toggleBtn.addEventListener('click', function() {
|
||||
// 현재 뷰 모드를 확인하고 반대 모드로 전환
|
||||
const currentMode = listBody.classList.contains('card-view') ? 'list' : 'card';
|
||||
setViewMode(currentMode);
|
||||
});
|
||||
|
||||
// 페이지 로드 시 저장된 뷰 모드를 적용
|
||||
setViewMode(savedViewMode);
|
||||
|
||||
// 카드형 뷰에서 체크박스 클릭 시, 목록형 뷰의 동일한 체크박스도 동기화
|
||||
const cardCheckboxes = document.querySelectorAll('input[name="chk_wr_id_card[]"]');
|
||||
cardCheckboxes.forEach((cardChk, index) => {
|
||||
cardChk.addEventListener('change', function() {
|
||||
const listChk = document.getElementById('chk_wr_id_' + index);
|
||||
if (listChk) {
|
||||
listChk.checked = this.checked;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ▼▼▼ [추가] 노출 상태 토글 기능 ▼▼▼
|
||||
$('#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_1"]');
|
||||
const reservationFields = $('#reservation_fields');
|
||||
|
||||
function toggleReservationFields() {
|
||||
if ($('input[name="wr_1"]: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,338 @@
|
||||
<?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=' . time() . '">', 0);
|
||||
add_javascript('<script src="' . $board_skin_url . '/js/list.js?ver=' . 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";
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- ▼▼▼ [핵심 수정] JS에서 사용할 PHP 변수를 전역 JS 변수로 선언합니다. ▼▼▼ -->
|
||||
<script>
|
||||
const board_skin_url = "<?php echo $board_skin_url; ?>";
|
||||
</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-btn" class="btn-view-toggle" title="카드형으로 보기">
|
||||
<i class="fa 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="">
|
||||
|
||||
<!-- 게시물 리스트 (보기 전환 컨테이너) -->
|
||||
<div id="bo_list_body" class="list-view">
|
||||
<?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"> 현재 페이지 게시물 전체선택</label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?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_1'])) {
|
||||
if ($post_data['wr_1'] == '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">
|
||||
</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">
|
||||
</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">
|
||||
<div class="bo-pagination"><?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 } ?>
|
||||
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
|
||||
|
||||
// 이 페이지에서도 스킨의 CSS 파일을 불러옵니다.
|
||||
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css?ver=' . time() . '">', 0);
|
||||
?>
|
||||
|
||||
<section id="bo_v">
|
||||
<h2 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); // 글제목 출력 ?>
|
||||
</h2>
|
||||
|
||||
<div id="bo_v_info">
|
||||
<!-- 예약 노출 여부 표시 -->
|
||||
<label class="frm_label"><?php echo $board['bo_1_subj'] ?></label>
|
||||
<div class="option_group">
|
||||
<label>
|
||||
<input type="radio" name="wr_1_view" value="IMMEDIATE"
|
||||
<?php echo ($view['wr_1'] !== 'RESERVED') ? 'checked' : ''; ?>
|
||||
disabled> 즉시 노출
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="wr_1_view" value="RESERVED"
|
||||
<?php echo ($view['wr_1'] === 'RESERVED') ? 'checked' : ''; ?>
|
||||
disabled> 예약 노출
|
||||
</label>
|
||||
</div>
|
||||
<?php if ($view['wr_1'] === '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 } ?>
|
||||
</div>
|
||||
<div id="bo_v_atc">
|
||||
<!-- --><?php
|
||||
// // 📌 [핵심] 첫번째 첨부파일을 메인 비주얼로 상단에 크게 표시합니다.
|
||||
// if (isset($view['file'][0]['file']) && $view['file'][0]['file']) {
|
||||
// $file = $view['file'][0];
|
||||
// $file_ext = strtolower(pathinfo($file['file'], PATHINFO_EXTENSION));
|
||||
// $is_video = in_array($file_ext, ['mp4', 'mov', 'webm']);
|
||||
// $file_url = $file['path'].'/'.$file['file'];
|
||||
//
|
||||
// echo "<div id=\"bo_v_main_visual\">\n";
|
||||
// if ($is_video) {
|
||||
// // 동영상 파일일 경우 video 태그로 출력
|
||||
// echo '<video src="'.$file_url.'" controls preload="metadata" playsinline></video>';
|
||||
// } else {
|
||||
// // 이미지 파일일 경우 img 태그로 출력
|
||||
// echo '<img src="'.$file_url.'" alt="'.get_text($file['source']).'">';
|
||||
// }
|
||||
// echo "</div>\n";
|
||||
// }
|
||||
// ?>
|
||||
|
||||
<!-- 본문 내용 -->
|
||||
<div class="write_div">
|
||||
<label for="wr_content" class="frm_label">상세 내용</label>
|
||||
<div class="view_content">
|
||||
<?php echo conv_content($view['wr_content'], 1); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div id="bo_v_con">-->
|
||||
<!-- --><?php //echo get_view_thumbnail($view['content']); ?>
|
||||
<!-- </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">';
|
||||
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>
|
||||
</section>
|
||||
|
||||
<!-- 이미지 팝업(라이트박스) HTML과 스크립트 -->
|
||||
<div id="image_lightbox" class="image_lightbox">
|
||||
<span class="lightbox_close">×</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 => {
|
||||
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.'&c_id='.$comment_id.'&w=c#bo_vc_w';
|
||||
$c_edit_href = $comment_common_url.'&c_id='.$comment_id.'&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,107 @@
|
||||
<?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);
|
||||
|
||||
// 이 스킨의 전용 스타일시트를 불러옵니다.
|
||||
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css?ver=' . time() . '">', 0);
|
||||
|
||||
// 이 스킨의 전용 자바스크립트 파일을 불러옵니다.
|
||||
add_javascript('<script src="' . $board_skin_url . '/js/write.js?ver=' . time() . '"></script>', 0);
|
||||
?>
|
||||
|
||||
<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 for="wr_content" class="frm_label">상세 내용</label>
|
||||
<?php echo $editor_html; // 스마트에디터 출력 ?>
|
||||
</div>
|
||||
|
||||
<div class="write_div">
|
||||
<label class="frm_label">이미지 또는 동영상 (최대 <?php echo $board['bo_upload_count']; ?>개, 각 10MB 이하)</label>
|
||||
<div class="file_upload_grid">
|
||||
<?php
|
||||
for ($i=0; $i<$board['bo_upload_count']; $i++) {
|
||||
$file_label_id = 'bf_file_'.$i;
|
||||
?>
|
||||
<div class="file_preview_wrapper">
|
||||
<?php
|
||||
// 💡 [핵심 수정] 수정 모드일 때 기존 파일의 URL을 가져와 미리보기 스타일을 생성합니다.
|
||||
$file_preview_style = '';
|
||||
if ($w == 'u' && isset($file[$i]['file']) && $file[$i]['file']) {
|
||||
$file_url = $file[$i]['path'].'/'.$file[$i]['file'];
|
||||
$file_preview_style = "background-image: url('{$file_url}');";
|
||||
}
|
||||
?>
|
||||
<div class="file_preview" id="preview_<?php echo $i; ?>" style="<?php echo $file_preview_style; ?>">
|
||||
<span class="preview_text" style="<?php echo $file_preview_style ? 'display:none;' : ''; ?>">클릭하여 파일 업로드</span>
|
||||
</div>
|
||||
|
||||
<!-- 수정 모드이고, 이 슬롯에 파일이 이미 등록되어 있을 경우 파일 정보 표시 -->
|
||||
<?php if ($w == 'u' && isset($file[$i]['file']) && $file[$i]['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">
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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; // 에디터 사용시 자바스크립트 부분 ?>
|
||||
|
||||
// 예약 노출 선택 시 날짜 입력 유효성 검사
|
||||
if (document.querySelector('input[name="wr_1"]: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_1']) && $_POST['wr_1'] == '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_1 = '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날짜를 다시 확인해주세요.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||