Files
2026-06-11 18:47:38 +09:00

180 lines
7.5 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;
}
error_reporting(E_ALL);
ini_set("display_errors", 1);
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;
}
}
if (!empty($left_banners)) {
echo '<div class="floating-ad left">';
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>';
}
}
echo '</div>';
}
echo '<div class="floating-ad right">';
// 1. 배너 출력 (모바일이 아니고 데이터가 있을 때) (조건문 제거)
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>';
}
}
}
// 2. 💡 [추가] 문의하기 플로팅 버튼 (항상 출력)
echo '<a href="javascript:void(0);" class="floating-contact-btn btn-open-contact-modal open-contact-modal floating-contact-btn">
<span class="icon"><i class="fa fa-comments"></i></span>
<span class="text">문의하기</span>
</a>';
echo '</div>';
// 메뉴 데이터 가져오기 (그누보드 공통 함수 사용)
function split_menu_name_head($name) {
$ko = '';
$en = '';
// 1. 한글과 영문의 시작 위치 찾기
$pos_ko = -1;
$pos_en = -1;
if (preg_match('/[가-힣]/u', $name, $matches, PREG_OFFSET_CAPTURE)) {
$pos_ko = $matches[0][1];
}
if (preg_match('/[a-zA-Z]/', $name, $matches, PREG_OFFSET_CAPTURE)) {
$pos_en = $matches[0][1];
}
// 2. 위치에 따라 분리
if ($pos_ko !== -1 && $pos_en !== -1) {
if ($pos_ko < $pos_en) {
// 한글이 먼저 나오는 경우: 영문 시작 위치 기준으로 분리
// 예: "한글 12 English" -> ko="한글 12", en="English"
$ko = substr($name, 0, $pos_en);
$en = substr($name, $pos_en);
} else {
// 영문이 먼저 나오는 경우: 한글 시작 위치 기준으로 분리
// 예: "English 12 한글" -> en="English 12", ko="한글"
$en = substr($name, 0, $pos_ko);
$ko = substr($name, $pos_ko);
}
} elseif ($pos_ko !== -1) {
// 한글만 있는 경우
$ko = $name;
} elseif ($pos_en !== -1) {
// 영문만 있는 경우
$en = $name;
} else {
// 둘 다 없는 경우 (숫자 등) -> 한글 변수에 담음
$ko = $name;
}
return array(trim($ko), trim($en));
}
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);
}
function get_sub_title($bo_table,$coid)
{
$menu_datas = get_menu_db(0, false);
foreach ($menu_datas as $i=> $row) {
foreach ($row['sub'] as $sub) {
list($board_id,$co_id) = get_bo_table_from_url_regex($sub['me_link']);
list($sub_ko, $sub_en) = split_menu_name_head($sub['me_name']);
$menu_name = $sub_ko . '<br>'. $sub_en;
if(isset($bo_table) && $bo_table!='' && $board_id == $bo_table){
return $menu_name;
} else if(isset($coid) && $coid!='' && $co_id == $coid){
return $menu_name;
}
}
}
return '';
}
if (!defined("_INDEX_")) {
$co_id = isset($_GET['co_id']) ? preg_replace('/[^a-z0-9_]/i', '', $_GET['co_id']) : '';
$bo_table = isset($_GET['bo_table']) ? 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);
}
echo '<div class="sub-page-visual">';
echo ' <div class="container">';
echo ' <h2 id="container_title">'.get_sub_title($bo_table,$co_id).'</h2>';
echo ' </div>';
echo '</div>';
echo '<div class="sub-page-container container">';
}
?>