task #0001372: Backup - nom du fichier

Bug modele.inc.php
This commit is contained in:
Dany De Bontridder 2017-09-14 22:35:25 +02:00
parent 4feba4e5ed
commit 9da90df28b
2 changed files with 18 additions and 4 deletions

View file

@ -63,13 +63,21 @@ if ( isset ($_REQUEST['sa']) )
} else {
die ('Aucune connection');
}
$repo=new Database(0);
// compute file name with date
if ( $_REQUEST['t'] == 'd' )
{
// get folder name
$name = $repo->get_value("select dos_name from ac_dossier where dos_id=$1",
array($dossier_number));
$database=domaine."dossier".$dossier_number;
$filename= str_replace(array('/','\\' ,'<','>','"','[',']',':','*',' ','{','}','&'),'_', $name);
$filename= str_replace("__", "_", $filename);
$filename.="-".date('Ymd');
$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);
header('Content-Disposition:attachment;filename="'.$filename.'.bin"',FALSE);
passthru ($cmd.$args,$a);
@ -77,10 +85,16 @@ if ( isset ($_REQUEST['sa']) )
if ( $_REQUEST['t'] == 'm' )
{
// get template name
$name = $repo->get_value("select mod_name from modeledef where mod_id=$1",
array($dossier_number));
$database=domaine."mod".$dossier_number;
$filename= str_replace(array('/','\\' ,'<','>','"','[',']',':','*',' ','{','}','&'),'_', $name);
$filename= str_replace("__", "_", $filename);
$filename.="-".date('Ymd');
$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);
header('Content-Disposition: attachment;filename="'.$filename.'.bin"',FALSE);
$a=passthru ($cmd.$args);
}
}

View file

@ -53,7 +53,7 @@ if (isset($_POST['upd']) &&
$cn = new Database();
$fmod_dbid=$http->post("FMOD_DBID");
$fmod_dbid=$http->post("FMOD_DBID","number",0);
// IF FMOD_NAME is posted then must add a template
if (isset($_POST["FMOD_NAME"]))