Fix: changement du fonctionnement de l'encryption

This commit is contained in:
Regis Houssin 2007-04-25 14:16:27 +00:00
parent 872bf3529b
commit b9f7e6768b
2 changed files with 10 additions and 20 deletions

View File

@ -2415,30 +2415,20 @@ function encodedecode_dbpassconf($level=0)
while(!feof($fp))
{
$buffer = fgets($fp,4096);
if (strstr($buffer,"\$dolibarr_main_db_encrypted_pass"))
if (strstr($buffer,"\$dolibarr_main_db_encrypted_pass") && $level == 0)
{
if ($level == 0)
{
$config .= "\$dolibarr_main_db_encrypted_pass=0;\n";
}
else if ($level == 1)
{
$config .= "\$dolibarr_main_db_encrypted_pass=1;\n";
}
$passwd = strstr($buffer,"$dolibarr_main_db_encrypted_pass=");
$passwd = substr(substr($passwd,2),0,-3);
$passwd = dolibarr_decode($passwd);
$config .= "\$dolibarr_main_db_pass=\"$passwd\";\n";
}
else if (strstr($buffer,"\$dolibarr_main_db_pass"))
else if (strstr($buffer,"\$dolibarr_main_db_pass") && $level == 1)
{
$passwd = strstr($buffer,"$dolibarr_main_db_pass=");
$passwd = substr(substr($passwd,2),0,-3);
if ($level == 0)
{
$passwd = dolibarr_decode($passwd);
}
else if ($level == 1)
{
$passwd = dolibarr_encode($passwd);
}
$config .= "\$dolibarr_main_db_pass=\"$passwd\";\n";
$passwd = dolibarr_encode($passwd);
$config .= "\$dolibarr_main_db_encrypted_pass=\"$passwd\";\n";
}
else
{

View File

@ -87,7 +87,7 @@ define('DOL_URL_ROOT', $pos); // URL racine relative
// on décode le mot de passe de la base si besoin
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.inc.php");
if ($dolibarr_main_db_encrypted_pass == 1) $dolibarr_main_db_pass = dolibarr_decode($dolibarr_main_db_pass);
if ($dolibarr_main_db_encrypted_pass) $dolibarr_main_db_pass = dolibarr_decode($dolibarr_main_db_encrypted_pass);
require_once(DOL_DOCUMENT_ROOT."/conf/conf.class.php");