forked from Th3-822/rapidleech
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunrar.php
More file actions
197 lines (188 loc) · 6.7 KB
/
Copy pathunrar.php
File metadata and controls
197 lines (188 loc) · 6.7 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
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
129
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<?php
function unrar() {
global $PHP_SELF, $options, $list;
require_once(CLASS_DIR."rar.php");
?>
<script type="text/javascript">
/* <![CDATA[ */
function unrar_setCheckboxes(act, filestounrar) {
var elts = document.getElementsByName('filestounrar['+filestounrar+'][]');
var elts_cnt = (typeof(elts) != 'undefined') ? elts.length : 0;
if (elts_cnt) {
for (var i = 0; i < elts_cnt; i++) {
elts[i].checked = (act == 1 || act == 0) ? act : elts[i].checked ? 0 : 1;
}
}
}
/* ]]> */
</script>
<form name="unrar_files" method="post" action="<?php echo $PHP_SELF; ?>">
<table align="center">
<tr>
<td>
<table>
<?php
$rar_passl_needed = false;
$any_file_tounrar = false;
for($i = 0; $i < count($_GET["files"]); $i++) {
$file = $list[$_GET["files"][$i]];
?>
<tr align="center">
<td colspan="2" class="unrar-main-td">
<input type="hidden" name="files[<?php echo $i; ?>]" value="<?php echo $_GET["files"][$i]; ?>" />
<?php printf(lang(366),htmlentities(basename($file["name"]))); ?>
<br />
<a href="javascript:unrar_setCheckboxes(1, <?php echo $i;?>);"><?php echo lang(52); ?></a> |
<a href="javascript:unrar_setCheckboxes(0, <?php echo $i;?>);"><?php echo lang(53); ?></a> |
<a href="javascript:unrar_setCheckboxes(2, <?php echo $i;?>);"><?php echo lang(54); ?></a>
</td>
</tr>
<tr>
<td colspan="2" class="unrar-main2-td">
<?php
unset ($rar);
$rar = new rlRar($file["name"], $options['check_these_before_unzipping'] ? $options['forbidden_filetypes'] : array('.xxx'));
if ($rar->get_rar_return() === false) { echo lang(367); }
else {
$rar_list = $rar->listthem(@$_GET['passwords'][$i], $options['download_dir'], $i);
if ($rar_list[0] == 'PASS') { $rar_passl_needed = true; echo lang(368); }
elseif ($rar_list['NEEDP'] == true) { echo lang(369); }
elseif ($rar_list[0] == 'ERROR') { printf(lang(370),$rar_list[1].' '.$rar_list[2]); }
}
?>
<input type="<?php echo ($rar_list['NEEDP'] == true) ? 'password' : 'hidden'; ?>" name="passwords[]" value="<?php echo htmlspecialchars($_GET['passwords'][$i], ENT_QUOTES); ?>" />
</td>
</tr>
<?php
if ($rar_list[0] == 'LIST') {
$any_file_tounrar = true;
$rar_list = $rar_list[2];
foreach($rar_list as $rar_key => $rar_item) {
?>
<tr>
<td class="unrar-lb-td">
<input type="checkbox" name="filestounrar[<?php echo $i; ?>][]" checked="checked" value="<?php echo base64_encode($rar_key); ?>" />
</td>
<td class="unrar-rb-td"><?php echo $rar_key.' ('.bytesToKbOrMbOrGb($rar_item['size']).')'; ?></td>
</tr>
<?php
}
}
?>
<tr>
<td colspan="2" class="unrar-space-td"> </td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
<tr>
<td align="center">
<input type="hidden" name="act" value="<?php echo $rar_passl_needed ? 'unrar' : 'unrar_go'; ?>" />
<input type="submit" value="<?php echo $rar_passl_needed ? lang(371) : lang(372); ?>" />
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</form>
<?php
}
function unrar_go() {
global $PHP_SELF, $options, $list;
require_once(CLASS_DIR."rar.php");
?>
<table align="center">
<tr>
<td>
<table>
<?php
for($i = 0; $i < count($_GET["files"]); $i++) {
$file = $list[$_GET["files"][$i]];
if (count($_GET['filestounrar'][$i]) == 0) { continue; }
?>
<tr align="center">
<td colspan="2" style="border-right:1px solid #666; border-left:1px solid #666; border-top:1px solid #666; padding:2px; background-color:#001825;"><?php printf(lang(373),basename($file["name"])); ?></td>
</tr>
<?php
foreach ($_GET['filestounrar'][$i] as $rar_item) {
?>
<tr>
<td class="unrar-lb-td">
<?php
echo link_for_file(realpath($options['download_dir']).'/'.basename(base64_decode($rar_item)));
?>
</td>
<td id="<?php echo 'unrar'.$_GET["files"][$i].'-'.str_replace('=', '-', $rar_item); ?>" align="center" style="border-right:1px solid #666; padding:2px; background-color:#001825;"><?php echo lang(364); ?></td>
</tr>
<?php
}
?>
<tr>
<td colspan="2" class="unrar-space-td"> </td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
<span id="unrar_finished" style="display:none;"><a href="<?php echo $PHP_SELF."?act=files"; ?>"><?php echo lang(365); ?></a><br /><br /><br /></span>
<?php
}
function unrar_go_go() {
global $options, $list;
?>
<script type="text/javascript">
/* <![CDATA[ */
function rar_st(elementid, st){
document.getElementById(elementid).innerHTML = st;
return true;
}
/* ]]> */
</script>
<?php
for($i = 0; $i < count($_GET["files"]); $i++) {
$file = $list[$_GET["files"][$i]];
if (count($_GET['filestounrar'][$i]) == 0) { continue; }
foreach ($_GET['filestounrar'][$i] as $rar_item) {
flush();
$rar = new rlRar($file["name"], $options['check_these_before_unzipping'] ? $options['forbidden_filetypes'] : array('.xxx'));
if ($rar->get_rar_return() === false) {
?>
<script type="text/javascript">rar_st('<?php echo 'unrar'.$_GET["files"][$i].'-'.str_replace('=', '-', $rar_item); ?>', '<?php echo lang(343); ?>');</script>
<?php
}
else {
$rar_result = $rar->extract(base64_decode($rar_item), $options['download_dir'], $_GET['passwords'][$i], 'unrar'.$_GET["files"][$i].'-'.str_replace('=', '-', $rar_item), $i);
echo $rar_result;
if (strpos($rar_result, ", 'OK')") !== false) {
_create_list();
$rar_tolist = realpath($options['download_dir']).'/'.basename(base64_decode($rar_item));
$time = filemtime($rar_tolist); while (isset($list[$time])) { $time++; }
$list[$time] = array("name" => $rar_tolist, "size" => bytesToKbOrMbOrGb(filesize($rar_tolist)), "date" => $time);
if (!updateListInFile($list)) {
?>
<script type="text/javascript">var tmp = document.getElementById('rar_finished'); tmp.innerHTML = "<?php echo lang(9); ?><br /><br />" + tmp.innerHTML</script>;
<?php
}
}
}
}
}
?>
<script type="text/javascript">document.getElementById('unrar_finished').style.display = '';</script>
<?php
}
?>