Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/news.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-10-21 18:45:36 +0400
committerBernhard Posselt <dev@bernhard-posselt.com>2014-10-21 18:45:36 +0400
commit42d69a95f3276a2d6089ca68f635c4e2f6aa7a23 (patch)
tree6a17fd7998f291e6dec1d996c1e7c724b92b8e58 /controller
parent0e6598b0734fb927109f745d9c0f3a8605a30ca5 (diff)
convert tabs indention to indention with 4 spaces because of mixing of both variants in code and better readability on github and websites because you cant set the indention width there and 8 spaces will be used for a tab
Diffstat (limited to 'controller')
-rw-r--r--controller/admincontroller.php90
-rw-r--r--controller/exportcontroller.php102
-rw-r--r--controller/feedapicontroller.php262
-rw-r--r--controller/feedcontroller.php350
-rw-r--r--controller/folderapicontroller.php148
-rw-r--r--controller/foldercontroller.php158
-rw-r--r--controller/itemapicontroller.php274
-rw-r--r--controller/jsonhttperror.php18
-rw-r--r--controller/pagecontroller.php126
-rw-r--r--controller/utilityapicontroller.php64
10 files changed, 796 insertions, 796 deletions
diff --git a/controller/admincontroller.php b/controller/admincontroller.php
index 2b876c394..cd3ae9df4 100644
--- a/controller/admincontroller.php
+++ b/controller/admincontroller.php
@@ -21,56 +21,56 @@ use \OCA\News\Config\Config;
class AdminController extends Controller {
- private $config;
- private $configPath;
+ private $config;
+ private $configPath;
- public function __construct($appName, IRequest $request, Config $config,
- $configPath){
- parent::__construct($appName, $request);
- $this->config = $config;
- $this->configPath = $configPath;
- }
+ public function __construct($appName, IRequest $request, Config $config,
+ $configPath){
+ parent::__construct($appName, $request);
+ $this->config = $config;
+ $this->configPath = $configPath;
+ }
- // There are no checks for the index method since the output is rendered
- // in admin/admin.php
- public function index() {
- $data = [
- 'autoPurgeMinimumInterval' => $this->config->getAutoPurgeMinimumInterval(),
- 'autoPurgeCount' => $this->config->getAutoPurgeCount(),
- 'cacheDuration' => $this->config->getSimplePieCacheDuration(),
- 'feedFetcherTimeout' => $this->config->getFeedFetcherTimeout(),
- 'useCronUpdates' => $this->config->getUseCronUpdates(),
- ];
- return new TemplateResponse($this->appName, 'admin', $data, 'blank');
- }
+ // There are no checks for the index method since the output is rendered
+ // in admin/admin.php
+ public function index() {
+ $data = [
+ 'autoPurgeMinimumInterval' => $this->config->getAutoPurgeMinimumInterval(),
+ 'autoPurgeCount' => $this->config->getAutoPurgeCount(),
+ 'cacheDuration' => $this->config->getSimplePieCacheDuration(),
+ 'feedFetcherTimeout' => $this->config->getFeedFetcherTimeout(),
+ 'useCronUpdates' => $this->config->getUseCronUpdates(),
+ ];
+ return new TemplateResponse($this->appName, 'admin', $data, 'blank');
+ }
- /**
- * @param int $autoPurgeMinimumInterval
- * @param int $autoPurgeCount
- * @param int $cacheDuration
- * @param int $feedFetcherTimeout
- * @param bool $useCronUpdates
- * @return array with the updated values
- */
- public function update($autoPurgeMinimumInterval, $autoPurgeCount,
- $cacheDuration, $feedFetcherTimeout,
- $useCronUpdates) {
- $this->config->setAutoPurgeMinimumInterval($autoPurgeMinimumInterval);
- $this->config->setAutoPurgeCount($autoPurgeCount);
- $this->config->setSimplePieCacheDuration($cacheDuration);
- $this->config->setFeedFetcherTimeout($feedFetcherTimeout);
- $this->config->setUseCronUpdates($useCronUpdates);
- $this->config->write($this->configPath);
+ /**
+ * @param int $autoPurgeMinimumInterval
+ * @param int $autoPurgeCount
+ * @param int $cacheDuration
+ * @param int $feedFetcherTimeout
+ * @param bool $useCronUpdates
+ * @return array with the updated values
+ */
+ public function update($autoPurgeMinimumInterval, $autoPurgeCount,
+ $cacheDuration, $feedFetcherTimeout,
+ $useCronUpdates) {
+ $this->config->setAutoPurgeMinimumInterval($autoPurgeMinimumInterval);
+ $this->config->setAutoPurgeCount($autoPurgeCount);
+ $this->config->setSimplePieCacheDuration($cacheDuration);
+ $this->config->setFeedFetcherTimeout($feedFetcherTimeout);
+ $this->config->setUseCronUpdates($useCronUpdates);
+ $this->config->write($this->configPath);
- return [
- 'autoPurgeMinimumInterval' => $this->config->getAutoPurgeMinimumInterval(),
- 'autoPurgeCount' => $this->config->getAutoPurgeCount(),
- 'cacheDuration' => $this->config->getSimplePieCacheDuration(),
- 'feedFetcherTimeout' => $this->config->getFeedFetcherTimeout(),
- 'useCronUpdates' => $this->config->getUseCronUpdates(),
- ];
- }
+ return [
+ 'autoPurgeMinimumInterval' => $this->config->getAutoPurgeMinimumInterval(),
+ 'autoPurgeCount' => $this->config->getAutoPurgeCount(),
+ 'cacheDuration' => $this->config->getSimplePieCacheDuration(),
+ 'feedFetcherTimeout' => $this->config->getFeedFetcherTimeout(),
+ 'useCronUpdates' => $this->config->getUseCronUpdates(),
+ ];
+ }
} \ No newline at end of file
diff --git a/controller/exportcontroller.php b/controller/exportcontroller.php
index b455f2fcc..1d0f7086c 100644
--- a/controller/exportcontroller.php
+++ b/controller/exportcontroller.php
@@ -26,64 +26,64 @@ use \OCA\News\Utility\OPMLExporter;
class ExportController extends Controller {
- private $opmlExporter;
- private $folderService;
- private $feedService;
- private $itemService;
- private $userId;
+ private $opmlExporter;
+ private $folderService;
+ private $feedService;
+ private $itemService;
+ private $userId;
- public function __construct($appName,
- IRequest $request,
- FolderService $folderService,
- FeedService $feedService,
- ItemService $itemService,
- OPMLExporter $opmlExporter,
- $userId){
- parent::__construct($appName, $request);
- $this->feedService = $feedService;
- $this->folderService = $folderService;
- $this->opmlExporter = $opmlExporter;
- $this->itemService = $itemService;
- $this->userId = $userId;
- }
+ public function __construct($appName,
+ IRequest $request,
+ FolderService $folderService,
+ FeedService $feedService,
+ ItemService $itemService,
+ OPMLExporter $opmlExporter,
+ $userId){
+ parent::__construct($appName, $request);
+ $this->feedService = $feedService;
+ $this->folderService = $folderService;
+ $this->opmlExporter = $opmlExporter;
+ $this->itemService = $itemService;
+ $this->userId = $userId;
+ }
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
- public function opml(){
- $feeds = $this->feedService->findAll($this->userId);
- $folders = $this->folderService->findAll($this->userId);
- $opml = $this->opmlExporter->build($folders, $feeds)->saveXML();
- return new TextDownloadResponse($opml, 'subscriptions.opml', 'text/xml');
- }
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ */
+ public function opml(){
+ $feeds = $this->feedService->findAll($this->userId);
+ $folders = $this->folderService->findAll($this->userId);
+ $opml = $this->opmlExporter->build($folders, $feeds)->saveXML();
+ return new TextDownloadResponse($opml, 'subscriptions.opml', 'text/xml');
+ }
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
- public function articles(){
- $feeds = $this->feedService->findAll($this->userId);
- $items = $this->itemService->getUnreadOrStarred($this->userId);
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ */
+ public function articles(){
+ $feeds = $this->feedService->findAll($this->userId);
+ $items = $this->itemService->getUnreadOrStarred($this->userId);
- // build assoc array for fast access
- $feedsDict = [];
- foreach($feeds as $feed) {
- $feedsDict['feed' . $feed->getId()] = $feed;
- }
+ // build assoc array for fast access
+ $feedsDict = [];
+ foreach($feeds as $feed) {
+ $feedsDict['feed' . $feed->getId()] = $feed;
+ }
- $articles = [];
- foreach($items as $item) {
- $articles[] = $item->toExport($feedsDict);
- }
-
- $response = new JSONResponse($articles);
- $response->addHeader('Content-Disposition',
- 'attachment; filename="articles.json"');
- return $response;
- }
+ $articles = [];
+ foreach($items as $item) {
+ $articles[] = $item->toExport($feedsDict);
+ }
+
+ $response = new JSONResponse($articles);
+ $response->addHeader('Content-Disposition',
+ 'attachment; filename="articles.json"');
+ return $response;
+ }
} \ No newline at end of file
diff --git a/controller/feedapicontroller.php b/controller/feedapicontroller.php
index 33a9cbb7f..c75cd5879 100644
--- a/controller/feedapicontroller.php
+++ b/controller/feedapicontroller.php
@@ -26,53 +26,53 @@ use \OCA\News\Service\ServiceConflictException;
class FeedApiController extends ApiController {
- use JSONHttpError;
-
- private $itemService;
- private $feedService;
- private $userId;
- private $logger;
- private $loggerParams;
- private $serializer;
-
- public function __construct($appName,
- IRequest $request,
- FeedService $feedService,
- ItemService $itemService,
- ILogger $logger,
- $userId,
- $loggerParams){
- parent::__construct($appName, $request);
- $this->feedService = $feedService;
- $this->itemService = $itemService;
- $this->userId = $userId;
- $this->logger = $logger;
- $this->loggerParams = $loggerParams;
- $this->serializer = new EntityApiSerializer('feeds');
- }
-
-
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- * @CORS
- */
- public function index() {
-
- $result = [
- 'starredCount' => $this->itemService->starredCount($this->userId),
- 'feeds' => $this->feedService->findAll($this->userId)
- ];
-
-
- try {
- $result['newestItemId'] = $this->itemService->getNewestItemId($this->userId);
-
- // in case there are no items, ignore
- } catch(ServiceNotFoundException $ex) {}
-
- return $this->serializer->serialize($result);
- }
+ use JSONHttpError;
+
+ private $itemService;
+ private $feedService;
+ private $userId;
+ private $logger;
+ private $loggerParams;
+ private $serializer;
+
+ public function __construct($appName,
+ IRequest $request,
+ FeedService $feedService,
+ ItemService $itemService,
+ ILogger $logger,
+ $userId,
+ $loggerParams){
+ parent::__construct($appName, $request);
+ $this->feedService = $feedService;
+ $this->itemService = $itemService;
+ $this->userId = $userId;
+ $this->logger = $logger;
+ $this->loggerParams = $loggerParams;
+ $this->serializer = new EntityApiSerializer('feeds');
+ }
+
+
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ * @CORS
+ */
+ public function index() {
+
+ $result = [
+ 'starredCount' => $this->itemService->starredCount($this->userId),
+ 'feeds' => $this->feedService->findAll($this->userId)
+ ];
+
+
+ try {
+ $result['newestItemId'] = $this->itemService->getNewestItemId($this->userId);
+
+ // in case there are no items, ignore
+ } catch(ServiceNotFoundException $ex) {}
+
+ return $this->serializer->serialize($result);
+ }
/**
@@ -84,27 +84,27 @@ class FeedApiController extends ApiController {
* @param int $folderId
* @return array|mixed|\OCP\AppFramework\Http\JSONResponse
*/
- public function create($url, $folderId=0) {
- try {
- $this->feedService->purgeDeleted($this->userId, false);
+ public function create($url, $folderId=0) {
+ try {
+ $this->feedService->purgeDeleted($this->userId, false);
- $feed = $this->feedService->create($url, $folderId, $this->userId);
- $result = ['feeds' => [$feed]];
+ $feed = $this->feedService->create($url, $folderId, $this->userId);
+ $result = ['feeds' => [$feed]];
- try {
- $result['newestItemId'] = $this->itemService->getNewestItemId($this->userId);
+ try {
+ $result['newestItemId'] = $this->itemService->getNewestItemId($this->userId);
- // in case there are no items, ignore
- } catch(ServiceNotFoundException $ex) {}
+ // in case there are no items, ignore
+ } catch(ServiceNotFoundException $ex) {}
- return $this->serializer->serialize($result);
+ return $this->serializer->serialize($result);
- } catch(ServiceConflictException $ex) {
- return $this->error($ex, Http::STATUS_CONFLICT);
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
- }
+ } catch(ServiceConflictException $ex) {
+ return $this->error($ex, Http::STATUS_CONFLICT);
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
+ }
/**
@@ -115,28 +115,28 @@ class FeedApiController extends ApiController {
* @param int $feedId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function delete($feedId) {
- try {
- $this->feedService->delete($feedId, $this->userId);
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function delete($feedId) {
+ try {
+ $this->feedService->delete($feedId, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- * @CORS
- *
- * @param int $feedId
- * @param int $newestItemId
- */
- public function read($feedId, $newestItemId) {
- $this->itemService->readFeed($feedId, $newestItemId, $this->userId);
- }
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ * @CORS
+ *
+ * @param int $feedId
+ * @param int $newestItemId
+ */
+ public function read($feedId, $newestItemId) {
+ $this->itemService->readFeed($feedId, $newestItemId, $this->userId);
+ }
/**
@@ -148,15 +148,15 @@ class FeedApiController extends ApiController {
* @param int $folderId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function move($feedId, $folderId) {
- try {
- $this->feedService->move($feedId, $folderId, $this->userId);
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function move($feedId, $folderId) {
+ try {
+ $this->feedService->move($feedId, $folderId, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
/**
@@ -168,51 +168,51 @@ class FeedApiController extends ApiController {
* @param string $feedTitle
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function rename($feedId, $feedTitle) {
- try {
- $this->feedService->rename($feedId, $feedTitle, $this->userId);
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function rename($feedId, $feedTitle) {
+ try {
+ $this->feedService->rename($feedId, $feedTitle, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
-
-
- /**
- * @NoCSRFRequired
- * @CORS
- */
- public function fromAllUsers() {
- $feeds = $this->feedService->findAllFromAllUsers();
- $result = ['feeds' => []];
-
- foreach ($feeds as $feed) {
- $result['feeds'][] = [
- 'id' => $feed->getId(),
- 'userId' => $feed->getUserId()
- ];
- }
-
- return $result;
- }
-
-
- /**
- * @NoCSRFRequired
- *
- * @param string $userId
- * @param int $feedId
- */
- public function update($userId, $feedId) {
- try {
- $this->feedService->update($feedId, $userId);
- // ignore update failure (feed could not be reachable etc, we don't care)
- } catch(\Exception $ex) {
- $this->logger->debug('Could not update feed ' . $ex->getMessage(),
- $this->loggerParams);
- }
- }
+ }
+
+
+ /**
+ * @NoCSRFRequired
+ * @CORS
+ */
+ public function fromAllUsers() {
+ $feeds = $this->feedService->findAllFromAllUsers();
+ $result = ['feeds' => []];
+
+ foreach ($feeds as $feed) {
+ $result['feeds'][] = [
+ 'id' => $feed->getId(),
+ 'userId' => $feed->getUserId()
+ ];
+ }
+
+ return $result;
+ }
+
+
+ /**
+ * @NoCSRFRequired
+ *
+ * @param string $userId
+ * @param int $feedId
+ */
+ public function update($userId, $feedId) {
+ try {
+ $this->feedService->update($feedId, $userId);
+ // ignore update failure (feed could not be reachable etc, we don't care)
+ } catch(\Exception $ex) {
+ $this->logger->debug('Could not update feed ' . $ex->getMessage(),
+ $this->loggerParams);
+ }
+ }
}
diff --git a/controller/feedcontroller.php b/controller/feedcontroller.php
index 686eec9e3..e1544bff0 100644
--- a/controller/feedcontroller.php
+++ b/controller/feedcontroller.php
@@ -28,94 +28,94 @@ use \OCA\News\Db\FeedType;
class FeedController extends Controller {
- use JSONHttpError;
-
- private $feedService;
- private $folderService;
- private $itemService;
- private $userId;
- private $settings;
-
- public function __construct($appName,
- IRequest $request,
- FolderService $folderService,
- FeedService $feedService,
- ItemService $itemService,
- IConfig $settings,
- $userId){
- parent::__construct($appName, $request);
- $this->feedService = $feedService;
- $this->folderService = $folderService;
- $this->itemService = $itemService;
- $this->userId = $userId;
- $this->settings = $settings;
- }
-
-
- /**
- * @NoAdminRequired
- */
- public function index(){
-
- // this method is also used to update the interface
- // because of this we also pass the starred count and the newest
- // item id which will be used for marking feeds read
- $params = [
- 'feeds' => $this->feedService->findAll($this->userId),
- 'starred' => $this->itemService->starredCount($this->userId)
- ];
-
- try {
- $params['newestItemId'] =
- $this->itemService->getNewestItemId($this->userId);
-
- // An exception occurs if there is a newest item. If there is none,
- // simply ignore it and do not add the newestItemId
- } catch (ServiceNotFoundException $ex) {}
-
- return $params;
- }
-
-
- /**
- * @NoAdminRequired
- */
- public function active(){
- $feedId = (int) $this->settings->getUserValue($this->userId,
- $this->appName,'lastViewedFeedId');
- $feedType = $this->settings->getUserValue($this->userId, $this->appName,
- 'lastViewedFeedType');
-
- // cast from null to int is 0
- if($feedType !== null){
- $feedType = (int) $feedType;
- }
-
- // check if feed or folder exists
- try {
- if($feedType === FeedType::FOLDER){
- $this->folderService->find($feedId, $this->userId);
-
- } elseif ($feedType === FeedType::FEED){
- $this->feedService->find($feedId, $this->userId);
-
- // if its the first launch, those values will be null
- } elseif($feedType === null){
- throw new ServiceNotFoundException('');
- }
-
- } catch (ServiceNotFoundException $ex){
- $feedId = 0;
- $feedType = FeedType::SUBSCRIPTIONS;
- }
-
- return [
- 'activeFeed' => [
- 'id' => $feedId,
- 'type' => $feedType
- ]
- ];
- }
+ use JSONHttpError;
+
+ private $feedService;
+ private $folderService;
+ private $itemService;
+ private $userId;
+ private $settings;
+
+ public function __construct($appName,
+ IRequest $request,
+ FolderService $folderService,
+ FeedService $feedService,
+ ItemService $itemService,
+ IConfig $settings,
+ $userId){
+ parent::__construct($appName, $request);
+ $this->feedService = $feedService;
+ $this->folderService = $folderService;
+ $this->itemService = $itemService;
+ $this->userId = $userId;
+ $this->settings = $settings;
+ }
+
+
+ /**
+ * @NoAdminRequired
+ */
+ public function index(){
+
+ // this method is also used to update the interface
+ // because of this we also pass the starred count and the newest
+ // item id which will be used for marking feeds read
+ $params = [
+ 'feeds' => $this->feedService->findAll($this->userId),
+ 'starred' => $this->itemService->starredCount($this->userId)
+ ];
+
+ try {
+ $params['newestItemId'] =
+ $this->itemService->getNewestItemId($this->userId);
+
+ // An exception occurs if there is a newest item. If there is none,
+ // simply ignore it and do not add the newestItemId
+ } catch (ServiceNotFoundException $ex) {}
+
+ return $params;
+ }
+
+
+ /**
+ * @NoAdminRequired
+ */
+ public function active(){
+ $feedId = (int) $this->settings->getUserValue($this->userId,
+ $this->appName,'lastViewedFeedId');
+ $feedType = $this->settings->getUserValue($this->userId, $this->appName,
+ 'lastViewedFeedType');
+
+ // cast from null to int is 0
+ if($feedType !== null){
+ $feedType = (int) $feedType;
+ }
+
+ // check if feed or folder exists
+ try {
+ if($feedType === FeedType::FOLDER){
+ $this->folderService->find($feedId, $this->userId);
+
+ } elseif ($feedType === FeedType::FEED){
+ $this->feedService->find($feedId, $this->userId);
+
+ // if its the first launch, those values will be null
+ } elseif($feedType === null){
+ throw new ServiceNotFoundException('');
+ }
+
+ } catch (ServiceNotFoundException $ex){
+ $feedId = 0;
+ $feedType = FeedType::SUBSCRIPTIONS;
+ }
+
+ return [
+ 'activeFeed' => [
+ 'id' => $feedId,
+ 'type' => $feedType
+ ]
+ ];
+ }
/**
@@ -126,33 +126,33 @@ class FeedController extends Controller {
* @param string $title
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function create($url, $parentFolderId, $title){
- try {
- // we need to purge deleted feeds if a feed is created to
- // prevent already exists exceptions
- $this->feedService->purgeDeleted($this->userId, false);
+ public function create($url, $parentFolderId, $title){
+ try {
+ // we need to purge deleted feeds if a feed is created to
+ // prevent already exists exceptions
+ $this->feedService->purgeDeleted($this->userId, false);
- $feed = $this->feedService->create($url, $parentFolderId,
- $this->userId, $title);
- $params = ['feeds' => [$feed]];
+ $feed = $this->feedService->create($url, $parentFolderId,
+ $this->userId, $title);
+ $params = ['feeds' => [$feed]];
- try {
- $params['newestItemId'] =
- $this->itemService->getNewestItemId($this->userId);
+ try {
+ $params['newestItemId'] =
+ $this->itemService->getNewestItemId($this->userId);
- // An exception occurs if there is a newest item. If there is none,
- // simply ignore it and do not add the newestItemId
- } catch (ServiceNotFoundException $ex) {}
+ // An exception occurs if there is a newest item. If there is none,
+ // simply ignore it and do not add the newestItemId
+ } catch (ServiceNotFoundException $ex) {}
- return $params;
+ return $params;
- } catch(ServiceConflictException $ex) {
- return $this->error($ex, Http::STATUS_CONFLICT);
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY);
- }
+ } catch(ServiceConflictException $ex) {
+ return $this->error($ex, Http::STATUS_CONFLICT);
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY);
+ }
- }
+ }
/**
@@ -161,15 +161,15 @@ class FeedController extends Controller {
* @param int $feedId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function delete($feedId){
- try {
- $this->feedService->markDeleted($feedId, $this->userId);
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function delete($feedId){
+ try {
+ $this->feedService->markDeleted($feedId, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
/**
@@ -178,26 +178,26 @@ class FeedController extends Controller {
* @param int $feedId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function update($feedId){
- try {
- $feed = $this->feedService->update($feedId, $this->userId);
+ public function update($feedId){
+ try {
+ $feed = $this->feedService->update($feedId, $this->userId);
- return [
- 'feeds' => [
- // only pass unread count to not accidentally readd
- // the feed again
- [
- 'id' => $feed->getId(),
- 'unreadCount' => $feed->getUnreadCount()
- ]
- ]
- ];
+ return [
+ 'feeds' => [
+ // only pass unread count to not accidentally readd
+ // the feed again
+ [
+ 'id' => $feed->getId(),
+ 'unreadCount' => $feed->getUnreadCount()
+ ]
+ ]
+ ];
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
- }
+ }
/**
@@ -207,15 +207,15 @@ class FeedController extends Controller {
* @param int $parentFolderId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function move($feedId, $parentFolderId){
- try {
- $this->feedService->move($feedId, $parentFolderId, $this->userId);
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function move($feedId, $parentFolderId){
+ try {
+ $this->feedService->move($feedId, $parentFolderId, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
/**
* @NoAdminRequired
@@ -224,15 +224,15 @@ class FeedController extends Controller {
* @param string $feedTitle
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function rename($feedId, $feedTitle) {
- try {
- $this->feedService->rename($feedId, $feedTitle, $this->userId);
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function rename($feedId, $feedTitle) {
+ try {
+ $this->feedService->rename($feedId, $feedTitle, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
/**
@@ -241,19 +241,19 @@ class FeedController extends Controller {
* @param array $json
* @return array
*/
- public function import($json) {
- $feed = $this->feedService->importArticles($json, $this->userId);
+ public function import($json) {
+ $feed = $this->feedService->importArticles($json, $this->userId);
- $params = [
- 'starred' => $this->itemService->starredCount($this->userId)
- ];
+ $params = [
+ 'starred' => $this->itemService->starredCount($this->userId)
+ ];
- if($feed) {
- $params['feeds'] = [$feed];
- }
+ if($feed) {
+ $params['feeds'] = [$feed];
+ }
- return $params;
- }
+ return $params;
+ }
/**
@@ -263,18 +263,18 @@ class FeedController extends Controller {
* @param int $highestItemId
* @return array
*/
- public function read($feedId, $highestItemId){
- $this->itemService->readFeed($feedId, $highestItemId, $this->userId);
+ public function read($feedId, $highestItemId){
+ $this->itemService->readFeed($feedId, $highestItemId, $this->userId);
- return [
- 'feeds' => [
- [
- 'id' => $feedId,
- 'unreadCount' => 0
- ]
- ]
- ];
- }
+ return [
+ 'feeds' => [
+ [
+ 'id' => $feedId,
+ 'unreadCount' => 0
+ ]
+ ]
+ ];
+ }
/**
@@ -283,15 +283,15 @@ class FeedController extends Controller {
* @param int $feedId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function restore($feedId){
- try {
- $this->feedService->unmarkDeleted($feedId, $this->userId);
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function restore($feedId){
+ try {
+ $this->feedService->unmarkDeleted($feedId, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
} \ No newline at end of file
diff --git a/controller/folderapicontroller.php b/controller/folderapicontroller.php
index 84f1dbdf5..ab2b5601f 100644
--- a/controller/folderapicontroller.php
+++ b/controller/folderapicontroller.php
@@ -26,36 +26,36 @@ use \OCA\News\Service\ServiceValidationException;
class FolderApiController extends ApiController {
- use JSONHttpError;
-
- private $folderService;
- private $itemService;
- private $userId;
- private $serializer;
-
- public function __construct($appName,
- IRequest $request,
- FolderService $folderService,
- ItemService $itemService,
- $userId){
- parent::__construct($appName, $request);
- $this->folderService = $folderService;
- $this->itemService = $itemService;
- $this->userId = $userId;
- $this->serializer = new EntityApiSerializer('folders');
- }
-
-
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- * @CORS
- */
- public function index() {
- return $this->serializer->serialize(
- $this->folderService->findAll($this->userId)
- );
- }
+ use JSONHttpError;
+
+ private $folderService;
+ private $itemService;
+ private $userId;
+ private $serializer;
+
+ public function __construct($appName,
+ IRequest $request,
+ FolderService $folderService,
+ ItemService $itemService,
+ $userId){
+ parent::__construct($appName, $request);
+ $this->folderService = $folderService;
+ $this->itemService = $itemService;
+ $this->userId = $userId;
+ $this->serializer = new EntityApiSerializer('folders');
+ }
+
+
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ * @CORS
+ */
+ public function index() {
+ return $this->serializer->serialize(
+ $this->folderService->findAll($this->userId)
+ );
+ }
/**
@@ -66,18 +66,18 @@ class FolderApiController extends ApiController {
* @param string $name
* @return array|mixed|\OCP\AppFramework\Http\JSONResponse
*/
- public function create($name) {
- try {
- $this->folderService->purgeDeleted($this->userId, false);
- return $this->serializer->serialize(
- $this->folderService->create($name, $this->userId)
- );
- } catch(ServiceValidationException $ex) {
- return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY);
- } catch(ServiceConflictException $ex) {
- return $this->error($ex, Http::STATUS_CONFLICT);
- }
- }
+ public function create($name) {
+ try {
+ $this->folderService->purgeDeleted($this->userId, false);
+ return $this->serializer->serialize(
+ $this->folderService->create($name, $this->userId)
+ );
+ } catch(ServiceValidationException $ex) {
+ return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY);
+ } catch(ServiceConflictException $ex) {
+ return $this->error($ex, Http::STATUS_CONFLICT);
+ }
+ }
/**
@@ -88,15 +88,15 @@ class FolderApiController extends ApiController {
* @param int $folderId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function delete($folderId) {
- try {
- $this->folderService->delete($folderId, $this->userId);
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function delete($folderId) {
+ try {
+ $this->folderService->delete($folderId, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
/**
@@ -107,33 +107,33 @@ class FolderApiController extends ApiController {
* @param string $name
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function update($folderId, $name) {
- try {
- $this->folderService->rename($folderId, $name, $this->userId);
-
- } catch(ServiceValidationException $ex) {
- return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY);
- } catch(ServiceConflictException $ex) {
- return $this->error($ex, Http::STATUS_CONFLICT);
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function update($folderId, $name) {
+ try {
+ $this->folderService->rename($folderId, $name, $this->userId);
+
+ } catch(ServiceValidationException $ex) {
+ return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY);
+ } catch(ServiceConflictException $ex) {
+ return $this->error($ex, Http::STATUS_CONFLICT);
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
-
-
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- * @CORS
- *
- * @param int $folderId
- * @param int $newestItemId
- */
- public function read($folderId, $newestItemId) {
- $this->itemService->readFolder($folderId, $newestItemId, $this->userId);
- }
+ }
+
+
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ * @CORS
+ *
+ * @param int $folderId
+ * @param int $newestItemId
+ */
+ public function read($folderId, $newestItemId) {
+ $this->itemService->readFolder($folderId, $newestItemId, $this->userId);
+ }
}
diff --git a/controller/foldercontroller.php b/controller/foldercontroller.php
index 9488a7d6c..d5ccc7c62 100644
--- a/controller/foldercontroller.php
+++ b/controller/foldercontroller.php
@@ -27,34 +27,34 @@ use \OCA\News\Service\ServiceValidationException;
class FolderController extends Controller {
- use JSONHttpError;
-
- private $folderService;
- private $feedService;
- private $itemService;
- private $userId;
-
- public function __construct($appName,
- IRequest $request,
- FolderService $folderService,
- FeedService $feedService,
- ItemService $itemService,
- $userId) {
- parent::__construct($appName, $request);
- $this->folderService = $folderService;
- $this->feedService = $feedService;
- $this->itemService = $itemService;
- $this->userId = $userId;
- }
-
-
- /**
- * @NoAdminRequired
- */
- public function index() {
- $folders = $this->folderService->findAll($this->userId);
- return ['folders' => $folders];
- }
+ use JSONHttpError;
+
+ private $folderService;
+ private $feedService;
+ private $itemService;
+ private $userId;
+
+ public function __construct($appName,
+ IRequest $request,
+ FolderService $folderService,
+ FeedService $feedService,
+ ItemService $itemService,
+ $userId) {
+ parent::__construct($appName, $request);
+ $this->folderService = $folderService;
+ $this->feedService = $feedService;
+ $this->itemService = $itemService;
+ $this->userId = $userId;
+ }
+
+
+ /**
+ * @NoAdminRequired
+ */
+ public function index() {
+ $folders = $this->folderService->findAll($this->userId);
+ return ['folders' => $folders];
+ }
/**
@@ -64,15 +64,15 @@ class FolderController extends Controller {
* @param bool $open
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function open($folderId, $open) {
- try {
- $this->folderService->open($folderId, $open, $this->userId);
- } catch(ServiceNotFoundException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function open($folderId, $open) {
+ try {
+ $this->folderService->open($folderId, $open, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
/**
@@ -81,22 +81,22 @@ class FolderController extends Controller {
* @param string $folderName
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function create($folderName) {
- try {
- // we need to purge deleted folders if a folder is created to
- // prevent already exists exceptions
- $this->folderService->purgeDeleted($this->userId, false);
- $folder = $this->folderService->create($folderName, $this->userId);
+ public function create($folderName) {
+ try {
+ // we need to purge deleted folders if a folder is created to
+ // prevent already exists exceptions
+ $this->folderService->purgeDeleted($this->userId, false);
+ $folder = $this->folderService->create($folderName, $this->userId);
- return ['folders' => [$folder]];
+ return ['folders' => [$folder]];
- } catch(ServiceConflictException $ex) {
- return $this->error($ex, Http::STATUS_CONFLICT);
- } catch(ServiceValidationException $ex) {
- return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY);
- }
+ } catch(ServiceConflictException $ex) {
+ return $this->error($ex, Http::STATUS_CONFLICT);
+ } catch(ServiceValidationException $ex) {
+ return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY);
+ }
- }
+ }
/**
@@ -105,15 +105,15 @@ class FolderController extends Controller {
* @param int $folderId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function delete($folderId) {
- try {
- $this->folderService->markDeleted($folderId, $this->userId);
- } catch (ServiceNotFoundException $ex){
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function delete($folderId) {
+ try {
+ $this->folderService->markDeleted($folderId, $this->userId);
+ } catch (ServiceNotFoundException $ex){
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
/**
@@ -123,22 +123,22 @@ class FolderController extends Controller {
* @param int $folderId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function rename($folderName, $folderId) {
- try {
- $folder = $this->folderService->rename($folderId, $folderName,
- $this->userId);
+ public function rename($folderName, $folderId) {
+ try {
+ $folder = $this->folderService->rename($folderId, $folderName,
+ $this->userId);
- return ['folders' => [$folder]];
+ return ['folders' => [$folder]];
- } catch(ServiceConflictException $ex) {
- return $this->error($ex, Http::STATUS_CONFLICT);
- } catch(ServiceValidationException $ex) {
- return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY);
- } catch (ServiceNotFoundException $ex){
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ } catch(ServiceConflictException $ex) {
+ return $this->error($ex, Http::STATUS_CONFLICT);
+ } catch(ServiceValidationException $ex) {
+ return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY);
+ } catch (ServiceNotFoundException $ex){
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
- }
+ }
/**
* @NoAdminRequired
@@ -147,11 +147,11 @@ class FolderController extends Controller {
* @param int $highestItemId
* @return array
*/
- public function read($folderId, $highestItemId) {
- $this->itemService->readFolder($folderId, $highestItemId, $this->userId);
+ public function read($folderId, $highestItemId) {
+ $this->itemService->readFolder($folderId, $highestItemId, $this->userId);
- return ['feeds' => $this->feedService->findAll($this->userId)];
- }
+ return ['feeds' => $this->feedService->findAll($this->userId)];
+ }
/**
@@ -160,15 +160,15 @@ class FolderController extends Controller {
* @param int $folderId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function restore($folderId) {
- try {
- $this->folderService->unmarkDeleted($folderId, $this->userId);
- } catch (ServiceNotFoundException $ex){
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function restore($folderId) {
+ try {
+ $this->folderService->unmarkDeleted($folderId, $this->userId);
+ } catch (ServiceNotFoundException $ex){
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
} \ No newline at end of file
diff --git a/controller/itemapicontroller.php b/controller/itemapicontroller.php
index ebfbc218b..3674d644c 100644
--- a/controller/itemapicontroller.php
+++ b/controller/itemapicontroller.php
@@ -22,21 +22,21 @@ use \OCA\News\Service\ServiceNotFoundException;
class ItemApiController extends ApiController {
- use JSONHttpError;
+ use JSONHttpError;
- private $itemService;
- private $userId;
- private $serializer;
+ private $itemService;
+ private $userId;
+ private $serializer;
- public function __construct($appName,
- IRequest $request,
- ItemService $itemService,
- $userId){
- parent::__construct($appName, $request);
- $this->itemService = $itemService;
- $this->userId = $userId;
- $this->serializer = new EntityApiSerializer('items');
- }
+ public function __construct($appName,
+ IRequest $request,
+ ItemService $itemService,
+ $userId){
+ parent::__construct($appName, $request);
+ $this->itemService = $itemService;
+ $this->userId = $userId;
+ $this->serializer = new EntityApiSerializer('items');
+ }
/**
@@ -52,15 +52,15 @@ class ItemApiController extends ApiController {
* @param bool $oldestFirst
* @return array|mixed
*/
- public function index($type, $id, $getRead, $batchSize=20, $offset=0,
- $oldestFirst=false) {
- return $this->serializer->serialize(
- $this->itemService->findAll(
- $id, $type, $batchSize, $offset, $getRead, $oldestFirst,
- $this->userId
- )
- );
- }
+ public function index($type, $id, $getRead, $batchSize=20, $offset=0,
+ $oldestFirst=false) {
+ return $this->serializer->serialize(
+ $this->itemService->findAll(
+ $id, $type, $batchSize, $offset, $getRead, $oldestFirst,
+ $this->userId
+ )
+ );
+ }
/**
@@ -73,23 +73,23 @@ class ItemApiController extends ApiController {
* @param int $lastModified
* @return array|mixed
*/
- public function updated($type, $id, $lastModified=0) {
- return $this->serializer->serialize(
- $this->itemService->findAllNew($id, $type, $lastModified,
- true, $this->userId)
- );
- }
+ public function updated($type, $id, $lastModified=0) {
+ return $this->serializer->serialize(
+ $this->itemService->findAllNew($id, $type, $lastModified,
+ true, $this->userId)
+ );
+ }
- private function setRead($isRead, $itemId) {
- try {
- $this->itemService->read($itemId, $isRead, $this->userId);
- } catch(ServiceNotFoundException $ex){
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ private function setRead($isRead, $itemId) {
+ try {
+ $this->itemService->read($itemId, $isRead, $this->userId);
+ } catch(ServiceNotFoundException $ex){
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
/**
@@ -100,9 +100,9 @@ class ItemApiController extends ApiController {
* @param int $itemId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function read($itemId) {
- return $this->setRead(true, $itemId);
- }
+ public function read($itemId) {
+ return $this->setRead(true, $itemId);
+ }
/**
@@ -113,20 +113,20 @@ class ItemApiController extends ApiController {
* @param int $itemId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function unread($itemId) {
- return $this->setRead(false, $itemId);
- }
+ public function unread($itemId) {
+ return $this->setRead(false, $itemId);
+ }
- private function setStarred($isStarred, $feedId, $guidHash) {
- try {
- $this->itemService->star($feedId, $guidHash, $isStarred, $this->userId);
- } catch(ServiceNotFoundException $ex){
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ private function setStarred($isStarred, $feedId, $guidHash) {
+ try {
+ $this->itemService->star($feedId, $guidHash, $isStarred, $this->userId);
+ } catch(ServiceNotFoundException $ex){
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
/**
@@ -138,9 +138,9 @@ class ItemApiController extends ApiController {
* @param string $guidHash
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function star($feedId, $guidHash) {
- return $this->setStarred(true, $feedId, $guidHash);
- }
+ public function star($feedId, $guidHash) {
+ return $this->setStarred(true, $feedId, $guidHash);
+ }
/**
@@ -152,92 +152,92 @@ class ItemApiController extends ApiController {
* @param string $guidHash
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function unstar($feedId, $guidHash) {
- return $this->setStarred(false, $feedId, $guidHash);
- }
-
-
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- * @CORS
- *
- * @param int $newestItemId
- */
- public function readAll($newestItemId) {
- $this->itemService->readAll($newestItemId, $this->userId);
- }
-
-
- private function setMultipleRead($isRead, $items) {
- foreach($items as $id) {
- try {
- $this->itemService->read($id, $isRead, $this->userId);
- } catch(ServiceNotFoundException $ex) {
- continue;
- }
- }
- }
-
-
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- * @CORS
- *
- * @param int[] item ids
- */
- public function readMultiple($items) {
- $this->setMultipleRead(true, $items);
- }
-
-
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- * @CORS
- *
- * @param int[] item ids
- */
- public function unreadMultiple($items) {
- $this->setMultipleRead(false, $items);
- }
-
-
- private function setMultipleStarred($isStarred, $items) {
- foreach($items as $item) {
- try {
- $this->itemService->star($item['feedId'], $item['guidHash'],
- $isStarred, $this->userId);
- } catch(ServiceNotFoundException $ex) {
- continue;
- }
- }
- }
-
-
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- * @CORS
- *
- * @param int[] item ids
- */
- public function starMultiple($items) {
- $this->setMultipleStarred(true, $items);
- }
-
-
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- * @CORS
- *
- * @param int[] item ids
- */
- public function unstarMultiple($items) {
- $this->setMultipleStarred(false, $items);
- }
+ public function unstar($feedId, $guidHash) {
+ return $this->setStarred(false, $feedId, $guidHash);
+ }
+
+
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ * @CORS
+ *
+ * @param int $newestItemId
+ */
+ public function readAll($newestItemId) {
+ $this->itemService->readAll($newestItemId, $this->userId);
+ }
+
+
+ private function setMultipleRead($isRead, $items) {
+ foreach($items as $id) {
+ try {
+ $this->itemService->read($id, $isRead, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
+ continue;
+ }
+ }
+ }
+
+
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ * @CORS
+ *
+ * @param int[] item ids
+ */
+ public function readMultiple($items) {
+ $this->setMultipleRead(true, $items);
+ }
+
+
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ * @CORS
+ *
+ * @param int[] item ids
+ */
+ public function unreadMultiple($items) {
+ $this->setMultipleRead(false, $items);
+ }
+
+
+ private function setMultipleStarred($isStarred, $items) {
+ foreach($items as $item) {
+ try {
+ $this->itemService->star($item['feedId'], $item['guidHash'],
+ $isStarred, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
+ continue;
+ }
+ }
+ }
+
+
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ * @CORS
+ *
+ * @param int[] item ids
+ */
+ public function starMultiple($items) {
+ $this->setMultipleStarred(true, $items);
+ }
+
+
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ * @CORS
+ *
+ * @param int[] item ids
+ */
+ public function unstarMultiple($items) {
+ $this->setMultipleStarred(false, $items);
+ }
}
diff --git a/controller/jsonhttperror.php b/controller/jsonhttperror.php
index a271878a8..722019ae1 100644
--- a/controller/jsonhttperror.php
+++ b/controller/jsonhttperror.php
@@ -17,15 +17,15 @@ use \OCP\AppFramework\Http\JSONResponse;
trait JSONHttpError {
- /**
- * @param \Exception $exception the message that is returned taken from the
- * exception
- * @param int $code the http error code
- * @return \OCP\AppFramework\Http\JSONResponse
- */
- public function error(\Exception $exception, $code) {
- return new JSONResponse(['message' => $exception->getMessage()], $code);
- }
+ /**
+ * @param \Exception $exception the message that is returned taken from the
+ * exception
+ * @param int $code the http error code
+ * @return \OCP\AppFramework\Http\JSONResponse
+ */
+ public function error(\Exception $exception, $code) {
+ return new JSONResponse(['message' => $exception->getMessage()], $code);
+ }
} \ No newline at end of file
diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php
index e8b651608..90f702d49 100644
--- a/controller/pagecontroller.php
+++ b/controller/pagecontroller.php
@@ -24,70 +24,70 @@ use \OCA\News\Config\AppConfig;
class PageController extends Controller {
- private $settings;
- private $l10n;
- private $userId;
- private $appConfig;
- private $urlGenerator;
-
- public function __construct($appName,
- IRequest $request,
- IConfig $settings,
- IURLGenerator $urlGenerator,
+ private $settings;
+ private $l10n;
+ private $userId;
+ private $appConfig;
+ private $urlGenerator;
+
+ public function __construct($appName,
+ IRequest $request,
+ IConfig $settings,
+ IURLGenerator $urlGenerator,
AppConfig $appConfig,
- IL10N $l10n,
- $userId){
- parent::__construct($appName, $request);
- $this->settings = $settings;
- $this->urlGenerator = $urlGenerator;
- $this->appConfig = $appConfig;
- $this->l10n = $l10n;
- $this->userId = $userId;
- }
-
-
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
- public function index() {
- return new TemplateResponse($this->appName, 'index');
- }
-
-
- /**
- * @NoAdminRequired
- */
- public function settings() {
- $settings = ['showAll', 'compact', 'preventReadOnScroll', 'oldestFirst'];
-
- $result = ['language' => $this->l10n->getLanguageCode()];
-
- foreach ($settings as $setting) {
- $result[$setting] = $this->settings->getUserValue(
- $this->userId, $this->appName, $setting
- ) === '1';
- }
- return ['settings' => $result];
- }
-
-
- /**
- * @NoAdminRequired
- *
- * @param bool $showAll
- * @param bool $compact
- * @param bool $preventReadOnScroll
- * @param bool $oldestFirst
- */
- public function updateSettings($showAll, $compact, $preventReadOnScroll, $oldestFirst) {
- $settings = ['showAll', 'compact', 'preventReadOnScroll', 'oldestFirst'];
-
- foreach ($settings as $setting) {
- $this->settings->setUserValue($this->userId, $this->appName,
- $setting, ${$setting});
- }
- }
+ IL10N $l10n,
+ $userId){
+ parent::__construct($appName, $request);
+ $this->settings = $settings;
+ $this->urlGenerator = $urlGenerator;
+ $this->appConfig = $appConfig;
+ $this->l10n = $l10n;
+ $this->userId = $userId;
+ }
+
+
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ */
+ public function index() {
+ return new TemplateResponse($this->appName, 'index');
+ }
+
+
+ /**
+ * @NoAdminRequired
+ */
+ public function settings() {
+ $settings = ['showAll', 'compact', 'preventReadOnScroll', 'oldestFirst'];
+
+ $result = ['language' => $this->l10n->getLanguageCode()];
+
+ foreach ($settings as $setting) {
+ $result[$setting] = $this->settings->getUserValue(
+ $this->userId, $this->appName, $setting
+ ) === '1';
+ }
+ return ['settings' => $result];
+ }
+
+
+ /**
+ * @NoAdminRequired
+ *
+ * @param bool $showAll
+ * @param bool $compact
+ * @param bool $preventReadOnScroll
+ * @param bool $oldestFirst
+ */
+ public function updateSettings($showAll, $compact, $preventReadOnScroll, $oldestFirst) {
+ $settings = ['showAll', 'compact', 'preventReadOnScroll', 'oldestFirst'];
+
+ foreach ($settings as $setting) {
+ $this->settings->setUserValue($this->userId, $this->appName,
+ $setting, ${$setting});
+ }
+ }
/**
diff --git a/controller/utilityapicontroller.php b/controller/utilityapicontroller.php
index 6dae8d027..44745a074 100644
--- a/controller/utilityapicontroller.php
+++ b/controller/utilityapicontroller.php
@@ -23,45 +23,45 @@ use \OCA\News\Utility\Updater;
class UtilityApiController extends ApiController {
- private $updater;
- private $settings;
+ private $updater;
+ private $settings;
- public function __construct($appName,
- IRequest $request,
- Updater $updater,
- IConfig $settings){
- parent::__construct($appName, $request);
- $this->updater = $updater;
- $this->settings = $settings;
- }
+ public function __construct($appName,
+ IRequest $request,
+ Updater $updater,
+ IConfig $settings){
+ parent::__construct($appName, $request);
+ $this->updater = $updater;
+ $this->settings = $settings;
+ }
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- * @API
- */
- public function version() {
- $version = $this->settings->getAppValue($this->appName,
- 'installed_version');
- return ['version' => $version];
- }
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ * @API
+ */
+ public function version() {
+ $version = $this->settings->getAppValue($this->appName,
+ 'installed_version');
+ return ['version' => $version];
+ }
- /**
- * @NoCSRFRequired
- */
- public function beforeUpdate() {
- $this->updater->beforeUpdate();
- }
+ /**
+ * @NoCSRFRequired
+ */
+ public function beforeUpdate() {
+ $this->updater->beforeUpdate();
+ }
- /**
- * @NoCSRFRequired
- */
- public function afterUpdate() {
- $this->updater->afterUpdate();
- }
+ /**
+ * @NoCSRFRequired
+ */
+ public function afterUpdate() {
+ $this->updater->afterUpdate();
+ }
}