summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-11-07 18:14:48 +0300
committerAndrew Dolgov <[email protected]>2010-11-07 18:14:48 +0300
commit324944f3329b99e527f12c65e4a0e1358e8f180a (patch)
tree37b098fa9a066e3dbb0d74584a571fabb749e092 /modules
parentf3f67c1b53d2d93486fc3c57253b8af4d5e7a0c7 (diff)
implement per-user timezone support; store dates in UTC internally (closes #254)
Diffstat (limited to 'modules')
-rw-r--r--modules/pref-feeds.php10
-rw-r--r--modules/pref-prefs.php8
-rw-r--r--modules/pref-users.php22
3 files changed, 15 insertions, 25 deletions
diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php
index b10679776..376980ce3 100644
--- a/modules/pref-feeds.php
+++ b/modules/pref-feeds.php
@@ -1326,22 +1326,16 @@
if (!$last_updated) {
$last_updated = "&mdash;";
- } else if (get_pref($link, 'HEADLINES_SMART_DATE')) {
- $last_updated = smart_date_time(strtotime($last_updated));
} else {
- $short_date = get_pref($link, 'SHORT_DATE_FORMAT');
- $last_updated = date($short_date, strtotime($last_updated));
+ $last_updated = make_local_datetime($link, $last_updated, false);
}
$last_article = $line["last_article"];
if (!$last_article) {
$last_article = "&mdash;";
- } else if (get_pref($link, 'HEADLINES_SMART_DATE')) {
- $last_article = smart_date_time(strtotime($last_article));
} else {
- $short_date = get_pref($link, 'SHORT_DATE_FORMAT');
- $last_article = date($short_date, strtotime($last_article));
+ $last_article = make_local_datetime($link, $last_article, false);
}
if (get_pref($link, 'ENABLE_FEED_CATS') && $cur_cat_id != $cat_id) {
diff --git a/modules/pref-prefs.php b/modules/pref-prefs.php
index 5105f3573..f5671a995 100644
--- a/modules/pref-prefs.php
+++ b/modules/pref-prefs.php
@@ -370,7 +370,13 @@
print "<td class=\"prefValue\">";
- if ($pref_name == "DEFAULT_UPDATE_INTERVAL") {
+ if ($pref_name == "USER_TIMEZONE") {
+
+ $timezones = explode("\n", file_get_contents("lib/timezones.txt"));
+
+ print_select($pref_name, $value, $timezones);
+
+ } else if ($pref_name == "DEFAULT_UPDATE_INTERVAL") {
global $update_intervals_nodefault;
diff --git a/modules/pref-users.php b/modules/pref-users.php
index 57be9b895..7321f19d4 100644
--- a/modules/pref-users.php
+++ b/modules/pref-users.php
@@ -38,11 +38,11 @@
print "<table width='100%'>";
- $last_login = date(get_pref($link, 'LONG_DATE_FORMAT'),
- strtotime(db_fetch_result($result, 0, "last_login")));
+ $last_login = make_local_datetime($link,
+ db_fetch_result($result, 0, "last_login"));
- $created = date(get_pref($link, 'LONG_DATE_FORMAT'),
- strtotime(db_fetch_result($result, 0, "created")));
+ $created = make_local_datetime($link,
+ db_fetch_result($result, 0, "created"));
$access_level = db_fetch_result($result, 0, "access_level");
$stored_articles = db_fetch_result($result, 0, "stored_articles");
@@ -448,18 +448,8 @@
$line["login"] = htmlspecialchars($line["login"]);
-# $line["last_login"] = date(get_pref($link, 'SHORT_DATE_FORMAT'),
-# strtotime($line["last_login"]));
-
- if (get_pref($link, 'HEADLINES_SMART_DATE')) {
- $line["last_login"] = smart_date_time(strtotime($line["last_login"]));
- $line["created"] = smart_date_time(strtotime($line["created"]));
- } else {
- $line["last_login"] = date(get_pref($link, 'SHORT_DATE_FORMAT'),
- strtotime($line["last_login"]));
- $line["created"] = date(get_pref($link, 'SHORT_DATE_FORMAT'),
- strtotime($line["created"]));
- }
+ $line["created"] = make_local_datetime($link, $line["created"], false);
+ $line["last_login"] = make_local_datetime($link, $line["last_login"], false);
print "<td align='center'><input onclick='toggleSelectPrefRow(this, \"user\");'
type=\"checkbox\" id=\"UMCHK-$uid\"></td>";