Change to PDODocument library
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
* This will display a button which will either add or remove a bookmark for a given item.
|
||||
*/
|
||||
|
||||
use BitBadger\Documents\DocumentException;
|
||||
use BitBadger\Documents\SQLite\Patch;
|
||||
use BitBadger\PDODocument\DocumentException;
|
||||
use BitBadger\PDODocument\Patch;
|
||||
use FeedReaderCentral\ItemWithFeed;
|
||||
use FeedReaderCentral\Table;
|
||||
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
* Allows users to add, edit, and delete feeds
|
||||
*/
|
||||
|
||||
use BitBadger\Documents\DocumentException;
|
||||
use BitBadger\Documents\Field;
|
||||
use BitBadger\Documents\SQLite\Configuration;
|
||||
use BitBadger\Documents\SQLite\Delete;
|
||||
use BitBadger\PDODocument\Delete;
|
||||
use BitBadger\PDODocument\DocumentException;
|
||||
use BitBadger\PDODocument\Field;
|
||||
use FeedReaderCentral\Feed;
|
||||
use FeedReaderCentral\Security;
|
||||
use FeedReaderCentral\Table;
|
||||
@@ -32,21 +31,19 @@ if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
|
||||
}
|
||||
}
|
||||
|
||||
$db = Configuration::dbConn();
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
try {
|
||||
$isNew = $_POST['id'] == 'new';
|
||||
if ($isNew) {
|
||||
$result = Feed::add($_POST['url'], $db);
|
||||
$result = Feed::add($_POST['url']);
|
||||
} else {
|
||||
$toEdit = Feed::retrieveById($_POST['id']);
|
||||
$result = $toEdit
|
||||
? Feed::update($toEdit, $_POST['url'], $db)
|
||||
? Feed::update($toEdit, $_POST['url'])
|
||||
: ['error' => "Feed {$_POST['id']} not found"];
|
||||
}
|
||||
if (key_exists('ok', $result)) {
|
||||
add_info('Feed saved successfully');
|
||||
$db->close();
|
||||
frc_redirect('/feeds');
|
||||
}
|
||||
add_error($result['error']);
|
||||
@@ -83,4 +80,3 @@ page_head($title); ?>
|
||||
</form>
|
||||
</article><?php
|
||||
page_foot();
|
||||
$db->close();
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
* List feeds and provide links for maintenance actions
|
||||
*/
|
||||
|
||||
use BitBadger\Documents\ArrayMapper;
|
||||
use BitBadger\Documents\Field;
|
||||
use BitBadger\Documents\JsonMapper;
|
||||
use BitBadger\Documents\Query;
|
||||
use BitBadger\Documents\SQLite\Custom;
|
||||
use BitBadger\PDODocument\Custom;
|
||||
use BitBadger\PDODocument\Field;
|
||||
use BitBadger\PDODocument\Mapper\ArrayMapper;
|
||||
use BitBadger\PDODocument\Mapper\DocumentMapper;
|
||||
use BitBadger\PDODocument\Query;
|
||||
use FeedReaderCentral\Feed;
|
||||
use FeedReaderCentral\Key;
|
||||
use FeedReaderCentral\Table;
|
||||
@@ -19,10 +19,9 @@ include '../start.php';
|
||||
|
||||
FeedReaderCentral\Security::verifyUser();
|
||||
|
||||
// TODO: adapt query when document list is done
|
||||
$field = Field::EQ('user_id', $_SESSION[Key::USER_ID], '@user');
|
||||
$feeds = Custom::list(Query\Find::byFields(Table::FEED, [$field]) . " ORDER BY lower(data->>'title')",
|
||||
$field->appendParameter([]), new JsonMapper(Feed::class));
|
||||
$field->appendParameter([]), new DocumentMapper(Feed::class));
|
||||
|
||||
page_head('Your Feeds'); ?>
|
||||
<h1>Your Feeds</h1>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
* Displays a list of unread or bookmarked items for the current user
|
||||
*/
|
||||
|
||||
use BitBadger\Documents\SQLite\Configuration;
|
||||
use FeedReaderCentral\Feed;
|
||||
use FeedReaderCentral\ItemList;
|
||||
|
||||
@@ -15,9 +14,7 @@ include '../start.php';
|
||||
FeedReaderCentral\Security::verifyUser();
|
||||
|
||||
if (key_exists('refresh', $_GET)) {
|
||||
$db = Configuration::dbConn();
|
||||
$refreshResult = Feed::refreshAll($db);
|
||||
$db->close();
|
||||
$refreshResult = Feed::refreshAll();
|
||||
if (key_exists('ok', $refreshResult)) {
|
||||
add_info('All feeds refreshed successfully');
|
||||
} else {
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
* Retrieves and displays an item from a feed belonging to the current user
|
||||
*/
|
||||
|
||||
use BitBadger\Documents\DocumentException;
|
||||
use BitBadger\Documents\SQLite\Delete;
|
||||
use BitBadger\Documents\SQLite\Patch;
|
||||
use BitBadger\PDODocument\DocumentException;
|
||||
use BitBadger\PDODocument\Delete;
|
||||
use BitBadger\PDODocument\Patch;
|
||||
use FeedReaderCentral\ItemWithFeed;
|
||||
use FeedReaderCentral\Table;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user