mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-06 00:34:00 +01:00
replace indexOf with lastIndex on shortURLstarts
causes probs if you have the same term more than once in your path (ie, var/www/mysite/www), previously took first www Now takes last one and solves path issues in quite a few areas
This commit is contained in:
@@ -89,7 +89,7 @@ previousFiles = [<?php
|
||||
<a href="javascript:top.ICEcoder.deleteFile(top.ICEcoder.rightClickedFile)" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">Delete</a>
|
||||
<span id="singleFileMenuItems">
|
||||
<a href="javascript:top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile)" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">Rename</a>
|
||||
<a href="javascript:window.open(top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.indexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length))" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">View Webpage</a>
|
||||
<a href="javascript:window.open(top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.lastIndexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length))" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">View Webpage</a>
|
||||
</span>
|
||||
<a href="javascript:top.ICEcoder.zipIt(top.ICEcoder.rightClickedFile)" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">Zip It!</a>
|
||||
<a href="javascript:top.ICEcoder.propertiesScreen(top.ICEcoder.rightClickedFile)" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">Properties</a>
|
||||
|
||||
12
lib/coder.js
12
lib/coder.js
@@ -650,7 +650,7 @@ var ICEcoder = {
|
||||
}
|
||||
} else if (top.ICEcoder.thisFileFolderLink) {
|
||||
// We clicked a file/folder. Work out a shortened URL for the file, with pipes instead of slashes
|
||||
shortURL = top.ICEcoder.thisFileFolderLink.substr((top.ICEcoder.thisFileFolderLink.indexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.thisFileFolderLink.length).replace(/\//g,"|");
|
||||
shortURL = top.ICEcoder.thisFileFolderLink.substr((top.ICEcoder.thisFileFolderLink.lastIndexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.thisFileFolderLink.length).replace(/\//g,"|");
|
||||
|
||||
// If we have the CTRL key down
|
||||
if (top.ICEcoder.ctrlKeyDown) {
|
||||
@@ -731,7 +731,7 @@ var ICEcoder = {
|
||||
newFolder: function() {
|
||||
var newFolder, shortURL;
|
||||
|
||||
shortURL = top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.indexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length).replace(/\|/g,"/");
|
||||
shortURL = top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.lastIndexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length).replace(/\|/g,"/");
|
||||
newFolder = top.ICEcoder.getInput('Enter New Folder Name at '+shortURL+'/','');
|
||||
if (newFolder) {
|
||||
newFolder = shortURL + "/" + newFolder;
|
||||
@@ -751,7 +751,7 @@ var ICEcoder = {
|
||||
|
||||
// work out a shortened URL for the file
|
||||
shortURL = top.ICEcoder.thisFileFolderLink.replace(/\|/g,"/");
|
||||
shortURL = shortURL.substr((shortURL.indexOf(shortURLStarts)+shortURLStarts.length),shortURL.length);
|
||||
shortURL = shortURL.substr((shortURL.lastIndexOf(shortURLStarts)+shortURLStarts.length),shortURL.length);
|
||||
|
||||
// No reason why we can't open a file (so far)
|
||||
canOpenFile = true;
|
||||
@@ -804,10 +804,10 @@ var ICEcoder = {
|
||||
var shortURL;
|
||||
|
||||
if (!oldName) {
|
||||
shortURL = top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.indexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length).replace(/\|/g,"/");
|
||||
shortURL = top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.lastIndexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length).replace(/\|/g,"/");
|
||||
oldName = top.ICEcoder.rightClickedFile.replace(/\|/g,"/");
|
||||
} else {
|
||||
shortURL = oldName.substr((oldName.indexOf(shortURLStarts)+top.shortURLStarts.length),oldName.length).replace(/\|/g,"/");
|
||||
shortURL = oldName.substr((oldName.lastIndexOf(shortURLStarts)+top.shortURLStarts.length),oldName.length).replace(/\|/g,"/");
|
||||
}
|
||||
if (!newName) {
|
||||
newName = top.ICEcoder.getInput('Please enter the new name for',shortURL);
|
||||
@@ -1241,7 +1241,7 @@ var ICEcoder = {
|
||||
// Chmod on files
|
||||
if (action=="chmod") {
|
||||
// Identify a shortened URL for our file and get our target element based on this
|
||||
shortURL = top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.indexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length).replace(/\|/g,"/");
|
||||
shortURL = top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.lastIndexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length).replace(/\|/g,"/");
|
||||
targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL.replace(/\//g,"|")+"_perms");
|
||||
// Set the new perms
|
||||
targetElem.innerHTML = perms;
|
||||
|
||||
@@ -30,7 +30,7 @@ if ($_GET['action']=="load") {
|
||||
if ($_SESSION['userLevel'] == 10 || ($_SESSION['userLevel'] < 10 && $bannedFile==false)) {
|
||||
echo '<script>fileType="text";top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink=\''.$file.'\';';
|
||||
echo 'shortURL = top.ICEcoder.thisFileFolderLink.replace(/\|/g,"/");';
|
||||
echo 'top.ICEcoder.shortURL = shortURL.substr((shortURL.indexOf(top.shortURLStarts)+top.shortURLStarts.length),shortURL.length);</script>';
|
||||
echo 'top.ICEcoder.shortURL = shortURL.substr((shortURL.lastIndexOf(top.shortURLStarts)+top.shortURLStarts.length),shortURL.length);</script>';
|
||||
$loadedFile = file_get_contents($file);
|
||||
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",$loadedFile).'</textarea>';
|
||||
} else {
|
||||
@@ -268,7 +268,7 @@ if (action=="save") {
|
||||
if ($file=="|[NEW]"||$saveType=="saveAs") {
|
||||
?>
|
||||
if (top.ICEcoder.rightClickedFile) {
|
||||
shortURL = top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.indexOf(top.shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length).replace(/\|/g,"/")+"/";
|
||||
shortURL = top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.lastIndexOf(top.shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length).replace(/\|/g,"/")+"/";
|
||||
newFileName = top.ICEcoder.getInput('Enter Filename',shortURL);
|
||||
} else {
|
||||
newFileName = top.ICEcoder.getInput('Enter Filename','/');
|
||||
|
||||
Reference in New Issue
Block a user