Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 require_once '../include/constant.php';
00022 require_once("constant.php");
00023 require_once('class_database.php');
00024 require_once ("class_user.php");
00025 require_once ('ac_common.php');
00026
00027 $rep=new Database();
00028 $User=new User($rep);
00029 $User->Check();
00030
00031
00032 if ($User->admin != 1)
00033 {
00034 echo "<script>alert('"._("Vous n\'êtes pas administrateur")."') </script>";
00035 return;
00036 }
00037 $dossier_number=HtmlInput::default_value_request("d", 0);
00038 if ($dossier_number == 0
00039 || isNumber($dossier_number) ==0 ) {
00040 die ('Invalid folder number');
00041 }
00042
00043
00044
00045 if ( isset ($_REQUEST['sa']) )
00046 {
00047 if ( defined ('PG_PATH') )
00048 putenv("PATH=".PG_PATH);
00049
00050
00051 if ( ! isset($_REQUEST['t']))
00052 {
00053 echo "Erreur : paramètre manquant ";
00054 exit();
00055 }
00056
00057 $sa=$_REQUEST['sa'];
00058
00059 if ( $sa=='b')
00060 {
00061 $cmd=escapeshellcmd (PG_DUMP);
00062 if ( defined ("noalyss_user"))
00063 {
00064 putenv("PGPASSWORD=".noalyss_password);
00065 putenv("PGUSER=".noalyss_user);
00066 putenv("PGHOST=".noalyss_psql_host);
00067 putenv("PGPORT=".noalyss_psql_port);
00068 }else if (defined ("phpcompta_user"))
00069 {
00070 putenv("PGPASSWORD=".phpcompta_password);
00071 putenv("PGUSER=".phpcompta_user);
00072 putenv("PGHOST=".phpcompta_psql_host);
00073 putenv("PGPORT=".phpcompta_psql_port);
00074 } else {
00075 die ('Aucune connection');
00076 }
00077
00078 if ( $_REQUEST['t'] == 'd' )
00079 {
00080 $database=domaine."dossier".$dossier_number;
00081 $args= " -Fc -Z9 --no-owner -h ".getenv("PGHOST")." -p ".getenv("PGPORT")." ".$database;
00082 header('Content-type: application/octet');
00083 header('Content-Disposition:attachment;filename="'.$database.'.bin"',FALSE);
00084
00085 passthru ($cmd.$args,$a);
00086
00087 }
00088
00089 if ( $_REQUEST['t'] == 'm' )
00090 {
00091 $database=domaine."mod".$dossier_number;
00092 $args= " -Fc -Z9 --no-owner -h ".getenv("PGHOST")." -p ".getenv("PGPORT")." ".$database;
00093 header('Content-type: bin/x-application');
00094 header('Content-Disposition: attachment;filename="'.$database.'.bin"',FALSE);
00095 $a=passthru ($cmd.$args);
00096 }
00097 }
00098 }
00099