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,13 @@
<?php
if (!defined('_GNUBOARD_')) exit;
/**
* notice :: config.php
* 스킨 전용 설정 파일
*/
$notice_skin_config = [
'left_ad' => true, // 좌측 광고 영역 표시 여부
'right_ad' => true, // 우측 광고 영역 표시 여부
];
?>
@@ -0,0 +1,336 @@
@charset "utf-8";
/* notice :: style.css */
/* --- Global Variables --- */
:root {
--primary-color: #0056b3; /* 파란색 (메인) */
--primary-hover: #004494;
--secondary-color: #6c757d; /* 회색 (보조) */
--secondary-hover: #5a6268;
--danger-color: #dc3545; /* 붉은색 (삭제/경고) */
--danger-hover: #c82333;
--light-gray: #f8f9fa;
--border-color: #dee2e6;
--text-color: #333;
--bg-color: #fff;
}
/* 전체 배경 흰색 설정 */
#notice-board {
background-color: var(--bg-color);
color: var(--text-color);
}
/* --- 레이아웃 (3단 컬럼) --- */
#notice-board .three-column-layout {
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-top: 20px;
}
/*#notice-board .layout-sidebar-left,*/
/*#notice-board .layout-sidebar-right {*/
/* flex: 0 0 200px;*/
/* max-width: 200px;*/
/*}*/
#notice-board .layout-main-content,
#notice-board .layout-main-content1 {
flex: 1;
min-width: 0;
background: #fff; /* 메인 컨텐츠 배경 흰색 */
padding: 20px;
border: 1px solid var(--border-color); /* 테두리 추가로 영역 구분 */
border-radius: 8px;
}
/* 사이드바 내부 */
/*#notice-board .sidebar-inner {*/
/* background: #f8f9fa;*/
/* padding: 15px;*/
/* border-radius: 5px;*/
/* min-height: 300px;*/
/* border: 1px solid var(--border-color);*/
/*}*/
#notice-board .three-column-layout { display: flex; gap: 30px; }
#notice-board .layout-sidebar-left, #notice-board .layout-sidebar-right { flex: 0 0 240px; position: sticky; top: 100px; }
#notice-board .layout-main-content { flex: 1; min-width: 0; }
/* 반응형 */
@media (max-width: 991px) {
#notice-board .layout-sidebar-left,
#notice-board .layout-sidebar-right {
display: none;
}
#notice-board .layout-main-content,
#notice-board .layout-main-content1 {
flex: 0 0 100%;
max-width: 100%;
border: none; /* 모바일에서는 테두리 제거 */
padding: 0;
}
}
/* --- 버튼 스타일 (공통) --- */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 8px 16px;
border-radius: 4px;
font-size: 14px;
font-weight: 500;
text-decoration: none;
cursor: pointer;
transition: all 0.2s;
border: 1px solid transparent;
line-height: 1.5;
}
/* 파란색 버튼 (글쓰기, 저장, 수정 등) */
.btn-primary {
background-color: var(--primary-color);
color: #fff;
border-color: var(--primary-color);
}
.btn-primary:hover { background-color: var(--primary-hover); }
/* 회색 버튼 (목록, 취소 등) */
.btn-secondary {
background-color: #fff;
color: var(--secondary-color);
border-color: var(--border-color);
}
.btn-secondary:hover { background-color: var(--light-gray); color: #333; }
/* 붉은색 버튼 (삭제) */
.btn-danger {
background-color: #fff;
color: var(--danger-color);
border-color: var(--danger-color);
}
.btn-danger:hover { background-color: var(--danger-color); color: #fff; }
/* --- 게시판 목록 (List) --- */
.bo-list-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
padding-bottom: 15px;
border-bottom: 2px solid var(--primary-color);
}
.bo-list-total { font-weight: bold; color: #555; }
.bo-list-buttons { display: flex; gap: 5px; }
.btn-view-toggle {
background: #fff;
border: 1px solid var(--border-color);
color: #555;
width: 36px;
height: 36px;
border-radius: 4px;
cursor: pointer;
}
.btn-view-toggle:hover { background: var(--light-gray); }
/* 리스트 뷰 / 카드 뷰 전환 */
#bo_list_body[data-view-mode="card"] .bo-list-item { display: none; }
#bo_list_body[data-view-mode="card"] .bo-card-item { display: flex; }
#bo_list_body[data-view-mode="list"] .bo-card-item { display: none; }
#bo_list_body[data-view-mode="list"] .bo-list-item { display: flex; }
/* 1. 리스트형 스타일 */
.bo-list-item {
display: flex;
align-items: center;
padding: 15px 10px;
border-bottom: 1px solid var(--border-color);
}
.bo-list-item:hover { background-color: #f9fbff; }
.item-chk { margin-right: 15px; }
.item-subject { flex-grow: 1; font-size: 15px; font-weight: 500; }
.item-subject a { color: #333; text-decoration: none; }
.item-subject a:hover { text-decoration: underline; color: var(--primary-color); }
.item-info { font-size: 13px; color: #888; margin-left: 20px; white-space: nowrap; }
.item-info span { margin-left: 10px; }
/* 2. 카드형 스타일 */
#bo_list_body[data-view-mode="card"] {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
margin-top: 20px;
}
.bo-card-item {
flex-direction: column;
border: 1px solid var(--border-color);
border-radius: 8px;
overflow: hidden;
transition: transform 0.2s, box-shadow 0.2s;
background: #fff;
position: relative;
}
.bo-card-item:hover { transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.card-chk { position: absolute; top: 10px; left: 10px; z-index: 10; }
.card-thumb {
width: 100%;
padding-top: 60%; /* 썸네일 비율 */
position: relative;
background: #eee;
overflow: hidden;
}
.card-thumb img {
position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover;
}
.card-body { padding: 15px; }
.card-title { font-size: 16px; font-weight: bold; margin-bottom: 8px; line-height: 1.4; height: 44px; overflow: hidden; }
.card-info { font-size: 13px; color: #888; display: flex; justify-content: space-between; }
/* 상태 뱃지 */
.status-badge {
display: inline-block;
padding: 2px 6px;
font-size: 11px;
border-radius: 3px;
color: #fff;
margin-left: 5px;
vertical-align: middle;
}
.status-active { background-color: #28a745; } /* 녹색 */
.status-scheduled { background-color: #ffc107; color: #000; } /* 노랑 */
.status-expired { background-color: #6c757d; } /* 회색 */
.status-hidden { background-color: #dc3545; } /* 빨강 */
/* --- 게시판 보기 (View) --- */
#bo_v { padding: 10px 0; }
#bo_v_title {
font-size: 24px;
font-weight: bold;
padding-bottom: 15px;
border-bottom: 1px solid var(--border-color);
margin-bottom: 20px;
line-height: 1.4;
}
#bo_v_info {
background: #f9f9f9;
padding: 15px;
border-radius: 5px;
margin-bottom: 30px;
font-size: 14px;
color: #555;
border: 1px solid #eee;
}
#bo_v_info dl { display: flex; margin-bottom: 5px; }
#bo_v_info dt { font-weight: bold; width: 80px; color: #333; }
#bo_v_info dd { flex: 1; }
#bo_v_con {
min-height: 200px;
line-height: 1.8;
font-size: 16px;
margin-bottom: 40px;
padding-bottom: 40px;
border-bottom: 1px solid var(--border-color);
}
#bo_v_con img { max-width: 100%; height: auto; }
/* 첨부파일 갤러리 */
.gallery_grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: 10px;
margin-top: 20px;
}
.gallery_grid img {
width: 100%; height: 150px; object-fit: cover; border-radius: 4px; border: 1px solid #eee;
}
/* 하단 버튼 영역 */
#bo_v_bot {
display: flex;
justify-content: flex-end;
gap: 8px;
margin-top: 20px;
}
/* --- 게시판 쓰기 (Write) --- */
#bo_w .write_div {
margin-bottom: 20px;
padding-bottom: 20px;
border-bottom: 1px solid #f1f1f1;
}
#bo_w .write_div:last-child { border-bottom: none; }
#bo_w .frm_label {
display: block;
font-weight: bold;
margin-bottom: 8px;
font-size: 15px;
color: #333;
}
#bo_w .frm_input {
width: 100%;
height: 42px;
padding: 0 12px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 14px;
box-sizing: border-box;
}
#bo_w .frm_input:focus { border-color: var(--primary-color); outline: none; }
/* 노출 설정 라디오/체크박스 */
.option_group { display: flex; gap: 20px; align-items: center; }
.option_group label { cursor: pointer; display: flex; align-items: center; gap: 5px; }
/* 예약 날짜 입력 (달력) */
#reservation_fields {
background: #f0f7ff; /* 연한 파랑 배경으로 강조 */
padding: 15px;
border-radius: 5px;
margin-top: -10px;
margin-bottom: 20px;
border: 1px solid #cce5ff;
}
.date_picker_group { display: flex; gap: 10px; align-items: center; }
.date_item { flex: 1; }
.date_divider { font-weight: bold; color: #888; }
/* 파일 업로드 */
.file_upload_grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: 10px;
}
.file_preview {
width: 100%; padding-top: 100%; background: #f8f8f8; border: 1px dashed #ccc;
position: relative; cursor: pointer; border-radius: 4px;
background-size: cover; background-position: center;
}
.file_preview:hover { border-color: var(--primary-color); }
.preview_text {
position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
font-size: 12px; color: #999; text-align: center; width: 100%;
}
/* 버튼 그룹 */
.btn_confirm { text-align: center; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.btn_confirm .btn { min-width: 100px; height: 45px; font-size: 16px; }
/* Datepicker z-index 수정 (달력이 가려지지 않도록) */
.ui-datepicker { z-index: 9999 !important; }
@@ -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,12 @@
/**
* notice :: script.js
*/
jQuery(function($) {
// 더보기 버튼 (필요시 구현)
$('#btn-load-more').on('click', function() {
var page = $(this).data('page');
// AJAX 로드 로직 구현
console.log('Load more page: ' + page);
});
});
@@ -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,253 @@
<?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.'/css/style.css?ver='.G5_SERVER_TIME.'">', 0);
add_javascript('<script src="'.$board_skin_url.'/js/script.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'] : 'list';
$view_mode = get_cookie('board_' . $bo_table . '_view_mode') ?: $default_view_mode;
?>
<div id="notice-board">
<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">
<div class="sidebar-inner">
<?php if($is_admin) { ?> <h3 class="sidebar-title">좌측 광고 영역</h3> <?php } ?>
<div class="flex_box flex_box_l" data-layout="notice-list-left"></div>
</div>
</aside>
<?php endif; ?>
<main class="layout-main-content1">
<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" class="btn-view-toggle" onclick="toggleViewMode()" title="보기 모드 전환">
<i class="fa <?php echo ($view_mode === 'card') ? 'fa-list' : 'fa-th-large'; ?>" id="view-mode-icon"></i>
</button>
<?php if ($admin_href) { ?><a href="<?php echo $admin_href ?>" class="btn btn-secondary">관리자</a><?php } ?>
<?php if ($write_href) { ?><a href="<?php echo $write_href ?>" class="btn btn-primary">글쓰기</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="">
<!-- 전체 선택 체크박스 -->
<?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 속성으로 CSS 제어 -->
<div id="bo_list_body" 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']);
$thumbnail = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], 280, 180);
$status_text = '노출중';
$status_class = 'active';
if (!empty($post_data['wr_10'])) {
$status_text = '숨김';
$status_class = 'hidden';
} elseif (isset($post_data['wr_9']) && $post_data['wr_9'] == 'RESERVED') {
$today = G5_TIME_YMD;
if ($today < $post_data['wr_2']) { $status_text = '예약됨'; $status_class = 'scheduled'; }
elseif ($today > $post_data['wr_3']) { $status_text = '만료됨'; $status_class = 'expired'; }
}
?>
<!-- 1. 리스트형 아이템 -->
<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_list_<?php echo $i ?>" class="selec_chk">
<label for="chk_wr_id_list_<?php echo $i ?>"><span></span></label>
</div>
<?php } ?>
<div class="item-subject">
<a href="<?php echo $list[$i]['href'] ?>">
<?php echo $list[$i]['subject'] ?>
<?php if ($list[$i]['comment_cnt']) { ?><span class="cnt_cmt"><?php echo $list[$i]['wr_comment']; ?></span><?php } ?>
</a>
<span class="status-badge status-<?php echo $status_class; ?>"><?php echo $status_text; ?></span>
</div>
<div class="item-info">
<span><?php echo $list[$i]['name'] ?></span>
<span><?php echo $list[$i]['datetime2'] ?></span>
<span>조회 <?php echo $list[$i]['wr_hit'] ?></span>
</div>
</div>
<!-- 2. 카드형 아이템 -->
<div class="bo-card-item">
<?php if ($is_checkbox) { ?>
<div class="card-chk">
<input type="checkbox" name="chk_wr_id[]" 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></label>
</div>
<?php } ?>
<a href="<?php echo $list[$i]['href'] ?>" class="card-link">
<div class="card-thumb">
<?php if ($thumbnail['src']) { ?>
<img src="<?php echo $thumbnail['src']; ?>" alt="<?php echo $thumbnail['alt']; ?>">
<?php } else { ?>
<div class="no-img"><i class="fa fa-image"></i></div>
<?php } ?>
</div>
<div class="card-body">
<div class="card-title">
<?php echo $list[$i]['subject'] ?>
<span class="status-badge status-<?php echo $status_class; ?>"><?php echo $status_text; ?></span>
</div>
<div class="card-info">
<span><?php echo $list[$i]['name'] ?></span>
<span><?php echo $list[$i]['datetime2'] ?></span>
</div>
</div>
</a>
</div>
<?php } ?>
<?php if (count($list) == 0) { echo '<div class="empty-list">게시물이 없습니다.</div>'; } ?>
</div>
<?php if ($is_checkbox) { ?>
<div class="bo-list-footer" style="margin-top:20px; text-align:right;">
<button type="submit" name="btn_submit" value="선택삭제" onclick="document.pressed=this.value" class="btn btn-danger">선택삭제</button>
</div>
<?php } ?>
</form>
<div class="bo-list-bottom-wrapper" style="margin-top:30px;">
<div class="bo-pagination">
<?php echo $write_pages; ?>
</div>
<fieldset id="bo_sch" class="bo-search-box">
<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 btn btn-secondary">검색</button>
</form>
</fieldset>
</div>
</div>
</main>
<?php if (isset($board_ad_config['list_ad']['right']) && $board_ad_config['list_ad']['right'] === true): ?>
<aside class="layout-sidebar-right">
<div class="sidebar-inner">
<?php if($is_admin) { ?> <h3 class="sidebar-title">우측 광고 영역</h3> <?php } ?>
<div class="flex_box flex_box_r" data-layout="notice-list-right"></div>
</div>
</aside>
<?php endif; ?>
</div>
</div>
<script>
// 뷰 모드 전환 함수
function toggleViewMode() {
var body = document.getElementById('bo_list_body');
var icon = document.getElementById('view-mode-icon');
var currentMode = body.getAttribute('data-view-mode');
var newMode = (currentMode === 'list') ? 'card' : 'list';
body.setAttribute('data-view-mode', newMode);
// 아이콘 변경
if (newMode === 'card') {
icon.className = 'fa fa-list';
} else {
icon.className = 'fa fa-th-large';
}
// 쿠키 저장 (365일)
var date = new Date();
date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000));
document.cookie = "board_<?php echo $bo_table; ?>_view_mode=" + newMode + "; expires=" + date.toUTCString() + "; path=/";
}
<?php if ($is_checkbox) { ?>
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].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].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;
}
<?php } ?>
</script>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,164 @@
<?php
if (!defined('_GNUBOARD_')) exit;
/**
* notice :: view.skin.php
*/
// 0. 중앙 광고 설정 파일을 로드합니다.
include_once(G5_THEME_PATH . '/skin/board/board_ad_config.php');
$config_path = __DIR__ . '/config.php';
if (file_exists($config_path)) {
include_once($config_path);
}
// 이 스킨의 전용 스타일시트를 불러옵니다.
$style_ver = file_exists($board_skin_path . '/css/style.css') ? filemtime($board_skin_path . '/css/style.css') : G5_CSS_VER;
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/css/style.css?ver=' . $style_ver . '">', 0);
add_javascript('<script src="'.$board_skin_url.'/js/script.js?ver='.G5_SERVER_TIME.'"></script>', 0);
// --- 노출 상태 계산 ---
$status_text = '정보 없음';
$status_class = 'expired';
$is_hidden = ($view['wr_10'] == '1');
$today = G5_TIME_YMD;
if ($is_hidden) {
$status_text = '숨김 (노출 안 함)';
$status_class = 'hidden';
} else if ($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="notice-board">
<div class="three-column-layout container">
<?php if ((isset($board_ad_config['view_ad']['left']) && $board_ad_config['view_ad']['left'] === true) ): ?>
<aside class="layout-sidebar-left">
<div class="sidebar-inner">
<?php if($is_admin) { ?> <h3 class="sidebar-title">좌측 광고 영역</h3> <?php } ?>
<div class="flex_box flex_box_l" data-layout="notice-view-left"></div>
</div>
</aside>
<?php endif; ?>
<main class="layout-main-content">
<div id="bo_v">
<!-- 1. 제목 영역 -->
<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>
<!-- 2. 정보 영역 (작성자, 날짜, 조회수 등) -->
<div id="bo_v_info">
<dl>
<dt>작성자</dt>
<dd><?php echo $view['name'] ?><?php if ($is_ip_view) { echo "&nbsp;($ip)"; } ?></dd>
</dl>
<dl>
<dt>작성일</dt>
<dd><?php echo date("y-m-d H:i", strtotime($view['wr_datetime'])) ?></dd>
</dl>
<dl>
<dt>조회</dt>
<dd><?php echo number_format($view['wr_hit']) ?>회</dd>
</dl>
<?php if ($view['wr_link1']) { ?>
<dl>
<dt>링크</dt>
<dd><a href="<?php echo $view['wr_link1']; ?>" target="_blank"><?php echo $view['wr_link1']; ?></a></dd>
</dl>
<?php } ?>
</div>
<!-- 3. 본문 영역 -->
<div id="bo_v_con">
<?php
// 파일 출력
$v_img_count = count($view['file']);
if($v_img_count) {
echo "<div id=\"bo_v_img\">\n";
for ($i=0; $i<=count($view['file']); $i++) {
if (isset($view['file'][$i])) {
echo get_file_thumbnail($view['file'][$i]);
}
}
echo "</div>\n";
}
?>
<div class="view_content">
<?php echo conv_content($view['wr_content'], 1); ?>
</div>
</div>
<!-- 4. 첨부파일 영역 -->
<?php if (isset($view['file']) && count($view['file']) > 0) { ?>
<div id="bo_v_file">
<h3>첨부파일</h3>
<ul class="file-list">
<?php
for ($i = 0; $i < count($view['file']); $i++) {
if (isset($view['file'][$i]['source']) && $view['file'][$i]['source']) {
?>
<li>
<a href="<?php echo $view['file'][$i]['href']; ?>" class="view_file_download">
<i class="fa fa-download" aria-hidden="true"></i>
<strong><?php echo $view['file'][$i]['source'] ?></strong>
<?php echo $view['file'][$i]['content'] ?> (<?php echo $view['file'][$i]['size'] ?>)
</a>
<span class="bo_v_file_cnt"><?php echo $view['file'][$i]['download'] ?>회 다운로드 | DATE : <?php echo $view['file'][$i]['datetime'] ?></span>
</li>
<?php
}
}
?>
</ul>
</div>
<?php } ?>
<!-- 5. 하단 버튼 영역 -->
<div id="bo_v_bot">
<?php if ($update_href) { ?><a href="<?php echo $update_href ?>" class="btn btn-primary">수정</a><?php } ?>
<?php if ($delete_href) { ?><a href="<?php echo $delete_href ?>" onclick="del(this.href); return false;" class="btn btn-danger">삭제</a><?php } ?>
<?php if ($write_href) { ?><a href="<?php echo $write_href ?>" class="btn btn-primary">글쓰기</a><?php } ?>
<a href="<?php echo $list_href ?>" class="btn btn-secondary">목록</a>
</div>
</div>
</main>
<?php if ((isset($board_ad_config['view_ad']['right']) && $board_ad_config['view_ad']['right'] === true) ): ?>
<aside class="layout-sidebar-right">
<div class="sidebar-inner">
<?php if($is_admin) { ?> <h3 class="sidebar-title">우측 광고 영역</h3> <?php } ?>
<div class="flex_box flex_box_r" data-layout="notice-view-right"></div>
</div>
</aside>
<?php endif; ?>
</div>
</div>
<script>
function del(href) {
if(confirm("한번 삭제한 자료는 복구할 수 없습니다.\n\n정말 삭제하시겠습니까?")) {
document.location.href = href;
}
}
</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,203 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
/**
* notice :: write.skin.php
*/
// 0. 중앙 광고 설정 파일을 로드합니다.
include_once(G5_THEME_PATH . '/skin/board/board_ad_config.php');
$config_path = __DIR__ . '/config.php';
if (file_exists($config_path)) {
include_once($config_path);
}
// 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 . '/css/style.css') ? filemtime($board_skin_path . '/css/style.css') : G5_CSS_VER;
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/css/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);
?>
<div id="notice-board">
<div class="three-column-layout container">
<?php if (isset($board_ad_config['write_ad']['left']) && $board_ad_config['write_ad']['left'] === true): ?>
<aside class="layout-sidebar-left">
<div class="sidebar-inner">
<?php if($is_admin) { ?> <h3 class="sidebar-title">좌측 광고 영역</h3> <?php } ?>
<div class="flex_box flex_box_l" data-layout="notice-write-left"></div>
</div>
</aside>
<?php endif; ?>
<main class="layout-main-content">
<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 == '' || $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' && $write['wr_9'] == 'RESERVED') echo 'checked'; ?>>
<span class="custom-radio"></span> 예약 노출
</label>
<label style="margin-left: 20px;">
<input type="checkbox" name="wr_10" value="1" <?php echo ($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' && $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" readonly> <!-- readonly 추가하여 달력으로만 입력 유도 -->
</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" readonly>
</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 $write['wr_link1']; ?>" id="wr_link1" class="frm_input" size="50" placeholder="http://...">
</div>
<div class="write_div">
<label for="wr_content" class="frm_label">내용</label>
<?php echo $editor_html; // 스마트에디터 출력 ?>
</div>
<?php // 파일 업로드 ?>
<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-secondary">취소</a>
<input type="submit" value="작성완료" id="btn_submit" accesskey="s" class="btn btn-primary">
</div>
</form>
</div>
</main>
<?php if (isset($board_ad_config['write_ad']['right']) && $board_ad_config['write_ad']['right'] === true): ?>
<aside class="layout-sidebar-right">
<div class="sidebar-inner">
<?php if($is_admin) { ?> <h3 class="sidebar-title">우측 광고 영역</h3> <?php } ?>
<div class="flex_box flex_box_r" data-layout="notice-write-right"></div>
</div>
</aside>
<?php endif; ?>
</div>
</div>
<script>
function fwrite_submit(f) {
<?php echo $editor_js; // 에디터 사용시 자바스크립트 부분 ?>
// 예약 노출 선택 시 날짜 입력 유효성 검사
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날짜를 다시 확인해주세요.");
}
}
}
?>