aboutsummaryrefslogtreecommitdiff
path: root/p/api/greader.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-09-25 01:05:00 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-09-25 01:05:00 +0200
commit36e6c10f21aa682a737aa3754750f8ee8820598e (patch)
tree789cda65717a080d143696f996b59d2ccad648b3 /p/api/greader.php
parent85c8fba94fa08dbf71afa0d0ef4fd95607ddb493 (diff)
API rename category
Diffstat (limited to 'p/api/greader.php')
-rw-r--r--p/api/greader.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/p/api/greader.php b/p/api/greader.php
index dc8dd92bc..96c2b2ee3 100644
--- a/p/api/greader.php
+++ b/p/api/greader.php
@@ -600,6 +600,22 @@ function editTag($e_ids, $a, $r) {
exit('OK');
}
+function renameTag($s, $dest) {
+ //logMe("renameTag()");
+ if ($s != '' && strpos($s, 'user/-/label/') === 0 &&
+ $dest != '' && strpos($dest, 'user/-/label/') === 0) {
+ $s = substr($s, 13);
+ $categoryDAO = new FreshRSS_CategoryDAO();
+ $cat = $categoryDAO->searchByName($s);
+ if ($cat != null) {
+ $dest = substr($dest, 13);
+ $categoryDAO->updateCategory($cat->id(), array('name' => $dest));
+ exit('OK');
+ }
+ }
+ badRequest();
+}
+
function markAllAsRead($streamId, $olderThanId) {
//logMe("markAllAsRead($streamId, $olderThanId)");
$entryDAO = FreshRSS_Factory::createEntryDao();
@@ -735,6 +751,13 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo
$e_ids = multiplePosts('i'); //item IDs
editTag($e_ids, $a, $r);
break;
+ case 'rename-tag': //https://github.com/theoldreader/api
+ $token = isset($_POST['T']) ? trim($_POST['T']) : '';
+ checkToken(FreshRSS_Context::$user_conf, $token);
+ $s = isset($_POST['s']) ? $_POST['s'] : ''; //user/-/label/Folder
+ $dest = isset($_POST['dest']) ? $_POST['dest'] : ''; //user/-/label/NewFolder
+ renameTag($s, $dest);
+ break;
case 'mark-all-as-read':
$token = isset($_POST['T']) ? trim($_POST['T']) : '';
checkToken(FreshRSS_Context::$user_conf, $token);