aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2013-04-21 10:53:22 -0700
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2013-04-21 10:53:22 -0700
commit37c6ed4e7a75238504a28d6be5fbaad475689526 (patch)
tree69bfdf8ddbc09467be830274f434190b42979aa1 /index.php
parentff4d8c8c1efca0759330906419cb5f36de86d156 (diff)
parentf0070a15e4725255dad967bde76155a39d189631 (diff)
downloadwallabag-37c6ed4e7a75238504a28d6be5fbaad475689526.tar.gz
wallabag-37c6ed4e7a75238504a28d6be5fbaad475689526.tar.zst
wallabag-37c6ed4e7a75238504a28d6be5fbaad475689526.zip
Merge pull request #67 from inthepoche/dev
tag 0.2
Diffstat (limited to 'index.php')
-rw-r--r--index.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/index.php b/index.php
index 9a81a741..6eefd277 100644
--- a/index.php
+++ b/index.php
@@ -10,8 +10,8 @@
10 10
11include dirname(__FILE__).'/inc/config.php'; 11include dirname(__FILE__).'/inc/config.php';
12 12
13# initialize session 13myTool::initPhp();
14Session::init(); 14
15# XSRF protection with token 15# XSRF protection with token
16if (!empty($_POST)) { 16if (!empty($_POST)) {
17 if (!Session::isToken($_POST['token'])) { 17 if (!Session::isToken($_POST['token'])) {
@@ -20,6 +20,8 @@ if (!empty($_POST)) {
20 unset($_SESSION['tokens']); 20 unset($_SESSION['tokens']);
21} 21}
22 22
23$ref = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
24
23if (isset($_GET['login'])) { 25if (isset($_GET['login'])) {
24 // Login 26 // Login
25 if (!empty($_POST['login']) && !empty($_POST['password'])) { 27 if (!empty($_POST['login']) && !empty($_POST['password'])) {
@@ -34,7 +36,7 @@ if (isset($_GET['login'])) {
34 } 36 }
35 session_regenerate_id(true); 37 session_regenerate_id(true);
36 38
37 MyTool::redirect(); 39 MyTool::redirect($ref);
38 } 40 }
39 logm('login failed'); 41 logm('login failed');
40 die("Login failed !"); 42 die("Login failed !");
@@ -55,12 +57,11 @@ $action = (isset ($_REQUEST['action'])) ? htmlentities($_REQUEST['ac
55$_SESSION['sort'] = (isset ($_REQUEST['sort'])) ? htmlentities($_REQUEST['sort']) : 'id'; 57$_SESSION['sort'] = (isset ($_REQUEST['sort'])) ? htmlentities($_REQUEST['sort']) : 'id';
56$id = (isset ($_REQUEST['id'])) ? htmlspecialchars($_REQUEST['id']) : ''; 58$id = (isset ($_REQUEST['id'])) ? htmlspecialchars($_REQUEST['id']) : '';
57$url = (isset ($_GET['url'])) ? $_GET['url'] : ''; 59$url = (isset ($_GET['url'])) ? $_GET['url'] : '';
58$ref = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
59 60
60$tpl->assign('isLogged', Session::isLogged()); 61$tpl->assign('isLogged', Session::isLogged());
61$tpl->assign('referer', $ref); 62$tpl->assign('referer', $ref);
62$tpl->assign('view', $view); 63$tpl->assign('view', $view);
63$tpl->assign('poche_url', get_poche_url()); 64$tpl->assign('poche_url', myTool::getUrl());
64$tpl->assign('title', 'poche, a read it later open source system'); 65$tpl->assign('title', 'poche, a read it later open source system');
65 66
66if (Session::isLogged()) { 67if (Session::isLogged()) {
@@ -69,4 +70,4 @@ if (Session::isLogged()) {
69} 70}
70else { 71else {
71 $tpl->draw('login'); 72 $tpl->draw('login');
72} \ No newline at end of file 73}