Core  3.2
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  * @package FDL
5 */
6 /**
7  * Delete imported tar
8  *
9  * @author Anakeen
10  * @version $Id: freedom_del_tar.php,v 1.1 2004/03/16 15:37:09 eric Exp $
11  * @package FDL
12  * @subpackage GED
13  */
14 /**
15  */
16 
17 include_once ("FREEDOM/freedom_import_tar.php");
18 
20 {
21 
22  global $_FILES;
23 
24  $filename = GetHttpVars("filename"); // the select filename
26  if ($handle = opendir($ldir)) {
27  while (false !== ($file = readdir($handle))) {
28  if ($file[0] != ".") {
29  $ttar[] = array(
30  "filename" => $file,
31  "selected" => ($file == $filename) ? "selected" : ""
32  );
33  if ($file == $filename) {
34  $selfile = $file;
35  }
36  }
37  }
38  }
39  if ($selfile == "") {
40  // try the first
41  $action->exitError(sprintf(_("archive %s not found and cannot be removed") , $filename));
42  }
43 
44  $untardir = getTarExtractDir($action, $selfile);
45 
46  if (is_dir($untardir)) {
47  // suppress directory
48  exec("/bin/rm -fr " . escapeshellarg($untardir) , $msg, $status);
49 
50  if ($status != 0) $action->exitError(sprintf(_("cannot suppress extract directory for archive file %s") , $selfile));
51  }
52  $tar = $ldir . $selfile;
53 
54  if (is_file($tar)) if (!unlink($tar)) $action->exitError(sprintf(_("cannot suppress archive file %s") , $selfile));
55 
56  $action->AddWarningMsg(sprintf(_("archive file %s has been deleted") , $selfile));
57 
58  redirect($action, "FREEDOM", "FREEDOM_VIEW_TAR", $action->GetParam("CORE_STANDURL"));
59 }
60 ?>
$status
Definition: index.php:30
global $action
$ldir
Definition: resizeimg.php:145
$filename
getTarExtractDir(Action &$action, $tar)
Definition: import_tar.php:34
$file
freedom_del_tar(&$action)
getTarUploadDir(Action &$action)
Definition: import_tar.php:24
← centre documentaire © anakeen