mirror of
https://github.com/e107inc/e107.git
synced 2025-07-16 12:36:26 +02:00
e107::getFile()->send() now accepts optional type, encoding and disposition values.
HTMLTAG fallback for THEME_LAYOUT added.
This commit is contained in:
@ -117,7 +117,7 @@ if(!defined("XHTML4"))
|
|||||||
{
|
{
|
||||||
echo "<!doctype html>\n";
|
echo "<!doctype html>\n";
|
||||||
$htmlTag = "<html".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " lang=\"".CORE_LC."\"" : "").">";
|
$htmlTag = "<html".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " lang=\"".CORE_LC."\"" : "").">";
|
||||||
echo deftrue('HTMLTAG', $htmlTag)."\n";
|
echo (defined('HTMLTAG') ? str_replace('THEME_LAYOUT', THEME_LAYOUT, HTMLTAG) : $htmlTag)."\n";
|
||||||
echo "<head>\n";
|
echo "<head>\n";
|
||||||
echo "<meta charset='utf-8' />\n";
|
echo "<meta charset='utf-8' />\n";
|
||||||
}
|
}
|
||||||
@ -139,6 +139,18 @@ if(!defined('e_PAGETITLE') && ($_PAGE_TITLE = e107::getSingleton('eResponse')->g
|
|||||||
unset($_PAGE_TITLE);
|
unset($_PAGE_TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (deftrue('e_FRONTPAGE'))
|
||||||
|
{
|
||||||
|
// Ignore any additional title when current page is the frontpage
|
||||||
|
echo "<title>".SITENAME."</title>\n\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
echo "<title>".(deftrue('e_PAGETITLE') ? e_PAGETITLE.' - ' : (defined('PAGE_NAME') ? PAGE_NAME.' - ' : "")).SITENAME."</title>\n\n";
|
||||||
|
|
||||||
|
unset($_PAGE_TITLE);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// C: Send start of HTML
|
// C: Send start of HTML
|
||||||
@ -179,18 +191,7 @@ unset($e_headers);
|
|||||||
|
|
||||||
echo e107::getSingleton('eResponse')->renderMeta()."\n"; // render all the e107::meta() entries.
|
echo e107::getSingleton('eResponse')->renderMeta()."\n"; // render all the e107::meta() entries.
|
||||||
|
|
||||||
if (deftrue('e_FRONTPAGE'))
|
|
||||||
{
|
|
||||||
// Ignore any additional title when current page is the frontpage
|
|
||||||
echo "<title>".SITENAME."</title>\n\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
echo "<title>".(deftrue('e_PAGETITLE') ? e_PAGETITLE.' - ' : (defined('PAGE_NAME') ? PAGE_NAME.' - ' : "")).SITENAME."</title>\n\n";
|
|
||||||
|
|
||||||
unset($_PAGE_TITLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1078,10 +1078,11 @@
|
|||||||
/**
|
/**
|
||||||
* File retrieval function. by Cam.
|
* File retrieval function. by Cam.
|
||||||
*
|
*
|
||||||
* @param $file string actual path or {e_xxxx} path to file.
|
* @param string $file actual path or {e_xxxx} path to file.
|
||||||
|
* @param string $opts (optional) type | disposition | encoding values.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function send($file)
|
function send($file, $opts = array())
|
||||||
{
|
{
|
||||||
|
|
||||||
global $e107;
|
global $e107;
|
||||||
@ -1159,12 +1160,22 @@
|
|||||||
fseek($res, $seek);
|
fseek($res, $seek);
|
||||||
}
|
}
|
||||||
$data_len -= $seek;
|
$data_len -= $seek;
|
||||||
header("Expires: 0");
|
|
||||||
|
$contentType = vartrue($opts['type'], 'application/force-download');
|
||||||
|
$contentDisp = vartrue($opts['disposition'], 'attachment');
|
||||||
|
|
||||||
|
header('Expires: 0');
|
||||||
header("Cache-Control: max-age=30");
|
header("Cache-Control: max-age=30");
|
||||||
header("Content-Type: application/force-download");
|
header('Content-Type: '.$contentType);
|
||||||
header("Content-Disposition: attachment; filename=\"{$file}\"");
|
header('Content-Disposition: '.$contentDisp.'; filename="'.$file.'"');
|
||||||
header("Content-Length: {$data_len}");
|
header("Content-Length: {$data_len}");
|
||||||
header("Pragma: public");
|
header("Pragma: public");
|
||||||
|
|
||||||
|
if(!empty($opts['encoding']))
|
||||||
|
{
|
||||||
|
header('Content-Transfer-Encoding: '.$opts['encoding']);
|
||||||
|
}
|
||||||
|
|
||||||
if($seek)
|
if($seek)
|
||||||
{
|
{
|
||||||
header("Accept-Ranges: bytes");
|
header("Accept-Ranges: bytes");
|
||||||
|
Reference in New Issue
Block a user