]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/config.php
Installation mode
[github/wallabag/wallabag.git] / inc / config.php
index 737f5215a685d55cc5f02d8f6f10528f6465eacd..2de725f4087888dad9c1282e924f87969b068398 100644 (file)
@@ -18,6 +18,7 @@ define ('ABS_PATH', 'assets/');
 define ('CONVERT_LINKS_FOOTNOTES', TRUE);
 define ('REVERT_FORCED_PARAGRAPH_ELEMENTS',FALSE);
 define ('DOWNLOAD_PICTURES', TRUE);
+define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX');
 $storage_type = 'sqlite'; # sqlite or file
 
 include 'functions.php';
@@ -33,9 +34,7 @@ require_once 'class.messages.php';
 
 Session::init();
 
-$store         = new $storage_type();
-$msg   = new Messages();
-
+$store     = new $storage_type();
 # initialisation de RainTPL
 raintpl::$tpl_dir   = './tpl/';
 raintpl::$cache_dir = './cache/';
@@ -43,4 +42,24 @@ raintpl::$base_url  = get_poche_url();
 raintpl::configure('path_replace', false);
 raintpl::configure('debug', false);
 $tpl = new raintpl();
+
+if(!$store->isInstalled())
+{
+    logm('poche still not installed');
+    $tpl->draw('install');
+    if (isset($_GET['install'])) {
+        if (($_POST['password'] == $_POST['password_repeat']) 
+            && $_POST['password'] != "" && $_POST['login'] != "") {
+            $store->install($_POST['login'], encode_string($_POST['password'] . $_POST['login']));
+            Session::logout();
+            MyTool::redirect();
+        }
+    }
+    exit();
+}
+
+$_SESSION['login'] = (isset ($_SESSION['login'])) ? $_SESSION['login'] : $store->getLogin();
+$_SESSION['pass']  = (isset ($_SESSION['pass'])) ? $_SESSION['pass'] : $store->getPassword();
+
+$msg = new Messages();
 $tpl->assign('msg', $msg);
\ No newline at end of file