mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 15:24:00 +01:00
Merge branch 'temp'
Conflicts: lib/settings.php Fixing stupid Github problems
This commit is contained in:
76
editor.php
76
editor.php
@@ -35,47 +35,47 @@ span.CodeMirror-matchhighlight {background: #555}
|
||||
<body onLoad="top.ICEcoder.updateFileFolderCount()" style="color: #fff; margin: 0" onKeyDown="return top.ICEcoder.interceptKeys('content', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
|
||||
|
||||
<div style="margin: 32px 43px; font-family: arial; font-size: 10px; color: #ddd">
|
||||
<?php if($_SESSION['loggedIn']) {
|
||||
echo '<div style="float: left; margin-right: 50px">'.PHP_EOL;
|
||||
echo '<h2 style="color: rgba(0,198,255,0.7)">server</h2>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Server name, OS & IP:</span><br>'.PHP_EOL;
|
||||
echo $_SERVER['SERVER_NAME'].' '.$_SERVER['SERVER_SOFTWARE'].' '.$_SERVER['SERVER_ADDR'].'<br><br>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Root:</span><br>'.PHP_EOL;
|
||||
echo $docRoot.'<br><br>'.PHP_EOL;
|
||||
echo '<span style="color:#888">ICEcoder root:</span><br>'.PHP_EOL;
|
||||
echo $docRoot.$ICEcoder['root'].'<br><br>'.PHP_EOL;
|
||||
echo '<span style="color:#888">PHP version:</span><br>'.PHP_EOL;
|
||||
echo phpversion().'<br><br>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Date & time:</span><br>'.PHP_EOL;
|
||||
echo '<span id="serverDT"></span><br><br><br>'.PHP_EOL;
|
||||
echo '</div>'.PHP_EOL;
|
||||
<?php
|
||||
echo '<div style="float: left; margin-right: 50px">'.PHP_EOL;
|
||||
echo '<h2 style="color: rgba(0,198,255,0.7)">server</h2>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Server name, OS & IP:</span><br>'.PHP_EOL;
|
||||
echo $_SERVER['SERVER_NAME'].' '.$_SERVER['SERVER_SOFTWARE'].' '.$_SERVER['SERVER_ADDR'].'<br><br>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Root:</span><br>'.PHP_EOL;
|
||||
echo $docRoot.'<br><br>'.PHP_EOL;
|
||||
echo '<span style="color:#888">ICEcoder root:</span><br>'.PHP_EOL;
|
||||
echo $docRoot.$ICEcoder['root'].'<br><br>'.PHP_EOL;
|
||||
echo '<span style="color:#888">PHP version:</span><br>'.PHP_EOL;
|
||||
echo phpversion().'<br><br>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Date & time:</span><br>'.PHP_EOL;
|
||||
echo '<span id="serverDT"></span><br><br><br>'.PHP_EOL;
|
||||
echo '</div>'.PHP_EOL;
|
||||
|
||||
echo '<div style="float: left">'.PHP_EOL;
|
||||
echo '<h2 style="color: rgba(0,198,255,0.7)">files</h2>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Last 10 files opened:</span><br>'.PHP_EOL;
|
||||
$last10FilesArray = explode(",",$ICEcoder["last10Files"]);
|
||||
for ($i=0;$i<count($last10FilesArray);$i++) {
|
||||
if ($ICEcoder["last10Files"]=="") {
|
||||
echo '[none]<br><br>';
|
||||
} else {
|
||||
echo '<a style="cursor:pointer" onClick="top.ICEcoder.openFile(\''.str_replace("|","/",$last10FilesArray[$i]).'\')">';
|
||||
echo str_replace($docRoot,"",str_replace("|","/",$last10FilesArray[$i]));
|
||||
echo '</a><br>'.PHP_EOL;
|
||||
if ($i==count($last10FilesArray)-1) {echo '<br>'.PHP_EOL;};
|
||||
}
|
||||
echo '<div style="float: left">'.PHP_EOL;
|
||||
echo '<h2 style="color: rgba(0,198,255,0.7)">files</h2>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Last 10 files opened:</span><br>'.PHP_EOL;
|
||||
$last10FilesArray = explode(",",$ICEcoder["last10Files"]);
|
||||
for ($i=0;$i<count($last10FilesArray);$i++) {
|
||||
if ($ICEcoder["last10Files"]=="") {
|
||||
echo '[none]<br><br>';
|
||||
} else {
|
||||
echo '<a style="cursor:pointer" onClick="top.ICEcoder.openFile(\''.str_replace("|","/",$last10FilesArray[$i]).'\')">';
|
||||
echo str_replace($docRoot,"",str_replace("|","/",$last10FilesArray[$i]));
|
||||
echo '</a><br>'.PHP_EOL;
|
||||
if ($i==count($last10FilesArray)-1) {echo '<br>'.PHP_EOL;};
|
||||
}
|
||||
echo '<span style="color:#888">File & folder count:</span><br>'.PHP_EOL;
|
||||
echo '<div id="fileFolderCounts"></div><br><br><br>'.PHP_EOL;
|
||||
echo '</div>'.PHP_EOL;
|
||||
}
|
||||
echo '<span style="color:#888">File & folder count:</span><br>'.PHP_EOL;
|
||||
echo '<div id="fileFolderCounts"></div><br><br><br>'.PHP_EOL;
|
||||
echo '</div>'.PHP_EOL;
|
||||
|
||||
echo '<div style="clear: both">'.PHP_EOL;
|
||||
echo '<h2 style="color: rgba(0,198,255,0.7)">your device</h2>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Browser:</span><br>'.PHP_EOL;
|
||||
echo $_SERVER['HTTP_USER_AGENT'].'<br><br>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Your IP:</span><br>'.PHP_EOL;
|
||||
echo $_SERVER['REMOTE_ADDR'].PHP_EOL;
|
||||
echo '</div>'.PHP_EOL;
|
||||
}; ?>
|
||||
echo '<div style="clear: both">'.PHP_EOL;
|
||||
echo '<h2 style="color: rgba(0,198,255,0.7)">your device</h2>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Browser:</span><br>'.PHP_EOL;
|
||||
echo $_SERVER['HTTP_USER_AGENT'].'<br><br>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Your IP:</span><br>'.PHP_EOL;
|
||||
echo $_SERVER['REMOTE_ADDR'].PHP_EOL;
|
||||
echo '</div>'.PHP_EOL;
|
||||
?>
|
||||
<script>
|
||||
var nDT=<?php echo time()*1000;?>;
|
||||
setInterval(function(){
|
||||
|
||||
@@ -121,11 +121,7 @@ for ($i=0;$i<count($finalArray);$i++) {
|
||||
$fileAtts = '<span style="color: #888; font-size: 8px" id="'.str_replace($docRoot,"",str_replace("/","|",$fileFolderName)).'_perms">'.$chmodInfo.'</span>';
|
||||
}
|
||||
$type == "folder" ? $class = 'pft-directory' : $class = 'pft-file '.strtolower($ext);
|
||||
if ($_SESSION['loggedIn'] || (!$_SESSION['loggedIn'] && !$restrictedFile)) {
|
||||
echo "<li class=\"".$class."\"><a nohref title=\"$fileFolderName\" onMouseOver=\"top.ICEcoder.overFileFolder('$type','".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."')\" onMouseOut=\"top.ICEcoder.overFileFolder('$type','')\" style=\"position: relative; left:-22px\"> <span id=\"".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."\">".basename($fileFolderName)."</span> ".$fileAtts."</a>\n";
|
||||
} else {
|
||||
echo "<li class=\"".$class."\" style=\"cursor: default\"><span style=\"position: relative; left:-22px; color: #888\" onClick=\"top.ICEcoder.message('Sorry, you need higher admin level rights to view.')\"> [HIDDEN]</span>";
|
||||
}
|
||||
echo "<li class=\"".$class."\"><a nohref title=\"$fileFolderName\" onMouseOver=\"top.ICEcoder.overFileFolder('$type','".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."')\" onMouseOut=\"top.ICEcoder.overFileFolder('$type','')\" style=\"position: relative; left:-22px\"> <span id=\"".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."\">".basename($fileFolderName)."</span> ".$fileAtts."</a>\n";
|
||||
if ($i<count($finalArray)) {echo "</li>\n";}
|
||||
$lastPath = $fileFolderName;
|
||||
}
|
||||
|
||||
15
index.php
15
index.php
@@ -43,7 +43,7 @@ window.onbeforeunload = function() {
|
||||
}
|
||||
|
||||
previousFiles = [<?php
|
||||
if ($ICEcoder["previousFiles"]!="" && $_SESSION['loggedIn']) {
|
||||
if ($ICEcoder["previousFiles"]!="") {
|
||||
$openFilesArray = explode(",",$ICEcoder["previousFiles"]);
|
||||
echo "'".implode("','",$openFilesArray)."'";
|
||||
}
|
||||
@@ -55,10 +55,7 @@ showFileMenu = function() {
|
||||
<script language="JavaScript" src="lib/coder.js"></script>
|
||||
</head>
|
||||
|
||||
<body onLoad="ICEcoder.init(<?php
|
||||
if ($_SESSION['loggedIn']) {echo "'login'";};
|
||||
echo ")".$updateMsg.$onLoadExtras;
|
||||
?>" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);">
|
||||
<body onLoad="ICEcoder.init()<?php echo $updateMsg.$onLoadExtras;?>" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);">
|
||||
|
||||
<div id="blackMask" class="blackMask" onClick="ICEcoder.showHide('hide',this)">
|
||||
<div class="popupVCenter">
|
||||
@@ -101,14 +98,6 @@ echo ")".$updateMsg.$onLoadExtras;
|
||||
|
||||
<div id="files" class="files" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract'); top.document.getElementById('fileMenu').style.display='none';">
|
||||
<div class="account" id="account">
|
||||
<div class="accountLoginContainer" id="accountLoginContainer">
|
||||
<div class="accountLogin" id="accountLogin">
|
||||
<form name="login" action="lib/settings.php" method="POST" target="ff">
|
||||
<input type="password" name="loginPassword" class="accountPassword">
|
||||
<input type="submit" name="submit" value="Login" class="button">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="accountOptions">
|
||||
<div title="Save" onClick="ICEcoder.fMIcon('save')" id="fMSave" class="save"></div>
|
||||
<div title="Open" onClick="ICEcoder.fMIcon('open')" id="fMOpen" class="open"></div>
|
||||
|
||||
@@ -76,15 +76,8 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
|
||||
box-shadow: 0 0 10px 4px rgba(0,0,0,0.4);
|
||||
}
|
||||
.files .account {display: inline-block; height: 50px; width: 250px; margin-top: 40px; background-color: #888}
|
||||
.files .accountLoginContainer {position: absolute; width: 250px; height: 50px; z-index: 1}
|
||||
.files .accountLoginContainer .accountLogin {position: absolute; width: 250px; height: 50px; top: 0; background-color: #666;
|
||||
-webkit-transition: top 0.3s;
|
||||
-moz-transition: top 0.3s;
|
||||
transition: top 0.3s;
|
||||
}
|
||||
.files .accountOptions {position: relative; height: 32px; width: 100%; margin-left: 15px; margin-top: 8px}
|
||||
.files .accountOptions div {display: inline-block; background: url('../images/file-manager-icons.png') 0 0 no-repeat; cursor: pointer}
|
||||
.files .accountPassword {position: relative; border: 0; background-color: #333; color: #fff; height: 18px; width: 140px; margin-left: 14px; margin-top: 16px}
|
||||
.files .accountOptions .save {width: 30px; height: 32px; opacity: 0.3}
|
||||
.files .accountOptions .open {width: 25px; height: 32px; background-position: -32px -3px; margin: 3px 0 0 7px; opacity: 0.3}
|
||||
.files .accountOptions .newFile {width: 15px; height: 16px; background-position: -64px 0; margin: 8px 0 0 10px; opacity: 0.3}
|
||||
|
||||
33
lib/coder.js
33
lib/coder.js
@@ -31,7 +31,7 @@ var ICEcoder = {
|
||||
|
||||
// Set our aliases
|
||||
initAliases: function() {
|
||||
var aliasArray = ["header","files","account","accountLogin","fmLock","filesFrame","editor","tabsBar","findBar","content","footer","nestValid","nestDisplay","charDisplay"];
|
||||
var aliasArray = ["header","files","account","fmLock","filesFrame","editor","tabsBar","findBar","content","footer","nestValid","nestDisplay","charDisplay"];
|
||||
|
||||
// Create our ID aliases
|
||||
for (var i=0;i<aliasArray.length;i++) {
|
||||
@@ -40,21 +40,13 @@ var ICEcoder = {
|
||||
},
|
||||
|
||||
// On load, set the layout and get the nest location
|
||||
init: function(login) {
|
||||
init: function() {
|
||||
// Set layout & the nest location
|
||||
ICEcoder.setLayout();
|
||||
|
||||
// Hide the loading screen
|
||||
// Hide the loading screen & auto open last files?
|
||||
top.document.getElementById('loadingMask').style.visibility = "hidden";
|
||||
|
||||
// If we're logging in, slide the login area to reveal the icons
|
||||
if (login) {
|
||||
top.document.getElementById('accountLogin').style.top = "-50px";
|
||||
setTimeout(function() {top.document.getElementById('accountLoginContainer').style.display = "none";},300);
|
||||
if (top.openLastFiles) {top.ICEcoder.autoOpenFiles()};
|
||||
} else {
|
||||
top.document.getElementsByName('loginPassword')[0].focus();
|
||||
}
|
||||
if (top.openLastFiles) {top.ICEcoder.autoOpenFiles()};
|
||||
|
||||
// Add drag based events to our tabs
|
||||
var tabs = document.querySelectorAll('.tab');
|
||||
@@ -79,7 +71,7 @@ var ICEcoder = {
|
||||
// Apply sizes to various elements of the page
|
||||
headerH = 40, footerH = 30, accountH = 50, tabsBarH = 21, findBarH = 28;
|
||||
this.header.style.width = this.tabsBar.style.width = this.findBar.style.width = winW + "px";
|
||||
this.files.style.width = this.accountLogin.style.width = this.editor.style.left = this.filesW + "px";
|
||||
this.files.style.width = this.editor.style.left = this.filesW + "px";
|
||||
this.account.style.height = this.accountH + "px";
|
||||
this.fmLock.style.marginLeft = (this.filesW-42) + "px";
|
||||
this.filesFrame.style.height = (winH-headerH-accountH-footerH) + "px";
|
||||
@@ -1550,7 +1542,7 @@ var ICEcoder = {
|
||||
},
|
||||
|
||||
// Refresh file manager on demand
|
||||
refreshFileManager: function(loginAttempt) {
|
||||
refreshFileManager: function() {
|
||||
top.document.getElementById('progressBar').style.webkitAnimation = top.document.getElementById('progressBar').style.mozAnimation = '';
|
||||
setTimeout(function () {
|
||||
top.document.getElementById('progressBar').style.webkitAnimation = top.document.getElementById('progressBar').style.mozAnimation = 'fullexpand 10s ease-out';
|
||||
@@ -1561,19 +1553,6 @@ var ICEcoder = {
|
||||
top.ICEcoder.filesFrame.onload = function() {
|
||||
top.ICEcoder.filesFrame.style.opacity="1";
|
||||
top.document.getElementById('loadingMask').style.visibility = "hidden";
|
||||
if (loginAttempt) {
|
||||
if (loginAttempt == "loginOK") {
|
||||
if (top.ICEcoder.openFiles.length==0) {
|
||||
top.ICEcoder.content.style.visibility='visible';
|
||||
top.ICEcoder.content.src = "editor.php";
|
||||
}
|
||||
top.document.getElementById('accountLogin').style.top = "-50px";
|
||||
setTimeout(function() {top.document.getElementById('accountLoginContainer').style.display = "none";},300);
|
||||
if (top.openLastFiles) {top.ICEcoder.autoOpenFiles()};
|
||||
} else {
|
||||
top.ICEcoder.message('Sorry, that\'s not correct.');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ $ICEcoder = array(
|
||||
"lockedNav" => true,
|
||||
"accountPassword" => "",
|
||||
"restrictedFiles" => array("wp-",".php",".rb",".sql",".zip"),
|
||||
"bannedFiles" => array("_coder","wp-",".exe"),
|
||||
"bannedFiles" => array("_coder","ICEcoder"),
|
||||
"allowedIPs" => array("*"),
|
||||
"plugins" => array(
|
||||
array("Adminer","plugins/adminer/icon.png","margin-top: 3px","plugins/adminer/adminer-3.4.0-mysql-en.php","_blank",""),
|
||||
|
||||
@@ -31,18 +31,15 @@ if ($_GET['action']=="load") {
|
||||
$bannedFile=true;
|
||||
}
|
||||
}
|
||||
if (file_exists($file) && ($_SESSION['loggedIn'] || (!$_SESSION['loggedIn'] && !$bannedFile))) {
|
||||
if (file_exists($file)) {
|
||||
echo '<script>fileType="text";';
|
||||
echo 'top.ICEcoder.shortURL = top.ICEcoder.rightClickedFile = top.ICEcoder.thisFileFolderLink = "'.$fileLoc."/".$fileName.'";';
|
||||
echo '</script>';
|
||||
$loadedFile = file_get_contents($file);
|
||||
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",htmlentities($loadedFile)).'</textarea>';
|
||||
} else if (!file_exists($file)) {
|
||||
echo '<script>fileType="nothing";</script>';
|
||||
echo '<script>top.ICEcoder.message(\'Sorry, '.$fileLoc."/".$fileName.' doesn\\\'t seem to exist on the server\');</script>';
|
||||
} else {
|
||||
echo '<script>fileType="nothing";</script>';
|
||||
echo '<script>top.ICEcoder.message(\'Sorry, you need a higher admin level to view this file\');</script>';
|
||||
echo '<script>top.ICEcoder.message(\'Sorry, '.$fileLoc."/".$fileName.' doesn\\\'t seem to exist on the server\');</script>';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -53,35 +50,25 @@ if ($_GET['action']=="load") {
|
||||
|
||||
// If we're due to add a new folder...
|
||||
if ($_GET['action']=="newFolder") {
|
||||
if (is_writable($docRoot.$fileLoc) && $_SESSION['loggedIn']) {
|
||||
if (is_writable($docRoot.$fileLoc)) {
|
||||
mkdir($file, 0705);
|
||||
// Reload file manager
|
||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');action="newFolder";</script>';
|
||||
} else {
|
||||
echo "<script>top.ICEcoder.message('";
|
||||
if (!is_writable($docRoot.$fileLoc)) {
|
||||
echo "Sorry, cannot create folder at\\n".$fileLoc;
|
||||
} else {
|
||||
echo "Sorry, you need to be logged in to add folders";
|
||||
}
|
||||
echo "');action='nothing';</script>";
|
||||
echo "<script>top.ICEcoder.message('Sorry, cannot create folder at\\n".$fileLoc."');action='nothing';</script>";
|
||||
}
|
||||
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
|
||||
}
|
||||
|
||||
// If we're due to rename a file/folder...
|
||||
if ($_GET['action']=="rename") {
|
||||
if ($_SESSION['loggedIn'] && is_writable($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])))) {
|
||||
if (is_writable($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])))) {
|
||||
rename($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])),$docRoot.$fileLoc."/".$fileName);
|
||||
// Reload file manager
|
||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",strClean($_GET['oldFileName'])).'\');';
|
||||
echo 'action="rename";</script>';
|
||||
} else {
|
||||
if (!is_writable($_GET['oldFileName'])) {
|
||||
echo "<script>top.ICEcoder.message('Sorry, cannot rename\\n".strClean($_GET['oldFileName'])."');</script>";
|
||||
} else {
|
||||
echo '<script>top.ICEcoder.message(\'Sorry, you need to be logged in to rename\');</script>';
|
||||
}
|
||||
echo "<script>top.ICEcoder.message('Sorry, cannot rename\\n".strClean($_GET['oldFileName'])."');</script>";
|
||||
echo '<script>action="nothing";</script>';
|
||||
}
|
||||
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
|
||||
@@ -89,7 +76,7 @@ if ($_GET['action']=="rename") {
|
||||
|
||||
// If we're due to replace text in a file...
|
||||
if ($_GET['action']=="replaceText") {
|
||||
if ($_SESSION['loggedIn'] && is_writable(str_replace("|","/",strClean($_GET['fileRef'])))) {
|
||||
if (is_writable(str_replace("|","/",strClean($_GET['fileRef'])))) {
|
||||
$file = str_replace("|","/",strClean($_GET['fileRef']));
|
||||
$loadedFile = file_get_contents($file);
|
||||
$newContent = str_replace(strClean($_GET['find']),strClean($_GET['replace']),$loadedFile);
|
||||
@@ -98,11 +85,7 @@ if ($_GET['action']=="replaceText") {
|
||||
fclose($fh);
|
||||
echo '<script>action="replaceText";</script>';
|
||||
} else {
|
||||
if (!is_writable(str_replace("|","/",strClean($_GET['fileRef'])))) {
|
||||
echo "<script>top.ICEcoder.message('Sorry, cannot replace text in\\n".strClean($_GET['fileRef'])."');</script>";
|
||||
} else {
|
||||
echo '<script>top.ICEcoder.message(\'Sorry, you need to be logged in to rename\');</script>';
|
||||
}
|
||||
echo "<script>top.ICEcoder.message('Sorry, cannot replace text in\\n".strClean($_GET['fileRef'])."');</script>";
|
||||
echo '<script>action="nothing";</script>';
|
||||
}
|
||||
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
|
||||
@@ -110,17 +93,13 @@ if ($_GET['action']=="replaceText") {
|
||||
|
||||
// If we're due to change permissions on a file/folder...
|
||||
if ($_GET['action']=="perms") {
|
||||
if ($_SESSION['loggedIn'] && is_writable($file)) {
|
||||
if (is_writable($file)) {
|
||||
chmod($file,octdec(numClean($_GET['perms'])));
|
||||
// Reload file manager
|
||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');';
|
||||
echo 'action="perms";</script>';
|
||||
} else {
|
||||
if (!is_writable($file)) {
|
||||
echo "<script>top.ICEcoder.message('Sorry, cannot change permissions on \\n".strClean($file)."');</script>";
|
||||
} else {
|
||||
echo '<script>top.ICEcoder.message(\'Sorry, you need to be logged in to change permissions\');</script>';
|
||||
}
|
||||
echo "<script>top.ICEcoder.message('Sorry, cannot change permissions on \\n".strClean($file)."');</script>";
|
||||
echo '<script>action="nothing";</script>';
|
||||
}
|
||||
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
|
||||
@@ -128,28 +107,19 @@ if ($_GET['action']=="perms") {
|
||||
|
||||
// If we're due to delete a file...
|
||||
if ($_GET['action']=="delete") {
|
||||
if ($_SESSION['loggedIn']) {
|
||||
$filesArray = split(";",$file); // May contain more than one file here
|
||||
for ($i=0;$i<=count($filesArray)-1;$i++) {
|
||||
if (is_writable($iceRoot.$filesArray[$i])) {
|
||||
if (is_dir($iceRoot.$filesArray[$i])) {
|
||||
rrmdir($iceRoot.$filesArray[$i]);
|
||||
} else {
|
||||
unlink($iceRoot.$filesArray[$i]);
|
||||
}
|
||||
// Reload file manager
|
||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');';
|
||||
echo 'action="delete";</script>';
|
||||
$filesArray = split(";",$file); // May contain more than one file here
|
||||
for ($i=0;$i<=count($filesArray)-1;$i++) {
|
||||
if (is_writable($iceRoot.$filesArray[$i])) {
|
||||
if (is_dir($iceRoot.$filesArray[$i])) {
|
||||
rrmdir($iceRoot.$filesArray[$i]);
|
||||
} else {
|
||||
echo "<script>top.ICEcoder.message('Sorry can\\'t delete\\n".$filesArray[$i]."');</script>";
|
||||
unlink($iceRoot.$filesArray[$i]);
|
||||
}
|
||||
echo '<script>action="nothing";</script>';
|
||||
}
|
||||
} else {
|
||||
if (!is_writable($iceRoot.$filesArray[$i])) {
|
||||
echo "<script>top.ICEcoder.message('Sorry, cannot delete\\n".$iceRoot.$filesArray[$i]."');</script>";
|
||||
// Reload file manager
|
||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');';
|
||||
echo 'action="delete";</script>';
|
||||
} else {
|
||||
echo '<script>top.ICEcoder.message(\'Sorry, you need to be logged in to delete\');</script>';
|
||||
echo "<script>top.ICEcoder.message('Sorry can\\'t delete\\n".$filesArray[$i]."');</script>";
|
||||
}
|
||||
echo '<script>action="nothing";</script>';
|
||||
}
|
||||
@@ -174,54 +144,50 @@ if ($_GET['action']=="save") {
|
||||
echo '<script>action="save";</script>';
|
||||
// on the form posting via a reload, save the file
|
||||
if (isset($_POST['contents'])) {
|
||||
if ($_SESSION['loggedIn']) {
|
||||
if ((file_exists($file) && is_writable($file)) || isset($_POST['newFileName']) && $_POST['newFileName']!="") {
|
||||
if (filemtime($file)==$_GET['fileMDT']||!(isset($_GET['fileMDT']))) {
|
||||
$fh = fopen($file, 'w') or die("Sorry, cannot save");
|
||||
fwrite($fh, $_POST['contents']);
|
||||
fclose($fh);
|
||||
clearstatcache();
|
||||
echo '<script>top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.filemtime($file).'";</script>';
|
||||
// Reload file manager & rename tab if it was a new file
|
||||
if (isset($_POST['newFileName']) && $_POST['newFileName']!="") {
|
||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');</script>';
|
||||
echo '<script>top.ICEcoder.renameTab(top.ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');</script>';
|
||||
}
|
||||
// Reload stickytab window
|
||||
echo '<script>if (top.ICEcoder.stickyTabWindow.location) {top.ICEcoder.stickyTabWindow.location.reload()};action="doneSave";</script>';
|
||||
} else {
|
||||
$loadedFile = file_get_contents($file);
|
||||
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",htmlentities($loadedFile)).'</textarea>';
|
||||
echo '<textarea name="userVersionFile" id="userVersionFile"></textarea>';
|
||||
?>
|
||||
<script>
|
||||
var refreshFile = top.ICEcoder.ask('Sorry, this file has changed, cannot save\n<?php echo $file;?>\n\nReload this file and copy your version to a new document?');
|
||||
if (refreshFile) {
|
||||
var cM = top.ICEcoder.getcMInstance();
|
||||
var thisTab = top.ICEcoder.selectedTab;
|
||||
document.getElementById('userVersionFile').value = cM.getValue();
|
||||
// Revert back to original
|
||||
cM.setValue(document.getElementById('loadedFile').value);
|
||||
top.ICEcoder.changedContent[thisTab-1] = 0;
|
||||
top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1] = "<?php echo filemtime($file); ?>";
|
||||
cM.clearHistory();
|
||||
// Now for the new file
|
||||
top.ICEcoder.newTab();
|
||||
cM = top.ICEcoder.getcMInstance();
|
||||
cM.setValue(document.getElementById('userVersionFile').value);
|
||||
cM.clearHistory();
|
||||
// Finally, switch back to original tab
|
||||
top.ICEcoder.switchTab(thisTab);
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
echo "<script>action='nothing';</script>";
|
||||
if ((file_exists($file) && is_writable($file)) || isset($_POST['newFileName']) && $_POST['newFileName']!="") {
|
||||
if (filemtime($file)==$_GET['fileMDT']||!(isset($_GET['fileMDT']))) {
|
||||
$fh = fopen($file, 'w') or die("Sorry, cannot save");
|
||||
fwrite($fh, $_POST['contents']);
|
||||
fclose($fh);
|
||||
clearstatcache();
|
||||
echo '<script>top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.filemtime($file).'";</script>';
|
||||
// Reload file manager & rename tab if it was a new file
|
||||
if (isset($_POST['newFileName']) && $_POST['newFileName']!="") {
|
||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');</script>';
|
||||
echo '<script>top.ICEcoder.renameTab(top.ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');</script>';
|
||||
}
|
||||
} else {
|
||||
echo "<script>top.ICEcoder.message('Sorry, cannot write\\n".$file."');action='nothing';</script>";
|
||||
// Reload stickytab window
|
||||
echo '<script>if (top.ICEcoder.stickyTabWindow.location) {top.ICEcoder.stickyTabWindow.location.reload()};action="doneSave";</script>';
|
||||
} else {
|
||||
$loadedFile = file_get_contents($file);
|
||||
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",htmlentities($loadedFile)).'</textarea>';
|
||||
echo '<textarea name="userVersionFile" id="userVersionFile"></textarea>';
|
||||
?>
|
||||
<script>
|
||||
var refreshFile = top.ICEcoder.ask('Sorry, this file has changed, cannot save\n<?php echo $file;?>\n\nReload this file and copy your version to a new document?');
|
||||
if (refreshFile) {
|
||||
var cM = top.ICEcoder.getcMInstance();
|
||||
var thisTab = top.ICEcoder.selectedTab;
|
||||
document.getElementById('userVersionFile').value = cM.getValue();
|
||||
// Revert back to original
|
||||
cM.setValue(document.getElementById('loadedFile').value);
|
||||
top.ICEcoder.changedContent[thisTab-1] = 0;
|
||||
top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1] = "<?php echo filemtime($file); ?>";
|
||||
cM.clearHistory();
|
||||
// Now for the new file
|
||||
top.ICEcoder.newTab();
|
||||
cM = top.ICEcoder.getcMInstance();
|
||||
cM.setValue(document.getElementById('userVersionFile').value);
|
||||
cM.clearHistory();
|
||||
// Finally, switch back to original tab
|
||||
top.ICEcoder.switchTab(thisTab);
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
echo "<script>action='nothing';</script>";
|
||||
}
|
||||
} else {
|
||||
echo "<script>top.ICEcoder.message('Sorry, you need to be logged in to save');action='nothing';</script>";
|
||||
} else {
|
||||
echo "<script>top.ICEcoder.message('Sorry, cannot write\\n".$file."');action='nothing';</script>";
|
||||
}
|
||||
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
|
||||
}
|
||||
|
||||
@@ -39,17 +39,13 @@ echo number_format($outputSize, 2, '.', '').$outputUnit." (".number_format($byte
|
||||
<br><br>
|
||||
<span class="column" style="width: 180px">Type: <?php echo is_dir($fileName) ? "Folder" : "File"; ?></span>
|
||||
<span class="column" style="margin: 0 10px">Readable / Writeable: <?php
|
||||
if ($_SESSION['loggedIn']) {
|
||||
echo is_readable($fileName) ? "Yes" : "No"; ?> / <?php echo is_writeable($fileName) ? "Yes" : "No";
|
||||
} else {
|
||||
echo '[HIDDEN]';
|
||||
}
|
||||
echo is_readable($fileName) ? "Yes" : "No"; ?> / <?php echo is_writeable($fileName) ? "Yes" : "No";
|
||||
?></span>
|
||||
<span class="column">Relative path: <?php echo str_replace($docRoot,"",$fileName);?></span>
|
||||
<span style="font-size:10px">
|
||||
<br><br>
|
||||
Absolute path:<br><?php
|
||||
echo $_SESSION['loggedIn'] ? $fileName : '[HIDDEN]';
|
||||
echo $fileName;
|
||||
?>
|
||||
<br><br>
|
||||
</span>
|
||||
@@ -144,13 +140,7 @@ var validatePerms = function() {
|
||||
permText.split("")[2]*1 <0 || permText.split("")[2]*1 >7) {
|
||||
canUpdate = false;
|
||||
}
|
||||
<?php
|
||||
if ($_SESSION['loggedIn']) {
|
||||
?>
|
||||
if (canUpdate) {top.ICEcoder.chmod('<?php echo str_replace($docRoot,"",$fileName);?>',permText)};
|
||||
<?php
|
||||
;};
|
||||
?>
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -103,10 +103,8 @@ if (startTab!=top.ICEcoder.selectedTab) {
|
||||
} else if(stristr(file_get_contents($fullPath), $q)) {
|
||||
$rFile = false;
|
||||
$bFile = false;
|
||||
if (!$_SESSION['loggedIn']) {
|
||||
for ($i=0;$i<count($ICEcoder["restrictedFiles"]);$i++) {
|
||||
if (strpos($f,$ICEcoder['restrictedFiles'][$i])>0) {$rFile = true;};
|
||||
}
|
||||
for ($i=0;$i<count($ICEcoder["restrictedFiles"]);$i++) {
|
||||
if (strpos($f,$ICEcoder['restrictedFiles'][$i])>0) {$rFile = true;};
|
||||
}
|
||||
for ($i=0;$i<count($ICEcoder['bannedFiles']);$i++) {
|
||||
if (strpos($f,$ICEcoder['bannedFiles'][$i])>0) {$bFile = true;};
|
||||
|
||||
@@ -52,7 +52,7 @@ for ($i=0;$i<count($themeArray);$i++) {
|
||||
<br><br>
|
||||
|
||||
file manager root:<br>
|
||||
<?php echo $_SESSION['loggedIn'] ? $ICEcoder['root'] : '[HIDDEN]';?>
|
||||
<?php echo $ICEcoder['root'];?>
|
||||
<br><br><br><br>
|
||||
|
||||
<div style="font-size: 10px; line-height: 12px">ICE coder by Matt Pass (<a href="http://www.twitter.com/mattpass" style="font-size: 10px" target="_blank">@mattpass</a>)<br><br>
|
||||
@@ -202,7 +202,6 @@ var showHideTabs = function() {
|
||||
}
|
||||
|
||||
var validatePasswords = function() {
|
||||
<?php if($_SESSION['loggedIn']) { ?>
|
||||
if (document.settings.accountPassword.value != 0 && document.settings.accountPassword.value.length<8) {
|
||||
top.ICEcoder.message('Please use at least 8 chars in the password');
|
||||
} else {
|
||||
@@ -212,9 +211,6 @@ var validatePasswords = function() {
|
||||
document.settings.submit();
|
||||
}
|
||||
}
|
||||
<?php } else { ?>
|
||||
top.ICEcoder.message('Sorry, you need to be logged in to change settings');
|
||||
<?php ;}; ?>
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ include($settingsFile);
|
||||
|
||||
// Add ICEcoder settings to beginning of $ICEcoder array
|
||||
$ICEcoder = array(
|
||||
"versionNo" => "0.8.4",
|
||||
"versionNo" => "0.8.5",
|
||||
"codeMirrorDir" => "CodeMirror-2.33",
|
||||
"cMThisVer" => 2.33
|
||||
)+$ICEcoder;
|
||||
|
||||
Reference in New Issue
Block a user