2006-12-02 04:36:16 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
+ ----------------------------------------------------------------------------+
|
|
|
|
| e107 website system
|
|
|
|
|
|
2013-02-23 12:39:58 -08:00
|
|
|
| Copyright (C) 2008-2013 e107 Inc
|
2006-12-02 04:36:16 +00:00
|
|
|
| http://e107.org
|
2009-07-14 05:31:57 +00:00
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
| Released under the terms and conditions of the
|
|
|
|
| GNU General Public License (http://gnu.org).
|
2013-02-23 12:39:58 -08:00
|
|
|
|
|
|
|
|
| Generic File Request Script.
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
|
+----------------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
2013-02-23 12:39:58 -08:00
|
|
|
|
2008-12-30 16:51:07 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
require_once("class2.php");
|
|
|
|
|
2008-12-30 16:51:07 +00:00
|
|
|
if (!e_QUERY || isset($_POST['userlogin']))
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
header("location: {$e107->base_path}");
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2012-07-11 04:46:09 +00:00
|
|
|
|
|
|
|
// Media-Manager direct file download.
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2013-02-23 12:39:58 -08:00
|
|
|
if(vartrue($_GET['file']) && is_numeric($_GET['file'])) // eg. request.php?file=1
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2013-02-23 12:39:58 -08:00
|
|
|
$sql = e107::getDb();
|
|
|
|
if ($sql->select('core_media', 'media_url', "media_id= ".intval($_GET['file'])." AND media_userclass IN (".USERCLASS_LIST.") LIMIT 1 "))
|
2008-07-04 20:23:13 +00:00
|
|
|
{
|
2013-02-23 12:39:58 -08:00
|
|
|
$row = $sql->fetch();
|
|
|
|
// $file = $tp->replaceConstants($row['media_url'],'rel');
|
|
|
|
e107::getFile()->send($row['media_url']);
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2013-02-23 12:39:58 -08:00
|
|
|
else //BC Legacy Support. (Downloads Plugin)
|
2008-12-30 16:51:07 +00:00
|
|
|
{
|
2013-02-23 12:39:58 -08:00
|
|
|
e107::getRedirect()->redirect(e_PLUGIN."download/request.php?".e_QUERY);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2013-02-23 12:39:58 -08:00
|
|
|
exit();
|
2008-12-30 16:51:07 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
?>
|