summaryrefslogtreecommitdiff
path: root/plugins/pdfviewer
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2015-02-05 17:51:46 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2015-02-05 17:51:46 (GMT)
commit9bd459f51d8c959e51313167e46b8847766c7745 (patch)
treedb52376738f95ef75c0d3daa611e5b790ac9ed69 /plugins/pdfviewer
parent8d10498a8fe26687fac4c7d01d77bdd19c955181 (diff)
downloadroundcubemail-plugins-kolab-9bd459f51d8c959e51313167e46b8847766c7745.tar.gz
Fix compatibility with assets_path and use_secure_urls options (#4499)
Diffstat (limited to 'plugins/pdfviewer')
-rw-r--r--plugins/pdfviewer/pdfviewer.php24
1 files changed, 6 insertions, 18 deletions
diff --git a/plugins/pdfviewer/pdfviewer.php b/plugins/pdfviewer/pdfviewer.php
index 6f90eb2..5e92b58 100644
--- a/plugins/pdfviewer/pdfviewer.php
+++ b/plugins/pdfviewer/pdfviewer.php
@@ -68,9 +68,12 @@ class pdfviewer extends rcube_plugin
{
// redirect to viewer/viewer.html
if (!$args['download'] && $args['mimetype'] && empty($_GET['_load']) && in_array($args['mimetype'], $this->pdf_mimetypes)) {
- $file_url = $this->abs_url(rcube::get_instance()->url($_GET + array('_load' => 1)));
- header('Location: ' . $this->abs_url($this->urlbase . 'viewer/viewer.html') . '?file=' . urlencode($file_url));
- $args['abort'] = true;
+ $rcmail = rcube::get_instance();
+ $file_url = $_SERVER['REQUEST_URI'] . '&_load=1';
+ $location = $rcmail->output->asset_url($this->urlbase . 'viewer/viewer.html');
+
+ header('Location: ' . $location . '?file=' . urlencode($file_url));
+ exit;
}
return $args;
@@ -116,19 +119,4 @@ class pdfviewer extends rcube_plugin
list($part->ctype_primary, $part->ctype_secondary) = explode('/', $part->mimetype);
}
-
- /**
- * Build an absolute URL with the given relative path
- */
- private function abs_url($relpath = '')
- {
- $webroot = '/';
-
- if (dirname($_SERVER['SCRIPT_NAME']) != '/')
- $webroot = dirname($_SERVER['SCRIPT_NAME']) . '/';
-
- return $webroot . preg_replace('!^\./!', '', $relpath);
- }
-
}
-