]> git.immae.eu Git - github/wallabag/wallabag.git/blame - index.php
Add SHAARLI support to view template
[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
746f93c2
NL
11if (file_exists(__DIR__ . '/inc/poche/myconfig.inc.php')) {
12 require_once __DIR__ . '/inc/poche/myconfig.inc.php';
13}
bb5a7d9e
NL
14require_once './inc/poche/Tools.class.php';
15Tools::createMyConfig();
16
eb1af592 17include dirname(__FILE__).'/inc/poche/config.inc.php';
1a268ba7 18
ed06f040 19# Parse GET & REFERER vars
a4565e88 20$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
7f959169 21$view = Tools::checkVar('view', 'home');
63c35580
NL
22$action = Tools::checkVar('action');
23$id = Tools::checkVar('id');
f6df40db 24$_SESSION['sort'] = Tools::checkVar('sort', 'id');
63c35580 25$url = new Url((isset ($_GET['url'])) ? $_GET['url'] : '');
8c72b98d 26
ed06f040 27# poche actions
a1953dff 28if (isset($_GET['login'])) {
4f5b44bd 29 # hello you
c765c367 30 $poche->login($referer);
a1953dff 31}
32elseif (isset($_GET['logout'])) {
4f5b44bd 33 # see you soon !
c765c367 34 $poche->logout();
a1953dff 35}
c765c367 36elseif (isset($_GET['config'])) {
4f5b44bd 37 # Update password
c765c367
NL
38 $poche->updatePassword();
39}
40elseif (isset($_GET['import'])) {
07ee09f4 41 $import = $poche->import($_GET['from']);
da368cc8 42}
63c35580
NL
43elseif (isset($_GET['export'])) {
44 $poche->export();
45}
a1953dff 46
ed06f040 47# vars to send to templates
a4565e88 48$tpl_vars = array(
a4565e88
NL
49 'referer' => $referer,
50 'view' => $view,
eb1af592 51 'poche_url' => Tools::getPocheUrl(),
a4565e88 52 'title' => _('poche, a read it later open source system'),
8cbb2a88 53 'token' => Session::getToken(),
a4565e88 54);
139769aa 55
e4d2565e 56if (Session::isLogged()) {
eb1af592
NL
57 $poche->action($action, $url, $id);
58 $tpl_file = Tools::getTplFile($view);
59 $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id));
e4d2565e 60}
61else {
8cbb2a88 62 $tpl_file = 'login.twig';
8c72b98d 63}
a4565e88 64
55821e04 65# because messages can be added in $poche->action(), we have to add this entry now (we can add it before)
6a361945
NL
66$messages = $poche->messages->display('all', FALSE);
67$tpl_vars = array_merge($tpl_vars, array('messages' => $messages));
55821e04 68
ed06f040 69# display poche
eb1af592 70echo $poche->tpl->render($tpl_file, $tpl_vars);