diff --git a/.gitignore b/.gitignore index f00fed8..c932383 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea/* data/* !data/.gitkeep plugins/* diff --git a/assets/css/icecoder.css b/assets/css/icecoder.css index 3ac2e21..56983d3 100644 --- a/assets/css/icecoder.css +++ b/assets/css/icecoder.css @@ -13,6 +13,7 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .blackMask {position: fixed; display: table; width: 100%; height: 100%; top: 0; left: 0; visibility: hidden; background-color: rgba(0,0,0,0.8); text-align: center; z-index: 100} .blackMask .popupVCenter {#position: absolute; display: table-cell; #top: 50%; vertical-align: middle; text-align: center} .popupVCenter .popup {#position: relative; #top: -50%; text-align: center; color: #fff; font-size: 10px} +.popupVCenter .popup .imgDisplay {border: solid 10px #fff; max-width: 700px; max-height: 500px; background-color: #000; background-image: url('../images/checkerboard.png')} .floatingContainer {position: absolute; top: 0; left: 0; width: 55px; height: 55px; visibility: hidden; border: solid 1px #444; image-rendering: pixelated} .floatingContainer:before {position: absolute; display: inline-block; width: 3px; height: 3px; left: 25px; top: 25px; content: ''; border: solid 1px #b00} diff --git a/assets/js/icecoder.js b/assets/js/icecoder.js index dd53e02..da7c4b4 100644 --- a/assets/js/icecoder.js +++ b/assets/js/icecoder.js @@ -10,8 +10,9 @@ var ICEcoder = { // INIT // ==== - // URL we're viewing ICEcoder from + // URLs we're viewing ICEcoder and its assets from iceLoc: window.location.origin + window.location.pathname.replace(/\/$/, ""), + assetsLoc: get('icecoderJSFile').dataset.assetsRoot, // Define settings filesW: 250, // Width of files pane @@ -4429,7 +4430,7 @@ var ICEcoder = { this.openFiles.push(shortURL); // Setup a new tab - closeTabLink = ''; + closeTabLink = ''; get('tab' + (this.openFiles.length)).style.display = "inline-block"; fileName = this.openFiles[this.openFiles.length - 1]; fileExt = fileName.substr(fileName.lastIndexOf(".") + 1); @@ -4477,7 +4478,7 @@ var ICEcoder = { this.openFiles[tabNum - 1] = newName; // Setup a new tab - closeTabLink = ''; + closeTabLink = ''; fileName = this.openFiles[tabNum - 1]; fileExt = fileName.substr(fileName.lastIndexOf(".") + 1); get('tab' + tabNum).innerHTML = closeTabLink + "" + fileName.slice(fileName.lastIndexOf("/")).replace(/\//, ""); @@ -5301,7 +5302,7 @@ var ICEcoder = { "height": 55, "top": -55, "left": 0, - "title": "

Code editor awesomeness ...in your browser", + "title": "

Code editor awesomeness ...in your browser", "message": "View the quick start tutorial? (Well worthwhile!) or skip it.", "button": "view tutorial" }, diff --git a/classes/File.php b/classes/File.php index e9522a0..b392607 100644 --- a/classes/File.php +++ b/classes/File.php @@ -234,7 +234,7 @@ class File parent.parent.document.getElementById(\'blackMask\').style.visibility = "visible"; parent.parent.document.getElementById(\'mediaContainer\').innerHTML = "" + - " 700 || this.naturalHeight > 500) ? \', ' .$t['displayed at'] . '\' + this.width + \' x \' + this.height : \'\'; document.getElementById(\'imgInfo\').innerHTML += \' (\' + this.naturalWidth + \' x \' + this.naturalHeight + reducedImgMsg + \')\'; ICEcoder.initCanvasImage(this); ICEcoder.interactCanvasImage(this)\">
" + + " 700 || this.naturalHeight > 500) ? \', ' .$t['displayed at'] . '\' + this.width + \' x \' + this.height : \'\'; document.getElementById(\'imgInfo\').innerHTML += \' (\' + this.naturalWidth + \' x \' + this.naturalHeight + reducedImgMsg + \')\'; ICEcoder.initCanvasImage(this); ICEcoder.interactCanvasImage(this)\">
" + "
" + "' . $fileLoc . "/" . $fileName . '" + "

" + diff --git a/classes/Settings.php b/classes/Settings.php index e7172b0..4c82d26 100644 --- a/classes/Settings.php +++ b/classes/Settings.php @@ -7,8 +7,10 @@ class Settings public function __construct() { // Set version number and document root as core settings - $this->versionNo = "8.1"; - $this->docRoot = $_SERVER['DOCUMENT_ROOT']; + // Defaults to the right + $this->versionNo = "8.1"; // "8.1"; + $this->docRoot = $_SERVER['DOCUMENT_ROOT']; // $_SERVER['DOCUMENT_ROOT'] + $this->assetsRoot = "assets"; // "assets" (relative or absolute) } public function getCoreDetails() @@ -16,6 +18,7 @@ class Settings return [ "versionNo" => $this->versionNo, "docRoot" => $this->docRoot, + "assetsRoot" => $this->assetsRoot, ]; } diff --git a/editor.php b/editor.php index 7b7fa26..e9160a0 100644 --- a/editor.php +++ b/editor.php @@ -10,16 +10,16 @@ $t = $text['editor']; ICEcoder <?php echo $ICEcoder["versionNo"];?> editor - - - + + + - + "> - - - + + + - - - + + + diff --git a/files.php b/files.php index 95a9ad8..4ae7e44 100644 --- a/files.php +++ b/files.php @@ -9,10 +9,10 @@ $t = $text['files']; ICEcoder <?php echo $ICEcoder["versionNo"];?> file manager - - - - + + + + - - + + diff --git a/lib/bug-report.php b/lib/bug-report.php index 03aeb92..ac72427 100644 --- a/lib/bug-report.php +++ b/lib/bug-report.php @@ -2,6 +2,10 @@ include "headers.php"; include "settings.php" ; $t = $text['bug-report']; + +$assetsPath = "assets" === $settingsClass->assetsRoot + ? "../" . $settingsClass->assetsRoot + : $settingsClass->assetsRoot; ?> @@ -10,8 +14,8 @@ $t = $text['bug-report']; ICEcoder <?php echo $ICEcoder["versionNo"];?> bug report - - + + diff --git a/lib/help.php b/lib/help.php index 9d7e0d7..9db374d 100644 --- a/lib/help.php +++ b/lib/help.php @@ -2,6 +2,10 @@ include "headers.php"; include "settings.php"; $t = $text['help']; + +$assetsPath = "assets" === $settingsClass->assetsRoot + ? "../" . $settingsClass->assetsRoot + : $settingsClass->assetsRoot; ?> @@ -10,8 +14,8 @@ $t = $text['help']; ICEcoder <?php echo $ICEcoder["versionNo"];?> help - - + + diff --git a/lib/login.php b/lib/login.php index 1f843ed..aa6338f 100644 --- a/lib/login.php +++ b/lib/login.php @@ -25,6 +25,10 @@ if ($ICEcoder["multiUser"]) { } closedir($handle); } + +$assetsPath = "assets" === $settingsClass->assetsRoot + ? "../" . $settingsClass->assetsRoot + : $settingsClass->assetsRoot ?> @@ -37,9 +41,9 @@ echo true === $settingPW ? "Setup" : "Login"; - - - + + + setTimeout(function(){document.getElementById('screenContainer').style.opacity = '1'}, 50)"> @@ -47,7 +51,7 @@ echo true === $settingPW ? "Setup" : "Login";
- ICEcoder + ICEcoder
onsubmit="return checkCanSubmit();"> diff --git a/lib/multiple-results.php b/lib/multiple-results.php index c871233..04af6d8 100644 --- a/lib/multiple-results.php +++ b/lib/multiple-results.php @@ -8,6 +8,10 @@ $t = $text['multiple-results']; $selectedFiles = true === isset($_GET['selectedFiles']) ? explode(":", $_GET['selectedFiles']) : []; + +$assetsPath = "assets" === $settingsClass->assetsRoot + ? "../" . $settingsClass->assetsRoot + : $settingsClass->assetsRoot ?> @@ -16,8 +20,8 @@ $selectedFiles = true === isset($_GET['selectedFiles']) ICEcoder <?php echo $ICEcoder["versionNo"];?> multiple results screen - - + + diff --git a/lib/plugins-manager.php b/lib/plugins-manager.php index fe16e2d..29b80c6 100644 --- a/lib/plugins-manager.php +++ b/lib/plugins-manager.php @@ -149,6 +149,10 @@ function deletePlugin($dir) { closedir($theDir); rmdir($dir); } + +$assetsPath = "assets" === $settingsClass->assetsRoot + ? "../" . $settingsClass->assetsRoot + : $settingsClass->assetsRoot ?> @@ -157,8 +161,8 @@ function deletePlugin($dir) { ICEcoder <?php echo $ICEcoder["versionNo"];?> plugins manager - - + + diff --git a/lib/properties.php b/lib/properties.php index a4e9b20..95cd70b 100644 --- a/lib/properties.php +++ b/lib/properties.php @@ -9,6 +9,10 @@ $fileName=realpath($docRoot . $iceRoot . str_replace("|", "/", $_GET['fileName'] if (!file_exists($fileName) || 0 !== strpos(str_replace("\\", "/", $fileName),$docRoot)) { die(""); } + +$assetsPath = "assets" === $settingsClass->assetsRoot + ? "../" . $settingsClass->assetsRoot + : $settingsClass->assetsRoot ?> @@ -17,8 +21,8 @@ if (!file_exists($fileName) || 0 !== strpos(str_replace("\\", "/", $fileName),$d ICEcoder <?php echo $ICEcoder["versionNo"];?> file/folder properties - - + + diff --git a/lib/requirements.php b/lib/requirements.php index 4b1f69c..836b422 100644 --- a/lib/requirements.php +++ b/lib/requirements.php @@ -32,9 +32,9 @@ if (false === empty($reqsFailures)) { - - - + + + @@ -42,7 +42,7 @@ if (false === empty($reqsFailures)) {
- ICEcoder + ICEcoder
versionNo;?>
diff --git a/lib/settings-screen.php b/lib/settings-screen.php index c4a8a73..3d612ec 100644 --- a/lib/settings-screen.php +++ b/lib/settings-screen.php @@ -2,6 +2,10 @@ include "headers.php"; include "settings.php"; $t = $text['settings-screen']; + +$assetsPath = "assets" === $settingsClass->assetsRoot + ? "../" . $settingsClass->assetsRoot + : $settingsClass->assetsRoot ?> @@ -10,9 +14,9 @@ $t = $text['settings-screen']; ICEcoder <?php echo $ICEcoder["versionNo"];?> settings screen - - - + + + - + ' . PHP_EOL; + echo '' . PHP_EOL; } -// Do we have a tab to switch to? -$tabSwitchExtra = ""; -if (true === isset($_GET['tab'])) { - $tabSwitchExtra = "switchTab('" . $_GET['tab'] . "');"; -} ?> - + - +
- +

@@ -205,14 +204,18 @@ if (true === isset($_GET['tab'])) { // Display number of days backups available $backupDirBase = str_replace("\\", "/", dirname(__FILE__)) . "/../data/backups/"; $backupDirHost = "localhost"; - $backupDirsList = scandir($backupDirBase . $backupDirHost); - // Remove . and .. from array - for ($i = 0; $i < count($backupDirsList); $i++) { - if ($backupDirsList[$i] === "." || $backupDirsList[$i] === "..") { - array_splice($backupDirsList, $i, 1); - $i--; - } - } + if (true === is_dir($backupDirBase . $backupDirHost)) { + $backupDirsList = scandir($backupDirBase . $backupDirHost); + // Remove . and .. from array + for ($i = 0; $i < count($backupDirsList); $i++) { + if ($backupDirsList[$i] === "." || $backupDirsList[$i] === "..") { + array_splice($backupDirsList, $i, 1); + $i--; + } + } + } else { + $backupDirsList = []; + } // Display text re the number of days backups have taken place $backupNumDays = "" != $backupDirsList[0] && count($backupDirsList) > 0 ? count($backupDirsList) : 0; echo $backupNumDays . " " . (1 !== $backupNumDays ? $t['days'] : $t['day']) . " " . $t['of backups stored...']; @@ -594,6 +597,12 @@ function switchTab(tab) { function submitSettings() { ; } +
update
diff --git a/lib/settings-update.php b/lib/settings-update.php index 9697828..0ec5b2e 100644 --- a/lib/settings-update.php +++ b/lib/settings-update.php @@ -95,7 +95,8 @@ if (false === $demoMode && true === isset($_SESSION['loggedIn']) && true === $_S // Work out the theme to use now $themeURL = - "assets/css/theme/" . + $settingsClass->assetsRoot . + "/css/theme/" . ("default" === $ICEcoder["theme"] ? 'icecoder.css' : $ICEcoder["theme"] . '.css') . "?microtime=" . microtime(true); diff --git a/terminal.php b/terminal.php index 0c51e38..12477a7 100644 --- a/terminal.php +++ b/terminal.php @@ -9,7 +9,7 @@ include "lib/settings.php"; - +