aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/feedController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre.alapetite@alexandra.dk> 2016-09-26 10:44:44 +0200
committerGravatar Alexandre Alapetite <alexandre.alapetite@alexandra.dk> 2016-09-26 10:44:44 +0200
commit9291748c4745ff8f4be2beaa2998869fd26e907e (patch)
tree20f45c15e387cd1e0d4f4aad3b50ed20035fd214 /app/Controllers/feedController.php
parent3870e430b1001b6a2adfa6dd228420392485488a (diff)
API implement user-info and fix edits
https://github.com/FreshRSS/FreshRSS/issues/1254 https://github.com/jangernert/FeedReader/issues/59#issuecomment-249491580
Diffstat (limited to 'app/Controllers/feedController.php')
-rwxr-xr-xapp/Controllers/feedController.php20
1 files changed, 14 insertions, 6 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index faf670e6e..ca7a818c6 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -473,17 +473,25 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
return $feedDAO->updateFeed($feed_id, array('name' => $feed_name));
}
- public static function moveFeed($feed_id, $cat_id) {
+ public static function moveFeed($feed_id, $cat_id, $new_cat_name = '') {
if ($feed_id <= 0) {
return false;
}
- if ($cat_id <= 0) {
- // If category was not given get the default one.
- $catDAO = new FreshRSS_CategoryDAO();
+
+ $catDAO = new FreshRSS_CategoryDAO();
+ if ($cat_id > 0) {
+ $cat = $catDAO->searchById($cat_id);
+ $cat_id = $cat == null ? 0 : $cat->id();
+ }
+ if ($cat_id <= 1 && $new_cat_name != '') {
+ $cat_id = $catDAO->addCategory(array('name' => $new_cat_name));
+ }
+ if ($cat_id <= 1) {
$catDAO->checkDefault();
- $def_cat = $catDAO->getDefault();
- $cat_id = $def_cat->id();
+ $cat = $catDAO->getDefault();
+ $cat_id = $cat->id();
}
+
$feedDAO = FreshRSS_Factory::createFeedDao();
return $feedDAO->updateFeed($feed_id, array('category' => $cat_id));
}