From e58f003bbe6d3cc6bf9cdedc8ce4f5b588163927 Mon Sep 17 00:00:00 2001 From: gnuboard Date: Fri, 18 Jan 2013 12:18:06 +0900 Subject: [PATCH] =?UTF-8?q?PC,=20=EB=AA=A8=EB=B0=94=EC=9D=BC=20=EB=B2=84?= =?UTF-8?q?=EC=A0=84=20=EB=B3=80=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/memo.php | 9 ------ common.php | 74 +++++++++++++++++++++++++++++++--------------- head.sub.php | 9 ------ lib/common.lib.php | 6 ++++ mobile.tail.php | 2 ++ tail.php | 6 ++++ 6 files changed, 64 insertions(+), 42 deletions(-) diff --git a/bbs/memo.php b/bbs/memo.php index 43e624614..992de7c9b 100644 --- a/bbs/memo.php +++ b/bbs/memo.php @@ -1,12 +1,7 @@ >>>>>> fca2c7be504cccbd5466136a893f3d3ed875554c alert_close('회원만 이용하실 수 있습니다.'); $g4['title'] = '내 쪽지함'; @@ -81,10 +76,6 @@ for ($i=0; $row=sql_fetch_array($result); $i++) echo ''; -<<<<<<< HEAD -======= -$member_skin_path = $g4['path'].'/skin/member/'.$config['cf_member_skin']; ->>>>>>> fca2c7be504cccbd5466136a893f3d3ed875554c include_once($member_skin_path.'/memo.skin.php'); include_once($g4['path'].'/tail.sub.php'); diff --git a/common.php b/common.php index 94af99ba3..c314e5d5b 100644 --- a/common.php +++ b/common.php @@ -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(); + +//============================================================================== +// 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 방지를 위해 코드를 작성했으나 효과가 없어 주석처리 함 -if (strpos($_SERVER[PHP_SELF], $g4['admin']) === false) - set_session("ss_admin", false); +$_SESSION['ss_is_mobile'] = false; +if (get_cookie('ck_is_mobile')) + $_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 가 틀리면 로그아웃한다. if (isset($_REQUEST['PHPSESSID']) && $_REQUEST['PHPSESSID'] != session_id()) @@ -529,4 +545,14 @@ while ($entry = $tmp->read()) { if (preg_match("/(\.php)$/i", $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 ?> \ No newline at end of file diff --git a/head.sub.php b/head.sub.php index 825ed01ca..252c16b06 100644 --- a/head.sub.php +++ b/head.sub.php @@ -27,15 +27,6 @@ if (!$lo_location) $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 /* // 만료된 페이지로 사용하시는 경우 header("Cache-Control: no-cache"); // HTTP/1.1 diff --git a/lib/common.lib.php b/lib/common.lib.php index 3cebf49eb..014003f40 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -1661,4 +1661,10 @@ function skin_path() if (G4_IS_MOBILE) $skin_path = $g4['mobile_path'].'/'.$skin_dir; return $skin_path; } + + +function is_mobile() +{ + return preg_match('/'.G4_MOBILE_AGENT.'/i', $_SERVER['HTTP_USER_AGENT']); +} ?> \ No newline at end of file diff --git a/mobile.tail.php b/mobile.tail.php index 5545b25b7..4d591082b 100644 --- a/mobile.tail.php +++ b/mobile.tail.php @@ -6,4 +6,6 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

Page Footer

+ PC버전 + diff --git a/tail.php b/tail.php index a19e30f22..251881de7 100644 --- a/tail.php +++ b/tail.php @@ -14,6 +14,12 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

Copyright © 소유하신 도메인. All rights reserved.

+모바일 버전으로"; +} +?> +