diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 1c27280..825a0e1 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1143,7 +1143,7 @@ var ICEcoder = { newFolder = top.ICEcoder.getInput('Enter new folder name at '+shortURL,''); if (newFolder) { newFolder = (shortURL + "/" + newFolder).replace(/\/\//,"/"); - top.ICEcoder.serverQueue("add","lib/file-control.php?action=newFolder&file="+newFolder.replace(/\//g,"|")+"&csrf="+top.ICEcoder.csrf); + top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=newFolder&csrf="+top.ICEcoder.csrf,newFolder.replace(/\//g,"|")); top.ICEcoder.serverMessage(''+top.t['Creating Folder']+'
'+newFolder); } }, @@ -1208,7 +1208,7 @@ var ICEcoder = { // Get remote file contents getRemoteFile: function(remoteFile) { - top.ICEcoder.serverQueue("add","lib/file-control.php?action=getRemoteFile&file="+remoteFile+"&csrf="+top.ICEcoder.csrf); + top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=getRemoteFile&csrf="+top.ICEcoder.csrf,remoteFile); top.ICEcoder.serverMessage(''+top.t['Getting']+'
'+remoteFile); }, @@ -1252,7 +1252,7 @@ var ICEcoder = { top.get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); top.get('tab'+(i+1)).title = newName; } - top.ICEcoder.serverQueue("add","lib/file-control.php?action=rename&file="+newName+"&oldFileName="+oldName.replace(/\|/g,"/")+"&csrf="+top.ICEcoder.csrf); + top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=rename&oldFileName="+oldName.replace(/\|/g,"/")+"&csrf="+top.ICEcoder.csrf,newName); top.ICEcoder.serverMessage(''+top.t['Renaming to']+'
'+newName); top.ICEcoder.setPreviousFiles(); @@ -1273,7 +1273,7 @@ var ICEcoder = { top.get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); top.get('tab'+(i+1)).title = newName; } - top.ICEcoder.serverQueue("add","lib/file-control.php?action=move&file="+newName+"&oldFileName="+oldName.replace(/\|/g,"/")+"&csrf="+top.ICEcoder.csrf); + top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=move&oldFileName="+oldName.replace(/\//g,"|")+"&csrf="+top.ICEcoder.csrf,newName.replace(/\//g,"|")); top.ICEcoder.serverMessage(''+top.t['Moving to']+'
'+newName); top.ICEcoder.setPreviousFiles(); @@ -1287,7 +1287,7 @@ var ICEcoder = { tgtFiles = fileList ? fileList : top.ICEcoder.selectedFiles; tgtListDisplay = tgtFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n"); if (tgtFiles.length>0 && top.ICEcoder.ask('Delete:\n\n'+tgtListDisplay+'?')) { - top.ICEcoder.serverQueue("add","lib/file-control.php?action=delete&file="+tgtFiles.join(";")+"&csrf="+top.ICEcoder.csrf); + top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=delete&&csrf="+top.ICEcoder.csrf,tgtFiles.join(";")); top.ICEcoder.serverMessage(''+top.t['Deleting File']+'
'+tgtListDisplay); }; }, @@ -1311,7 +1311,7 @@ var ICEcoder = { if (top.ICEcoder.copiedFiles) { for (var i=0; i'+top.t['Pasting File']+'
'+top.ICEcoder.copiedFiles[i].toString().replace(/\|/g,"/").replace(/,/g,"\n")); } else { top.ICEcoder.message(top.t['Sorry cannot paste...']); @@ -1735,7 +1735,7 @@ var ICEcoder = { // Replace text in a file replaceInFile: function(fileRef,find,replace) { - top.ICEcoder.serverQueue("add","lib/file-control.php?action=replaceText&fileRef="+fileRef.replace(/\//g,"|")+"&find="+find+"&replace="+replace+"&csrf="+top.ICEcoder.csrf); + top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=replaceText&fileRef="+fileRef.replace(/\//g,"|")+"&find="+find+"&replace="+replace+"&csrf="+top.ICEcoder.csrf,fileRef.replace(/\//g,"|")); top.ICEcoder.serverMessage(''+top.t['Replacing text in']+'
'+fileRef); }, @@ -2107,7 +2107,8 @@ var ICEcoder = { // If we've just removed from the array and there's another action queued up, or we're triggering for the first time // then do the next requested process, stored at array pos 0 if (action=="del" && ICEcoder.serverQueueItems.length>=1 || ICEcoder.serverQueueItems.length==1) { - if (item && item.indexOf('action=save')>0) { + // If we have an item, we're not saving previous file refs and not loading + if (item && (item.indexOf('saveFiles=')==-1 && item.indexOf('action=load')==-1)) { xhr = top.ICEcoder.xhrObj(); xhr.onreadystatechange=function() { if (xhr.readyState==4 && xhr.status==200) { @@ -2131,7 +2132,11 @@ var ICEcoder = { xhr.open("POST",ICEcoder.serverQueueItems[0],true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); timeStart = new Date().getTime(); - xhr.send('timeStart='+timeStart+'&file='+file+'&contents='+encodeURIComponent(top.document.getElementById('saveTemp1').value)); + if (item.indexOf('action=save')>0) { + xhr.send('timeStart='+timeStart+'&file='+file+'&contents='+encodeURIComponent(top.document.getElementById('saveTemp1').value)); + } else { + xhr.send('timeStart='+timeStart+'&file='+file); + } } else { setTimeout(function() {top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href=ICEcoder.serverQueueItems[0]},1); }