summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/helpers/gallery.php')
-rw-r--r--modules/gallery/helpers/gallery.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index b6d4fee0..37a08d08 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -96,7 +96,18 @@ class gallery_Core {
return "lib/$file";
}
- return is_string($file_name) ? substr($file_name, strlen(DOCROOT)) : $file_name;
+ if (is_string($file_name)) {
+ // make relative to DOCROOT
+ $parts = explode("/", $file_name);
+ foreach ($parts as $idx => $part) {
+ if (in_array($part, array("application", "modules", "themes", "lib"))) {
+ break;
+ }
+ unset($parts[$idx]);
+ }
+ $file_name = implode("/", $parts);
+ }
+ return $file_name;
}
} \ No newline at end of file