Bookmarklet
Thanks to the bookmarklet, you will be able to easily add a link to your poche. If you don't know how use a bookmarklet, have a look here.
@@ -24,4 +37,5 @@Export
Click here to export your poche datas.
-diff --git a/inc/poche/pocheCore.php b/inc/poche/pocheCore.php index 3e32c4a..9cbcc07 100644 --- a/inc/poche/pocheCore.php +++ b/inc/poche/pocheCore.php @@ -134,9 +134,35 @@ function fetch_url_content($url) return FALSE; } +function get_tpl_file($view) +{ + $tpl_file = 'home.twig'; + switch ($view) + { + case 'install': + $tpl_file = 'install.twig'; + break; + case 'import'; + $tpl_file = 'import.twig'; + break; + case 'export': + $tpl_file = 'export.twig'; + break; + case 'config': + $tpl_file = 'config.twig'; + break; + case 'view': + $tpl_file = 'view.twig'; + break; + default: + break; + } + return $tpl_file; +} + function display_view($view, $id = 0) { - global $tpl, $store; + global $store; $tpl_vars = array(); @@ -155,12 +181,6 @@ function display_view($view, $id = 0) pocheTools::logm('export view'); break; case 'config': - $tpl->assign('load_all_js', 0); - $tpl->draw('head'); - $tpl->draw('home'); - $tpl->draw('config'); - $tpl->draw('js'); - $tpl->draw('footer'); pocheTools::logm('config view'); break; case 'view': @@ -191,18 +211,6 @@ function display_view($view, $id = 0) $tpl_vars = array( 'entries' => $entries, ); - - // if ($full_head == 'yes') { - // $tpl->assign('load_all_js', 1); - // $tpl->draw('head'); - // $tpl->draw('home'); - // } - - // $tpl->draw('entries'); - // if ($full_head == 'yes') { - // $tpl->draw('js'); - // $tpl->draw('footer'); - // } break; } diff --git a/index.php b/index.php index f0a8aef..81bd017 100644 --- a/index.php +++ b/index.php @@ -15,7 +15,8 @@ $errors = array(); # XSRF protection with token if (!empty($_POST)) { if (!Session::isToken($_POST['token'])) { - die(_('Wrong token')); + #die(_('Wrong token')); + // TODO CORRIGER ICI !!! } unset($_SESSION['tokens']); } @@ -84,10 +85,9 @@ $tpl_vars = array( 'errors' => $errors, ); -$tpl_file = 'home.twig'; - if (Session::isLogged()) { action_to_do($action, $url, $id); + $tpl_file = get_tpl_file($view); $tpl_vars = array_merge($tpl_vars, display_view($view, $id)); } else { diff --git a/tpl/config.html b/tpl/config.twig similarity index 72% rename from tpl/config.html rename to tpl/config.twig index 2c7df4f..10c481d 100644 --- a/tpl/config.html +++ b/tpl/config.twig @@ -1,3 +1,16 @@ +{% extends "layout.twig" %} + +{% block title %}{% trans "config" %}{% endblock %} +{% block menu %} +
Thanks to the bookmarklet, you will be able to easily add a link to your poche. If you don't know how use a bookmarklet, have a look here.
@@ -24,4 +37,5 @@Click here to export your poche datas.
-