|
@@ -8,7 +8,8 @@ class entryController extends ActionController {
|
|
|
array ('error' => array ('Vous n\'avez pas le droit d\'accéder à cette page'))
|
|
array ('error' => array ('Vous n\'avez pas le droit d\'accéder à cette page'))
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $this->redirect = false;
|
|
|
$ajax = Request::param ('ajax');
|
|
$ajax = Request::param ('ajax');
|
|
|
if ($ajax) {
|
|
if ($ajax) {
|
|
|
$this->view->_useLayout (false);
|
|
$this->view->_useLayout (false);
|
|
@@ -16,7 +17,7 @@ class entryController extends ActionController {
|
|
|
}
|
|
}
|
|
|
public function lastAction () {
|
|
public function lastAction () {
|
|
|
$ajax = Request::param ('ajax');
|
|
$ajax = Request::param ('ajax');
|
|
|
- if (!$ajax) {
|
|
|
|
|
|
|
+ if (!$ajax && $this->redirect) {
|
|
|
Request::forward (array (
|
|
Request::forward (array (
|
|
|
'c' => 'index',
|
|
'c' => 'index',
|
|
|
'a' => 'index',
|
|
'a' => 'index',
|
|
@@ -28,17 +29,19 @@ class entryController extends ActionController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function readAction () {
|
|
public function readAction () {
|
|
|
|
|
+ $this->redirect = true;
|
|
|
|
|
+
|
|
|
$id = Request::param ('id');
|
|
$id = Request::param ('id');
|
|
|
$is_read = Request::param ('is_read');
|
|
$is_read = Request::param ('is_read');
|
|
|
$get = Request::param ('get');
|
|
$get = Request::param ('get');
|
|
|
$dateMax = Request::param ('dateMax', time ());
|
|
$dateMax = Request::param ('dateMax', time ());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if ($is_read) {
|
|
if ($is_read) {
|
|
|
$is_read = true;
|
|
$is_read = true;
|
|
|
} else {
|
|
} else {
|
|
|
$is_read = false;
|
|
$is_read = false;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$entryDAO = new EntryDAO ();
|
|
$entryDAO = new EntryDAO ();
|
|
|
if ($id == false) {
|
|
if ($id == false) {
|
|
|
if (!$get) {
|
|
if (!$get) {
|
|
@@ -55,7 +58,7 @@ class entryController extends ActionController {
|
|
|
$this->params = array ('get' => 'f_' . $get);
|
|
$this->params = array ('get' => 'f_' . $get);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// notif
|
|
// notif
|
|
|
$notif = array (
|
|
$notif = array (
|
|
|
'type' => 'good',
|
|
'type' => 'good',
|
|
@@ -66,28 +69,98 @@ class entryController extends ActionController {
|
|
|
$entryDAO->updateEntry ($id, array ('is_read' => $is_read));
|
|
$entryDAO->updateEntry ($id, array ('is_read' => $is_read));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
public function bookmarkAction () {
|
|
public function bookmarkAction () {
|
|
|
|
|
+ $this->redirect = true;
|
|
|
|
|
+
|
|
|
$id = Request::param ('id');
|
|
$id = Request::param ('id');
|
|
|
$is_fav = Request::param ('is_favorite');
|
|
$is_fav = Request::param ('is_favorite');
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if ($is_fav) {
|
|
if ($is_fav) {
|
|
|
$is_fav = true;
|
|
$is_fav = true;
|
|
|
} else {
|
|
} else {
|
|
|
$is_fav = false;
|
|
$is_fav = false;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$entryDAO = new EntryDAO ();
|
|
$entryDAO = new EntryDAO ();
|
|
|
if ($id != false) {
|
|
if ($id != false) {
|
|
|
$entry = $entryDAO->searchById ($id);
|
|
$entry = $entryDAO->searchById ($id);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if ($entry != false) {
|
|
if ($entry != false) {
|
|
|
$values = array (
|
|
$values = array (
|
|
|
'is_favorite' => $is_fav,
|
|
'is_favorite' => $is_fav,
|
|
|
);
|
|
);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$entryDAO->updateEntry ($entry->id (), $values);
|
|
$entryDAO->updateEntry ($entry->id (), $values);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public function noteAction () {
|
|
|
|
|
+ $not_found = false;
|
|
|
|
|
+ $entryDAO = new EntryDAO ();
|
|
|
|
|
+ $catDAO = new CategoryDAO ();
|
|
|
|
|
+
|
|
|
|
|
+ $id = Request::param ('id');
|
|
|
|
|
+ if ($id) {
|
|
|
|
|
+ $entry = $entryDAO->searchById ($id);
|
|
|
|
|
+
|
|
|
|
|
+ if ($entry) {
|
|
|
|
|
+ $feed = $entry->feed (true);
|
|
|
|
|
+
|
|
|
|
|
+ if (Request::isPost ()) {
|
|
|
|
|
+ $note = htmlspecialchars (Request::param ('note', ''));
|
|
|
|
|
+ $public = Request::param ('public', 'no');
|
|
|
|
|
+ if ($public == 'yes') {
|
|
|
|
|
+ $public = true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $public = false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $values = array (
|
|
|
|
|
+ 'annotation' => $note,
|
|
|
|
|
+ 'is_public' => $public
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ if ($entryDAO->updateEntry ($id, $values)) {
|
|
|
|
|
+ $notif = array (
|
|
|
|
|
+ 'type' => 'good',
|
|
|
|
|
+ 'content' => 'Modifications enregistrées'
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $notif = array (
|
|
|
|
|
+ 'type' => 'bad',
|
|
|
|
|
+ 'content' => 'Une erreur est survenue'
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ Session::_param ('notification', $notif);
|
|
|
|
|
+ Request::forward (array (
|
|
|
|
|
+ 'c' => 'entry',
|
|
|
|
|
+ 'a' => 'note',
|
|
|
|
|
+ 'params' => array (
|
|
|
|
|
+ 'id' => $id
|
|
|
|
|
+ )
|
|
|
|
|
+ ), true);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $not_found = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $not_found = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($not_found) {
|
|
|
|
|
+ Error::error (
|
|
|
|
|
+ 404,
|
|
|
|
|
+ array ('error' => array ('La page que vous cherchez n\'existe pas'))
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $this->view->entry = $entry;
|
|
|
|
|
+ $this->view->cat_aside = $catDAO->listCategories ();
|
|
|
|
|
+ $this->view->nb_favorites = $entryDAO->countFavorites ();
|
|
|
|
|
+ $this->view->nb_total = $entryDAO->count ();
|
|
|
|
|
+ $this->view->get_c = $feed->category ();
|
|
|
|
|
+ $this->view->get_f = $feed->id ();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|