From b72ef4d967f0f196398edf315b06023c225b2ff5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 25 Apr 2007 12:41:35 +0000 Subject: [PATCH] Fix: affichage d'un message d'erreur si conf.php est en lecture seule --- htdocs/admin/security.php | 30 ++++++++++++++++++++++++------ htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 31dce5b7ecc..5fcd0b769af 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -36,6 +36,8 @@ if (!$user->admin) accessforbidden(); // Do not allow change to clear model once passwords are crypted $allow_disable_encryption=false; +$mesg = ''; + /* * Actions @@ -90,16 +92,30 @@ else if ($_GET["action"] == 'disable_encrypt') if ($_GET["action"] == 'activate_encryptdbpassconf') { $result = encodedecode_dbpassconf(1); - if ($result > 0) dolibarr_set_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED", "1"); - Header("Location: security.php"); - exit; + if ($result > 0) + { + dolibarr_set_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED", "1"); + Header("Location: security.php"); + exit; + } + else + { + $mesg='
'.$langs->trans('ConfigFilesIsReadOnly').'
'; + } } else if ($_GET["action"] == 'disable_encryptdbpassconf') { $result = encodedecode_dbpassconf(0); - if ($result > 0) dolibarr_del_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED"); - Header("Location: security.php"); - exit; + if ($result > 0) + { + dolibarr_del_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED"); + Header("Location: security.php"); + exit; + } + else + { + $mesg = '
'.$langs->trans('ConfigFilesIsReadOnly').'
'; + } } /* @@ -108,6 +124,8 @@ else if ($_GET["action"] == 'disable_encryptdbpassconf') llxHeader(); +if ($mesg) print "$mesg\n"; + print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("GeneratedPasswordDesc")."
\n"; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b642d232e27..2c94c5aeac0 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -94,6 +94,7 @@ Security=Security Passwords=Passwords DoNotStoreClearPassword=Do no store clear passwords in database MainDbPasswordFileConfEncrypted=Password of the database encrypted in conf.php +ConfigFilesIsReadOnly=The file conf.php is in read only, check the rights. Feature=Feature DolibarrLicense=License DolibarrProjectLeader=Project leader diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 89251b5c5e5..5b665f931d2 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -94,6 +94,7 @@ Security=S Passwords=Mots de passe DoNotStoreClearPassword=Ne pas stocker de mot de passe en clair dans la base MainDbPasswordFileConfEncrypted=Encrypter le mot de passe de la base dans le fichier conf.php +ConfigFilesIsReadOnly=Le fichier conf.php est lecture seule, vérifiez les droits d'écriture. Feature=Fonction DolibarrLicense=Licence DolibarrProjectLeader=Chef de projet