diff options
Diffstat (limited to 'Neutron-trunk/resources/private')
-rw-r--r-- | Neutron-trunk/resources/private/.htaccess | 1 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/CodeEditor$2.php | 39 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/CodeEditor$3.php | 39 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/CodeEditor.php | 44 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/VisualEditor$2.php | 410 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/VisualEditor.php | 416 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/debug.php | 186 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/global.js._/index.php | 95 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/header.php | 5 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/headers/csettings-base.json | 8 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/headers/documentbody.php | 12 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/headers/documenthead.php | 139 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/headers/preprocessor.php | 224 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/license | 15 | ||||
-rw-r--r-- | Neutron-trunk/resources/private/relative.php | 31 |
15 files changed, 1664 insertions, 0 deletions
diff --git a/Neutron-trunk/resources/private/.htaccess b/Neutron-trunk/resources/private/.htaccess new file mode 100644 index 0000000..2c73686 --- /dev/null +++ b/Neutron-trunk/resources/private/.htaccess @@ -0,0 +1 @@ +Deny from All
\ No newline at end of file diff --git a/Neutron-trunk/resources/private/CodeEditor$2.php b/Neutron-trunk/resources/private/CodeEditor$2.php new file mode 100644 index 0000000..ec4abe9 --- /dev/null +++ b/Neutron-trunk/resources/private/CodeEditor$2.php @@ -0,0 +1,39 @@ +<p><input type="checkbox" name="wordwrap" id="wordwrap" onchange="ace.edit("editor").getSession().setUseWrapMode(document.getElementById('wordwrap').checked);" checked><label for="wordwrap"><?= $lang["editor"]["wrap"] ?></label></p> + +<div id="editor"></div> + +<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.6/ace.js" type="text/javascript" charset="utf-8"></script> +<script> + var codeeditor = ace.edit("editor"); + <?php + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/darktheme-enabled")) { + echo("ace.edit(\"editor\").setTheme('ace/theme/monokai');"); + } + + ?> + codeeditor.session.setMode("ace/mode/html"); + codeeditor.session.setUseWrapMode(true); + function loadAce() {} +</script> +<script>setInterval(() => {ace.edit("editor").session.setMode("ace/mode/html");}, 100)</script> +<div style="text-align: center;"> + <a onclick="createPageHTML();" class="mdc-button mdc-button--raised"> + <div class="mdc-button__ripple"></div> + <i class="material-icons-outlined mdc-button__icon" aria-hidden="true">publish</i> + <span class="mdc-button__label"><?= $lang["editor"]["publish"] ?></span> + </a> +</div> +<script> + window.onbeforeunload = function (e) { + e = e || window.event; + + // For IE and Firefox prior to version 4 + if (e) { + e.returnValue = "<?= $lang["editor"]["exit"] ?>"; + } + + // For Safari + return "<?= $lang["editor"]["exit"] ?>"; + }; +</script>
\ No newline at end of file diff --git a/Neutron-trunk/resources/private/CodeEditor$3.php b/Neutron-trunk/resources/private/CodeEditor$3.php new file mode 100644 index 0000000..83b0fa8 --- /dev/null +++ b/Neutron-trunk/resources/private/CodeEditor$3.php @@ -0,0 +1,39 @@ +<p><input type="checkbox" name="wordwrap" id="wordwrap" onchange="ace.edit("editor").getSession().setUseWrapMode(document.getElementById('wordwrap').checked);" checked><label for="wordwrap"><?= $lang["editor"]["wrap"] ?></label></p> + +<div id="editor"><?php echo(str_ireplace(">", ">", str_ireplace("<", "<", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json")))) ?></div> + +<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.6/ace.js" type="text/javascript" charset="utf-8"></script> +<script> + var codeeditor = ace.edit("editor"); + <?php + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/darktheme-enabled")) { + echo("ace.edit(\"editor\").setTheme('ace/theme/monokai');"); + } + + ?> + codeeditor.session.setMode("ace/mode/json"); + codeeditor.session.setUseWrapMode(true); + function loadAce() {} +</script> +<script>setInterval(() => {ace.edit("editor").session.setMode("ace/mode/json");}, 100)</script> +<div style="text-align: center;"> + <a onclick="pushSettings();" class="mdc-button mdc-button--raised"> + <div class="mdc-button__ripple"></div> + <i class="material-icons-outlined mdc-button__icon" aria-hidden="true">save</i> + <span class="mdc-button__label"><?= $lang["editor"]["save"] ?></span> + </a> +</div> +<script> + window.onbeforeunload = function (e) { + e = e || window.event; + + // For IE and Firefox prior to version 4 + if (e) { + e.returnValue = "<?= $lang["editor"]["exit"] ?>"; + } + + // For Safari + return "<?= $lang["editor"]["exit"] ?>"; + }; +</script>
\ No newline at end of file diff --git a/Neutron-trunk/resources/private/CodeEditor.php b/Neutron-trunk/resources/private/CodeEditor.php new file mode 100644 index 0000000..9a915ed --- /dev/null +++ b/Neutron-trunk/resources/private/CodeEditor.php @@ -0,0 +1,44 @@ +<p><input type="checkbox" name="wordwrap" id="wordwrap" onchange="ace.edit("editor").getSession().setUseWrapMode(document.getElementById('wordwrap').checked);" checked><label for="wordwrap"><?= $lang["editor"]["wrap"] ?></label></p> + +<div id="editor"><?php echo(str_ireplace(">", ">", str_ireplace("<", "<", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $currentSlug)))) ?></div> + +<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.6/ace.js" type="text/javascript" charset="utf-8"></script> +<script> + var codeeditor = ace.edit("editor"); + <?php + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/darktheme-enabled")) { + echo("ace.edit(\"editor\").setTheme('ace/theme/monokai');"); + } + + ?> + codeeditor.session.setMode("ace/mode/html"); + codeeditor.session.setUseWrapMode(true); + function loadAce() {} +</script> +<script>setInterval(() => {ace.edit("editor").session.setMode("ace/mode/html");}, 100)</script> +<div style="text-align: center;"> + <a onclick="updatePageHTML();" class="mdc-button mdc-button--raised"> + <div class="mdc-button__ripple"></div> + <i class="material-icons-outlined mdc-button__icon" aria-hidden="true">publish</i> + <span class="mdc-button__label"><?= $lang["editor"]["publish"] ?></span> + </a> + <a onclick="updatePageHTMLNoBack();" class="mdc-button mdc-button--outlined"> + <div class="mdc-button__ripple"></div> + <i class="material-icons-outlined mdc-button__icon" aria-hidden="true">save</i> + <span class="mdc-button__label"><?= $lang["editor"]["publishnoback"] ?></span> + </a> +</div> +<script> + window.onbeforeunload = function (e) { + e = e || window.event; + + // For IE and Firefox prior to version 4 + if (e) { + e.returnValue = "<?= $lang["editor"]["exit"] ?>"; + } + + // For Safari + return "<?= $lang["editor"]["exit"] ?>"; + }; +</script>
\ No newline at end of file diff --git a/Neutron-trunk/resources/private/VisualEditor$2.php b/Neutron-trunk/resources/private/VisualEditor$2.php new file mode 100644 index 0000000..e22b9d4 --- /dev/null +++ b/Neutron-trunk/resources/private/VisualEditor$2.php @@ -0,0 +1,410 @@ +<textarea name="content" id="editor"> + </textarea><br> +<div style="text-align: center;"> + <a onclick="createPageVisual();" class="mdc-button mdc-button--raised"> + <div class="mdc-button__ripple"></div> + <i class="material-icons-outlined mdc-button__icon" aria-hidden="true">publish</i> + <span class="mdc-button__label"><?= $lang["editor"]["publish"] ?></span> + </a> +</div> + <script> + let colors = [{ + color: 'hsl(0, 0%, 0%)', + }, + { + color: 'hsl(0, 0%, 12.5%)', + }, + { + color: 'hsl(0, 0%, 25%)', + }, + { + color: 'hsl(0, 0%, 37.5%)', + }, + { + color: 'hsl(0, 0%, 50%)', + }, + { + color: 'hsl(0, 0%, 62.5%)', + }, + { + color: 'hsl(0, 0%, 75%)', + }, + { + color: 'hsl(0, 0%, 87.5%)', + }, + { + color: 'hsl(0, 0%, 100%)', + hasBorder: true, + }, + { + color: 'hsl(0, 100%, 10%)', + }, + { + color: 'hsl(0, 100%, 12.5%)', + }, + { + color: 'hsl(0, 100%, 25%)', + }, + { + color: 'hsl(0, 100%, 37.5%)', + }, + { + color: 'hsl(0, 100%, 50%)', + }, + { + color: 'hsl(0, 100%, 62.5%)', + }, + { + color: 'hsl(0, 100%, 75%)', + }, + { + color: 'hsl(0, 100%, 87.5%)', + }, + { + color: 'hsl(0, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(30, 100%, 10%)', + }, + { + color: 'hsl(30, 100%, 12.5%)', + }, + { + color: 'hsl(30, 100%, 25%)', + }, + { + color: 'hsl(30, 100%, 37.5%)', + }, + { + color: 'hsl(30, 100%, 50%)', + }, + { + color: 'hsl(30, 100%, 62.5%)', + }, + { + color: 'hsl(30, 100%, 75%)', + }, + { + color: 'hsl(30, 100%, 87.5%)', + }, + { + color: 'hsl(30, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(60, 100%, 10%)', + }, + { + color: 'hsl(60, 100%, 12.5%)', + }, + { + color: 'hsl(60, 100%, 25%)', + }, + { + color: 'hsl(60, 100%, 37.5%)', + }, + { + color: 'hsl(60, 100%, 50%)', + }, + { + color: 'hsl(60, 100%, 62.5%)', + }, + { + color: 'hsl(60, 100%, 75%)', + }, + { + color: 'hsl(60, 100%, 87.5%)', + }, + { + color: 'hsl(60, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(90, 100%, 10%)', + }, + { + color: 'hsl(90, 100%, 12.5%)', + }, + { + color: 'hsl(90, 100%, 25%)', + }, + { + color: 'hsl(90, 100%, 37.5%)', + }, + { + color: 'hsl(90, 100%, 50%)', + }, + { + color: 'hsl(90, 100%, 62.5%)', + }, + { + color: 'hsl(90, 100%, 75%)', + }, + { + color: 'hsl(90, 100%, 87.5%)', + }, + { + color: 'hsl(90, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(120, 100%, 10%)', + }, + { + color: 'hsl(120, 100%, 12.5%)', + }, + { + color: 'hsl(120, 100%, 25%)', + }, + { + color: 'hsl(120, 100%, 37.5%)', + }, + { + color: 'hsl(120, 100%, 50%)', + }, + { + color: 'hsl(120, 100%, 62.5%)', + }, + { + color: 'hsl(120, 100%, 75%)', + }, + { + color: 'hsl(120, 100%, 87.5%)', + }, + { + color: 'hsl(120, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(150, 100%, 10%)', + }, + { + color: 'hsl(150, 100%, 12.5%)', + }, + { + color: 'hsl(150, 100%, 25%)', + }, + { + color: 'hsl(150, 100%, 37.5%)', + }, + { + color: 'hsl(150, 100%, 50%)', + }, + { + color: 'hsl(150, 100%, 62.5%)', + }, + { + color: 'hsl(150, 100%, 75%)', + }, + { + color: 'hsl(150, 100%, 87.5%)', + }, + { + color: 'hsl(150, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(180, 100%, 10%)', + }, + { + color: 'hsl(180, 100%, 12.5%)', + }, + { + color: 'hsl(180, 100%, 25%)', + }, + { + color: 'hsl(180, 100%, 37.5%)', + }, + { + color: 'hsl(180, 100%, 50%)', + }, + { + color: 'hsl(180, 100%, 62.5%)', + }, + { + color: 'hsl(180, 100%, 75%)', + }, + { + color: 'hsl(180, 100%, 87.5%)', + }, + { + color: 'hsl(180, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(210, 100%, 10%)', + }, + { + color: 'hsl(210, 100%, 12.5%)', + }, + { + color: 'hsl(210, 100%, 25%)', + }, + { + color: 'hsl(210, 100%, 37.5%)', + }, + { + color: 'hsl(210, 100%, 50%)', + }, + { + color: 'hsl(210, 100%, 62.5%)', + }, + { + color: 'hsl(210, 100%, 75%)', + }, + { + color: 'hsl(210, 100%, 87.5%)', + }, + { + color: 'hsl(210, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(240, 100%, 10%)', + }, + { + color: 'hsl(240, 100%, 12.5%)', + }, + { + color: 'hsl(240, 100%, 25%)', + }, + { + color: 'hsl(240, 100%, 37.5%)', + }, + { + color: 'hsl(240, 100%, 50%)', + }, + { + color: 'hsl(240, 100%, 62.5%)', + }, + { + color: 'hsl(240, 100%, 75%)', + }, + { + color: 'hsl(240, 100%, 87.5%)', + }, + { + color: 'hsl(240, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(270, 100%, 10%)', + }, + { + color: 'hsl(270, 100%, 12.5%)', + }, + { + color: 'hsl(270, 100%, 25%)', + }, + { + color: 'hsl(270, 100%, 37.5%)', + }, + { + color: 'hsl(270, 100%, 50%)', + }, + { + color: 'hsl(270, 100%, 62.5%)', + }, + { + color: 'hsl(270, 100%, 75%)', + }, + { + color: 'hsl(270, 100%, 87.5%)', + }, + { + color: 'hsl(270, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(300, 100%, 10%)', + }, + { + color: 'hsl(300, 100%, 12.5%)', + }, + { + color: 'hsl(300, 100%, 25%)', + }, + { + color: 'hsl(300, 100%, 37.5%)', + }, + { + color: 'hsl(300, 100%, 50%)', + }, + { + color: 'hsl(300, 100%, 62.5%)', + }, + { + color: 'hsl(300, 100%, 75%)', + }, + { + color: 'hsl(300, 100%, 87.5%)', + }, + { + color: 'hsl(300, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(330, 100%, 10%)', + }, + { + color: 'hsl(330, 100%, 12.5%)', + }, + { + color: 'hsl(330, 100%, 25%)', + }, + { + color: 'hsl(330, 100%, 37.5%)', + }, + { + color: 'hsl(330, 100%, 50%)', + }, + { + color: 'hsl(330, 100%, 62.5%)', + }, + { + color: 'hsl(330, 100%, 75%)', + }, + { + color: 'hsl(330, 100%, 87.5%)', + }, + { + color: 'hsl(330, 100%, 90%)', + hasBorder: true, + }]; + let editor; + ClassicEditor + .create( document.querySelector( '#editor' ), { + language: { + ui: <?= "'" . $langsel . "'" ?>, + content: <?= "'" . $langsel . "'" ?> + }, + toolbar: [ + 'undo', 'redo', '|', 'removeFormat', '|', 'heading', '|', 'fontSize', 'fontColor', 'fontBackgroundColor', 'alignment', '|', 'bold', 'italic', 'underline', 'strikethrough', '|', 'subscript', 'superscript', '|', 'code', '|', 'outdent', 'indent', '|', 'bulletedList', 'numberedList', '|', 'link', 'imageUpload', 'mediaEmbed', 'blockQuote', 'insertTable', 'codeBlock', '|', 'horizontalLine' + ], + fontColor: { + colors: colors, + columns: 9 + }, + } ) + + .then( newEditor => { + editor = newEditor; + } ) + .catch( error => { + console.error( error ); + } ); + </script> + <script> + window.onbeforeunload = function (e) { + e = e || window.event; + + // For IE and Firefox prior to version 4 + if (e) { + e.returnValue = "<?= $lang["editor"]["exit"] ?>"; + } + + // For Safari + return "<?= $lang["editor"]["exit"] ?>"; + }; + </script>
\ No newline at end of file diff --git a/Neutron-trunk/resources/private/VisualEditor.php b/Neutron-trunk/resources/private/VisualEditor.php new file mode 100644 index 0000000..7d25ef9 --- /dev/null +++ b/Neutron-trunk/resources/private/VisualEditor.php @@ -0,0 +1,416 @@ +<textarea name="content" id="editor"> + <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $currentSlug) ?> + </textarea><br> + <div style="text-align: center;"> + <a onclick="updatePage();" class="mdc-button mdc-button--raised"> + <div class="mdc-button__ripple"></div> + <i class="material-icons-outlined mdc-button__icon" aria-hidden="true">publish</i> + <span class="mdc-button__label"><?= $lang["editor"]["publish"] ?></span> + </a> + <a onclick="updatePageNoBack();" class="mdc-button mdc-button--outlined"> + <div class="mdc-button__ripple"></div> + <i class="material-icons-outlined mdc-button__icon" aria-hidden="true">save</i> + <span class="mdc-button__label"><?= $lang["editor"]["publishnoback"] ?></span> + </a> + </div> + <script> + let colors = [{ + color: 'hsl(0, 0%, 0%)', + }, + { + color: 'hsl(0, 0%, 12.5%)', + }, + { + color: 'hsl(0, 0%, 25%)', + }, + { + color: 'hsl(0, 0%, 37.5%)', + }, + { + color: 'hsl(0, 0%, 50%)', + }, + { + color: 'hsl(0, 0%, 62.5%)', + }, + { + color: 'hsl(0, 0%, 75%)', + }, + { + color: 'hsl(0, 0%, 87.5%)', + }, + { + color: 'hsl(0, 0%, 100%)', + hasBorder: true, + }, + { + color: 'hsl(0, 100%, 10%)', + }, + { + color: 'hsl(0, 100%, 12.5%)', + }, + { + color: 'hsl(0, 100%, 25%)', + }, + { + color: 'hsl(0, 100%, 37.5%)', + }, + { + color: 'hsl(0, 100%, 50%)', + }, + { + color: 'hsl(0, 100%, 62.5%)', + }, + { + color: 'hsl(0, 100%, 75%)', + }, + { + color: 'hsl(0, 100%, 87.5%)', + }, + { + color: 'hsl(0, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(30, 100%, 10%)', + }, + { + color: 'hsl(30, 100%, 12.5%)', + }, + { + color: 'hsl(30, 100%, 25%)', + }, + { + color: 'hsl(30, 100%, 37.5%)', + }, + { + color: 'hsl(30, 100%, 50%)', + }, + { + color: 'hsl(30, 100%, 62.5%)', + }, + { + color: 'hsl(30, 100%, 75%)', + }, + { + color: 'hsl(30, 100%, 87.5%)', + }, + { + color: 'hsl(30, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(60, 100%, 10%)', + }, + { + color: 'hsl(60, 100%, 12.5%)', + }, + { + color: 'hsl(60, 100%, 25%)', + }, + { + color: 'hsl(60, 100%, 37.5%)', + }, + { + color: 'hsl(60, 100%, 50%)', + }, + { + color: 'hsl(60, 100%, 62.5%)', + }, + { + color: 'hsl(60, 100%, 75%)', + }, + { + color: 'hsl(60, 100%, 87.5%)', + }, + { + color: 'hsl(60, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(90, 100%, 10%)', + }, + { + color: 'hsl(90, 100%, 12.5%)', + }, + { + color: 'hsl(90, 100%, 25%)', + }, + { + color: 'hsl(90, 100%, 37.5%)', + }, + { + color: 'hsl(90, 100%, 50%)', + }, + { + color: 'hsl(90, 100%, 62.5%)', + }, + { + color: 'hsl(90, 100%, 75%)', + }, + { + color: 'hsl(90, 100%, 87.5%)', + }, + { + color: 'hsl(90, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(120, 100%, 10%)', + }, + { + color: 'hsl(120, 100%, 12.5%)', + }, + { + color: 'hsl(120, 100%, 25%)', + }, + { + color: 'hsl(120, 100%, 37.5%)', + }, + { + color: 'hsl(120, 100%, 50%)', + }, + { + color: 'hsl(120, 100%, 62.5%)', + }, + { + color: 'hsl(120, 100%, 75%)', + }, + { + color: 'hsl(120, 100%, 87.5%)', + }, + { + color: 'hsl(120, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(150, 100%, 10%)', + }, + { + color: 'hsl(150, 100%, 12.5%)', + }, + { + color: 'hsl(150, 100%, 25%)', + }, + { + color: 'hsl(150, 100%, 37.5%)', + }, + { + color: 'hsl(150, 100%, 50%)', + }, + { + color: 'hsl(150, 100%, 62.5%)', + }, + { + color: 'hsl(150, 100%, 75%)', + }, + { + color: 'hsl(150, 100%, 87.5%)', + }, + { + color: 'hsl(150, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(180, 100%, 10%)', + }, + { + color: 'hsl(180, 100%, 12.5%)', + }, + { + color: 'hsl(180, 100%, 25%)', + }, + { + color: 'hsl(180, 100%, 37.5%)', + }, + { + color: 'hsl(180, 100%, 50%)', + }, + { + color: 'hsl(180, 100%, 62.5%)', + }, + { + color: 'hsl(180, 100%, 75%)', + }, + { + color: 'hsl(180, 100%, 87.5%)', + }, + { + color: 'hsl(180, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(210, 100%, 10%)', + }, + { + color: 'hsl(210, 100%, 12.5%)', + }, + { + color: 'hsl(210, 100%, 25%)', + }, + { + color: 'hsl(210, 100%, 37.5%)', + }, + { + color: 'hsl(210, 100%, 50%)', + }, + { + color: 'hsl(210, 100%, 62.5%)', + }, + { + color: 'hsl(210, 100%, 75%)', + }, + { + color: 'hsl(210, 100%, 87.5%)', + }, + { + color: 'hsl(210, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(240, 100%, 10%)', + }, + { + color: 'hsl(240, 100%, 12.5%)', + }, + { + color: 'hsl(240, 100%, 25%)', + }, + { + color: 'hsl(240, 100%, 37.5%)', + }, + { + color: 'hsl(240, 100%, 50%)', + }, + { + color: 'hsl(240, 100%, 62.5%)', + }, + { + color: 'hsl(240, 100%, 75%)', + }, + { + color: 'hsl(240, 100%, 87.5%)', + }, + { + color: 'hsl(240, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(270, 100%, 10%)', + }, + { + color: 'hsl(270, 100%, 12.5%)', + }, + { + color: 'hsl(270, 100%, 25%)', + }, + { + color: 'hsl(270, 100%, 37.5%)', + }, + { + color: 'hsl(270, 100%, 50%)', + }, + { + color: 'hsl(270, 100%, 62.5%)', + }, + { + color: 'hsl(270, 100%, 75%)', + }, + { + color: 'hsl(270, 100%, 87.5%)', + }, + { + color: 'hsl(270, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(300, 100%, 10%)', + }, + { + color: 'hsl(300, 100%, 12.5%)', + }, + { + color: 'hsl(300, 100%, 25%)', + }, + { + color: 'hsl(300, 100%, 37.5%)', + }, + { + color: 'hsl(300, 100%, 50%)', + }, + { + color: 'hsl(300, 100%, 62.5%)', + }, + { + color: 'hsl(300, 100%, 75%)', + }, + { + color: 'hsl(300, 100%, 87.5%)', + }, + { + color: 'hsl(300, 100%, 90%)', + hasBorder: true, + }, + { + color: 'hsl(330, 100%, 10%)', + }, + { + color: 'hsl(330, 100%, 12.5%)', + }, + { + color: 'hsl(330, 100%, 25%)', + }, + { + color: 'hsl(330, 100%, 37.5%)', + }, + { + color: 'hsl(330, 100%, 50%)', + }, + { + color: 'hsl(330, 100%, 62.5%)', + }, + { + color: 'hsl(330, 100%, 75%)', + }, + { + color: 'hsl(330, 100%, 87.5%)', + }, + { + color: 'hsl(330, 100%, 90%)', + hasBorder: true, + }]; + let editor; + ClassicEditor + .create( document.querySelector( '#editor' ), { + language: { + ui: <?= "'" . $langsel . "'" ?>, + content: <?= "'" . $langsel . "'" ?> + }, + toolbar: [ + 'undo', 'redo', '|', 'removeFormat', '|', 'heading', '|', 'fontSize', 'fontColor', 'fontBackgroundColor', 'alignment', '|', 'bold', 'italic', 'underline', 'strikethrough', '|', 'subscript', 'superscript', '|', 'code', '|', 'outdent', 'indent', '|', 'bulletedList', 'numberedList', '|', 'link', 'imageUpload', 'mediaEmbed', 'blockQuote', 'insertTable', 'codeBlock', '|', 'horizontalLine' + ], + fontColor: { + colors: colors, + columns: 9 + }, + } ) + + .then( newEditor => { + editor = newEditor; + } ) + .catch( error => { + console.error( error ); + } ); + </script> + <script> + window.onbeforeunload = function (e) { + e = e || window.event; + + // For IE and Firefox prior to version 4 + if (e) { + e.returnValue = "<?= $lang["editor"]["exit"] ?>"; + } + + // For Safari + return "<?= $lang["editor"]["exit"] ?>"; + }; + </script>
\ No newline at end of file diff --git a/Neutron-trunk/resources/private/debug.php b/Neutron-trunk/resources/private/debug.php new file mode 100644 index 0000000..86a721a --- /dev/null +++ b/Neutron-trunk/resources/private/debug.php @@ -0,0 +1,186 @@ +<?php + +function debugDump() { + global $_FNSN_DUMP_STARTDATE; + $_FNSN_DUMP_STOPDATE = new DateTime("now"); + $_FNSN_DUMP_DSTARTDATE = new DateTime("now"); + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/flag_boundaries")): ?> + +<style> + +* { + outline: 1px solid rgba(0, 0, 0, 0.3); +} + +div, blockquote, center { + outline: 1px solid rgba(255, 0, 0, 0.3); +} + +p, h1, h2, h3, h4, h5, h6 { + outline: 1px solid rgba(0, 255, 0, 0.3); +} + +span, i, u, b, s, sup, sub, code, mark { + outline: 1px solid rgba(0, 0, 255, 0.3); +} + +li, ol, ul, table { + outline: 1px solid rgba(0, 255, 255, 0.3); +} + +iframe, audio, video, frame, canvas, figure { + outline: 1px solid rgba(255, 0, 255, 0.3); +} + +svg, image, img { + outline: 1px solid rgba(255, 255, 0, 0.3); +} + +input, textarea { + outline: 1px solid rgba(255, 255, 255, 0.3); +} + +</style> +<?php endif;if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/flag_trace")): ?> + <style> + #neutron-dump { + background: white; + outline: none; + border-collapse: collapse; + color: black; + font-family: sans-serif !important; + } + + #neutron-dump td, #neutron-dump tr, #neutron-dump tbody { + border: 1px solid black; + font-family: sans-serif !important; + } + + #neutron-dump * { + font-family: sans-serif !important; + outline: none !important; + } + + #neutron-dump-title { + background: red; + color: white; + font-size: 24px; + } + + #neutron-dump-logo { + background-color: blue; + } + + #neutron-dump-category { + background-color: lightgray; + font-weight: bold; + } + </style> +<table id="neutron-dump"> + <tbody> + <tr> + <td colspan="3" id="neutron-dump-title"><span id="neutron-dump-logo">(i)</span> Neutron Debug</td> + </tr> + <tr> + <td colspan="3" id="neutron-dump-category">Loaded Files</td> + </tr> + <?php + $files = get_included_files(); + $sizes = []; + foreach ($files as $file) { + $sizes[] = filesize($file); + } + sort($sizes, SORT_NUMERIC); + $rev = array_reverse($sizes); + $max = $rev[0]; + $i = 1; + foreach ($files as $file) : ?> + <tr> + <td id="neutron-dump-cell"><?php if (filesize($file) == $max) { echo("<b>"); } ?><?= $i ?><?php if (filesize($file) == $max) { echo("</b>"); } ?></td> + <td id="neutron-dump-cell"><?php if (filesize($file) == $max) { echo("<b>"); } ?><?= $file ?><?php if (filesize($file) == $max) { echo("</b>"); } ?></td> + <td id="neutron-dump-cell"><?php if (filesize($file) == $max) { echo("<b>"); } ?><?= filesize($file) ?> B<?php if (filesize($file) == $max) { echo("</b>"); } ?></td> + </tr> + <?php $i++;endforeach; ?> + <tr> + <td colspan="3" id="neutron-dump-category">Processing Time</td> + </tr> + <tr> + <td colspan="2" id="neutron-dump-cell">Page Rendering</td> + <td id="neutron-dump-cell"><?= $_FNSN_DUMP_STARTDATE->diff($_FNSN_DUMP_STOPDATE)->f * 1000; ?> ms</td> + </tr> + <tr> + <td colspan="2" id="neutron-dump-cell">System Trace Creation</td> + <td id="neutron-dump-cell"><?php $_FNSN_DUMP_DSTOPDATE = new DateTime("now"); echo $_FNSN_DUMP_DSTARTDATE->diff($_FNSN_DUMP_DSTOPDATE)->f * 1000; ?> ms</td> + </tr> + <tr> + <td colspan="3" id="neutron-dump-category">Software Stack Version</td> + </tr> + <tr> + <td id="neutron-dump-cell">PHP Version</td> + <td colspan="2" id="neutron-dump-cell"><?= PHP_VERSION ?></td> + </tr> + <tr> + <td id="neutron-dump-cell">Server OS</td> + <td colspan="2" id="neutron-dump-cell"><?= php_uname('s') ?>:<?= php_uname('m') ?>@<?= php_uname('n') ?> <?= php_uname('r') ?></td> + </tr> + <tr> + <td id="neutron-dump-cell">Neutron Version</td> + <td colspan="2" id="neutron-dump-cell"><?= explode("-", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version"))[0] ?></td> + </tr> + <tr> + <td id="neutron-dump-cell">Electrode Compat. Layer</td> + <td colspan="2" id="neutron-dump-cell"><?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/electrode/version") ?></td> + </tr> + <tr> + <td id="neutron-dump-cell">JustAWebsite</td> + <td colspan="2" id="neutron-dump-cell"><?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/jaw_version") ?></td> + </tr> + <tr> + <td id="neutron-dump-cell">CyclicCMS</td> + <td colspan="2" id="neutron-dump-cell"><?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/cyclic_version") ?></td> + </tr> + <tr> + <td colspan="3" id="neutron-dump-category">Server Data</td> + </tr> + <tr> + <td colspan="3" id="neutron-dump-cell"> + <details style="cursor:pointer;"> + <summary>Click here to show</summary> + <table style="border-collapse:collapse;cursor:text;"> + <tbody> + <?php foreach ($_SERVER as $key => $srv): ?> + <tr> + <td id="neutron-dump-cell"><?= $key ?></td> + <td colspan="2" id="neutron-dump-cell"><?= $srv ?></td> + </tr> + <?php endforeach; ?> + </tbody> + </table> + </details> + </td> + </tr> + <tr> + <td colspan="3" id="neutron-dump-category">Headers</td> + </tr> + <?php foreach (getallheaders() as $key => $srv): ?> + <tr> + <td id="neutron-dump-cell"><?= $key ?></td> + <td colspan="2" id="neutron-dump-cell"><?php + + if (strtolower($key) == "cookie" || strtolower($key) == "set-cookie") { + echo("[hidden for safety]"); + } else { + echo($srv); + } + + + ?></td> + </tr> + <?php endforeach; ?> + </tbody> +</table> + + <?php + endif; +}
\ No newline at end of file diff --git a/Neutron-trunk/resources/private/global.js._/index.php b/Neutron-trunk/resources/private/global.js._/index.php new file mode 100644 index 0000000..2a721a8 --- /dev/null +++ b/Neutron-trunk/resources/private/global.js._/index.php @@ -0,0 +1,95 @@ +window.onerror = function(msg, url, line, col, error) { + if (msg == "ResizeObserver loop completed with undelivered notifications.") { + return; + } + if (typeof line != "undefined") { + if (typeof col != "undefined") { + linecol = "at line " + line + " and column " + col + } else { + linecol = "at line " + line + } + } + alert_full("Sorry, a runtime error occurred on this page:\n" + msg + "\n\nThe error is from " + url + "\n" + linecol + "\n\nWe suggest that you submit a bug report on Neutron's website and include above information."); +}; + +// New Ajax Lazy Loader +location.reloadLegacy = location.reload; +reloadPage = () => { location.reload() }; +ajaxPageReload = () => { + try { + document.title = "..."; + $('body').fadeOut(200); + $.ajax({ + type: "GET", + dataType: 'html', + url: location.href, + success: function (data) { + document.getElementsByTagName('html')[0].innerHTML = data + "<style>body{display:none;}</style>"; + setTimeout(() => { + $('body').fadeIn(200); + }, 500) + }, + error: function (error) { + location.reloadLegacy(); + }, + cache: false, + contentType: false, + processData: false + }); + } catch (err) { + location.reloadLegacy(); + } +} +switchToPage = (url) => { + try { + let stateObj = { + foo: ".", + }; + document.title = "..."; + history.pushState(stateObj, "page 2", "#/loading"); + $('body').fadeOut(200); + $.ajax({ + type: "GET", + dataType: 'html', + url: url, + success: function (data) { + document.getElementsByTagName('html')[0].innerHTML = data + "<style>body{display:none;}</style>"; + Array.from(document.getElementsByTagName('script')).forEach((el) => { + if (el.src.trim() == "") { + eval(el.innerHTML); + } + }); + if (location.pathname.startsWith("<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin")) { + $.ajax({ + type: "GET", + dataType: 'html', + url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/$resources/admin.js", + success: function (data) { + eval(data); + }, + error: function (error) { + console.error("Unable to load script at " + "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/$resources/admin.js"); + }, + cache: false, + contentType: false, + processData: false + }); + } + setTimeout(() => { + $('body').fadeIn(200); + history.pushState(stateObj, "page 2", url); + }, 500) + }, + error: function (error) { + console.log(error); + location.href = url; + }, + cache: false, + contentType: false, + processData: false + }); + } catch (err) { + console.log(err); + location.href = url; + } +}
\ No newline at end of file diff --git a/Neutron-trunk/resources/private/header.php b/Neutron-trunk/resources/private/header.php new file mode 100644 index 0000000..51f7886 --- /dev/null +++ b/Neutron-trunk/resources/private/header.php @@ -0,0 +1,5 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/preprocessor.php"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/documenthead.php"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/documentbody.php";
\ No newline at end of file diff --git a/Neutron-trunk/resources/private/headers/csettings-base.json b/Neutron-trunk/resources/private/headers/csettings-base.json new file mode 100644 index 0000000..51909c0 --- /dev/null +++ b/Neutron-trunk/resources/private/headers/csettings-base.json @@ -0,0 +1,8 @@ +{ + "customResources": { + "styles": "", + "script": "" + }, + "hiddenPages": [], + "showAdminButton": true +} diff --git a/Neutron-trunk/resources/private/headers/documentbody.php b/Neutron-trunk/resources/private/headers/documentbody.php new file mode 100644 index 0000000..3f8d8c1 --- /dev/null +++ b/Neutron-trunk/resources/private/headers/documentbody.php @@ -0,0 +1,12 @@ +<pjse-placeholder class="hide"> + <pjse-window> + <pjse-window-inner> + <pjse-title><?= $lang["header"]["pjseDefault"][0] ?></pjse-title> + <pjse-message><?= $lang["header"]["pjseDefault"][1] ?></pjse-message><br><br> + <pjse-close onclick="closeError()"><span><?= $lang["header"]["pjseDefault"][2] ?></span></pjse-close> + </pjse-window-inner> + </pjse-window> +</pjse-placeholder> + +<div id="snackbar"><?= $lang["header"]["snackbarDefault"] ?></div> +<div id="snowapi-placeholder"><div snowapi-enable-snowfall></div></div>
\ No newline at end of file diff --git a/Neutron-trunk/resources/private/headers/documenthead.php b/Neutron-trunk/resources/private/headers/documenthead.php new file mode 100644 index 0000000..a628016 --- /dev/null +++ b/Neutron-trunk/resources/private/headers/documenthead.php @@ -0,0 +1,139 @@ +<?php + +global $_FNSN_DUMP_STARTDATE; +$_FNSN_DUMP_STARTDATE = new DateTime("now"); + +// Preloader, if enabled +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/semantic_resourcesPreload")) { + echo('<link rel="preload" href="/resources/themes/colors/dark.js" as="script">'); + echo('<link rel="preload" href="/resources/themes/icons/classic.js" as="script">'); + echo('<link rel="preload" href="/resources/themes/icons/suru.js" as="script">'); + echo('<link rel="preload" href="/resources/js/right-click.js" as="script">'); + echo('<link rel="preload" href="/resources/js/jquery.js" as="script">'); + echo('<link rel="preload" href="/resources/lib/pushbar.js/library.js" as="script">'); + echo('<link rel="preload" href="/resources/lib/pushbar.js/library.css" as="style">'); + echo('<link rel="preload" href="/resources/css/ui.css" as="style">'); + echo('<link rel="preload" href="/resources/css/snowapi.css" as="style">'); + echo('<link rel="preload" href="/resources/css/setup.css" as="style">'); + echo('<link rel="preload" href="/resources/css/right-click.css" as="style">'); + echo('<link rel="preload" href="/resources/css/preview.css" as="style">'); + echo('<link rel="preload" href="/resources/css/main.css" as="style">'); + echo('<link rel="preload" href="/resources/css/index.php" as="style">'); + echo('<link rel="preload" href="/resources/css/error.css" as="style">'); + echo('<link rel="preload" href="/resources/css/admin.css" as="style">'); +} + +// This will run only if the website is ready +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent")) { + // Custom settings parser + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json")) { + if (dataValid(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json"))) { + $customSettings = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json")); + if (isset($customSettings->AfficherBoutonAdministration) && isset($customSettings->AdministrationBarreNavigation) && isset($customSettings->RessourcesPersonnalisées) && isset($customSettings->RessourcesPersonnalisées->CSS) && isset($customSettings->RessourcesPersonnalisées->JS) && isset($customSettings->PagesMasquées)) { // If it's using the old system, delete the file and generate a new one. + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json.bak", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json")); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/csettings-base.json")); + $continue = true; + } else { + $continue = true; + } + if ($continue) { + if (isset($customSettings->showAdminButton) && isset($customSettings->customResources) && isset($customSettings->customResources->styles) && isset($customSettings->customResources->script) && isset($customSettings->hiddenPages)) { + if (!$customSettings->showAdminButton) { + echo("<style>#siteadmin-button{display:none;}</style>"); + } + echo("<style type=\"text/css\">" . $customSettings->customResources->styles . "</style>"); + echo("<script type=\"text/javascript\">" . $customSettings->customResources->script . "</script>"); + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("<h1>" . $lang["header"]["internalError"][0] . "</h1><p>" . $lang["header"]["internalError"][1] . "</p><p>" . $lang["header"]["internalError"][2] . "<code>/data/webcontent/customSettings.json</code>" . $lang["header"]["internalError"][3] . "</p><hr><i> " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version") . " " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/codename") . "</i>"); + } + } + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("<h1>" . $lang["header"]["internalError"][0] . "</h1><p>" . $lang["header"]["internalError"][4] . "</p><p>" . $lang["header"]["internalError"][2] . "<code>/data/webcontent/customSettings.json</code>" . $lang["header"]["internalError"][3] . "</p><hr><i> " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version") . " " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/codename") . "</i>"); + } + } else { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/csettings-base.json")); + } +} + +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/styles.css")) { + echo('<link rel="stylesheet" href="' . $GLOBALS["SYSTEM_ROOT"] . '/resources/upload/styles.css">'); // Custom styles loader +} +echo('<script src="' . $GLOBALS["SYSTEM_ROOT"] . '/resources/js/jquery.js"></script>'); // JQuery, used at almost all pages + +echo("<script>"); +require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/global.js._/index.php"; +echo("</script>"); // Global Scripts + +?> + +<script> + +String.prototype.replaceAll = function(search, replacement) { + var target = this; + return target.replace(new RegExp(search, 'g'), replacement); +}; + +roo_alert = false; + +function alert_full(text, refreshOnOk) { + try { + if (text == "ResizeObserver loop completed with undelivered notifications.") { + return; + } + if (typeof refreshOnOk == "boolean") { + roo_alert = refreshOnOk; + } + if (typeof text == "string") { + document.querySelector('pjse-message').innerHTML = text.replaceAll(">", ">").replaceAll("<", "<").replaceAll("\n", "<br>") + } else { + document.querySelector('pjse-message').innerHTML = "<?= $lang["header"]["pjseDefault"][1] ?>" + } + $("pjse-placeholder").fadeIn(200) + document.querySelector('body').childNodes.forEach((el) => { + if (typeof el.classList != "undefined") { + if (el.localName != "pjse-placeholder") { + el.classList.add("pjse-blurry") + } + } + }) + } catch (err) { + alert("<?= $lang["header"]["errorError"] ?>"); + } +} + +function alert(text, refreshOnOk) { + if (typeof refreshOnOk == "boolean") { + if (refreshOnOk == true) { + console.warn("The refresh on OK feature isn't available on new errors, showing the legacy one"); + alert_full(text, refreshOnOk) + return; + } + } + var x = document.getElementById("snackbar"); + + if (typeof text == "string") { + x.innerHTML = text.replaceAll(">", ">").replaceAll("<", "<").replaceAll("\n", "<br>"); + } else { + x.innerHTML = "<?= $lang["header"]["snackbarDefault"] ?>"; + } + + x.className = "snackbar_show"; + + setTimeout(function(){ x.className = x.className.replace("show", ""); }, 5000); +} + +function closeError() { + $("pjse-placeholder").fadeOut(200) + document.querySelector('body').childNodes.forEach((el) => { + if (typeof el.classList != "undefined") { + if (el.localName != "pjse-placeholder") { + el.classList.remove("pjse-blurry") + } + } + }) + if (roo_alert) { + reloadPage() + } +} + +</script> diff --git a/Neutron-trunk/resources/private/headers/preprocessor.php b/Neutron-trunk/resources/private/headers/preprocessor.php new file mode 100644 index 0000000..84ff3f0 --- /dev/null +++ b/Neutron-trunk/resources/private/headers/preprocessor.php @@ -0,0 +1,224 @@ +<?php + +if (!function_exists("rlgps")) { + function rlgps(string $message) {} +} + +// Check if website is ready +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent")) { + $ready = true; +} else { + $ready = false; +} + +// Disable removed widgets +if ($ready) { + $json = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/widgets.json")); + if (!isset($json->_neutronMigrationDone)) { + $widgets = $json->list; + + $index = 0; + foreach ($widgets as $widget) { + if ($widget === "notes" || $widget === "contact") { + array_splice($widgets, $index, 1); + } + $index++; + } + + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/widgets.json", json_encode([ + "list" => $widgets, + "_neutronMigrationDone" => true + ])); + } +} + +$_MD_INCLUDES = $GLOBALS["SYSTEM_ROOT"] . "/resources/lib/material"; // Path to Material Design files, can be changed if files are bundled with the code +$_MDI_PATH = $GLOBALS["SYSTEM_ROOT"] . "/resources/lib/material/iconfont.css"; // Path to Material Icons font, can be changed if files are bundled with the code + +// Generate favicon if not yet generated +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/favicon.png") && $ready) { + require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/favicon.php"; +} + +// Dark/light/dynamic theme + color +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/theme") && $ready) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/theme", "auto"); +} + +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/color") && $ready) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/color", "blue"); +} + +// Trim Build Values +try { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version", trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version"))); +} catch (E_WARNING $err) {} +try { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/api/codename", trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/codename"))); +} catch (E_WARNING $err) {} +try { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/api/experimental", trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/experimental"))); +} catch (E_WARNING $err) {} +try { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/api/public", trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/public"))); +} catch (E_WARNING $err) {} +try { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/api/bugs", trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/bugs"))); +} catch (E_WARNING $err) {} + +// Functions to get localized name and description of a plugin +function getDescription($config) { + $langsel = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/lang"); + + if (isset($config->description->$langsel)) { + return $config->description->$langsel; + } else { + return $config->description->en; + } +} + +function getName($config) { + $langsel = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/lang"); + + if (isset($config->name->$langsel)) { + return $config->name->$langsel; + } else { + return $config->name->en; + } +} + +// Language Loader +require $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php"; + +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache") && $ready) { // Cache directory + mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache"); +} + +// Function to check if a JSON string is valid +function dataValid($string) { + json_decode($string); + return (json_last_error() == JSON_ERROR_NONE); +} + +// Custom Styles, create directory +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/styles.json")) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/styles.json", "[]"); +} + +// Connections Log +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log") && $ready) { + if (strpos($_SERVER['HTTP_USER_AGENT'], "MinteckProjectsAutoUptime") !== false) {} else { // Don't log for Auto-Uptime bot + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log") . date("d/m/Y H:i:s") . " - INTERFACE/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); + } +} else { + if (strpos($_SERVER['HTTP_USER_AGENT'], "MinteckProjectsAutoUptime") !== false || !$ready) {} else { // Don't log for Auto-Uptime bot + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", date("d/m/Y H:i:s") . " - INTERFACE/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); + } +} + +// Migrate old "adminkey" to new "authkey" +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/adminkey")) { + copy($_SERVER['DOCUMENT_ROOT'] . "/data/adminkey", $_SERVER['DOCUMENT_ROOT'] . "/data/authkey"); + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/adminkey"); +} + +/* Old statistics system, not used anymore */ +/*try { // Failing is not important + // Statistics directory + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/stats")) {} else { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent")) { + mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/stats"); + } + } + + // Only if website ready + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/")) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/stats/" . date("Y-m-d"))) { + if (strpos($_SERVER['HTTP_USER_AGENT'], "MinteckProjectsAutoUptime") !== false) {} else { // Don't log for Auto-Uptime bot + (int)$actual = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/stats/" . date("Y-m-d")); + $actual = $actual + 1; + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/stats/" . date("Y-m-d"), $actual); + } + } else { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/stats/" . date("Y-m-d"), "1"); + } + } +} catch (E_WARNING $err) { +}*/ + +// New statistics system +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats")) {} else { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent")) { + mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats"); + } +} + +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/")) { + if (isset($_SERVER['REMOTE_ADDR']) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats")) { + //$hash = @password_hash($_SERVER['REMOTE_ADDR'], PASSWORD_DEFAULT, [ "salt" => "net.minteckprojects.fns.neutron.stats" ]); // Storing IP addresses is illegal in EU, so just a hashed IP addresses + $hash = md5($_SERVER['REMOTE_ADDR']); // Changed to MD5 sum instead of encrypted IP because salt not supported anymore + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y'))) {} else { + mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y')); + } + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m'))) {} else { + mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m')); + } + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m') . "/" . date('d'))) { + $file = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m') . "/" . date('d')); + $lines = explode("\n", $file); + + $already = false; + foreach ($lines as $line) { + if (trim($line) == "" || trim($line) == "\n") {} else { + if (trim($line) == trim($hash)) { + $already = true; + } + } + } + + if (!$already) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m') . "/" . date('d'), file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m') . "/" . date('d')) . $hash . "\n"); + } + } else { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m') . "/" . date('d'), $hash . "\n"); + } + } +} + +// Check for updates at random intervals +if (rand(0, 10) == 5) { + try { + $version = explode("-", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version"))[0]; + $json = json_decode(@file_get_contents(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/update") . "/" . $version . "/updates.json")); + + if (isset($json)) { + if (json_last_error() != JSON_ERROR_NONE) { + $updates = -1; + } + + if ($json->version->name != $version) { + $updates = -1; + } + + foreach ($json->updates as $update) { + if (!isset($updates)) { + $updates = 1; + } + } + + if (!isset($updates)) { + $updates = 0; + } + } else { + $updates = -1; + } + + if ($updates == 1) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/updates", ""); + } else { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/updates")) { + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/updates"); + } + } + } catch (E_WARNING $err) {} +} diff --git a/Neutron-trunk/resources/private/license b/Neutron-trunk/resources/private/license new file mode 100644 index 0000000..6a62c67 --- /dev/null +++ b/Neutron-trunk/resources/private/license @@ -0,0 +1,15 @@ +Neutron, a new way to design your websites +Copyright (C) 2019-%year% Minteck + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <https://www.gnu.org/licenses/>.
\ No newline at end of file diff --git a/Neutron-trunk/resources/private/relative.php b/Neutron-trunk/resources/private/relative.php new file mode 100644 index 0000000..d9156e6 --- /dev/null +++ b/Neutron-trunk/resources/private/relative.php @@ -0,0 +1,31 @@ +<?php
+
+function getRelativeDetails($source) {
+ global $__root;
+
+ $GLOBALS["ORIGINAL_DOCUMENT_ROOT"] = $_SERVER['DOCUMENT_ROOT'];
+
+ if (substr($_SERVER['REQUEST_URI'], 0, strlen($source) + 1) === "/" . $source) {
+ $__root = "";
+ $GLOBALS["SYSTEM_ROOT"] = "";
+ $GLOBALS["SYSTEM_PREFIXED"] = false;
+ } else {
+ $_SERVER['DOCUMENT_ROOT'] = $_SERVER['DOCUMENT_ROOT'] . "/" . explode("/", $_SERVER["PHP_SELF"])[1];
+ $__root = "/" . explode("/", $_SERVER["PHP_SELF"])[1];
+ $GLOBALS["SYSTEM_ROOT"] = "/" . explode("/", $_SERVER["PHP_SELF"])[1];
+ $GLOBALS["SYSTEM_PREFIXED"] = true;
+ }
+
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/oldRenderer") && $GLOBALS["SYSTEM_PREFIXED"]) {
+ header("Content-Type: text/plain");
+ echo("Error: Neutron Titanium does not support relative URLs! Please delete ./data/webcontent/oldRenderer and try again.");
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit();
+ }
+
+ if (isset($__electrode) && $__electrode) {
+ $__root = "";
+ $GLOBALS["SYSTEM_ROOT"] = "";
+ $_SERVER['DOCUMENT_ROOT'] = $GLOBALS["ORIGINAL_DOCUMENT_ROOT"];
+ $GLOBALS["SYSTEM_PREFIXED"] = false;
+ }
+}
\ No newline at end of file |