]> git.immae.eu Git - github/wallabag/wallabag.git/blame - index.php
empty phpunit file
[github/wallabag/wallabag.git] / index.php
CommitLineData
1a268ba7
NL
1<?php
2/**
3 * poche, a read it later open source system
4 *
5 * @category poche
421b65eb 6 * @author Nicolas Lœuillet <support@inthepoche.com>
1a268ba7
NL
7 * @copyright 2013
8 * @license http://www.wtfpl.net/ see COPYING file
9 */
10
eb1af592 11include dirname(__FILE__).'/inc/poche/config.inc.php';
1a268ba7 12
ed06f040 13# Parse GET & REFERER vars
a4565e88 14$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
7f959169 15$view = Tools::checkVar('view', 'home');
63c35580
NL
16$action = Tools::checkVar('action');
17$id = Tools::checkVar('id');
f6df40db 18$_SESSION['sort'] = Tools::checkVar('sort', 'id');
63c35580 19$url = new Url((isset ($_GET['url'])) ? $_GET['url'] : '');
8c72b98d 20
ed06f040 21# poche actions
a1953dff 22if (isset($_GET['login'])) {
4f5b44bd 23 # hello you
c765c367 24 $poche->login($referer);
a1953dff 25}
26elseif (isset($_GET['logout'])) {
4f5b44bd 27 # see you soon !
c765c367 28 $poche->logout();
a1953dff 29}
c765c367 30elseif (isset($_GET['config'])) {
4f5b44bd 31 # Update password
c765c367
NL
32 $poche->updatePassword();
33}
34elseif (isset($_GET['import'])) {
07ee09f4 35 $import = $poche->import($_GET['from']);
da368cc8 36}
63c35580
NL
37elseif (isset($_GET['export'])) {
38 $poche->export();
39}
a1953dff 40
ed06f040 41# vars to send to templates
a4565e88 42$tpl_vars = array(
a4565e88
NL
43 'referer' => $referer,
44 'view' => $view,
eb1af592 45 'poche_url' => Tools::getPocheUrl(),
a4565e88 46 'title' => _('poche, a read it later open source system'),
8cbb2a88 47 'token' => Session::getToken(),
a4565e88 48);
139769aa 49
e4d2565e 50if (Session::isLogged()) {
eb1af592
NL
51 $poche->action($action, $url, $id);
52 $tpl_file = Tools::getTplFile($view);
53 $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id));
e4d2565e 54}
55else {
8cbb2a88 56 $tpl_file = 'login.twig';
8c72b98d 57}
a4565e88 58
55821e04 59# because messages can be added in $poche->action(), we have to add this entry now (we can add it before)
6a361945
NL
60$messages = $poche->messages->display('all', FALSE);
61$tpl_vars = array_merge($tpl_vars, array('messages' => $messages));
55821e04 62
ed06f040 63# display poche
eb1af592 64echo $poche->tpl->render($tpl_file, $tpl_vars);