|
From: Florin C B. <ory...@us...> - 2013-06-16 01:10:17
|
Update of /cvsroot/mxbb/core/includes/shared/phpbb2/includes In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29054/shared/phpbb2/includes Modified Files: functions.php Log Message: Index: functions.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb2/includes/functions.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** functions.php 31 Oct 2008 18:54:43 -0000 1.6 --- functions.php 16 Jun 2013 01:10:14 -0000 1.7 *************** *** 538,560 **** return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]); } ! // ! // Create date/time from format and timezone ! // ! public static function create_date($format, $gmepoch, $tz) { ! global $board_config, $lang; static $translate; ! if ( empty($translate) && $board_config['default_lang'] != 'english' ) { @reset($lang['datetime']); ! while ( list($match, $replace) = @each($lang['datetime']) ) { ! $translate[$match] = $replace; } } ! ! return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz)); } --- 538,605 ---- return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]); } + + /* + * Get DST + */ + public function get_dst($gmepoch, $tz = 0, $time_mode = 0) + { + global $board_config, $mx_user; ! $tz = empty($tz) ? $board_config['board_timezone'] : $tz; ! $dst_time_lag = isset($mx_user->data['user_dst']) ? $mx_user->data['user_dst'] : $tz; ! ! switch ($time_mode) ! { ! case 2: ! //MANUAL_DST ! $dst_sec = $dst_time_lag * 60; ! break; ! case 1: ! //SERVER_SWITCH ! $dst_sec = gmdate('I', $gmepoch + (3600 * $tz)) * $dst_time_lag * 60; ! //$dst_sec = @date('I', $gmepoch) * $dst_time_lag * 60; ! break; ! default: ! $dst_sec = (isset($mx_user->timezone) && isset($mx_user->dst)) ? (int) $mx_user->timezone + (int) $mx_user->dst : 0; ! break; ! } ! return $dst_sec; ! } ! ! /* ! * Create date/time using the specified format and timezone ! */ ! public static function create_date($format, $gmepoch, $tz = 0) { ! global $board_config, $mx_user, $lang; static $translate; ! $tz = empty($tz) ? $board_config['board_timezone'] : $tz; ! // We need to force this ==> isset($lang['datetime']) <== otherwise we may have $lang initialized and we don't want that... ! if (empty($translate) && ($board_config['default_lang'] != 'english') && isset($lang['datetime'])) { + $use_short_names = false; + if (((strpos($format, '\M') === false) && (strpos($format, 'M') !== false)) || ((strpos($format, '\r') === false) && (strpos($format, 'r') !== false))) + { + $use_short_names = true; + } @reset($lang['datetime']); ! while (list($match, $replace) = @each($lang['datetime'])) { ! $var_name = $match; ! if ((strpos($match, '_short') !== false) && $use_short_names) ! { ! $var_name = str_replace('_short', '', $match); ! } ! $translate[$var_name] = $replace; } } ! $tz = empty($tz) ? $board_config['board_timezone'] : $tz; ! $dst_time_lag = isset($mx_user->data['user_dst']) ? $mx_user->data['user_dst'] : $tz; ! $dst_sec = (isset($mx_user->timezone) && isset($mx_user->dst)) ? (int) $mx_user->timezone + (int) $mx_user->dst : $dst_time_lag * 60; ! //$dst_sec = self::get_dst($gmepoch, $tz); ! $date = @gmdate($format, $gmepoch + (3600 * $tz) + $dst_sec); ! $date = (is_array($translate) ? @strtr($date, $translate) : $date); ! return $date; } |