Update

getMessage()); } $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; // Invalid id if ($id === 0) { header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request'); // TODO: Better error message echo 'Invalid id'; return; } // FIXME: This works, but filtering by WHERE before JOIN might be better $sql = 'SELECT event.id, title, content, published, foreign_url, object_type, object_verb, subscription.type FROM event ' . 'INNER JOIN subscription ON event.subscription_id = subscription.id ' . 'WHERE event.id = ' . $id; $res = $dbh->query($sql); $row = $res->fetch(PDO::FETCH_ASSOC); $datePublished = new DateTime(); $tz = new DateTimeZone("America/Toronto"); $utc = new DateTimeZone("UTC"); if ($row) { $datePublished->setTimeZone($utc); $datePublished->modify(str_replace(' ', 'T', $row['published']) . '+00:00'); $datePublished->setTimeZone($tz); $html = '
' . '
' . '
' . '
'; $html .= $row['title']; $html .= '
'; if ($row['type'] === 'webmention') { $html .= $row['content']; } else { $html .= '
' . $row['content'] . '
'; } $html .= ''; $html .= '
'; } echo $html; ?>