Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2018-04-24 09:32:16 +0300
committerAleksander Machniak <machniak@kolabsys.com>2018-04-24 09:32:16 +0300
commit35a3abd3de29a98455ae9e9ffb75006d60eb3b3f (patch)
treec9d5a0578273baea3a41e0c32140ee3c12e136b9 /program
parent8355ba62fba8821367e7fcf019a7d8d90de05961 (diff)
Fix skin extending for assets (#5115) - take two
Diffstat (limited to 'program')
-rw-r--r--program/include/rcmail_output_html.php29
1 files changed, 21 insertions, 8 deletions
diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php
index eaae20444..1dd4838da 100644
--- a/program/include/rcmail_output_html.php
+++ b/program/include/rcmail_output_html.php
@@ -342,23 +342,35 @@ EOF;
public function get_skin_file($file, &$skin_path = null, $add_path = null)
{
$skin_paths = $this->skin_paths;
+
if ($add_path) {
array_unshift($skin_paths, $add_path);
+ $skin_paths = array_unique($skin_paths);
}
- foreach ($skin_paths as $skin_path) {
- if (realpath(RCUBE_INSTALL_PATH . $skin_path . $file)) {
- return $skin_path . $file;
- }
+ if ($skin_path = $this->find_file_path($file, $skin_paths)) {
+ return $skin_path . $file;
+ }
+ return false;
+ }
+
+ /**
+ * Find path of the asset file
+ */
+ protected function find_file_path($file, $skin_paths)
+ {
+ foreach ($skin_paths as $skin_path) {
if ($this->assets_dir != RCUBE_INSTALL_PATH) {
if (realpath($this->assets_dir . $skin_path . $file)) {
- return $skin_path . $file;
+ return $skin_path;
}
}
- }
- return false;
+ if (realpath(RCUBE_INSTALL_PATH . $skin_path . $file)) {
+ return $skin_path;
+ }
+ }
}
/**
@@ -827,7 +839,8 @@ EOF;
// correct absolute paths
if ($file[0] == '/') {
- $file = $this->base_path . $file;
+ $this->get_skin_file($file, $skin_path, $this->base_path);
+ $file = ($skin_path ?: $this->base_path) . $file;
}
// add file modification timestamp