* @license MIT */ declare(strict_types=1); use BitBadger\PDODocument\{Delete, DocumentException, Patch}; use FeedReaderCentral\{ItemWithFeed, Table}; include '../start.php'; FeedReaderCentral\Security::verifyUser(); $id = match (true) { key_exists('id', $_POST) => (int)$_POST['id'], key_exists('id', $_GET) => (int)$_GET['id'], default => -1, }; $from = match ($_SERVER['REQUEST_METHOD']) { 'POST' => $_POST['from'], default => $_GET['from'] ?? '/', }; switch ($_SERVER['REQUEST_METHOD']) { case 'POST': try { // "Keep as New" button sends a POST request to reset the is_read flag before going back to the item list if (ItemWithFeed::existsById($id)) { Patch::byId(Table::Item, $id, ['is_read' => 0]); } frc_redirect($from); } catch (DocumentException $ex) { add_error("$ex"); } break; case 'DELETE': try { if (ItemWithFeed::existsById($id)) Delete::byId(Table::Item, $id); } catch (DocumentException $ex) { add_error("$ex"); } frc_redirect($from); } $item = ItemWithFeed::retrieveById($id)->getOrCall(not_found(...)); try { Patch::byId(Table::Item, $id, ['is_read' => 1]); } catch (DocumentException $ex) { add_error("$ex"); } $published = date_time($item->published_on); $updated = isset($item->updated_on) ? date_time($item->updated_on) : null; $title = trim($item->title) === '' ? 'no title' : strip_tags($item->title); page_head(htmlentities("$item->title | {$item->feed->title}")); ?>


From feed->title)?>
Published published_on)?>
content)?>
>