From f5d140a3ef6e34658f6a9a6cc58ee32d01427782 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 12 Apr 2022 16:22:44 +0200 Subject: File uploader --- admin/index.php | 6 +- admin/uploads/index.php | 186 ++++++++++++++++++++++++++++++++++++++++++ data/files.json | 1 + data/general.json | 0 file/index.php | 41 ++++++++++ includes/admin/navigation.php | 108 +++++++++++++++++++++++- includes/gui/header.php | 4 + 7 files changed, 340 insertions(+), 6 deletions(-) create mode 100755 admin/uploads/index.php create mode 100755 data/files.json mode change 100644 => 100755 data/general.json create mode 100644 file/index.php diff --git a/admin/index.php b/admin/index.php index 7722af8..942db44 100755 --- a/admin/index.php +++ b/admin/index.php @@ -19,7 +19,7 @@

File Uploader

-

Encrypted, secure and fast file uploader.

+

Extensible, secure and fast file uploader.

Manage
@@ -56,13 +56,13 @@

Software Updates

Ensure this version of the website is up-to-date.

- Manage + Manage ➚
-

This website is managed by $item): ?> (you) and , (edit...) and updated through Minteck's TeamCity instance

+

This website is managed by $item): ?> (you) and , (edit...)

powered by Pawer Technologies

diff --git a/admin/uploads/index.php b/admin/uploads/index.php new file mode 100755 index 0000000..2990933 --- /dev/null +++ b/admin/uploads/index.php @@ -0,0 +1,186 @@ + + $_FILES["add-file"]["name"], + "uuid" => $fileId, + "size" => $_FILES["add-file"]["size"] + ]; + file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/data/files.json", json_encode($projects)); + + header("Location: /admin/uploads"); + die(); + } + + if (isset($_GET["delete-project"])) { + if (isset($projects[(int)$_GET["delete-project"]])) { + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/uploads/" . $projects[(int)$_GET["delete-project"]]['uuid']); + unset($projects[(int)$_GET["delete-project"]]); + file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/data/files.json", json_encode($projects, JSON_PRETTY_PRINT)); + header("Location: /admin/uploads"); + die(); + } + } + + if (isset($_GET["edit-project"]) && isset($_GET["edit-project-name"])) { + if (isset($projects[(int)$_GET["edit-project"]])) { + $projects[(int)$_GET["edit-project"]]["name"] = $_GET["edit-project-name"]; + file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/data/files.json", json_encode($projects, JSON_PRETTY_PRINT)); + header("Location: /admin/uploads"); + die(); + } + } +} + +?> + + +
+
+ + +

Edit
()

+ +
+ +
+

+ File Name:
+ "> +

+ + "> + +
+
+ + "> + +
+ + +

File Uploads

+

Files added to this list are publicly accessible from their URL.

+ + +
+ + + + +
+ + + + \ No newline at end of file diff --git a/data/files.json b/data/files.json new file mode 100755 index 0000000..0637a08 --- /dev/null +++ b/data/files.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/data/general.json b/data/general.json old mode 100644 new mode 100755 diff --git a/file/index.php b/file/index.php new file mode 100644 index 0000000..9b1f250 --- /dev/null +++ b/file/index.php @@ -0,0 +1,41 @@ +
- Project Cloudsdale Admin Panel + + Project Cloudsdale Admin Panel + Panel +
- \ No newline at end of file + + + \ No newline at end of file diff --git a/includes/gui/header.php b/includes/gui/header.php index 0ca8765..7a85a55 100755 --- a/includes/gui/header.php +++ b/includes/gui/header.php @@ -7,6 +7,10 @@ if (!file_exists($_SERVER["DOCUMENT_ROOT"] . "/data/general.json")) { ])); } +if (!file_exists($_SERVER["DOCUMENT_ROOT"] . "/data/files.json")) { + file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/data/files.json", json_encode([])); +} + if ($_SERVER['HTTP_HOST'] !== "conep.one" && $_SERVER['HTTP_HOST'] !== "www.conep.one" && $_SERVER['HTTP_HOST'] !== "localhost" && $_SERVER['HTTP_HOST'] !== "0.0.0.0") { header("Location: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); die(); -- cgit