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,9 @@
<?php
if (!defined('_GNUBOARD_')) exit;
// product_admin 스킨 광고 영역 설정
$product_admin_skin_config = [
'left_ad' => false, // 좌측 광고 사용 안함
'right_ad' => false, // 우측 광고 사용 안함
];
?>
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8" ?>
<dwsync>
<file name="btn_close.gif" server="happyjung.com:5001/www/" local="131979082007552031" remote="131980119000000000" Dst="0" />
<file name="bull_1.gif" server="happyjung.com:5001/www/" local="131979082006962424" remote="131980119000000000" Dst="0" />
<file name="bull_10.gif" server="happyjung.com:5001/www/" local="131979082006772542" remote="131980119000000000" Dst="0" />
<file name="bull_11.gif" server="happyjung.com:5001/www/" local="131979082006232877" remote="131980119000000000" Dst="0" />
<file name="bull_12.gif" server="happyjung.com:5001/www/" local="131979082005803143" remote="131980119000000000" Dst="0" />
<file name="bull_13.gif" server="happyjung.com:5001/www/" local="131979082005253594" remote="131980119000000000" Dst="0" />
<file name="bull_14.gif" server="happyjung.com:5001/www/" local="131979082004743798" remote="131980119000000000" Dst="0" />
<file name="bull_15.gif" server="happyjung.com:5001/www/" local="131979082003824369" remote="131980119000000000" Dst="0" />
<file name="bull_16.gif" server="happyjung.com:5001/www/" local="131979082003684453" remote="131980119000000000" Dst="0" />
<file name="bull_17.gif" server="happyjung.com:5001/www/" local="131979082003164776" remote="131980119000000000" Dst="0" />
<file name="bull_18.gif" server="happyjung.com:5001/www/" local="131979082002515176" remote="131980119000000000" Dst="0" />
<file name="bull_19.gif" server="happyjung.com:5001/www/" local="131979082002055462" remote="131980119000000000" Dst="0" />
<file name="bull_2.gif" server="happyjung.com:5001/www/" local="131979082001565747" remote="131980119000000000" Dst="0" />
<file name="bull_20.gif" server="happyjung.com:5001/www/" local="131979082001026095" remote="131980119000000000" Dst="0" />
<file name="bull_21.gif" server="happyjung.com:5001/www/" local="131979082000586371" remote="131980119000000000" Dst="0" />
<file name="bull_22.gif" server="happyjung.com:5001/www/" local="131979082000106668" remote="131980119000000000" Dst="0" />
<file name="bull_23.gif" server="happyjung.com:5001/www/" local="131979081999616945" remote="131980119000000000" Dst="0" />
<file name="bull_24.gif" server="happyjung.com:5001/www/" local="131979081998767473" remote="131980119000000000" Dst="0" />
<file name="bull_25.gif" server="happyjung.com:5001/www/" local="131979081998677552" remote="131980119000000000" Dst="0" />
<file name="bull_26.gif" server="happyjung.com:5001/www/" local="131979081998177863" remote="131980119000000000" Dst="0" />
<file name="bull_27.gif" server="happyjung.com:5001/www/" local="131979081997628202" remote="131980119000000000" Dst="0" />
<file name="bull_28.gif" server="happyjung.com:5001/www/" local="131979081997108523" remote="131980119000000000" Dst="0" />
<file name="bull_29.gif" server="happyjung.com:5001/www/" local="131979081996478914" remote="131980119000000000" Dst="0" />
<file name="bull_3.gif" server="happyjung.com:5001/www/" local="131979081996059173" remote="131980119000000000" Dst="0" />
<file name="bull_30-1.gif" server="happyjung.com:5001/www/" local="131979081995559497" remote="131980119000000000" Dst="0" />
<file name="bull_30.gif" server="happyjung.com:5001/www/" local="131979081995109763" remote="131980119000000000" Dst="0" />
<file name="bull_4.gif" server="happyjung.com:5001/www/" local="131979081994650045" remote="131980119000000000" Dst="0" />
<file name="bull_5.gif" server="happyjung.com:5001/www/" local="131979081994130368" remote="131980119000000000" Dst="0" />
<file name="bull_6.gif" server="happyjung.com:5001/www/" local="131979081993300882" remote="131980119000000000" Dst="0" />
<file name="bull_7.gif" server="happyjung.com:5001/www/" local="131979081993250910" remote="131980119000000000" Dst="0" />
<file name="bull_8.gif" server="happyjung.com:5001/www/" local="131979081992281511" remote="131980119000000000" Dst="0" />
<file name="bull_9.gif" server="happyjung.com:5001/www/" local="131979081992191568" remote="131980119000000000" Dst="0" />
<file name="bull_a.gif" server="happyjung.com:5001/www/" local="131979081991262143" remote="131980119000000000" Dst="0" />
<file name="cal.gif" server="happyjung.com:5001/www/" local="131979081991202152" remote="131980119000000000" Dst="0" />
<file name="icon.gif" server="happyjung.com:5001/www/" local="131979081990362720" remote="131980119000000000" Dst="0" />
<file name="icon_file.gif" server="happyjung.com:5001/www/" local="131979081990302736" remote="131980119000000000" Dst="0" />
<file name="icon_hot.gif" server="happyjung.com:5001/www/" local="131979081989483215" remote="131980119000000000" Dst="0" />
<file name="icon_img.gif" server="happyjung.com:5001/www/" local="131979081989433276" remote="131980119000000000" Dst="0" />
<file name="icon_link.gif" server="happyjung.com:5001/www/" local="131979081988553808" remote="131980119000000000" Dst="0" />
<file name="icon_mobile.gif" server="happyjung.com:5001/www/" local="131979081988503855" remote="131980119000000000" Dst="0" />
<file name="icon_movie.gif" server="happyjung.com:5001/www/" local="131979081987634370" remote="131980119000000000" Dst="0" />
<file name="icon_new.gif" server="happyjung.com:5001/www/" local="131979081987584419" remote="131980119000000000" Dst="0" />
<file name="icon_reply.gif" server="happyjung.com:5001/www/" local="131979081986765031" remote="131980119000000000" Dst="0" />
<file name="icon_secret.gif" server="happyjung.com:5001/www/" local="131979081986715074" remote="131980119000000000" Dst="0" />
<file name="icon_sound.gif" server="happyjung.com:5001/www/" local="131979081985855489" remote="131980119000000000" Dst="0" />
<file name="m_next.gif" server="happyjung.com:5001/www/" local="131979081985805519" remote="131980119000000000" Dst="0" />
<file name="m_prev.gif" server="happyjung.com:5001/www/" local="131979081985035998" remote="131980119000000000" Dst="0" />
<file name="point.gif" server="happyjung.com:5001/www/" local="131979081984896083" remote="131980119000000000" Dst="0" />
<file name="y_next.gif" server="happyjung.com:5001/www/" local="131979081984436368" remote="131980119000000000" Dst="0" />
<file name="y_prev.gif" server="happyjung.com:5001/www/" local="131979081983207101" remote="131980119000000000" Dst="0" />
</dwsync>
Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

@@ -0,0 +1,51 @@
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;
}
});
});
});
@@ -0,0 +1,300 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 1. 자식 스킨의 설정 파일을 로드합니다.
$config_path = __DIR__ . '/config.php';
if (file_exists($config_path)) {
include_once($config_path);
}
// 💡 [핵심 1] 테마의 헤더 파일을 불러옵니다. (상단 메뉴, 로고 등 포함)
//include_once(G5_THEME_PATH.'/head.php');
// 이 스킨의 전용 스타일시트를 불러옵니다.
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);
?>
<main class="main-content-wrapper">
<div class="three-column-layout container">
<?php if (isset($product_admin_skin_config['left_ad']) && $product_admin_skin_config['left_ad'] === 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">
<!-- 게시판 카테고리 시작 { -->
<?php if ($is_category) { ?>
<nav id="bo_cate">
<h2><?php echo $board['bo_subject'] ?> 카테고리</h2>
<ul id="bo_cate_ul">
<?php echo $category_option ?>
</ul>
</nav>
<?php } ?>
<!-- } 게시판 카테고리 끝 -->
<!-- 게시판 상단 정보 및 버튼 영역 -->
<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="">
<!-- 게시물 리스트 시작 -->
<!-- 게시물 리스트 시작 (보기 전환을 위해 컨테이너 ID 추가 및 기본 클래스 설정) -->
<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
// 게시물이 없을 경우를 위한 플래그
$has_posts = count($list) > 0;
for ($i = 0; $i < count($list); $i++) {
// --- 카드형을 위한 데이터 준비 ---
// 1. 썸네일 이미지 가져오기 (GnuBoard 표준 함수 사용)
$thumbnail = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
// 2. 이미지가 없을 경우, 본문 내용의 일부를 가져오기
$content_preview = '';
if (!$thumbnail['src']) {
// 💡 [수정] $g5['write_table'] 대신 직접 테이블명을 조합하여 사용합니다.
$write_table = $g5['write_prefix'] . $bo_table;
$post_content_data = get_write($write_table, $list[$i]['wr_id']);
// 💡 [수정] get_write()가 데이터를 정상적으로 가져왔는지 확인 후 처리하여 오류를 방지합니다.
if (isset($post_content_data['wr_content'])) {
// HTML 태그를 제거하고 150자까지 잘라서 보여줍니다.
$content_preview = cut_str(strip_tags($post_content_data['wr_content']), 150);
}
}
// --- 데이터 준비 끝 ---
?>
<!-- 1. 기존 목록형 아이템 (bo-list-item) -->
<div class="bo-list-item <?php if ($list[$i]['is_notice']) echo "is-notice"; ?>">
<?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">
<?php if ($list[$i]['is_notice']) {
echo '<strong class="item-notice-badge">공지</strong>';
} ?>
<?php if ($is_category && $list[$i]['ca_name']) { ?>
<a href="<?php echo $list[$i]['ca_name_href'] ?>"
class="item-category"><?php echo $list[$i]['ca_name'] ?></a>
<?php } ?>
<a href="<?php echo $list[$i]['href'] ?>" class="item-title">
<?php echo $list[$i]['icon_reply'] ?>
<?php if (isset($list[$i]['icon_secret'])) echo $list[$i]['icon_secret']; ?>
<?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 } ?>
<?php if ($list[$i]['icon_new']) echo "<span class=\"item-new-icon\">N</span>"; ?>
</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>
<?php if ($is_good) { ?><span class="item-good">
추천 <?php echo $list[$i]['wr_good'] ?></span><?php } ?>
</div>
</div>
</div>
<!-- 2. 새로운 카드형 아이템 (bo-card-item) -->
<div class="bo-card-item <?php if ($list[$i]['is_notice']) echo "is-notice"; ?>">
<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 if ($is_category && $list[$i]['ca_name']) { ?>
<strong class="item-category"><?php echo $list[$i]['ca_name'] ?></strong>
<?php } ?>
<?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-meta">
<span><?php echo $list[$i]['name'] ?></span>
<span><?php echo $list[$i]['datetime2'] ?></span>
</div>
</div>
</a>
<?php if ($is_checkbox) { ?>
<div class="card-chk">
<input type="checkbox" name="chk_wr_id_card[]"
value="<?php echo $list[$i]['wr_id'] ?>"
id="chk_wr_id_card_<?php echo $i ?>" class="selec_chk">
<!-- <label for="chk_wr_id_card_-->
<?php //echo $i ?><!--"><span></span></label>-->
</div>
<?php } ?>
</div>
<?php } ?>
<?php if (!$has_posts) {
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>
<button type="submit" name="btn_submit" value="선택복사"
onclick="document.pressed=this.value" class="btn-admin">선택복사
</button>
<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($product_admin_skin_config['right_ad']) && $product_admin_skin_config['right_ad'] === 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].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 == "선택복사" || document.pressed == "선택이동") {
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
f.sw.value = (document.pressed == "선택복사") ? "copy" : "move";
f.target = "move";
f.action = "<?php echo G5_BBS_URL; ?>/move.php";
f.submit();
return;
}
if (document.pressed == "선택삭제") {
if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다\n\n답변글이 있는 게시글을 선택하신 경우\n답변글도 선택하셔야 게시글이 삭제됩니다."))
return false;
f.removeAttribute("target");
f.action = "<?php echo G5_BBS_URL; ?>/board_list_update.php";
}
return true;
}
</script>
<?php } ?>
<!-- } 게시판 목록 끝 -->
<?php
// 💡 [핵심 2] 테마의 푸터 파일을 불러옵니다. (하단 정보, 저작권 등 포함)
//include_once(G5_THEME_PATH.'/tail.php');
?>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,116 @@
<?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">
<span><i class="fa fa-user" aria-hidden="true"></i> <strong><?php echo $view['name'] ?></strong></span>
<span><i class="fa fa-clock-o" aria-hidden="true"></i> <?php echo date("Y-m-d H:i", strtotime($view['wr_datetime'])) ?></span>
<span><i class="fa fa-eye" aria-hidden="true"></i> <?php echo number_format($view['wr_hit']) ?></span>
<span><?php echo '제품글 번호 : '.$wr_id; ?></span>
</div>
<div id="bo_v_atc">
<!-- 1. 본문 내용이 먼저 나오도록 순서 변경 -->
<div id="bo_v_con">
<!-- --><?php //echo $view['content']; ?>
<?php echo conv_content($view['content'],1); ?>
</div>
<?php
// 📌 [최종 수정] 올바른 서버 경로를 사용하여 썸네일을 생성합니다.
if (isset($view['file']) && is_array($view['file']) && count($view['file'])) {
echo "<div id=\"bo_v_img\">\n";
// 썸네일을 저장할 실제 서버 폴더 경로를 지정합니다.
$source_path = G5_DATA_PATH.'/file/'.$bo_table;
foreach ($view['file'] as $file) {
// 파일 정보가 유효한지 확인합니다.
if ( !is_array($file) || empty($file['file']) ) {
continue;
}
// 올바른 서버 경로를 사용하여 썸네일을 생성합니다.
$thumb = thumbnail($file['file'], $source_path, $source_path, 200, 200, false, true);
if($thumb) {
// 화면에 표시할 올바른 웹 주소(URL)를 생성합니다.
$img_src = G5_DATA_URL.'/file/'.$bo_table.'/'.$thumb;
$original_href = G5_DATA_URL.'/file/'.$bo_table.'/'.$file['file'];
// 최종 HTML 구조를 생성합니다.
echo '<a href="'.$original_href.'" class="view_image_link">';
$alt_text = isset($file['source']) ? get_text($file['source']) : '';
echo '<img src="'.$img_src.'" alt="'.$alt_text.'">';
echo '</a>';
}
}
echo "</div>\n";
}
?>
</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 ($reply_href) { ?><a href="<?php echo $reply_href ?>" 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">&times;</span>
<img class="lightbox_content" id="lightbox_image">
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const lightbox = document.getElementById('image_lightbox');
const lightboxImage = document.getElementById('lightbox_image');
const imageLinks = document.querySelectorAll('.view_image_link');
const closeBtn = document.querySelector('.lightbox_close');
if (!lightbox || !imageLinks.length) return;
imageLinks.forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
lightboxImage.src = this.href;
lightbox.style.display = 'flex';
});
});
function closeModal() {
lightbox.style.display = 'none';
lightboxImage.src = '';
}
if(closeBtn) {
closeBtn.addEventListener('click', closeModal);
}
lightbox.addEventListener('click', function(e) {
if (e.target === lightbox) {
closeModal();
}
});
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape' && lightbox.style.display === 'flex') {
closeModal();
}
});
});
</script>
@@ -0,0 +1,355 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
?>
<script>
// 글자수 제한
var char_min = parseInt(<?php echo $comment_min ?>); // 최소
var char_max = parseInt(<?php echo $comment_max ?>); // 최대
</script>
<button type="button" class="cmt_btn"><span class="total"><b>댓글</b> <?php echo $view['wr_comment']; ?></span><span class="cmt_more"></span></button>
<!-- 댓글 시작 { -->
<section id="bo_vc">
<h2>댓글목록</h2>
<?php
$cmt_amt = count($list);
for ($i=0; $i<$cmt_amt; $i++) {
$comment_id = $list[$i]['wr_id'];
$cmt_depth = strlen($list[$i]['wr_comment_reply']) * 50;
$comment = $list[$i]['content'];
/*
if (strstr($list[$i]['wr_option'], "secret")) {
$str = $str;
}
*/
$comment = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $comment);
$cmt_sv = $cmt_amt - $i + 1; // 댓글 헤더 z-index 재설정 ie8 이하 사이드뷰 겹침 문제 해결
$c_reply_href = $comment_common_url.'&amp;c_id='.$comment_id.'&amp;w=c#bo_vc_w';
$c_edit_href = $comment_common_url.'&amp;c_id='.$comment_id.'&amp;w=cu#bo_vc_w';
$is_comment_reply_edit = ($list[$i]['is_reply'] || $list[$i]['is_edit'] || $list[$i]['is_del']) ? 1 : 0;
?>
<article id="c_<?php echo $comment_id ?>" <?php if ($cmt_depth) { ?>style="margin-left:<?php echo $cmt_depth ?>px;border-top-color:#e0e0e0"<?php } ?>>
<div class="pf_img"><?php echo get_member_profile_img($list[$i]['mb_id']); ?></div>
<div class="cm_wrap">
<header style="z-index:<?php echo $cmt_sv; ?>">
<h2><?php echo get_text($list[$i]['wr_name']); ?>님의 <?php if ($cmt_depth) { ?><span class="sound_only">댓글의</span><?php } ?> 댓글</h2>
<?php echo $list[$i]['name'] ?>
<?php if ($is_ip_view) { ?>
<span class="sound_only">아이피</span>
<span>(<?php echo $list[$i]['ip']; ?>)</span>
<?php } ?>
<span class="sound_only">작성일</span>
<span class="bo_vc_hdinfo"><i class="fa fa-clock-o" aria-hidden="true"></i> <time datetime="<?php echo date('Y-m-d\TH:i:s+09:00', strtotime($list[$i]['datetime'])) ?>"><?php echo $list[$i]['datetime'] ?></time></span>
<?php
include(G5_SNS_PATH.'/view_comment_list.sns.skin.php');
?>
</header>
<!-- 댓글 출력 -->
<div class="cmt_contents">
<p>
<?php if (strstr($list[$i]['wr_option'], "secret")) { ?><img src="<?php echo $board_skin_url; ?>/img/icon_secret.gif" alt="비밀글"><?php } ?>
<?php echo $comment ?>
</p>
<?php if($is_comment_reply_edit) {
if($w == 'cu') {
$sql = " select wr_id, wr_content, mb_id from $write_table where wr_id = '$c_id' and wr_is_comment = '1' ";
$cmt = sql_fetch($sql);
if (isset($cmt)) {
if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id']))) {
$cmt['wr_content'] = '';
}
$c_wr_content = $cmt['wr_content'];
}
}
?>
<?php } ?>
</div>
<span id="edit_<?php echo $comment_id ?>" class="bo_vc_w"></span><!-- 수정 -->
<span id="reply_<?php echo $comment_id ?>" class="bo_vc_w"></span><!-- 답변 -->
<input type="hidden" value="<?php echo strstr($list[$i]['wr_option'],"secret") ?>" id="secret_comment_<?php echo $comment_id ?>">
<textarea id="save_comment_<?php echo $comment_id ?>" style="display:none"><?php echo get_text($list[$i]['content1'], 0) ?></textarea>
</div>
<?php if($is_comment_reply_edit) { ?>
<div class="bo_vl_opt">
<button type="button" class="btn_cm_opt btn_b01 btn"><i class="fa fa-ellipsis-v" aria-hidden="true"></i><span class="sound_only">댓글 옵션</span></button>
<ul class="bo_vc_act">
<?php if ($list[$i]['is_reply']) { ?><li><a href="<?php echo $c_reply_href; ?>" onclick="comment_box('<?php echo $comment_id ?>', 'c'); return false;">답변</a></li><?php } ?>
<?php if ($list[$i]['is_edit']) { ?><li><a href="<?php echo $c_edit_href; ?>" onclick="comment_box('<?php echo $comment_id ?>', 'cu'); return false;">수정</a></li><?php } ?>
<?php if ($list[$i]['is_del']) { ?><li><a href="<?php echo $list[$i]['del_link']; ?>" onclick="return comment_delete();">삭제</a></li><?php } ?>
</ul>
</div>
<?php } ?>
<script>
$(function() {
// 댓글 옵션창 열기
$(".btn_cm_opt").on("click", function(){
$(this).parent("div").children(".bo_vc_act").show();
});
// 댓글 옵션창 닫기
$(document).mouseup(function (e){
var container = $(".bo_vc_act");
if( container.has(e.target).length === 0)
container.hide();
});
});
</script>
</article>
<?php } ?>
<?php if ($i == 0) { //댓글이 없다면 ?><p id="bo_vc_empty">등록된 댓글이 없습니다.</p><?php } ?>
</section>
<!-- } 댓글 끝 -->
<?php if ($is_comment_write) {
if($w == '')
$w = 'c';
?>
<!-- 댓글 쓰기 시작 { -->
<aside id="bo_vc_w" class="bo_vc_w">
<h2>댓글쓰기</h2>
<form name="fviewcomment" id="fviewcomment" action="<?php echo $comment_action_url; ?>" onsubmit="return fviewcomment_submit(this);" method="post" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w ?>" id="w">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="comment_id" value="<?php echo $c_id ?>" id="comment_id">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="is_good" value="">
<span class="sound_only">내용</span>
<?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?>
<textarea id="wr_content" name="wr_content" maxlength="10000" required class="required" title="내용" placeholder="댓글내용을 입력해주세요"
<?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?>><?php echo $c_wr_content; ?></textarea>
<?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?>
<script>
$(document).on("keyup change", "textarea#wr_content[maxlength]", function() {
var str = $(this).val()
var mx = parseInt($(this).attr("maxlength"))
if (str.length > mx) {
$(this).val(str.substr(0, mx));
return false;
}
});
</script>
<div class="bo_vc_w_wr">
<div class="bo_vc_w_info">
<?php if ($is_guest) { ?>
<label for="wr_name" class="sound_only">이름<strong> 필수</strong></label>
<input type="text" name="wr_name" value="<?php echo get_cookie("ck_sns_name"); ?>" id="wr_name" required class="frm_input required" size="25" placeholder="이름">
<label for="wr_password" class="sound_only">비밀번호<strong> 필수</strong></label>
<input type="password" name="wr_password" id="wr_password" required class="frm_input required" size="25" placeholder="비밀번호">
<?php
}
?>
<?php
if($board['bo_use_sns'] && ($config['cf_facebook_appid'] || $config['cf_twitter_key'])) {
?>
<span class="sound_only">SNS 동시등록</span>
<span id="bo_vc_send_sns"></span>
<?php } ?>
<?php if ($is_guest) { ?>
<?php echo $captcha_html; ?>
<?php } ?>
</div>
<div class="btn_confirm">
<span class="secret_cm chk_box">
<input type="checkbox" name="wr_secret" value="secret" id="wr_secret" class="selec_chk">
<label for="wr_secret"><span></span>비밀글</label>
</span>
<button type="submit" id="btn_submit" class="btn_submit">댓글등록</button>
</div>
</div>
</form>
</aside>
<script>
var save_before = '';
var save_html = document.getElementById('bo_vc_w').innerHTML;
function good_and_write()
{
var f = document.fviewcomment;
if (fviewcomment_submit(f)) {
f.is_good.value = 1;
f.submit();
} else {
f.is_good.value = 0;
}
}
function fviewcomment_submit(f)
{
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
f.is_good.value = 0;
var subject = "";
var content = "";
$.ajax({
url: g5_bbs_url+"/ajax.filter.php",
type: "POST",
data: {
"subject": "",
"content": f.wr_content.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
subject = data.subject;
content = data.content;
}
});
if (content) {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다");
f.wr_content.focus();
return false;
}
// 양쪽 공백 없애기
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
document.getElementById('wr_content').value = document.getElementById('wr_content').value.replace(pattern, "");
if (char_min > 0 || char_max > 0)
{
check_byte('wr_content', 'char_count');
var cnt = parseInt(document.getElementById('char_count').innerHTML);
if (char_min > 0 && char_min > cnt)
{
alert("댓글은 "+char_min+"글자 이상 쓰셔야 합니다.");
return false;
} else if (char_max > 0 && char_max < cnt)
{
alert("댓글은 "+char_max+"글자 이하로 쓰셔야 합니다.");
return false;
}
}
else if (!document.getElementById('wr_content').value)
{
alert("댓글을 입력하여 주십시오.");
return false;
}
if (typeof(f.wr_name) != 'undefined')
{
f.wr_name.value = f.wr_name.value.replace(pattern, "");
if (f.wr_name.value == '')
{
alert('이름이 입력되지 않았습니다.');
f.wr_name.focus();
return false;
}
}
if (typeof(f.wr_password) != 'undefined')
{
f.wr_password.value = f.wr_password.value.replace(pattern, "");
if (f.wr_password.value == '')
{
alert('비밀번호가 입력되지 않았습니다.');
f.wr_password.focus();
return false;
}
}
<?php if($is_guest) echo chk_captcha_js(); ?>
set_comment_token(f);
document.getElementById("btn_submit").disabled = "disabled";
return true;
}
function comment_box(comment_id, work)
{
var el_id,
form_el = 'fviewcomment',
respond = document.getElementById(form_el);
// 댓글 아이디가 넘어오면 답변, 수정
if (comment_id)
{
if (work == 'c')
el_id = 'reply_' + comment_id;
else
el_id = 'edit_' + comment_id;
}
else
el_id = 'bo_vc_w';
if (save_before != el_id)
{
if (save_before)
{
document.getElementById(save_before).style.display = 'none';
}
document.getElementById(el_id).style.display = '';
document.getElementById(el_id).appendChild(respond);
//입력값 초기화
document.getElementById('wr_content').value = '';
// 댓글 수정
if (work == 'cu')
{
document.getElementById('wr_content').value = document.getElementById('save_comment_' + comment_id).value;
if (typeof char_count != 'undefined')
check_byte('wr_content', 'char_count');
if (document.getElementById('secret_comment_'+comment_id).value)
document.getElementById('wr_secret').checked = true;
else
document.getElementById('wr_secret').checked = false;
}
document.getElementById('comment_id').value = comment_id;
document.getElementById('w').value = work;
if(save_before)
$("#captcha_reload").trigger("click");
save_before = el_id;
}
}
function comment_delete()
{
return confirm("이 댓글을 삭제하시겠습니까?");
}
comment_box('', 'c'); // 댓글 입력폼이 보이도록 처리하기위해서 추가 (root님)
<?php if($board['bo_use_sns'] && ($config['cf_facebook_appid'] || $config['cf_twitter_key'])) { ?>
$(function() {
// sns 등록
$("#bo_vc_send_sns").load(
"<?php echo G5_SNS_URL; ?>/view_comment_write.sns.skin.php?bo_table=<?php echo $bo_table; ?>",
function() {
save_html = document.getElementById('bo_vc_w').innerHTML;
}
);
});
<?php } ?>
</script>
<?php } ?>
<!-- } 댓글 쓰기 끝 -->
<script>
jQuery(function($) {
//댓글열기
$(".cmt_btn").click(function(e){
e.preventDefault();
$(this).toggleClass("cmt_btn_op");
$("#bo_vc").toggle();
});
});
</script>
@@ -0,0 +1,123 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 💡 [핵심 1] 테마의 헤더 파일을 불러옵니다. (상단 메뉴, 로고 등 포함)
//include_once(G5_THEME_PATH.'/head.php');
// 이 스킨의 전용 스타일시트를 불러옵니다.
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css?ver=' . time() . '">', 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
$option = '';
$option_hidden = '';
if ($is_notice || $is_html || $is_secret || $is_mail) {
// HTML 사용을 기본으로 강제합니다.
$option_hidden .= '<input type="hidden" name="html" value="html1">';
}
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>
<!-- 💡 [수정] CSS에 맞춘 이미지 미리보기 기능 구현 -->
<?php for ($i=1; $is_file && $i<=$file_count; $i++) { ?>
<div class="write_div">
<label for="bf_file_<?php echo $i ?>" class="frm_label">대표 이미지 (파일 #<?php echo $i ?>)</label>
<div class="file_preview_wrapper">
<div class="file_preview" id="preview_<?php echo $i ?>"
style="<?php if($w=='u' && isset($file[$i-1]['path'])) echo 'background-image: url('.$file[$i-1]['path'].'/'.$file[$i-1]['file'].')'; ?>">
<?php if(!($w=='u' && isset($file[$i-1]['path']))) { ?>
<span class="preview_text">클릭하여 이미지 업로드</span>
<?php } ?>
</div>
</div>
<input type="file" name="bf_file[]" id="bf_file_<?php echo $i ?>" style="display:none;" accept="image/*">
<div class="file_info">
<span id="info_<?php echo $i ?>">
<?php if ($w == 'u' && isset($file[$i-1]['source'])) { echo $file[$i-1]['source'].' ('.$file[$i-1]['size'].')'; } else { echo '선택된 파일 없음'; } ?>
</span>
<?php if ($w == 'u' && isset($file[$i-1]['source'])) { ?>
<span class="file_del">
<input type="checkbox" id="bf_file_del_<?php echo $i-1 ?>" name="bf_file_del[<?php echo $i-1; ?>]" value="1">
<label for="bf_file_del_<?php echo $i-1 ?>">삭제</label>
</span>
<?php } ?>
</div>
</div>
<?php } ?>
<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>
document.addEventListener('DOMContentLoaded', function() {
// 파일 미리보기 기능
for (let i = 1; i <= <?php echo $file_count; ?>; i++) {
const previewBox = document.getElementById(`preview_${i}`);
const fileInput = document.getElementById(`bf_file_${i}`);
const infoText = document.getElementById(`info_${i}`);
if (previewBox && fileInput && infoText) {
const previewText = previewBox.querySelector('.preview_text');
previewBox.addEventListener('click', () => {
fileInput.click();
});
fileInput.addEventListener('change', (event) => {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
previewBox.style.backgroundImage = `url(${e.target.result})`;
if (previewText) {
previewText.style.display = 'none';
}
}
reader.readAsDataURL(file);
infoText.textContent = file.name;
}
});
}
}
});
function fwrite_submit(f) {
<?php echo $editor_js; // 에디터 사용시 자바스크립트 부분 ?>
// 추가적인 유효성 검사 로직이 필요하다면 여기에 추가
return true;
}
</script>
<?php
// 💡 [핵심 2] 테마의 푸터 파일을 불러옵니다. (하단 정보, 저작권 등 포함)
//include_once(G5_THEME_PATH.'/tail.php');
?>
@@ -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날짜를 다시 확인해주세요.");
}
}
}
?>