summaryrefslogtreecommitdiff
path: root/app/Controllers/entryController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-15 11:28:27 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-15 11:28:27 +0100
commitb4463cb69e64ff2dfe840ef69f1b825ecdbee43e (patch)
tree30203852047d7d984211dbe9677b8261e8f3eb57 /app/Controllers/entryController.php
parent4ee4f16ffe06e247d2cb79a2054ab5d5315d82b2 (diff)
Problème casse renommage répertoire
Diffstat (limited to 'app/Controllers/entryController.php')
-rwxr-xr-xapp/Controllers/entryController.php112
1 files changed, 112 insertions, 0 deletions
diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php
new file mode 100755
index 000000000..a332ca8a9
--- /dev/null
+++ b/app/Controllers/entryController.php
@@ -0,0 +1,112 @@
+<?php
+
+class FreshRSS_entry_Controller extends Minz_ActionController {
+ public function firstAction () {
+ if (login_is_conf ($this->view->conf) && !is_logged ()) {
+ Minz_Error::error (
+ 403,
+ array ('error' => array (Minz_Translate::t ('access_denied')))
+ );
+ }
+
+ $this->params = array ();
+ $this->redirect = false;
+ $ajax = Minz_Request::param ('ajax');
+ if ($ajax) {
+ $this->view->_useLayout (false);
+ }
+ }
+ public function lastAction () {
+ $ajax = Minz_Request::param ('ajax');
+ if (!$ajax && $this->redirect) {
+ Minz_Request::forward (array (
+ 'c' => 'index',
+ 'a' => 'index',
+ 'params' => $this->params
+ ), true);
+ } else {
+ Minz_Request::_param ('ajax');
+ }
+ }
+
+ public function readAction () {
+ $this->redirect = true;
+
+ $id = Minz_Request::param ('id');
+ $is_read = Minz_Request::param ('is_read');
+ $get = Minz_Request::param ('get');
+ $nextGet = Minz_Request::param ('nextGet', $get);
+ $idMax = Minz_Request::param ('idMax', 0);
+
+ $is_read = !!$is_read;
+
+ $entryDAO = new FreshRSS_EntryDAO ();
+ if ($id == false) {
+ if (!$get) {
+ $entryDAO->markReadEntries ($idMax);
+ } else {
+ $typeGet = $get[0];
+ $get = substr ($get, 2);
+ switch ($typeGet) {
+ case 'c':
+ $entryDAO->markReadCat ($get, $idMax);
+ break;
+ case 'f':
+ $entryDAO->markReadFeed ($get, $idMax);
+ break;
+ case 's':
+ $entryDAO->markReadEntries ($idMax, true);
+ break;
+ case 'a':
+ $entryDAO->markReadEntries ($idMax);
+ break;
+ }
+ if ($nextGet !== 'a') {
+ $this->params = array ('get' => $nextGet);
+ }
+ }
+
+ $notif = array (
+ 'type' => 'good',
+ 'content' => Minz_Translate::t ('feeds_marked_read')
+ );
+ Minz_Session::_param ('notification', $notif);
+ } else {
+ $entryDAO->markRead ($id, $is_read);
+ }
+ }
+
+ public function bookmarkAction () {
+ $this->redirect = true;
+
+ $id = Minz_Request::param ('id');
+ if ($id) {
+ $entryDAO = new FreshRSS_EntryDAO ();
+ $entryDAO->markFavorite ($id, Minz_Request::param ('is_favorite'));
+ }
+ }
+
+ public function optimizeAction() {
+ @set_time_limit(300);
+ invalidateHttpCache();
+
+ // La table des entrées a tendance à grossir énormément
+ // Cette action permet d'optimiser cette table permettant de grapiller un peu de place
+ // Cette fonctionnalité n'est à appeler qu'occasionnellement
+ $entryDAO = new FreshRSS_EntryDAO();
+ $entryDAO->optimizeTable();
+
+ invalidateHttpCache();
+
+ $notif = array (
+ 'type' => 'good',
+ 'content' => Minz_Translate::t ('optimization_complete')
+ );
+ Minz_Session::_param ('notification', $notif);
+
+ Minz_Request::forward(array(
+ 'c' => 'configure',
+ 'a' => 'display'
+ ), true);
+ }
+}