Add user set timezones

Currently, aurweb displays all dates and times in UTC time. This patch
adds a capability for each logged in user to set their preferred
timezone.

Implements FS#48729.

Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Mark Weiman 2017-01-20 01:16:39 -05:00 committed by Lukas Fleischer
parent 087b539cbc
commit 608c483090
19 changed files with 130 additions and 23 deletions

View file

@ -126,6 +126,21 @@
print "<option value=\"".$code."\"> ".$lang."</option>"."\n";
}
}
?>
</select>
</p>
<p>
<label for="id_timezone"><?= __("Timezone") ?></label>
<select name="TZ" id="id_timezone">
<?php
$timezones = generate_timezone_list();
while (list($key, $val) = each($timezones)) {
if ($TZ == $key) {
print "<option value=\"".$key."\" selected=\"selected\"> ".$val."</option>\n";
} else {
print "<option value=\"".$key."\"> ".$val."</option>\n";
}
}
?>
</select>
</p>

View file

@ -5,7 +5,7 @@
<?= __('%s%s%s flagged %s%s%s out-of-date on %s%s%s for the following reason:',
'<strong>', html_format_username($message['Username']), '</strong>',
'<strong>', htmlspecialchars($pkgbase_name), '</strong>',
'<strong>', gmdate('Y-m-d', $message['OutOfDateTS']), '</strong>'); ?>
'<strong>', date('Y-m-d', $message['OutOfDateTS']), '</strong>'); ?>
<?php else: ?>
<?= __('%s%s%s is not flagged out-of-date.',
'<strong>', htmlspecialchars($pkgbase_name), '</strong>'); ?>

View file

@ -17,7 +17,7 @@ if (!isset($count)) {
<?php while (list($indx, $row) = each($comments)): ?>
<?php
$date_fmtd = gmdate('Y-m-d H:i', $row['CommentTS']);
$date_fmtd = date('Y-m-d H:i', $row['CommentTS']);
if ($row['UserName']) {
$user_fmtd = html_format_username($row['UserName']);
$heading = __('%s commented on %s', $user_fmtd, $date_fmtd);
@ -30,7 +30,7 @@ if (!isset($count)) {
$is_pinned = $row['PinnedTS'];
if ($uid && $is_deleted) {
$date_fmtd = gmdate('Y-m-d H:i', $row['DelTS']);
$date_fmtd = date('Y-m-d H:i', $row['DelTS']);
$heading .= ' <span class="edited">(';
if ($row['DelUserName']) {
$user_fmtd = html_format_username($row['DelUserName']);
@ -40,7 +40,7 @@ if (!isset($count)) {
}
$heading .= ')</span>';
} elseif ($uid && $is_edited) {
$date_fmtd = gmdate('Y-m-d H:i', $row['EditedTS']);
$date_fmtd = date('Y-m-d H:i', $row['EditedTS']);
$heading .= ' <span class="edited">(';
if ($row['EditUserName']) {
$user_fmtd = html_format_username($row['EditUserName']);

View file

@ -34,9 +34,9 @@ $msg = __('unknown');
$license = empty($row['License']) ? $msg : $row['License'];
# Print the timestamps for last updates
$updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["ModifiedTS"]));
$submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["SubmittedTS"]));
$out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"]));
$updated_time = ($row["ModifiedTS"] == 0) ? $msg : date("Y-m-d H:i", intval($row["ModifiedTS"]));
$submitted_time = ($row["SubmittedTS"] == 0) ? $msg : date("Y-m-d H:i", intval($row["SubmittedTS"]));
$out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : date("Y-m-d", intval($row["OutOfDateTS"]));
$lics = pkg_licenses($row["ID"]);
$grps = pkg_groups($row["ID"]);

View file

@ -31,9 +31,9 @@ $popularity = $row['Popularity'];
$msg = __('unknown');
# Print the timestamps for last updates
$updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["ModifiedTS"]));
$submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["SubmittedTS"]));
$out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"]));
$updated_time = ($row["ModifiedTS"] == 0) ? $msg : date("Y-m-d H:i", intval($row["ModifiedTS"]));
$submitted_time = ($row["SubmittedTS"] == 0) ? $msg : date("Y-m-d H:i", intval($row["SubmittedTS"]));
$out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : date("Y-m-d", intval($row["OutOfDateTS"]));
$pkgs = pkgbase_get_pkgnames($base_id);

View file

@ -67,7 +67,7 @@
<td>
<a href="<?= get_uri('/account/') . htmlspecialchars($row['User'], ENT_QUOTES) ?>" title="<?= __('View account information for %s', htmlspecialchars($row['User'])) ?>"><?= htmlspecialchars($row['User']) ?></a>
</td>
<td<?php if ($due): ?> class="flagged"<?php endif; ?>><?= gmdate("Y-m-d H:i", intval($row['RequestTS'])) ?></td>
<td<?php if ($due): ?> class="flagged"<?php endif; ?>><?= date("Y-m-d H:i", intval($row['RequestTS'])) ?></td>
<?php if ($row['Open']): ?>
<td>
<?php if ($row['BaseID']): ?>

View file

@ -10,7 +10,7 @@
<a href="<?= get_pkg_uri($row["Name"]); ?>" title="<?= htmlspecialchars($row["Name"]) . ' ' . htmlspecialchars($row["Version"]); ?>"><?= htmlspecialchars($row["Name"]) . ' ' . htmlspecialchars($row["Version"]); ?></a>
</td>
<td class="pkg-date">
<span><?= gmdate("Y-m-d H:i", intval($row["ModifiedTS"])); ?></span>
<span><?= date("Y-m-d H:i", intval($row["ModifiedTS"])); ?></span>
</td>
</tr>
<?php endforeach; ?>

View file

@ -39,10 +39,10 @@ if ($yes > $active_tus / 2) {
<?php endif; ?>
</strong>
<br />
<?= __("Submitted: %s by %s", gmdate("Y-m-d H:i", $row['Submitted']), html_format_username(username_from_id($row['SubmitterID']))) ?>
<?= __("Submitted: %s by %s", date("Y-m-d H:i", $row['Submitted']), html_format_username(username_from_id($row['SubmitterID']))) ?>
<br />
<?= __("End") ?>:
<strong><?= gmdate("Y-m-d H:i", $row['End']) ?></strong>
<strong><?= date("Y-m-d H:i", $row['End']) ?></strong>
<?php if ($isrunning == 0): ?>
<br />
<?= __("Result") ?>:

View file

@ -38,8 +38,8 @@
<td><?php $row["Agenda"] = htmlspecialchars(substr($row["Agenda"], 0, $prev_Len)); ?>
<a href="<?= get_uri('/tu/'); ?>?id=<?= $row['ID'] ?>"><?= $row["Agenda"] ?></a>
</td>
<td><?= gmdate("Y-m-d", $row["Submitted"]) ?></td>
<td><?= gmdate("Y-m-d", $row["End"]) ?></td>
<td><?= date("Y-m-d", $row["Submitted"]) ?></td>
<td><?= date("Y-m-d", $row["End"]) ?></td>
<td>
<?php if (!empty($row['User'])): ?>
<a href="<?= get_uri('/packages/'); ?>?K=<?= $row['User'] ?>&amp;SeB=m"><?= $row['User'] ?></a>