Commit 96ce0ce2 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't try to reconstruct url in a stupid longwinded way

parent 1236bb87
......@@ -40,25 +40,9 @@ if ($forcedl) {
$options['forcedownload'] = true;
}
else {
$downloadurl = get_config('wwwroot') . 'artefact/file/download.php?file=' . $fileid;
if (!empty($viewid)) {
$downloadurl .= '&view=' . $viewid;
}
if (!empty($size)) {
if (is_string($size)) {
$downloadurl .= '&size=' . $size;
$size = array('size' => $size);
} else if (is_array($size)) {
$sizeparam = array('w' => 'width', 'h' => 'height', 'maxw' => 'maxwidth', 'maxh' => 'maxheight');
foreach ($sizeparam as $k => $v) {
if (isset($size[$k])) {
$downloadurl .= '&' . $v . '=' . $size[$k];
}
}
}
}
$downloadurl .= '&download=1';
$options['downloadurl'] = $downloadurl;
$options['downloadurl'] = get_config('wwwroot')
. substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], 'artefact/file/download.php'))
. '&download=1';
}
if ($viewid && $fileid) {
......
Markdown is supported
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