From c88f57c0360eca7f8f152d35e54872bf845e0ca0 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 12 May 2013 16:11:37 +0200 Subject: Fix issue #83 : affichage d'un message d'erreur si la connexion à la base de données échoue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/i18n/en.php | 1 + app/i18n/fr.php | 1 + public/install.php | 12 +++++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/i18n/en.php b/app/i18n/en.php index a78604c3e..52a1674ba 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -259,6 +259,7 @@ return array ( 'do_not_change_if_doubt' => 'Don\'t change if you doubt about it', 'bdd_conf_is_ok' => 'Database configuration has been saved.', + 'bdd_conf_is_ko' => 'Verify your database information.', 'host' => 'Host', 'username' => 'Username', 'password' => 'Password', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 33f094c21..74dfaf8be 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -259,6 +259,7 @@ return array ( 'do_not_change_if_doubt' => 'Laissez tel quel dans le doute', 'bdd_conf_is_ok' => 'La configuration de la base de données a été enregistrée.', + 'bdd_conf_is_ko' => 'Vérifiez les informations d\'accès à la base de données.', 'host' => 'Hôte', 'username' => 'Nom utilisateur', 'password' => 'Mot de passe', diff --git a/public/install.php b/public/install.php index 52b129a70..930241496 100644 --- a/public/install.php +++ b/public/install.php @@ -168,9 +168,8 @@ function saveStep3 () { if (!empty ($_POST)) { if (empty ($_POST['host']) || empty ($_POST['user']) || - empty ($_POST['pass']) || empty ($_POST['base'])) { - return false; + $_SESSION['bd_error'] = true; } $_SESSION['bd_host'] = $_POST['host']; @@ -196,7 +195,10 @@ function saveStep3 () { $res = checkBD (); if ($res) { + $_SESSION['bd_error'] = false; header ('Location: index.php?step=4'); + } else { + $_SESSION['bd_error'] = true; } } } @@ -275,11 +277,13 @@ function checkStep3 () { isset ($_SESSION['bd_user']) && isset ($_SESSION['bd_pass']) && isset ($_SESSION['bd_name']); + $conn = !isset ($_SESSION['bd_error']) || !$_SESSION['bd_error']; return array ( 'bd' => $bd ? 'ok' : 'ko', + 'conn' => $conn ? 'ok' : 'ko', 'conf' => $conf ? 'ok' : 'ko', - 'all' => $bd && $conf ? 'ok' : 'ko' + 'all' => $bd && $conn && $conf ? 'ok' : 'ko' ); } function checkBD () { @@ -467,6 +471,8 @@ function printStep3 () { ?>

+ +

-- cgit v1.2.3