We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit ea1676cb authored by Evan Prodromou's avatar Evan Prodromou

UTC only and tighter date format for showbookmark

parent 763a5f18
...@@ -75,13 +75,13 @@ class ShowbookmarkAction extends ShownoticeAction ...@@ -75,13 +75,13 @@ class ShowbookmarkAction extends ShownoticeAction
$this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE); $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
$crc32 = pack("H*", $this->trimmed('crc32')); sscanf($this->trimmed('crc32'), '%08x', $crc32);
if (empty($crc32)) { if (empty($crc32)) {
throw new ClientException(_('No such URL.'), 404); throw new ClientException(_('No such URL.'), 404);
} }
$dt = DateTime::createFromFormat(DateTime::W3C, $dt = DateTime::createFromFormat('YmdHis',
$this->trimmed('created'), $this->trimmed('created'),
new DateTimeZone('UTC')); new DateTimeZone('UTC'));
...@@ -90,10 +90,10 @@ class ShowbookmarkAction extends ShownoticeAction ...@@ -90,10 +90,10 @@ class ShowbookmarkAction extends ShownoticeAction
} }
$bookmarks = Bookmark::getByCRC32($this->profile, $bookmarks = Bookmark::getByCRC32($this->profile,
$this->crc32); $crc32);
foreach ($bookmarks as $bookmark) { foreach ($bookmarks as $bookmark) {
$bdt = new DateTime($bookmark->created); $bdt = new DateTime($bookmark->created, new DateTimeZone('UTC'));
if ($bdt->getTimestamp() == $dt->getTimestamp()) { if ($bdt->getTimestamp() == $dt->getTimestamp()) {
$this->bookmark = $bookmark; $this->bookmark = $bookmark;
break; break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment