diff -r 53cff4b4a802 -r bde1974c263b web/wp-content/plugins/event-calendar/tz.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-content/plugins/event-calendar/tz.php Wed Feb 03 15:37:20 2010 +0000 @@ -0,0 +1,575 @@ +tz_disabled=true; + $ec3->tz=getenv('TZ'); + +else: + + // PHP4 safe mode OFF + function ec3_tz_push($tz) + { + $old_tz=getenv('TZ'); + putenv("TZ=$tz"); + return $old_tz; + } + function ec3_tz_pop($tz) + { + putenv("TZ=$tz"); + } + +endif; + + +/** Converts a WordPress timestamp to Unix time. */ +function ec3_to_time($timestamp) +{ + global $ec3; + // Parse $timestamp and extract the Unix time. + $old_tz=ec3_tz_push($ec3->tz); + $unix_time = strtotime($timestamp); + ec3_tz_pop($old_tz); + // Unix time is seconds since the epoch (in UTC). + return $unix_time; +} + +/** Converts a WordPress timestamp to UTC. */ +function ec3_to_utc($timestamp,$fmt='%Y%m%dT%H%M00Z') +{ + $result = gmstrftime($fmt,ec3_to_time($timestamp)); + return $result; +} + +/** Formats a Unix time as a time in the current timezone. */ +function ec3_strftime($format,$unix_time=0) +{ + global $ec3; + if(!$unix_time) + $unix_time=time(); + // Express the Unix time as a string for timezone $ec3->tz. + $old_tz=ec3_tz_push($ec3->tz); + $result = strftime($format,$unix_time); + ec3_tz_pop($old_tz); + return $result; +} + + +$ec3->today=ec3_strftime("%Y-%m-%d 00:00:00"); + + +/** Call from within a