-if ($action != '') {
- action_to_do($action, $id, $url, $token);
+# template engine
+Twig_Autoloader::register();
+$loader = new Twig_Loader_Filesystem(TPL);
+$twig = new Twig_Environment($loader, array(
+ 'cache' => CACHE,
+));
+$twig->addExtension(new Twig_Extensions_Extension_I18n());
+
+Session::init();
+$store = new $storage_type();
+
+# installation
+if(!$store->isInstalled())
+{
+ pocheTools::logm('poche still not installed');
+ echo $twig->render('install.twig', array(
+ 'token' => Session::getToken(),
+ ));
+ if (isset($_GET['install'])) {
+ if (($_POST['password'] == $_POST['password_repeat'])
+ && $_POST['password'] != "" && $_POST['login'] != "") {
+ # let's rock, install poche baby !
+ $store->install($_POST['login'], encode_string($_POST['password'] . $_POST['login']));
+ Session::logout();
+ pocheTools::redirect();
+ }
+ }
+ exit();