forked from e107inc/e107
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequest.php
67 lines (51 loc) · 1.38 KB
/
request.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
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
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Copyright (C) 2008-2013 e107 Inc
| http://e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| Generic File Request Script.
|
+----------------------------------------------------------------------------+
*/
require_once("class2.php");
if (!e_QUERY || isset($_POST['userlogin']))
{
e107::redirect();
exit();
}
// Media-Manager direct file download.
if(!empty($_GET['file'])) // eg. request.php?file=1
{
if(is_numeric($_GET['file']))
{
$query = "media_id= ".intval($_GET['file']);
}
else // @see $tp->toFile()
{
$srch = array(
'{e_MEDIA_FILE}' => 'e_MEDIA_FILE/',
'{e_PLUGIN}' => 'e_PLUGIN/'
);
$fileName = str_replace($srch,array_keys($srch),$_GET['file']);
$query = "media_url= \"".e107::getParser()->filter($fileName)."\"";
}
$sql = e107::getDb();
if ($sql->select('core_media', 'media_url', $query . " AND media_userclass IN (".USERCLASS_LIST.") LIMIT 1 "))
{
$row = $sql->fetch();
// $file = $tp->replaceConstants($row['media_url'],'rel');
e107::getFile()->send($row['media_url']);
}
}
elseif(e107::isInstalled('download')) //BC Legacy Support. (Downloads Plugin)
{
e107::getRedirect()->redirect(e_PLUGIN."download/request.php?".e_QUERY);
}
exit();
?>