A free, self-hostable aggregator…
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.0 KiB

12 years ago
<?php
class entryController extends ActionController {
public function firstAction () {
if (login_is_conf ($this->view->conf) && !is_logged ()) {
Error::error (
403,
array ('error' => array ('Vous n\'avez pas le droit d\'accéder à cette page'))
);
}
$ajax = Request::param ('ajax');
if ($ajax) {
$this->view->_useLayout (false);
}
}
public function lastAction () {
$ajax = Request::param ('ajax');
if (!$ajax) {
Request::forward (array (
'c' => 'index',
'a' => 'index',
'params' => $this->params
), true);
} else {
Request::_param ('ajax');
}
}
12 years ago
public function readAction () {
$id = Request::param ('id');
$is_read = Request::param ('is_read');
$get = Request::param ('get');
$dateMax = Request::param ('dateMax', time ());
12 years ago
if ($is_read) {
$is_read = true;
} else {
$is_read = false;
}
$entryDAO = new EntryDAO ();
if ($id == false) {
if (!$get) {
$entryDAO->markReadEntries ($is_read, $dateMax);
} else {
$typeGet = $get[0];
$get = substr ($get, 2);
if ($typeGet == 'c') {
$entryDAO->markReadCat ($get, $is_read, $dateMax);
$this->params = array ('get' => 'c_' . $get);
} elseif ($typeGet == 'f') {
$entryDAO->markReadFeed ($get, $is_read, $dateMax);
$this->params = array ('get' => 'f_' . $get);
}
}
// notif
$notif = array (
'type' => 'good',
'content' => 'Les flux ont été marqués comme lu'
);
Session::_param ('notification', $notif);
12 years ago
} else {
$entryDAO->updateEntry ($id, array ('is_read' => $is_read));
12 years ago
}
}
public function bookmarkAction () {
$id = Request::param ('id');
$is_fav = Request::param ('is_favorite');
if ($is_fav) {
$is_fav = true;
} else {
$is_fav = false;
}
$entryDAO = new EntryDAO ();
if ($id != false) {
$entry = $entryDAO->searchById ($id);
if ($entry != false) {
$values = array (
'is_favorite' => $is_fav,
);
$entryDAO->updateEntry ($entry->id (), $values);
}
}
}
}