Files
dnssash/theme/rd.dnssash/skin/board/rb.board.core/view.skin.php
T
2026-06-11 18:47:38 +09:00

125 lines
5.6 KiB
PHP

<?php
if (!defined('_GNUBOARD_')) exit;
/**
* rb.board.core :: view.skin.php
* 💡 [최종판] '플러그인형 코어' 뷰 - 자식 스킨의 설정에 따라 전문 코어 파일을 불러옵니다.
*/
if (!function_exists('get_extension')) {
function get_extension($filename) {
$filename = basename($filename);
return substr(strrchr($filename, "."), 1);
}
}
// 필드 맵 정의
$field_map = array('summary' => 'wr_1');
// 💡 [핵심] 첨부파일 재구성 (다운로드 파일만 처리)
$download_files = array();
if ($view['file']['count'] > 1) { // 썸네일(첫번째 파일)을 제외하고 2번째 파일부터 처리
$temp_files = $view['file'];
unset($temp_files['count']);
for ($i = 1; $i < $view['file']['count']; $i++) {
if (!isset($temp_files[$i])) continue;
$file = $temp_files[$i];
// 모든 파일을 다운로드 목록에 추가 (전문 코어에서 처리되지 않은 파일)
$download_files[] = $file;
}
}
// 💡 [핵심] 어떤 전문 코어 뷰 파일을 불러올지 결정합니다.
$core_type = isset($board_config['view']['core_type']) ? $board_config['view']['core_type'] : 'default';
$core_view_file = __DIR__ . '.'.$core_type.'/view.skin.php';
?>
<div class="board-view-container">
<article id="bo_v" class="view-article">
<header class="view-header">
<h1 id="bo_v_title"><?php echo cut_str(get_text($view['wr_subject']), 70); ?></h1>
<div class="view-meta">
<span class="meta-item"><i class="fa fa-user"></i> <?php echo $view['name'] ?></span>
<span class="meta-item"><i class="fa fa-clock-o"></i> <?php echo $view['datetime2'] ?></span>
<span class="meta-item"><i class="fa fa-eye"></i> <?php echo number_format($view['wr_hit']) ?></span>
</div>
</header>
<div class="view-content">
<!-- 💡 [핵심] 요약 내용이 있을 경우에만, 그리고 config에서 show_summary_in_view가 true일 경우에만 표시합니다. -->
<?php if ($view[$field_map['summary']] && (!isset($board_config['view']['show_summary_in_view']) || $board_config['view']['show_summary_in_view'] === true)): ?>
<div class="view-summary">
<?php echo get_text($view[$field_map['summary']]); ?>
</div>
<?php endif; ?>
<!-- 💡 [핵심] 본문 내용은 전문 코어 파일에서 처리하도록 비워둡니다. -->
<div class="view-detail-content">
<?php
// 이 부분은 전문 코어 파일에서 처리하므로 비워둡니다.
?>
</div>
<?php
// 💡 [핵심] 전문 코어 뷰 파일을 불러옵니다.
if (file_exists($core_view_file)) {
include($core_view_file);
} else {
echo '<div class="empty-list">전문 코어 뷰 파일을 찾을 수 없습니다: '.$core_view_file.'</div>';
}
?>
<?php if (!empty($download_files)): ?>
<div class="download-box">
<h3><i class="fa fa-download"></i> 첨부파일</h3>
<ul class="download-list">
<?php foreach ($download_files as $file):
$ext = strtolower(get_extension($file['source']));
$icon_class = 'fa-file-o';
if ($ext == 'pdf') $icon_class = 'fa-file-pdf-o';
else if (in_array($ext, ['jpg', 'jpeg', 'png', 'gif'])) $icon_class = 'fa-file-image-o';
else if (in_array($ext, ['zip', 'rar', '7z'])) $icon_class = 'fa-file-archive-o';
?>
<li>
<a href="<?php echo $file['href']; ?>">
<i class="fa <?php echo $icon_class; ?> file-icon" aria-hidden="true"></i>
<span class="file-name"><?php echo $file['source']; ?></span>
<span class="file-size">(<?php echo $file['size']; ?>)</span>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</div>
<!-- 💡 [최종 수정] view-footer 섹션을 다시 추가합니다. -->
<div class="view-footer">
<div class="btn-group-left">
<?php if ($prev_href): ?><a href="<?php echo $prev_href ?>" class="btn btn-secondary">이전글</a><?php endif; ?>
<?php if ($next_href): ?><a href="<?php echo $next_href ?>" class="btn btn-secondary">다음글</a><?php endif; ?>
</div>
<div class="btn-group-right">
<a href="<?php echo $list_href ?>" class="btn btn-primary">목록</a>
<?php if ($update_href): ?><a href="<?php echo $update_href ?>" class="btn btn-secondary">수정</a><?php endif; ?>
<?php if ($delete_href): ?><a href="<?php echo $delete_href ?>" onclick="del(this.href); return false;" class="btn btn-secondary">삭제</a><?php endif; ?>
<?php if ($write_href): ?><a href="<?php echo $write_href ?>" class="btn btn-primary">글쓰기</a><?php endif; ?>
</div>
</div>
</article>
</div>
<?php
// 💡 [핵심] 페이드 효과 확장 파일을 불러옵니다. (journal 타입에서만 사용)
if ($core_type === 'journal') {
$fade_effect_skin = __DIR__ . '.journal/pdf_fade_effect.skin.php';
if (file_exists($fade_effect_skin)) {
include_once($fade_effect_skin);
}
}
?>