diff --git a/html/backup.php b/html/backup.php index f2a751fbd..e49464bbf 100644 --- a/html/backup.php +++ b/html/backup.php @@ -56,10 +56,20 @@ if ( isset ($_REQUEST['sa']) ) if ( $sa=='b') { $cmd=escapeshellcmd (PG_DUMP); - putenv("PGPASSWORD=".noalyss_password); - putenv("PGUSER=".noalyss_user); - putenv("PGHOST=".noalyss_psql_host); - putenv("PGPORT=".noalyss_psql_port); + if ( defined ("noalyss_user")) + { + putenv("PGPASSWORD=".noalyss_password); + putenv("PGUSER=".noalyss_user); + putenv("PGHOST=".noalyss_psql_host); + putenv("PGPORT=".noalyss_psql_port); + }else if (defined ("phpcompta_user")) + { + putenv("PGPASSWORD=".phpcompta_password); + putenv("PGUSER=".phpcompta_user); + putenv("PGHOST=".phpcompta_psql_host); + putenv("PGPORT=".phpcompta_psql_port); + } + if ( $_REQUEST['t'] == 'd' ) { $database=domaine."dossier".$_REQUEST['d']; diff --git a/include/class_database.php b/include/class_database.php index cdb5d9647..70bfc78e8 100644 --- a/include/class_database.php +++ b/include/class_database.php @@ -42,9 +42,9 @@ class Database function __construct ($p_database_id=0,$p_type='dos') { if ( IsNumber($p_database_id) == false || strlen($p_database_id) > 5 ) die ("-->Dossier invalide [$p_database_id]"); - $noalyss_user=noalyss_user; - $password=noalyss_password; - $port=noalyss_psql_port; + $noalyss_user=(defined ("noalyss_user"))?noalyss_user:phpcompta_user; + $password=(defined("noalyss_password"))?noalyss_password:phpcompta_password; + $port=(defined("noalyss_psql_port"))?noalyss_psql_port:phpcompta_psql_port; $host=( ! defined ("noalyss_psql_host"))?'127.0.0.1':noalyss_psql_host; if (defined ("MULTI") && MULTI=="0") { $noalyss_user = noalyss_user; diff --git a/include/restore.inc.php b/include/restore.inc.php index 153f3b2d6..ab96f3f45 100644 --- a/include/restore.inc.php +++ b/include/restore.inc.php @@ -31,10 +31,19 @@ if ( isset ($_REQUEST['sa'] )) putenv("PATH=".PG_PATH); $cmd=escapeshellcmd (PG_RESTORE); - putenv("PGPASSWORD=".noalyss_password); - putenv("PGUSER=".noalyss_user); - putenv("PGPORT=".noalyss_psql_port); - putenv("PGHOST=").noalyss_psql_host; + if (defined("noalyss_user")) + { + putenv("PGPASSWORD=" . noalyss_password); + putenv("PGUSER=" . noalyss_user); + putenv("PGHOST=" . noalyss_psql_host); + putenv("PGPORT=" . noalyss_psql_port); + } else if (defined("phpcompta_user")) + { + putenv("PGPASSWORD=" . phpcompta_password); + putenv("PGUSER=" . phpcompta_user); + putenv("PGHOST=" . phpcompta_psql_host); + putenv("PGPORT=" . phpcompta_psql_port); + } $retour='
'.HtmlInput::button_anchor("Retour","?action=restore"); if ( ! isset($_REQUEST['t']))