aboutsummaryrefslogtreecommitdiff
path: root/app/Models/FeedDAO.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models/FeedDAO.php')
-rw-r--r--app/Models/FeedDAO.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php
index c9c9f6301..1dad4a834 100644
--- a/app/Models/FeedDAO.php
+++ b/app/Models/FeedDAO.php
@@ -39,6 +39,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
description,
`lastUpdate`,
priority,
+ `pathEntries`,
`httpAuth`,
error,
keep_history,
@@ -46,11 +47,14 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
attributes
)
VALUES
- (?, ?, ?, ?, ?, ?, 10, ?, 0, ?, ?, ?)';
+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
$stm = $this->bd->prepare($sql);
$valuesTmp['url'] = safe_ascii($valuesTmp['url']);
$valuesTmp['website'] = safe_ascii($valuesTmp['website']);
+ if (!isset($valuesTmp['pathEntries'])) {
+ $valuesTmp['pathEntries'] = '';
+ }
$values = array(
substr($valuesTmp['url'], 0, 511),
@@ -59,8 +63,11 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
substr($valuesTmp['website'], 0, 255),
mb_strcut($valuesTmp['description'], 0, 1023, 'UTF-8'),
$valuesTmp['lastUpdate'],
+ isset($valuesTmp['priority']) ? intval($valuesTmp['priority']) : FreshRSS_Feed::PRIORITY_MAIN_STREAM,
+ mb_strcut($valuesTmp['pathEntries'], 0, 511, 'UTF-8'),
base64_encode($valuesTmp['httpAuth']),
- FreshRSS_Feed::KEEP_HISTORY_DEFAULT,
+ isset($valuesTmp['error']) ? intval($valuesTmp['error']) : 0,
+ isset($valuesTmp['keep_history']) ? intval($valuesTmp['keep_history']) : FreshRSS_Feed::KEEP_HISTORY_DEFAULT,
isset($valuesTmp['ttl']) ? intval($valuesTmp['ttl']) : FreshRSS_Feed::TTL_DEFAULT,
isset($valuesTmp['attributes']) ? json_encode($valuesTmp['attributes']) : '',
);
@@ -238,6 +245,17 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
}
}
+ public function selectAll() {
+ $sql = 'SELECT id, url, category, name, website, description, `lastUpdate`, priority, '
+ . '`pathEntries`, `httpAuth`, error, keep_history, ttl, attributes '
+ . 'FROM `' . $this->prefix . 'feed`';
+ $stm = $this->bd->prepare($sql);
+ $stm->execute();
+ while ($row = $stm->fetch(PDO::FETCH_ASSOC)) {
+ yield $row;
+ }
+ }
+
public function searchById($id) {
$sql = 'SELECT * FROM `' . $this->prefix . 'feed` WHERE id=?';
$stm = $this->bd->prepare($sql);