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-05 14:30:42 +0300
committerPhie <phie@phie.ovh>2018-10-05 14:30:42 +0300
commitdc652534ee38806aef43f0262f77355f9610d3ac (patch)
tree09e8d708f7abb7474d398d480ecdba77f3e0aa86 /templates/settings.php
parentf9c00d120c86b221c82102aeead6db841d1d8e78 (diff)
fix snap
Diffstat (limited to 'templates/settings.php')
-rwxr-xr-xtemplates/settings.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/templates/settings.php b/templates/settings.php
index 8ec0045..85b53c0 100755
--- a/templates/settings.php
+++ b/templates/settings.php
@@ -1,10 +1,14 @@
<?php
-$currentpath = substr(get_defined_vars()["file"],strlen(getcwd())+1, -strlen("settings.php"))."/CarnetElectron/";
+$currentpath = substr(get_defined_vars()["file"],0, -strlen("settings.php"))."/CarnetElectron/";
+$root = substr(__DIR__, strlen($_SERVER['DOCUMENT_ROOT']));
+if (strpos(__DIR__, '/snap/') !== false) {
+ $root = "/extra-apps/carnet/templates";
+}
$file = file_get_contents($currentpath."settings/index.html");
//
-$file = str_replace("href=\"","href=\"".substr(__DIR__, strlen($_SERVER['DOCUMENT_ROOT']))."/CarnetElectron/",$file);
+$file = str_replace("href=\"","href=\"".$root."/CarnetElectron/",$file);
preg_match_all('/<script.*?src=\"(.*?\.js(?:\?.*?)?)"/si', $file, $matches, PREG_PATTERN_ORDER);
for ($i = 0; $i < count($matches[1]); $i++) {
@@ -13,8 +17,7 @@ for ($i = 0; $i < count($matches[1]); $i++) {
if($_['carnet_display_fullscreen']==="yes")
script("carnet","../templates/CarnetElectron/compatibility/nextcloud/browser_fullscreen");
$file = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $file);
-$root = substr(__DIR__, strlen($_SERVER['DOCUMENT_ROOT']));
$file = str_replace("src=\"","defer src=\"".$root."/CarnetElectron/",$file);
echo $file;
echo "<span style=\"display:none;\" id=\"root-url\">".$root."/CarnetElectron/</span>";
-?> \ No newline at end of file
+?>