summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-05-12 16:11:37 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-05-12 16:11:37 +0200
commitc88f57c0360eca7f8f152d35e54872bf845e0ca0 (patch)
treedc7145cc9fa9be4d0e0b30ab48dcd6e507239009
parent8fb61fadd075984c58cc9181e2547eef63e20637 (diff)
Fix issue #83 : affichage d'un message d'erreur si la connexion à la base de données échoue
-rw-r--r--app/i18n/en.php1
-rw-r--r--app/i18n/fr.php1
-rw-r--r--public/install.php12
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 () {
?>
<?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">