diff options
author | Pierre-Alain Bandinelli <pa@bandinelli.net> | 2022-03-23 09:49:44 +0300 |
---|---|---|
committer | Pierre-Alain Bandinelli <pa@bandinelli.net> | 2022-03-23 09:49:44 +0300 |
commit | b078d1f1deadc6a581ad0c6bfd9bba5ed875376d (patch) | |
tree | 3cae7d04977676682e8498dfa15830669b9e936a | |
parent | 4de6909ad2d3c1b994de55607a7d30d1e53dc381 (diff) |
Backporting changes in app_path detection7.2.0b
-rw-r--r-- | app/rainloop/v/1.16.0/app/libraries/RainLoop/Utils.php | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/app/rainloop/v/1.16.0/app/libraries/RainLoop/Utils.php b/app/rainloop/v/1.16.0/app/libraries/RainLoop/Utils.php index ceb7f68..d772b8f 100644 --- a/app/rainloop/v/1.16.0/app/libraries/RainLoop/Utils.php +++ b/app/rainloop/v/1.16.0/app/libraries/RainLoop/Utils.php @@ -562,10 +562,10 @@ class Utils $sAppPath = ''; if (\RainLoop\Utils::IsOwnCloud()) { - if (\class_exists('OC_App')) - { - $sAppPath = \rtrim(\trim(\OC_App::getAppWebPath('rainloop')), '\\/').'/app/'; - } + $sAppPath = \OC::$server->getURLGenerator()->linkToRoute('rainloop.page.appGet'); + // TODO: Fix this ugly hack. Is there a "modern" way to return + // a URL that doesn't include index.php, which breaks things? + $sAppPath = preg_replace('/index\.php\//', '', $sAppPath); if (empty($sAppPath)) { @@ -577,9 +577,18 @@ class Utils } } } - - return $sAppPath; + /*Now trying to detect the apps folder to give the right URL for assets */ + $re = '/\/([a-zA-Z0-9-_\.]*)\/rainloop\/app\//m'; + $str = __FILE__; + preg_match($re, $str, $matches); + + if ($matches[1] == "apps") { + return $sAppPath; + } else { + return str_replace("/apps/rainloop/app", "/".$matches[1]."/rainloop/app", $sAppPath); + } } + /** * @return string */ |