Add item read page (#7)
- Open items links in an external window - Include "Keep as New" button
This commit is contained in:
@@ -49,6 +49,7 @@ function page_head(string $title): void {
|
||||
?><!DOCTYPE html>
|
||||
<html lang=en>
|
||||
<head>
|
||||
<meta name=viewport content="width=device-width, initial-scale=1">
|
||||
<title><?=$title?> | Feed Reader Central</title>
|
||||
<link href=/assets/style.css rel=stylesheet>
|
||||
</head>
|
||||
@@ -79,3 +80,32 @@ function page_head(string $title): void {
|
||||
function page_foot(): void {
|
||||
?></main></body></html><?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect the user to the given URL
|
||||
*
|
||||
* @param string $value A local URL to which the user should be redirected
|
||||
*/
|
||||
function frc_redirect(string $value) {
|
||||
if (str_starts_with($value, 'http')) {
|
||||
http_response_code(400);
|
||||
die();
|
||||
}
|
||||
header("Location: $value");
|
||||
http_response_code(303);
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date/time string to a date/time in the configured format
|
||||
*
|
||||
* @param string $value The date/time string
|
||||
* @return string The standard format of a date/time, or '(invalid date)' if the date could not be parsed
|
||||
*/
|
||||
function date_time(string $value): string {
|
||||
try {
|
||||
return (new DateTimeImmutable($value))->format(DATE_TIME_FORMAT);
|
||||
} catch (Exception) {
|
||||
return '(invalid date)';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user