]>
Commit | Line | Data |
---|---|---|
1a268ba7 NL |
1 | <?php |
2 | /** | |
c95b78a8 | 3 | * wallabag, self hostable application allowing you to not miss any content anymore |
1a268ba7 | 4 | * |
c95b78a8 NL |
5 | * @category wallabag |
6 | * @author Nicolas Lœuillet <nicolas@loeuillet.org> | |
1a268ba7 | 7 | * @copyright 2013 |
3602405e | 8 | * @license http://opensource.org/licenses/MIT see COPYING file |
1a268ba7 NL |
9 | */ |
10 | ||
3602405e | 11 | define ('POCHE', '1.8.0'); |
792097fb | 12 | require 'check_setup.php'; |
00dbaf90 | 13 | require_once 'inc/poche/global.inc.php'; |
bb5a7d9e | 14 | |
752cd4a8 | 15 | |
b3cda72e NL |
16 | use PicoFarad\Router; |
17 | use PicoFarad\Response; | |
18 | use PicoFarad\Request; | |
19 | use PicoFarad\Session; | |
eb5b6772 | 20 | |
b3cda72e NL |
21 | // Called before each action |
22 | Router\before(function($action) { | |
23 | ||
24 | // Open a session only for the specified directory | |
25 | Session\open(dirname($_SERVER['PHP_SELF'])); | |
26 | ||
27 | // HTTP secure headers | |
28 | Response\csp(); | |
29 | Response\xframe(); | |
30 | Response\xss(); | |
31 | Response\nosniff(); | |
32 | }); | |
33 | ||
34 | // Show help | |
35 | Router\get_action('unread', function() use ($wallabag) { | |
36 | $view = 'home'; | |
37 | $id = 0; | |
38 | ||
39 | $tpl_vars = array( | |
40 | 'referer' => $wallabag->routing->referer, | |
41 | 'view' => $wallabag->routing->view, | |
42 | 'poche_url' => Tools::getPocheUrl(), | |
43 | 'title' => _('wallabag, a read it later open source system'), | |
44 | 'token' => \Session::getToken(), | |
45 | 'theme' => $wallabag->tpl->getTheme(), | |
46 | 'entries' => '', | |
47 | 'page_links' => '', | |
48 | 'nb_results' => '', | |
49 | 'listmode' => (isset($_COOKIE['listmode']) ? true : false), | |
50 | ); | |
51 | ||
52 | $count = $wallabag->store->getEntriesByViewCount($view, $wallabag->user->getId(), $id); | |
53 | ||
54 | if ($count > 0) { | |
55 | $wallabag->pagination->set_total($count); | |
56 | $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), | |
57 | $wallabag->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . (($id)?'&id='.$id:'') . '&' )); | |
58 | $tpl_vars['entries'] = $wallabag->store->getEntriesByView($view, $wallabag->user->getId(), $wallabag->pagination->get_limit(), $id); | |
59 | $tpl_vars['page_links'] = $page_links; | |
60 | $tpl_vars['nb_results'] = $count; | |
61 | } | |
62 | ||
63 | $wallabag->routing->render('home.twig', $tpl_vars); | |
64 | ||
65 | Tools::logm('display ' . $view . ' view'); | |
66 | ||
67 | }); |