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) 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
+
12
+ // header('Set-Cookie: PHPSESSID= ' . session_id() . '; SameSite=strict; Secure=true; HttpOnly=true;');
13
+
14
+if (isset($_POST['s_ajax_call']) && ($_POST['s_ajax_call'] == $_SESSION['validate_s_access'])) {
15
+
16
+    define('ACCESSCONST', TRUE);
17
+
18
+    require('db-connect.php');
19
+
20
+    $username = $_POST['username'];
21
+    $aconfExtension = $_POST['aconfextension'];
22
+
23
+    // Get the user role and the list of groups to which the current user belongs, from the 'app_users' table
24
+    $querygr = $mysqli->prepare("SELECT id, userrole, username, user_groups FROM app_users WHERE BINARY username = ?");
25
+    $querygr->bind_param("s", $username);
26
+    $querygr->execute();
27
+    $querygrres = $querygr->get_result()->fetch_assoc();
28
+    $userrole = $querygrres['userrole'];
29
+
30
+    if ($userrole != 'superadmin') {
31
+
32
+        $usergroupsall = $querygrres['user_groups'];
33
+        $usergroupsarr = explode("|", $usergroupsall);
34
+        array_shift($usergroupsarr);
35
+        array_pop($usergroupsarr);
36
+
37
+        // Get the list of groups whose users have access to the current audio conference
38
+        $querycont = $mysqli->prepare("SELECT id, audio_conf_extension, limit_to_groups FROM conferences_audio WHERE audio_conf_extension = ?");
39
+        $querycont->bind_param("s", $aconfExtension);
40
+        $querycont->execute();
41
+        $querytcagr = $querycont->get_result()->fetch_assoc();
42
+        $querytcagrlst = $querytcagr['limit_to_groups'];
43
+        $querytcagrarr = explode("|", $querytcagrlst);
44
+        array_shift($querytcagrarr);
45
+        array_pop($querytcagrarr);
46
+
47
+        $chck = 0;
48
+        foreach ($usergroupsarr as $key => $arrval) {
49
+              if (in_array($arrval, $querytcagrarr)) { $chck++; }
50
+        }
51
+
52
+        if ($chck > 0) { $messagetosend = 'success'; } else { $messagetosend = 'failure'; }
53
+
54
+    } else { $messagetosend = 'success'; }
55
+
56
+    $response = array('result' => $messagetosend);
57
+
58
+    echo json_encode($response);
59
+
60
+} else {
61
+     header("Location: ../login.php");
62
+}
63
+
64
+?>