From 2cc6c3fd6fd474133addab97a67e360d92951a0c Mon Sep 17 00:00:00 2001 From: haneul Date: Sun, 30 Sep 2007 12:06:20 +0000 Subject: [PATCH] ticket:187 calander error fix. (when zbxe's timzone is different from server's timezone) git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2654 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- config/func.inc.php | 31 ++++++++++++++++++----------- widgets/calendar/calendar.class.php | 2 +- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/config/func.inc.php b/config/func.inc.php index 33a8e1640..2d42810ec 100644 --- a/config/func.inc.php +++ b/config/func.inc.php @@ -221,20 +221,27 @@ $month = (int)substr($str,4,2); $day = (int)substr($str,6,2); - $time_zone = $GLOBALS['_time_zone']; - if($time_zone<0) $to = -1; else $to = 1; - $t_hour = substr($time_zone,1,2)*$to; - $t_min = substr($time_zone,3,2)*$to; + if(strlen($str) < 8) + { + $gap = 0; + } + else + { + $time_zone = $GLOBALS['_time_zone']; + if($time_zone<0) $to = -1; else $to = 1; + $t_hour = substr($time_zone,1,2)*$to; + $t_min = substr($time_zone,3,2)*$to; - $server_time_zone = date("O"); - if($server_time_zone<0) $so = -1; else $so = 1; - $c_hour = substr($server_time_zone,1,2)*$so; - $c_min = substr($server_time_zone,3,2)*$so; + $server_time_zone = date("O"); + if($server_time_zone<0) $so = -1; else $so = 1; + $c_hour = substr($server_time_zone,1,2)*$so; + $c_min = substr($server_time_zone,3,2)*$so; - $g_min = $t_min - $c_min; - $g_hour = $t_hour - $c_hour; - - $gap = $g_min*60 + $g_hour*60*60; + $g_min = $t_min - $c_min; + $g_hour = $t_hour - $c_hour; + + $gap = $g_min*60 + $g_hour*60*60; + } return mktime($hour, $min, $sec, $month?$month:1, $day?$day:1, $year)+$gap; } diff --git a/widgets/calendar/calendar.class.php b/widgets/calendar/calendar.class.php index a3e5ce25b..cfb3b9c5f 100644 --- a/widgets/calendar/calendar.class.php +++ b/widgets/calendar/calendar.class.php @@ -26,7 +26,7 @@ $regdate = Context::get('search_keyword'); if($regdate) $obj->regdate = zdate($regdate, 'Ym'); } - if(!$obj->regdate) $obj->regdate = date('Ym'); + if(!$obj->regdate) $obj->regdate = date('YmdHis'); // document 모듈의 model 객체를 받아서 getDailyArchivedList() method를 실행 $oDocumentModel = &getModel('document');