alpha1 #8
|
@ -56,7 +56,6 @@ class Data {
|
||||||
published_on TEXT NOT NULL,
|
published_on TEXT NOT NULL,
|
||||||
updated_on TEXT,
|
updated_on TEXT,
|
||||||
content TEXT NOT NULL,
|
content TEXT NOT NULL,
|
||||||
is_encoded BOOLEAN NOT NULL,
|
|
||||||
is_read BOOLEAN NOT NULL DEFAULT 0,
|
is_read BOOLEAN NOT NULL DEFAULT 0,
|
||||||
is_bookmarked BOOLEAN NOT NULL DEFAULT 0,
|
is_bookmarked BOOLEAN NOT NULL DEFAULT 0,
|
||||||
FOREIGN KEY (feed_id) REFERENCES feed (id))
|
FOREIGN KEY (feed_id) REFERENCES feed (id))
|
||||||
|
|
|
@ -129,8 +129,7 @@ class Feed {
|
||||||
'published' => Data::formatDate(self::eltValue($item, 'pubDate')),
|
'published' => Data::formatDate(self::eltValue($item, 'pubDate')),
|
||||||
'updated' => Data::formatDate($updNodes->length > 0 ? $updNodes->item(0)->textContent : null),
|
'updated' => Data::formatDate($updNodes->length > 0 ? $updNodes->item(0)->textContent : null),
|
||||||
'content' => $encNodes->length > 0 ? $encNodes->item(0)->textContent
|
'content' => $encNodes->length > 0 ? $encNodes->item(0)->textContent
|
||||||
: self::eltValue($item, 'description'),
|
: self::eltValue($item, 'description')
|
||||||
'isEncoded' => $encNodes->length > 0
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +147,6 @@ class Feed {
|
||||||
published_on = :published,
|
published_on = :published,
|
||||||
updated_on = :updated,
|
updated_on = :updated,
|
||||||
content = :content,
|
content = :content,
|
||||||
is_encoded = :encoded,
|
|
||||||
is_read = 0
|
is_read = 0
|
||||||
WHERE id = :id
|
WHERE id = :id
|
||||||
SQL);
|
SQL);
|
||||||
|
@ -156,7 +154,6 @@ class Feed {
|
||||||
$query->bindValue(':published', $item['published']);
|
$query->bindValue(':published', $item['published']);
|
||||||
$query->bindValue(':updated', $item['updated']);
|
$query->bindValue(':updated', $item['updated']);
|
||||||
$query->bindValue(':content', $item['content']);
|
$query->bindValue(':content', $item['content']);
|
||||||
$query->bindValue(':encoded', $item['isEncoded']);
|
|
||||||
$query->bindValue(':id', $itemId);
|
$query->bindValue(':id', $itemId);
|
||||||
$query->execute();
|
$query->execute();
|
||||||
}
|
}
|
||||||
|
@ -171,9 +168,9 @@ class Feed {
|
||||||
private static function addItem(int $feedId, array $item, SQLite3 $db): void {
|
private static function addItem(int $feedId, array $item, SQLite3 $db): void {
|
||||||
$query = $db->prepare(<<<'SQL'
|
$query = $db->prepare(<<<'SQL'
|
||||||
INSERT INTO item (
|
INSERT INTO item (
|
||||||
feed_id, item_guid, item_link, title, published_on, updated_on, content, is_encoded
|
feed_id, item_guid, item_link, title, published_on, updated_on, content
|
||||||
) VALUES (
|
) VALUES (
|
||||||
:feed, :guid, :link, :title, :published, :updated, :content, :encoded
|
:feed, :guid, :link, :title, :published, :updated, :content
|
||||||
)
|
)
|
||||||
SQL);
|
SQL);
|
||||||
$query->bindValue(':feed', $feedId);
|
$query->bindValue(':feed', $feedId);
|
||||||
|
@ -183,7 +180,6 @@ class Feed {
|
||||||
$query->bindValue(':published', $item['published']);
|
$query->bindValue(':published', $item['published']);
|
||||||
$query->bindValue(':updated', $item['updated']);
|
$query->bindValue(':updated', $item['updated']);
|
||||||
$query->bindValue(':content', $item['content']);
|
$query->bindValue(':content', $item['content']);
|
||||||
$query->bindValue(':encoded', $item['isEncoded']);
|
|
||||||
$query->execute();
|
$query->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,8 @@ page_head('Welcome'); ?>
|
||||||
<article><?php
|
<article><?php
|
||||||
if ($item) {
|
if ($item) {
|
||||||
while ($item) { ?>
|
while ($item) { ?>
|
||||||
<p><a href=/item?id=<?=$item['id']?>><?=htmlentities($item['item_title'])?></a><br>
|
<p><a href=/item?id=<?=$item['id']?>><?=$item['item_title']?></a><br>
|
||||||
<?=htmlentities($item['feed_title'])?><br><small><em><?=date_time($item['as_of'])?></em></small><?php
|
<?=$item['feed_title']?><br><small><em><?=date_time($item['as_of'])?></em></small><?php
|
||||||
$item = $result->fetchArray(SQLITE3_ASSOC);
|
$item = $result->fetchArray(SQLITE3_ASSOC);
|
||||||
}
|
}
|
||||||
} else { ?>
|
} else { ?>
|
||||||
|
|
|
@ -51,7 +51,6 @@ if ($item) {
|
||||||
|
|
||||||
$published = date_time($item['published_on']);
|
$published = date_time($item['published_on']);
|
||||||
$updated = isset($item['updated_on']) ? date_time($item['updated_on']) : null;
|
$updated = isset($item['updated_on']) ? date_time($item['updated_on']) : null;
|
||||||
$isEncoded = (bool) $item['is_encoded'];
|
|
||||||
|
|
||||||
page_head(htmlentities("{$item['item_title']} | {$item['feed_title']}")); ?>
|
page_head(htmlentities("{$item['item_title']} | {$item['feed_title']}")); ?>
|
||||||
<h1 class=item_heading>
|
<h1 class=item_heading>
|
||||||
|
@ -62,13 +61,7 @@ page_head(htmlentities("{$item['item_title']} | {$item['feed_title']}")); ?>
|
||||||
Published <?=date_time($item['published_on'])?><?=$updated && $updated != $published ? " (Updated $updated)" : ''?>
|
Published <?=date_time($item['published_on'])?><?=$updated && $updated != $published ? " (Updated $updated)" : ''?>
|
||||||
</div>
|
</div>
|
||||||
<article>
|
<article>
|
||||||
<div class=item_content><?php
|
<div class=item_content><?=str_replace('<a ', '<a target=_blank rel=noopener ', $item['content'])?></div>
|
||||||
if ($isEncoded) {
|
|
||||||
echo str_replace('<a ', '<a target=_blank rel=noopener ', $item['content']);
|
|
||||||
} else {
|
|
||||||
echo htmlentities($item['content']);
|
|
||||||
} ?>
|
|
||||||
</div>
|
|
||||||
<form class=action_buttons action=/item method=POST>
|
<form class=action_buttons action=/item method=POST>
|
||||||
<input type=hidden name=id value=<?=$_GET['id']?>>
|
<input type=hidden name=id value=<?=$_GET['id']?>>
|
||||||
<a href="/">Done</a>
|
<a href="/">Done</a>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user