From aa8c9f2a32ea75278d52c86c6a3a39d34bce5cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 31 May 2013 22:55:52 +0200 Subject: Installation mode --- inc/config.php | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'inc/config.php') diff --git a/inc/config.php b/inc/config.php index 737f5215..2de725f4 100644 --- a/inc/config.php +++ b/inc/config.php @@ -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 -- cgit v1.2.3