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
00038
00039
00040
00041 if ( isset ($_REQUEST['sa']) )
00042 {
00043 if ( defined ('PG_PATH') )
00044 putenv("PATH=".PG_PATH);
00045
00046
00047 if ( ! isset ($_REQUEST['d']) ||
00048 ! isset($_REQUEST['t']))
00049 {
00050 echo "Erreur : paramètre manquant ";
00051 exit();
00052 }
00053
00054 $sa=$_REQUEST['sa'];
00055
00056 if ( $sa=='b')
00057 {
00058 $cmd=escapeshellcmd (PG_DUMP);
00059 if ( defined ("noalyss_user"))
00060 {
00061 putenv("PGPASSWORD=".noalyss_password);
00062 putenv("PGUSER=".noalyss_user);
00063 putenv("PGHOST=".noalyss_psql_host);
00064 putenv("PGPORT=".noalyss_psql_port);
00065 }else if (defined ("phpcompta_user"))
00066 {
00067 putenv("PGPASSWORD=".phpcompta_password);
00068 putenv("PGUSER=".phpcompta_user);
00069 putenv("PGHOST=".phpcompta_psql_host);
00070 putenv("PGPORT=".phpcompta_psql_port);
00071 } else {
00072 die ('Aucune connection');
00073 }
00074
00075 if ( $_REQUEST['t'] == 'd' )
00076 {
00077 $database=domaine."dossier".$_REQUEST['d'];
00078 $args= " -Fc -Z9 --no-owner -h ".getenv("PGHOST")." -p ".getenv("PGPORT")." ".$database;
00079 header('Content-type: application/octet');
00080 header('Content-Disposition:attachment;filename="'.$database.'.bin"',FALSE);
00081
00082 passthru ($cmd.$args,$a);
00083
00084 }
00085
00086 if ( $_REQUEST['t'] == 'm' )
00087 {
00088 $database=domaine."mod".$_REQUEST['d'];
00089 $args= " -Fc -Z9 --no-owner -h ".getenv("PGHOST")." -p ".getenv("PGPORT")." ".$database;
00090 header('Content-type: bin/x-application');
00091 header('Content-Disposition: attachment;filename="'.$database.'.bin"',FALSE);
00092 $a=passthru ($cmd.$args);
00093 }
00094 }
00095 }
00096