Commit cc1a2812 authored by Aaron Wells's avatar Aaron Wells
Browse files

Make Embedded PDF work for logged-out users

Bug 1221001. Needed artefact/lib.php (which apparently gets included by init.php if you're logged in),
and it needed to add &view= to the file download URL so that Mahara could tell which view was giving
you access to the PDF file.

Change-Id: If7c0a6a843588075104819f7ea1e53e392cc4959
parent 69f9f1e1
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
define('INTERNAL', 1); define('INTERNAL', 1);
define('PUBLIC', 1); define('PUBLIC', 1);
require(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/init.php'); require(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/init.php');
require_once(get_config('docroot') . '/artefact/lib.php');
$fileid = param_integer('file'); $fileid = param_integer('file');
$viewid = param_integer('view'); $viewid = param_integer('view');
...@@ -50,6 +51,6 @@ if (!($file instanceof ArtefactTypeFile)) { ...@@ -50,6 +51,6 @@ if (!($file instanceof ArtefactTypeFile)) {
} }
$smarty = smarty(); $smarty = smarty();
$smarty->assign('url', get_config('wwwroot') . 'artefact/file/download.php?file=' . $fileid); $smarty->assign('url', get_config('wwwroot') . 'artefact/file/download.php?file='.$fileid.'&view='.$viewid);
$smarty->assign('title', $file->get('title')); $smarty->assign('title', $file->get('title'));
$smarty->display('blocktype:pdf:pdf.tpl'); $smarty->display('blocktype:pdf:pdf.tpl');
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment