]>
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 if (file_exists(__DIR__
. '/inc/poche/myconfig.inc.php')) {
12 require_once __DIR__
. '/inc/poche/myconfig.inc.php';
14 require_once './inc/poche/Tools.class.php';
15 Tools
::createMyConfig();
17 include dirname(__FILE__
).'/inc/poche/config.inc.php';
19 # Parse GET & REFERER vars
20 $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
21 $view = Tools
::checkVar('view', 'home');
22 $action = Tools
::checkVar('action');
23 $id = Tools
::checkVar('id');
24 $_SESSION['sort'] = Tools
::checkVar('sort', 'id');
25 $url = new Url((isset ($_GET['url'])) ? $_GET['url'] : '');
28 if (isset($_GET['login'])) {
30 $poche->login($referer);
32 elseif (isset($_GET['logout'])) {
36 elseif (isset($_GET['config'])) {
38 $poche->updatePassword();
40 elseif (isset($_GET['import'])) {
41 $import = $poche->import($_GET['from']);
43 elseif (isset($_GET['export'])) {
46 elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) {
47 $plain_url = new Url(base64_encode($_GET['plainurl']));
48 $poche->action('add', $plain_url);
51 # vars to send to templates
53 'referer' => $referer,
55 'poche_url' => Tools
::getPocheUrl(),
56 'title' => _('poche, a read it later open source system'),
57 'token' => Session
::getToken(),
60 if (Session
::isLogged()) {
61 $poche->action($action, $url, $id);
62 $tpl_file = Tools
::getTplFile($view);
63 $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id));
66 $tpl_file = 'login.twig';
69 # because messages can be added in $poche->action(), we have to add this entry now (we can add it before)
70 $messages = $poche->messages
->display('all', FALSE);
71 $tpl_vars = array_merge($tpl_vars, array('messages' => $messages));
74 echo $poche->tpl
->render($tpl_file, $tpl_vars);