]> git.wh0rd.org Git - tt-rss.git/commitdiff
use local TZ in digest header
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 31 Jan 2012 12:37:00 +0000 (16:37 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 31 Jan 2012 12:37:00 +0000 (16:37 +0400)
include/functions.php

index aaca70dae5c7ba9e76ce9f798ad2f8d3471a6eac..f188fc10a8be7495fe611411aaf65b69483f2cfe 100644 (file)
 
                                        $do_catchup = get_pref($link, 'DIGEST_CATCHUP', $line['id'], false);
 
+                                       global $tz_offset;
+
+                                       // reset tz_offset global to prevent tz cache clash between users
+                                       $tz_offset = -1;
+
                                        $tuple = prepare_headlines_digest($link, $line["id"], 1, $limit);
                                        $digest = $tuple[0];
                                        $headlines_count = $tuple[1];
                $tpl->readTemplateFromFile("templates/digest_template_html.txt");
                $tpl_t->readTemplateFromFile("templates/digest_template.txt");
 
-               $tpl->setVariable('CUR_DATE', date('Y/m/d'));
-               $tpl->setVariable('CUR_TIME', date('G:i'));
+               $user_tz_string = get_pref($link, 'USER_TIMEZONE', $user_id);
+               $local_ts = convert_timestamp(time(), 'UTC', $user_tz_string);
+
+               $tpl->setVariable('CUR_DATE', date('Y/m/d', $local_ts));
+               $tpl->setVariable('CUR_TIME', date('G:i', $local_ts));
 
-               $tpl_t->setVariable('CUR_DATE', date('Y/m/d'));
-               $tpl_t->setVariable('CUR_TIME', date('G:i'));
+               $tpl_t->setVariable('CUR_DATE', date('Y/m/d', $local_ts));
+               $tpl_t->setVariable('CUR_TIME', date('G:i', $local_ts));
 
                $affected_ids = array();