<?php
/*
 * http://www.g4mob.com
 */
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$begin_time = get_microtime();

if (!$g4['title'])
    $g4['title'] = $config['cf_title'];

// 쪽지를 받았나?
if ($member['mb_memo_call']) {
    $mb = get_member($member['mb_memo_call'], "mb_nick");
    sql_query(" update {$g4['member_table']} set mb_memo_call = '' where mb_id = '{$member['mb_id']}' ");

    alert($mb[mb_nick]."님으로부터 쪽지가 전달되었습니다.", $_SERVER['REQUEST_URI']);
}


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

// 자바스크립트에서 go(-1) 함수를 쓰면 폼값이 사라질때 해당 폼의 상단에 사용하면
// 캐쉬의 내용을 가져옴. 완전한지는 검증되지 않음
header("Content-Type: text/html; charset={$g4['charset']}");
$gmnow = gmdate("D, d M Y H:i:s") . " GMT";
header("Expires: 0"); // rfc2616 - Section 14.21
header("Last-Modified: " . $gmnow);
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: pre-check=0, post-check=0, max-age=0"); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0
?>
<!DOCTYPE html>
<html lang="ko">
    <head>
        <meta name="Author" content="g4mob.com"/>
        <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"/>
        
        <meta http-equiv="content-type" content="text/html; charset=<?php echo $g4['charset'] ?>"/>
        <title><?php echo $g4['title'] ?></title>
        
        <script type="text/javascript">
            // 자바스크립트에서 사용하는 전역변수 선언
            var g4_path      = "<?php echo $g4['path'] ?>";
            var g4m_path     = "<?php echo $g4['g4m_path'] ?>";
            var g4_bbs       = "<?php echo $g4['bbs'] ?>";
            var g4m_bbs      = "<?php echo $g4['g4m_bbs'] ?>";
            var g4_bbs_img   = "<?php echo $g4['bbs_img'] ?>";
            var g4_url       = "<?php echo $g4['url'] ?>";
            var g4_is_member = "<?php echo $is_member ?>";
            var g4_is_admin  = "<?php echo $is_admin ?>";
            var g4_bo_table  = "<?php echo isset($bo_table) ? $bo_table : ''; ?>";
            var g4_sca       = "<?php echo isset($sca) ? $sca : ''; ?>";
            var g4_charset   = "<?php echo $g4['charset'] ?>";
            var g4_cookie_domain = "<?php echo $g4['cookie_domain'] ?>";
            var g4_is_gecko  = navigator.userAgent.toLowerCase().indexOf("gecko") != -1;
            var g4_is_ie     = navigator.userAgent.toLowerCase().indexOf("msie") != -1;
            <?php if ($is_admin) {
                echo "var g4_admin = '{$g4['admin']}';";
            } ?>
        </script>
        <!-- site skin -->
        <link href="<?php echo "{$g4['g4m_site_skin']}/{$config['cf_m_site_skin']}" ?>/css/bootstrap.min.css" rel="stylesheet"/>
        <link href="<?php echo "{$g4['g4m_site_skin']}/{$config['cf_m_site_skin']}" ?>/css/default.css" rel="stylesheet"/>
        <link href='<?php echo $g4['g4m_path']?>/css/bootstrap3-dialog.css' rel='stylesheet'/>
        <link href='<?php echo $g4['g4m_path']?>/css/jquery.mmenu.css?v=3' rel='stylesheet'/>
        <script type="text/javascript" src="<?php echo $g4['g4m_path'] ?>/js/jquery-2.1.0.min.js"></script>
        <script type="text/javascript" src="<?php echo $g4['g4m_path'] ?>/js/bootstrap3-dialog.js"></script>
        <script type="text/javascript" src="<?php echo $g4['g4m_path'] ?>/js/jquery.mmenu.js?v=3"></script>
        <script type="text/javascript" src="<?php echo "{$g4['g4m_site_skin']}/{$config['cf_m_site_skin']}" ?>/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="<?php echo $g4['g4m_path'] ?>/js/common.js"></script>
        
        <script type="text/javascript">
            $(function(){
                //getRegID
                try{
                    var regId = window.android.getRegID();
                    //console.log(regId);
                    if(regId){
                        var insert_Path = './insert_regid.php?regID=' + regId;
                        $.get( insert_Path, function() {
                            console.log( "regID success" );
                        }).done(function() {
                            console.log( "regID second success" );
                        }).fail(function() {
                            console.log( "regID error" );
                        }).always(function() {
                            console.log( "regID finished" );
                        });
                    }

                }catch(err){
                    var regId = undefined;
                    console.log(err);
                }

            });

        </script>
        <script type="text/javascript">
            $(function(){
                $('.history-back').click(function(){
                    history.back();    
                });
                
            });
            var delay = (function(){
            var timer = 0;
            return function(callback, ms){
                clearTimeout (timer);
                timer = setTimeout(callback, ms);
                };
            })();

        $(function() {
            var pause = 50;

            $(window).resize(function() {
                delay(function() {
                    var width = $(window).width();
                    if( width >= 768) {
                        // code for tablet view
                        $('.side_menu li a').removeClass('btn btn-info').css({"display":"block"});;
                        $('.side_menu li').css({"float":""});
                        
                    } else if(width <= 767 ) {
                        // code for mobile landscape
                        $('.side_menu li').css({"float":"left"});
                        $('.side_menu li a').addClass('btn btn-info').css({"display":"inline-block"});
                        
                        
                    } else if( width <= 479 ) {
                        // code for mobile portrait
                        
                        
                    }
                }, pause );
            });

            $(window).resize();
        });
        </script>
    </head>
    <body>