]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - index.php
3 * poche, a read it later open source system
6 * @author Nicolas Lœuillet <support@inthepoche.com>
8 * @license http://www.wtfpl.net/ see COPYING file
11 include dirname(__FILE__
).'/inc/config.php';
15 # XSRF protection with token
17 if (!Session
::isToken($_POST['token'])) {
20 unset($_SESSION['tokens']);
23 $ref = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
25 if (isset($_GET['login'])) {
27 if (!empty($_POST['login']) && !empty($_POST['password'])) {
28 if (Session
::login($_SESSION['login'], $_SESSION['pass'], $_POST['login'], encode_string($_POST['password'] . $_POST['login']))) {
29 logm('login successful');
30 $msg->add('s', 'welcome in your poche!');
31 if (!empty($_POST['longlastingsession'])) {
32 $_SESSION['longlastingsession'] = 31536000;
33 $_SESSION['expires_on'] = time() +
$_SESSION['longlastingsession'];
34 session_set_cookie_params($_SESSION['longlastingsession']);
36 session_set_cookie_params(0); // when browser closes
38 session_regenerate_id(true);
40 MyTool
::redirect($ref);
43 die("Login failed !");
48 elseif (isset($_GET['logout'])) {
53 elseif (isset($_GET['config'])) {
54 if (isset($_POST['password']) && isset($_POST['password_repeat'])) {
55 if ($_POST['password'] == $_POST['password_repeat'] && $_POST['password'] != "") {
56 logm('password updated');
58 $store->updatePassword(encode_string($_POST['password'] . $_SESSION['login']));
59 $msg->add('s', 'your password has been updated');
62 $msg->add('i', 'in demo mode, you can\'t update password');
66 $msg->add('e', 'your password can\'t be empty and you have to repeat it in the second field');
70 # Traitement des paramètres et déclenchement des actions
71 $view = (isset ($_REQUEST['view'])) ? htmlentities($_REQUEST['view']) : 'index';
72 $full_head = (isset ($_REQUEST['full_head'])) ? htmlentities($_REQUEST['full_head']) : 'yes';
73 $action = (isset ($_REQUEST['action'])) ? htmlentities($_REQUEST['action']) : '';
74 $_SESSION['sort'] = (isset ($_REQUEST['sort'])) ? htmlentities($_REQUEST['sort']) : 'id';
75 $id = (isset ($_REQUEST['id'])) ? htmlspecialchars($_REQUEST['id']) : '';
76 $url = (isset ($_GET['url'])) ? $_GET['url'] : '';
78 $tpl->assign('isLogged', Session
::isLogged());
79 $tpl->assign('referer', $ref);
80 $tpl->assign('view', $view);
81 $tpl->assign('poche_url', myTool
::getUrl());
82 $tpl->assign('title', 'poche, a read it later open source system');
84 if (Session
::isLogged()) {
85 action_to_do($action, $url, $id);
86 display_view($view, $id, $full_head);