콘텐츠와 동일하게, 게시판(bo_include)·1:1문의(qa_include)·쇼핑몰 분류 (ca_include)의 상단/하단 파일 경로도 저장 전에 먼저 정규화한 뒤 확장자와 위치를 검증하도록 순서를 조정한다. 정규화 과정에서 확장자가 사라져 검증을 우회하던 경로를 차단하고, data 디렉터리로 귀결되는 경로를 거부한다. 실행 직전 board_head/board_tail, qahead/qatail, shop 목록·상품 페이지에서도 승인 확장자와 data 디렉터리 여부를 다시 확인하는 is_content_include_allowed() 를 적용한다. 이미 저장된 경로도 실행 시 재확인된다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 0c6bca704725ebea2a584d4c06366282e9bc36d6)
20 lines
1.0 KiB
PHP
20 lines
1.0 KiB
PHP
<?php
|
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
|
|
|
// 게시판 관리의 상단 내용
|
|
if (G5_IS_MOBILE) {
|
|
// 모바일의 경우 설정을 따르지 않는다.
|
|
include_once(G5_BBS_PATH.'/_head.php');
|
|
echo run_replace('board_mobile_content_head', html_purifier(stripslashes($board['bo_mobile_content_head'])), $board);
|
|
} else {
|
|
// 상단 파일 경로를 입력하지 않았다면 기본 상단 파일도 include 하지 않음
|
|
if (trim($board['bo_include_head'])) {
|
|
if (is_include_path_check($board['bo_include_head'])
|
|
&& (!function_exists('is_content_include_allowed') || is_content_include_allowed($board['bo_include_head']))) { //파일경로 체크
|
|
@include ($board['bo_include_head']);
|
|
} else { //파일경로가 올바르지 않으면 기본파일을 가져옴
|
|
include_once(G5_BBS_PATH.'/_head.php');
|
|
}
|
|
}
|
|
echo run_replace('board_content_head', html_purifier(stripslashes($board['bo_content_head'])), $board);
|
|
} |