Check(); if ($User->admin != 1) { echo ""; return; } $dossier_number=HtmlInput::default_value_request("d", 0); if ($dossier_number == 0 || isNumber($dossier_number) ==0 ) { die ('Invalid folder number'); } /*!\file * \brief Make and restore backup */ if ( isset ($_REQUEST['sa']) ) { if ( defined ('PG_PATH') ) putenv("PATH=".PG_PATH); if ( ! isset($_REQUEST['t'])) { echo "Erreur : paramètre manquant "; exit(); } $sa=$_REQUEST['sa']; // backup if ( $sa=='b') { $cmd=escapeshellcmd (PG_DUMP); 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); } else { die ('Aucune connection'); } if ( $_REQUEST['t'] == 'd' ) { $database=domaine."dossier".$dossier_number; $args= " -Fc -Z9 --no-owner -h ".getenv("PGHOST")." -p ".getenv("PGPORT")." ".$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".$dossier_number; $args= " -Fc -Z9 --no-owner -h ".getenv("PGHOST")." -p ".getenv("PGPORT")." ".$database; header('Content-type: bin/x-application'); header('Content-Disposition: attachment;filename="'.$database.'.bin"',FALSE); $a=passthru ($cmd.$args); } } }