Parcourir la source

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
Marien Fressinaud il y a 11 ans
Parent
commit
52763ed97d
1 fichiers modifiés avec 5 ajouts et 4 suppressions
  1. 5 4
      app/install.php

+ 5 - 4
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'] = '';