aboutsummaryrefslogtreecommitdiff
path: root/p/api/greader.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-09-24 18:10:53 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-09-24 18:10:53 +0200
commitf1f8ea2da3a9334d20d54c083735855c90a21d9e (patch)
tree8fe57f0647ae9a1a593895dcdf09ecbcb806162f /p/api/greader.php
parent44f22ab8b4c46befab98440f69a05725928bed75 (diff)
API fix change feed category
Diffstat (limited to 'p/api/greader.php')
-rw-r--r--p/api/greader.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/p/api/greader.php b/p/api/greader.php
index 426f3fe44..7094fb381 100644
--- a/p/api/greader.php
+++ b/p/api/greader.php
@@ -288,12 +288,15 @@ function subscriptionList() {
}
function subscriptionEdit($streamNames, $titles, $action, $add = '', $remove = '') {
+ //logMe("subscriptionEdit()");
//https://github.com/mihaip/google-reader-api/blob/master/wiki/ApiSubscriptionEdit.wiki
switch ($action) {
case 'subscribe':
case 'unsubscribe':
case 'edit':
+ break;
default:
+ logMe("Bad action: $action");
badRequest();
}
$addCatId = 0;
@@ -305,7 +308,7 @@ function subscriptionEdit($streamNames, $titles, $action, $add = '', $remove = '
$c_name = basename($add);
$cat = $categoryDAO->searchByName($c_name);
$addCatId = $cat == null ? -1 : $cat->id();
- } else if ($remove != '' && strpos($remove, 'user/-/label/') {
+ } else if ($remove != '' && strpos($remove, 'user/-/label/')) {
$addCatId = 1; //Default category
}
$feedDAO = FreshRSS_Factory::createFeedDao();
@@ -328,21 +331,22 @@ function subscriptionEdit($streamNames, $titles, $action, $add = '', $remove = '
case 'subscribe':
if ($feedId <= 0) {
//TODO
+ } else {
+ badRequest();
}
break;
case 'unsubscribe':
if ($feedId > 0) {
//TODO
+ } else {
+ badRequest();
}
break;
case 'edit':
- if ($feedId > 0) {
- if ($feedDAO->moveFeed($feed_id, $cat_id)) {
- exit('OK');
- } else {
- badRequest();
- }
+ if ($feedId > 0 && $feedDAO->moveFeed($feedId, $addCatId)) {
+ exit('OK');
}
+ badRequest();
break;
}
}
@@ -704,7 +708,7 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo
$action = $_POST['ac']; //Action to perform on the given StreamId. Possible values are `subscribe`, `unsubscribe` and `edit`
$add = isset($_POST['a']) ? $_POST['a'] : ''; //StreamId to add the subscription to (generally a user label)
$remove = isset($_POST['r']) ? $_POST['r'] : ''; //StreamId to remove the subscription from (generally a user label)
- subscriptionEdit($streamNames, $titles $action, $add, $remove);
+ subscriptionEdit($streamNames, $titles, $action, $add, $remove);
}
break;
}