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

github.com/CarnetApp/CarnetNextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhie <phie@phie.ovh>2018-10-08 23:09:31 +0300
committerPhie <phie@phie.ovh>2018-10-08 23:09:31 +0300
commit418ef5cb148c9a36dd2ecc86c47d1a2d70ed8756 (patch)
treef405b8baa41926233ccdac743d524820f8dcd13b /templates
parent6b67942cc8e1def97c0a0eea00ae1700ce7a0ac3 (diff)
fix path issues on some other servers
Diffstat (limited to 'templates')
-rwxr-xr-xtemplates/writer.php15
1 files changed, 7 insertions, 8 deletions
diff --git a/templates/writer.php b/templates/writer.php
index 3fb973d..7e449c8 100755
--- a/templates/writer.php
+++ b/templates/writer.php
@@ -1,19 +1,18 @@
<?php
-$currentpath = getcwd()."/";
+$currentpath = __DIR__."/CarnetElectron/";
+$root = \OCP\Util::linkToAbsolute("carnet","templates");
-$file = file_get_contents($currentpath."CarnetElectron/reader/reader.html");
-$file = str_replace("<!ROOTPATH>", "CarnetElectron/", $file);
+$file = file_get_contents($currentpath."reader/reader.html");
+$file = str_replace("<!ROOTPATH>", $root."/CarnetElectron/", $file);
$file = preg_replace_callback('/<script(.*?)src=\"(.*?\.js(?:\?.*?)?)"/s',function ($matches) {
global $currentpath;
return "<script".$matches[1]."src=\"".$matches[2]."?mtime=".filemtime($currentpath.$matches[2])."\"";
}, $file);
$root = substr(__DIR__, strlen($_SERVER['DOCUMENT_ROOT']));
-
-$file = str_replace("<!ROOTURL>", "CarnetElectron/", $file);
-$file = str_replace("<!APIURL>", "../../../index.php/apps/carnet/", $file);
-
-
+$urlGenerator = \OC::$server->getURLGenerator();
+$file = str_replace("<!ROOTURL>", $root."/CarnetElectron/", $file);
+$file = str_replace("<!APIURL>", $urlGenerator->linkToRouteAbsolute("carnet.page.index"), $file);
echo $file;
?> \ No newline at end of file