F diff --git a/loggedin.js b/loggedin.js
--- a/loggedin.js
+++ b/loggedin.js
// A FileView is an entry inside the explorer window
class FileView {
- constructor(filename, mimetype, is_directory, write_permissions) {
+ constructor(filename, visuals, mimetype, is_directory, write_permissions) {
this.filename = filename;
- this.visuals = null; // The DOM object with the icon and the filenam text
+ this.visuals = visuals; // The DOM object with the icon and the filenam text
this.mimetype = mimetype;
this.is_directory = is_directory;
this.write_permissions = write_permissions;
this.pwd = pwd; // pwd = [ "Folder1", "Folder2" ] means the current directory of that window is /Folder1/Folder2
this.visuals = null; // The DOM object
this.h2 = null; // The titlebar of the window
- this.fileview = null;
}
}
files = [];
var json = JSON.parse(xhr.responseText);
- console.log(json);
if (!json)
return;
// Create the FileViews from the json response
for (const f of json) {
- var view = new FileView(f.name,
- f.mimetype,
- f.is_directory && f.is_directory != "0",
- f.can_edit && f.can_edit != "0");
+ var view = new FileView(f.name, null, f.mimetype, f.is_directory && f.is_directory != "0", true);
files.push(view);
}
mk(h3, 'div', 'separator');
let replace_btn = mk(h3, 'button');
- replace_btn.innerText = "Save Changes";
+ replace_btn.innerText = "Save";
replace_btn.onclick = () => { alert("No implemento"); }
mk(h3, 'div', 'separator');
F diff --git a/loggedin.php b/loggedin.php
--- a/loggedin.php
+++ b/loggedin.php
<form id="upload_form" style="display:none;" action="php/upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="the_file" id="the_file">
<input type="hidden" name="filename" id="filename">
- <input type="hidden" name="overwrite" id="override_input">
+ <input type="hidden" name="override" id="override_input">
<input type="hidden" name="parent_directory" id="upload_parent_directory">
</form>
F diff --git a/php/database.php b/php/database.php
--- a/php/database.php
+++ b/php/database.php
nodes.code as code,
nodes.type as mimetype,
node_access.can_view as can_view,
- node_access.can_edit as can_edit
+ node_access.can_view as can_eddit
from node_links
inner join nodes on
nodes.node_id=node_links.node_id
F diff --git a/php/upload.php b/php/upload.php
--- a/php/upload.php
+++ b/php/upload.php
require_once "node.php";
session_start();
- if (!isset( $_POST["filename"]) || !isset($_FILES["the_file"]) || !isset($_POST['parent_directory']))
+ if (!isset( $_POST["filename"]) || !isset($_FILES["the_file"]) || !isset($_POST['parent_directory']) || !isset($_POST['overwrite']))
{
error_log("someone tried to upload something impropperly");
http_response_code(400);
$user=$_SESSION['user_object'];
$homedir=$user->home_directory;
$mimetype=file_type($file['tmp_name']);
+ $overwrite=$_POST['overwrite'];
$dir = get_directory($parent_directory, $user);
if (!$dir)
http_response_code(409);
exit(0);
}
- if($codename=="filename taken")
+ if($codename=="filename taken" && $overwrite!=1)
{
http_response_code(409);
exit(0);