FILEUP



LOG | FILES | OVERVIEW


F diff --git a/loggedin.js b/loggedin.js --- a/loggedin.js +++ b/loggedin.js
entry.innerText = d;
the_path.appendChild(entry);
- entry.onclick = () => {
- pwd.length = i + 1;
- load_dir();
- }
+ add_link_functionality(entry, i + 1);
}
var data = new FormData();
}
}
+ function add_link_functionality(link, length) {
+ link.onclick = () => {
+ pwd.length = length,
+ load_dir();
+ }
+
+ link.onmouseup = (e) => {
+ if (dragging) {
+ var new_folder = get_path(length);
+ move_file(new_folder, dragging_fileview.filename);
+ end_drag();
+
+ e.preventDefault();
+ e.stopPropagation();
+ }
+ }
+ }
+
+ add_link_functionality(document.getElementById("home_path_entry"), 0);
+
function add_file_visuals(fileview) {
var visuals = document.createElement('div');
fileview.visuals = visuals;
document.body.appendChild(context_menu);
}
- function get_path() {
+ function get_path(max_length) {
+ if (max_length == undefined) {
+ max_length = pwd.length;
+ }
+
var path = "/";
- for (const d of pwd)
- path += d + "/";
- if (path.length > 1)
- path = path.substring(0, path.length - 1);
+ for (let i = 0; i < max_length; i++) {
+ path += pwd[i];
+ if (i != max_length - 1)
+ path + "/";
+ }
return path;
}
F diff --git a/loggedin.php b/loggedin.php --- a/loggedin.php +++ b/loggedin.php
<button id="upload_btn" onclick="new_folder()">New Folder</button>
<div class="separator"></div>
<div class="path" id="the_path">
- <button class="pathentry" onclick="pwd.length = 0; load_dir();"><?php echo $_SESSION['username'] ?>'s files</button>
+ <button class="pathentry" id="home_path_entry"><?php echo $_SESSION['username'] ?>'s files</button>
</div>
</h2>
F diff --git a/php/move.php b/php/move.php --- a/php/move.php +++ b/php/move.php
session_start();
if (!isset($_POST['old_folder']) || !isset($_POST['new_folder']) || !isset($_POST['filename'])) {
- error_log("bad /php/move.php call $_POST of:$_POST[old_folder] nf:$_POST[new_folder] fn:$_POST[filename]");
+ error_log("bad /php/move.php call");
http_response_code(400);
exit(1);
}