summaryrefslogtreecommitdiffstats
path: root/ajax/changefoldername.php
diff options
context:
space:
mode:
Diffstat (limited to 'ajax/changefoldername.php')
-rw-r--r--ajax/changefoldername.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/ajax/changefoldername.php b/ajax/changefoldername.php
new file mode 100644
index 000000000..7031364f6
--- /dev/null
+++ b/ajax/changefoldername.php
@@ -0,0 +1,34 @@
+<?php
+/**
+* ownCloud - News app
+*
+* @author Bernhard Posselt
+* Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com>
+*
+* This file is licensed under the Affero General Public License version 3 or later.
+* See the COPYING-README file
+*
+*/
+
+// Check if we are a user
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('news');
+OCP\JSON::callCheck();
+
+$folderId = (int)$_POST['folderId'];
+$folderName = $_POST['folderName'];
+
+$folderMapper = new OCA\News\FolderMapper();
+$folder = $folderMapper->find($folderId);
+$folder->setName($folderName);
+$success = $folderMapper->update($folder);
+
+$l = OC_L10N::get('news');
+
+if(!$success) {
+ OCP\JSON::error(array('data' => array('message' => $l->t('Error changing name of folder ' . $folderId . ' to ' . $folderName))));
+ OCP\Util::writeLog('news','ajax/setallitemsread.php: Error changing name of folder ' . $folderId . ' to ' . $folderName, OCP\Util::ERROR);
+ exit();
+}
+
+OCP\JSON::success(); \ No newline at end of file