Alpha 6: Feed-level Pages (#21)
Reviewed-on: #21
This commit was merged in pull request #21.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user