2 commits - plugins/pdfviewer

Aleksander Machniak machniak at kolabsys.com
Thu Feb 5 18:54:17 CET 2015


 plugins/pdfviewer/pdfviewer.php |   24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

New commits:
commit e6c11695f9596a0c81efd6a52a4202fa89d967e5
Merge: 9bd459f cea470c
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Thu Feb 5 12:53:18 2015 -0500

    Merge branch 'master' of ssh://git.kolabsys.com/git/roundcube



commit 9bd459f51d8c959e51313167e46b8847766c7745
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Thu Feb 5 12:51:46 2015 -0500

    Fix compatibility with assets_path and use_secure_urls options (#4499)

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);
-    }
-
 }
-




More information about the commits mailing list