var ie = document.all ? 1 : 0; // Creates a popup window function open_window(url, width, height, scroll) { var LEFT = 100; var TOP = 100; if (scroll == null) { scroll = 1; } if(window.screen) { LEFT = (window.screen.width - width) / 2; TOP = (window.screen.height - height) / 2; } var NEW_WIN = null; NEW_WIN = window.open("", "", "toolbar=no,width=" + width + ",height=" + height + ",directories=no,status=no,scrollbars=" + scroll + ",resize=yes,menubar=no,left=" + LEFT + ",top=" + TOP); NEW_WIN.document.location.href = url; NEW_WIN.focus(); return; }// Changes the file name in the remote file field function set_remotename() { if (window.document.forms["popup"].elements["local"].value != null) { // Now set the remote file name window.document.forms["popup"].elements["remote"].value = window.document.forms["popup"].elements["local"].value.substr(window.document.forms["popup"].elements["local"].value.lastIndexOf("\\") + 1, window.document.forms["popup"].elements["local"].value.length); // If the remote file name is still the same as the local file name then the user isn't running on Windows so try a different way if (window.document.forms["popup"].elements["remote"].value == window.document.forms["popup"].elements["local"].value) { window.document.forms["popup"].elements["remote"].value = window.document.forms["popup"].elements["local"].value.substr(window.document.forms["popup"].elements["local"].value.lastIndexOf("/") + 1, window.document.forms["popup"].elements["local"].value.length); } } return false; } // Displays the multi file upload window function multi_uploads() { var dir = window.document.forms["popup"].elements["dir"].value; open_window("index.php?act=card&id=mup&dir=" + dir, 500, 300); window.close(); } // Displays the single file upload window function single_upload() { var dir = window.document.forms["popup"].elements["dir"].value; open_window("index.php?act=card&id=up&dir=" + dir, 500, 250); window.close(); } // Submits the Popup windows notes function submitPopup() { window.document.forms["popup"].elements["submit"].disabled = true; window.setTimeout("window.close();", "100"); // We need to use a timer, overwise mozilla will not submit the form return; } // Submits the "jump" form on the move dialog function jumpTo() { window.document.forms["popup"].elements["dir"].value = window.document.forms["jumpdir"].elements["jumpdir"].value; window.document.forms["jumpdir"].elements["submit"].disabled = true; window.document.forms["popup"].submit(); return false; } // Submits the "bookmark" form on the move dialog function jumpToBookmark() { var bookmark = window.document.forms["bookmarks"].elements["bookmark"].options[window.document.forms["bookmarks"].elements["bookmark"].selectedIndex].value; if (bookmark == "") { return false; } window.document.forms["popup"].elements["dir"].value = bookmark; window.document.forms["bookmarks"].elements["submit"].disabled = true; window.document.forms["popup"].submit(); return false; } // Submits the main form on the move dialog function submitMoveDialog() { if (window.document.forms["popup"].elements["dir"].value == window.document.forms["popup"].elements["target"].value) { alert("<%SOURCE_IS_TARGET%>"); return; } window.document.forms["popup"].elements["act"].value = "list"; window.document.forms["confirm"].elements["submit"].disabled = true; window.document.forms["popup"].submit(); window.setTimeout("window.close();", "100"); // We need to use a timer, overwise mozilla will not submit the form return; } // Submits the main form on the extract dialog function submitExtractDialog() { window.document.forms["confirm"].elements["submit"].disabled = true; window.setTimeout("window.close();", "100"); // We need to use a timer, overwise mozilla will not submit the form return; } // Submits the main form on the link dialog function submitLinkDialog() { // var regExp = /[\/:*?\\\"<>|%]/i; var regExp = /^[a-zA-Z0-9\._\(\)\-\s]+$/; // Check for a file name if (regExp.test(window.document.forms["confirm"].elements["name"].value) == false || window.document.forms["confirm"].elements["name"].value.length == 0) { alert("<%INVALID_LINK_NAME%>"); window.document.forms["confirm"].elements["name"].select(); return; } window.document.forms["popup"].elements["name"].value = window.document.forms["confirm"].elements["name"].value; window.document.forms["popup"].elements["act"].value = "list"; window.document.forms["confirm"].elements["submit"].disabled = true; // window.document.forms["popup"].target = "mainWindow"; window.document.forms["popup"].submit(); window.setTimeout("window.close();", "100"); // We need to use a timer, overwise mozilla will not submit the form return; } // Updates the CHMOD value function chmod(field, value) { // We have 2 fields, 1 showing the 'actual' value, and one containing the numeric value var current = window.document.forms["popup"].elements["numeric"].value; current = parseInt(current); value = parseInt(value); if (field.checked == true) { window.document.forms["popup"].elements["numeric"].value = current + value; } else { window.document.forms["popup"].elements["numeric"].value = current - value; } window.document.forms["popup"].elements["decimal"].value = window.document.forms["popup"].elements["numeric"].value; while (window.document.forms["popup"].elements["decimal"].value.length < 3) { window.document.forms["popup"].elements["decimal"].value = "0" + window.document.forms["popup"].elements["decimal"].value; } } // Closes the dialog and refreshes the main page function cancel_dialog() { window.opener.location = window.opener.location; window.close(); return; } // Checks that the CHMOD value is valid function checkCHMOD() { var chmod = window.document.forms["popup"].elements["decimal"].value; if (chmod == "" || chmod == "000") { return false; } if (isNaN(chmod) || (chmod == "") || (chmod.length != 3) || !isChmod(chmod)) { window.alert("<%INVALID_CHMOD%>") return false; } else { return submitPopup(); } } // Checks that the CHMOD value is valid function isChmod(chmod) { if (!chmod) { return false; } for (i=0; i "7") { return false; } } return true; } // Check the username/password on the htaccess dialog function checkAuth() { var fields = window.document.getElementsByTagName("input"); var usernames = new Array(); if (window.document.forms["popup"].elements["prompt"].value == "") { alert("<%PROMPT_NEEDED%>"); window.document.forms["popup"].elements["prompt"].select(); return false } for (var i=0; i < fields.length; i++) { if (fields[i].type == "text") { if (fields[i].value.match(":")) { alert("<%INVALID_CHARACTER%>"); fields[i].select(); return false; } else if (typeof usernames[fields[i].value] != "undefined") { alert("<%USERNAME_EXISTS%>"); fields[i].select(); return false; } else if (fields[i].value != "") { // Add the username to the username array usernames[fields[i].value] = fields[i].value; } } else if (fields[i].type == "password") { if (fields[i].value.match(":")) { alert("<%INVALID_CHARACTER%>"); fields[i].select(); return false; } } } return submitPopup(); }