mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 12:20:44 +02:00
Fix for $tp->toFile()
This commit is contained in:
@@ -448,7 +448,7 @@ class e107_db_debug {
|
||||
$tMarker['Memory Used'] = "<span class='label label-danger'>".$tMarker['Memory Used']."</span>";
|
||||
}
|
||||
|
||||
// $aSum['Memory'] += $tMem;
|
||||
$aSum['Memory'] = $tMem;
|
||||
|
||||
if($tMarker['What'] == 'Stop')
|
||||
{
|
||||
@@ -511,6 +511,8 @@ class e107_db_debug {
|
||||
<td class='fcaption' style='text-align:right' title='DB Time (msec)'><b>" . $aSum['DB Time'] . "</b></td>
|
||||
<td class='fcaption' style='text-align:right'><b>" . $aSum['DB Count'] . "</b></td>
|
||||
<td class='fcaption' style='text-align:right' title='Memory (Kb)'><b>" . number_format($aSum['Memory'] / 1024, 1) . "</b></td>
|
||||
<td class='fcaption' style='text-align:right' title='Memory (Kb)'><b>" . number_format($aSum['Memory'] / 1024, 1) . "</b></td>
|
||||
|
||||
<td class='fcaption' style='text-align:right'><b>" . $tMarker['OB Lev'] . "</b></td>
|
||||
|
||||
</tr>
|
||||
|
@@ -3665,13 +3665,17 @@ class e_parser
|
||||
|
||||
/**
|
||||
* Take a file-path and convert it to a download link.
|
||||
* @todo
|
||||
* @param $text
|
||||
* @return string
|
||||
*/
|
||||
public function toFile($text, $parm=array())
|
||||
{
|
||||
$link = e_HTTP."request.php?".str_replace('{e_MEDIA_FILE}', '',$text);
|
||||
$srch = array(
|
||||
'{e_MEDIA_FILE}' => 'e_MEDIA_FILE/',
|
||||
'{e_PLUGIN}' => 'e_PLUGIN/'
|
||||
);
|
||||
|
||||
$link = e_HTTP."request.php?file=". str_replace(array_keys($srch), $srch,$text);
|
||||
|
||||
if(!empty($parm['raw']))
|
||||
{
|
||||
|
23
request.php
23
request.php
@@ -28,17 +28,34 @@ if (!e_QUERY || isset($_POST['userlogin']))
|
||||
|
||||
// Media-Manager direct file download.
|
||||
|
||||
if(vartrue($_GET['file']) && is_numeric($_GET['file'])) // eg. request.php?file=1
|
||||
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', "media_id= ".intval($_GET['file'])." AND media_userclass IN (".USERCLASS_LIST.") LIMIT 1 "))
|
||||
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']);
|
||||
}
|
||||
}
|
||||
else //BC Legacy Support. (Downloads Plugin)
|
||||
elseif(e107::isInstalled('download')) //BC Legacy Support. (Downloads Plugin)
|
||||
{
|
||||
e107::getRedirect()->redirect(e_PLUGIN."download/request.php?".e_QUERY);
|
||||
}
|
||||
|
Reference in New Issue
Block a user