summaryrefslogtreecommitdiff
path: root/plugins/pdfviewer
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-01-24 13:10:20 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-01-24 13:10:20 (GMT)
commiteb29aaeb960a846c845d25960855e1c9baaabe27 (patch)
treeca5db16a05024bf6b42edc191267da544fb3bb04 /plugins/pdfviewer
parent451ced1d3468c9ab92e405f27b910bfe7150ea80 (diff)
downloadroundcubemail-plugins-kolab-eb29aaeb960a846c845d25960855e1c9baaabe27.tar.gz
Add alternative mimetypes for PDF files; little code cleanup
Diffstat (limited to 'plugins/pdfviewer')
-rw-r--r--plugins/pdfviewer/pdfviewer.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/plugins/pdfviewer/pdfviewer.php b/plugins/pdfviewer/pdfviewer.php
index 686da9a..b6da2d2 100644
--- a/plugins/pdfviewer/pdfviewer.php
+++ b/plugins/pdfviewer/pdfviewer.php
@@ -30,6 +30,11 @@ class pdfviewer extends rcube_plugin
private $pdf_mimetypes = array(
'application/pdf',
+ 'application/x-pdf',
+ 'application/acrobat',
+ 'applications/vnd.pdf',
+ 'text/pdf',
+ 'text/x-pdf',
);
/**
@@ -50,7 +55,7 @@ class pdfviewer extends rcube_plugin
}
// only use pdf.js if the browser doesn't support inline PDF rendering
- if (empty($_SESSION['browser_caps']['pdf']) || $ua->opera)
+ if (empty($_SESSION['browser_caps']['pdf']) || $ua->opera)
$this->add_hook('message_part_get', array($this, 'get_part'));
$this->add_hook('message_part_structure', array($this, 'part_structure'));
@@ -61,16 +66,11 @@ class pdfviewer extends rcube_plugin
*/
public function get_part($args)
{
- if (!$args['download'] && $args['mimetype'] && in_array($args['mimetype'], $this->pdf_mimetypes)) {
- $rcmail = rcube::get_instance();
- $mimetype = 'application/pdf';
-
- // redirect to viewer.html
- if (empty($_GET['_load'])) {
- $file_url = $this->abs_url($rcmail->url($_GET + array('_load' => 1)));
- header('Location: ' . $this->abs_url($this->urlbase . 'viewer/viewer.html') . '?file=' . urlencode($file_url));
- $args['abort'] = true;
- }
+ // 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;
}
return $args;