-
Notifications
You must be signed in to change notification settings - Fork 8
/
functions.php
33 lines (28 loc) · 932 Bytes
/
functions.php
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
<?php
// Download function target a ?download=directory/file
// Notice! This function is unsafe to leave at it is.
// Make restrictions for which files are allowed to be downloaded.
if(isset($_GET['download']) && $_GET['download']) {
$filename = explode('/', $_GET['download']);
$filename = end($filename);
$url = $app->server_root.$_GET['download'];
$safe = false;
$explode = explode('/', $_GET['download']);
if($explode[0] == 'assets' || $explode[0] == 'crow-3.0') {
$safe = true;
}
if(is_file($url) && $safe) {
header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"".$filename."\"");
readfile($url);
exit;
}
}
// Placeholder for eventual translations
if(!function_exists('__')) {
function __($value = false) {
return $value;
}
}
?>