X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=d400354d2fd2a92bae540ae38e6c2e7511814d85;hb=027b4e156853b4d5e358e19e83506ec4446de7ab;hp=1cb32f58ca9ca5358abecafb21ab4f5da9ed364a;hpb=263d6c6756a2549100ae186042f157ff64944bfa;p=github%2Fwallabag%2Fwallabag.git diff --git a/index.php b/index.php old mode 100755 new mode 100644 index 1cb32f58..d400354d --- a/index.php +++ b/index.php @@ -8,19 +8,96 @@ * @license http://www.wtfpl.net/ see COPYING file */ -include dirname(__FILE__).'/inc/config.php'; - -$action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : ''; -$view = (isset ($_GET['view'])) ? htmlspecialchars($_GET['view']) : 'index'; -$id = (isset ($_GET['id'])) ? htmlspecialchars($_GET['id']) : ''; -$url = (isset ($_GET['url'])) ? $_GET['url'] : ''; - -action_to_do($action, $id); -$entries = display_view($view); - -$tpl->assign('title', 'poche, a read it later open source system'); -$tpl->assign('view', $view); -$tpl->assign('poche_url', get_poche_url()); -$tpl->assign('entries', $entries); -$tpl->assign('load_all_js', 1); -$tpl->draw('home'); \ No newline at end of file +define ('POCHE', '1.0.0'); +require_once 'inc/poche/global.inc.php'; +session_start(); + +# Start Poche +$poche = new Poche(); +$notInstalledMessage = $poche -> getNotInstalledMessage(); + +# Parse GET & REFERER vars +$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']; +$view = Tools::checkVar('view', 'home'); +$action = Tools::checkVar('action'); +$id = Tools::checkVar('id'); +$_SESSION['sort'] = Tools::checkVar('sort', 'id'); +$url = new Url((isset ($_GET['url'])) ? $_GET['url'] : ''); + +# vars to _always_ send to templates +$tpl_vars = array( + 'referer' => $referer, + 'view' => $view, + 'poche_url' => Tools::getPocheUrl(), + 'title' => _('poche, a read it later open source system'), + 'token' => Session::getToken(), + 'theme' => $poche->getTheme() +); + +if (! empty($notInstalledMessage)) { + if (! Poche::$canRenderTemplates || ! Poche::$configFileAvailable) { + # We cannot use Twig to display the error message + echo '