Update of /cvsroot/tikiwiki/tiki/lib/wiki-plugins In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20921/lib/wiki-plugins Modified Files: wikiplugin_articles.php wikiplugin_events.php wikiplugin_lastmod.php wikiplugin_rss.php wikiplugin_tracker.php wikiplugin_vote.php Log Message: [MOD] dates and timezones : Modify every call to php native date / timezone functions in order to use GMT timezone instead of the server timezone. Timestamps stored in the database should be stored in GMT timezone, because changing the server (or just its timezone settings) should never have an impact on tikiwiki. This is why every date(), strftime() and mktime() calls are replaced by gmdate(), gmstrftime() and gmmktime(). Those functions will use GMT timestamps and not a timestamp that depends on the server TZ environment variable. !! Note that everything has not been fully tested yet and that this update lacks of an upgrade path for existing calendars and timezones stored in database with a server timezone. Index: wikiplugin_articles.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/lib/wiki-plugins/wikiplugin_articles.php,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- wikiplugin_articles.php 17 Jan 2007 15:22:36 -0000 1.23 +++ wikiplugin_articles.php 3 Feb 2007 20:47:37 -0000 1.24 @@ -48,7 +48,7 @@ if (!isset($lang)) $lang = ''; - $now = date("U"); + $now = gmdate("U"); include_once("lib/commentslib.php"); $commentslib = new Comments($dbTiki); Index: wikiplugin_events.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/lib/wiki-plugins/wikiplugin_events.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- wikiplugin_events.php 21 Nov 2006 04:48:23 -0000 1.2 +++ wikiplugin_events.php 3 Feb 2007 20:47:37 -0000 1.3 @@ -74,11 +74,11 @@ $repl .= '<tr class="heading"><td colspan="2">'.tra("Upcoming events").'</td></tr>'; for ($j = 0; $j < $max; $j++) { if ($datetime!=1) { - $eventStart=str_replace(" "," ",strftime($tikilib->get_short_date_format(),$events[$j]["start"])); - $eventEnd=str_replace(" "," ",strftime($tikilib->get_short_date_format(),$events[$j]["end"])); + $eventStart=str_replace(" "," ",gmstrftime($tikilib->get_short_date_format(),$events[$j]["start"])); + $eventEnd=str_replace(" "," ",gmstrftime($tikilib->get_short_date_format(),$events[$j]["end"])); } else { - $eventStart=str_replace(" "," ",strftime($tikilib->get_short_datetime_format(),$events[$j]["start"])); - $eventEnd=str_replace(" "," ",strftime($tikilib->get_short_datetime_format(),$events[$j]["end"])); + $eventStart=str_replace(" "," ",gmstrftime($tikilib->get_short_datetime_format(),$events[$j]["start"])); + $eventEnd=str_replace(" "," ",gmstrftime($tikilib->get_short_datetime_format(),$events[$j]["end"])); } if ($j%2) { $style="odd"; Index: wikiplugin_lastmod.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/lib/wiki-plugins/wikiplugin_lastmod.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- wikiplugin_lastmod.php 31 Dec 2006 20:18:03 -0000 1.1 +++ wikiplugin_lastmod.php 3 Feb 2007 20:47:37 -0000 1.2 @@ -23,7 +23,7 @@ } - $lastmod = date( "r", $tikilib->page_exists_modtime($page) ); + $lastmod = gmdate( "r", $tikilib->page_exists_modtime($page) ); return $lastmod; Index: wikiplugin_rss.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/lib/wiki-plugins/wikiplugin_rss.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- wikiplugin_rss.php 11 Dec 2006 00:41:08 -0000 1.5 +++ wikiplugin_rss.php 3 Feb 2007 20:47:37 -0000 1.6 @@ -44,7 +44,7 @@ if (!isset($desc)) { $desc=0; } if (!isset($author)) { $author=0; } - $now = date("U"); + $now = gmdate("U"); $ids=explode(":",$id); Index: wikiplugin_tracker.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/lib/wiki-plugins/wikiplugin_tracker.php,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- wikiplugin_tracker.php 9 Jan 2007 17:17:08 -0000 1.54 +++ wikiplugin_tracker.php 3 Feb 2007 20:47:37 -0000 1.55 @@ -62,7 +62,7 @@ global $notificationlib; include_once('lib/notifications/notificationlib.php'); $tracker = array_merge($tracker,$trklib->get_tracker_options($trackerId)); - if ((!empty($tracker['start']) && date('U') < $tracker['start']) || (!empty($tracker['end']) && date('U') > $tracker['end'])) + if ((!empty($tracker['start']) && gmdate('U') < $tracker['start']) || (!empty($tracker['end']) && date('U') > $tracker['end'])) return; $flds = $trklib->list_tracker_fields($trackerId,0,-1,"position_asc",""); $back = ''; Index: wikiplugin_vote.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/lib/wiki-plugins/wikiplugin_vote.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- wikiplugin_vote.php 10 Nov 2006 15:22:27 -0000 1.8 +++ wikiplugin_vote.php 3 Feb 2007 20:47:37 -0000 1.9 @@ -47,7 +47,7 @@ $options = $trklib->get_tracker_options($trackerId); if (!empty($options['start']) || !empty($options['end'])) $smarty->assign_by_ref('options', $options); - if ((!empty($options['start']) && date('U') < $options['start']) || (!empty($options['end']) && date('U') > $options['end'])) { + if ((!empty($options['start']) && gmdate('U') < $options['start']) || (!empty($options['end']) && date('U') > $options['end'])) { $smarty->assign('p_create_tracker_items', 'n'); $smarty->assign('vote', ''); } else { @@ -67,7 +67,7 @@ if (!empty($options['start']) || !empty($options['end'])) $smarty->assign_by_ref('options', $options); } - if (!empty($options['end']) && date('U') < $options['end']) + if (!empty($options['end']) && gmdate('U') < $options['end']) $show_stat = 'n'; } if ($show_stat == 'y') { @@ -80,7 +80,7 @@ } else { $smarty->assign('stat', ''); } - $smarty->assign('date', date('U')); + $smarty->assign('date', gmdate('U')); return $smarty->fetch('wiki-plugins/wikiplugin_vote.tpl'); } |