forked from Th3-822/rapidleech
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunzip.php
More file actions
99 lines (98 loc) · 3.07 KB
/
Copy pathunzip.php
File metadata and controls
99 lines (98 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
function unzip() {
global $list, $PHP_SELF;
?>
<form method="post" action="<?php echo $PHP_SELF; ?>">
<input type="hidden" name="act" value="unzip_go" />
<table align="center">
<tr>
<td>
<table>
<?php
for($i = 0; $i < count ( $_GET ["files"] ); $i ++) {
$file = $list [$_GET ["files"] [$i]];
require_once (CLASS_DIR . "unzip.php");
if (file_exists($file['name'])) {
$zip = new dUnzip2 ( $file['name'] );
$flist = $zip->getList();
?>
<tr><td align="center">
<input type="hidden" name="files[]" value="<?php echo $_GET['files'][$i]; ?>" />
<b><?php echo basename($file['name']); ?></b> (<?php echo count($flist).' '.lang(204); ?>)
</td></tr>
<tr><td>
<div style="overflow-y:scroll; height:150px; padding-left:5px;">
<?php
foreach ($flist as $property) {
echo($property['file_name'].'<br />');
}
?>
</div>
</td></tr>
<?php
}
}
?>
</table>
</td>
<td><input type="submit" name="submit" value="<?php echo lang(205); ?>" /></td>
</tr>
<tr><td></td></tr>
</table>
</form>
<?php
}
function unzip_go() {
global $list, $options;
require_once (CLASS_DIR . "unzip.php");
$any_file_unzippped = false;
for($i = 0; $i < count ( $_POST ["files"] ); $i ++) {
$file = $list [$_POST ["files"] [$i]];
if (file_exists ( $file ["name"] )) {
$zip = new dUnzip2 ( $file ["name"] );
$allf = $zip->getList ();
$file_inside_zip_exists = false;
$forbidden_inside_zip = false;
foreach ($allf as $k => $properties) {
if (file_exists($options['download_dir'].basename($properties['file_name']))) {
$file_inside_zip_exists = true; break;
}
}
if ($options['check_these_before_unzipping']) {
foreach ( $allf as $k => $property ) {
$zfiletype = strrchr ( $property ['file_name'], "." );
if (is_array ( $options['forbidden_filetypes'] ) && in_array ( strtolower ( $zfiletype ), $options['forbidden_filetypes'] )) {
$forbidden_inside_zip = true; break;
}
}
}
if ($file_inside_zip_exists) {
echo 'Some file(s) inside <b>'.htmlentities(basename($file["name"])).'</b> already exist on download directory';
echo "<br /><br />";
}
elseif ($forbidden_inside_zip) {
printf(lang(181), $zfiletype);
echo "<br /><br />";
}
else {
$zip->unzipAll ( $options['download_dir'] );
if ($zip->getList () != false) {
$any_file_unzippped = true;
echo '<b>'.htmlentities(basename($file["name"])).'</b> unzipped successfully<br /><br />';
foreach ($allf as $k => $properties) {
$efile = realpath($options['download_dir']).'/'.basename($properties['file_name']);
if (is_file($efile)) {
$time = filemtime($efile); while (isset($list[$time])) { $time++; }
$list[$time] = array("name" => $efile, "size" => bytesToKbOrMbOrGb(filesize($efile)), "date" => $time);
}
}
if (!updateListInFile($list)) { echo lang(146)."<br /><br />"; }
}
else {
echo "File <b>".$file["name"]."</b> not found!<br /><br />";
}
}
}
}
}
?>