Alpha 6: Feed-level Pages (#21)

Reviewed-on: #21
This commit was merged in pull request #21.
This commit is contained in:
2024-05-23 23:04:41 +00:00
parent 93377ffa0e
commit 4fa4dcb831
14 changed files with 256 additions and 85 deletions

View File

@@ -514,4 +514,18 @@ class Feed {
return sizeof($errors) == 0 ? ['ok' => true] : ['error' => implode("\n", $errors)];
}
/**
* Retrieve a feed by its ID for the current user
*
* @param int $feedId The ID of the feed to retrieve
* @param SQLite3 $db A database connection to use to retrieve the feed
* @return array|bool The data for the feed if found, false if not found
*/
public static function retrieveById(int $feedId, SQLite3 $db): array|bool {
$query = $db->prepare('SELECT * FROM feed WHERE id = :id AND user_id = :user');
$query->bindValue(':id', $feedId);
$query->bindValue(':user', $_SESSION[Key::USER_ID]);
return ($result = $query->execute()) ? $result->fetchArray(SQLITE3_ASSOC) : false;
}
}