Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
freedom_del_tar.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Delete imported tar
9  *
10  * @author Anakeen 2004
11  * @version $Id: freedom_del_tar.php,v 1.1 2004/03/16 15:37:09 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage GED
15  */
16 /**
17  */
18 
19 include_once ("FREEDOM/freedom_import_tar.php");
20 
22 {
23 
24  global $_FILES;
25 
26  $filename = GetHttpVars("filename"); // the select filename
28  if ($handle = opendir($ldir)) {
29  while (false !== ($file = readdir($handle))) {
30  if ($file[0] != ".") {
31  $ttar[] = array(
32  "filename" => $file,
33  "selected" => ($file == $filename) ? "selected" : ""
34  );
35  if ($file == $filename) {
36  $selfile = $file;
37  }
38  }
39  }
40  }
41  if ($selfile == "") {
42  // try the first
43  $action->exitError(sprintf(_("archive %s not found and cannot be removed") , $filename));
44  }
45 
46  $untardir = getTarExtractDir($action, $selfile);
47 
48  if (is_dir($untardir)) {
49  // suppress directory
50  exec("/bin/rm -fr " . escapeshellarg($untardir) , $msg, $status);
51 
52  if ($status != 0) $action->exitError(sprintf(_("cannot suppress extract directory for archive file %s") , $selfile));
53  }
54  $tar = $ldir . $selfile;
55 
56  if (is_file($tar)) if (!unlink($tar)) $action->exitError(sprintf(_("cannot suppress archive file %s") , $selfile));
57 
58  $action->AddWarningMsg(sprintf(_("archive file %s has been deleted") , $selfile));
59 
60  redirect($action, "FREEDOM", "FREEDOM_VIEW_TAR", $action->GetParam("CORE_STANDURL"));
61 }
62 ?>
← centre documentaire © anakeen - published under CC License - Dynacase