First cut of item-with-feed and list impl

- Add strict types to all files
- Convert many queries to document commands
This commit is contained in:
2024-06-02 22:14:19 -04:00
parent b88ad1f268
commit 93dd8e880f
35 changed files with 309 additions and 319 deletions

View File

@@ -1,4 +1,5 @@
<?php
<?php declare(strict_types=1);
/**
* Add/Edit/Delete Feed Page
*
@@ -25,7 +26,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
Delete::byFields(Table::ITEM, [Field::EQ('feed_id', $feed->id)]);
Delete::byId(Table::FEED, $feed->id);
add_info('Feed &ldquo;' . htmlentities($feed->title) . '&rdquo; deleted successfully');
$db->close();
frc_redirect('/feeds');
} catch (DocumentException $ex) {
add_error("$ex");

View File

@@ -1,26 +1,24 @@
<?php
<?php declare(strict_types=1);
/**
* Feed Item List Page
*
* Lists items in a given feed (all, unread, or bookmarked)
*/
use BitBadger\Documents\SQLite\Configuration;
use FeedReaderCentral\Feed;
use FeedReaderCentral\ItemList;
use FeedReaderCentral\Security;
include '../../start.php';
Security::verifyUser();
FeedReaderCentral\Security::verifyUser();
if (!($feed = Feed::retrieveById($_GET['id']))) not_found();
$db = Configuration::dbConn();
$list = match (true) {
key_exists('unread', $_GET) => ItemList::unreadForFeed($feed->id, $db),
key_exists('bookmarked', $_GET) => ItemList::bookmarkedForFeed($feed->id, $db),
default => ItemList::allForFeed($feed->id, $db)
key_exists('unread', $_GET) => ItemList::unreadForFeed($feed->id),
key_exists('bookmarked', $_GET) => ItemList::bookmarkedForFeed($feed->id),
default => ItemList::allForFeed($feed->id)
};
page_head(($list->itemType != '' ? "$list->itemType Items | " : '') . strip_tags($feed['title']));
@@ -32,4 +30,3 @@ if ($list->itemType == '') {
}
$list->render();
page_foot();
$db->close();