PC, 모바일 버전 변환

This commit is contained in:
gnuboard
2013-01-18 12:18:06 +09:00
parent ad593d0060
commit e58f003bbe
6 changed files with 64 additions and 42 deletions

View File

@ -1,12 +1,7 @@
<? <?
include_once('./_common.php'); include_once('./_common.php');
<<<<<<< HEAD
if ($is_guest) if ($is_guest)
=======
if (!$member[mb_id])
>>>>>>> fca2c7be504cccbd5466136a893f3d3ed875554c
alert_close('회원만 이용하실 수 있습니다.'); alert_close('회원만 이용하실 수 있습니다.');
$g4['title'] = '내 쪽지함'; $g4['title'] = '내 쪽지함';
@ -81,10 +76,6 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
echo '<script src="'.$g4['path'].'/js/sideview.js"></script>'; echo '<script src="'.$g4['path'].'/js/sideview.js"></script>';
<<<<<<< HEAD
=======
$member_skin_path = $g4['path'].'/skin/member/'.$config['cf_member_skin'];
>>>>>>> fca2c7be504cccbd5466136a893f3d3ed875554c
include_once($member_skin_path.'/memo.skin.php'); include_once($member_skin_path.'/memo.skin.php');
include_once($g4['path'].'/tail.sub.php'); include_once($g4['path'].'/tail.sub.php');

View File

@ -233,27 +233,6 @@ else
//============================================================================== //==============================================================================
//==============================================================================
// Mobile 모바일 설정
// 쿠키에 저장된 값이 모바일이라면 브라우저 상관없이 모바일로 실행
// 그렇지 않다면 브라우저의 HTTP_USER_AGENT 에 따라 모바일 결정
// G4_MOBILE_AGENT : config.php 에서 선언
//------------------------------------------------------------------------------
$is_mobile = false;
if (get_cookie('is_mobile')) {
$is_mobile = true;
} else if (preg_match('/'.G4_MOBILE_AGENT.'/i', $_SERVER['HTTP_USER_AGENT'])) {
$is_mobile = true;
}
define('G4_IS_MOBILE', $is_mobile);
if (G4_IS_MOBILE) {
include_once($g4['path'].'/lib/mobile.lib.php'); // 모바일 전용 라이브러리
$g4['mobile_path'] = $g4['path'].'/'.$g4['mobile_dir'];
}
//==============================================================================
//============================================================================== //==============================================================================
// 공용 변수 // 공용 변수
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -271,11 +250,48 @@ ini_set("session.cookie_domain", $g4['cookie_domain']);
@session_start(); @session_start();
//==============================================================================
// Mobile 모바일 설정
// 쿠키에 저장된 값이 모바일이라면 브라우저 상관없이 모바일로 실행
// 그렇지 않다면 브라우저의 HTTP_USER_AGENT 에 따라 모바일 결정
// G4_MOBILE_AGENT : config.php 에서 선언
//------------------------------------------------------------------------------
$is_mobile = false;
if (isset($_REQUEST['pc']))
$is_mobile = false;
else if (isset($_REQUEST['mobile']))
$is_mobile = true;
else if (isset($_SESSION['ss_is_mobile']))
$is_mobile = $_SESSION['ss_is_mobile'];
else if (is_mobile())
$is_mobile = true;
$_SESSION['ss_is_mobile'] = $is_mobile;
define('G4_IS_MOBILE', $is_mobile);
if (G4_IS_MOBILE) {
include_once($g4['path'].'/lib/mobile.lib.php'); // 모바일 전용 라이브러리
$g4['mobile_path'] = $g4['path'].'/'.$g4['mobile_dir'];
}
/* /*
// 081022 : CSRF 방지를 위해 코드를 작성했으나 효과가 없어 주석처리 함 $_SESSION['ss_is_mobile'] = false;
if (strpos($_SERVER[PHP_SELF], $g4['admin']) === false) if (get_cookie('ck_is_mobile'))
set_session("ss_admin", false); $_SESSION['ss_is_mobile'] = false;
else if (isset($_REQUEST['pc']))
$_SESSION['ss_is_mobile'] = false;
else if (isset($_REQUEST['mobile']))
$_SESSION['ss_is_mobile'] = true;
else if (is_mobile())
$_SESSION['ss_is_mobile'] = true;
define('G4_IS_MOBILE', $_SESSION['ss_is_mobile']);
if (G4_IS_MOBILE) {
include_once($g4['path'].'/lib/mobile.lib.php'); // 모바일 전용 라이브러리
$g4['mobile_path'] = $g4['path'].'/'.$g4['mobile_dir'];
}
*/ */
//==============================================================================
// 4.00.03 : [보안관련] PHPSESSID 가 틀리면 로그아웃한다. // 4.00.03 : [보안관련] PHPSESSID 가 틀리면 로그아웃한다.
if (isset($_REQUEST['PHPSESSID']) && $_REQUEST['PHPSESSID'] != session_id()) if (isset($_REQUEST['PHPSESSID']) && $_REQUEST['PHPSESSID'] != session_id())
@ -529,4 +545,14 @@ while ($entry = $tmp->read()) {
if (preg_match("/(\.php)$/i", $entry)) if (preg_match("/(\.php)$/i", $entry))
include_once($g4['path'].'/extend/'.$entry); include_once($g4['path'].'/extend/'.$entry);
} }
// 자바스크립트에서 go(-1) 함수를 쓰면 폼값이 사라질때 해당 폼의 상단에 사용하면
// 캐쉬의 내용을 가져옴. 완전한지는 검증되지 않음
header("Content-Type: text/html; charset=utf-8");
$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
?> ?>

View File

@ -27,15 +27,6 @@ if (!$lo_location)
$lo_url = $_SERVER['REQUEST_URI']; $lo_url = $_SERVER['REQUEST_URI'];
if (strstr($lo_url, "/$g4[admin]/") || $is_admin == 'super') $lo_url = ''; 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
/* /*
// 만료된 페이지로 사용하시는 경우 // 만료된 페이지로 사용하시는 경우
header("Cache-Control: no-cache"); // HTTP/1.1 header("Cache-Control: no-cache"); // HTTP/1.1

View File

@ -1661,4 +1661,10 @@ function skin_path()
if (G4_IS_MOBILE) $skin_path = $g4['mobile_path'].'/'.$skin_dir; if (G4_IS_MOBILE) $skin_path = $g4['mobile_path'].'/'.$skin_dir;
return $skin_path; return $skin_path;
} }
function is_mobile()
{
return preg_match('/'.G4_MOBILE_AGENT.'/i', $_SERVER['HTTP_USER_AGENT']);
}
?> ?>

View File

@ -6,4 +6,6 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
<h4>Page Footer</h4> <h4>Page Footer</h4>
</div><!-- /footer --> </div><!-- /footer -->
<a href="<?=$g4['url']?>/?pc" data-ajax="false">PC버전</a>
</div><!-- /page --> </div><!-- /page -->

View File

@ -14,6 +14,12 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
<p>Copyright &copy; 소유하신 도메인. All rights reserved.</p> <p>Copyright &copy; 소유하신 도메인. All rights reserved.</p>
</footer> </footer>
<?
if (is_mobile()) {
echo "<a href=\"{$g4['url']}/?mobile\">모바일 버전으로</a>";
}
?>
<script> <script>
function fsearchbox_submit(f) function fsearchbox_submit(f)
{ {