Add alternative mimetypes for PDF files; little code cleanup
This commit is contained in:
parent
451ced1d34
commit
eb29aaeb96
1 changed files with 11 additions and 11 deletions
|
@ -30,6 +30,11 @@ class pdfviewer extends rcube_plugin
|
||||||
|
|
||||||
private $pdf_mimetypes = array(
|
private $pdf_mimetypes = array(
|
||||||
'application/pdf',
|
'application/pdf',
|
||||||
|
'application/x-pdf',
|
||||||
|
'application/acrobat',
|
||||||
|
'applications/vnd.pdf',
|
||||||
|
'text/pdf',
|
||||||
|
'text/x-pdf',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,17 +66,12 @@ class pdfviewer extends rcube_plugin
|
||||||
*/
|
*/
|
||||||
public function get_part($args)
|
public function get_part($args)
|
||||||
{
|
{
|
||||||
if (!$args['download'] && $args['mimetype'] && in_array($args['mimetype'], $this->pdf_mimetypes)) {
|
// redirect to viewer/viewer.html
|
||||||
$rcmail = rcube::get_instance();
|
if (!$args['download'] && $args['mimetype'] && empty($_GET['_load']) && in_array($args['mimetype'], $this->pdf_mimetypes)) {
|
||||||
$mimetype = 'application/pdf';
|
$file_url = $this->abs_url(rcube::get_instance()->url($_GET + array('_load' => 1)));
|
||||||
|
|
||||||
// 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));
|
header('Location: ' . $this->abs_url($this->urlbase . 'viewer/viewer.html') . '?file=' . urlencode($file_url));
|
||||||
$args['abort'] = true;
|
$args['abort'] = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue