Minahito
minah****@users*****
2007年 4月 25日 (水) 19:39:30 JST
Index: xoops2jp/html/include/functions.php diff -u xoops2jp/html/include/functions.php:1.2.8.19.2.10.2.1 xoops2jp/html/include/functions.php:1.2.8.19.2.10.2.2 --- xoops2jp/html/include/functions.php:1.2.8.19.2.10.2.1 Wed Apr 25 17:44:06 2007 +++ xoops2jp/html/include/functions.php Wed Apr 25 19:39:30 2007 @@ -1,5 +1,5 @@ <?php -// $Id: functions.php,v 1.2.8.19.2.10.2.1 2007/04/25 08:44:06 minahito Exp $ +// $Id: functions.php,v 1.2.8.19.2.10.2.2 2007/04/25 10:39:30 minahito Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -171,11 +171,9 @@ $timeoffset = $xoopsConfig['default_TZ']; } } - $usertimestamp = intval($time) + (intval($timeoffset) - $xoopsConfig['server_TZ'])*3600; - return $usertimestamp; -} - + return intval($time) + (intval($timeoffset) - $xoopsConfig['server_TZ'])*3600; +} /* * Function to display formatted times in user timezone @@ -184,6 +182,30 @@ { global $xoopsConfig, $xoopsUser; $usertimestamp = xoops_getUserTimestamp($time, $timeoffset); + return _formatTimeStamp($usertimestamp); +} + +/* + * Function to display formatted times in user timezone + */ +function formatTimestampGMT($time, $format="l", $timeoffset="") +{ + global $xoopsConfig, $xoopsUser; + + if ($timeoffset == '') { + if ($xoopsUser) { + $timeoffset = $xoopsUser->getVar("timezone_offset"); + } else { + $timeoffset = $xoopsConfig['default_TZ']; + } + } + + $usertimestamp = intval($time) + (intval($timeoffset))*3600; + return _formatTimeStamp($usertimestamp); +} + +function _formatTimeStamp($time, $format="l") +{ switch (strtolower($format)) { case 's': $datestring = _SHORTDATESTRING; @@ -208,7 +230,7 @@ } break; } - return ucfirst(date($datestring, $usertimestamp)); + return ucfirst(date($datestring, $time)); } /*