aboutsummaryrefslogtreecommitdiff
path: root/app/Models/UserDAO.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2019-09-11 18:40:17 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-09-11 18:40:17 +0200
commit7b4cd3abae88bf1b8a04642489b68a741e4d2c6a (patch)
treed9c46df4256d27f7925703cbd8476d6d61e8c817 /app/Models/UserDAO.php
parent84f9311fd53f5fa58ae55986ece9bfa7dac455c1 (diff)
add: Allow admins to configure default feeds (#2515)
* Homogenize SQL_INSERT_FEEDS across database types * Extract default feeds into system configuration * Adapt default feeds init during installation
Diffstat (limited to 'app/Models/UserDAO.php')
-rw-r--r--app/Models/UserDAO.php22
1 files changed, 10 insertions, 12 deletions
diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php
index e9d3a7329..0cf163bae 100644
--- a/app/Models/UserDAO.php
+++ b/app/Models/UserDAO.php
@@ -30,19 +30,17 @@ class FreshRSS_UserDAO extends Minz_ModelPdo {
}
}
if ($ok && $insertDefaultFeeds) {
- if (defined('SQL_INSERT_FEEDS')) { //E.g. MySQL
- $sql = sprintf(SQL_INSERT_FEEDS, $bd_prefix_user);
+ $default_feeds = FreshRSS_Context::$system_conf->default_feeds;
+ foreach ($default_feeds as $feed) {
+ $sql = sprintf(SQL_INSERT_FEED, $bd_prefix_user);
$stm = $userPDO->bd->prepare($sql);
- $ok &= $stm && $stm->execute();
- } else { //E.g. SQLite
- global $SQL_INSERT_FEEDS;
- if (is_array($SQL_INSERT_FEEDS)) {
- foreach ($SQL_INSERT_FEEDS as $instruction) {
- $sql = sprintf($instruction, $bd_prefix_user);
- $stm = $userPDO->bd->prepare($sql);
- $ok &= ($stm && $stm->execute());
- }
- }
+ $parameters = array(
+ ':url' => $feed['url'],
+ ':name' => $feed['name'],
+ ':website' => $feed['website'],
+ ':description' => $feed['description'],
+ );
+ $ok &= ($stm && $stm->execute($parameters));
}
}
} catch (Exception $e) {