File roundcubemail-1.1-assets.patch of Package roundcubemail (Revision c8157f558d4602d29f47ee2d5c67d8de)

Currently displaying revision c8157f558d4602d29f47ee2d5c67d8de , Show latest

67
 
1
diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php
2
index aae54d4..3df5589 100644
3
--- a/program/include/rcmail_output_html.php
4
+++ b/program/include/rcmail_output_html.php
5
@@ -184,7 +184,7 @@ EOF;
6
             }
7
 
8
             $path = (rcube_utils::https_check() ? 'https' : 'http') . '://'
9
-                . $_SERVER['SERVER_NAME'] . $base . '/' . $path;
10
+                . $_SERVER['HTTP_HOST'] . rtrim($base, '/') . '/' . ltrim($path, '/');
11
         }
12
 
13
         $this->assets_path = $path;
14
@@ -306,10 +306,27 @@ EOF;
15
         }
16
 
17
         foreach ($skin_paths as $skin_path) {
18
-            $path = realpath($skin_path . $file);
19
+            $path = $skin_path . $file;
20
+
21
+            if (is_file($path)) {
22
+                return $skin_path . $file;
23
+            }
24
+
25
+            $path = rtrim(RCUBE_INSTALL_PATH, '/');
26
+            $path .= '/' . 'public_html/assets/';
27
+            $path .= rtrim($skin_path, '/') . '/' . $file;
28
+
29
             if (is_file($path)) {
30
                 return $skin_path . $file;
31
             }
32
+
33
+            $path = rtrim(RCUBE_INSTALL_PATH, '/');
34
+            $path .= '/' . $skin_path . $file;
35
+            $path = realpath($path);
36
+
37
+            if ($skin_path[0] != '/' && is_file($path)) {
38
+                return $path;
39
+            }
40
         }
41
 
42
         return false;
43
@@ -491,9 +491,10 @@ EOF;
44
 
45
             // fallback to deprecated template names
46
             if (!is_readable($path) && $this->deprecated_templates[$realname]) {
47
-                $path = "$skin_path/templates/" . $this->deprecated_templates[$realname] . ".html";
48
+                // Try an old path
49
+                $tpath = "$skin_path/templates/" . $this->deprecated_templates[$realname] . ".html";
50
 
51
-                if (is_readable($path)) {
52
+                if (is_readable($tpath)) {
53
                     rcube::raise_error(array(
54
                         'code' => 502, 'type' => 'php',
55
                         'file' => __FILE__, 'line' => __LINE__,
56
@@ -552,6 +569,10 @@ EOF;
57
                 }
58
             }
59
 
60
+            if (!is_readable($path) && $path[0] != '/' && is_readable(rtrim(RCUBE_INSTALL_PATH, '/') . '/' . $path)) {
61
+                $path = rtrim(RCUBE_INSTALL_PATH, '/') . '/' . $path;
62
+            }
63
+
64
             if (is_readable($path)) {
65
                 $this->config->set('skin_path', $skin_path);
66
                 $this->base_path = preg_replace('!plugins/\w+/!', '', $skin_path);  // set base_path to core skin directory (not plugin's skin)
67