]>
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 require_once 'inc/poche/global.inc.php';
15 $notInstalledMessage = $poche -> getNotInstalledMessage();
17 # Parse GET & REFERER vars
18 $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
19 $view = Tools
::checkVar('view', 'home');
20 $action = Tools
::checkVar('action');
21 $id = Tools
::checkVar('id');
22 $_SESSION['sort'] = Tools
::checkVar('sort', 'id');
23 $url = new Url((isset ($_GET['url'])) ? $_GET['url'] : '');
25 # vars to _always_ send to templates
27 'referer' => $referer,
29 'poche_url' => Tools
::getPocheUrl(),
30 'title' => _('poche, a read it later open source system'),
31 'token' => Session
::getToken(),
32 'theme' => $poche->getTheme()
35 if (! empty($notInstalledMessage)) {
36 if (! Poche
::$canRenderTemplates || ! Poche
::$configFileAvailable) {
37 # We cannot use Twig to display the error message
38 echo '<h1>Errors</h1><ol>';
39 foreach ($notInstalledMessage as $message) {
40 echo '<li>' . $message . '</li>';
45 # Twig is installed, put the error message in the template
46 $tpl_file = Tools
::getTplFile('error');
47 $tpl_vars = array_merge($tpl_vars, array('msg' => $poche->getNotInstalledMessage()));
48 echo $poche->tpl
->render($tpl_file, $tpl_vars);
54 if (isset($_GET['login'])) {
56 $poche->login($referer);
57 } elseif (isset($_GET['logout'])) {
60 } elseif (isset($_GET['config'])) {
62 $poche->updatePassword();
63 } elseif (isset($_GET['import'])) {
64 $import = $poche->import($_GET['from']);
65 } elseif (isset($_GET['export'])) {
67 } elseif (isset($_GET['updatetheme'])) {
68 $poche->updateTheme();
70 elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) {
71 $plain_url = new Url(base64_encode($_GET['plainurl']));
72 $poche->action('add', $plain_url);
75 if (Session
::isLogged()) {
76 $poche->action($action, $url, $id);
77 $tpl_file = Tools
::getTplFile($view);
78 $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id));
80 $tpl_file = Tools
::getTplFile('login');
83 # because messages can be added in $poche->action(), we have to add this entry now (we can add it before)
84 $messages = $poche->messages
->display('all', FALSE);
85 $tpl_vars = array_merge($tpl_vars, array('messages' => $messages));
88 echo $poche->tpl
->render($tpl_file, $tpl_vars);