Fix path refs for doNext

This commit is contained in:
mattpass
2020-03-01 09:18:04 +00:00
parent ffd17ba3f7
commit 63ff39d200

View File

@@ -103,7 +103,7 @@ if (isset($ftpSite)) {
ftpStart();
// Show user warning if no good connection
if (!$ftpConn || !$ftpLogin) {
$doNext .= 'parent.parent.ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");';
$doNext .= 'ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");';
}
}
@@ -186,24 +186,24 @@ if (!$error && $_GET['action']=="save") {
$fileMDTURLPart = isset($_GET["fileMDT"]) && $_GET["fileMDT"]!="undefined" ? "&fileMDT=".numClean($_GET['fileMDT']) : "";
$fileVersionURLPart = isset($_GET["fileVersion"]) && $_GET["fileVersion"]!="undefined" ? "&fileVersion=".numClean($_GET['fileVersion']) : "";
$doNext .= '
parent.parent.ICEcoder.serverMessage();
ICEcoder.serverMessage();
fileLoc = "'.$fileLoc.'";
overwriteOK = false;
noConflictSave = false;
newFileName = parent.parent.ICEcoder.getInput("'.$t['Enter filename to...'].' "+(fileLoc!="" ? fileLoc : "/"),"");
newFileName = ICEcoder.getInput("'.$t['Enter filename to...'].' "+(fileLoc!="" ? fileLoc : "/"),"");
if (newFileName) {
if (newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName};
newFileName = fileLoc + newFileName;
/* Check if file/dir exists */
parent.parent.ICEcoder.lastFileDirCheckStatusObj = false;
parent.parent.ICEcoder.checkExists(newFileName);
ICEcoder.lastFileDirCheckStatusObj = false;
ICEcoder.checkExists(newFileName);
var thisInt = setInterval(function() {
if (parent.parent.ICEcoder.lastFileDirCheckStatusObj != false) {
if (ICEcoder.lastFileDirCheckStatusObj != false) {
clearInterval(thisInt);
if (ICEcoder.lastFileDirCheckStatusObj.file && parent.parent.ICEcoder.lastFileDirCheckStatusObj.file.exists) {
overwriteOK = parent.parent.ICEcoder.ask("'.$t['That file exists...'].'");
if (ICEcoder.lastFileDirCheckStatusObj.file && ICEcoder.lastFileDirCheckStatusObj.file.exists) {
overwriteOK = ICEcoder.ask("'.$t['That file exists...'].'");
} else {
noConflictSave = true;
};
@@ -213,7 +213,7 @@ if (!$error && $_GET['action']=="save") {
newFileName = "'.(isset($ftpSite) ? "" : $docRoot).'" + newFileName;
saveURL = "lib/file-control-xhr.php?action=save'.$fileMDTURLPart.$fileVersionURLPart.'&csrf='.$_GET["csrf"].'";
var xhr = parent.parent.ICEcoder.xhrObj();
var xhr = ICEcoder.xhrObj();
xhr.onreadystatechange=function() {
if (xhr.readyState==4 && xhr.status==200) {
@@ -225,7 +225,7 @@ if (!$error && $_GET['action']=="save") {
/* console.log(statusObj); */
if (statusObj.status.error) {
parent.parent.ICEcoder.message(statusObj.status.errorMsg);
ICEcoder.message(statusObj.status.errorMsg);
} else {
eval(statusObj.action.doNext);
}
@@ -235,8 +235,8 @@ if (!$error && $_GET['action']=="save") {
/* console.log(\'Calling \'+saveURL+\' via XHR\'); */
xhr.open("POST",saveURL,true);
xhr.setRequestHeader(\'Content-type\', \'application/x-www-form-urlencoded\');
xhr.send(\'timeStart='.numClean($_POST["timeStart"]).'&file='.$fileURL.'&newFileName=\'+newFileName.replace(/\\\+/g,"%2B")+\'&contents=\'+encodeURIComponent(parent.parent.ICEcoder.saveAsContent));
parent.parent.ICEcoder.serverMessage("<b>'.$t['Saving'].'</b><br>" + "'.($finalAction == "Save" ? "newFileName" : "'".$fileName."'").'");
xhr.send(\'timeStart='.numClean($_POST["timeStart"]).'&file='.$fileURL.'&newFileName=\'+newFileName.replace(/\\\+/g,"%2B")+\'&contents=\'+encodeURIComponent(ICEcoder.saveAsContent));
ICEcoder.serverMessage("<b>'.$t['Saving'].'</b><br>" + "'.($finalAction == "Save" ? "newFileName" : "'".$fileName."'").'");
}
}
},10);
@@ -244,8 +244,8 @@ if (!$error && $_GET['action']=="save") {
/* UI dialog cancelling and saving contents for save as looparound */
if (!newFileName || newFileName && !overwriteOK) {
parent.parent.ICEcoder.saveAsContent = document.getElementById(\'saveTemp1\').value;
parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);
ICEcoder.saveAsContent = document.getElementById(\'saveTemp1\').value;
ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);
}';
// ===================
@@ -309,10 +309,10 @@ if (!$error && $_GET['action']=="save") {
}
// Write our file contents
if (!ftpWriteFile($ftpConn, $ftpFilepath, $contents, $ftpMode)) {
$doNext .= 'parent.parent.ICEcoder.message("Sorry, could not write '.$ftpFilepath.' at '.$ftpHost.'");';
$doNext .= 'ICEcoder.message("Sorry, could not write '.$ftpFilepath.' at '.$ftpHost.'");';
} else {
$doNext .= 'parent.parent.ICEcoder.openFileMDTs[parent.parent.ICEcoder.selectedTab-1]="'.$filemtime.'";';
$doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=parent.parent.ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();parent.parent.ICEcoder.updateVersionsDisplay();';
$doNext .= 'ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]="'.$filemtime.'";';
$doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();ICEcoder.updateVersionsDisplay();';
}
// Local saving
} else {
@@ -355,8 +355,8 @@ if (!$error && $_GET['action']=="save") {
}
clearstatcache();
$filemtime = $serverType=="Linux" ? filemtime($file) : "1000000";
$doNext .= 'parent.parent.ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]="'.$filemtime.'";';
$doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=parent.parent.ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();parent.parent.ICEcoder.updateVersionsDisplay();';
$doNext .= 'ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]="'.$filemtime.'";';
$doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();ICEcoder.updateVersionsDisplay();';
}
// Save a version controlled backup source of the file
@@ -445,30 +445,30 @@ if (!$error && $_GET['action']=="save") {
// Reload file manager, rename tab & remove old file highlighting if it was a new file
if (isset($_POST['newFileName']) && $_POST['newFileName']!="") {
$doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'file\');';
$doNext .= 'parent.parent.ICEcoder.renameTab(parent.parent.ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');';
$doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'file\');';
$doNext .= 'ICEcoder.renameTab(ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');';
if (!strpos($_REQUEST['file'],"[NEW]")) {
// We're saving as a new file, so unhighlight the old name in the file manager if visible
$doNext .= "fileLink = ICEcoder.filesFrame.contentWindow.document.getElementById('".str_replace("/","|",$fileLoc)."|".basename($_REQUEST['file'])."');";
$doNext .= "if (fileLink) {fileLink.style.backgroundColor = parent.parent.ICEcoder.tabBGnormal; fileLink.style.color = parent.parent.ICEcoder.tabFGnormalFile};";
$doNext .= "if (fileLink) {fileLink.style.backgroundColor = ICEcoder.tabBGnormal; fileLink.style.color = ICEcoder.tabFGnormalFile};";
}
}
// Reload previewWindow window if not a Markdown file
// In doing this, we check on an interval for the page to be complete and if we last saw it loading
// When we are done loading, so set the loading status to false and load plugins on..
$doNext .= 'if (parent.parent.ICEcoder.previewWindow.location && parent.parent.ICEcoder.previewWindow.location.pathname && parent.parent.ICEcoder.previewWindow.location.pathname.indexOf(".md")==-1) {
parent.parent.ICEcoder.previewWindowLoading = false;
parent.parent.ICEcoder.previewWindow.location.reload(true);
$doNext .= 'if (ICEcoder.previewWindow.location && ICEcoder.previewWindow.location.pathname && ICEcoder.previewWindow.location.pathname.indexOf(".md")==-1) {
ICEcoder.previewWindowLoading = false;
ICEcoder.previewWindow.location.reload(true);
parent.parent.ICEcoder.checkPreviewWindowLoadingInt = setInterval(function() {
if (parent.parent.ICEcoder.previewWindow.document.readyState != "loading" && parent.parent.ICEcoder.previewWindowLoading) {
parent.parent.ICEcoder.previewWindowLoading = false;
try {parent.parent.ICEcoder.doPesticide();} catch(err) {};
try {parent.parent.ICEcoder.doStatsJS(\'save\');} catch(err) {};
try {parent.parent.ICEcoder.doResponsive();} catch(err) {};
clearInterval(parent.parent.ICEcoder.checkPreviewWindowLoadingInt);
ICEcoder.checkPreviewWindowLoadingInt = setInterval(function() {
if (ICEcoder.previewWindow.document.readyState != "loading" && ICEcoder.previewWindowLoading) {
ICEcoder.previewWindowLoading = false;
try {ICEcoder.doPesticide();} catch(err) {};
try {ICEcoder.doStatsJS(\'save\');} catch(err) {};
try {ICEcoder.doResponsive();} catch(err) {};
clearInterval(ICEcoder.checkPreviewWindowLoadingInt);
} else {
parent.parent.ICEcoder.previewWindowLoading = parent.parent.ICEcoder.previewWindow.document.readyState == "loading" ? true : false;
ICEcoder.previewWindowLoading = ICEcoder.previewWindow.document.readyState == "loading" ? true : false;
}
},4);
@@ -476,20 +476,20 @@ if (!$error && $_GET['action']=="save") {
// Copy over content to diff pane if we have that setting on
$doNext .= '
cM = parent.parent.ICEcoder.getcMInstance();
cMdiff = parent.parent.ICEcoder.getcMdiffInstance();
if (parent.parent.ICEcoder.updateDiffOnSave) {
cM = ICEcoder.getcMInstance();
cMdiff = ICEcoder.getcMdiffInstance();
if (ICEcoder.updateDiffOnSave) {
cMdiff.setValue(cM.getValue());
};
';
// Finally, set previous files, indicate changes, set saved points and redo tabs
$doNext .= '
parent.parent.ICEcoder.setPreviousFiles();
ICEcoder.setPreviousFiles();
setTimeout(function(){ICEcoder.indicateChanges()},4);
parent.parent.ICEcoder.savedPoints[parent.parent.ICEcoder.selectedTab-1] = cM.changeGeneration();
parent.parent.ICEcoder.savedContents[parent.parent.ICEcoder.selectedTab-1] = cM.getValue();
parent.parent.ICEcoder.redoTabHighlight(parent.parent.ICEcoder.selectedTab);';
ICEcoder.savedPoints[ICEcoder.selectedTab-1] = cM.changeGeneration();
ICEcoder.savedContents[ICEcoder.selectedTab-1] = cM.getValue();
ICEcoder.redoTabHighlight(ICEcoder.selectedTab);';
// Run our custom processes
include_once("../processes/on-file-save.php");
@@ -505,21 +505,21 @@ if (!$error && $_GET['action']=="save") {
$doNext .= '
var loadedFile = document.createElement("textarea");
loadedFile.value = "'.str_replace('"','\\\"',str_replace("\r","\\\\r",str_replace("\n","\\\\n",str_replace("</textarea>","<ICEcoder:/:textarea>",$loadedFile)))).'";
var refreshFile = parent.parent.ICEcoder.ask("'.$t['Sorry, this file...'].'\\\n'.$file.'\\\n\\\n'.$t['Reload this file...'].'");
var refreshFile = ICEcoder.ask("'.$t['Sorry, this file...'].'\\\n'.$file.'\\\n\\\n'.$t['Reload this file...'].'");
if (refreshFile) {
var cM = parent.parent.ICEcoder.getcMInstance();
var thisTab = parent.parent.ICEcoder.selectedTab;
var cM = ICEcoder.getcMInstance();
var thisTab = ICEcoder.selectedTab;
var userVersionFile = cM.getValue();
/* Revert back to original */
cM.setValue(loadedFile.value);
parent.parent.ICEcoder.savedPoints[thisTab-1] = cM.changeGeneration();
parent.parent.ICEcoder.savedContents[thisTab-1] = cM.getValue();
parent.parent.ICEcoder.openFileMDTs[parent.parent.ICEcoder.selectedTab-1] = "'.$filemtime.'";
parent.parent.ICEcoder.openFileVersions[parent.parent.ICEcoder.selectedTab-1] = "'.$fileCountInfo['count'].'";
ICEcoder.savedPoints[thisTab-1] = cM.changeGeneration();
ICEcoder.savedContents[thisTab-1] = cM.getValue();
ICEcoder.openFileMDTs[ICEcoder.selectedTab-1] = "'.$filemtime.'";
ICEcoder.openFileVersions[ICEcoder.selectedTab-1] = "'.$fileCountInfo['count'].'";
cM.clearHistory();
/* Now for the new version in the diff pane */
parent.parent.ICEcoder.setSplitPane(\'on\');
var cMdiff = parent.parent.ICEcoder.getcMdiffInstance();
ICEcoder.setSplitPane(\'on\');
var cMdiff = ICEcoder.getcMdiffInstance();
cMdiff.setValue(userVersionFile);
};';
$finalAction = "nothing";
@@ -531,9 +531,9 @@ if (!$error && $_GET['action']=="save") {
} else {
$finalAction = "nothing";
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot save']."\\\\n".$file."');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot save']."\\\\n".$file."');";
}
$doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);';
$doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);';
}
};
@@ -548,7 +548,7 @@ if (!$error && $_GET['action']=="newFolder") {
if (isset($ftpSite)) {
$ftpFilepath = ltrim($fileLoc."/".$fileName,"/");
if (!ftpMkDir($ftpConn, octdec($ICEcoder['newDirPerms']), $ftpFilepath)) {
$doNext .= 'parent.parent.ICEcoder.message("Sorry, could not create dir '.$ftpFilepath.' at '.$ftpHost.'");';
$doNext .= 'ICEcoder.message("Sorry, could not create dir '.$ftpFilepath.' at '.$ftpHost.'");';
} else {
$updateFM = true;
}
@@ -560,16 +560,16 @@ if (!$error && $_GET['action']=="newFolder") {
}
// Update file manager on success
if ($updateFM) {
$doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'folder\');';
$doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'folder\');';
}
$finalAction = "newFolder";
// Run our custom processes
include_once("../processes/on-new-dir.php");
} else {
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot create...']."\\\\n".$fileLoc."');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot create...']."\\\\n".$fileLoc."');";
$finalAction = "nothing";
}
$doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);';
$doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);';
};
// ================
@@ -590,7 +590,7 @@ if (!$error && $_GET['action']=="move") {
// FTP
if (isset($ftpSite)) {
if (!ftpRename($ftpConn, $srcDir, $tgtDir)) {
$doNext .= 'parent.parent.ICEcoder.message("Sorry, could not rename '.$srcDir.' to '.$tgtDir.'");';
$doNext .= 'ICEcoder.message("Sorry, could not rename '.$srcDir.' to '.$tgtDir.'");';
} else {
$ftpFileDirInfo = ftpGetFileInfo($ftpConn, ltrim($fileLoc,"/"), $fileName);
$fileOrFolder = $ftpFileDirInfo['type'] == "directory" ? "folder" : "file";
@@ -606,20 +606,20 @@ if (!$error && $_GET['action']=="move") {
}
// Update file manager on success
if ($updateFM) {
$doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'move\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",str_replace("|","/",$_GET['oldFileName'])).'\',false,\''.$fileOrFolder.'\');';
$doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'move\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",str_replace("|","/",$_GET['oldFileName'])).'\',false,\''.$fileOrFolder.'\');';
}
$finalAction = "move";
// Run our custom processes
include_once("../processes/on-file-dir-move.php");
} else {
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot move']."\\\\n".str_replace("|","/",$_GET['oldFileName'])."\\\\n\\\\n".$t['Maybe public write...']."');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot move']."\\\\n".str_replace("|","/",$_GET['oldFileName'])."\\\\n\\\\n".$t['Maybe public write...']."');";
$finalAction = "nothing";
}
} else {
$doNext .= "";
$finalAction = "nothing";
}
$doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);';
$doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);';
};
// ==================
@@ -633,7 +633,7 @@ if (!$error && $_GET['action']=="rename") {
if (isset($ftpSite)) {
$ftpFilepath = ltrim($fileLoc."/".$fileName,"/");
if (!ftpRename($ftpConn, ltrim($_GET['oldFileName'],"/"), $ftpFilepath)) {
$doNext .= 'parent.parent.ICEcoder.message("Sorry, could not rename '.ltrim($_GET['oldFileName'],"/").' to '.$ftpFilepath.'");';
$doNext .= 'ICEcoder.message("Sorry, could not rename '.ltrim($_GET['oldFileName'],"/").' to '.$ftpFilepath.'");';
} else {
$updateFM = true;
}
@@ -644,16 +644,16 @@ if (!$error && $_GET['action']=="rename") {
}
// Update file manager on success
if ($updateFM) {
$doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",$_GET['oldFileName']).'\');';
$doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",$_GET['oldFileName']).'\');';
}
$finalAction = "rename";
// Run our custom processes
include_once("../processes/on-file-dir-rename.php");
} else {
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot rename']."\\\\n".$_GET['oldFileName']."\\\\n\\\\n".$t['Maybe public write...']."');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot rename']."\\\\n".$_GET['oldFileName']."\\\\n\\\\n".$t['Maybe public write...']."');";
$finalAction = "nothing";
}
$doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);';
$doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);';
};
// =================
@@ -702,15 +702,15 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="paste") {
}
}
// Reload file manager
$doNext .= 'parent.parent.ICEcoder.updateFileManagerList(\'add\',\''.str_replace("|","/",$_GET['location']).'\',\''.basename($dest).'\',false,false,false,\''.$fileOrFolder.'\');';
$doNext .= 'ICEcoder.updateFileManagerList(\'add\',\''.str_replace("|","/",$_GET['location']).'\',\''.basename($dest).'\',false,false,false,\''.$fileOrFolder.'\');';
$finalAction = "pasteFile";
// Run our custom processes
include_once("../processes/on-file-dir-paste.php");
} else {
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot copy']." \\\\n".str_replace($docRoot,"",$source)."\\\\n ".$t['into']." \\\\n".str_replace($docRoot,"",$dest)."');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot copy']." \\\\n".str_replace($docRoot,"",$source)."\\\\n ".$t['into']." \\\\n".str_replace($docRoot,"",$dest)."');";
$finalAction = "nothing";
}
$doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);';
$doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);';
};
// ==============
@@ -734,10 +734,10 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="upload") {
$setPerms = $ICEcoder['newFilePerms'];
}
if ($this->upload($current,$this->uploadFile,$setPerms)) {
$doNext .= 'parent.parent.ICEcoder.updateFileManagerList(\'add\',parent.parent.ICEcoder.selectedFiles[parent.parent.ICEcoder.selectedFiles.length-1].replace(/\|/g,\'/\'),\''.str_replace("'","\'",$fileName).'\',false,false,true,\'file\'); parent.parent.ICEcoder.serverMessage("'.$t['Uploaded file(s) OK'].'");setTimeout(function(){parent.parent.ICEcoder.serverMessage();},2000);';
$doNext .= 'ICEcoder.updateFileManagerList(\'add\',ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,\'/\'),\''.str_replace("'","\'",$fileName).'\',false,false,true,\'file\'); ICEcoder.serverMessage("'.$t['Uploaded file(s) OK'].'");setTimeout(function(){ICEcoder.serverMessage();},2000);';
$finalAction = "upload";
} else {
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot upload']." \\\\n".$fileName."\\\\n ".$t['into']." \\\\n'+parent.parent.ICEcoder.selectedFiles[parent.parent.ICEcoder.selectedFiles.length-1].replace(/\|/g,'/'));";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot upload']." \\\\n".$fileName."\\\\n ".$t['into']." \\\\n'+ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,'/'));";
$finalAction = "nothing";
}
}
@@ -768,11 +768,11 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="upload") {
// Run our custom processes
include_once("../processes/on-file-upload.php");
} else {
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot upload...']."');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot upload...']."');";
$finalAction = "nothing";
}
$doNext .= "parent.parent.ICEcoder.hideFileMenu();document.getElementById('fileInput').value='';parent.parent.ICEcoder.showHide('hide',document.getElementById('loadingMask'));";
$doNext .= "ICEcoder.hideFileMenu();document.getElementById('fileInput').value='';ICEcoder.showHide('hide',document.getElementById('loadingMask'));";
// Upload is not handled by XHR methods, but form post, so we need to manually trigger $doNext in a script tag
echo "<script>".$doNext."</script>";
@@ -793,16 +793,16 @@ if (!$error && $_GET['action']=="delete") {
if (!$demoMode && ftpDelete($ftpConn,$itemType,$itemPath)) {
if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";};
// Reload file manager
$doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');';
$doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');';
$finalAction = "delete";
// Run our custom processes
include_once("../processes/on-file-dir-delete.php");
} else {
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".$fileLoc."/".$fileName."');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".$fileLoc."/".$fileName."');";
$finalAction = "nothing";
}
} else {
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot delete more...']."');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot delete more...']."');";
$finalAction = "nothing";
}
// Local
@@ -813,7 +813,7 @@ if (!$error && $_GET['action']=="delete") {
$fullPath = $docRoot.$iceRoot.$fullPath;
if (rtrim($fullPath,"/") == rtrim($docRoot,"/")) {
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot delete...']."');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot delete...']."');";
} else if (!$demoMode && is_writable($fullPath)) {
if (is_dir($fullPath)) {
rrmdir($fullPath);
@@ -827,17 +827,17 @@ if (!$error && $_GET['action']=="delete") {
$fileLoc = dirname(str_replace($docRoot,"",$fullPath));
if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";};
// Reload file manager
$doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');';
$doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');';
$finalAction = "delete";
// Run our custom processes
include_once("../processes/on-file-dir-delete.php");
} else {
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".str_replace($docRoot,"",$fullPath)."');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".str_replace($docRoot,"",$fullPath)."');";
$finalAction = "nothing";
}
}
}
$doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);';
$doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);';
};
// The function to recursively remove folders & files
@@ -879,10 +879,10 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="replaceText") {
// Run our custom processes
include_once("../processes/on-file-replace-text.php");
} else {
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot replace...']."\\\\n".$file."');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot replace...']."\\\\n".$file."');";
$finalAction = "nothing";
}
$doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);';
$doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);';
};
// ==========================
@@ -896,17 +896,17 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="getRemoteFile") {
$remoteFile = str_replace("\r\n", $ICEcoder["lineEnding"], $remoteFile);
$remoteFile = str_replace("\r", $ICEcoder["lineEnding"], $remoteFile);
$remoteFile = str_replace("\n", $ICEcoder["lineEnding"], $remoteFile);
$doNext .= 'parent.parent.ICEcoder.newTab();';
$doNext .= 'parent.parent.ICEcoder.getcMInstance().setValue(\''.str_replace("\r","",str_replace("\t","\\\\t",str_replace("\n","\\\\n",str_replace("'","\\\\'",str_replace("\\","\\\\",preg_quote($remoteFile)))))).'\');';
$doNext .= 'parent.parent.ICEcoder.goToLine('.$lineNumber.');';
$doNext .= 'ICEcoder.newTab();';
$doNext .= 'ICEcoder.getcMInstance().setValue(\''.str_replace("\r","",str_replace("\t","\\\\t",str_replace("\n","\\\\n",str_replace("'","\\\\'",str_replace("\\","\\\\",preg_quote($remoteFile)))))).'\');';
$doNext .= 'ICEcoder.goToLine('.$lineNumber.');';
$finalAction = "getRemoteFile";
// Run our custom processes
include_once("../processes/on-get-remote-file.php");
} else {
$finalAction = "nothing";
$doNext .= 'parent.parent.ICEcoder.message(\''.$t['Sorry, could not...'].' '.$file.'\');';
$doNext .= 'ICEcoder.message(\''.$t['Sorry, could not...'].' '.$file.'\');';
}
$doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);';
$doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);';
};
// =======================
@@ -920,7 +920,7 @@ if (!$error && $_GET['action']=="perms") {
if (isset($ftpSite)) {
$ftpFilepath = ltrim($fileLoc."/".$fileName,"/");
if (!ftpPerms($ftpConn, octdec(numClean($_GET['perms'])), $ftpFilepath)) {
$doNext .= 'parent.parent.ICEcoder.message("Sorry, could not set perms on '.$ftpFilepath.' at '.$ftpHost.'");';
$doNext .= 'ICEcoder.message("Sorry, could not set perms on '.$ftpFilepath.' at '.$ftpHost.'");';
} else {
$updateFM = true;
}
@@ -932,16 +932,16 @@ if (!$error && $_GET['action']=="perms") {
}
// Update file manager on success
if ($updateFM) {
$doNext .= 'parent.parent.ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');';
$doNext .= 'ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');';
}
$finalAction = "perms";
// Run our custom processes
include_once("../processes/on-file-dir-perms.php");
} else {
$finalAction = "nothing";
$doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot change...']." \\n".$file."');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot change...']." \\n".$file."');";
}
$doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);';
$doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);';
};
// ====================
@@ -949,10 +949,10 @@ if (!$error && $_GET['action']=="perms") {
// ====================
if (!isset($ftpSite) && !$error && $_GET['action']=="checkExists") {
// This action is called under seperate AJAX call and the responseText object stored in parent.parent.ICEcoder.lastFileDirCheckStatusObj
// This action is called under seperate AJAX call and the responseText object stored in ICEcoder.lastFileDirCheckStatusObj
// Nothing really done here though, we do something with the responseText
$finalAction = "checkExists";
$doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);';
$doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);';
};
// ===================
@@ -1010,7 +1010,7 @@ echo '{
"timeEnd": 0,
"timeTaken": 0,
"csrf": "'.xssClean($_GET['csrf'],"html").'",
"doNext" : "'.preg_replace('/\r|\n/','',str_replace(' ','',str_replace('"','\"',$doNext))).'parent.parent.ICEcoder.switchMode();"
"doNext" : "'.preg_replace('/\r|\n/','',str_replace(' ','',str_replace('"','\"',$doNext))).'ICEcoder.switchMode();"
},
"status": {
"error" : '.($error ? 'true' : 'false').',