| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,191 @@ |
| 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 |
+ |
|
| 22 |
+ // Get the configuration data for the current user from the 'app_users' table |
|
| 23 |
+ $querysel = $mysqli->prepare("SELECT id, userrole, username, wss_server, web_socket_port, server_path, profile_name, sip_username, sip_password, stun_server, audio_output_id,
|
|
| 24 |
+ video_src_id, video_height, frame_rate, aspect_ratio, video_orientation, ringtone, audio_src_id, auto_gain_control, echo_cancellation, |
|
| 25 |
+ noise_suppression, ring_output_id, video_conf_window_width, profile_picture, language, notifications, show_vconf_usernames, display_vconf_user, |
|
| 26 |
+ use_email, load_groups, date_added, date_modified, enabled FROM app_users WHERE BINARY username = ?"); |
|
| 27 |
+ $querysel->bind_param("s", $username);
|
|
| 28 |
+ $querysel->execute(); |
|
| 29 |
+ $confdatafromdb = $querysel->get_result()->fetch_assoc(); |
|
| 30 |
+ $cruserid = $confdatafromdb['id']; |
|
| 31 |
+ |
|
| 32 |
+ |
|
| 33 |
+ // Get the fax settings for the current user from the 'fax_settings' table |
|
| 34 |
+ $queryselfax = $mysqli->prepare("SELECT userid, tel_secret_key, tel_fax_app_id, tel_recwh_url, phax_api_key, phax_api_secret, phax_webhook_token, phax_receive_url, get_notification,
|
|
| 35 |
+ notification_email FROM fax_settings WHERE userid = ?"); |
|
| 36 |
+ $queryselfax->bind_param("i", $cruserid);
|
|
| 37 |
+ $queryselfax->execute(); |
|
| 38 |
+ $queryselfaxdata = $queryselfax->get_result()->fetch_assoc(); |
|
| 39 |
+ |
|
| 40 |
+ if ($queryselfaxdata) {
|
|
| 41 |
+ |
|
| 42 |
+ $confdatafromdb['tel_secret_key'] = $queryselfaxdata['tel_secret_key']; |
|
| 43 |
+ $confdatafromdb['tel_fax_app_id'] = $queryselfaxdata['tel_fax_app_id']; |
|
| 44 |
+ $confdatafromdb['tel_recwh_url'] = $queryselfaxdata['tel_recwh_url']; |
|
| 45 |
+ $confdatafromdb['phax_api_key'] = $queryselfaxdata['phax_api_key']; |
|
| 46 |
+ $confdatafromdb['phax_api_secret'] = $queryselfaxdata['phax_api_secret']; |
|
| 47 |
+ $confdatafromdb['phax_webhook_token'] = $queryselfaxdata['phax_webhook_token']; |
|
| 48 |
+ $confdatafromdb['phax_receive_url'] = $queryselfaxdata['phax_receive_url']; |
|
| 49 |
+ $confdatafromdb['get_notification'] = $queryselfaxdata['get_notification']; |
|
| 50 |
+ $confdatafromdb['notification_email'] = $queryselfaxdata['notification_email']; |
|
| 51 |
+ |
|
| 52 |
+ } else {
|
|
| 53 |
+ |
|
| 54 |
+ $confdatafromdb['tel_secret_key'] = ''; |
|
| 55 |
+ $confdatafromdb['tel_fax_app_id'] = ''; |
|
| 56 |
+ $confdatafromdb['tel_recwh_url'] = ''; |
|
| 57 |
+ $confdatafromdb['phax_api_key'] = ''; |
|
| 58 |
+ $confdatafromdb['phax_api_secret'] = ''; |
|
| 59 |
+ $confdatafromdb['phax_webhook_token'] = ''; |
|
| 60 |
+ $confdatafromdb['phax_receive_url'] = ''; |
|
| 61 |
+ $confdatafromdb['get_notification'] = ''; |
|
| 62 |
+ $confdatafromdb['notification_email'] = ''; |
|
| 63 |
+ } |
|
| 64 |
+ |
|
| 65 |
+ // Get the phone numbers for the current user from the 'phone_numbers' table |
|
| 66 |
+ $queryselphnb = $mysqli->prepare("SELECT userid, voice_numbers, default_voice_number, sms_numbers, default_sms_number, fax_numbers, default_fax_number FROM phone_numbers
|
|
| 67 |
+ WHERE userid = ?"); |
|
| 68 |
+ $queryselphnb->bind_param("i", $cruserid);
|
|
| 69 |
+ $queryselphnb->execute(); |
|
| 70 |
+ $queryselphnbdata = $queryselphnb->get_result()->fetch_assoc(); |
|
| 71 |
+ |
|
| 72 |
+ if ($queryselphnbdata) {
|
|
| 73 |
+ $confdatafromdb['voice_numbers'] = $queryselphnbdata['voice_numbers']; |
|
| 74 |
+ $confdatafromdb['default_voice_number'] = $queryselphnbdata['default_voice_number']; |
|
| 75 |
+ $confdatafromdb['sms_numbers'] = $queryselphnbdata['sms_numbers']; |
|
| 76 |
+ $confdatafromdb['default_sms_number'] = $queryselphnbdata['default_sms_number']; |
|
| 77 |
+ $confdatafromdb['fax_numbers'] = $queryselphnbdata['fax_numbers']; |
|
| 78 |
+ $confdatafromdb['default_fax_number'] = $queryselphnbdata['default_fax_number']; |
|
| 79 |
+ } else {
|
|
| 80 |
+ $confdatafromdb['voice_numbers'] = ''; |
|
| 81 |
+ $confdatafromdb['default_voice_number'] = ''; |
|
| 82 |
+ $confdatafromdb['sms_numbers'] = ''; |
|
| 83 |
+ $confdatafromdb['default_sms_number'] = ''; |
|
| 84 |
+ $confdatafromdb['fax_numbers'] = ''; |
|
| 85 |
+ $confdatafromdb['default_fax_number'] = ''; |
|
| 86 |
+ } |
|
| 87 |
+ |
|
| 88 |
+ // Get the email configuration data for the current user from the 'email_conf' table |
|
| 89 |
+ $queryselrcnf = $mysqli->prepare("SELECT userid, rcdomain, rcuser, rcpassword, rcbasicauthuser, rcbasicauthpass FROM email_conf WHERE userid = ?");
|
|
| 90 |
+ $queryselrcnf->bind_param("i", $cruserid);
|
|
| 91 |
+ $queryselrcnf->execute(); |
|
| 92 |
+ $queryselrcnfdata = $queryselrcnf->get_result()->fetch_assoc(); |
|
| 93 |
+ |
|
| 94 |
+ if ($queryselrcnfdata) {
|
|
| 95 |
+ $confdatafromdb['rcdomain'] = $queryselrcnfdata['rcdomain']; |
|
| 96 |
+ $confdatafromdb['rcuser'] = $queryselrcnfdata['rcuser']; |
|
| 97 |
+ $confdatafromdb['rcpassword'] = $queryselrcnfdata['rcpassword']; |
|
| 98 |
+ $confdatafromdb['rcbasicauthuser'] = $queryselrcnfdata['rcbasicauthuser']; |
|
| 99 |
+ $confdatafromdb['rcbasicauthpass'] = $queryselrcnfdata['rcbasicauthpass']; |
|
| 100 |
+ } else {
|
|
| 101 |
+ $confdatafromdb['rcdomain'] = ''; |
|
| 102 |
+ $confdatafromdb['rcuser'] = ''; |
|
| 103 |
+ $confdatafromdb['rcpassword'] = ''; |
|
| 104 |
+ $confdatafromdb['rcbasicauthuser'] = ''; |
|
| 105 |
+ $confdatafromdb['rcbasicauthpass'] = ''; |
|
| 106 |
+ } |
|
| 107 |
+ |
|
| 108 |
+ // Replace the SIP password, fax keys (if any), Roundcube password (if any) and Roundcube basic auth password (if any) with placeholders |
|
| 109 |
+ if ($confdatafromdb['sip_password']) {
|
|
| 110 |
+ $confdatafromdb['sip_password'] = "%20%20%20%20%20%20%20"; |
|
| 111 |
+ } else { $confdatafromdb['sip_password'] = ''; }
|
|
| 112 |
+ |
|
| 113 |
+ if ($confdatafromdb['tel_secret_key']) {
|
|
| 114 |
+ $confdatafromdb['tel_secret_key'] = "%20%20%20%20%20%20%20"; |
|
| 115 |
+ } else { $confdatafromdb['tel_secret_key'] = ''; }
|
|
| 116 |
+ |
|
| 117 |
+ if ($confdatafromdb['tel_fax_app_id']) {
|
|
| 118 |
+ $confdatafromdb['tel_fax_app_id'] = "%20%20%20%20%20%20%20"; |
|
| 119 |
+ } else { $confdatafromdb['tel_fax_app_id'] = ''; }
|
|
| 120 |
+/* |
|
| 121 |
+ if ($confdatafromdb['tel_recwh_url']) {
|
|
| 122 |
+ $confdatafromdb['tel_recwh_url'] = "%20%20%20%20%20%20%20"; |
|
| 123 |
+ } else { $confdatafromdb['tel_recwh_url'] = ''; }
|
|
| 124 |
+*/ |
|
| 125 |
+ if ($confdatafromdb['phax_api_key']) {
|
|
| 126 |
+ $confdatafromdb['phax_api_key'] = "%20%20%20%20%20%20%20"; |
|
| 127 |
+ } else { $confdatafromdb['phax_api_key'] = ''; }
|
|
| 128 |
+ |
|
| 129 |
+ if ($confdatafromdb['phax_api_secret']) {
|
|
| 130 |
+ $confdatafromdb['phax_api_secret'] = "%20%20%20%20%20%20%20"; |
|
| 131 |
+ } else { $confdatafromdb['phax_api_secret'] = ''; }
|
|
| 132 |
+ |
|
| 133 |
+ if ($confdatafromdb['phax_webhook_token']) {
|
|
| 134 |
+ $confdatafromdb['phax_webhook_token'] = "%20%20%20%20%20%20%20"; |
|
| 135 |
+ } else { $confdatafromdb['phax_webhook_token'] = ''; }
|
|
| 136 |
+/* |
|
| 137 |
+ if ($confdatafromdb['phax_receive_url']) {
|
|
| 138 |
+ $confdatafromdb['phax_receive_url'] = "%20%20%20%20%20%20%20"; |
|
| 139 |
+ } else { $confdatafromdb['phax_receive_url'] = ''; }
|
|
| 140 |
+*/ |
|
| 141 |
+ if ($confdatafromdb['rcpassword']) {
|
|
| 142 |
+ $confdatafromdb['rcpassword'] = "%20%20%20%20%20%20%20"; |
|
| 143 |
+ } else { $confdatafromdb['rcpassword'] = ''; }
|
|
| 144 |
+ |
|
| 145 |
+ if ($confdatafromdb['rcbasicauthpass']) {
|
|
| 146 |
+ $confdatafromdb['rcbasicauthpass'] = "%20%20%20%20%20%20%20"; |
|
| 147 |
+ } else { $confdatafromdb['rcbasicauthpass'] = ''; }
|
|
| 148 |
+ |
|
| 149 |
+ |
|
| 150 |
+ // Get the text conference data from the 'conferences_text' table |
|
| 151 |
+ $querygettxt = $mysqli->prepare("SELECT id, text_conf_extension, text_conf_label, limit_to_groups FROM conferences_text");
|
|
| 152 |
+ $querygettxt->execute(); |
|
| 153 |
+ $textconfdatadb = $querygettxt->get_result(); |
|
| 154 |
+ $textconfarr = []; |
|
| 155 |
+ |
|
| 156 |
+ while ($textconfinfo = $textconfdatadb->fetch_assoc()) {
|
|
| 157 |
+ $textconfarr[] = ['text_conf_extension' => $textconfinfo['text_conf_extension'], 'text_conf_label' => $textconfinfo['text_conf_label'], |
|
| 158 |
+ 'limit_to_groups' => $textconfinfo['limit_to_groups']]; |
|
| 159 |
+ } |
|
| 160 |
+ |
|
| 161 |
+ // Get the audio conference data from the 'conferences_audio' table |
|
| 162 |
+ $querygetaudio = $mysqli->prepare("SELECT id, audio_conf_extension, audio_conf_label, limit_to_groups FROM conferences_audio");
|
|
| 163 |
+ $querygetaudio->execute(); |
|
| 164 |
+ $audioconfdatadb = $querygetaudio->get_result(); |
|
| 165 |
+ $audioconfarr = []; |
|
| 166 |
+ |
|
| 167 |
+ while ($audioconfinfo = $audioconfdatadb->fetch_assoc()) {
|
|
| 168 |
+ $audioconfarr[] = ['audio_conf_extension' => $audioconfinfo['audio_conf_extension'], 'audio_conf_label' => $audioconfinfo['audio_conf_label'], |
|
| 169 |
+ 'limit_to_groups' => $audioconfinfo['limit_to_groups']]; |
|
| 170 |
+ } |
|
| 171 |
+ |
|
| 172 |
+ // Get the video conference data from the 'conferences_video' table |
|
| 173 |
+ $querygetvideo = $mysqli->prepare("SELECT id, video_conf_extension, video_conf_label, limit_to_groups FROM conferences_video");
|
|
| 174 |
+ $querygetvideo->execute(); |
|
| 175 |
+ $videoconfdatadb = $querygetvideo->get_result(); |
|
| 176 |
+ $videoconfarr = []; |
|
| 177 |
+ |
|
| 178 |
+ while ($videoconfinfo = $videoconfdatadb->fetch_assoc()) {
|
|
| 179 |
+ $videoconfarr[] = ['video_conf_extension' => $videoconfinfo['video_conf_extension'], 'video_conf_label' => $videoconfinfo['video_conf_label'], |
|
| 180 |
+ 'limit_to_groups' => $videoconfinfo['limit_to_groups']]; |
|
| 181 |
+ } |
|
| 182 |
+ |
|
| 183 |
+ $response = ['datafromdb' => $confdatafromdb, 'textconferences' => $textconfarr, 'audioconferences' => $audioconfarr, 'videoconferences' => $videoconfarr]; |
|
| 184 |
+ |
|
| 185 |
+ echo json_encode($response); |
|
| 186 |
+ |
|
| 187 |
+} else {
|
|
| 188 |
+ header("Location: ../login.php");
|
|
| 189 |
+} |
|
| 190 |
+ |
|
| 191 |
+?> |