summaryrefslogtreecommitdiff
path: root/app/controllers/apiController.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/apiController.php')
-rwxr-xr-xapp/controllers/apiController.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/app/controllers/apiController.php b/app/controllers/apiController.php
new file mode 100755
index 000000000..88b968cb9
--- /dev/null
+++ b/app/controllers/apiController.php
@@ -0,0 +1,38 @@
+<?php
+
+class apiController extends ActionController {
+ public function getFavoritesAction () {
+ header('Content-type: application/json');
+
+ $this->view->_useLayout (false);
+
+ $entryDAO = new EntryDAO ();
+ $entryDAO->_nbItemsPerPage (-1);
+
+ $entries_tmp = $entryDAO->listFavorites ('all', 'low_to_high');
+
+ $entries = array ();
+
+ foreach ($entries_tmp as $e) {
+ $author = $e->author ();
+ $feed = $e->feed (true);
+ $content = 'Article publiƩ initialement sur <a href="' . $feed->website () . '">' . $feed->name () . '</a>';
+ if($author != '') {
+ $content .= ' par ' . $author;
+ }
+ $content .= ', mis en favoris dans <a href="https://github.com/marienfressinaud/FreshRSS">FreshRSS</a>';
+
+ $id = $e->id ();
+ $entries[$id] = array ();
+ $entries[$id]['title'] = $e->title ();
+ $entries[$id]['content'] = $content;
+ $entries[$id]['date'] = $e->date (true);
+ $entries[$id]['lastUpdate'] = $e->date (true);
+ $entries[$id]['tags'] = array ();
+ $entries[$id]['url'] = $e->link ();
+ $entries[$id]['type'] = 'url';
+ }
+
+ $this->view->entries = $entries;
+ }
+}