Browse code

Changed majority of files.

DoubleBastionAdmin authored on 30/11/2024 06:56:40
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,64 @@
1
+<?php
2
+/**
3
+ *  Copyright (C) 2022, 2024  Double Bastion LLC
4
+ *
5
+ *  This file is part of Roundpin, which is licensed under the
6
+ *  GNU Affero General Public License Version 3.0. The license terms
7
+ *  are detailed in the "LICENSE.txt" file located in the root directory.
8
+ */
9
+
10
+session_start();
11
+
12
+if (isset($_GET['sipusername']) && $_GET['sipusername'] != '' && isset($_GET['encextenpass']) && $_GET['encextenpass'] != '' && isset($_GET['conferenceext']) && 
13
+    $_GET['conferenceext'] != '' && isset($_GET['destSipUser']) && $_GET['destSipUser'] != '' && isset($_GET['sentFlNm']) && $_GET['sentFlNm'] != '') {
14
+
15
+    define('ACCESSCONST', TRUE);
16
+
17
+    require('db-connect.php');
18
+
19
+    $vconfExtension = $_GET['sipusername'];
20
+    $extenPassEnc = rawurldecode($_GET['encextenpass']);
21
+    $videoConfExt = $_GET['conferenceext'];
22
+
23
+    $destSipUser = $_GET['destSipUser'];
24
+    $sentFileName = $_GET['sentFlNm'];
25
+
26
+    $fileToDownload = '../textchat/' . $destSipUser . '/uploads/' . $sentFileName;
27
+
28
+    // Check if the received external user extension, the corresponding encrypted password and the extension of the conference, match the data in the 'external_users' table
29
+    $query = $mysqli->prepare("SELECT id, exten_for_external, exten_for_ext_pass, conf_extension FROM external_users WHERE exten_for_external = ? AND exten_for_ext_pass = ? AND conf_extension = ?");
30
+    $query->bind_param("sss", $vconfExtension, $extenPassEnc, $videoConfExt);
31
+    $query->execute();
32
+    $extqueryres = $query->get_result()->fetch_array();
33
+
34
+    if (!$extqueryres) {
35
+
36
+        http_response_code(400);
37
+        exit();
38
+
39
+    } else {
40
+
41
+	    // Process the download
42
+	    if (is_file($fileToDownload)) {
43
+		    header('Content-Description: File Transfer');
44
+		    header('Content-Type: application/octet-stream');
45
+		    header('Content-Disposition: attachment; filename="' . basename($fileToDownload) . '"');
46
+		    header('Expires: 0');
47
+		    header('Cache-Control: no-cache, must-revalidate');
48
+		    header('Pragma: public');
49
+		    header('Content-Length: ' . filesize($fileToDownload));
50
+		    flush();
51
+		    readfile($fileToDownload);
52
+		    exit();
53
+	    } else {
54
+		    http_response_code(404);
55
+		    exit();
56
+	    }
57
+
58
+    }
59
+
60
+} else {
61
+        header("Location: ../login.php");
62
+}
63
+
64
+?>