<?php 
include_once('./_common.php');
/*
    그누보드5 자동 업데이트 체킹 기능
    제작자 : SIR (익명닉네임)
    작동 방식 : 그누보드5 github 파싱해서 버전 체크를 해서 업데이트를 건유 하는 기능입니다.
*/
define('G5_VER_URL', 'https://github.com/gnuboard/gnuboard5/blob/master/config.php');

// 그누보드 5 버전 체크
$g5_text = file_get_contents(G5_VER_URL);

$g5_temp = @explode('<td id="LC8" class="blob-code blob-code-inner js-file-line">', $g5_text);
$g5_temp = @explode('</td>', $g5_temp[1]);

$g5_text = $g5_temp[0];
define('G5_VER', substr($g5_text, 215, 6));

//그누보드 5 버전 HTML 체크
if($is_admin && G5_GNUBOARD_VER != G5_VER){
  echo '<style>
.fixed-container {
    position: fixed;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: 30px;
    min-height: 30px;
    max-height: 30px;
    bottom: 0;
    left: 0;
    text-align: center;
    color: #ffffff;
    background-color: rgba(38, 42, 130, 0.7);
    z-index: 9999;
    padding: 20px 0;
}
.fixed-container a {
    color: #fff;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
    $(".fixed-container").click(function() {
        $(".fixed-container").css("display", "none");
    });
});
</script>';
  echo '<div class="fixed-container">현재 홈페이지의 그누보드5 버전은 '.G5_GNUBOARD_VER.' 입니다.<br>새로운 버전 '.G5_VER.' 이 나왔습니다. <a href="http://sir.co.kr/g5_pds">그누보드5 다운로드</a></div>';
}
?>