Skip to content

Commit

Permalink
using more conventionnal ways to get path
Browse files Browse the repository at this point in the history
  • Loading branch information
PhieF committed Oct 8, 2018
1 parent 2e246f5 commit c80b2c9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
7 changes: 2 additions & 5 deletions templates/index.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<?php

$currentpath = substr(get_defined_vars()["file"],0, -strlen("index.php"))."/CarnetElectron/";
$root = substr(__DIR__, strlen($_SERVER['DOCUMENT_ROOT']));
if (strpos(__DIR__, '/snap/') !== false) {
$root = "/extra-apps/carnet/templates";
}
$currentpath = __DIR__."/CarnetElectron/";
$root = \OCP\Util::linkToAbsolute("carnet","templates");
$file = file_get_contents($currentpath."index.html");
//
$file = str_replace("href=\"","href=\"".$root."/CarnetElectron/",$file);
Expand Down
7 changes: 2 additions & 5 deletions templates/settings.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<?php

$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";
}
$currentpath = __DIR__."/CarnetElectron/";
$root = \OCP\Util::linkToAbsolute("carnet","templates");
$file = file_get_contents($currentpath."settings/index.html");

//
Expand Down
4 changes: 2 additions & 2 deletions templates/writer.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$currentpath = getcwd()."/CarnetElectron/";
$currentpath = getcwd()."/";

$file = file_get_contents($currentpath."reader/reader.html");
$file = file_get_contents($currentpath."CarnetElectron/reader/reader.html");
$file = str_replace("<!ROOTPATH>", "CarnetElectron/", $file);

$file = preg_replace_callback('/<script(.*?)src=\"(.*?\.js(?:\?.*?)?)"/s',function ($matches) {
Expand Down

0 comments on commit c80b2c9

Please sign in to comment.