feed-reader-central/src/start.php

48 lines
1.0 KiB
PHP
Raw Normal View History

2024-04-04 23:15:58 +00:00
<?php
spl_autoload_register(function ($class) {
$file = implode(DIRECTORY_SEPARATOR, [ __DIR__, 'lib', "$class.php" ]);
if (file_exists($file)) {
require $file;
return true;
}
return false;
});
2024-04-04 23:15:58 +00:00
require 'user-config.php';
2024-04-04 23:15:58 +00:00
Data::ensureDb();
/**
* Render the page title
* @param string $title The title of the page being displayed
*/
function page_head(string $title): void {
?><!DOCTYPE html>
<html lang="en">
<head>
<title><?=$title?> | Feed Reader Central</title>
2024-04-06 15:02:48 +00:00
<link href=/assets/style.css rel=stylesheet>
</head>
2024-04-06 15:02:48 +00:00
<body>
<header>
<div class=title>Feed Reader Central</div>
<div><?php
if (array_key_exists('FRC_USER_ID', $_REQUEST)) {
echo '<a href=/feed?id=new>Add Feed</a>';
if ($_REQUEST['FRC_USER_EMAIL'] != 'solouser@example.com') {
echo " | {$_REQUEST['FRC_USER_EMAIL']}";
}
} ?>
</div>
</header>
<main hx-target=this>
<?php
}
/**
* Render the end of the page
*/
function page_foot(): void {
2024-04-06 15:02:48 +00:00
?></main></body></html><?php
}