From 52763ed97d0fd3ca96d11cbec361f5f4cf79fec4 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 10 Jul 2014 18:46:38 +0200 Subject: Fix a bug during installation - If MySQL database was configured and user choosed SQLite, an error was raised at the first submit. - Cast STEP into integer --- app/install.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'app/install.php') diff --git a/app/install.php b/app/install.php index 357a8e340..3767e3d91 100644 --- a/app/install.php +++ b/app/install.php @@ -10,13 +10,17 @@ session_set_cookie_params(0, dirname(empty($_SERVER['REQUEST_URI']) ? '/' : dirn session_start(); if (isset ($_GET['step'])) { - define ('STEP', $_GET['step']); + define ('STEP', (int)$_GET['step']); } else { define ('STEP', 1); } define('SQL_CREATE_DB', 'CREATE DATABASE IF NOT EXISTS %1$s DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); +if (STEP === 3 && isset($_POST['type'])) { + $_SESSION['bd_type'] = $_POST['type']; +} + if (isset($_SESSION['bd_type'])) { switch ($_SESSION['bd_type']) { case 'mysql': @@ -216,9 +220,6 @@ function saveStep2 () { function saveStep3 () { if (!empty ($_POST)) { - - $_SESSION['bd_type'] = isset ($_POST['type']) ? $_POST['type'] : ''; - if ($_SESSION['bd_type'] === 'sqlite') { $_SESSION['bd_base'] = $_SESSION['default_user']; $_SESSION['bd_host'] = ''; -- cgit v1.2.3