aboutsummaryrefslogtreecommitdiffstats
path: root/managing-ui/deleteFile.php
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2017-05-27 20:33:11 +0200
committersteckbrief <steckbrief@chefmail.de>2017-05-27 20:34:06 +0200
commitb7515c5d9c5fc3c622376818570c05a03c74fe17 (patch)
tree38ebba18eb38d16f94afd821430ced2bcf63a739 /managing-ui/deleteFile.php
parent6bd2862f8f6b37f145097767ebbbedbc5e243443 (diff)
managing-ui: initial commit0.2
added possibility to manage uploaded files simple php ui to delete uploaded files
Diffstat (limited to '')
-rw-r--r--managing-ui/deleteFile.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/managing-ui/deleteFile.php b/managing-ui/deleteFile.php
new file mode 100644
index 0000000..24f8c9c
--- /dev/null
+++ b/managing-ui/deleteFile.php
@@ -0,0 +1,36 @@
+<?php
+
+include_once(__DIR__.'/lib/functions.http.inc.php');
+require_once(__DIR__."/XMPPClient.php");
+session_start();
+
+if (empty($_SESSION['JID']) || empty($_SESSION['authenticated']) || $_SESSION['authenticated'] != 'yeah') {
+ header('Location: login.php');
+ exit();
+}
+
+//
+$jid = $_SESSION['JID'];
+$password = $_SESSION['PASSWORD'];
+
+$fileurl = $_POST['fileurl'];
+
+if (null != $fileurl && "" != $fileurl) {
+ try {
+ $client = new XMPPClient($jid, $password, true);
+ if ($client->login()) {
+ $client->deleteFile($fileurl);
+ $client->disconnect();
+ } else {
+ $data = ['error' => true, 'msg' => 'Failed to login'];
+ }
+ } catch (XMPPException $e) {
+ $data = ['error' => true, 'msg' => $e->getMessage()];
+ }
+} else {
+ $data = ['error' => true, 'msg' => 'Missing required file url to delete'];
+}
+
+sendHttpReturnCodeAndJson(200, $data);
+
+?> \ No newline at end of file