class.tx_nG6_eid.php 16.8 KB
Newer Older
Jerome Mariette's avatar
Jerome Mariette committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

// Inclusion des librairies nécessaires
require_once(PATH_t3lib.'class.t3lib_befunc.php');
require_once(PATH_t3lib.'stddb/tables.php');
require_once(t3lib_extMgm::extPath('cms','ext_tables.php'));
require_once(PATH_t3lib.'class.t3lib_db.php');

class tx_nG6_eid {


    /* Méthode principale */
    function main() {

    	/* connect to the databse */
    	tslib_eidtools::connectDB();
Jerome Mariette's avatar
Jerome Mariette committed
17
    	
Jerome Mariette's avatar
Jerome Mariette committed
18
19
20
21
22
23
24
25
    	$html = '';
    	$id = trim(t3lib_div::_GP('id'));
    	$type = trim(t3lib_div::_GP('type'));
    	
    	if ($type == 'project') {    	
	    	// First all project runs
	    	$p_runs = $this->get_project_runs($id);
			foreach($p_runs as $run_id => $run_values) {
Jerome Mariette's avatar
Jerome Mariette committed
26
				$html .= '<li class="jstree-closed" name=\''.str_replace(array('###SPAN_NAME###', '###SPAN_DATE###'), array($run_values["name"], strftime('%d-%m-%y',$run_values["date"])), trim(t3lib_div::_GP('short_run_printing'))).'\' id=\''.$run_id.'\'> <a href=\'#\'>'.str_replace(array('###SPAN_NAME###', '###SPAN_DATE###', '###SPAN_NB_SEQ###', '###SPAN_SPECIES###'), array($run_values["name"], strftime('%d-%m-%y',$run_values["date"]), $run_values["nb_sequences"], $run_values["species"]), trim(t3lib_div::_GP('run_printing'))).'</a></li>';
Jerome Mariette's avatar
Jerome Mariette committed
27
28
29
30
			}
	    	// Then all project analysis
	    	$p_analysis = $this->get_project_analysis($id);
			foreach($p_analysis as $analyse_id => $analyse_values) {  
Jerome Mariette's avatar
Jerome Mariette committed
31
				$html .= '<li name=\''.str_replace(array('###SPAN_NAME###'), array($analyse_values["name"]), trim(t3lib_div::_GP('analyse_printing'))).'\' id=\''.$analyse_id.'\'> <a href=\'#\'>'.str_replace(array('###SPAN_NAME###'), array($analyse_values["name"]), trim(t3lib_div::_GP('analyse_printing'))).'</a></li>';
Jerome Mariette's avatar
Jerome Mariette committed
32
33
34
35
36
			}
	    	print $html;
    	} else if ($type == 'run'){
			
			$r_analysis = $this->get_run_analysis($id);
Jerome Mariette's avatar
Jerome Mariette committed
37
			$run_info = $this->get_run($id);
Jerome Mariette's avatar
Jerome Mariette committed
38
			
Jerome Mariette's avatar
Jerome Mariette committed
39
			$html .= '<li name=\'run_'.$id.'_'.trim(t3lib_div::_GP("raw_data_label")).'\'  id=\'data_'.$id.'\'> <a href=\'#\'>'.trim(t3lib_div::_GP("raw_data_label")).'</a></li>';
Jerome Mariette's avatar
Jerome Mariette committed
40
			foreach($r_analysis as $analyse_id => $analyse_values) {   
Jerome Mariette's avatar
Jerome Mariette committed
41
				$html .= '<li name=\'run_'.$id.'_'.str_replace(array('###SPAN_NAME###'), array($analyse_values["name"]), trim(t3lib_div::_GP('analyse_printing'))).'\' id=\''.$analyse_id.'\'> <a href=\'#\'>'.str_replace(array('###SPAN_NAME###'), array($analyse_values["name"]), trim(t3lib_div::_GP('analyse_printing'))).'</a></li>';
Jerome Mariette's avatar
Jerome Mariette committed
42
43
			}
	    	print $html;
Jerome Mariette's avatar
Jerome Mariette committed
44
45
46
47
48
    	} else if ($type == 'download') {
			$ids = trim(t3lib_div::_GP('ids'));
			$data_folder = trim(t3lib_div::_GP('data_folder'));
			$tmp_folder = trim(t3lib_div::_GP('tmp_folder'));
    		print $this->get_download_file($ids, $data_folder, $tmp_folder);
Jerome Mariette's avatar
Jerome Mariette committed
49
50
    	}
    }
Jerome Mariette's avatar
Jerome Mariette committed
51
52
53
54
55
56
57
58
59
60
61
62
63
	
	function get_download_file($ids, $data_folder, $tmp_folder) {
		$src_directories = Array();
		$dest_directories = Array();
		$vals = split(";", $ids);
		$temporary_dir = $this->createRandomArchiveName($tmp_folder);
		foreach($vals as $val) {
			if ($val != "undefined" && $val != "") {
				$id = split("_", $val);
				if ($id[0] == "data") {
					$run = $this->get_run($id[1]);
					if (!in_array($data_folder.$run["directory"], $src_directories)) {
						$src_directories[] = $data_folder.$run["directory"];
64
						$dest_directories[] = $temporary_dir."/Project_".str_replace(' ', '_', $run["project_name"]).'.'.$run["project_id"]."/Run_".str_replace(' ', '_', $run["name"]).".".$id[1]."/RawData";
Jerome Mariette's avatar
Jerome Mariette committed
65
66
67
68
69
					}
				} else if ($id[0] == "run") {
					$run = $this->get_run($id[1]);
					if (!in_array($data_folder.$run["directory"], $src_directories)) {
						$src_directories[] = $data_folder.$run["directory"];
70
						$dest_directories[] = $temporary_dir."/Project_".str_replace(' ', '_', $run["project_name"]).'.'.$run["project_id"]."/Run_".str_replace(' ', '_', $run["name"]).".".$id[1]."/RawData";
Jerome Mariette's avatar
Jerome Mariette committed
71
72
73
74
					}
					foreach($this->get_run_analysis($id[1]) as $analyse_id => $analyse_values) {
						if (!in_array($data_folder.$analyse_values["directory"], $src_directories)) {
							$src_directories[] = $data_folder.$analyse_values["directory"];
75
76
							$aid = split("_", $analyse_id);
							$dest_directories[] = $temporary_dir."/Project_".str_replace(' ', '_', $run["project_name"]).'.'.$run["project_id"]."/Run_".str_replace(' ', '_', $run["name"]).".".$id[1]."/Analyse_".str_replace(' ', '_', $analyse_values["name"]).".".$aid;
Jerome Mariette's avatar
Jerome Mariette committed
77
78
79
80
81
82
83
84
						}
					}
				} else if ($id[0] == "analyse") {
					$analyse = $this->get_analyse($id[1]);
					if (!in_array($data_folder.$analyse["directory"], $src_directories)) {
						$src_directories[] = $data_folder.$analyse["directory"];
						// If it's a project analyse
						if ($analyse["run_id"] == 'None') {
85
							$dest_directories[] = $temporary_dir."/Project_".str_replace(' ', '_', $analyse["project_name"]).".".$analyse["project_id"]."/Project_analyses/".str_replace(' ', '_', $analyse["name"]).".".$id[1];
Jerome Mariette's avatar
Jerome Mariette committed
86
						} else {
87
							$dest_directories[] = $temporary_dir."/Project_".str_replace(' ', '_', $analyse["project_name"]).".".$analyse["project_id"]."/Run_".str_replace(' ', '_', $analyse["run_name"]).".".$analyse["run_id"]."/Analyse_".str_replace(' ', '_', $analyse["name"]).".".$id[1];
Jerome Mariette's avatar
Jerome Mariette committed
88
89
90
91
92
						}
					}
				}
			}
		} 
Jerome Mariette's avatar
Jerome Mariette committed
93
		return $this->archiveZip($src_directories, $dest_directories, $temporary_dir, 'tar.gz');
Jerome Mariette's avatar
Jerome Mariette committed
94
95
    }

Jerome Mariette's avatar
Jerome Mariette committed
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
    function get_run_analysis($run_id) {

		$results = array();
		$queryParts = array( 
			'SELECT' => 'tx_nG6_analyze.uid AS analyze_id,'. 
						'tx_nG6_analyze.directory AS analyze_directory,'. 
						'tx_nG6_analyze.name AS analyze_name, '.
						'tx_nG6_analyze.date AS analyze_date, '.
						'tx_nG6_analyze.description AS analyze_description',
			'FROM' => 'tx_nG6_run_analyze JOIN tx_nG6_analyze ON '.
					  'tx_nG6_analyze.uid=tx_nG6_run_analyze.analyze_id',
			'WHERE' => 'tx_nG6_run_analyze.run_id='.$run_id,
			'GROUPBY' => '',
			'ORDERBY' => 'tx_nG6_analyze.name',
			'LIMIT' => ''
		);

		$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
		while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))
		{
			$analyze_id = $row['analyze_id'];
			if (! isset ($results['analyse_'.$analyze_id]) )
			{				
				$results['analyse_'.$analyze_id] = array( 
					'directory'					=> $row['analyze_directory'], 
					'name' 						=> $row['analyze_name'],
					'date'						=> $row['analyze_date'],
					'description' 				=> $row['analyse_description']				
				);
			}						
		}
		return $results;
    }
Jerome Mariette's avatar
Jerome Mariette committed
129

Jerome Mariette's avatar
Jerome Mariette committed
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
    function get_project_analysis($project_id) {

		$results = array();
		$queryParts = array( 
			'SELECT' => 'tx_nG6_analyze.uid AS analyze_id,'. 
						'tx_nG6_analyze.directory AS analyze_directory,'. 
						'tx_nG6_analyze.name AS analyze_name, '.
						'tx_nG6_analyze.date AS analyze_date, '.
						'tx_nG6_analyze.description AS analyze_description',
			'FROM' => 'tx_nG6_project_analyze JOIN tx_nG6_analyze ON '.
					  'tx_nG6_analyze.uid=tx_nG6_project_analyze.analyze_id',
			'WHERE' => 'tx_nG6_project_analyze.project_id='.$project_id,
			'GROUPBY' => '',
			'ORDERBY' => 'tx_nG6_analyze.name',
			'LIMIT' => ''
		);

		$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
		while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))
		{
			$analyze_id = $row['analyze_id'];
			if (! isset ($results['analyse_'.$analyze_id]) )
			{				
				$results['analyse_'.$analyze_id] = array( 
					'directory'					=> $row['analyze_directory'], 
					'name' 						=> $row['analyze_name'],
					'date'						=> $row['analyze_date'],
					'description' 				=> $row['analyse_description']				
				);
			}						
		}
		return $results;
    }
Jerome Mariette's avatar
Jerome Mariette committed
163
164
165
166
167

    function get_run($run_id) {
		
		$result = array();
		$queryParts = Array( 
168
169
170
			'SELECT' => 'tx_nG6_project.uid AS project_id,'.
						'tx_nG6_project.name AS project_name,'.
						'tx_nG6_run.uid AS run_id,'.
Jerome Mariette's avatar
Jerome Mariette committed
171
172
173
174
175
					 	'tx_nG6_run.directory AS run_directory,'.
						'tx_nG6_run.description AS run_description, '.
						'tx_nG6_run.name AS run_name, '.
						'tx_nG6_run.nb_sequences, '.
						'tx_nG6_run.date AS run_date',
176
177
			'FROM' => 'tx_nG6_project INNER JOIN ( tx_nG6_project_run INNER JOIN tx_nG6_run ON tx_nG6_project_run.run_id=tx_nG6_run.uid '.
					  ' ) ON tx_nG6_project.uid=tx_nG6_project_run.project_id',
Jerome Mariette's avatar
Jerome Mariette committed
178
179
180
181
182
183
184
185
186
187
188
189
190
			'WHERE' => 'tx_nG6_run.uid='.$run_id,
			'GROUPBY' => '',
			'ORDERBY' => 'tx_nG6_run.date DESC',
			'LIMIT' 	=> ''
		); 

		$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
		while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))
		{
			$run_id = $row['run_id'];
			if (! isset ($results['run_'.$run_id]) )
			{				
				$result = array( 
191
192
					'project_id'				=> $row['project_id'], 
					'project_name'				=> $row['project_name'], 
Jerome Mariette's avatar
Jerome Mariette committed
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
					'directory'					=> $row['run_directory'], 
					'name' 						=> $row['run_name'],
					'nb_sequences' 				=> $row['nb_sequences'],
					'date'						=> $row['run_date'],
					'description' 				=> $row['run_description']				
				);
			}						
		}
		return $result;
    }

    function get_analyse($analyse_id) {
		
		$queryParts = array( 
			'SELECT' => 'tx_nG6_project.uid AS project_id,'. 
						'tx_nG6_project.name AS project_name,'. 
						'tx_nG6_analyze.uid AS analyze_id,'. 
						'tx_nG6_analyze.directory AS analyze_directory,'. 
						'tx_nG6_analyze.name AS analyze_name, '.
						'tx_nG6_analyze.date AS analyze_date, '.
						'tx_nG6_analyze.description AS analyze_description ',
			'FROM' => 'tx_nG6_project INNER JOIN (tx_nG6_project_analyze INNER JOIN tx_nG6_analyze ON ' .
					  'tx_nG6_analyze.uid=tx_nG6_project_analyze.analyze_id) ON tx_nG6_project.uid = tx_nG6_project_analyze.project_id ',
			'WHERE' => 'tx_nG6_analyze.uid='.$analyse_id,
			'GROUPBY' => '',
			'ORDERBY' => '',
			'LIMIT' => ''
		);
		$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
		
		// If it's a project analyse
		if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) {
			$result = array();
			while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))
			{	
				$result = array( 
					'project_name'				=> $row['project_name'], 
					'project_id'				=> $row['project_id'],
					'run_name'					=> 'None', 
					'run_id'					=> 'None',					 
					'directory'					=> $row['analyze_directory'], 
					'name' 						=> $row['analyze_name'],
					'date'						=> $row['analyze_date'],
					'description' 				=> $row['analyze_description']				
				);				
			}
			return $result;
		} else {
			$queryParts = array( 
				'SELECT' => 'tx_nG6_project.name AS project_name,'.
							'tx_nG6_project.uid AS project_id,'.
							'tx_nG6_run.uid AS run_id,'. 
							'tx_nG6_run.name AS run_name,'.
							'tx_nG6_analyze.uid AS analyze_id,'. 
							'tx_nG6_analyze.directory AS analyze_directory,'. 
							'tx_nG6_analyze.name AS analyze_name, '.
							'tx_nG6_analyze.date AS analyze_date, '.
							'tx_nG6_analyze.description AS analyze_description',
				'FROM' => 'tx_nG6_project INNER JOIN ( tx_nG6_project_run INNER JOIN ( tx_nG6_run INNER JOIN ( tx_nG6_run_analyze INNER JOIN '.
						  'tx_nG6_analyze ON tx_nG6_analyze.uid = tx_nG6_run_analyze.analyze_id) ON tx_nG6_run_analyze.run_id = tx_nG6_run.uid '.
						  ') ON tx_nG6_run.uid = tx_nG6_project_run.run_id) ON tx_nG6_project_run.project_id = tx_nG6_project.uid ',
				'WHERE' => 'tx_nG6_analyze.uid='.$analyse_id,
				'GROUPBY' => '',
				'ORDERBY' => 'tx_nG6_analyze.name',
				'LIMIT' => ''
			);
			$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
			$result = array();
			while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))
			{	
				$result = array( 
					'project_name'				=> $row['project_name'], 
					'project_id'				=> $row['project_id'],
					'run_name'					=> $row['run_name'], 
					'run_id'					=> $row['run_id'], 			 
					'directory'					=> $row['analyze_directory'], 
					'name' 						=> $row['analyze_name'],
					'date'						=> $row['analyze_date'],
					'description' 				=> $row['analyze_description']				
				);				
			}
			return $result;
		}
    }

Jerome Mariette's avatar
Jerome Mariette committed
278
279
280
281
282
283
    function get_project_runs($project_id) {
		
		$results = array();
		$queryParts = Array( 
			'SELECT' => 'tx_nG6_run.uid AS run_id,'.
					 	'tx_nG6_run.directory AS run_directory,'.
284
					 	'tx_nG6_run.species AS run_species,'.
Jerome Mariette's avatar
Jerome Mariette committed
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
						'tx_nG6_run.description AS run_description, '.
						'tx_nG6_run.name AS run_name, '.
						'tx_nG6_run.nb_sequences, '.
						'tx_nG6_run.date AS run_date',
			'FROM' => 'tx_nG6_project_run JOIN tx_nG6_run ON '.
					  'tx_nG6_run.uid=tx_nG6_project_run.run_id',
			'WHERE' => 'tx_nG6_project_run.project_id='.$project_id,
			'GROUPBY' => '',
			'ORDERBY' => 'tx_nG6_run.date DESC',
			'LIMIT' 	=> ''
		); 

		$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
		while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))
		{
			$run_id = $row['run_id'];
			if (! isset ($results['run_'.$run_id]) )
			{				
				$results['run_'.$run_id] = array( 
					'directory'					=> $row['run_directory'], 
					'name' 						=> $row['run_name'],
306
					'species' 					=> $row['run_species'],
Jerome Mariette's avatar
Jerome Mariette committed
307
308
309
310
311
312
313
314
315
316
					'nb_sequences' 				=> $row['nb_sequences'],
					'date'						=> $row['run_date'],
					'description' 				=> $row['run_description']				
				);
			}						
		}
		return $results;
    }

	//Return archive's filepath.random_name
Jerome Mariette's avatar
Jerome Mariette committed
317
	function createRandomArchiveName ($tmp_dir) {
Jerome Mariette's avatar
Jerome Mariette committed
318
		$randomKey = $this->createRandomKey(10);
Jerome Mariette's avatar
Jerome Mariette committed
319
		$pathname = $tmp_dir.'/archiveNG6_'.$randomKey;
Jerome Mariette's avatar
Jerome Mariette committed
320
321
		// 1 chance over 49**10 is still a risk
		while( file_exists($pathname) )
Jerome Mariette's avatar
Jerome Mariette committed
322
			$pathname = $tmp_dir.'/archiveNG6_'.$randomKey;
Jerome Mariette's avatar
Jerome Mariette committed
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
		return $pathname;
	}

	//Create a random string for a given length ($amount) 
   	function createRandomKey($amount) {
		// From http://snipplr.com/view/6347/php-random-key-generator/
		$keyset = "abcdefghijklmABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
   		$randkey = "";
   		for ($i=0; $i<$amount; $i++)
	   		$randkey .= substr($keyset, rand(0, strlen($keyset)-1), 1);
   		return $randkey;
   	}

	//Add a / to a directory pathname 
	function dirSlash($dir){
		if (substr( $dir, -1) == "/")
			return $dir;
		return $dir."/";
	}	

Jerome Mariette's avatar
Jerome Mariette committed
343
344
345
346
347
348
349
350
351
352
	function force_download($name, $path) {
		header('Content-Type: application/octet-stream');
		header('Content-disposition: attachment; filename='. $name);
		header('Pragma: no-cache');
		header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
		header('Expires: 0');
		readfile($path);
		exit();
	}

Jerome Mariette's avatar
Jerome Mariette committed
353
354
355
356
357
	/**
	 * Archivate data from $directories_src to an archive (structurated as $directories_dest)
	 *
	 * @param	array			$directories_src: list of directories to archivate
	 * @param	array			$directories_dest: list of directories to archivate
Jerome Mariette's avatar
Jerome Mariette committed
358
	 * @param   string          $method : tar.gz
Jerome Mariette's avatar
Jerome Mariette committed
359
360
	 * @return	string		HTML link to the archive
	 */
Jerome Mariette's avatar
Jerome Mariette committed
361
362
	function archiveZip($directories_src , $directories_dest, $temporary_dir, $method)	
	{			
Jerome Mariette's avatar
Jerome Mariette committed
363
364
365
		##Do an exhaustive list of files from the directories list
		foreach($directories_src as $index => $dir_src)
		{
Jerome Mariette's avatar
Jerome Mariette committed
366
			$this->copyDirectoryAndList($dir_src, $directories_dest[$index]);		
Jerome Mariette's avatar
Jerome Mariette committed
367
		}
Jerome Mariette's avatar
Jerome Mariette committed
368
369
370
371
		$normal_cwd = getcwd();
		$temporary_dir = $this->dirSlash($temporary_dir);
		chdir(dirname($temporary_dir));
		
Jerome Mariette's avatar
Jerome Mariette committed
372
		//write out zipped file 
Jerome Mariette's avatar
Jerome Mariette committed
373
		switch($method) 
Jerome Mariette's avatar
Jerome Mariette committed
374
375
		{
			case 'tar.gz': //system call
Jerome Mariette's avatar
Jerome Mariette committed
376
				$archive_name = basename($temporary_dir);			
Jerome Mariette's avatar
Jerome Mariette committed
377
378
379
380
381
382
383
384
385
				$outfile = $archive_name.".tar";
				system("tar -Pcf ".$outfile." ".$archive_name." --remove-files");  
				system("gzip ".$outfile);	
				$outfile .= '.gz';	
				system("rm -rf ".$archive_name); 
				break;
		}
		//restore cwd 
		chdir($normal_cwd);
Jerome Mariette's avatar
Jerome Mariette committed
386
		return $outfile; 
Jerome Mariette's avatar
Jerome Mariette committed
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
	} 	 

	/**
	 * Recursively copy the content of $dir_src into $dir_dest
	 *
	 * @param	string		$dir_src: name of the source directory
	 * @param	string		$dir_dest: name of the destination directory
	 * @return	None
	 */
	function copyDirectoryAndList($dir_src, $dir_dest)	
	{
		$zip = Array();
		$dir_dest = $this->dirSlash($dir_dest);
		$dir_src = $this->dirSlash($dir_src);	 
		if (! file_exists($dir_src)) {
			return $zip; //nothing to do
		}
			
		//Recursively build destination structure
		if (! file_exists($dir_dest))
			mkdir($dir_dest, 0755, true);
		
		$iterator = new DirectoryIterator($dir_src);
		foreach ($iterator as $fileinfo) 
		{ 			
			$filename = $fileinfo->getFilename() ;			
			$isNotRecursiveLink = ($filename!="." and $filename!="..") ;	
			$isNotCrap = ($isNotRecursiveLink and $filename!="index.html" and $filename!="run.cfg" );
			if ($fileinfo->isDir() and $isNotCrap)
			{  // get recursively subdirectories files
			
				$dirpathname =  $this->dirSlash($fileinfo->getPathname());
				// then actualize the list of file to zip
				$subzip = $this->copyDirectoryAndList( $dirpathname , $dir_dest.$fileinfo->getFilename() ) ;
				$zip = array_merge  ( $zip , $subzip );
			}		
			elseif ($fileinfo->isFile() and $isNotCrap) 
			{  // copy file in new structure				
				$pathname_src = $fileinfo->getPathname(); 
		    	$pathname_dest = $dir_dest . $fileinfo->getFilename(); 
		    	copy( $pathname_src , $pathname_dest );	
	    	
		    	// add to zip  
		    	$zip[] = $pathname_dest;
			}    
		} 

		return $zip; //Done		
	}
    
}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/nG6/class.tx_nG6_eid.php']) {
    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/nG6/class.tx_nG6_eid.php']);
}


// instanciation
$SOBE = t3lib_div::makeInstance('tx_nG6_eid');
$SOBE->main();

?>