diff options
author | Phie <phie@phie.ovh> | 2018-08-21 18:39:12 +0300 |
---|---|---|
committer | Phie <phie@phie.ovh> | 2018-08-21 18:39:12 +0300 |
commit | 7d24cc0120859fc4e46b301c08effc97ddfbb1bb (patch) | |
tree | 94b5b52074022ceccd4c91073f217feaec38ca40 /templates/writer.php |
first commit for Carnet NC server
Diffstat (limited to 'templates/writer.php')
-rwxr-xr-x | templates/writer.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/templates/writer.php b/templates/writer.php new file mode 100755 index 0000000..7c46252 --- /dev/null +++ b/templates/writer.php @@ -0,0 +1,20 @@ +<?php +$currentpath = substr(get_defined_vars()["file"],strlen(getcwd())+1, -strlen("writer.php"))."/CarnetElectron/"; + +$file = file_get_contents($currentpath."reader/reader.html"); +// +$file = str_replace("href=\"","href=\"".substr(__DIR__, strlen($_SERVER['DOCUMENT_ROOT']))."/CarnetElectron/",$file); +$file = str_replace("<!ROOTPATH>", "", $file); +preg_match_all('/<script.*?src=\"(.*?\.js(?:\?.*?)?)"/si', $file, $matches, PREG_PATTERN_ORDER); +for ($i = 0; $i < count($matches[1]); $i++) { + + $url = substr($matches[1][$i],0,-3); + if (strpos($url, 'jquery.min') == false) //jquery already in nextcloud + script("carnet","../templates/CarnetElectron/".$url); +} +$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 |