]> git.immae.eu Git - github/wallabag/wallabag.git/blame_incremental - index.php
remove xsrf check
[github/wallabag/wallabag.git] / index.php
... / ...
CommitLineData
1<?php
2/**
3 * poche, a read it later open source system
4 *
5 * @category poche
6 * @author Nicolas LÅ“uillet <support@inthepoche.com>
7 * @copyright 2013
8 * @license http://www.wtfpl.net/ see COPYING file
9 */
10
11include dirname(__FILE__).'/inc/poche/config.inc.php';
12
13#XSRF protection with token
14// if (!empty($_POST)) {
15// if (!Session::isToken($_POST['token'])) {
16// die(_('Wrong token'));
17// }
18// unset($_SESSION['tokens']);
19// }
20
21$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
22$view = Tools::checkVar('view', 'home');
23$action = Tools::checkVar('action');
24$id = Tools::checkVar('id');
25$_SESSION['sort'] = Tools::checkVar('sort');
26$url = new Url((isset ($_GET['url'])) ? $_GET['url'] : '');
27
28if (isset($_GET['login'])) {
29 # hello you
30 $poche->login($referer);
31}
32elseif (isset($_GET['logout'])) {
33 # see you soon !
34 $poche->logout();
35}
36elseif (isset($_GET['config'])) {
37 # Update password
38 $poche->updatePassword();
39}
40elseif (isset($_GET['import'])) {
41 $poche->import($_GET['from']);
42}
43elseif (isset($_GET['export'])) {
44 $poche->export();
45}
46
47$tpl_vars = array(
48 'referer' => $referer,
49 'view' => $view,
50 'poche_url' => Tools::getPocheUrl(),
51 'title' => _('poche, a read it later open source system'),
52 'token' => Session::getToken(),
53);
54
55if (Session::isLogged()) {
56 $poche->action($action, $url, $id);
57 $tpl_file = Tools::getTplFile($view);
58 $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id));
59}
60else {
61 $tpl_file = 'login.twig';
62}
63
64# Aaaaaaand action !
65echo $poche->tpl->render($tpl_file, $tpl_vars);