Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit b009ef2

Browse files
author
mattpass
committed
Remove stray old code, error if fail to move or rename
1 parent a905b0b commit b009ef2

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

assets/js/icecoder.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2078,7 +2078,6 @@ var ICEcoder = {
20782078
let i, closeTabLink, fileName;
20792079

20802080
if (newName && newName !== oldName) {
2081-
i = this.openFiles.indexOf(oldName.replace(/\|/g, "/"));
20822081
if (this.ask("Are you sure you want to move file " + oldName + " to " + newName + " ?")){
20832082
this.serverQueue("add", iceLoc + "/lib/file-control.php?action=move&oldFileName=" + encodeURIComponent(oldName.replace(/\//g, "|")) + "&csrf=" + this.csrf, encodeURIComponent(newName.replace(/\//g, "|")));
20842083
this.serverMessage('<b>' + t['Moving to'] + '</b><br>' + newName);

lib/file-control.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,15 @@
248248
$fileOrFolder = is_dir($docRoot . $fileLoc . "/" . $fileName) ? "folder" : "file";
249249
$fileClass->updateFileManager('move', $fileLoc, $fileName, '', str_replace($iceRoot, "", str_replace("|", "/", $_GET['oldFileName'])), '', $fileOrFolder);
250250
$doNext .= 'tabNum = ICEcoder.openFiles.indexOf(\'' . str_replace("|", "/", $_GET['oldFileName']) . '\') + 1; if (0 < tabNum) {ICEcoder.renameTab(tabNum, \'' . $fileLoc . "/" . $fileName . '\');};';
251+
$finalAction = "move";
252+
// Run any extra processes
253+
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
254+
$doNext = $extraProcessesClass->onFileDirMove($doNext);
255+
} else {
256+
$doNext .= "ICEcoder.message('" . $t['Sorry, cannot move'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
257+
$finalAction = "nothing";
251258
}
252259
}
253-
$finalAction = "move";
254-
// Run any extra processes
255-
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
256-
$doNext = $extraProcessesClass->onFileDirMove($doNext);
257260
} else {
258261
$doNext .= "ICEcoder.message('" . $t['Sorry, cannot move'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
259262
$finalAction = "nothing";
@@ -290,12 +293,12 @@
290293
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
291294
$doNext = $extraProcessesClass->onFileDirRename($doNext);
292295
} else {
293-
$doNext .= "ICEcoder.message('".$t['Sorry, cannot rename'] . "\\\\n" . $_GET['oldFileName'] . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
296+
$doNext .= "ICEcoder.message('".$t['Sorry, cannot rename'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['does not seem...'] . "');";
294297
$finalAction = "nothing";
295298
}
296299
}
297300
} else {
298-
$doNext .= "ICEcoder.message('".$t['Sorry, cannot rename'] . "\\\\n" . $_GET['oldFileName'] . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
301+
$doNext .= "ICEcoder.message('".$t['Sorry, cannot rename'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
299302
$finalAction = "nothing";
300303
}
301304
$doNext .= 'ICEcoder.serverMessage(); ICEcoder.serverQueue("del", 0);';

0 commit comments

Comments
 (0)