<?php
// 이 파일은 새로운 파일 생성시 반드시 포함되어야 함
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

$g5_debug['php']['begin_time'] = $begin_time = get_microtime();

if (!isset($g5['title'])) {
    $g5['title'] = $config['cf_title'];
    $g5_head_title = $g5['title'];
}
else {
    // 상태바에 표시될 제목
    $g5_head_title = implode(' | ', array_filter(array($g5['title'], $config['cf_title'])));
}

$g5['title'] = strip_tags($g5['title']);
$g5_head_title = strip_tags($g5_head_title);

// 현재 접속자
// 게시판 제목에 ' 포함되면 오류 발생
$g5['lo_location'] = addslashes($g5['title']);
if (!$g5['lo_location'])
    $g5['lo_location'] = addslashes(clean_xss_tags($_SERVER['REQUEST_URI']));
$g5['lo_url'] = addslashes(clean_xss_tags($_SERVER['REQUEST_URI']));
if (strstr($g5['lo_url'], '/'.G5_ADMIN_DIR.'/') || $is_admin == 'super') $g5['lo_url'] = '';

/*
// 만료된 페이지로 사용하시는 경우
header("Cache-Control: no-cache"); // HTTP/1.1
header("Expires: 0"); // rfc2616 - Section 14.21
header("Pragma: no-cache"); // HTTP/1.0
*/
?>
<!doctype html>
<html lang="ko">
<head>
<base id="temporary-base" href="<?php echo G5_THEME_URL; ?>/temha/">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
 <meta name="format-detection" content="telephone=no" />
<?php
if($config['cf_add_meta'])
    echo $config['cf_add_meta'].PHP_EOL;
?>
<title><?php echo $g5_head_title; ?></title>
<!--[if lte IE 8]>
<script src="<?php echo G5_JS_URL ?>/html5.js"></script>
<![endif]-->
	<title><?php echo $g5_head_title; ?></title>

<link rel="icon" href="<?php echo G5_TEMHA_RESOUCES; ?>/images/favicon.ico" />
<link rel="stylesheet" href="<?php echo G5_TEMHA_RESOUCES; ?>/css/setting.css">
<link rel="stylesheet" href="<?php echo G5_TEMHA_RESOUCES; ?>/css/plugin.css">
<link rel="stylesheet" href="<?php echo G5_TEMHA_RESOUCES; ?>/css/templatehouse.css">
<link rel="stylesheet" href="<?php echo G5_TEMHA_RESOUCES; ?>/css/style.css">
<?php
$shop_css = '';
if (defined('_SHOP_')) $shop_css = '_shop';
echo '<link rel="stylesheet" href="'.run_replace('head_css_url', G5_THEME_CSS_URL.'/'.(G5_IS_MOBILE?'mobile':'default').$shop_css.'.css?ver='.G5_CSS_VER, G5_THEME_URL).'">'.PHP_EOL;
?>
<script>
// 자바스크립트에서 사용하는 전역변수 선언
var g5_url       = "<?php echo G5_URL ?>";
var g5_bbs_url   = "<?php echo G5_BBS_URL ?>";
var g5_is_member = "<?php echo isset($is_member)?$is_member:''; ?>";
var g5_is_admin  = "<?php echo isset($is_admin)?$is_admin:''; ?>";
var g5_is_mobile = "<?php echo G5_IS_MOBILE ?>";
var g5_bo_table  = "<?php echo isset($bo_table)?$bo_table:''; ?>";
var g5_sca       = "<?php echo isset($sca)?$sca:''; ?>";
var g5_editor    = "<?php echo ($config['cf_editor'] && $board['bo_use_dhtml_editor'])?$config['cf_editor']:''; ?>";
var g5_cookie_domain = "<?php echo G5_COOKIE_DOMAIN ?>";
<?php if(defined('G5_IS_ADMIN')) { ?>
var g5_admin_url = "<?php echo G5_ADMIN_URL; ?>";
<?php } ?>
</script>
<link rel="stylesheet" href="<?php echo G5_JS_URL ?>/remodal/remodal.css">
<link rel="stylesheet" href="<?php echo G5_JS_URL ?>/remodal/remodal-default-theme.css">
<script src="<?php echo G5_JS_URL ?>/jquery-1.12.4.min.js"></script>
<script src="<?php echo G5_JS_URL ?>/remodal/remodal.js"></script>
<script src="<?php echo G5_JS_URL ?>/common.js?ver=<?php echo G5_JS_VER; ?>"></script>
<script src="<?php echo G5_JS_URL ?>/wrest.js?ver=<?php echo G5_JS_VER; ?>"></script>
<script src="<?php echo G5_JS_URL ?>/placeholders.min.js"></script>
<link rel="stylesheet" href="<?php echo G5_JS_URL ?>/font-awesome/css/font-awesome.min.css">
<?php if (defined('_SHOP_')): ?>
<script src="<?php echo G5_THEME_URL; ?>/js/theme.shop.list.js?ver=2304171"></script>
<?php endif; ?>

<script>
document.addEventListener("DOMContentLoaded", function () {
  const imgBase = "<?php echo G5_THEME_URL; ?>/temha/";
  const isRelative = url => url && !/^(https?:|\/\/|data:)/.test(url) && !url.startsWith(imgBase);
  const clean = url => url.replace(/^(\.\/|\/)/, '');

  document.querySelectorAll("img, source").forEach(el => {
    // src 처리 (getAttribute 기준)
    const srcAttr = el.getAttribute("src");
    if (isRelative(srcAttr)) el.setAttribute("src", imgBase + clean(srcAttr));

    // srcset 처리
    const srcset = el.getAttribute("srcset");
    if (srcset) {
      const updated = srcset.split(',').map(item => {
        const [url, desc] = item.trim().split(/\s+/);
        return isRelative(url) ? imgBase + clean(url) + (desc ? ' ' + desc : '') : item.trim();
      }).join(', ');
      el.setAttribute("srcset", updated);
    }
  });
	 // base 태그 제거
 const base = document.getElementById('temporary-base');
if (base) base.remove();
});
</script>
<!--로그인 토글 스크립트-->
<script>
jQuery(function ($){
	$(".btn_member_mn").on("click", function() {
        $(".member_mn").toggle();
        $(".btn_member_mn").toggleClass("btn_member_mn_on");
    });    

});
</script>	
</head>


<body>
