aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/feedController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-09-27 23:02:34 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-09-27 23:02:34 +0200
commit90164df068783f32fee9ca445c99b340004a13c7 (patch)
treeb1e184c5bf090ccf82126d0b8cba7a744018bdf8 /app/Controllers/feedController.php
parentc1c5279109782537cf7d6b6b2664af2a0990fb16 (diff)
parent1d87ebe9dd607a8e4da395d102763b62a94ac02b (diff)
Merge branch 'FreshRSS/dev' into PostgreSQL
Diffstat (limited to 'app/Controllers/feedController.php')
-rwxr-xr-xapp/Controllers/feedController.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index faf670e6e..c2a22aeb3 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) {
- if ($feed_id <= 0) {
+ public static function moveFeed($feed_id, $cat_id, $new_cat_name = '') {
+ if ($feed_id <= 0 || ($cat_id <= 0 && $new_cat_name == '')) {
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));
}