<?php 
require_once("../../base/php/startSession.php");
require_once("../../base/php//classDatabase.php");
require_once("../../base/php/Functions.php");
require_once("../../base/php/WebAppLog.php");

global $database;
global $finess;
global $typeEts;
global $tmp_path;
global $in_file;

set_time_limit(3600);
ini_set('memory_limit','256M');


$in_file = @$_POST["file"];
if ($in_file == "") {
	$in_file = @$_GET["file"];
}


initializeDir();


$tmp_path = "../../../temp";


$returnCode = "OK";
$returnTexte = "";

clear_imports();


$httpString = "";
$httpString = $httpString . "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
$httpString = $httpString . "\n<HTTP_SERVICE returnCode=\"$returnCode\" returnTexte=\"$returnTexte\" >";
$httpString = $httpString . "\n</HTTP_SERVICE>";
 

$httpString = gzcompress($httpString,9);
$httpString = "_c_" . base64_encode($httpString); 

echo "<CTICONTENT>$httpString</CTICONTENT>";





// récupération historique
function clear_imports() {

	global $tmp_path;
	global $in_file;

	global $ENV_TYPEETS;
	global $ZIPS_array;
	
	$httpString = "";

	
	$ZIPS_array = array();
	
	
	$path = $tmp_path;
	$rep=@opendir($path);
	if ($rep > 0) {
		while ($file = readdir($rep)){
			if($file != '..' && $file !='.' && $file !=''  ){
				$longFile = $path . '/' . $file;
			
				$fileType = "";
				$path_parts = pathinfo($longFile);

				$fileType =  strtoupper($path_parts['extension']);
				if (is_dir($longFile)) {
					$fileType = "DIR";
				}
				
				if ($file == $in_file || $in_file == "*ALL") {
					@unlink($longFile);
				}
			}
		}
	}
	@closedir($rep);


}



function initializeDir() {
	
	if (! file_exists("../../../temp")) {
		@mkdir("../../../temp");
	}

}





?> 