A free, self-hostable news aggregator…
Fix issue #83 : affichage d'un message d'erreur si la connexion à la base de données échoue
Marien Fressinaudc88f57c0360e
diff --git a/app/i18n/en.php b/app/i18n/en.phpindex 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.phpindex 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.phpindex 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 () {?><?php $s3 = checkStep3 (); if ($s3['all'] == 'ok') { ?><p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('bdd_conf_is_ok'); ?></p>+ <?php } elseif ($s3['conn'] == 'ko') { ?>+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('bdd_conf_is_ko'); ?></p><?php } ?><form action="index.php?step=3" method="post">