Files
dnssash/theme/rd.laser/head.php
T
2026-06-11 18:47:38 +09:00

159 lines
6.9 KiB
PHP

<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if(G5_COMMUNITY_USE === false) {
define('G5_IS_COMMUNITY_PAGE', true);
include_once(G5_THEME_SHOP_PATH.'/shop.head.php');
return;
}
include_once (G5_THEME_PATH.'/functions.php');
include_once(G5_THEME_PATH.'/head.sub.php');
include_once(G5_LIB_PATH.'/latest.lib.php');
include_once(G5_LIB_PATH.'/outlogin.lib.php');
include_once(G5_LIB_PATH.'/poll.lib.php');
include_once(G5_LIB_PATH.'/visit.lib.php');
include_once(G5_LIB_PATH.'/connect.lib.php');
include_once(G5_LIB_PATH.'/popular.lib.php');
if(defined('_INDEX_')) {
include G5_THEME_PATH.'/skin/newwin/modal/newwin.skin.php';
}
$version_string = G5_SERVER_TIME;
add_stylesheet('<link rel="stylesheet" href="'.G5_THEME_CSS_URL.'/style_prestige_1.css?ver='.$version_string.'">', 0);
add_stylesheet('<link rel="preconnect" href="https://fonts.googleapis.com">', 0);
add_stylesheet('<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>', 0);
add_stylesheet('<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;700;900&display=swap" rel="stylesheet">', 0);
add_stylesheet('<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">', 0);
// add_stylesheet('<link rel="stylesheet" href="'.G5_THEME_URL.'/css/custom_header.css?ver='.$version_string.'">', 1);
add_stylesheet('<link rel="stylesheet" href="'.G5_THEME_URL.'/css/floating_ads.css?ver='.$version_string.'">', 2);
add_javascript('<script src="'.G5_THEME_JS_URL.'/script_trend_1.js?ver='.$version_string.'"></script>', 100);
add_javascript('<script src="'.G5_THEME_JS_URL.'/member/member.js?ver='.$version_string.'"></script>', 101);
add_javascript('<script src="'.G5_THEME_URL.'/js/module-helper.js?ver='.$version_string.'"></script>', 1);
if (isset($rb_core['layout_hd']) && $rb_core['layout_hd']) {
include_once(G5_THEME_PATH . '/rb.layout_hd/' . $rb_core['layout_hd'] . '/header.php');
} else {
echo "<div class='no_data' style='padding:30px 0 !important; text-align:center; background-color:#f9f9f9;'><span class='font-B color-000'>선택된 헤더 레이아웃이 없습니다.</span><br>관리자 > 리빌더 > 환경설정 패널에서 헤더 레이아웃을 설정해주세요.</div>";
}
// 유동형 광고 출력 로직
$left_banners = array();
$right_banners = array();
// 💡 [수정] 모바일이 아닐 때만 배너 데이터 조회 및 좌측 배너 출력 (조건문 제거)
// 💡 [최종 수정] ORDER BY 구문 추가
$sql = " SELECT * FROM `rb_banner` WHERE (bn_position = 'floating_left' OR bn_position = 'floating_right') AND bn_begin_time <= NOW() AND bn_end_time >= NOW() ORDER BY bn_order ASC, bn_id DESC ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
if ($row['bn_position'] == 'floating_left') {
$left_banners[] = $row;
} else {
$right_banners[] = $row;
}
}
?>
<?php if (!empty($left_banners)) { ?>
<div class="floating-ad left">
<?php foreach ($left_banners as $banner) {
$bimg = G5_DATA_PATH.'/banners/'.$banner['bn_id'];
if (file_exists($bimg)) {
echo '<a href="'.$banner['bn_url'].'" target="'.($banner['bn_new_win'] ? '_blank' : '_self').'" onclick="banner_click_count(this); return true;" data-banner-id="'.$banner['bn_id'].'"><img src="'.G5_DATA_URL.'/banners/'.$banner['bn_id'].'" alt="'.get_text($banner['bn_alt']).'"></a>';
}
} ?>
</div>
<?php } ?>
<div class="floating-ad right">
<?php if (!empty($right_banners)) {
foreach ($right_banners as $banner) {
$bimg = G5_DATA_PATH.'/banners/'.$banner['bn_id'];
if (file_exists($bimg)) {
echo '<a href="'.$banner['bn_url'].'" target="'.($banner['bn_new_win'] ? '_blank' : '_self').'" onclick="banner_click_count(this); return true;" data-banner-id="'.$banner['bn_id'].'"><img src="'.G5_DATA_URL.'/banners/'.$banner['bn_id'].'" alt="'.get_text($banner['bn_alt']).'"></a>';
}
}
} ?>
</div>
<?php
// 서브타이틀 관련 함수 (nav.skin.php의 split_menu_name에 의존하지 않는 독립 버전)
if (!function_exists('get_bo_table_from_url_regex')) {
function get_bo_table_from_url_regex($url) {
preg_match('/bo_table=([^&]+)/', $url, $board_matches);
$boadid = isset($board_matches[1]) ? trim($board_matches[1]) : '';
preg_match('/\?co_id=([^&]+)/', $url, $coid_matches);
$coid = isset($coid_matches[1]) ? trim($coid_matches[1]) : '';
return array($boadid, $coid);
}
}
// 메뉴명에서 한글 부분만 추출 (서브타이틀 표시용 독립 함수)
if (!function_exists('get_menu_name_ko')) {
function get_menu_name_ko($name) {
// split_menu_name이 이미 로드된 경우 활용, 아니면 직접 처리
if (function_exists('split_menu_name')) {
list($ko, $en) = split_menu_name($name);
return $ko;
}
// 한글 포함 여부 확인 후 한글 앞부분만 반환
if (preg_match('/^(.*?)[a-zA-Z]{2,}/u', $name, $m)) {
return trim($m[1]) ?: $name;
}
return $name;
}
}
if (!function_exists('get_sub_title')) {
function get_sub_title($bo_table, $coid) {
$menu_datas = get_menu_db(0, false);
foreach ($menu_datas as $row) {
if (empty($row['sub'])) continue;
foreach ($row['sub'] as $sub) {
list($board_id, $co_id) = get_bo_table_from_url_regex($sub['me_link']);
$name_ko = get_menu_name_ko($sub['me_name']);
if ($bo_table !== '' && $board_id === $bo_table) {
return $name_ko;
}
if ($coid !== '' && $co_id === $coid) {
return $name_ko;
}
}
}
return '';
}
}
if (!defined("_INDEX_")) {
// bo_table: common.php에서 이미 설정된 전역변수 우선 사용, 없으면 GET에서 읽기
$co_id = isset($_GET['co_id']) ? preg_replace('/[^a-z0-9_]/i', '', $_GET['co_id']) : '';
$bo_table_sub = '';
if (isset($bo_table) && $bo_table) {
// common.php에서 설정된 $bo_table 사용
$bo_table_sub = $bo_table;
} elseif (isset($_GET['bo_table'])) {
$bo_table_sub = preg_replace('/[^a-z0-9_]/i', '', $_GET['bo_table']);
}
$page_config_path = G5_THEME_PATH.'/skin/page/'.$co_id.'/config.php';
if ($co_id && file_exists($page_config_path)) {
include_once($page_config_path);
}
$sub_title_text = get_sub_title($bo_table_sub, $co_id);
echo '<div class="sub-page-visual">';
echo ' <div class="container" style="width:'.$rb_core['sub_width'].'px;">';
echo ' <h2 id="container_title">' . $sub_title_text . '</h2>';
echo ' </div>';
echo '</div>';
echo '<div class="sub-page-container" style="width:'.$rb_core['sub_width'].'px; margin: 0 auto;">';
}
?>