41 lines
1017 B
PHP
41 lines
1017 B
PHP
<?php declare(strict_types=1);
|
|
|
|
/**
|
|
* Home Page
|
|
*
|
|
* Displays a list of unread or bookmarked items for the current user
|
|
*/
|
|
|
|
use FeedReaderCentral\Feed;
|
|
use FeedReaderCentral\ItemList;
|
|
|
|
include '../start.php';
|
|
|
|
FeedReaderCentral\Security::verifyUser();
|
|
|
|
if (key_exists('refresh', $_GET)) {
|
|
$refreshResult = Feed::refreshAll();
|
|
if (key_exists('ok', $refreshResult)) {
|
|
add_info('All feeds refreshed successfully');
|
|
} else {
|
|
add_error(nl2br($refreshResult['error']));
|
|
}
|
|
}
|
|
//const PDO_DOC_DEBUG_SQL = true;
|
|
|
|
$list = match (true) {
|
|
key_exists('bookmarked', $_GET) => ItemList::allBookmarked(),
|
|
default => ItemList::allUnread()
|
|
};
|
|
$title = "Your $list->itemType Items";
|
|
|
|
page_head($title);
|
|
echo "<h1>$title";
|
|
if ($list->itemType == 'Unread') {
|
|
echo ' ' . hx_get('/?refresh', '(Refresh All Feeds)', 'class=refresh hx-indicator="closest h1"')
|
|
. '<span class=loading>Refreshing…</span>';
|
|
}
|
|
echo '</h1>';
|
|
$list->render();
|
|
page_foot();
|