Check(); if ($User->admin != 1) { echo ""; return; } /*!\file * \brief Make and restore backup */ if ( isset ($_REQUEST['sa']) ) { if ( defined ('PG_PATH') ) putenv("PATH=".PG_PATH); if ( ! isset ($_REQUEST['d']) || ! isset($_REQUEST['t'])) { echo "Erreur : paramètre manquant "; exit(); } $sa=$_REQUEST['sa']; // backup if ( $sa=='b') { $cmd=escapeshellcmd (PG_DUMP); putenv("PGPASSWORD=".phpcompta_password); putenv("PGUSER=".phpcompta_user); echo_debug ("commande backup ".$cmd); if ( $_REQUEST['t'] == 'd' ) { $database=domaine."dossier".$_REQUEST['d']; $args= " -Fc -Z9 --no-owner -p ".phpcompta_psql_port." ".$database; header('Content-type: application/octet'); header('Content-Disposition:attachment;filename="'.$database.'.bin"',FALSE); passthru ($cmd.$args,$a); } if ( $_REQUEST['t'] == 'm' ) { $database=domaine."mod".$_REQUEST['d']; $args= " -Fc -Z9 --no-owner -p ".phpcompta_psql_port." ".$database; header('Content-type: bin/x-application'); header('Content-Disposition: attachment;filename="'.$database.'.bin"',FALSE); $a=passthru ($cmd.$args); } } }