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,52 @@
1
+<?php
2
+/**
3
+ *  Copyright (C) 2021  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
+ // header('Set-Cookie: PHPSESSID= ' . session_id() . '; SameSite=strict; Secure=true; HttpOnly=true;');
12
+
13
+if (isset($_POST['s_ajax_call']) && ($_POST['s_ajax_call'] == $_SESSION['validate_s_access']) && isset($_POST['currentvconfext']) && $_POST['currentvconfext'] != '' &&
14
+    isset($_POST['currentvconfpubkey']) && $_POST['currentvconfpubkey'] != '' && isset($_POST['currentvconfprivkey']) && $_POST['currentvconfprivkey'] != '') {
15
+
16
+       $vconfExtension = $_POST['currentvconfext'];
17
+       $chatPubKey = $_POST['currentvconfpubkey'];
18
+       $chatPrivKey = $_POST['currentvconfprivkey'];
19
+
20
+       // Create the necessary directory if it doesn't exist
21
+       if (!is_dir('../textchat/' . $vconfExtension)) {
22
+            mkdir('../textchat/' . $vconfExtension, 0700);
23
+       }
24
+
25
+       // Save the RSA keys
26
+       if ($vconfExtension != '') {
27
+
28
+           if (!file_exists('../textchat/' . $vconfExtension . '/rsa_1024_pub.pem') || !file_exists('../textchat/' . $vconfExtension . '/rsa_1024_priv.pem')) {
29
+
30
+	        $savePubKey = file_put_contents('../textchat/' . $vconfExtension . '/rsa_1024_pub.pem', $chatPubKey);
31
+		chmod('../textchat/' . $vconfExtension . '/rsa_1024_pub.pem', 0600);
32
+
33
+		$savePrivKey = file_put_contents('../textchat/' . $vconfExtension . '/rsa_1024_priv.pem', $chatPrivKey);
34
+		chmod('../textchat/' . $vconfExtension . '/rsa_1024_priv.pem', 0400);
35
+
36
+		$messageres = 'success';
37
+
38
+           } else { $messageres = 'success'; }
39
+
40
+       } else { 
41
+             $messageres = 'failure';
42
+       }
43
+
44
+       $generateresp = ['messageres' => $messageres];
45
+
46
+       echo json_encode($generateresp);
47
+
48
+} else {
49
+    header("Location: ../login.php");
50
+}
51
+
52
+?>