Browse code

added appinfo/info.xml appinfo/signature.json CHANGELOG.txt js/showsmstables.js js/adminsettings.js css/style.css lib/Controller/AuthorApiController.php lib/Controller/SmsrelentlessController.php lib/Service/SmsrelentlessService.php templates/settings/admin.php lib/Migration/Version135Date20240420221527.php

DoubleBastionAdmin authored on 20/04/2024 03:36:59
Showing 11 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,172 @@
1
+======= CHANGELOG =======
2
+
3
+Versions:
4
+
5
+== 1.0.0 - 2022-1-27 ==
6
+* Initial release.
7
+
8
+== 1.0.1 - 2022-3-31 ==
9
+* Changed presentation text.
10
+
11
+== 1.0.2 - 2022-4-13 ==
12
+* Changed application controller class, to respect custom path of 'datadirectory'.
13
+* Fixed filters row arrow not showing up when using Apache.
14
+* Added the 'Contributors.txt' file.
15
+
16
+== 1.0.3 - 2022-4-15 ==
17
+* Changed the way the app gets the timezone.
18
+
19
+== 1.0.4 - 2022-5-7 ==
20
+* Changed the data type of the 'message' column in the 'sms_relent_sent' and 'sms_relent_received' tables.
21
+
22
+== 1.0.5 - 2022-5-9 ==
23
+* Changed string length for 'message' column in 'sms_relent_sent' and 'sms_relent_received' tables.
24
+* Changed syntax of SQL queries and of encryption function.
25
+* Changed structure of webhook URLs in case Nextcloud is served on a subdirectory.
26
+
27
+== 1.0.6 - 2022-8-13 ==
28
+* Added support for Twilio.
29
+* Added support for new lines in messages and email notifications.
30
+* Solved column width issue in sent/received SMS tables.
31
+* Minor explanatory text changes.
32
+
33
+== 1.0.7 - 2022-8-16 ==
34
+* Solved bug related to receiving messages on Twilio number when it's not associated with any Messaging Service.
35
+* Changed css properties for Network column.
36
+
37
+== 1.0.8 - 2022-8-23 ==
38
+* Added support for Flowroute.
39
+* Added automatic scrolling to bottom of received/sent messages table when clicking on 'Received/Sent SMS Messages' button.
40
+* Added scroll bar to info pop-up notes.
41
+
42
+== 1.0.9 - 2022-9-3 ==
43
+* Added support for MMS.
44
+* Minor CSS improvements.
45
+* Small changes to explanatory text.
46
+
47
+== 1.1.0 - 2022-9-5 ==
48
+* Solved issue with previewing images picked from Nextcloud.
49
+* Text changes to README.md.
50
+
51
+== 1.1.1 - 2022-9-9 ==
52
+* Changed signature verification process for Twilio.
53
+* Removed Alphanumeric Sender ID for Flowroute, since it's not supported.
54
+* Minor text changes on presentation page and settings page.
55
+
56
+== 1.1.2 - 2022-10-27 ==
57
+* Changed CSS settings to match the modifications introduced in Nextcloud 25.
58
+
59
+== 1.1.3 - 2022-12-1 ==
60
+* Fixed SQL error that appeared in fresh installations.
61
+* Added support for dark themes.
62
+* Updated explanatory text for Telnyx on the Settings page.
63
+
64
+== 1.1.4 - 2022-12-2 ==
65
+* Changed migration files to prevent installation errors.
66
+* Modified 3 svg files converting text objects to paths.
67
+
68
+== 1.1.5 - 2023-2-28 ==
69
+* Fixed issue related to Twilio message signing.
70
+* Updated message pricing information in app description.
71
+
72
+== 1.1.6 - 2023-5-8 ==
73
+* Implemented showing display names of message authors before their messages.
74
+* Added checkbox to enable/disable prepending display names before messages.
75
+* Custom display names can be now saved for external phone numbers.
76
+* Restrictions for groups or users can be placed on phone numbers by admins.
77
+* Admins can see just their own messages or all the messages in their message tables.
78
+* Auto-replies with 'daily mode' and 'vacation mode' can be configured for any controlled phone number.
79
+* Added a new message table that lists all the messages grouped by phone numbers.
80
+* Added the ability to see all the messages sent/received to/from a phone number, by clicking on 
81
+  a button located below the number, in the 'Received SMS Messages' and 'Sent SMS Messages' tables
82
+
83
+== 1.1.7 - 2023-5-9 ==
84
+* Fixed bug related to not being able to see messages in pop-up windows and on grouped messages table.
85
+
86
+== 1.1.8 - 2023-5-9 ==
87
+* Fixed migration issue bug.
88
+
89
+== 1.1.9 - 2023-5-9 ==
90
+* Made the app available to upgrade to for Nextcloud 26.
91
+
92
+== 1.2.0 - 2023-5-20 ==
93
+* Fixed auto-reply bug.
94
+* Moved the API keys and alphanumeric sender ID fields from the Personal settings page to the Admin 
95
+  settings page.
96
+* Available phone numbers are loaded automatically when the app's icon is clicked.
97
+* When only one phone number is available, it is selected automatically in the 'Set ID' field.
98
+* Admins can share their API keys with other non-admins.
99
+* Admins can see only their messages and the messages of the non-admins whith whom they share their API 
100
+  keys. Non-admins can see only their messages.
101
+* Added pop-up window that shows the messages exchanged between 2 phone numbers and allows sending replies.
102
+
103
+== 1.2.1 - 2023-5-23 ==
104
+* Allowed non-admin users to see incoming messages received on the phone numbers they are restricted to.
105
+* Customized confirm pop-up windows.
106
+
107
+== 1.2.2 - 2023-5-24 ==
108
+* Changed how non-admins view sent messages.
109
+
110
+== 1.2.3 - 2023-5-24 ==
111
+* Fixed 'Load more messages' bug.
112
+* Changed the way the display name is searched for and added to old messages, during app upgrade.
113
+
114
+== 1.2.4 - 2023-5-30 ==
115
+* Fixed MMS files domain problem.
116
+* Made MMS URLs clickable.
117
+* Added refresh button for messages in pop-up windows.
118
+
119
+== 1.2.5 - 2023-6-3 ==
120
+* Fixed incoming MMS issue.
121
+* Added checkbox on Settings page to allow users to include their display names in the text
122
+  of the message itself.
123
+
124
+== 1.2.6 - 2023-6-22 ==
125
+* Fixed messages display issue for non-admins.
126
+* Fixed how non-admins are able to see the messages sent/received from/to the numbers that are
127
+  shared with them but not restricted to them.
128
+
129
+== 1.2.7 - 2023-7-15 ==
130
+* Fixed alert messages issue.
131
+* Fixed text color for dark themes.
132
+* Added 'full-day' exception to auto-reply.
133
+* Added auto-refresh button on received/sent messages pages.
134
+
135
+== 1.2.8 - 2023-10-30 ==
136
+* Changed main screenshot and modified presentation text.
137
+* Changed text on Settings page.
138
+* Marked the app as compatible with Nextcloud 27.
139
+
140
+== 1.2.9 - 2023-11-1 ==
141
+* Changed how the app sends notifications for incoming messages.
142
+
143
+== 1.3.0 - 2023-11-3 ==
144
+* Changed notifications mechanism so that non-admin users receive notifications 
145
+  for messages received on phone numbers shared with them.
146
+* Fixed bug related to listing received messages for non-admin users.
147
+* Minor text modifications on the settings pages.
148
+
149
+== 1.3.1 - 2023-11-6 ==
150
+* Simplified some complex prepared SQL queries.
151
+
152
+== 1.3.2 - 2023-12-18 ==
153
+* Replaced default fonts with 2 free and open source fonts ('Open Sans' and 'Inter'),
154
+  included in the 'fonts' directory.
155
+* Fixed minor CSS issues.
156
+
157
+== 1.3.3 - 2024-2-15 ==
158
+* Implemented auto-refresh of the received messages table, when new messages arrive.
159
+* Fixed bug related to listing received messages, for non-admins.
160
+* Removed the 'Start auto refresh' button on pop-up windows.
161
+* Made the app completely functional when installed in a custom 'apps' directory.
162
+
163
+== 1.3.4 - 2024-4-2 ==
164
+* Removed the right of non-admin users to delete sent/received messages.
165
+* Added the 'Conversations' page, to list the messages exchanged between pairs of numbers and allow tagging, flagging and archiving conversations.
166
+* Improved mobile compatibility.
167
+* Changed the presentation text.
168
+
169
+== 1.3.5 - 2024-4-20 ==
170
+* Added checkboxes to allow admins to give non-admins permission to delete messages
171
+  sent from or received on phone numbers shared with them.
172
+* Fixed bug related to removing deleted messages from the conversations list.
0 173
new file mode 100644
... ...
@@ -0,0 +1,101 @@
1
+<?xml version="1.0"?>
2
+<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
3
+      xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
4
+    <id>sms_relentless</id>
5
+    <name>SMS Relentless</name>
6
+    <summary>Send and receive SMS in Nextcloud</summary>
7
+    <description><![CDATA[
8
+This application allows sending and receiving SMS and MMS messages in Nextcloud. An SMS/MMS enabled phone number acquired from 
9
+Telnyx, Plivo, Twilio or Flowroute is needed. Detailed instructions on how to configure and use this application can be found on the 'Admin documentation' page.
10
+
11
+### Features:
12
+
13
+* 🚀 Use one or multiple local phone numbers in countries of your choice, to send and receive SMS/MMS messages with your browser, on any device connected to the Internet.
14
+
15
+* 📑 Sent and received SMS/MMS messages are stored in the database per sending/receiving user and can be viewed in paginated tables with filters for every column.
16
+
17
+* 🖼️  Up to 10 files of various formats, including jpeg, png and gif, can be sent as MMS messages from MMS enabled phone numbers. Files included in incoming MMS messages are not downloaded automatically. They are stored as URL links to the actual files, so that the receivers can download them only if they trust the senders.
18
+
19
+* 📔 SMS/MMS messages older than a specified number of days can be deleted in bulk with one click and they are automatically archived in csv files stored in Nextcloud, before being removed from the database. This makes them available for future analysis.
20
+
21
+* 💻 Sending SMS/MMS messages to thousands of recipients can be achieved by uploading a txt/csv file containing the recipients' phone numbers and the same SMS/MMS is sent automatically to all. The time interval between two consecutive messages is configurable.
22
+
23
+* 👤 The Display Name of Nextcloud users can be prepended to their messages, to make the origin of messages clearer.
24
+
25
+* ⚠️  Admins can restrict the use of specific phone numbers to specific groups or users.
26
+
27
+* ✉️  Auto-replies in 'daily mode' and 'vacation mode' can be configured for any controlled phone number.
28
+
29
+* 🔏 SMS/MMS messages coming from Telnyx, Plivo and Twilio are checked for authenticity by verifying the SMS provider's signature.
30
+
31
+* 📧 Users receive notifications in Nextcloud and (optionally) emails when new SMS/MMS messages arrive.
32
+
33
+* 📄 Each sent message receives a delivery receipt displayed in the Sent SMS Messages table.
34
+
35
+* 🎎 Messages exchanged between pairs of numbers are organized into conversations on a separate page where each conversation can be viewed, tagged and archived.
36
+
37
+* 📞 It can be used with regular 'long code' (10-digit) phone numbers, but also with 'toll-free' numbers and 'short codes'. Users see a list with their current phone numbers and can set them as Sender IDs. Setting alphanumeric Sender IDs is also possible.
38
+
39
+* 📱 If Nextcloud is accessed in Firefox for mobile (version 123.0 or newer), it can be used directly on mobile devices.
40
+
41
+* 💵 It allows checking the current Telnyx/Plivo/Twilio balance by selecting the provider on the left panel.
42
+
43
+* 💰 The only ongoing cost is about $1 per month (depending on the country) for an SMS/MMS enabled phone number located in a country chosen by the user. No contracts.
44
+
45
+* 💸 Low prices per SMS: starting from $0.0040 per sent message and $0.0040 per received message (Telnyx), or $0.0085 per sent message and $0.0085 per received message (Plivo), or $0.0109 per sent message and 0.0079 per received message (Twilio), or $0.0055 per sent message and 0.0040 per received message (Flowroute) in the USA.
46
+
47
+We have no affiliation with Telnyx, Plivo, Twilio or Flowroute.
48
+
49
+### Documentation
50
+
51
+* [Admin documentation](https://www.doublebastion.com/install-nextcloud/#install-sms-relentless)
52
+
53
+### Donations
54
+
55
+* 🎁 [Donate](https://www.doublebastion.com/donations/)
56
+
57
+    ]]></description>
58
+    <version>1.3.5</version>
59
+    <licence>AGPL</licence>
60
+    <author mail="contact@doublebastion.com">Double Bastion LLC</author>
61
+    <namespace>SMSRelentless</namespace>
62
+	<documentation>
63
+		<admin>https://www.doublebastion.com/install-nextcloud/#install-sms-relentless</admin>
64
+	</documentation>
65
+    <category>office</category>
66
+    <category>organization</category>
67
+
68
+    <website>https://www.doublebastion.com/sms-relentless/</website>
69
+    <bugs>https://git.doublebastion.com/sms-relentless/issues/develop</bugs>
70
+    <repository>https://git.doublebastion.com/sms-relentless/develop/</repository>
71
+
72
+    <screenshot>https://git.doublebastion.com/sms-relentless/raw/develop/img/sms_relentless_sent_messages.png</screenshot>
73
+    <screenshot>https://git.doublebastion.com/sms-relentless/raw/develop/img/sms_relentless_received_messages.png</screenshot>
74
+    <screenshot>https://git.doublebastion.com/sms-relentless/raw/develop/img/active_archived_conversations.png</screenshot>    
75
+    <screenshot>https://git.doublebastion.com/sms-relentless/raw/develop/img/sms_relentless_grouped_by_number.png</screenshot>
76
+    <screenshot>https://git.doublebastion.com/sms-relentless/raw/develop/img/sms_relentless_exchanged_messages_popup.png</screenshot>
77
+    <screenshot>https://git.doublebastion.com/sms-relentless/raw/develop/img/sms_relentless_send_mms.png</screenshot>
78
+    <screenshot>https://git.doublebastion.com/sms-relentless/raw/develop/img/sms_relentless_on_mobile.png</screenshot>
79
+    <screenshot>https://git.doublebastion.com/sms-relentless/raw/develop/img/received_messages_on_mobile.png</screenshot>
80
+    <screenshot>https://git.doublebastion.com/sms-relentless/raw/develop/img/reply_to_message_on_mobile.png</screenshot>
81
+            
82
+    <dependencies>
83
+            <nextcloud min-version="26" max-version="28" />
84
+    </dependencies>
85
+
86
+    <navigations>
87
+        <navigation>
88
+            <name>SMS Relentless</name>
89
+            <route>sms_relentless.page.index</route>
90
+            <order>102</order>
91
+            <icon>sms_relentless.svg</icon>
92
+        </navigation>
93
+    </navigations>
94
+
95
+    <settings>
96
+            <personal>OCA\SMSRelentless\Settings\Personal</personal>
97
+            <personal-section>OCA\SMSRelentless\Settings\PersonalSection</personal-section>
98
+            <admin>OCA\SMSRelentless\Settings\Admin</admin>
99
+    	    <admin-section>OCA\SMSRelentless\Settings\AdminSection</admin-section>
100
+    </settings>
101
+</info>
0 102
new file mode 100644
... ...
@@ -0,0 +1,937 @@
1
+{
2
+    "hashes": {
3
+        "CHANGELOG.txt": "24cbd9d167fd5d6ece0bfa3e1003dc67eaaebc04a47d45bde382c5f525e9e883f49748919000cc34518c7ce2d9e5df6d5fcac256f7cfe8205064a8f03bc08f4d",
4
+        "COPYING.txt": "a0a86214ea153fb07ff35ceec0848dd1703eae22de036a825efc8394e50f65e3044832f3b49cf7e45a39edc470bdf738abc36a3a78ca7df3a6e73c14eaef94a8",
5
+        "Contributors.txt": "8ab4ea9b8c38e4d115af6ca08e8e27592198b763982bd166b67f38ee0b9f2b7e093cd58ce0927ae38ee3bc015b129add2ffeb3967288c804da493241bc67ba9b",
6
+        "README.md": "593e8b8ffd899357e54f1a4cc3d83b3e6b62fe123c298a59daf1a177b1623713b769a7ba2db01560009400ddc8599289cf1916ce9208db71d03ac52b8417b744",
7
+        "appinfo\/info.xml": "c07bb333fda5b482475e460ec304fe27a67906731324315e09e594ffa79e360a60659dafa569cdf46b97b0b851dfa83e1d198b0af7fea4cf49edb2c210544ddf",
8
+        "appinfo\/routes.php": "acff816e1947bf78f4387aa477c3183898e94d862ad84c53a64b69828cb5c4b5c42f0f127fd6e9b463eac4764463f134bc023b9e5c6caf24d90ad491d021bf5c",
9
+        "css\/style.css": "fb63d26994e46a30c2a2c43b389fab2313730baac54fa8b6a580e338790b983128e81ac3332a02010e5f98b2ff5775ed74d0de8ab2bdd4d8e81a83b9ce23b00c",
10
+        "fonts\/Apache_License_v2.0_Open_Sans.txt": "fdae7ed259455ca9fa45939e7f25cbb4de29831cda16d9151de25a5f6e9d9be43b053f4fd3b896026239fca77abce04f543d591c501ecf4ce18c854bc0a51660",
11
+        "fonts\/Inter-Bold.woff": "f34ed611dc0ba6e7c0bf7242bad7c02e09f208bfbdd21d6649ebf9b41bc06696d8856707851944786c80c718df455e619caab170c70bfe97ba2043d651d4532e",
12
+        "fonts\/Inter-Bold.woff2": "736b4aaf8a2de0c17fbd5396a338577227326f078ee0646072d851d328b58a8058989af8735ac073f935b05f291d9310797d95c963e5e3ff0ea61a87f21c9da5",
13
+        "fonts\/Inter-BoldItalic.woff": "619e398d37249fae96ba0deb06fcf5dab215ba888740024287e2c8f1278b33273124cd5b9ea8f7525a17657566b72a1661b688ca670bc068ca6ddf466b7e7ffe",
14
+        "fonts\/Inter-BoldItalic.woff2": "a24bdb558a9b26fbe7631d6cf90b8db8f5f0164c3c814a2971fb7d45e807b0856454893bbd0d5bd0d9f060689f2be5f5bb1b69e4bdea0293d1122e13ad28e96f",
15
+        "fonts\/Inter-Italic.woff": "72defeb5040f6375683dba41d4ce43654fdbae4f64aea88b01feb023b3e894c278c8a8c7e5583b6d83d980495ca0d5afa5ec7e1bfcc731be08d3dbe1b8b3f348",
16
+        "fonts\/Inter-Italic.woff2": "b128da83c81fe4a28026dc0a2a75c7920f37d4e04d6d6bde4e60b3a9527dbff04ff0ebc8b300874db9bd90036a41a52f4c9d82eb2f78fb8e99a35bb04defa1c2",
17
+        "fonts\/Inter-Medium.woff": "1f7c25aeb1ed534a106254fdba6bf59dfa03542f813489dca31fe067e2a22ab9549babb48af4cd465ab3ef0ef2f4b0f46532efcc8aae8942ad2cf98d0a5a4a3f",
18
+        "fonts\/Inter-Medium.woff2": "ce94d1a0cea81d42546ebc0247403b02c6fae24d3afba618cf658436734557a8b2b8ebed54319a9f66b233bd224da3685f848470866de63a144c8c28070491d4",
19
+        "fonts\/Inter-MediumItalic.woff": "7b7bef9c7a7717c6d52d619059e5ec258b537f538ada38325c2c7bfa4968ff53109bc9ee17a57819ef37d0a145a973f4a7c8e4d8d09e71d3faa4d0fe14cbf487",
20
+        "fonts\/Inter-MediumItalic.woff2": "4a2c5dc8c2ece82489e63b16cd8b1536b8f5502cf8f93307b0c71c6d54594a28ec2a80b8e58dfbbcc1d38a51aa8dd6d6fa025aed2cdc1429a462745a2bf2d414",
21
+        "fonts\/Inter-Regular.woff": "e37409956d19653617af32af2f99f4038c815a3664f2dcb2fef5e6a1a7345c78aaac3badc2ae499b1423514076ad676ab4bd5d936ef9d159899a6f668d991e4c",
22
+        "fonts\/Inter-Regular.woff2": "731924aedf31d6ef8fcd57a3b74182331ec7ba743d64033d8912d350ba98fd5b1942decaa4268f4dc925be2ed711c71a77200b2497bec10cae499b452fb27138",
23
+        "fonts\/Inter-SemiBold.woff": "684602b1f45bf7a9ca5ea6b1aca2cc2046e07ac79eb63b920099463f25866f50cca77ca253f16078d3a6e781ca23b964a69c87389621fa101d5cfffdb292d132",
24
+        "fonts\/Inter-SemiBold.woff2": "12b7680eccc54f56f800ac3ea4eff0490f515911d0fc83f99f62fa0f72d848155c8a7186918301a372d0fd0238d8093109c7b9b3c05168058e3cb47b1f7216ae",
25
+        "fonts\/Inter-SemiBoldItalic.woff": "9623d9c91148b651b7d4a642751e4f9eaeda68b6f4c33355d0173e303252039b3bcd301556a1d8451ffbd36d7996c1e8fc5ca1276884636cf57468e38c9e442a",
26
+        "fonts\/Inter-SemiBoldItalic.woff2": "97b7d8ab268ebcbc00876bd69ca9cc7cf2ae9ba5a6a30c13e3412e41a88f1f5ed758a6d9abbab3a14359943a003b14307cbc379bb11505c014b002322fd53c6e",
27
+        "fonts\/SIL_Open_Font_License_v1.1_Inter.txt": "073e141d4e45a3adfd2cb569db6a4fd217b1721dd6aeab8159e36940b984df5ebdc345deb0eb6be65367f943e516a12dff41eb1238a322d248ca3478c50ef9b6",
28
+        "fonts\/opensans-bold.woff": "d094832745611e047ffa87fdb21bac41befabdb07aecade483d4dc5a5b97bad00f1d4a5dca2a615789cd494791f0ab4209be537eb4b1bc7cbee7c42eb5e201dc",
29
+        "fonts\/opensans-bold.woff2": "096abb618c9ce1a534f0198aeea53c6d1138000f98b883131ab49ee48b80b483af635f0196ac40a1c1bde679f63b3c3b907b8f9b0102a752862d623dd22393a5",
30
+        "fonts\/opensans-bolditalic.woff": "c80f105a10d37c812f5d1b29445cd21cbc95594f71d9c5fc1b3aeeb9985c5465ba017654f1453baefdc56cc27aa325b586d77323012073eb713ab8f88f08dab4",
31
+        "fonts\/opensans-bolditalic.woff2": "38b99ebf320264d74a456fe590fc610580b003bc77a39d97ff42dec41353a8f908d6f680b4777cdb34ed544d9b4ed20dce8c418317de1d721e25ab670f49fc1d",
32
+        "fonts\/opensans-extrabold.woff": "6636a395ba345853ada2237b8e1f81c52e54bfb65559cbcb8de143cac00232f20cf34c764c9c4d4b80e82dae79cba3064ebdf22999cce8839df2d5709ee64092",
33
+        "fonts\/opensans-extrabold.woff2": "758c90eb07c6db7e78cb703ea285f82b443ca2cfab792328a3f8c14acc1f932ae79ec2987b8b94bf19b3cc16fae31c76f3164c9437a2591283fb1592e40ec33d",
34
+        "fonts\/opensans-extrabolditalic.woff": "ab1966f1ab3bb436e489c2d6ee562cf22d05b6b8c9bbca17e903518311aa45659efc329255e08ab597e2b8effe3bda602a7fb56b7d0c1d872b69337537d49dff",
35
+        "fonts\/opensans-extrabolditalic.woff2": "2132d6309969f868521f2d788b991bc9bcf3239f1768db9a2b90faf8838c35efea85225b24db256f54c86d0a7915ecd50a7f5348e6ab040e0f172ba7510598cd",
36
+        "fonts\/opensans-italic.woff": "a9751e7ac7a3c3d9f739d1fe00730a545b68e4a6473beafee8edf583f175b34fd5e0b60a14ec3707c8691fdbebea17e191c51707f50a21281e76be46f55a1140",
37
+        "fonts\/opensans-italic.woff2": "7a80c01d34562e2fe248a71078ffa9413c04c9c320d27acb0bce96cc295101eb9e80a25e97dab3e67c184c40937862be820581441aa4100bd512a26ef2d523cf",
38
+        "fonts\/opensans-light.woff": "cca2c5d207e0935c1848e22965972cb6feea39aa93b1b546051cfabe5ab16e909934d007a7ccd174eda1e7671d838f477890dedcb93d68ba722eda39a16d0bb8",
39
+        "fonts\/opensans-light.woff2": "cdc332de1b13eb0f05cc9dd1ebc905fa5ce948eab71e2fdb1bc538ad54a0de980bf83352090becd650af9c101ec9a6898d2e4798e4fb777e41c20fae85fd568b",
40
+        "fonts\/opensans-lightitalic.woff": "26e7759869088d8abba380f0bb22bbb9fdf0a985c0999519390cbd85099e3f48864d866f4639a8ff1992e7c81c755b0bbf66f525d4d38a929067886e9b54eb88",
41
+        "fonts\/opensans-lightitalic.woff2": "b7f80b69abeca9d0369f5d46da192e98a6329cf1f948c897fb7130e0d815f73e293c37f0e6d0047273fe3f13a19e648d1bd06cfa2fac2142ec38ac244e7f0940",
42
+        "fonts\/opensans-regular.woff": "3a526ba177f8f16ad95941c185411f350fab7e5202b9f56ea9c5f972c62912781d66da10e278e065cc6748a4bc9ab9182d68b27eaf380131c602195148e4b8b4",
43
+        "fonts\/opensans-regular.woff2": "66b3e915b891f7b37b441ee18e40f01274fe19f2515470760e503f428fc1c524ccfbe832191978c2c5f6bc4b7ef46937e4f77f5457b6efbf878c97c054cb45f2",
44
+        "fonts\/opensans-semibold.woff": "173f703ab767d0fcff014dac2fa3dcac787ffd0eb39f0c532b6679935c0105daacfa6a32bca97de13e420e10194b701ad2487bfd35d28807563ebf0b16d0ca35",
45
+        "fonts\/opensans-semibold.woff2": "75068ba76befc2356fe83b198bf6da70e177e53cc3128af09d0d9f69dfe538013f2828b2363c6f533fcaca4d4b2a5ec5159b5eb6f288504ac73d33ac5d1d2c4d",
46
+        "fonts\/opensans-semibolditalic.woff": "9e1e965095991d4a12a0658fa22a116b043ce20fd5f73bb9655d870ae49c46170cec52827510be323332b535002eb96445f79c3d1e4dd0550ff622fda0465f1d",
47
+        "fonts\/opensans-semibolditalic.woff2": "d7e43f05802e26f4cb80ab6a492b01c398c5b41168c7f61356ca3ffc5f4fccabae5ba332956f0aecad69ccabb6b7526efbc0395552cc5d68e47bec00bc660ad7",
48
+        "img\/active.svg": "3ab8794185150eceb9d54b7cebb6e2a925fa1baa8c979336f4f7b033278b4c48f1a9f4edeb92c2dd633fd4b2bfd199ed6634ec5db5fe20bd59bdeecd6da74463",
49
+        "img\/active_archived_conversations.png": "7432aa1588a1e5a9ff0d087b9268f904ff4d372791ea17eaecf9850dda3ebf568fed67f369c3ced0ee430d22eb8aef1b488d56431e396712e5e2a6a34cb2ae65",
50
+        "img\/active_small.svg": "c9076edc03da508e2c9ed3744db125cd961fae8e12a152b0fd8b9de9ff9c94531f558e436c81a358dcc62a0e3f53e09c565eb949fe5e7781494ca463a5c426aa",
51
+        "img\/add.svg": "5711a740d20d8243b4fa9a52783689af96b3b01af6e422ec6a9f0aca16db068869a5a302e6960168d9c90e2dc0a69eed851d69e7f1bf33684304cf861f990604",
52
+        "img\/app-dark.svg": "cbe97fe9fe636790ea0b415035cd78321ff53ec93ab1276d4ef609555592fa13d09b2037c20e06bbb9024fcfcc0ebb806c89572b08adcfe4ee9d06c6466b685a",
53
+        "img\/app.svg": "010ad7cee20f3a256a24bee2482b6798f042a3992c7df5d56ba803cca93552c3cda2a68d1772e67143ce45207b89d397e34ba6909f6b8515134db64e2c5497eb",
54
+        "img\/archive.svg": "ec3fd9dfd0724a1ca352043be8d1bea5ed6de6ef74e72dbb8e852d9579a330a74f16423587fe22b4a515cc593e45bc598a5f9b0128650a6003d7ccfc88522be4",
55
+        "img\/archive_red.svg": "0e43899668cfd9ce3992e02c8a99a3d011b9c94bbff57ed2777305d58350e031aea33d71aaf4e48d879bd19c6a29d981fa7e37351d4f13d84aca4cef42ce419d",
56
+        "img\/archived.svg": "6fb344ce2d1927a0245379857d2069c3b22acb9645ccd4c7b2d159575298433bfeb2e91fb2cde4e3f8536f197b0baa885d8c1546fdffb7b1587dbc2ec1013add",
57
+        "img\/archived_small.svg": "70c8c0a692bce23a07416d8782a6fd8ed2a68d27dbc384d8488968c933743d9304df82ab5f4cfeb4748449c38874e5c3b8fc8ec325c1742451548e7697b85726",
58
+        "img\/arrow-top-small.svg": "3fba2fbf3a27f4d6b44d1c94da2260d025bbe682a3db18c21b9aa548f4878609770cdaa2e5c24e8b5cd97249647187b7499ab18bcd843ae7ee145def41561bbf",
59
+        "img\/arrow-top.svg": "d89358d5d6316e6298789bfaee21aad3a48468f3744888e32325da04e70be385a0f72b97f77e9bb3c80e5907a4c6721a1454b2958c7fd35f6739512a2f2c2b9b",
60
+        "img\/arrowDown.svg": "6fb30b189e848b26369238f7446eb1533327a4e99c70b699c10bb03088eeb7d47393f18d4f16bc03edb945f36cf13b96f05b763dba821c0b04b209cd81624103",
61
+        "img\/arrowDown_small.svg": "cb41e401624082681d60fe5a753fbb3de0d9934b9313ff2f683cbef349ec5e5dbe43f59f60d96f76bb2474517a2a98cc48e1391e8e10c382c85ec9b8d5b3ad03",
62
+        "img\/arrowUp.svg": "4f6a413d836635fd7e2e4d5846ee257c9a13e80624468e444ec906febfcf07a1c84f48d29cce730f29729cc8fbbbd3dab490e2192e5beb2707a6a4b1036bfd76",
63
+        "img\/arrowUp_small.svg": "817c225554678442d19f5bb75733ffff789a97a54313aeac543a3a5dfd90d59b79eeb8032190d2264c8a35a46ec9fa0e2c6ec22e28016fcbbc757fd2668a2c0c",
64
+        "img\/between.svg": "8e7f4309dde5c83b0ef55b72bdac1d5b9ac26b8cc13d134f13a1819a6d214ddada19937cdd2012aa210dc612c0953e3bbb266aa98a02fe55607a0bc028251ca7",
65
+        "img\/check.svg": "aff77744fbd4e8eef8d91fd9e128e9e8be2830a93db9ba8d8a8277e78c8610d6ea5ec9678b3dfd2b8f2b4f8970dc40c4111e7af5011b0873bf461f5fbdeeaa88",
66
+        "img\/clearfilters.svg": "dd92c6c434ebcef78659c8b1f2f80444e25c6977e3ba86f3490baf6d9fe98581901a5d5279f78912b0e7b6df434a552c51e7223015579e632ad88665104004a8",
67
+        "img\/clearfilters_small.svg": "ab3500542d45d66ccc2a7d852ab3fe25e942f270cf0400efb07790eef182c891a7d7d349657c9d447a2cdc7361d063bb7ab05053aa74cd7f7d0b98aa2b872437",
68
+        "img\/clock.svg": "d8aa7359883b08e96bdc3c870cecaf482b149bf135f3ecabac77081ad0d7db02caeeb516aaa111d031bbea3e0fda05a295069a8c00d579ff23f140e99409155a",
69
+        "img\/closeconvpart.svg": "6253cc849d6322ff6395d3fe82106aeec1318f25e482b08db7407ef39ef7b02a3a6fef0916dade71c2f6f6238626a7a6edd11a4aaa266af478bd3c642856a3dc",
70
+        "img\/closewnd.svg": "38f6ba89d70905ab3d2c7d524fee42ce08f007622bb1256d04556cccdf40f549d39ab2fc455c878e6c318c03a8680d042c8e7d0dff9360a921e397e38567bf9a",
71
+        "img\/conversations.svg": "412ce4a14bb38b633ec0ff7d714c785f45f9153e0e5d77d04a051eb551e378374961e68255e124a2c5042a70d7c11fffce95631336529502503f920844d3c25c",
72
+        "img\/description.svg": "e024846cea431279325a17c92c964490a09e485cd3828f232cf69dc9c10233b7feda3c8bd0fb1500a0899fe356a2d7d7df9bd18a88bfb4076296f10181097b1b",
73
+        "img\/description_added.svg": "35e922d182e98be95edc056b3d2ff7eacd0443f49c294cbe7d0d3353284b590db1a7c4f72fb3505da4b2c65021074e41dff84473a88b0c92fa271675345bc49f",
74
+        "img\/dots.svg": "e4a46301c4b70f3820be8d6906ccec273a96edaaab44d7c133bb58f5499f2fc6381f2029c27d0393e3d31e1cf10bc55ee98f05347fa6af3533cc74290d9bb909",
75
+        "img\/filter_blue.svg": "740f464212882e0f785ecefceb3954ac836ffaff5e77d1cad83d1296c88fa469eafc1241a111a48d720124cc94ccc362ecf2da4121613e6a512f596057506df8",
76
+        "img\/filter_icon.svg": "5258d0d0e3677c10a8ae5d8cc37318855e5a6d5071d5a61ee6d29aad7109292502d60571f2c5ae716295dd8f93a327c060ec7c65f2f9cbfee4b85086682a385e",
77
+        "img\/flag_empty.svg": "a009b1228f4b504fc1e72b33a06ae0c8f1173b011c03bb5051409f8d732b5c51fc97158e234b2ca29e58522ce84931b925a6b710bf7d25240fbad4375f252748",
78
+        "img\/flag_red.svg": "1f3590d7a9fbe9f083970481af1cc4b945cfd0604fc91cd31da129aed67b1e6bb875f0e54221d217c6b3635446c291b7009c65b822a00779752ce6a30cebcadf",
79
+        "img\/garbage.svg": "b76cde0659b7f127a810406d2b734f03871e3a7c8bc53acb723c2a97fa6ca0801a26cfebd4ceaa28d2ad237a67a222e00aafaecaf7e749cc8e8f93ae35a4c4f3",
80
+        "img\/garbage_bright.svg": "45bbad63a659b6add876294f8aebda1cf03790b0c253ba442f04fd9677c1a35795eb823dbb92bbf38066e8cdf89fb34671763dabbcdad4722aba3ffcaa21581b",
81
+        "img\/garbage_grey.svg": "8b3f724edd0a1ac3e1161af3b37708bbd007aab58413c7e55f4f43abddea740b5a7956ce1f8c845bf99117f0f99716d6b5efdb7b221d92502ce4c89176345a80",
82
+        "img\/group.svg": "fbc10073fb9f5ac1780ccad2c61586512a922359b48ff76194bc5be2711ba99efcf9ce42a694e4cf1209dc78cf2bd077e12f98590c1fe1123260a23419cd256f",
83
+        "img\/incoming.svg": "c8f6e4c7e55c7fff5c74a87fe14e9f404fe5954a546949f148fd60cae7dd2e9165e883c34f1a3eb5500c12ae2bf281ab1607e04c4b75bd6322571ccf7e6ccc25",
84
+        "img\/list.svg": "2364a4ad93d0e4c85345a293f4f6b0e4135cbfb8b7b5e1ecd81d08affd0e0441439f9cd9e60da77eaa53052ef20cec20b49263e387b500c1fb4a3607b081e73f",
85
+        "img\/network.svg": "8778d56a1827da8787bf74704f1b296f4b882e04a1a36434e91dfee52f8f00925bdc72905de3b3833e3f79aa9f51d9a3cc7855aecade6892edf84a042668664f",
86
+        "img\/nextcloud_logo.svg": "4e0d3f0c371d668d83d443e5b1f69f0eedcc759092601d8fe8710dd97b16fd53aa3f9667bba7f305dc3aacfbc14e29b09b78da8b7bf6f41dcb83f5b16473991e",
87
+        "img\/nextcloud_logo_bright.svg": "aeab941556e29f9537508171583bb3309372866122c150c887c21d6a567c5aa06d2653db67c7151b064d4e2fa25f1fc63df21c786ede02ca5f40f12e5c1bad26",
88
+        "img\/outgoing.svg": "b5be7538df66570991b975b1fdca452144fdc27a14521dfb2ae4d0393d0f3b8abb6837458892e04adbdec0182ee3fd25ae33c6792457154dc2cab6e35bd6eb9e",
89
+        "img\/participants.svg": "83cf03ce7bda7cd15a87da78e5e4a8b7db674ff59ebd377cee909fc90b0cd746714123597d019e9b8ce208ce86f4fe03890c9c11b8e858b2e4e0f704aeaf165e",
90
+        "img\/participants_red.svg": "6a26e9d9a45d29f90e6ff335adf644310e55907d36af92cb7441babd76c826c6b31dfb3297465c42193caf450e1e84f8ae2f01a89cd8a58167a035ccc168e4c5",
91
+        "img\/question.svg": "c2bb43256a2b8c43997dd6b40a2db8c811e3a2a28a0ebc11c8e87d71c21b8cfea3367a39730e6675ca77c9ec6e9adb4bab65cee474c02276f905b4477e28b1bf",
92
+        "img\/received_messages_on_mobile.png": "ead85cbf9d328caca3840dc3d92d2247f744ac002c3628750e096aaca8ec865a56cd0d77a38c5e46c7f440ebdda0256c2e1dafdd78c6ee883f462f37f9c66900",
93
+        "img\/refresh.svg": "a95a19645bbde5e2146a3ec669950bc6029bfc6104886552eaeb4746733657ecbe4f9199e676ee2e9852ef0c5adb612d93e300e3fa9713fc611e1f8e7c1d5183",
94
+        "img\/reply.svg": "6c603311ec3fdb28314cb8c8477ec491e4d5b04ebc71f3f68409ff80b97fab8397c34a5d576c369cadfbe4bec7cd1fb177ee4963bc9bfca376126979afbadb42",
95
+        "img\/reply_to_message_on_mobile.png": "5b5b3ad0a668b15418c37d0832b1c252125006664d60fc58928bb7ce789fe6afb6a046bdf6c28a8b4e58d358d87f0880c8ac3b2e390bfad77d35f0970cf1d036",
96
+        "img\/sms_relentless.svg": "010ad7cee20f3a256a24bee2482b6798f042a3992c7df5d56ba803cca93552c3cda2a68d1772e67143ce45207b89d397e34ba6909f6b8515134db64e2c5497eb",
97
+        "img\/sms_relentless_dark.svg": "cbe97fe9fe636790ea0b415035cd78321ff53ec93ab1276d4ef609555592fa13d09b2037c20e06bbb9024fcfcc0ebb806c89572b08adcfe4ee9d06c6466b685a",
98
+        "img\/sms_relentless_delete_old_messages.png": "f8534ca040cd5e7d1bec0dcbd309742ff18e4cde8f978deaa2b50eeae8c810b1c4f605d941319e68353bb20a3b8fcf9e126d76e0b65a6176db530f8c2c9eae4a",
99
+        "img\/sms_relentless_exchanged_messages_popup.png": "7f64fb5e59222335a45fc93eb1ecf58e67635441d7768ecf3939dbee2ff3cb55f3e0f4c1b4e6b6e38744d86be65609ceca3e839538f185e62d98601218e16ee8",
100
+        "img\/sms_relentless_filter_messages_by_date_and_keyword.png": "d61047f211bfd6f51bb4222ec68fd13ec69af764964461f6e24194d99fab49c74c7e80c411c9be52f52e83357963a49fd7b2c0abe53dd60a145e5ef10993da26",
101
+        "img\/sms_relentless_grey.svg": "ffac810d151f22067a4ce4985b6c84ec6f6bbf7f1c0a8711ad4a374b838251d3681edfa8439e18c1fcb78160fcdfa20d4f08527a594c5080938aa611991acb2e",
102
+        "img\/sms_relentless_grouped_by_number.png": "fb34074ffba14dab82d4549162b4a447638c702b5e6c496f4bb7015b5456dbb2de919ec5c467c973f3299ef49b11e239a4ba4a7e78c4f306f49f11b6d78c19cd",
103
+        "img\/sms_relentless_logo.png": "bcc8bc7301aa9c4811ee875b5deb4ed21d9c7eca187970643962f0ae11a7483adc5257e26b307c41644dfef63ec82c4e61a221f133c62827e1d4418928c253c5",
104
+        "img\/sms_relentless_messages_to_from_popup.png": "a465c0c318bef7600610c345d3f88beee50bcfffa7b11986b1a8030f98797d73ab25f4eb1c773562566c0e0e02b69048f927a6da2a99e638f3ac09368b0ee0bb",
105
+        "img\/sms_relentless_on_mobile.png": "dcf7c74ed512afb2f296b675c4c6008bbab511ea77150cde4523eff16fce8a4fe67da9bc1adbd76ed0e9e3f27589ec900edc936ee7c3a9ac5be0b1720ed8b3ea",
106
+        "img\/sms_relentless_received_messages.png": "c661692d3f1a766aac5e453a387f5d72cf374691010790f80087f35e78152652e963b937ff9f74bafc3513ae56561e4bae5409b5711cdd792aa09a10b7d17355",
107
+        "img\/sms_relentless_send_mass_sms.png": "277796f41a62a36683d9fc8f3b125dee29114be6e2cf6544c5023219c032f8ed2667ce02543b7550c0c72ccfc29f54d4a5e6d41d47c3dcbfa38eb8a48072c779",
108
+        "img\/sms_relentless_send_mms.png": "af7fa40084cb677f72f940585550c0a3515bec5989df70b56ed6e3a99d894b2fbc2a1faeb31135f897520d478f6aeb39ed5c3632a2375f4d8ca23a2b65a07474",
109
+        "img\/sms_relentless_send_sms.png": "75955a572f44c24c5e35a556de66d60f7af356d8c5b3a95134dc9165143326d285c4ec42a8154cc017fd4020d44a7df911461f00d2f3514cb2bbb6e519b206de",
110
+        "img\/sms_relentless_sent_messages.png": "ed145791dabad6478c05a9aa3a396e7a3422f64d90143b49a5df1a893f2279931df6945ba5b35b80291fd738066f4040dd468e4bee2acb630956af1d89c2a5ce",
111
+        "img\/tag.svg": "7c554ae1a7b31af214bff8429fcac39ea4218bf55a83846b53b695bfd2fed43859efa7aa99a7dd6b2389a904baddf54f09e171378b02d9aeca6d0bfb74632289",
112
+        "img\/tag_added.svg": "346f3b192dc194bc100614e6afd3958eb52f76f641b402674da4d0b7273262345a6bf0fad18f9962a0edde724af5c231933e3c5391a6fdf8150ef784087eed46",
113
+        "img\/unarchive.svg": "a278a8e54b20c462cbb283dac6f5ecaebf863b055b377d32bb77e8cd443cba4e961d147729ca737816df1e90afe0b28b6b551f88a4f5753f14c87eb35dc55005",
114
+        "img\/unarchive_red.svg": "331ca9e9e9d51b70bca279366d7481153a24130cb19fbd6a0fea72a425967c9167bbe575c0d54b88b76d83a533b9fc2737b019aaa75e12b781b5d2e0d1c103fb",
115
+        "img\/user-grey.svg": "1128d96d0a4281591140149de57924e014a1d709ab97d351100c901569bbabc8c8834caf1a5932408b7918997547c323b8b9f4f410e1f03a4eeb89045bd95ff8",
116
+        "img\/user.svg": "d69cf4ee448f7ba5d46fcee24895e8705c297f078d943ecee1ea242b470c5e89318a5eb077c81e9c2a656f903c4e869298cc2935cf05a4a5f79e295dbf86df60",
117
+        "js\/adminsettings.js": "e0a88ddbe25574743193f067fd2f0c2728f05b07218386375719886f6a44bd882c7296c9fb3e8ab3fd02ac5a330105658e2e05fd1cf95220baad1af1e1a8bdd3",
118
+        "js\/arrowup.js": "f7d5c5aa20b49cf936f88e8ba0d3dc8574481f842edf3867fc761ce4b20699604a66a611dbcf999f25c3122fdd2b97d5f7e84e090453fd8563067f9821044478",
119
+        "js\/deleteoldsms.js": "7f967d97186690b1bf07a36efa4af3b593ef53c0efcecfb61d125aa15d077d5a6e69c703e3a0c0784475c5985272459c1fa9865395f7689838ecb37eb1b84ee0",
120
+        "js\/sendsms.js": "ef2b36d542b0ed5b00effaab76add3057d6bc6f04952304b157c51351fefbb7ed4210d0c9250d7663f2b39949a98b4b7ddf57edcbf532f3679a8428dbb924577",
121
+        "js\/settings.js": "17145e18c5e36ff81809ff4bdb05b4a7bbab0d71a95d671b07ca81aba6b8bd07fa2d00edb2fc70fec7737bf525210dbbc00e4c47e25fb152a3f934fdf2a6c4a2",
122
+        "js\/showsmstables.js": "103c3231951fff5c7a05f68ed2348769ac8565165db85efea9ba3cb1e28a00821fa1472781493b7963f8d614db619f1a6488df6cdb32237860c21ffab84d76c0",
123
+        "js\/tiff.js": "0c20e8d4f9f602ef497a26a50d8fd253abd55cf53afb0699638264550e931aba9b5b41c1ab0fdabee064046aab13b921c8d6988d76048f6c9795bed5aaac8aa7",
124
+        "js\/tiff.min.js": "c35f67b587aab62db7a3de662779a7b3264d70f5f856142cae88eadd1b477e474977f2b8c5ab31c16be002cb7ca9b52282e6de533b6fd79a02e6d33815919cb4",
125
+        "l10n\/en_GB.js": "475318da15c9eb934c4891702695fd9b1c9e98539585d2324b6702af6adc4a1a6adcb0e1e353163d5816de63fbccb8a0f3f71f0f2ac03c203d1ad9eb8eb56d35",
126
+        "l10n\/en_GB.json": "acce76cc12e2305761858a524874d691e463395102253d654c92f53c58b2794d185505256386bb6bafe55e16e291971fb14ee5bf9bdc495d0868016e75de61ba",
127
+        "l10n\/en_US.js": "475318da15c9eb934c4891702695fd9b1c9e98539585d2324b6702af6adc4a1a6adcb0e1e353163d5816de63fbccb8a0f3f71f0f2ac03c203d1ad9eb8eb56d35",
128
+        "l10n\/en_US.json": "acce76cc12e2305761858a524874d691e463395102253d654c92f53c58b2794d185505256386bb6bafe55e16e291971fb14ee5bf9bdc495d0868016e75de61ba",
129
+        "lib\/AppConfig.php": "c52269913ee80151397520bbebe4f0c725526910ce18f8717ba1c8016a5f4dcdc9a6f9350bc56c8a6b607ea342ee0cbe0f65afd9f03c31902190c008f41c9672",
130
+        "lib\/AppInfo\/Application.php": "7a4b185c9d8c130f7d3d804cd92099d38925e37b910f8bc2c433e3f0156f5631e2f952c7ece34f25e7139391f03158f3df1a3f60662d28699ecfbd89965b8cc7",
131
+        "lib\/Controller\/AuthorApiController.php": "2254c0e18d3892afeaf8f6a50331a2b7da41a2b3fc6952381dd9d42cbedad5f5ee5d1ac115ce7c0d22d9a72da9ce8d8f4b68187aa3f207b9ba47e10155207851",
132
+        "lib\/Controller\/PageController.php": "07da5883ea41b3f7993a3e358a03a3db592a30fa81ea1ed0f26a234fcc3824a243316b76824fb9a24f40304ae945c48118dd4bed1f0d2f6993e479ab2c1dcab6",
133
+        "lib\/Controller\/SmsrelentlessController.php": "7bf3c8511e590182140f835afea08cc448bb5ef17056e3f11465958c1ece54a96a99b5959930b89b09f09f87c9f41e3a064ba8b3de1e1627412a91781e547a5f",
134
+        "lib\/Migration\/Version100Date20211106192148.php": "96b9793edf72598c0330aed9f0c6c27ebf02287bd84b6b7a0285fc784bdf6442b560bc5dd2e55b464bb384a24831ae17d7ea144b0896d9b11cb82a27fbf602ff",
135
+        "lib\/Migration\/Version106Date20220813144231.php": "33f1f2953e038350e37c670462cc79fa48ab3a72b595f5fce970fdcc6d7eefa3401722da4cc532c7114d0c8aab7fbf0281afb374a695d5c1c1b311c30f64c9b8",
136
+        "lib\/Migration\/Version108Date20220823132408.php": "5d94388496cd88cec1dbbe67a2e9d6ae6fd5db7ed42d4bc737710d3c51ad4d8ad29d53a62739e05e2986e2d4c96374f4660a53dd7b7808d30e44e5c605105971",
137
+        "lib\/Migration\/Version114Date20221202011625.php": "920ee001204afad537bf2b7dbdb7c78e95b4ad0c79f5f693bd56347a1df91045cd83348f99e2ad714df2a735cf1a1d85aeb385c675ef6e90eed26f18b0b7d344",
138
+        "lib\/Migration\/Version116Date20230508212745.php": "556137e5580eb33beffbf6198447581b71de677c2a2561508c0d7f2f51e3ab7ca9feb0715b994a2753616838ad732e01e6cacbcfb521eaf559fb40200f0594fd",
139
+        "lib\/Migration\/Version117Date20230509183517.php": "dd289fe9ed0947b1174390dbd921ee696b50af9bdb360585376a6d5334e390dbcae65833c13c332732309f8fbaf8d83d047df6accb8118c9e4fdde8370db7b18",
140
+        "lib\/Migration\/Version118Date20230509194216.php": "165c805c76bedec7f48811fb4a83685287daa07660cf369b952ed2dbd9a6c0bf1bee2b78d3642478acc37ebd597f0df7d9eb7035c047acfc69146b664afdd286",
141
+        "lib\/Migration\/Version120Date20230520072431.php": "322eda5d5112d5e52a466c91ba02c40f1e77231c627c155e00cf6a924fbe16b4d6cee69978b0b3789c5daa03dfdb3fbf0f33b42fd40811aa366c7a227db4c31e",
142
+        "lib\/Migration\/Version121Date20230523201743.php": "d4f5e1520213a4f0a1d74c6faa1da8a4988dacf8d3f3c7aa8bb932744789a366e1758e2a9be14c7768ca7114ac0e7588ad53b7a9ad6bc1a45da5ef22806126b4",
143
+        "lib\/Migration\/Version123Date20230524182156.php": "7bc033f8852ac9b79e15bea2e13421c603acfcc443304bd36cb0f015991a0816b90950e6b45a84ebe5e03e92c4604e3473dbc90bd72810166a6a20f97eec546c",
144
+        "lib\/Migration\/Version125Date20230603224815.php": "430f98229247d0ca7e3c96f44d810e84a04a9b971c42f645eaaad08b213ec87506b4253c013b47b4c06d7f595aad414a17e3a9078b0fac9c9ed0d980bc39b4d9",
145
+        "lib\/Migration\/Version133Date20240215094712.php": "a47381d134e326413d2b8214f602d0abe5de30f99107c3f68bc2959fa6a601426d1f3f8f5a40b2ec7e297de696234918aa96eee51dea504ea76dd9fb63926958",
146
+        "lib\/Migration\/Version134Date20240402032516.php": "0dd7ecee413ef1bfe1768a2fa795210100acb9234c447fb1a0fd80239e7949485d33f1509408a09425db9171bc18dc2ec94989bb6160337078ae60c2e2fff732",
147
+        "lib\/Migration\/Version135Date20240420221527.php": "7eb2055e8dc89101d8805cd991ad5dd5246612987adff68c54c40dabaa0950bde5a9a72018a2ee22d2a744dd90e5847f58c60a73c5fc9ce9cb128b90b37ed63f",
148
+        "lib\/Notification\/Notifier.php": "87389f3cc99cd6e54357f7659cea534bddbefb9912150ccc9c38ee71606aed37831bae0dad3670156813ce50493dff9b2e7a4d838dac043bf9c7844879dd9f44",
149
+        "lib\/Service\/SmsrelentlessService.php": "664ac0a82d20ce5bfcc88b93299319a10e0bfde0dc4c226b98c5e0846d14c2462b44426821c15aefbedd2df0b7ca29ff5d9f5d30cb24feb305284d21a5908810",
150
+        "lib\/Settings\/Admin.php": "e4e5f6e8fc5748b11c90b676326dc228fbc52fe1f77a07e7b7460c6dbf2a8013b5e0b0f9084aac3f941478ae6ae75c47be17df3d229d8a998363b9a1d289f405",
151
+        "lib\/Settings\/AdminSection.php": "1c8fb26e8347d67c69af385b0aa33be2764135a4672b872b6c6d41bef3eac6733ca2796c393c8ff334ff56accd7ed4d4c38ca50baff2360d8d8be02b9f8a7c08",
152
+        "lib\/Settings\/Personal.php": "db6fc80342c865841edcae7d2cce5e50d04473a9ac47e26c2daabce493bbb1bbb922bbe9eb7353d759965506dbf1b4c99ce8e9c93f5c43769e1064cba19f95dd",
153
+        "lib\/Settings\/PersonalSection.php": "e65e1a8939e3818e7cd295ce86581a603b1e2fedb732ce51ed1fce62cb61ebae9b93742b1d923f08e14cdc6bd5cf2818d47917321e0aa1736932830c05a81682",
154
+        "providers\/Flowroute\/readme.txt": "25f08fea0f30105e850dbf07bb7a9351e47883640dd87d26981cf50f02ab5af8ef59dbd1fbe5e4127c0e019e13ce036f9414401b9d3f3a924c4125c291e53446",
155
+        "providers\/Plivo\/composer.json": "2d8def5ce9444d4bfe4ff32e008e6aeec924efd40e0cb61f3a72585fc4cf89e7b62970e796d56ebdd5d2f6378f39d3ad540ffdd02c31e2c4daae9b760482619e",
156
+        "providers\/Plivo\/composer.lock": "d9a2b89de334156eaded5ca4cdaee9b53c05e5d78584faf000a141692225a1bf6a1dd9ea6259bee2158ca7669c4000b3c366703fcd1f55a835278aa9f653c7c1",
157
+        "providers\/Plivo\/vendor\/autoload.php": "597387bcc320be22e8b0060c456fc745d8e3fbb06cd1cfbdf093b0ee52aa30cb7e4c31d6d8c38450f52387c0cd5f9d0483e3976611d96f391f5651b71d2095fc",
158
+        "providers\/Plivo\/vendor\/composer\/ClassLoader.php": "2b6fa585122ace1ba816410acbd8372cb75329917aae6363dbad48e396cca581452616e1386a2e445a8fbb0e461b988279103f4f89adf704bce7726f761abf0e",
159
+        "providers\/Plivo\/vendor\/composer\/InstalledVersions.php": "62b61a5303337c975905fa55addb6b1157034fecaa5fb3b5bad251ef7fa1b1ba840308f64fd2e1244d2098b7f87431e35939a153298530cdbd82f81b99cabaa2",
160
+        "providers\/Plivo\/vendor\/composer\/LICENSE": "f3bb64009f41a425df5a9bbab53490f0eb9b74fa8d6aaa2f57efb928edc4ffff330260666edeaa04a91fed708c3663371cf01b284f3a08d6698aaef7a23f355a",
161
+        "providers\/Plivo\/vendor\/composer\/autoload_classmap.php": "1844f7843fdaabef42d1d9e4c09f92f51a5ad45b26d44b34a2aa9202a183489239a0f5ee6502f302b169ccfa3a4bea7308771ca02d3bad96095b5b2194a65377",
162
+        "providers\/Plivo\/vendor\/composer\/autoload_files.php": "c0eaa5b28b83539deb67f24a98ebff5ac0483f9117a72d5cbba02e26f1f18cd4c93ebc23786047ee61eeef11961c55ae6cd4d4096a16f18a19d2af49a47820bb",
163
+        "providers\/Plivo\/vendor\/composer\/autoload_namespaces.php": "0ac6bde683c053d62b7024686ecced083ca1a326d5346a248b1a058ac74a5af71d515d311ce76df799a518027f734b80b9e7f6e8022a9556c0f24ce90240d822",
164
+        "providers\/Plivo\/vendor\/composer\/autoload_psr4.php": "91bffab80b2ba961f206bf3008a7380f81b7cac7b09afe4bcd2d4787d8b4c839ffe2a67442e04010918631b1c76b66304e7d7bce76371e741b444f2ef527355f",
165
+        "providers\/Plivo\/vendor\/composer\/autoload_real.php": "2ff5b7a817e3acbf585fe506b11345f6f3ab0f21c0ee96c67037f09de6130126d4c0e728ea22508192787a451322369197610726f96f32a12f91b7e48cee86a1",
166
+        "providers\/Plivo\/vendor\/composer\/autoload_static.php": "4fdf5e58875a6dc6bab4aafefd254cf3504f78feecdeda5fb431a56f84b37d2cf8fab8e233ecaadc2667f1be492ded264423f3200e1095aa507172b0dad3f60b",
167
+        "providers\/Plivo\/vendor\/composer\/installed.json": "0365a8c8cb376a0b3ca8cdf63147012435d2488c5ab585db3f9e0d926b588887992c1c8cfe07ac187f5f72afa9a3db936c6885d443db444147d7c87ff0f3084b",
168
+        "providers\/Plivo\/vendor\/composer\/installed.php": "923c151f9cca2fe9489aa4cfe04053d20e1923dfb388cc6aea2486557d77284fe6d9d2a77a7acd94496237465f03b712166a2f2f5837ab13bbb7f0aed8d52552",
169
+        "providers\/Plivo\/vendor\/composer\/platform_check.php": "49e79f2c7c1c32796dfef02f64feda4fc8fc5aa05197465fba579997d332cb9dfcad3511efbb34a32a2b2c8d8901be4ca39867026b2471fb17999ba840c3c340",
170
+        "providers\/Plivo\/vendor\/firebase\/php-jwt\/LICENSE": "6f6cbdccc57476f5386f5336c1efa105b4116760a329ae2fedb30fabe1f34f7c1a3073e7f711e07284c8b57b3b8ab6dcb38ba8d71f6835ac024ad524ad658f94",
171
+        "providers\/Plivo\/vendor\/firebase\/php-jwt\/README.md": "8f3226941b2d676aa31b66f5a38f6fa78a4073ec7ea6d6a3aaf0209072cbc8df2ebee65f64460e350f499f8448542443f9859db75f927fcbe70f1f59384e1a70",
172
+        "providers\/Plivo\/vendor\/firebase\/php-jwt\/composer.json": "82e17e8f606504476175a3c5116bff37c3d58faf5fbd9590cc4047f787b6aae79a84c660bf2e8dca453b998926dec84e6d5bca5d81b6817e09d99c6774cd04e3",
173
+        "providers\/Plivo\/vendor\/firebase\/php-jwt\/src\/BeforeValidException.php": "8aac5fb14b6d94bcf048a1cd4935af09c25183e74eaad8f2db19902f1f017a33261707b12be8080d5a662bd01d997d4d5805cfcdf3127f447feb6ec6b971f563",
174
+        "providers\/Plivo\/vendor\/firebase\/php-jwt\/src\/ExpiredException.php": "7cf0ec0dd02717f5152abf5c01979526fbb89f04c01802915745097c8606e432b41a4de5bf92b7cd1543b37a939ce8e133b7622f29cc48798c321654dfb94a3a",
175
+        "providers\/Plivo\/vendor\/firebase\/php-jwt\/src\/JWK.php": "3f134e7503b44f882a92a699dc4cbb4d7415bb93526438e4395cbe877ab2da700d3ef7a8c037d7d2ffabb84e20165f93e338bb32c2bad9426e63708da4f842e3",
176
+        "providers\/Plivo\/vendor\/firebase\/php-jwt\/src\/JWT.php": "9e5e21477b0495c3cc6fdff79d9b6acc136c0187d732cfa4ea438d9802be4642c2fe0e76b288238fa29bb0a8e37e31d57546d548519436dc49de467cfa704ed1",
177
+        "providers\/Plivo\/vendor\/firebase\/php-jwt\/src\/SignatureInvalidException.php": "0c00a3a08bf4fc2eb675fe8ad3d8cb732a82a8f88d37dba5e510ec798a49342b8089098dfae1f1ef1906e62a4b8e465fb7b4c6d17c9c0d8e66ba33ab271e5c88",
178
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/CHANGELOG.md": "f99b50bf2d30b8e842d2db14a28068364b330b402db7bb1fe87fd4e1e3a9009edb05a519a4c35be68ba99c4c334680ff52ff0bebb84ab99de8814959d34e9c90",
179
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/LICENSE": "ed4199d68a412c0515450194549bac0c6a6d838b3950c036bff6c97457fade76fc914d11bf008321b3e2622ef0a3c14da0bee2f109529cfa5a5fdc11fc6452ae",
180
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/README.md": "dcb463420d7da1805c5cc020988f60c15fc5623a2493556ba4bba63d431c21f0584c1e65f27bf0a4c7962074aacf40d763981f878a10e12327cff9b89204ae57",
181
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/UPGRADING.md": "4f2540329c6e06bc0f05a574b0ce5d77ac3f7fa4032371665dce41a766cd28ee12a0b7803ca507faf005f6a3ec5107a60978b69a4fede8bc562333b736576f55",
182
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/composer.json": "8746b3c8b0fcf0ede926b6a60b4d34e7a3e0e9664aef67b34e7e238c25179d22ce599e8c4a580e9f3d73122a0c9b373b87526874c947878ab339e662b03c150d",
183
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/BodySummarizer.php": "649dbacf3be500e6171769c18b1eec1888bfe831dcef8464ebce4461d5fd337c60a200d3c89f9bd7c2714c0567e5e220b31ec2970e7a013f914123824ea324a8",
184
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/BodySummarizerInterface.php": "d0a1271ad03136dca5752c0dfaa7fa678c6fb03890be828780201cd9fbdc8169ff4fd7c17867cf82ef1672ecf0e9f871f682ade1a8ff37e7b84d24c572e1b962",
185
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Client.php": "8fc98c3490398476a81f660a0dda38306acedaab2f662f762881c11f98bab8b5194ea6c05477bfb2676848f54229087df8fac0e6aacec6499f2313e09b940ea4",
186
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/ClientInterface.php": "d1ab53fbb1b6695e6537050421b3a749a7b34b3184015da449a1c76987fd6944bcc1c4cca7247b98b338926af89fa477f9be4897e6316cefb2c1656520c3ea2d",
187
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/ClientTrait.php": "ec1e95b2f1c56e4443c6fcf695ede88e02f1129b7027287f968a0ef2f7debb7533ce2371a27b5ee07f78818786b0a6d1b3d2f8ce28f44f4a8f7e275bbd1b6727",
188
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Cookie\/CookieJar.php": "3fa0964d59cbba956bb47fe103f02e4707a2a6ebe5a60dd5c33f59402a090b6f0110c2795b52f961f6ddf338567382e1248f1e27bf2d0e2033a43efd15e2705c",
189
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Cookie\/CookieJarInterface.php": "a3c6b9138e285d6c6b7521dc7059a04e1c80bc0de7a925c93ecde6c95cb7fadab91ee05e9594d6b891872a557a1b98fc6717ca1d1d46e00992c9cdcdb934a71a",
190
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Cookie\/FileCookieJar.php": "35111b9229059f54b537baec960b8480d5e3caf2961ca3e7e45de3fa5ad5bd0b0a91c2c4231f6386a4966bf9d97aa308a7e444000dae9b21f8c58b6832dee68b",
191
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Cookie\/SessionCookieJar.php": "9cf11d2908913a7555e9e190e6a4ffb0f0e26ddb3d141faeb0e7bafaa6f0b3259119ce6febb6d01b5a7f5a3193f72a099f08ea45b5955bdc7120bfd4857879a6",
192
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Cookie\/SetCookie.php": "7d6c4c14c9d652c27da23923cb577fa999e24f81c1b82f13fa329da3eda3373ba7a832b72d793d924fda9d6a3a02cb39db97e49e17feab3ecc93f395e614d44b",
193
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Exception\/BadResponseException.php": "4b7a572e9796b8043d56dc6650709e59bde237b3bacab1206b807485cc850ec99dde86892696d73121c345f1c88a9d2e879dc91be2cd438defe2609e521011b4",
194
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Exception\/ClientException.php": "0011418b0cd07eff70f99645a008c30e9a6a90b9ec396e8cf70ffc281140054bf313eba40d97ed34b59e04e5fd6712330d34268353493d112b8029c1c42e5046",
195
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Exception\/ConnectException.php": "bca929720f3f8f4484899b18b40f5d4d40ebc4105b316679a9349b97200c74ad2ae6408e2362b4639bcc4a3150fe63ca1e08bc1b159c51744d76466c41203c83",
196
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Exception\/GuzzleException.php": "444ae2d2847cc99d9a3895e2d23f0abe59bf0eae279809f7a4983e34098ee0a0ad7408d251df821c4029621060aff1ea0dc890615535ea4368e5796151a767cb",
197
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Exception\/InvalidArgumentException.php": "2647ca6c297960b01b29435db7522ece3a997def6b3af71e26113abd43ca4493501c130e7767b845db0e723f9955164ce33664d49bd67a45bd29d270a66e0e3b",
198
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Exception\/RequestException.php": "b0b3163e4eb96ace90c03faf9406b89ae21c7cd5fcabe78035d5d9e1e7ba0ff72bcf31b877ce2d5cd38e940cf0ead52659c3637dfa3567745fb46a11cc9de31a",
199
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Exception\/ServerException.php": "9cab599fd913d8f0bb1b8f448932ae0b5c5b1cd7d83fc4e1e4c13fec29b0a849a5385a6c40183b8dc58404ed020227b9ea4483ac89d135c6c82e4c7985604044",
200
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Exception\/TooManyRedirectsException.php": "99c4e6f908a5dc03939ca083232cf48cecd742616e00839ae25ca173ec458e6da10be2690b98588b76e0f3c24ee7f35c09ed5c848f9348c639c414aecedf6c2d",
201
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Exception\/TransferException.php": "665600a8617328454b70a43fbb72c81ea196584dc22e10324b3c861974aa55ff5867b30b86a65123f1bd4fece75049a9f6c4bfeef5410a9f29913d350358178b",
202
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Handler\/CurlFactory.php": "1dd7a848ab73a8db9354fa2f0461a995320ccb677b29464812a484730a85f405d8b6c9b39783881b299328cb8f99e67b9d959b00672bf60a4559b136fdae8119",
203
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Handler\/CurlFactoryInterface.php": "0d063ee120e0ff6042a58d29b109bf6573494d427e20184a4d448ef31fe0cb0cedd60bb47c7289d5f6e1027413a28f9f57921823605d4f11086da5c9be8c0902",
204
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Handler\/CurlHandler.php": "ae0388a0146bd0cfff1c597570f58acec92876d3d01298e1988dabc717ffd76895b45359cafd7bbc62ca1fb5e7e96fdab70697a2cb469c8c5d0298aef12e44e9",
205
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Handler\/CurlMultiHandler.php": "d03d4a374657d671554d06e5622eef0d1b06d0a39a9167ec6f894ee28af31defe1d4306f937376cf5997c1421643e08e757880e45a1c9c10959c967022160f96",
206
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Handler\/EasyHandle.php": "7438c054921687fcc4bea6ef6b49aae15651a95cced2cf73ffe46bb15abdf924afdd4784e8d2121ca851934fafce69d3661f1a792e6f2352cc5f5c1803ace3de",
207
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Handler\/MockHandler.php": "0d8e2e43e0b8079f20de6b86c241afdc83bb5bcdc5a91ac47084ffdf2a3904a79e5db6fbafa4715785ded8fb90dd8fc418aa05bc0fa8c52220555720f81e827e",
208
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Handler\/Proxy.php": "9caf11da430da351eff6e9be0a1e8e029bce41283a6d8215e2215d6abbd3f021018564d1e6717f65f280703d5e4dab78a2b522042d63c5a9cfd019b0bb0aa4f9",
209
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Handler\/StreamHandler.php": "e45738ddf123fa57df229fccc94622b9a2ad5dd9bf6f65d24756239b587937bac9b7a37220e65c55f2abbd7159bc16ac785893d4aac5c192e6422af4fc4f1222",
210
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/HandlerStack.php": "900b9df966c3c1f3aadc45bd42a81e8ab153c74d0eb90cb3c8b2f9d46115353f45e5bcaf0eaba1281ab98dffb3d136a0c0fa0058fe73d906eebb741b273c150a",
211
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/MessageFormatter.php": "99460bb55080cbc7e08eb6f1b3c8abc71c38cd5d6e04422bdf8144ca554e7d7de29fc5d5dbf7aab5f7440c4ec9d779d684f8194f90139a1ece1bb086f14e3cc5",
212
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/MessageFormatterInterface.php": "609462659ab00682e7fdd1bb56aed5ad3cf54a2ee3b641623175b9dca0136b4e1cbd3cb0541526ed86d05174a18a9333ba52a9e50f4c05ece55cdc636815e385",
213
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Middleware.php": "42fea3a5bff7eb363a7af1f85a21a9322aee8d7e343295209815739f8bbd5dc372f14e3e8c5454f7650a3b9d802ca25fa069d64fa16b0f5d4d48c3d626ba3527",
214
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Pool.php": "a6d17779976754d7c16127680ae32f8e45ed54c3ef4a2a6364a1e4100ce732b8494b2848977ba6b2bf6fd296d7a54b30a2f021cba5a88ddd0d1e0f3a3712b9cd",
215
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/PrepareBodyMiddleware.php": "268182133f0e484b56fa23193d20def23166eeabcc2fd9626b17cbc20188d76549adaa4c768df695b787d31b2eb26a5316f0a3531ad3ed022aaddf0574fc2ac8",
216
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/RedirectMiddleware.php": "38bbd75b92a6764b0502cea113e222d5cce7abe53c7ea0c01e441fbbb6b0514f2f54388ff14d459ed611925eaf9b48c0aee1b1fb41892d07d1b260734a1d2afb",
217
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/RequestOptions.php": "239e524c17dadb296efbd8b9ba82b94ddfcd90c83377fe4bf2890dae5dbc62f58032205274575f14bb2e745112ee59bb559936b992d9a227dec00f5b2e32c03d",
218
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/RetryMiddleware.php": "01236bb2265c0761148ccdda7d3668c10f9539119bcdcc36f10d077ca32013ca0169938d6f4bd0703018f38fac53b2bd34e873a07d8e5287c26fb64b7284dfe8",
219
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/TransferStats.php": "4fe882f7f801ba55a3934e00d81aef09edd092eadef498f3bb424f7f32dc8d568940806a9d8e80b1b6c768cffd41ecf0814a0bb366195b2400f08a8e310a8c19",
220
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/Utils.php": "c3e52199a0a1755f52b6902b78d008de10e33ff8b93242a709d7a12e8c05c1c2c09c2874439606f0f3ce6b353bbe3b8ac385a236307b428fbccc078e1959c7c1",
221
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/functions.php": "f45c62cbff0de0255f4f149ee3e93c52bdae44492d43c9314a48d8a793ef028f8a8f704a2b28c5b84491687c3b682e9f85c4ea61bf63de56c6cc6a4ba8081ae8",
222
+        "providers\/Plivo\/vendor\/guzzlehttp\/guzzle\/src\/functions_include.php": "058a92f735b5848dc18be383478bd1659a0b578beba1dce5a1ef3b7a0b6b5f643e2f222dd72ed09ec72e8a5c5c9fae9757979f7c4016c5654bcce9d7dfd42d37",
223
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/.php_cs.dist": "4d42019074dff2a1a5bebfa51568de254e5128b88ad309bbed5e8348ef213035cf3a4da66ae6753354a0dcf6ccc0001bfafa2453028bffb3548f2ede26c30177",
224
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/CHANGELOG.md": "0c021cdbfea029de4a20511445e64d0d6c35400025f1361cc913754adce9b2dc16efeac12cbdd489ffcbb76e95f91108dcc557fb9dfdacc99e5bb98f20b55b43",
225
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/LICENSE": "9699a00cb2c5ebf932515e1232b83f79c944f8100881df096de09e25222fa01173bf24d9e083db7d9605d1e4f5dfa14c726aed52c0fc2499643714a9e64c4cc5",
226
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/Makefile": "a350f48cbb68a05cd07f787522193851f9cdc6b2643e34eb502fe261387d97e5ceb8499a22b20ff2fec5d7352ff239a952fa3b129ba3407fae871683d65e9bbe",
227
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/README.md": "1ea705deca28d726cc65d0f55db886545b9f5309ccc085bb482f627a0ddb5f8609d6635f65686e3e26b9a23cb8bf03b3e8d02a26d25eaf8195dc6c2cc93be0bf",
228
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/composer.json": "74a66451bfa422f886266ff300b4ca5f7b0ed62199293635671718caced457f6eab5b8c9467f24e999762f56368fb35742dc0adaa35a233d32c72783112a6c50",
229
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/phpstan-baseline.neon": "916bcb7d298578dfc4770a3c49ee558eef9a20dbff8e3d097506379c8680917b08a8f96f2b59d96b1b56b1ccf4a5478c868a2da504a1935956db70f51528494f",
230
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/phpstan.neon.dist": "ddfcf700a47b916ed1072c979f13d6d51327c9bc389c49ad264ba23279b01151b90aaeef0a81a13eafd40115d407ceaf471c20a61b47f1b4796f8adf3c1ad218",
231
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/psalm.xml": "52c09c8b7daf6d90db16a5ce50b7a8ce15c1ffa02265fd1d4b117cf717331475245bfd4f2dc45d3990d67333988a11081e13ebf783bca8854a1df9c1b0cc9cfa",
232
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/AggregateException.php": "97b6e46aa16ad26a2b714129b83d933cba02ec7afcda514ef67c5027cf5b9b93a5d7cbc72560307adf294179a4d7b86a6da9caa835bcf5be17e398501bb88fba",
233
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/CancellationException.php": "b958ade84fa4e6c7a7efed66dfb6a7f83b9743a9ac6581276eb99bcab667ebcdfea92a9bb114d086c5831d26abf7f6ec3e03254067e2b29abaec995e28cbce8d",
234
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/Coroutine.php": "d1c789e47536cf8c9db52acf791bc6de0d61790856a78f0cf6a9c98a1628d2c42cdf9e5e94e05fea802a099bd3ae3c65b790f2fb5a342bd130654c4cfb4fcf07",
235
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/Create.php": "a3651bfb1f458675c58397460c8534c2819404fc89422467f119de4cd80147177e462a9965bde6a75e74e4354c3c6935cebe1891e6a53a1bb26383f22e9dbccc",
236
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/Each.php": "e57ea03f69e1680b56676ca1057e8defe7eaefeffb456b636f3cb32295eb6be36073c7a9a621f656c40d5661c0fbfaa3a632961d82ec7f116ab7fb5aa9db196a",
237
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/EachPromise.php": "c7d79757cca80b7352ffd12a6743a515255e4a89764f65067035b16fe39c09b6dabb833aec3fad3cb741aefd778f620202caf79e98b86095c6b252f4e555bbcd",
238
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/FulfilledPromise.php": "952eac7f7cc150394dedb72ac97e624db8156ecd41c8afc382ed0cf8e4c2c6c94879b7ddf6ff76608c6a95ef30ee136f44fa03ab9f5ce4b7fa01bcd0c7e7574f",
239
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/Is.php": "894b3c475b5a828e442745507fae4b35bf394fc9fc93905258f9736a67112c321b1f3e353f8f3fb84e8778bff67bd9d27a6fd5ab6dab3218a30d82b8fd14ae0a",
240
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/Promise.php": "bbfba94124c36b87941e1548162708a5543f156d64a8f465f78397a02bdc34c764b60f73d5e77a3a2e48727f4cbd91f60b9c1cd47c0fe205994c4ffdadb99c5c",
241
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/PromiseInterface.php": "8d8d1d9e04d75ceb6d3e656794fa93170a3b1f9c2dd3b53ba6b4dd3e599f880599cab0b1ec15eaedc1b26d09d6c535dc9fe92802ea8ab1ed5927ee8cda7cb9b3",
242
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/PromisorInterface.php": "1058176a68078d02c288528673176648e38d2b8093e67b0984d73ebc710c0bda7019689303b1f064726cbbfc9382e733443e9d5443a77715ba40bb798ac79e04",
243
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/RejectedPromise.php": "53914a46ca238b8d079333f9c71180aed015a77bf765cd2793790dde21fa7fcf67dcedc5c797a1d7caa06d788bd9631628712861b1185f3cef9aa63260aff0cd",
244
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/RejectionException.php": "6dae5e0b0b47538e5c94a3d4890623e3ec41be8198a1d00ca84d77f32b9d074cae13e25ea90e2af614e802aa28271def466e5ab623c187df49425cdfc5bc05f3",
245
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/TaskQueue.php": "431a73762758dd08406a41587115a11e61f921cc01997ea71efd803b2e3882b9cb7f6d89694e06ecd2992f2bffa38ba55d631dba7fabfce3b84d68dd4913a02f",
246
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/TaskQueueInterface.php": "f0b2b36ffb75337c590f82d3d7d19a4caa4eecd6003c0bec7ef935604dfe35f4e960f49da7115b3b3cf65c61d04bdf258310ae1b4f4b6cff4eb09f52626adc11",
247
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/Utils.php": "9bb1eebf4d0f43bc47cda6f70f08b3fde962355075bb87d40ec75d41b552c262a79023a72e2e8d776b6d0db1ef1d412e398ae16d96476aa5c72afbdab9d5a9fc",
248
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/functions.php": "b756c2bce2557e9c6b8db2ebfb026354418c93f54169d1e9249478532bb02e1062c30e14060a3bae195098c74deb4f7580943aca944a162615c44139acfa7861",
249
+        "providers\/Plivo\/vendor\/guzzlehttp\/promises\/src\/functions_include.php": "17063296fca8aa655e7d5267abcf04051cd58fab5a7ff02530e1becb5002306252d5ec55c82461cc51f62c881c51dd80da53ed9d90640b6d0dd56d5e8f819022",
250
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/CHANGELOG.md": "0540da857957565d77741b846932c739e0883751660d561b2a0990a7cec8188573c2d31400cf9f125d1b6eab482455d19f30a8363354341e3c54088a0c418e7a",
251
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/LICENSE": "5d25479f1c9c0b802e2944e029d7011f9b9d3f7b37f7c12eb77321ba448414f79b0b254c0846d2e5e1b8826bed85d7c377803a4ad5d5afb288f220c761822043",
252
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/README.md": "b9759cedfe2199b2477e95fc0770f35ed6a4a18c6e6b4b4e30a20f75945505dcc76834e20e61e3aed90fd790c677536bb43f593de8a68558a200000eca8d0bdc",
253
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/composer.json": "27ad0b2937068e201fd0312a7dcfba706a8a318ca4e09d80f29611803bfb28d48433ba5f2b452da8bd76fdfe2b9f073f81f2e2cd6fc3e4223b20637408f6c836",
254
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/AppendStream.php": "d94d352d6f640589e84fe2aae0bd20880c4d6e897a29a47d4dffe6aed4d852fd5df274db2e68124c7f15b84d6f4fc684873fd03d003db39caa61b024b053e396",
255
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/BufferStream.php": "eee7de67e107fb33e8f97949743726a30e8201fd874490fc93870a410b1e0e3a059b75dda972b3a844b8c739b9b768a73d65c61bf8030589d0d787aa26f70e8e",
256
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/CachingStream.php": "e9b1e3d5e2bfae610677b9d216643be7b2e8b97cf661bc5c67631f994df0dc88a9a9ac7bb9dd68fcfd2ed343cadbbae227a8a46baa3b732733497e24f1338be7",
257
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/DroppingStream.php": "63db37354a2eba98b768f0929ee9a4ffbce1647a79cc9aee5e994cb693e53cfdb9f7a0fc4c32b68b46c64b39438b1c53a30532f5f8fb442f07062a6b4861e39e",
258
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/FnStream.php": "bd25e2ca8ea196a5e876c5b9d01c6f2a27b206f7ba05d047cb46476c52191a594f1280c7435b6429e4ea411fe5fc01a2388e213df26d27c5ae5094a0d0f2d619",
259
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/Header.php": "27014466522ffca93b4a3da6e96a5e8501f11691f7642a2e5091f3d0c1b146789ea41fd7fa1e3948f264926e7b764b557b1b564a95a7b5cd56c17c8ddfb6b7d1",
260
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/InflateStream.php": "e19b69eb2f1d2f8782f7285414095ea810f746d02a447badef5ec7185623235f17f5689682b185ba124e71a19b0dcf3d36b64894d183e25edf27f1d1e34c1c0f",
261
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/LazyOpenStream.php": "8c262a2c574767d61a9eb084d6848bef77d047601ec5688a90fbc012d5349d9b4ea188444fe509c8ffbcbf6ecdfd839a461505ed3746b6e1c5283860f7fd4a2d",
262
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/LimitStream.php": "81a43b1ec261207c1a52faac2c5099a429e43083bbe0c9099f447859d2ea12a45d30e7f0b5a994696084b3c59401bc28564685c432644caf6a9d8b9669404c91",
263
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/Message.php": "4e9b857c226b57e2d2faea27643d6f213bba65bf158889a528fd684cf1acce6f480805d04da39a32fbd25be9fc51c4f1a3c1bbc9e92f3707fcf33a120b2aa256",
264
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/MessageTrait.php": "367bacfe383be2caeb0064fe80e5f6b138050dd4189bb65ff82d8f86d0b1b604090b61a2473d7e80c733c395cb893fa9eb2dad0a63a353c19da32e940a1de01a",
265
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/MimeType.php": "98467f19beca7d4239963d4d91a7896d44539c13a5c694c4aa8ec68f3b57031367d1cddff19fb51c389393cd1402a574c9afdc448766c8807228d726796d2e9c",
266
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/MultipartStream.php": "5bbb8f71ad1f2f421eac8c0d40c3a18372516e8ab8f2bb3f917871bec9aef0eafbef930902084aa3ca64a8ae930edb1f2befe1e6b49dec387ea239c5c475c099",
267
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/NoSeekStream.php": "f003ec01ce15f5dd56200396a84a2c94a1b134d320230983ef91efb1abc770827018894a1b8d1f3a68c2aa481e8f0bfbaec4c568d0b0fe251a61f76ee22efa38",
268
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/PumpStream.php": "15192b83cabf910107b30bde59197618e524aece85f9d396dcd8459174fe50a1cb82de51e5225b8e6ea64fbeec7b4d94f035bba2ed893efebb660105021fc98d",
269
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/Query.php": "8ace1f141c08396103431803ed35e1bf247fdf7f7c7b727ca63e58a1cfdd7e353a6c266c8a7bdbb863e5d290414ea630bbe37f55f275cc5a5b946b794ce01740",
270
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/Request.php": "e0582b7b304fddcd81a214bd8ecd4db301479eddec3084b18b822f5e22fbc9d1fe3f3d2f6ba52959619dfbd0e98db304b2400e67675fca41f470ca6126085da2",
271
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/Response.php": "32524250d58fba5c152472ed37160a9aba92c586c9b2a6bc55f97134e490636189bc8708fd8ca4145478a5bb20ea51b5bc417fa8d61ab08fab3479a04c4506e2",
272
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/Rfc7230.php": "beb2f85fd643c3cdb3c92b401c4df1385bc6fcddf7dfbfbed88396611438720a1b86ecb9b913472ca8edf1bd9782a3692b2138195fb366ac1b8a7f1b0b81d390",
273
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/ServerRequest.php": "f3fead87c83ce2f73b2890ec79cc620f319c59ebc41a041e4b70b38bb1e412c928fd7ff0f10d96fffed841cdc1ef2874d5ddb0e7cfbbad3ffa81ce7484365c05",
274
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/Stream.php": "7d108ed410ba89cad35637f837d97f7ef53c43a4666d0502e3e7dc4aad06e7bc365f311961d2bb8768faf9d9c6d64d09e080aa9bc65638084a127e7a563acbbb",
275
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/StreamDecoratorTrait.php": "e1b90e1d97a4a1ed1eb1552bcaa9011f79733167b7e5e3f2af8cfdc54adf0d64a414ed630ec74418020fd8ecc7c75e43db6bbe0fdb9ec6d3ea928bd3bb3f4561",
276
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/StreamWrapper.php": "7ed1833a91a1f56b743172192b7ce4399928b261eddba6bdcdde958bbeedeadcaadff4fe5b3913dad0e4b2cd9346f47b43849cc65bbdb839c9d9e4b586638eef",
277
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/UploadedFile.php": "a66f1119bd7327a19315456f17ac2d3ecb40e564705d41047a91a02b431efcde1eab2750b2f354fd2f5c10c1ec1b5968e84e758d51210f011dafa8df5fb35c0c",
278
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/Uri.php": "fc5c81c97687dcd34ebd18c6714479eb6b4d1c7d58963bf7f1f732eae98a04b094dd9c99d58f4bff265b2faf0629a456c391ab5b96534c927420f51a95dda637",
279
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/UriNormalizer.php": "8992ef486358f43df4a9567a6a232ad76883d9c7cacdc94707343e5465c857a4385739f66d0024136df94c59e60a5ccbf1850634a55f2cc1f56adddc717434e0",
280
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/UriResolver.php": "46e4c0ed24579ad9a0cf467141fda7dce6dd3a3d3281a1606261f322462d1b19bca413f3c5590b7ad42fda1fc57e60ba86d121b5af0c5b5a2ea21bbdf07f44fa",
281
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/Utils.php": "be75312627f929b2ac94cd6d12972816a13660a40d25cf87f6fc7fb7af416316ba8988656147a16becfa8120ce2a484c84d9f399b43dea2cd3c7ed916f7d8302",
282
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/functions.php": "f31604b89969730b482cd03a13b1356ff9b91324eeaa9ec45a45f86be2bd52a8209cec55aa878d5875a3c82fadd86848d558789d0072e853505d644f0a2603ab",
283
+        "providers\/Plivo\/vendor\/guzzlehttp\/psr7\/src\/functions_include.php": "5b85d1438039f778c454f67bfd3ff2933d06b1aa4bbf9dc516e385bd36cd749f7001de6278c5a1b4e3c5a7d280876d4d35337f87a0dcc6e521ccc20a3ddad1bb",
284
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/AUTHORS.md": "bd202fc574c862a7c3d4a27653605b6fa377823744a793a7848ddaa7001166fd645d6047892d79c8488786d82fee785b87b19e9af1d04512503eb195bd300aad",
285
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/CHANGELOG.md": "ef87f930b797ba0b32dec670491e021b5c881f6986624c1906d8f910e8393b37e6d7f5eb9f860c1bb8447ce61a206bca80db4b2279c57bb064a28be3d83690fd",
286
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/Jenkinsfile": "98d95e7185d040e9aea6e75118ec17ac34e38e17f8ad5a38d869ea02c0c9de5dd79d208a78da23ccb87444df7b7de827b314469027ee7573cc51423521786320",
287
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/LICENSE.txt": "0974968907abaaf61b640ece98a502e3c677b7cf734ccc82cb522b3e166c50eaccb189b4d31b03bdfe8e61a97b3ce06917a7ff5c7c60887e2ae944f909fb6e72",
288
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/README.md": "ddaea1367057ed09023311b6ce37938985c188fbbcb6867c6c3ddfbdb984b954e42fd6450d1e5cfe10374ddc4448f9b96d6130d465983d634ddb3c0b01a276a4",
289
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/ci\/config.yml": "d50e43de2ba68261ae35625f8ce984903baffc3c6535d31a7fb3c5efddd08f71cf0ec3aaf22ee9e17e93852dd99284b653b343a053ba50a45cf6716033131e3f",
290
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/composer.json": "c6b4f35c928d33d62b48139a8be5d85868fdcd0716380865f8dbe0f5a708600ad7dffb3ba510a45bf4a8002f7e1fbefb1c835de7e3e2d9b7c1cbddf9fa2b565d",
291
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Examples\/JWT.php": "ee8052cfd45be4eac77df60902c518a14bf2df07ae7218322493a8e2d115280b87c65f9637ca766a63d82dce36c7c78e894984dc83031a9b7a8d5a6345d38214",
292
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Examples\/Phlo.php": "f9d6482c51987aaa3d7f0db59cd45030e17284262681866999309205161094d96a55a39dd2898d0b7980074d764e1bde6cb6ad1f50be8a40cc9d557431c1bf91",
293
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Examples\/SSML.php": "932a827eedcd81956c275529815a2f7542636b0cb887fcf182648e8f972006f6ba8ea4a763b3de48aac989f26a5e44752c7d3a62df256ee2b6a1c922de677e14",
294
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Authentication\/BasicAuth.php": "42c036c38225556834ad5cb916db0c4783c7127909053ef623e7f71aa51c9fc968b9523fe5dcdaebee769cecdb0c4c76215116cbf5959b268c8792fa96754531",
295
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/BaseClient.php": "029f2be5a3c7734b5030b4fa96e0d7c0c1252bb7b30b9f001a78abaa646d6d3821a127859e5d170ea5e3c7f5c86d06112f28152c5cb2315f94dbccd318f9e5e0",
296
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Exceptions\/PlivoAuthenticationException.php": "7ee7458999adea1ab1722358f669467cb35265eb616ef2eb16e6bc3d42a7f3c2fcb0b42655df8f4f21127bfecded765bcb479a6923dbf1a184e00f6e26321ab4",
297
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Exceptions\/PlivoNotFoundException.php": "bf54dd70534e988c27d5e7d17bf8edf9dc65191b77677d9ffbf95ae3bd019f1ba368065e82440e04f9a0d7045cd62b5915943273b5d8d72ba01676ebf2975edb",
298
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Exceptions\/PlivoRequestException.php": "6655a36e42e700283235b84889088e378bab6861ae98ea99c20bde017ed39b83dc743e5c166e8129b9910a434b119578b23523fdfd5e9e1dcf3d57c5cf9375ef",
299
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Exceptions\/PlivoResponseException.php": "4f18628f90b1c5142446f0e394d5071a91995baec240344a1afa47687ae463cdc3dd18a79008813077a3511c1b00dff7a8715d26990afcb6f9726598c96822f3",
300
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Exceptions\/PlivoRestException.php": "758babb40ea45fb50dafe5231605196214736f014860618af9ca7161157255cdf20c5b0bf534f6f6b30a4f9bf612b5ff5edd2f7adc45553ef12555354f82c15a",
301
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Exceptions\/PlivoServerException.php": "b2b8f6d1d03a720885ce5718b1c80bc75c7f483f72a1d2d2313b98a37e152ca78bb688f7923f025563517a52de7e915325cf86e463a2083c30ca2473446b91c6",
302
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Exceptions\/PlivoValidationException.php": "5faec3f351037d6affa710c10f733c57a7919cb04820f93ef0c19f75b2f2b2b8ae1a0d004c216673977539b713ca31475f233fdd21698a390319364d2b9a4ba3",
303
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Exceptions\/PlivoXMLException.php": "a66429863ac7caad7e0d77f7a1fc105fea0a45e7eecb753e64bfd5a76c89b5eb06e4228bd63a78134090774458a646e10a11417855d3e72b2a6fd75aa754c625",
304
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Http\/PlivoRequest.php": "3fa26ce55e1b201dbe78e4bf3615f8c38d9e6c4e96e5b3673f6cf7985bc4055b88f227677273189381bd29076ae5e8baba6c0cef4bd612f2ff8fbd2847b6c129",
305
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Http\/PlivoResponse.php": "3f9f1ce15ef75db2e028f198d1bb337c37f31fa6dc7e5b985ad589f6a4dd7d873e3dae968b80f5e1eb6056b4bd00e1a4df4d54242206861302f9d6263d177bbe",
306
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/HttpClients\/HttpClientsFactory.php": "a9fbd6c007260fc2169648c9c764ff7b5988af0874b21211f8e85e8a995897d597cbc0c9fce4ec5c8d60a901ea05c5a8cd70684c2302ea17bff528ac674ea578",
307
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/HttpClients\/PlivoGuzzleHttpClient.php": "dc661dc489b30bfa98e0d75f04147d164ad953e7dc51326a20fa94846fe30afff07ce92958c27a9bce9fd15371543852c0be4c24031cf382b54403a0901189ce",
308
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/HttpClients\/PlivoHttpClientInterface.php": "61a18efcb4383bea7598ad9167ffe49a73e295d2ed3229c015f9a5ea08b00362005df1388cf6846f1c331b123b187290a1651341c76ce2cd4233926c927b6e9c",
309
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/MessageClient.php": "f96e09d05b71a2e0b6675300132634f5664026bbb84472a1e7ca5f72b679390170ed5aa0d4e21a4dd1bc646cf0267f0f9240c931657f7cca9b2bdea501586d26",
310
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Account\/Account.php": "22bf526a376e6045fe9045ef4eaef52c769ceb8a7c3ef11902e66acdbb673fa521f70f446e6724155c8499cc700a6cf4f4d435ed06d81baab69f638cb15651ef",
311
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Account\/AccountInterface.php": "5093f51c3803de918f3a500f1754f47a3dbf990008804c07e543da253a22641b96ca2ae5faa7e6800cfa10a41f7d407e5d29e9907c0970a9183a8795be9f7543",
312
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Account\/Address\/Address.php": "7ba3e1e7e136d43989fa0449b29882d78fcea39cb764e54228c7a4a899d5ce4db2deae9d9ff9ed5cc53a8af72f98c55914c10be3dbb7b9a354b8a06e17cce829",
313
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Account\/Address\/AddressInterface.php": "36182073184f67cb024e0c020307d4d74c8b5c65e3ac7affcb76e189c91af9750c318404d8ba3a5a6e104d64459c59c80d7a944395796f0f5aaad18d43d93720",
314
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Application\/Application.php": "9431715557954e8ac1cc340f3f568a6eddd6e00a0ff0356154b2778b118f620d0afad3979e79eef0a583b313256fdd018516cc8128a441dc667b39668b6f506b",
315
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Application\/ApplicationCreateResponse.php": "cb1167e6057eb71e102d55ad2ac3cc2c7aa2a757b317cc97d8d08dc400548d4ac56379653583d53185ee8ab37c4dd189b66af011bc9a32baae55991922c41466",
316
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Application\/ApplicationInterface.php": "77af1063e341dacee15504837264b8140ffa3e8f537b9eb0b102e8f6d184deefab6a08ff7f771965c31d6c84333de9963b2e998bd0389bd0517479d5ee150d3f",
317
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Application\/ApplicationList.php": "0840ebcf3a0d9688cc68a82f11484339d8dadc9d1a50787ee11b3849a361a421f30417ad4322633c53633b4cf58ff7980de6ef87471fc88b16d090f127763450",
318
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Call\/Call.php": "8e0a3bd97abbb7b9d03e22a4eca6eac4989653c43facff064a374f6787698bcc91320352d105f66aa3f31cc0d70902c8cef0f9264062ec4bf4e5cba6d07549ec",
319
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Call\/CallCreateResponse.php": "a3a07958282fc5a6e7b99978427e2361e8828a63c06a940159a7fbb356ab9621a899e6e2a25c27d445fb92ac34b63d8e5a8b6f0782b7f20c7d9f4308306903ee",
320
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Call\/CallInterface.php": "9aa42eadb3b1c06c802d46f1a11b17acf59e0c78ae65b6c9039b4afd9fe53f171cd8023be738a359128afef545a6fddd43bc039d94b014d122e9714f9591ab71",
321
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Call\/CallList.php": "9883c38a74497c496cbf7c4a837051cb6bfa0ed0b9ca9298f8908e7195a000196f7c79b4846417c64af0aeddb6327e45ad4b36352a28e8300c977e21db0fbd0e",
322
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Call\/CallLive.php": "14fc226091078fd069998fe41625d086407e0c22455dde078284f9a3e8fb34fbcac0b75484c5350b437387dc203db7690d9fe1f02aeb09da2d5c57f7b2ffa651",
323
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Call\/CallQueued.php": "64552d83e5911b11202ae4a965bcd7c408643c446566c3d09aebb0bd02fac0dca41477988aae62e91bfb42913900f1eeae9d20693c6bc29651e2734b06cf18da",
324
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Call\/CallRecording.php": "d23438ea994b0ab936c3917d77ae9bb38bc9ca14dff4c5c120a0f583db46891af3bde1a8c3f55d15bacae99723e510184c14c60eb6d3d411d46aa90c5c8acfa8",
325
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/CallFeedback\/CallFeedbackCreateResponse.php": "cff0c47988bfee02787a2d73df6b3165749844c1a93b1fb91e87e80582bd28c8c7efe101fcd532bdab62886eadc6354924eea81278da5037ad9d3ee5d8dc8f29",
326
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/CallFeedback\/CallFeedbackInterface.php": "7860708568f488bd0832e626123f4bb5ab986fa5d54f305d4744503ceb4e919857b78a02b766e7241d324a77d86592f60f26d1ed78955f5550bd0fcc7bbabcab",
327
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Conference\/Conference.php": "8b97d6c9abee836cce410fa1216fdb5aa8a4df0c8543a75c2415bb31a5ee2d87531d5d162b218660a33cdc30539861cb09d85a780feab2d5321d0e8ce06194cc",
328
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Conference\/ConferenceInterface.php": "34f563cac4a75ca234e4517cb4678998461011440f30f9d81895adfdbb2e1960009114773ac30901dfbd2596d327554fd335057de66516b656f7a96446f4b06b",
329
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Conference\/ConferenceMember.php": "1a880200a2988394ed0436702f805ce60762be1774e1d156f38e45be39cc72203fd4f04411a521ceba8fa9647cb00f6d1bc6d94798b66f12175fc68d88c51dcb",
330
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Conference\/ConferenceRecording.php": "1c3239209726556971c2cccc812ce5bb5a3fc8c7a0e4f3ef520e037acde32d9659dea1dc5d3803e1f7cfd39e945a1680983bdeba8cf62459fc168f0df731adab",
331
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Endpoint\/Endpoint.php": "4c9a87fd6042a3eb486af5dc899d1e4c0948de5ebb1467cc85704030947e2588e79d23407ff662a21b097fb46a05925c3df29dd6e2a038555cf44844342cb206",
332
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Endpoint\/EndpointCreateReponse.php": "f77356f3ca29ef7163e47530004a5d79c1da73e922b17333a89512e39c7d3cc842b161d9dcbc745075f6a6c7ae27b7f7cf85f56a6d5bb796b87db4efbb8425ae",
333
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Endpoint\/EndpointInterface.php": "09914bc8e8eeca2812a4dc07469137011eec1dd77b99e3aefc8d5b8f4675b8f221bc54e37417f6c45b07896b84bed953f8c85831f9e7cc7b85b7293142b60fff",
334
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Lookup\/LookupInterface.php": "040b0a2c01ca3c0c02c2c8450b47e8d1847ab7158014ae161ce971e330712d14d389cd746a353707d2bd2667dc604e55c662af8eb15796cfc613f285e170ed15",
335
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Media\/Media.php": "72b83f02669ec7b942dd898a74c22e909cd9b058ea2e903e92ef4dd9e985305311d53c30a0c54a3f0c210433aeb7b8bd04a4b3a768c853aa73ee4dad9c621a56",
336
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Media\/MediaInterface.php": "1cda06754bd1ba503a8405561594f9d3cd5befee2cc6d9cee98542886c71601bd8744899e7ede346df6b90552f05a9eadeec4cb4d11fdab3269de88170cae961",
337
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Message\/Message.php": "54ae356246cc911258552001390f10f701929afa24801b2bc6cde72484c915e2e738a03d04aee90908003efb3b4b3cc8106f92d7ff87d2119e8a350f7aeab54e",
338
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Message\/MessageCreateResponse.php": "75495f459ecf577e2e0c2f8c075d569f36df80c5c828fd1d6b84a001de2c3d032add50b5ef08177d5c68014fccbc939c8ff89ce6c884ac0c1b64f4301d81cc5e",
339
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Message\/MessageInterface.php": "e96af121fd4a851e4c1f27297c602a5e6862e0ac54974aedb19248f017f2d98386ea9b495ef6cb775aacafa7b51b6117665c803356442786142c15e86066ef41",
340
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Message\/MessageList.php": "baacdb72ec116be9a14b8e7e55d6c40cfd8b04c5bd1b0d93d5c9919ccba2591105e03dee96effee29e95ab7b7e58e45569760ae825351c1891877dd96853254e",
341
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Number\/Number.php": "1bf8e1b1844ccced8d8068a80ae45b6904f59b0fa0e7d6a7c5b43adda906859ec11d709a501f560aac3f8315176e9260ba4796aa9cbbd637431ec94f0ec0c668",
342
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Number\/NumberInterface.php": "e633bf2e705735759f6e27f9e747e3e05e839484b57672e2da405b7e2d8615653fa828f8295a442d13f5b64645fd009ba6cd923f0c163f2070710c7df57a1a70",
343
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/PHLO\/ConferenceBridge\/ConferenceBridge.php": "3da97309ccefdb15596bab5180d386e2a78cf938823225820f5b206d8d8f366209dcf96bd139cd0364729c8b733612ae067d03e1e29aef472c4dc82527d3002f",
344
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/PHLO\/ConferenceBridge\/ConferenceBridgeMember.php": "9ee728dc1f37fc183fd4890ca5d213bb1f47899d2379a16009de7ae32b75b459444a1a329357faff349909ee89843ac5798c75699fb2b8d939501f61dc09b564",
345
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/PHLO\/MultiiPartyCall\/MultiPartyCall.php": "d13d863ee416714a697600882f33b88a8bc9de8d5603149fa199f787d7d904d55aaa6646cfdb3d71caa99e4e95d7e352199e8b54230d3c64cfb81924f1b603f9",
346
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/PHLO\/MultiiPartyCall\/MultiPartyCallMember.php": "6e8f1c6a1177d0c933352bc2d8bd54c989db7679f2feb893f430e9e634c446d033d01a82ea740185b1926734f285facdb3d99b18ffcefe83be723fc08b50fc12",
347
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/PHLO\/Node\/NodeClass.php": "b8a08dfe16a42c08ea66d141b3b4471caffd2bbf89fa4b360a1b16a7072ea29d538792c16b93f1e3f1a1a01d564acf1a40906c32482c4cef0ef42f1647e483d8",
348
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/PHLO\/Node\/NodeMember.php": "e13f76753f278f07e8778f1d0ad64c9ff401633423ab2476700ad0711ea5534f7caa871b5e10fbb26096feca64471205082f9ba45de607e7ce71eccda0e7db91",
349
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/PHLO\/Phlo.php": "da8e7b69e9290d876b6ebe6778c09ab68f47f13cb22438ac92d6eb880b7fe72ffcc68c681cbb9be074e36f3ce4afefc69680e7a3493d3046a04ca9ec432d7a99",
350
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/PHLO\/PhloRestClient.php": "5f3b9bb5e3f7dd96572f1dc71531caeb0b14b21ba7c291561c1ebb040c3ded22bfc0dbd9030843cfeda8b4f83e69d86ed9db2b3b7d0cc8b311ec64000f3b935c",
351
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/PHLO\/Phlorunner.php": "c1f3764aa4a4c14a33614bc7cdaa05043d268b24f88cb2312bec3596e5e7e5286e9d0429edb8583b640723784b28ebf69df691d5e4ec53b7d7912252832c3ed9",
352
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/PhoneNumber\/PhoneNumber.php": "57bb602a9f511dd39c7143c50a9ca6537bd83f398eeb6f198feec689877a9a423d9cfb0645c4d20eaf30490ae6b6ebb91fbf1d00ce633a2007333ddd6273b032",
353
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/PhoneNumber\/PhoneNumberBuyResponse.php": "6929f9a7447425d76afae60b91de8d6a5a42a1e7864871dc73a40199181d5af8be9f645185ce1e796e75440d138cd0f69ef86ef404879d74b58107ce32824b6b",
354
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/PhoneNumber\/PhoneNumberInterface.php": "3720a8056618a019c64de2e4e05e99e0b30cf48de07117e75172b8ba02f2b2c60a1e0b12c3cc07b3f5ba8aeee2e747c3eed43b5bf589c29c7236b47b5ce75747",
355
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Powerpack\/Numberpool.php": "a774de315b1d34a61c9b9af9b21b8fd1f624b48bcdbc7ed1302ed25cc21093e05ce1533c0ce4788ad36ab28792878321a99b941cf9e1a8ec7fa2f2ab1d16f872",
356
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Powerpack\/Numbers.php": "f62f6534b223fa353f2363e38fb1069c3d10544a4cae2efeaff30019c0cfec7de2b4b9f551cfc16bf26fa1dfb916f6d916f9cd1d1357f8cf6f7cc84815812237",
357
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Powerpack\/Powerpack.php": "895da995fc1445bb6f7458c3904c918d8ba8e8db75e94e558f04ab8355058bf82d881d7c282fd8e03acf723c232f3081733a9ace2bef1da42c3e9f4de452d2cb",
358
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Powerpack\/PowerpackInterface.php": "e09a8e4e67ece27935a81730b7587bf29afe72ff9aac57b6c0efa6fdbc4b7cf4c91d60bdcc506a2c0b86f7a4cf7df70c38135e295504417d39024a4671b3cd33",
359
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Powerpack\/Shortcode.php": "afd1a0a277918a55fabfc2b46460ab6a8740ac68e1d7b9a0180d88229d7a93269305765fdc362c02cc2996ff7c3d8c95417bc90bb74e44f9c2cf12f023f45b08",
360
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Powerpack\/Tollfree.php": "0c63aaf33046375a8d7c0f9c7c092ca1041f553b1987ad5e2944630dd23f865785e06205b0711c215468630455d8c2264c0b141fee5cbdb4bf9430e6ef90527d",
361
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Pricing\/Inbound.php": "285fd073a2fbf84c533af3c0e60b369689592882364413a1879691a025655bf4bdc40831d13d96c59ec7a8827233e92d478c14d1d648df885c75fbe3d054351b",
362
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Pricing\/Local.php": "5140df58e671179a4edbfa82fcb7b7277e440706406200255ade35177e9a715c3340f5920c4a57c351b6e222f7bb1ef20b207d0830c487bd14b9fa713d3d8c4f",
363
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Pricing\/Message.php": "ae4e8bbe3a668748ba57bfa571cabcd97932d6cb7a8a63ea04689863ccf75a63e0aa867fad60c39e263cc685521a8465b46f730014933dcdc941ebf152fc437b",
364
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Pricing\/Outbound.php": "7656989e6b1da4e4887f8443304e422ad2aa01c9c05aea5b5245b4f3edc333935be4f573fc5105e13cf03ba6ed0ee0ea323cc76c833846bc5cfa01f3a0f33763",
365
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Pricing\/OutboundNetwork.php": "900ae54c0c0aa0f85af4f02da252a34907999bcd311e9e39ef8d8e27a16fc6c8bbde5d5f6460af6b8e68cf584419ccd7fbc4de177cb827cabb5ae9b2c896494e",
366
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Pricing\/PhoneNumbers.php": "cb51001dfd504ac52dfd39e2a0fcd01686de42e78464c76767f99fbc7884cc2d6e304cedd72e66dde42852f72cd833dc49dc1e92fe1487b2682648432e7979fa",
367
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Pricing\/Pricing.php": "5d197bd5eef109ba3d877f6de48f8567f135466adf1d811d32908d8d4fa7c8961592733d6bdbaa4f646c3d25a31c8098768dff183d192617b2c1726e8f41c447",
368
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Pricing\/PricingInterface.php": "dc940fc2f0338348b06fefb22caa65b98fbfd37063621fb4e4f1e23c5dfe21149e2e648c1a32b09012b34c5bd622fe28126bd33ba1255c6ae3c370dabce6ee97",
369
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Pricing\/Tollfree.php": "ad733c0d904ecfd646e79a3b6bb3ade270f99df5e6353bd6c8695322a71238fae107a55d33167063dc2e4b1b905273bb0631f051d06cbfcf5d01c94e9252fbdb",
370
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Pricing\/Voice.php": "ab645548152bfd840951e981c0d18aad23d613afefd4453af077a6055f902d6bea6a0bcc805288f130da6686d8419913e86422cae35b57c1087eea3371b7e799",
371
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Recording\/Recording.php": "def8da050e24afea59514b4fda360ecd1d80a49df2013b258e3d78304d6eb2ccbe21ff1ac50a851079234a1460d0f2750da8fb59c9ff184e8ba1f1becdfffe6c",
372
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Recording\/RecordingInterface.php": "1953832ff8be0a6801f306632f3ca3bc46f067d08662b8ca6d53e29d53507a48750bdd891d2d0164c029f675b8c4c1dfa6765c9abf328578838b428dcea22615",
373
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/Resource.php": "b8a8f583217c43c3eceedcb8f047efa1569bfe5f440fcf4f252f1a8402f484e18abff63229521f89697c1f7df21a2ff919488fcd9df42b5aaf7a160a50f0c62a",
374
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/ResourceInterface.php": "85bde5b0479b85aefa79139d36192ac334e3deb3a07353b7b1b0cea1180a050a92dcb563ef4a968b6436f60ac990fc5c1322ba3ee6f4ffd41d2997d604653b6b",
375
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/ResourceList.php": "71fc010407c57d77f5b31105f6e645d04347d961c3c81eef6cacc7b8dd475d86bd228c5ea5dd5976ce34d025b0753083b5361a47cde5d5daf0507678762106fe",
376
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/ResponseDelete.php": "3acf13bc2797c0ed58c78abac46ae2822a67b9c9194b3c9864738516847618c0033fe12c5a62d9dcb7d110ffd4264c534fded370d04a2960a2da32059fecaa8e",
377
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/ResponseUpdate.php": "4db3ee43405d0a456dbc23801c2c0d71676c3f88ac7c4161395ad275e7fd0dc6b53aee99a882706da4f14fc6c35844d54143a7fa3b6597a5a25d59ed67e0e6bc",
378
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/SubAccount\/SubAccount.php": "b39e628ab06827320f3dcb47d3ea55d459af1a133430e8e51e8e6aed5216c31b54498c836cfd2a5c5f2d9cda4bcac03ac476bd8ae81c3ee2c7865ddfcd359dfb",
379
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/SubAccount\/SubAccountCreateResponse.php": "3b92a7ef8da848a7a5d7b79436ae557657e97141ecb2bad076e69d495d78f94f6e9c68464dd7e790d64dc563428e4567a1baf96df1f8bc97cfdcb946e60e94ce",
380
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/SubAccount\/SubAccountInterface.php": "a4cec509ce127faf30261cf75555a2905c6e551223b4b90949251f0822dc20d7b97efadbcb6bb189cc9302acffed8106ceab79628a7531c161f4f713d6a26c4e",
381
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Resources\/SubAccount\/SubAccountList.php": "228e0fc0fc27fb523c9d2d9e62de77a5deb3bb2a29c10d91d7c59b6cf36b3e12b8b1935a69fb0ceda72c4008b2a04436e6aa3f84740edf265d0f647eed7c52d4",
382
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/RestClient.php": "91f01799f98c6d65e1a0a8025668fb0c9f5fa4b77d44e86790b34599c2b9045cbce2cb3a5dcd93a1fa8523cb688d9f2b895d7d5f2377f64f2e33ce68e621dd82",
383
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Util\/ArrayOperations.php": "04a84eb09d1ba33c3414dfc74d1c4b31c3149dc8e3a038912be632673a92e693da8e531a987c5ce747aa11fe01bf65bc05ac91924ccbb8f157c15c62f8ce9694",
384
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Util\/jwt.php": "61ef00cfe10afee4047149729431595a9e21d44b25de3e8808014312a869110bc22898552fd9216cda6906c91de2b3ef9d723ff0d4e18020d1b7f5d1050fe810",
385
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Util\/signatureValidation.php": "2bf40afd282bd8711459cff1b366510ea253508349adca2f64ad101b6c4e3e20bf405194b9e421ea7cad5b738716624127969de5497e16e3647872e0b3bfc6a6",
386
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Util\/v3SignatureValidation.php": "d70083f5ecd20fc41035462a2a27e04a9367d9b7b13e6bad5579dde4556ff187b8ecdfa17b2c07a0fcf88cce0141baf7dccfaad85a17aa2fd1a7afe7998d1037",
387
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/Version.php": "365ed59af02f30183af840aafe55b67b682919cbb3d662f860baf1defaede8a67fccc5a7f087209494239466f356fc83f612faa02f9f03a301f5ffc66b52bd09",
388
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Break.php": "89a669d486a72465efc2c6128deb6760dd86c9fb69cd8c0f57c209d10eb74067efb50bc6f0e68e2d1c9c2f39862ef3fa03a35c65b7395aea6ca963a013869658",
389
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Conference.php": "bf673327e263996b05a0b45e323168e3d44b27a65efb8a8acb0eccb0276360c1a0391f08edc34ac617aa079c6c2b1f45eba6142446a7ae2286e23f337819caef",
390
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Cont.php": "45ed9435166f1b72dc5ee98afaf3547ae646d16d41677ce5409a6005ccb9ff23743e4c528385a1e0a8f5570eb7ec9374433f609bb8cdcbdfe756842f1005c52f",
391
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/DTMF.php": "14c619e3f01d6dee2dbbe9b718c6c64458a97bf70ae333455aa45c9cce91e4bab693f5265de0099c9cef2334a5310bb85e3374c5f0cde9b93c3051cdf5b57a4f",
392
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Dial.php": "5370d1f1a1ca8420560fa204d295558ba9aeb626fb7149ee06e12acf7f4b7d079307f329f91594e138847a2b3dd9e3f3e9a9e6e774a3c1095c3201ab249e9c03",
393
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Element.php": "4913c3c78365a85eb5c90aa721b0e1cf535c00d5815f509e336ce635cf47a9d9aed1346ff0cbc875eabae65190be2875d0820312a6a5c90c6df3acfa23bc80c0",
394
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Emphasis.php": "d6fda7993f909d3a1a50441ef74003811252d68a33ec2da63d3551236a005952d3b6c7e2bcdf5d9c85d33bee2a9255dbc2b95988cbe0e115b42eeb667d58ca38",
395
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/GetDigits.php": "e41a4e05fd55fec82a24cb2a545db122000251abc0986715a4d5866dc64604ac340c59cf0a30a35ffeeaf17713eed730a7705f32aa20aa3b14ffea368cdddfe2",
396
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/GetInput.php": "cb11a5e0311d3b8938f7d94462d24c5d4b8a2ea4d733943253ffcf36aaa648cd3a4337d732799f382526e0e2b2059dd1489e9ac7fc5ae478eb1db07b3830a711",
397
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Hangup.php": "6a7ac35846ffaf61d8de286929bdce05974799b26b17f4d61e68b6f740cff49bc4a0b72899d1150ae03d72e4f8c4dc7cac491872e76be0aec6b1a665446a9226",
398
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Lang.php": "c16c3db519373df61712fb1748f91785d79ba0fcd7e85a32cff1d17ae89768cbc10b3c4cbceab380fa9762cc1b6948d8fa56054d78185f8c9c1d6c60a012f527",
399
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Message.php": "541a76d5dc1e25633d7bf67c83d1fa123820296b4755e7e48aca094040ba0c2acc6215eb29176551516941b8e8225e6084fbf89892893557e12f678cbe2abb86",
400
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Number.php": "82569de717d895eca9c4270a3fc48022e666e59e6d6c74dffe4982a8db1f6031d80c51863226c750cef5db111f0de940878baaafb352153bd0d053f716c43fe2",
401
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/P.php": "d8bc0f70c13af91549bf4c37ce4c95b6683590ac9c9a3006bf2a4dc02d85ea63a33d0d8fce4a6465f25e0f86b35994d98e7bf75c07e30737305a7f2707ceb444",
402
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Phoneme.php": "9bce52123dcc7451f21ecb2e155884479b7530715d78d175cd616da86198151481632af22cfc19f9c70a4cf0f29f3262f335982fc9988e4aa3a435cd74f14c59",
403
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Play.php": "9b25a9f3a6149ad856c4aa008c405192bf2804432d83d3a572cf066dbb151b8298272b0a9185bb26a5faa51c03d069aed172ddb135d4dff3fb99af9fe982ded5",
404
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/PlivoXML.php": "03c37815022f4b4e7ea917f69b5516c3bb5499e68b65ed1b50f7427d9827de1e84037745d25b420c1f81ab829f51ae752b126943005c82b06a668c8ff895e923",
405
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/PreAnswer.php": "f66f22bedaae6dce341d650d5ded5007d867361c570162a642e0a15f5fd6e90b49a4c8fac2d3a1cb5fea446c75e30834a1106a3acd1ac02a87b5a7df7c1d5af2",
406
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Prosody.php": "12c8b634b226bad4ec0a7dea7b8249959943bc5ab0e71f75fd42afbf6d1413834563c38430e9348bde2cdf1059f266a2ef59fb7a8f6187ecec135ee9d5dede4b",
407
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Record.php": "070470af5650220e0556baa6b109684e1abceb6e80af620ec750f0c691824249121e1c6aef6cc1c91bebb45b76ea9db24f9cadbdbab8857b367ba2521d1cd001",
408
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Redirect.php": "34e09e0b208c4dde1c4b53c451b09f23985c8f74737e73f4675053494cfc81b14920afd6620ff161877c4e1b7b6e7381cf3f824a2b06508d84299aa4e0e45690",
409
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Response.php": "8db3a9e823e3c11b8377829c783d93f0b7cf98afc6d837e514803b478a7887d6602bae6efac9dae6a2e7683d8409c23f78c463185754fd7916845aec23e42c58",
410
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/S.php": "d0dc3f3bcc818d107fd8e4be38718587edf610e3f840d7e6763ce8fef51a1e96de3b49076995802aac9edc7d8a976ef024a1d45ef634599a56d13c56a8ba73de",
411
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/SayAs.php": "46c8fff6a9dbb36df1bb14d0c4247569e00ce77b37730d7f8fe6fc4a404a632ae70e48c774f40c4ac0e19b10ecca7c09686c7d5a6fc7d5311edcba657177b6db",
412
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Speak.php": "d18aafc18ac404a85d18627ddc66d2810ba1061f8e0d3d3634d5f5258b239a139649a8cf479367dc026929010288a291aa1144aec2415a2de6083040b8a4a96f",
413
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Sub.php": "9d34d26e76074e65fc01a3a477ac176027b1ceb5dca2fff450111bd2cfc0027c7f7338777b494728ae2617a27075888ea699d4226b60049c4fec633d42cff8d5",
414
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/User.php": "2dab0ac6bb38d9216c1b39b81ce20f1a2af1d385c90ea13aa566176eeb288f8ce80e11048209abf8c38151207137cc86b754b7784cc478dcfa1f567fcf929520",
415
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/W.php": "798d6f10e6d07a54b29916216dbb2382f25bbf2f96e15906f842cd2ae4aee22b8f3e56535264b1da6d40835d5b9da6a9f4346303f7602c9562587b29fa419f3b",
416
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/src\/Plivo\/XML\/Wait.php": "99e6e66fb4d2a81f0419ac823be64ea8c81e6ffc8313934b41d6189519d053b54b5e95dbc7b869dc979b72b551b5654dcd6eef0540c3b01eb900716e97d52dd9",
417
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/BaseTestCase.php": "662140921fab3f1e7be65bef2d063673900eb3c41de8ddf68320de194e254ec3fbba3322790812c258698af81da35277cbdfc0d2fc957fd5f68956e7db2ceac2",
418
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/accountGetResponse.json": "1ee7d7e260e8678fa70fa47206ac7c4645e9d698da7017ab05fb56266710e34bce48b19d3c65541a084be28cfe918e81fd52073064071daba77355af2eddbbf2",
419
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/accountModifyResponse.json": "ef0e777d38b4605ab58d951f26e975566b61a26ebe5710b9c8c7588aae799c68cf76dc5860f44aaa666864f3fc1f74185b5eba888c1dfa8c2004fb8baf6d859a",
420
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/applicationCreateResponse.json": "19336630707d50a021e3dd3cbcd8a229f9f6123211e27fdba211494bc40e9b9fc5573ef328806bf00b937106e7c894ef96a98080f6003d91cdec67f50196849d",
421
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/applicationGetResponse.json": "26a3aee28fa9219455b0c7a54d47eaf1ee7e9fb526185d1598d5611246c1ad7b0cb1abb05b12d21189463955e25d2da906cf5b04f1bd4c3b826d44de47c0d56d",
422
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/applicationListResponse.json": "b363791ef3276030677b53f555a42deb02a9873cb5b21e17aee9176d425ed38c562da7fc162cf5771f0bd259b46d615ded3799f34f6fef590e2df97180ebd228",
423
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/applicationModifyResponse.json": "742b49b7f428a281b1189fd5f23811931f2d6c71fa271ead086b6acfac63bafed22b86f2e460fcea35d8bdd46786c5db83707f35c7a855efbb92e51ec01a4859",
424
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/break.xml": "6707a46a4316a9f23104a23e4ce9c79f8b4f969639c08f5196a9aa94ba3abd4a1972a29d6131e563a685732e8cb0a4fc90a76f2d0ff5b72637fba2f974abecd3",
425
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/callCreateResponse.json": "513446e1e7fb97b30b86dad2119bc9fe73e70f01f4976ac40e57e41e7d96a2faf978fc72fe2ff49e3326fdef8e17cb4da24bf665be81089aad1232716e42e114",
426
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/callGetResponse.json": "2958c05e7fe02f5f6f2f8834b34050599df05c6f5751fde2fb038853383683e78b2b33b9534bf8da38770173e08ea9c7015d7b2d4f270efddcaedffd77ce661a",
427
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/callListResponse.json": "b2b35a27aaff76dafc6f5a42b6ff515e56ea9d7c196670613b97c2b4c0b7f2dfc3ba7ca705b2618f3851e1db554268018c7c2bb658e94b66493576048c54ab49",
428
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/callUpdateResponse.json": "06be7ca7ccaf82f24f23e8c33382d372ba639662283023a9b6ef555fa24d273efd845ab27fd423dd4267d66a8df24604f96113aa3bb8f8dcfa49e713f3d71bbf",
429
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceDeleteAllResponse.json": "6722c7663c8877f4bd5d417638d5a0fde3db7cd2ba1880dc66a7ce9ad25a14de60b4942d84647cc21c0b12211227161349109162ef3eafc2a9607c2645d3c93a",
430
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceDeleteResponse.json": "9a8baf62bab7971a89490d637633a3d498d4442bb11ca29486d21a3dde432ca6c0cb36d236bbc94859efac83b2e56d33442a13a4395f4b026dfece2103ca790d",
431
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceGetResponse.json": "950fb7d6e6e120ce670da43937ab4ce9e7a7df5296848cb52261f5f854bd89d47f26d76f89929adc59bdadbc8d0e77de79f29edc5d6e6b4b73aff1a0c126bd43",
432
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceListResponse.json": "9f5635d9e0988b03c2bffa8457962cb6870a39d4354ec6c065b58949850b188d2829fcd3db1761ec42a4bed30ee3704b6c353d2b9372742cd6d8b00bff273dc3",
433
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceMemberDeafCreateResponse.json": "b39ae8d7a1de7d5732afdc00da955a91850b855f6463b143b5837023dd8281b450fa79635a3fc729b5b198c6af5cb57f9c6797c8eb56daf72b7c7131196fb4da",
434
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceMemberDeleteResponse.json": "ec18404f82674de8b7ca25eaf95074cefef51b13b038de14dc9ed5f2664c6e6c5c87d3f7a08eeab3926869e171ac26d1647ba1cca03253085a194cb0fbe16975",
435
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceMemberKickCreateResponse.json": "9f924beac462c4ad9f42a705f7bfde5aafe5e73563b07e98ac9db42e95d3c657f5c4ba0d6ea64b01e2e061563fec41d53f8ae8fbd7f5e08857a903c948019e1c",
436
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceMemberMuteCreateResponse.json": "c3f1c38b6c8295b28d531c446199454fd7422d00e3cf71fdd318a821edca4afba444f8cea38175c0853b34dcda5dcc2c6317a9f3103e16474fb36c43241a52de",
437
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceMemberPlayCreateResponse.json": "ac345d15512ca5debe0a20092d8a4bba1f725a581799a632bbdccea771f1b6094b6df3362120a29c1d9109cd8ca8857447c3be08436fa94a5a4304725b75ef4d",
438
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceMemberPlayDeleteResponse.json": "10b6ab89ba98b9d6d08dba8637971ca9260757c318a4842521c7d2bb2a1b967498453aee4cef6fd964cf2e614c25364f543412a0a88b877154b3faa9f18ab3ca",
439
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceMemberSpeakCreateResponse.json": "b2b01526d4838a72c816ad9c6ca7f9cb473a89818d4444b48aefc269d0173fc9eeed1e2473667517280c18315d67a548f41937ab4b7d26f2edd4d0e13486aff7",
440
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceMemberSpeakDeleteResponse.json": "d42658e98680911d21be32033be208b53071e3ee2c514a86809ef4d06cc138ca0a74d9b2e546c54b51c66f3aa891cf0ba3b4db9a6a07e7f06ed37bfb39ef3a6f",
441
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/conferenceRecordCreateResponse.json": "c9d8570ab20fea79181b1416cdc44b8e9f8b18b06ad446a0929ecbec53a6bb3d66ddc8609a2baff92d8ddf9bb68b802ac4eb3d62e958d2cdc1485711a6286ed8",
442
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/contSpeak.xml": "1115d194144f96d3b4ba895d45268e346e7e56bd308b4b7c58bf62712380908bb71d5250323bfa6d13b8d25e64a86580437f7ac1f2c63896965e3c13909c240d",
443
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/defaultSpeak.xml": "2449ff96f102465168a4551ddac6ff85bc680370b423d46ee10b345c128755560e0bf48c070081e8045839503450c0f8b443fe0b33b455410ad5dfd639a6adb0",
444
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/emphasisSpeak.xml": "1ae7422578c6921013c5dd65650f0c1efa50512824b429334cc150ee6872dd2a7981a125b07a8023e360d8a881a32333de24f1b595c95a339507dfb29732af83",
445
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/endpointCreateResponse.json": "e0cd43507839270c51117e48fdf3158e67662c1bdf9c8c964b57a13c15517ab7c83483855764b763f63bfee011bb893c20eca7e7a0b3b8872bbb1f26228ed720",
446
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/endpointGetResponse.json": "05359131cc3ed432c1b29f3766d019be556f58e5e7f7b502d866d0057c04917ad7011bea5afd7ca8f2814dc75c45a52930d48464f7fd740ae94b45d0a07d3627",
447
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/endpointListResponse.json": "d6488ec5e6277af9a34629d901a211e37c9a522107f84ea77f861c417345ddfa409d7de389ae69b719997600a0495289bcde64791ef07c257f75bdef4fa8006e",
448
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/endpointUpdateResponse.json": "3f20870d3ef78c57407bd42cd424775a7014473d891020bfc41fd78c9187acc3d7fc2a2d7a137eb5bf9e8741525db9aec853889b11d2d3ff508f7fb16a4bfc88",
449
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/langSpeak.xml": "1eb16f6028ee00a12e677560ec9b3ca4921deb2d6da15b3686c43f506e9a13ab0cf811d71e942e1f225989f3a486ee39b4949d17d8692ac0a50574845491cc8f",
450
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/liveCallDtmfCreateResponse.json": "f30ceb762f24445068ff4a688935a84cb64840310bd518806c1259ec26fd60da6a8be9f11c9c0882d08c857058944cf1c69c95035517716dba322a1a865435f2",
451
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/liveCallGetResponse.json": "339633aa5d9cd2aea4a86dc48dd8c63ea8c0c56d5cc0f4513bcd2d66df425ce4b74b246a8c39d6cb0dcde75a8c01d4ec8347e69342649ac27599a79a72fafd9e",
452
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/liveCallListGetResponse.json": "7e8efa8df76422d6a9bb0133c81d96b9ed932f7f529644a109b35e9f8f301b3a548e8e7f6a9213e301f25e914b98c3855160ca7e0d6f0283e947cd6fc95c5ed8",
453
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/liveCallPlayCreateResponse.json": "4cf2ddd4f3087fdcdf772219c5ed84ffe1dc027208540059bc532961b6c4cad382bce98dec481e0245c99e288c9523e8f33ae7c3c35316c8130f49f81db40604",
454
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/liveCallRecordCreateResponse.json": "02f2c4c88fc63e5585f6e5988d5f615488507a7d7eba442430753a60f0cc2763c38abf905042c9ae0f7d017dc50caf67f269267972b5a7fdd4fe7675572589a6",
455
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/liveCallSpeakCreateResponse.json": "ef69736cd0199704894c2fd938e4f84768b09a6b9d2f334ef0a83b1750db0bf0eab538471fead4397b49ffa8e86011da111e867d5d8b3532bf3f4250958d6146",
456
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/liveCallSpeakDeleteResponse.json": "63a9fda757cfbe1a338c42f19532609e8607f3c2c8a317ec8e5aa2a164b0e9f9a652129bbf7fbf9fe05c38a0f68138ba10b4d256f48dda1fa292c18f2b717d3b",
457
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/lookupGetResponse.json": "6b2dd461ce651012160ed88d092de0859ff1cc132c57091a1064b5745b83cd6e5144e8204b6810da7bb675eca802fff54fa298f03be6ef858c59058acd24e640",
458
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/mediaGetResponse.json": "251c9d7226411a160031776b1c7039d7e7f3d715ad7bb89131353611a2509a570656b8e29577e505102cf588ba50cab34b3b74351dd33e2a99333676d48b7aaf",
459
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/mediaListResponse.json": "1512baf046701056ae6b5ef06a1e6405cd62a27d4b82f5b38ed2b2ef6faddfd147b6d57074d04d77cc14325d50d7908c0446acd4a5a0355e9dd9316f80b0f448",
460
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/mediaResponse.json": "329e01ec90033528ca170704dc7a3de8f5d004a609fda5abaee4ad610b1559464a97b423ca27248f49fa3696f12ce6c1b3ef69ba198ae57877927ff78257231f",
461
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/messageGetResponse.json": "10494dc350e9a659083f44802a899a893e67fd82acdc506210c827642e27bb4ca1fca7c00a73a7aa20900ead392b9983ae719c6a9aaeeb0ff9f9b9e02539ca4b",
462
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/messageListResponse.json": "5751782fdb135ac45cec47687b7bcb10d4e2c4c8ae88461baca0eb6f0f81b8144aca9b610cc6ef7f3cffd4b5dc2ddac08247e74608166d147bafb1a9ecd4b834",
463
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/messageSendResponse.json": "ae5ef8b7e2a5db03fc5c04e96cef35b3f819f1670cce72e0e729b57de018bd6ffc254e00f20fa7c662eea100f78bb1824f0080275ac270f7e1229566683fc62a",
464
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/mmsmediaListResponse.json": "fa4d1e3885b6c84d72c9f9a4a414de7d1ae1d574db325cd773600c7a17f83fcbe2a84c0daa8fc690d5f5d95431b1ffe5097c17279593ccb4155d5f99b1a853c6",
465
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/numberCreateResponse.json": "e7acbc2aac3a716dd50e27de2e8937e27fe70da7dfcce17561f4d81a2de53e8cdfb5a695255e1ac65c8c49e4b894722e7ecc9297b9d040dadff97d1cb61ea414",
466
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/numberGetResponse.json": "261a85df87eb4ebd1d310575e8f33d94f74c30f5ba3aef1ed47654f7569ebe4310019c5dd317a8c6e2b015a1ac3f72455118e0878d688817580b18b747d6dda4",
467
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/numberListResponse.json": "134543e58c07917a79e0498e85466b9cbb1c97a0e3087473463419bc6c178bc278ca75e148f885eead7f6b1074063256fa61745c57a0dec4ac060c4b03afc499",
468
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/numberUpdateResponse.json": "e7acbc2aac3a716dd50e27de2e8937e27fe70da7dfcce17561f4d81a2de53e8cdfb5a695255e1ac65c8c49e4b894722e7ecc9297b9d040dadff97d1cb61ea414",
469
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/numberpoolListResponse.json": "961fe25a8fe8c35dee1b0608a24d741b6ab91f2104a9f2af2080279d6cbe4e631416d7b3d8e3772715e376a603cb740d652435a0f2d7971e64e00eb44e7cd518",
470
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/numberpoolResponse.json": "c725314dd96d000028683c175528d15657c046cb421add91a927472c235ae5c1ee1aab060aa0eec56b6c717138623684f827a2de50bdbec1017e7bff937b437f",
471
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/pSpeak.xml": "1e49af0752b825db21fc50126642fde3f39dd8b63cec3db00c3df92ca38935d58b8752ad14928278b98ef23421d0926d624b6aae948f9473398d25e2d087b963",
472
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/paramBreak.xml": "1202da39615a87758a5fd85096a4d98f6c2726d705ef0b1086cfc66cd0f456b15e3f79d9850e1bb8b99e9114e41b3ca19ee4fd269a42c002c205de005c72ceef",
473
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/phoneNumberCreateResponse.json": "a1dd38958ee69b5036aaa1c86cc730802dc2d7612eb1de9266f9a6651f6f067cf9a42d44c736bf85d1f40048f01f99fa05ccb3fb26baf3875e3bea98fbb9bbd8",
474
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/phoneNumberListResponse.json": "f2c263fdf122dfcf98289f6cd9276cd8c22fe4ff5bffca19b3509800d07909664e9ddfa3e145da04c06dfc6c5227a39868d17ca947e55b65a9cb18a6faadfe57",
475
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/phonemeSpeak.xml": "30620187252e4a92154e06e611a2cda1ca881a0d85b1c6c36e3c713734c0be9ce79bb9ad38a11e040cff437c5676c01638eecbacc5b50a20e0adb506565a9475",
476
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/powerpackDeleteResponse.json": "f170bba1b0b6bb42c88bc74353ea4db09b82f07f5a2166f693d0579e5b7d6beacb8cf11e39cff546345333b14752456212584e284c2c360cc673d009fd2aa018",
477
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/powerpackListResponse.json": "0cf4f36945bf4f73377a6688f99bb3efb0c35924ca9278bd777ecd0081c3f667d45de4a34f7101588b7a7b3b20179d18a393dcc468ed88df8eb53b5e2463d7c1",
478
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/powerpackResponse.json": "4318b75a2ac1642f6ee33fc62f18765a5142aa52e0353082a9d38cbc7660e40f24e1665a59c723ba90ba9a86edb4cd4a396bb9a0c00cebf6d5944e0ba84e7919",
479
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/pricingGetResponse.json": "25a616f338c147cb22228535abafa9c1439f663230d1fc5109af24f4f11a637c5d0cfdbfbf3b2762b87d0b4693f14223254e431f3b8ab1f518b32ea884e2d1fd",
480
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/prosodySpeak.xml": "0529a04b9ebbfc245e7d50bce1177e3eea9f0f6ede900e9fd3a447f86078ca86fe8c9911fad4645494cc784394194c5e6b63141a2a9125a1ecdde2cbe8bd7c86",
481
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/recordingGetResponse.json": "bdf9cd97b6c687685b9c37a0921bcba910dfc811abe416be7b17fefbf857c3ee1233e987570eb444d168edd660c26acb55377f60b8aa0a898f0c9af1743edc81",
482
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/recordingListResponse.json": "2d831eb418cd0de8a0d63da8a2ed133005a3e15e4e021c3451a737c45f42e5753ca5143204acf2f8bdf6ee91cf1ee8b04ee960f942ae0e62bfc3583ab44a1dbb",
483
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/sSpeak.xml": "b81f50357fb60ad968d8e949aed15c7544abed0a45c26c5bdcd4b166fa1d9bf74f57137fcfd378fec345e1fb2281ac38c30b2a3150cc6fcdc13581ea29379796",
484
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/sayAsSpeak.xml": "84e2d4a310c8d1fccc5be4be4cab026e1dde129ed2e18ab4fedcd50512cee91a52cf437606cc936c474cbfa508a105f36272edb6bcae29388f2a75bcb354de6b",
485
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/shortcodeListResponse.json": "449e0c165ad81254715b4521e5f4d39b0a6d1ecd583bf337e8b85ba40550a0942c04a8e33b69e5327a275fca4e42e31dd1719f100c8d6e459939a3696ede1a71",
486
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/shortcodeResponse.json": "867e2309b5c912c9dac5b06929a835b578b0dd3391c43f6e0d454adccf997060e1e5013051b394a94d44af3e5cfea67a88f4376088a376a031d6fde5fafa09be",
487
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/speak.xml": "a781afeb86ed31833e74d834de6d9834783264ec43678fe3e70a7f963e97a9dfd05dcb5ae75f51fdeec1d5d8d299d8c476454307a23efb830022a477500c02f2",
488
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/subSpeak.xml": "06ff8e0c15b36727265d9f80c736a1781438c04445e91bd563b73a1f9ed4b501458f7e3ec22607dcd96e9f95da6e6d874c39381ca061a768c2b664a1b4bfc504",
489
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/subaccountCreateResponse.json": "7fb28239b065aab21f14d158e51ab6bfff6b10de97ca558da02adb639fd15e99343ca54277d0e0b0dc6be11c01abe6517fcc2f0e862d5a3538342f86bea87994",
490
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/subaccountGetResponse.json": "929de7e767657a691c8bf34be8abe52990835f9787114256bca7a1fd6016b34798d36e2318ad3d4a2a8931986d8034e2310e4b4247fa38a84314658402aa3bc3",
491
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/subaccountListResponse.json": "c57bcf1f52d302550eacbe5492bbb1cc17bd399d03b6c83971bebd83fa8be975e97859063a2115edfed47f622adfb413d5c28d6cc180710211bce192d867052c",
492
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/subaccountModifyResponse.json": "a06022b797598bdabfd7029128d9ebc9934784edf77175292c17b60152e7464938f78ddb8ab2883e0da22fdf94e584d0fe8d766c40228bc0a564e6ce76c39365",
493
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/uploadmedia.json": "35f19877904dd5eacf97183a286db18153002e37159f6e007c9c70644843d73963e9293a5e64c1854665821e36592f5ca11289d2ece86fafb3ddc4b8b758dc4f",
494
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Mocks\/wSpeak.xml": "05cdd9418d049dc33432e02bc305b10635daf3bda936c695c4136bc4bb8167ac63e6ae809202a566e5a1488d8543c06fd9c52f869b03a474bfc3db560769c00b",
495
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/AccountTest.php": "8a98fbb165ab60db8a7423252e78d9db1da922dc2e1de9ef5cde32488c04380ab01e8fe53f4f542c602b28e574966adf58385456388fb4aff543dc04467de668",
496
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/ApplicationTest.php": "e23381682056702928ea1c587bf8241f71743e4349cb30b621f2c843711c108c0811689c953ecd52515b2c780c50c134f959e4ef77ad2c0dd65dfccfa8c79c2c",
497
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/CallTest.php": "7aa7df68b91782de7a8ff67ce4bdce917de03ce4800da2d6c103f0d1297fc26c09effbbb7ead06d70566398b8679c54246213c4babefca43976c289b8bdb895c",
498
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/ConferenceTest.php": "3d1149c50cc760ec57de791d7a1eb46a5210c113fe91e1756dc642d2d94b333067c9c3c5ff9d0c90d9ad8981963394d332287b57b84c634c8e4008ec5cb2356c",
499
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/EndpointTest.php": "aae4c23a72674a9d4da6261986147a3b3a1c5e4da03d2efe7f4ec21336e03d352ddc0f7e47dab3c9b4063a170d37e0eebeba649ecd1159d85a3c5553789c51b1",
500
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/LookupTest.php": "c436483d9ad54681ed44ef7a6b44d4899d06b7b421be27d2a076aa4bbef23a5d160d5098c60d5c380a8e66ebf8245c917074edf6a7b682d056f9f60e082de032",
501
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/MediaTest.php": "a6ea3f17046c123698c0b8fc1e7cfca6665159166dd53b51d1b5a7700373527c7346a90e67a382f4df26ed3f92209790c3ca93c0c3d3b653d424e17a1fed9f17",
502
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/MessageTest.php": "9749cc39c4acb64b49150958745f19952ffeab648abf06ae839eccf8eb9a6c66bea62e7d8fa398dc48a79bdc97ee063df934ba827632faf88f4aca01e5432181",
503
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/NumberTest.php": "9123fe40158482d314279a729e4c5c0eecf3733884ea39df16de986e775e93e90b8d9c7ad35fbde8f3d4cde3e02b33c70ebe87cbb27039615de8213cc27aad47",
504
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/PhoneNumberTest.php": "4b52dd78392c66e1d1803a278ab98bb03e4bfe5275e28b043e4f672357125b4373acece1c2c5668081be021a683acd2796e6ba5ff2646baf3435dda1d6de7667",
505
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/PowerpackTest.php": "52a3c6967c93b1b996abb3fe7e40ebaec915e58e715c6943b0f5ebd945c8a59023184dd1339cd044d2f3ef1a0041a61559a41a3832bfc222332fd85bca8371c9",
506
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/PricingTest.php": "91a088d32f726c2eb49160363f7a77d351f3f65d43a9282cbea646310e2d01a33d22a2adff9ce5795f949bd205c0b6e77571f0a231265514704f42bdefbc51bf",
507
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/RecordingTest.php": "353008dcfc66ae09e915787634877d598930e60fff3f1e6eec0aa5590881f66d78ebd79aa1ba2b2a20409e4b9372eef9ab28406c9fd29f95ca6c773d8c83fa63",
508
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/Resources\/SubAccountTest.php": "6dd803629402c6f7b8d923753477f6c03d6cfbd50aa59fcd63556527cdbc3d932557b318cf8c7a9f5a9d3ff8ff143ef15f31256e488fa8c35cd62bf80ae04d5a",
509
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/TestClient.php": "8917a380e2cc030228dbb37a7a3aaedd2cd624d8102eee1fc3469a9838f31f7ee734a40cd45e510d63bf4c1526da4bb3af8d45bd4ebd4382cc9fd5bc2ba178c1",
510
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/UtilTest.php": "6a66cd73b0cd403f64f8a4752381964bbac7507b4449e81c9aaa64d61db244128c604a8995327dd8e8ccc8a30cee7a3a57fc617b845ebe65a65ac38125ca7394",
511
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XML\/BreakTest.php": "740c84bc38e7044f5138e3816b72c6a94bca3accb592733421578a6eee2080bc6721d85cefeb8b6f1db751e2056fbf722e0dae61d260b089dd803e72cd9cc0d7",
512
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XML\/ContSpeakTest.php": "f3b641231907bf807c5c09b65a13409ea054b0116b9b36f5bbcc2bfa651592ae1f4707be5780c37c5b9f1516044a9f524f4ca829cd0b5387a6a32526ba11cc94",
513
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XML\/EmphasisTest.php": "b76b6d0eee048b44965f87fa6f59614e64d885864ef3ff0aa2310746d76304fb5ac6cc6d0c714e7560e5472e018fd0183cf9a918d3e4ee5415723314d7d219e6",
514
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XML\/LangTest.php": "1a4ef409ded7d9c7abd8c63994dd3e221b16bd1fcca8133ce43e04b300a28468cea68e430098393acafb78e537e37b0574644735cb84fd08e33dbd828e2fb071",
515
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XML\/PTest.php": "9084715ad9065f1a926e8dfdabc5816b16a385dd5cd74f16f6fdfd1aef043b7d344d9cdac4b9dc43df85e8e63f329909553e20b86d995d9eb6d25d716fc5fd1b",
516
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XML\/PhonemeTest.php": "f85a3119f95615c3d3e16c0a4c1d2aec7b2191629b60de276cedb769b23e11546fc27fff57e329c1ac6cb52868208d29f88d1412b452932b573d88cee9fbd68c",
517
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XML\/ProsodyTest.php": "5aecbb6cb41b0269b0895e580bf87dae24703c3116dd39774c11d52406635f4167bf55ed0b950cb4d8af9138c03361161527c7f0e08867053034d8aea1fb1daa",
518
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XML\/STest.php": "55343bd191ba9b88fdafcc409c1685224cd6673225c1ecdc006d4c3643d9e4f71fde0a07ead3f1bfda80bed486f09a7fdf42e16cf3d4fe66f592bb72397320bf",
519
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XML\/SayAsTest.php": "005fb0efa4803847719d9e7d52438ada0026b3860d7143fa4deb96a80826ff0f8608b3dd9302617547dd36cdee5293ec25570dd6513cd81a921ff483379574ab",
520
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XML\/SpeakTest.php": "cc92de5d0f5df6de17b121249074752bb191265335a6e50dcc4739fe525cc9d0014c187a7d15cd0c1226c56360277469ba10da72dc56dde01f478acc510a8dad",
521
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XML\/SubTest.php": "5c113371cb363691313226362512772facc38c30afdc32e96976aa309d6ac33aa32bab7d4ba674cd566182641048434dc65cf1403f25ea4adfdf6c6793db2fc9",
522
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XML\/WTest.php": "f7cb4983bde61290a90fac15c009ff1780b02fb81c8568d0e8a1f40fab97dc1ec2245cd477b5ec669c6f54e56bcf7351e38c09caac7255756174baf4070c9284",
523
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/XmlTest.php": "58317dda536a0383749d695ee8cce6f73d6ab413984673d46b10d9299e5a70c6cc464051e986b75c849286787a8fb23ef15e8bdf6bbc9a27e1c0cadf46a1bcd3",
524
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/bootstrap.php": "fb1c83cc2a11ffef9903eaf721f4cbcda4767f70368be33a0980aec4e5b515fa8258750f6e19fca0eff6843d0294de9c35b8e95af0e62f51a94442be0099720d",
525
+        "providers\/Plivo\/vendor\/plivo\/plivo-php\/tests\/phpunit.xml": "74191aa62aebbcf797167fc2bfb6bb304cb3d309287a73919caa1c43c188dcef47a1f1905e56143952e4b342ef183a84887dacd6976c18e58025582d5f672035",
526
+        "providers\/Plivo\/vendor\/psr\/http-client\/CHANGELOG.md": "82bb81ca074204aff5d95ac5d3edfa9c85569c8b9114f809e3e2f9525a6046a1276187ca42f638ed428311631791f60e6dace74cd60d77f1af0a41e9f76ab2ac",
527
+        "providers\/Plivo\/vendor\/psr\/http-client\/LICENSE": "3e0ee70fc857b6dda26ef2eafa55ef09384d82bb2f85b4289abcd94a60201c698eb477dcf03a73858b2cbb9efcf00affa199e848344b84dd4a4c135601e886ce",
528
+        "providers\/Plivo\/vendor\/psr\/http-client\/README.md": "a8fc38f5744eb4c1f14f5016b02108319b7cceea7fb3219f57f0604a2e92778fa9be6f1e340003b095f70c962aff0b49ccfb0264b26eecb8fa7782667e62cf3a",
529
+        "providers\/Plivo\/vendor\/psr\/http-client\/composer.json": "b767c510e3dc28fc5c8c0debf4e5627f4897940d41ced88cb0c85284c2e0765f49305997407e84d87154a4d9e14045e6c50fd86163d3d7452294af8b7bc36ccf",
530
+        "providers\/Plivo\/vendor\/psr\/http-client\/src\/ClientExceptionInterface.php": "33aededf573747615cbf7b8bc6aa10faea7762c903a0cc98bc43803043f9bad58460f09f7301814c22e95f2a6d0269388d8ca899ab76fcf0f2bd8d82aea5d9c3",
531
+        "providers\/Plivo\/vendor\/psr\/http-client\/src\/ClientInterface.php": "11b1cee24748c4ed1a41681b1b6e43e865e08150be14452de885daaca737f4029d65e8381632a23910789d3cf5e9f9d02f4999aad62e4e8c80a2fda9ac96a4ed",
532
+        "providers\/Plivo\/vendor\/psr\/http-client\/src\/NetworkExceptionInterface.php": "6d3d81d18a51f451e8a1b74a16b3ac8ce6c5642013a2d1375ce6718090de5369779f9d6f594675aeeb7bc3f55a11f1b9396036354c4e9ae0c90183ff369fd65e",
533
+        "providers\/Plivo\/vendor\/psr\/http-client\/src\/RequestExceptionInterface.php": "46391124b679cd54538ce5ae6b05d7fcfb6b9ef7680f33c8771f94b38075a366788293b757ccc674060d615783476e1151d0ab8a5f2a10e24578c9b46cc1433f",
534
+        "providers\/Plivo\/vendor\/psr\/http-message\/CHANGELOG.md": "5567e49c016bd259491fd13a96e5b88629fe67ccaa0d75f7aa7c54096edd663fc743930eeade981a041cf7524d9f65104718c129fa36a200397d30c0e5d2c954",
535
+        "providers\/Plivo\/vendor\/psr\/http-message\/LICENSE": "22ef0ac33682fbed60a5274a5b25991308decbb45c6ed45fb3222cc045bb9e552fa7310b1ab6f38329b63f53a02c25e7bc5e955ad23c5bb2366b417563cb71de",
536
+        "providers\/Plivo\/vendor\/psr\/http-message\/README.md": "d58ab57a3e35e51848c3c21313836c88eaca950eb5b716878ba950ad2389bdd84b24a5fd8e6b19ce3ff04b07d879b5206b0f26d5e3a63a5be19beac0e9ccc1de",
537
+        "providers\/Plivo\/vendor\/psr\/http-message\/composer.json": "4f074821b6fb7074c418bed0fb6232677a0cf6ae5ddf24694e14bd5aa7fb3610a645f2221fd024e7c4bfe3e95501421455dcfbbbb38468e9db442b8cde9471a7",
538
+        "providers\/Plivo\/vendor\/psr\/http-message\/src\/MessageInterface.php": "b79e96e691ad169d4d70420953ccb5933301ce7cedc17d4eaba859dbd56719008198fd201e3be1606ea5dbc78b559f1d86ba17b73ab7e843f0c2f0b49564147f",
539
+        "providers\/Plivo\/vendor\/psr\/http-message\/src\/RequestInterface.php": "f54aefad46987c6b4880d5f09f7e99909e6e2a99f9d305d1f73e4de58b43493179149912352869e50fc46e057f50c78ba7ed5df6280a7c0347f3d7c36afcbfe4",
540
+        "providers\/Plivo\/vendor\/psr\/http-message\/src\/ResponseInterface.php": "69d177fb504f47ca0181ab35e2155cacf16e77535d07bf4eb4d790e1ddbc7a133f3de21eff936a3e75acb704c936ee2f2b12b2cf3516464222c3d60ea9760488",
541
+        "providers\/Plivo\/vendor\/psr\/http-message\/src\/ServerRequestInterface.php": "ea36ff66e8bd962e468fb2bc832e70f7bbd81f92dc0e607cd69092b737609d565f3e254a2d54fb3588f5302315f62e53c6eefe9299ba4b6f1f53ba8feffa815c",
542
+        "providers\/Plivo\/vendor\/psr\/http-message\/src\/StreamInterface.php": "11ab8a9d07beea1f1633f8f6cabb2a463ff288555f2fb8a4cc0b99404d8580493018557a0f2674feef653be51f6fb8d9aa3ad8e6dede0391cadb7bb49f96f781",
543
+        "providers\/Plivo\/vendor\/psr\/http-message\/src\/UploadedFileInterface.php": "65da733a08d80c5490fec8e69c7b56a47efc522e720a2ddcc673bd74c0e21f5fad4d522ad47da4942d25d139b5392e0882de32b7fe5a5697b86f40fd96ff0f8e",
544
+        "providers\/Plivo\/vendor\/psr\/http-message\/src\/UriInterface.php": "0d46735005331a3489e3ef4c8229307320de44b0443ff74d238cf8f3962d83e99316da9435259d479b48477d33e8713dd3d1a1859264c22f2a53b43cd6adae2c",
545
+        "providers\/Plivo\/vendor\/ralouphie\/getallheaders\/LICENSE": "ba7ad111dab105773d8a75d20024b48c4222cba6f7836b7b608fddf34f367cd218302829a1926a675bfd22660f4562b0e9a679d15b41162412924ebcc1a4e557",
546
+        "providers\/Plivo\/vendor\/ralouphie\/getallheaders\/README.md": "48ce2def80836640ced369db92da9f9e943b319849cc89441023bc260edd6919c710d08c91fbdf04864c6e08bf89e60a397f5e814b3e9699b48df574f5799522",
547
+        "providers\/Plivo\/vendor\/ralouphie\/getallheaders\/composer.json": "495b111d0e0b4f4496ccaec984dc89c897f189a67d840c09b0cf17034629e1c896c37c4ddb1afdceb7d5a188dd0d90405ce34aad409d3b7722169628411d3ca4",
548
+        "providers\/Plivo\/vendor\/ralouphie\/getallheaders\/src\/getallheaders.php": "a61a5f91f21a68108c7e9c8eef22282e4b1b6f6f14ff997c5f47c83f39acd08ec60f4b9d25d306d67fdc68ec57c7f71a44a1f63ebf7c25b40ad61fa1cb4e58a6",
549
+        "providers\/Telnyx\/CHANGELOG.md": "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e",
550
+        "providers\/Telnyx\/LICENSE": "8756122099aea86ddf6f176a480c0454f2be6dd278e475bd6be7d7ab3d572162f1bd44c9f623e52e53514cb15336be6e84a5eafc8e2a347b481ab5799ebd6e17",
551
+        "providers\/Telnyx\/README.md": "321748e1de717ff62ccd3fb2c10fbed8ce92a66271f2047c83be8929f965c179cd163e429175b44893ae30addef3623f96659b98528a405a585f7afc7394e866",
552
+        "providers\/Telnyx\/VERSION": "7558cccb74c98362a480e1c0ae17e711de8e5d6cd10f508a31395105c0efb22cdea79aa6f9f6f890837d519acafc2cb3c429d3ab17a283e1992e5aca5053e25b",
553
+        "providers\/Telnyx\/build.php": "485d76b827a54d8455550e8a8f8d14862f9444381da251e66c2bb8ceaf2106a554c1cd339666b1260450749d0244d6b9ba0c6d0a2220ab2411aa4041fc83f8ad",
554
+        "providers\/Telnyx\/composer.json": "7ab90dcc0b5854786b213e5f2ee8c8030b21f65b2f8d0f74a3aa6d771ca1054ae5e1ba58ad6684dd1234e7eb7244be537cdb0a6888172cffcdaefcc7f5908dd5",
555
+        "providers\/Telnyx\/composer.lock": "1e4b665caeb711f94b1e7f0ce6388e91ada9973159c1230d4e60f0dcfd44ba9af2dd236e6acaa27564e91b4a89dde817d5a73cad8682aa9cb93b203f467c6be0",
556
+        "providers\/Telnyx\/data\/ca-certificates.crt": "66816e077ee99ceb9535a472e6bbf4f0e48ca838099c8a97c7baf3297fcada9a43016ea1ded63a455ee56a8f18501417a0f744fc17b215bb599cafd76b754518",
557
+        "providers\/Telnyx\/docker-compose.yml": "1fe4c651e406095f0ff1bfc196406d473184bf53cf80f7c67dc79f1aa94b26db74174e0e9bc47adc95eb2a5f6eb950255c4a5cf44ccb7029ba712df3be9e6384",
558
+        "providers\/Telnyx\/docker\/Dockerfile": "a63d1fabd8c19fef37b90922aa4bb21fbd1094635666cf2a3a4db47009888bfd3f1ad5c34c05184e2ccc8f581971f6dae91c1ff137730821422cd482c39e9390",
559
+        "providers\/Telnyx\/docker\/entrypoint.sh": "2bf3911c365a271fc52d17a0aac1687abf52e5286a5d52cd34367e18651dcfd6ef1f791b54105b7742f5d691564ddca3c05a9ba4ce8edfbc68fe919e0bdf6c1e",
560
+        "providers\/Telnyx\/init.php": "e590e355286b775423b39dd23b5aa0d3383d8a85ed2d1346802e0c487cb834154b4ba1b0ca41ae112ba81cf5afbcc9133db8747e08565c00fa3b0ea04fa7ccbd",
561
+        "providers\/Telnyx\/lib\/AlphanumericSenderID.php": "c6f7d381cd9901af59d67c66fbe6ace0729c77ac2b2962ce41351ed076cb39c9049aeeb72ba0e3933ebce4ab8a936b86a7e21d30a1c07b2b08cad9da2abcda1e",
562
+        "providers\/Telnyx\/lib\/ApiOperations\/All.php": "5caeaf5bede40fa19422387d224255ed534a866638b22a7a832111cada5496764bc0434cb1aa7365e1d4e0a8ad55545bb05a42a17ae5f2b361ed42c12166a229",
563
+        "providers\/Telnyx\/lib\/ApiOperations\/Create.php": "811f9227ecc5acb172e8e7120541227de0bc22cbf66a41490b743b3e49647a38889d5cfa5d64139b602572f0fcc0fbb96e3971c78801ed9acf7b50db2ab7499c",
564
+        "providers\/Telnyx\/lib\/ApiOperations\/Delete.php": "4c03010d81be8014694e366cf93244dd2f73dfb38fe8a1f3066b6ce179b999967de5a9d3e3140b3076d0dbbeccea329ac750ebb93915ced1e44891ab589f0c7f",
565
+        "providers\/Telnyx\/lib\/ApiOperations\/NestedResource.php": "390efb020ed7c101b32379716bc2111e83273e2a7092da61623f85295c67ad1f6ac2fda617ec91eb28d02ed52a86db9992ee044356f3d96aff2e3474b16da601",
566
+        "providers\/Telnyx\/lib\/ApiOperations\/Request.php": "5b947c7171a05a754fce9c5bcb81f93c1614db086fd4ceef9be1a57977f8bfa7311af0a60a2879d8cb9380c64ddbf7c991738e5b5a4e4b2feb5d88e25c822f3d",
567
+        "providers\/Telnyx\/lib\/ApiOperations\/Retrieve.php": "d2a5aed1aaab9421f2f2b41f69047a70bdea46082e118cd94e087f4082865313d7c67aa037fac194063c53b06d9dccbfa5e65582a9adbbcaaa2982396cbda01c",
568
+        "providers\/Telnyx\/lib\/ApiOperations\/Update.php": "a102e823a46dca1eea6c0bd67b4b7c63bdc0d074c97b42a830de18006782309d3c5f77103b32e82c778f670aade73d3c31f49da49682d9ac204560bd868cd526",
569
+        "providers\/Telnyx\/lib\/ApiRequestor.php": "617ebb71c97dbd896ad736a4e1235f784ea7b89dd73a980a2b259820e3dde0ae935fa532d1fc8e0d9e14a63f843e880e074319bab2f9c519c1ec19467f80bbd7",
570
+        "providers\/Telnyx\/lib\/ApiResource.php": "5adbc90947859652ee20745236c330c5a3124edd3140cb54cb2d4ecb46409d4d825024708b6bc0a44a418f181fd5631a65b41381aae7a55d7c98d80ca9751b5e",
571
+        "providers\/Telnyx\/lib\/ApiResponse.php": "0d292d053a85224f4ac839f54253decab0eec5ae9861ca95314e98cad0fec2d2f0a7e712a8ec433adb302b6702d69262c8866b20fd08d67b2d18571965bf6789",
572
+        "providers\/Telnyx\/lib\/AvailablePhoneNumber.php": "7c82ca4fa28264c4fdd910c71741270657e52cdbc760343339bbb7c1d5980d27b7af476f7e1bd431926d428dba685a6e34d250f9678ef0a4e3cd8c4b06289e55",
573
+        "providers\/Telnyx\/lib\/Collection.php": "8953b7490974401e598cfdba09be005dcc037ff74d7eed660d11afca7a45d62c47f6b6c4f31b3b3003f3d9401599283122034362618a9c3d487eb131d05cfa13",
574
+        "providers\/Telnyx\/lib\/Error\/Api.php": "5c496f65e000a74652c5e7e3c79303befb693e497d67dab4e13287ebe72722c9651fa04c4de4065ea969e140f7a2f74ccaee2ab728f05790ee26200558d0085c",
575
+        "providers\/Telnyx\/lib\/Error\/ApiConnection.php": "469821ef557d096a088d2997f762b4a39c82c49bcf22ca707bcbf611b20006106522150d6365835e0c7e23e3303bd407d78181fb7b5d86bd35095645e68da158",
576
+        "providers\/Telnyx\/lib\/Error\/Authentication.php": "e1c7a938a695fcd8602e5a972086989efd349a6d8d5e3abddbf6f548ba2e1f9bdabe708b5ea75474f7c3588ba7cca8a1dc60970a8be70a80962f90342e67c13c",
577
+        "providers\/Telnyx\/lib\/Error\/Base.php": "9d311a5445b2f3d9c4e25c42094734c3d6243fdc5025c7e5a609ce49d2b2a47f01ea2f163154917f3330e1a92d30a736319c4daf3ae18bb6ddc41d131afae0ff",
578
+        "providers\/Telnyx\/lib\/Error\/Idempotency.php": "cde2f56479baab53e74c6784878c7914e7393b655bfdbf7a36e0619fa9c521671c105c3d5002983b3759989a22eafa0bba7b4aedd4801d7d6b820842c0285e35",
579
+        "providers\/Telnyx\/lib\/Error\/InvalidRequest.php": "0c5748224174c20020155c9f0c734121d07c752460ef63648b08a2392bb6d8b6ff0a9eba13ed1cfb8988545f6dc8c70930de6e78da03c63da0e59bc5fa109a9f",
580
+        "providers\/Telnyx\/lib\/Error\/Permission.php": "3a03b08e77e6fd0897de16d69fb3769707f6fb46717b2a00f1282d7b3e33527f5ca5ea94b6df03c883ea177520140ab2dce4986e0ee0977cce8c375e8a5011fd",
581
+        "providers\/Telnyx\/lib\/Error\/RateLimit.php": "0ceb884f1078559f5bbfbba6153e6bacd6ebc49dac2d047da9e7c64d45c7cff0abc067711366aaec74a4f2736b7205c02ae9de8c214871a82ed1fc53faf4be73",
582
+        "providers\/Telnyx\/lib\/Error\/SignatureVerification.php": "8aec6ea46f62c2b6ecf845cadb726332f89a6c0dd92f4864ac71ffd25268b2af0468cfa83b32a24e91c735ae947498bdc6181efe09857c6bfa799cec721dadda",
583
+        "providers\/Telnyx\/lib\/HttpClient\/ClientInterface.php": "f47e88048bac320e8cabb1b61869f138f84a04858afc3b7aff4de858db9b3efc507d1607037bf07ec5fb1f1df4069b71bf8ec1d0edf953bd1eb8255e67651ae9",
584
+        "providers\/Telnyx\/lib\/HttpClient\/CurlClient.php": "fed4939d221213da7fa7865b4405e5c0b7dc092375e5acd890bfdf178baa6572ec7ac7ad57cb02caab5af24d2aa52763bae1b21679f3b94e6f7ba659cee7a438",
585
+        "providers\/Telnyx\/lib\/Message.php": "18acf4bf51ec27d330df16216924c65a45db59895b610a3c803ef1d09beb7d96d20753b4ec16be06ed40f2886ad46bb3d866f14a87021484ede5d33ac1a93c4a",
586
+        "providers\/Telnyx\/lib\/MessagingPhoneNumber.php": "2a2caa5e44efc5de92ef9b0f8ed0a68af1ab2c80932f4cd7fe79caa87ca1e146af3bd0e1d16d977738da2a3af1fb3cef77081c32a0dac50bbe8ef54a108efbc9",
587
+        "providers\/Telnyx\/lib\/MessagingProfile.php": "351d96a913427c045f534b6993c37fa6ce2ecbdd7a398502ae6447d631ff322ce146cd73dcd1161c999f6bc9ab9764221b4bd3567888dd14c110b98bdc4432b3",
588
+        "providers\/Telnyx\/lib\/NumberOrder.php": "52067d9999c150fbefcbba9969b308bb6118eabe25bd08f30cc4978cdebd68fce4479e53d71ce29632133e8c69bb4ce9276301f5a36ea95bd77d29fd057f5d46",
589
+        "providers\/Telnyx\/lib\/NumberReservation.php": "2b44bfa3fdcce2e21668004d458e9e6bcdb5e33cc37e9a0c980bbdcacec945dc4e06e489bf5b9d0194df00229a79e39bc2a62395d44e4072473441e258841baa",
590
+        "providers\/Telnyx\/lib\/Reporting\/ReportRun.php": "2a7b066db83e08b86e3da4c0b2d041c4d53ce0a1fc95ca3dab76ad2bbf549d74f9a97974be6bbbf0d7b592a814a00b514bb26ad13c7621b5c229f9bc40abac7c",
591
+        "providers\/Telnyx\/lib\/Reporting\/ReportType.php": "92ad055c626d39d9f878666310ffec1c425d4625af9e7803547d50f1684c166ea1dc67d79c35580ae08850bb6e570a81994014e82f4d4080377cfbc664c4fbc5",
592
+        "providers\/Telnyx\/lib\/RequestTelemetry.php": "cefdb55dce61e5f276bd49f6b49e57c78085338537e56cce6fea5a81cd1d2235f1eaa78be326cbd513117be88a046177afb628659088b66ce423799995c53709",
593
+        "providers\/Telnyx\/lib\/ShortCode.php": "4abc882d0dbc72becbff07212d17b8e1383b0efb43818a7eab983fd2a08c3f591a4f4ba2f185003fab0622a43329c969d2fcc80b23cb94410007a0879309ad49",
594
+        "providers\/Telnyx\/lib\/SingletonApiResource.php": "f11599b789dfaef76ef6cf10bade1b426d2e16749bd207c6d08ddd007fea470fdbf0492f9a59cf8bc9f8589aa4532cd6c3887629cf27060696c3f086b0a48673",
595
+        "providers\/Telnyx\/lib\/Telnyx.php": "4971ff61049149242b0cfdca4a15dce213c465ee697cb444eb47da8215eddf2737508164c59393bd7661cf40b1a525afa9fc0df0dae8a071a59f3646a5ec44b9",
596
+        "providers\/Telnyx\/lib\/TelnyxObject.php": "a1bb11b6bfecd69ba694dd34d6309707e916ef45edea1e81e160c572dc404aa4e16841f3be7a82b3965037efef24db7c7c9730fbb65d26e8a188d30fa9af01f6",
597
+        "providers\/Telnyx\/lib\/Util\/AutoPagingIterator.php": "d03ac3841bb553d847be9ea73ab9debd8c1f2c829b0d38ac4416a121ac535a5ece2ecd9943d89e720cb5abb1c907ca9b96df899a561c190ccd6843bde785114b",
598
+        "providers\/Telnyx\/lib\/Util\/CaseInsensitiveArray.php": "bcdf3fba35ae234bc63ba6cdb5429aaa5fd6baed85857991abb9eff854b23eb7a878184ed038636292ac470b67f91c6bf8d79c20a6214d31c872d22fe51833a5",
599
+        "providers\/Telnyx\/lib\/Util\/DefaultLogger.php": "50a69f9f6ad628e489a05fdad0df811c926c957c301adb0b4b906dcce9733a0598f6c2eb126865c54a0100131dc4230a834b1e98275237ce8e90bff2e96cd0fb",
600
+        "providers\/Telnyx\/lib\/Util\/LoggerInterface.php": "8d2dc2c59af5e625eaeef0b85b09f78a42e533b62fee84717d67a4c706fbacd94674f439d3ac60984c0a3947b7d2f5a8ccfb64e071c41d063b8298f57578f88c",
601
+        "providers\/Telnyx\/lib\/Util\/RandomGenerator.php": "292c880420b28390e3d734c6343acd48f322db0c474f80430402916de1dcbf8e988b3d2753a7c18e763e632f474284b213ccc8e8fe4e52f00569e72728dcccb4",
602
+        "providers\/Telnyx\/lib\/Util\/RequestOptions.php": "61a13e62a72e7fc4a1f4d2a707d03ca785af36dd8566e037efa4b1a07d91debe1bccc637bbae6ab9dd836b20a4133cdb7316d6c2628da0d13d2164d6613f1e3f",
603
+        "providers\/Telnyx\/lib\/Util\/Set.php": "1381d2144748a490fd27329fe231e9d3a9a8b428499d4005f9ff18a946c350d8dda1ea90285314a1a99f5d351b1b235ad37a74823c37d7345da8af528dbbba87",
604
+        "providers\/Telnyx\/lib\/Util\/Util.php": "d7c35dbf5a2832ced6059800a6730fbe75338252641edab902adfb134a179d96e162f05bca2902c6c2d99cf4827d5b89b0daac826162c7d460e17017ee405606",
605
+        "providers\/Telnyx\/phpunit.no_autoload.xml": "06ad2f4fe0a292902757629f5605509f32a0d1dca527550619c98a61519d83fc70f3c886b12f5e5734b1031186fd9c7fed6fba813cd816b0f07d36c2a6bf11e4",
606
+        "providers\/Telnyx\/phpunit.xml": "82ac037adc20f2aa76682878094e8bffbfe31782dc6a94e2987bac5546e3ffec90577d03715f4ce481cc977685eec9e4109a61b4b46bc19351c2cad555d7cadf",
607
+        "providers\/Telnyx\/tests\/TelnyxMock.php": "e8e93ca1114530cb7e9cad46eb20e32072934496d515a9391ce8093773450dd60f3288f9d3ba46533a0f650fe67b508d5e54bbfc6e1642443d1fc043b88eaaeb",
608
+        "providers\/Telnyx\/tests\/TestCase.php": "9945df738b56e344648cc00d3d4b94345c15d8749ce511b5095a87d5e52aed35d8e3c773276d9dde9d9fa04eada784a55e4876ebf70a198ba719c8e94c8c32d8",
609
+        "providers\/Telnyx\/tests\/api_resources\/AlphanumericSenderIDTest.php": "1db47c5c215f1dccbc0456035edb1619cb7575dfe2b152924a6e1abe4a021bf63be3b1d1cf1b86285c5425f5df46c8e396cd66b6ff6a27534e402e145e5fb194",
610
+        "providers\/Telnyx\/tests\/api_resources\/AvailablePhoneNumberTest.php": "823ab5138035a84a790d70c9bc5964e7aa163f195aeaa2fb50d2cfc7068f1a77440f09a134bec36a187cf57cca6c735b428b225239a263aa26cc5cecbecdf6d5",
611
+        "providers\/Telnyx\/tests\/api_resources\/CollectionTest.php": "af248a4d4c4504f5fb7148e8f5ddbce3a05cc859a761f57cffb8335be10b07ef6d4e808002601f92eff2968e86873fbbc3fad838420db0694f81b9cd95091452",
612
+        "providers\/Telnyx\/tests\/api_resources\/MessageTest.php": "a616a69339b599526dfd24a25d8e99eefc99c2341bb7d4f635d1b4984f41dc38a3eb6bca3e4242caccb974b141a490624669b5c2b2f5315b6cb07540d74fcad7",
613
+        "providers\/Telnyx\/tests\/api_resources\/MessagingPhoneNumberTest.php": "40409c270a6f9a683bc690f6e91051fe1ac4c8a6cb1b4e5536416d64fc3f8c81f327f33e562ee94cee1481e0ec2f13148b0dc3f76f3f20a49a9d80adfa5c1afa",
614
+        "providers\/Telnyx\/tests\/api_resources\/MessagingProfileTest.php": "1ca7abc2b47f221b491ebbe7def5569deada6eaf4184bd6e6327f7bf2da15669d1fff581e24c466621e8462e816c0a12d02e0aa1d91aa3746092f8a09a9131ae",
615
+        "providers\/Telnyx\/tests\/api_resources\/NumberOrderTest.php": "dd6e4382dcdb0cd60ded9d9db6262bbc7f523e8f5eb842e15655fe8ba4e24ad5192b8be40bbc762de2c62de3aeec31e1373063420a99e39bf02f5bf74915d5ab",
616
+        "providers\/Telnyx\/tests\/api_resources\/NumberReservationTest.php": "8b8386c0e044e120b6d60f97433c9ecf0ddc272f805034768300bf01bfbc731a3f6f964758e509d650013df03bca66eb1db13fa1a24315df76ea55fd86287fd6",
617
+        "providers\/Telnyx\/tests\/api_resources\/ShortCodeTest.php": "8aef092868b89adda6517905c7f05245b3c39affed4c7723e5a32cf17b8e39528e8925923aad4b2add5a0bbce9049a8f934141b87a790fcb002eaf77aa494258",
618
+        "providers\/Telnyx\/tests\/bootstrap.no_autoload.php": "cb002f7c8f77834b6414db6535f083bcd227ee6085363fa3cb0f66b55226680a45c8562fd8458249868465957b2aeae134b3379f8ee2ed22c96425475e9c0af1",
619
+        "providers\/Telnyx\/tests\/bootstrap.php": "50e143ed68aceb91d3e119d5a31521e76bfe9876bd780c90ac83afb7ca4f32be48ff81c33c134109eafe1d22f35e0957a9a834966b8853df99dc1df04795adf4",
620
+        "providers\/Telnyx\/tests\/data\/test.png": "6ad523f5b65487369d305613366b9f68dcdeee225291766e3b25faf45439ca069f614030c08ca54c714fdbf7a944fac489b1515a8bf9e0d3191e1bcbbfe6a9df",
621
+        "providers\/Telnyx\/tests\/openapi\/README.md": "0c54fffd5b7a5f393358864ff9e3bd3793075d6060cc1336603b2455d60f16d160ffd47b52bca6834acf0d9713855b386f69580099a3dcc131e8d5d617975ff2",
622
+        "providers\/Telnyx\/update_certs.php": "46dfc1129c3dff2211cdd8274fadd8629c450e94a7a1c8527373221b25a0664b6043d6b007351ac9afa4b40ba349a7fdbf4ad2e088cf0a8d864f7cbb81145fb9",
623
+        "providers\/Telnyx\/vendor\/autoload.php": "1d4735a3ebfd65901ce478f8bb98ac576ef9ba2706f17a1c6ab125979a882ec7ff463b577fed1c418f817c1a56e842fc25b6aeb8e7ce6dcdd554a25e03959c3a",
624
+        "providers\/Telnyx\/vendor\/composer\/ClassLoader.php": "866e8cbde808b4e7774c5d9e2bdda44e84ff9bc84268785aff1a75277bd7918dc26ceeb27732718c9ea93756777ec0d16c09c15f9c1179be3cbb410c7914d295",
625
+        "providers\/Telnyx\/vendor\/composer\/InstalledVersions.php": "86ebb1216b59b01b7cd1f3b2e66311cd6295b58fab91a9a82603f903c6d2f716d7697a82d625372538f809e9e45f7dbd257a00e2b95d23c3785e4eeb3a6ebb60",
626
+        "providers\/Telnyx\/vendor\/composer\/LICENSE": "f3bb64009f41a425df5a9bbab53490f0eb9b74fa8d6aaa2f57efb928edc4ffff330260666edeaa04a91fed708c3663371cf01b284f3a08d6698aaef7a23f355a",
627
+        "providers\/Telnyx\/vendor\/composer\/autoload_classmap.php": "a298b75d605ec9a330a5efe11769e79f02cf202f49d8b241afbd175c7fcfa0ac4db8e72a29aa1d839138e3b181fbfeca525181eb57e998a4a2c14ec9e457cf1a",
628
+        "providers\/Telnyx\/vendor\/composer\/autoload_files.php": "107b2d75757e7b39e2d279e373fd4291d57e91a7f442b0f880b51d07e7119beb9d41d1cdf916131bba717e8da953e2117ff83f1bd9ef850fc1d9056d0f02996f",
629
+        "providers\/Telnyx\/vendor\/composer\/autoload_namespaces.php": "30324cf2dc20c214c5b5c8fdc2099b67772149ddea1d1d51969c711be9a83d036e43746c600f958a6b49969b16a10ef93e9b1e3d5af9714721ead916b9aef344",
630
+        "providers\/Telnyx\/vendor\/composer\/autoload_psr4.php": "02804e683dc13b4eb2ad98284be2dff3eeb97f0ae9054c3a45641ce7e6144a3b5f34ae36eb764fd2faae39fe5dd4131b4dffd4649c6ba3220ef24aeab45efcb4",
631
+        "providers\/Telnyx\/vendor\/composer\/autoload_real.php": "469f95fde429006c3262cabe72cd49970b0cd6098b743d8e5a646af25679dfe539c98d3337b51a8faf7f30d9c64e1def8d131a93e8897f801830e7e1c4da5874",
632
+        "providers\/Telnyx\/vendor\/composer\/autoload_static.php": "4845f043e32744886f456f358ea87cdcfd641508151ba6c3b0169c9aa53fe111f05b78b82e204368da01da68d7007709c9140d08dce4e7dca3cc4c9f60397dcb",
633
+        "providers\/Telnyx\/vendor\/composer\/installed.json": "5ca47a408f164e118f7ccba81577933913002efce47331f2eeb13f3e24d78878521db08454026d270deaa6552095260d745f0a424c91eb7efd36f6a9a20adfba",
634
+        "providers\/Telnyx\/vendor\/composer\/installed.php": "38fb24f1f4e4aa0435926d601c7b78797c231eb0e3621e370b17078645f5d238a1d02da3a29cd14a9125f78f53964445f4326311f6e830cf8faa24e944215ce4",
635
+        "providers\/Telnyx\/vendor\/composer\/platform_check.php": "4d385b31994301facce94382fa007a56ee32268d2e1cdbe7c9f9cfa834ed4195d3cf8e8e7c9a800c97aafe2c9b46f3c1a93e632c7415e8a9e4a282c083cc6f9a",
636
+        "providers\/Telnyx\/vendor\/paragonie\/random_compat\/LICENSE": "0c0bf603f7e196edaf56d02acbb2e14df7f73a2da0617d62b5fc811f088c29865ecdbc7c6925a19bda63132cc651c56f1cdac79dfa02aaeb3fcca49033636ee0",
637
+        "providers\/Telnyx\/vendor\/paragonie\/random_compat\/build-phar.sh": "a5ecc580bc6e95a9c901ad1a0097fd47ab857dee79d0221ae463e27f27cc8b2227e1975ab2699b9d0782f0b0396ed9b3ac0106f53fe61315cd2954ae54beb333",
638
+        "providers\/Telnyx\/vendor\/paragonie\/random_compat\/composer.json": "c400438df2f41ace7bff40d284236bb06c6095ac03b58caef5b062e7ef317bac5a6bf551c94459ffc838acdae7df6cdfc615dfc3cbecd16be37ba67bd948415f",
639
+        "providers\/Telnyx\/vendor\/paragonie\/random_compat\/dist\/random_compat.phar.pubkey": "e8909663e5350be2fa9416e28c6b179c41e87feab8da0d6fa6a41c294c9b00e8cc40ae8bcd03997770056f70d946315fd530f72f42974f63195f14b3c675e3c9",
640
+        "providers\/Telnyx\/vendor\/paragonie\/random_compat\/dist\/random_compat.phar.pubkey.asc": "f07fb9c7b00f297e73127dddb1f3986fcebdb0760454765f6ce0977347919c0c74ea197ed310bcd86dca7ed227812bfa6d1595c44e40f10c085cbcbf602e163f",
641
+        "providers\/Telnyx\/vendor\/paragonie\/random_compat\/lib\/random.php": "fe4539e2b55b47dfff1e2256c91498e5a41a85e28e42d790fdbcc42102c16abb09b0d7a0e2268ee004c555e1001241a9925fab1eeaa16c11ae2188e1f01540b9",
642
+        "providers\/Telnyx\/vendor\/paragonie\/random_compat\/other\/build_phar.php": "370c622746a37b65aa6e36c2fb94486b4fb01f2db3f3c9539a7fde711d1abe3f9e9c30bc61f4200e6da9b47086c207b03cd7258d77dd2ea6b48126a618e2fa0e",
643
+        "providers\/Telnyx\/vendor\/paragonie\/random_compat\/psalm-autoload.php": "f05ea11c8e973ddffde4d60688b161701217ac8e5c9237cfb57babf7113482d5e19ea441f5092eb1448a21b95ceed75f994427d6febfe0de100c376ed17e91c3",
644
+        "providers\/Telnyx\/vendor\/paragonie\/random_compat\/psalm.xml": "88c631fb2f70a79d0e56a4484fb7ae8b6b3502ed2a9599757e7a3302c42b0adfc6f0c45c9916b88d7430f209d8934b6121221dd8b424dd913c49236db7ef01c4",
645
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/LICENSE": "db260eb10b8775cb408f675dcbe11bfb1a738d638f4215467df6c4bd03b8265dec7712fffa30dbcd38b5ef944266c3963343d033f497eaa6dc602f55fdd8729d",
646
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/README.md": "82f123f85b02a7e91c3ebece404b85ef5a0950e0ca79bb0841735a5a03b88d1a3efed4bc8229b3ee1db245471cf58b81923ac9800586ace3b794421f379f7bb3",
647
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/appveyor.yml": "ed6f025871e47d5afb1eda2e0705a2185670c447279cadd8c0fa796779fa2f1d7a5f17efaf6412c403e40bee345ac3224a45f9aa0e5143f06ea5e25ba8cb848a",
648
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/autoload-fast.php": "a40c6c77f211a2257d3339ad80ae7197ede8ba0a94c76b48052cfbcc8ce903959dbd8e3434e6660bfce2c5e935cb9f38568f96cf00819d03f4a1c46cd6b7b0b1",
649
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/autoload-pedantic.php": "c1a0e8a5b461135bc58ebf0a37d75e865d9e44ce666aba9a95d6416cc7d57a834aae6fb6ef4a9cb4176690a4e41cdd8638106a11b32a155f3a8ca3acebf7a504",
650
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/autoload-php7.php": "0ac98043c8df48e7bdd3a20c11688ad3702a06271687e1019c2a7288288532ea593e7e462635b806c0b18dacbb8f2bd6d9c700a61d2b1deb90eba0b49660b008",
651
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/autoload-phpunit.php": "d34cda9cd77a67d93817d5b9b1bb51a13521b2539f9a8d0189debb1938934df1d5fd51fd2a82c9d4775f5a8613708a1e78687fab86c3afdc356bc4b02045bc66",
652
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/autoload.php": "91c2a6366a27a76a0390c69dc4cf061c73cb03a22a3303aad673cd08e8cd659c7fa7e6796acdd9d2d271f015eb16b15663c5d21d8a538fe14f459519c9f9e8d1",
653
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/build-phar.sh": "5bc154a32c62797e85b82595da69ed11676d98deb9644b62a12d5ec169d3edfd4d3b24c67170143f12ca63d9bea06cd0803f68d5e63a7849ea9c4dc9483f7b4e",
654
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/composer-php52.json": "10cd40189c6ef385b9e21311b8b2bc8f7943273552227c8006a38889d743fde82c8c61286484d59bebfb83e645a87cf6d99f29409439a1057fd16a4ca7727417",
655
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/composer.json": "e9b03b450c47dc1a593e35493c7c80c373f958ac5ddbe89a163f15e7a30a8139ac0f9868466610899e3d5e5d573d517bf09acfc68d2b9420e3301b39e7736aad",
656
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/dist\/Makefile": "1cb0cca3e1413538bad70b8c8a22dd68d17bcb6450e0c4ee41fab9fab09c36bffb4816dd0f7ea2f40ca1b4cec6b030c5c0cc17955d2c83ec08759e748b04d965",
657
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/dist\/box.json": "47543b120abf7596f26b58f9911963e9bd0cbe2297b65d43f74dc52130e503ce09049a4be53146387b7fb42b7640f6577e3c1f4862540d4f8a0e668b0001e62c",
658
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/lib\/constants.php": "4e0597dadc39ae7b81e46ef5f3f045812a11753d9116215bf0d905e0bb3760bc44639988f1ec8f0ae8998f507e0c99eecbd19705f5399edfacb87172d7a577ba",
659
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/lib\/namespaced.php": "c550633d5dbd23c1bb2fe9a14b787e239bd5fa898932ddb8a1b1f8909a57393e01f12337fcc53f54b24bc48a97c3ed89de03da089ffbea71ef90d48c5091e200",
660
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/lib\/php72compat.php": "85b52455b2764ef4b80d60b8d99d5f65264b2a2e7d770b2ab05871a5aad213ad35f2cd755a8b5d19b5ddcea758c024175480f2dbc89ec75dc86ccdb453f5fc25",
661
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/lib\/php72compat_const.php": "177d6b1b8fb5286842400019be1465fa0438e06dfce2fbf5e93e93d0715c161ad07c0c31c17394cb0c6673a058f34544454cc0845893242dfb5a998655c93701",
662
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/lib\/ristretto255.php": "f2c36f65a9a556c43bf9f2fcad02f1c87c29d89bb5b3d81634112defbae7ac0c85e558fb3b5a5e74d95906a4b543e7a2cf16fd444ff28888ef09d73fb9e6b6f9",
663
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/lib\/sodium_compat.php": "75e3119fb1d400aba554506a562c64c1b1b82e66277383bf307406fd1f4c68499a32b82108529d5af99878890e3551dfd1fef1ab62ae86982c27dc975dd39155",
664
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/lib\/stream-xchacha20.php": "4cf0cb7bf023249c18f2261057f994faf8c4233022651285fdf8978fe9a71d7eae0511ea1f64faf2f3fcb1ae5b010112a5a4ebe8df9fea7ce908916cc2ec90af",
665
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Compat.php": "7a8389a0ca9cb8e544b7f345c60705e1cca41769105531211219142f15c83bd60b442dbe8bd62042a5fddf31040a19ba1f3f00ba6c2a44c3160089a2605099da",
666
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/BLAKE2b.php": "91aa0293c7c821d238f36fbb1f4327e67a718b53c13f0ea0f4d6e1d1675618bdadf183d842d4dea103017be863d40762a20c644a4f3619c7549991f11a19445b",
667
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/ChaCha20.php": "7e09160954fc59c77890f28e75f7ce8b75fdf08b9d5461c5e7dc1f49bc664bcb1b7ac74e3f5437657a20729c2db965d968060b27309a4a06a252d22b7f8dd4f6",
668
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/ChaCha20\/Ctx.php": "f19f61e54d42bf154182d203594613371f430d7c78f5b8229cb9bb94e19e42bb9a8e434639accff18497cd728ef391a1128d0145b8958f8d4350ee340340df39",
669
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/ChaCha20\/IetfCtx.php": "41ac6fb53ae553db13ef5c12d8c1c16d017267f130e8a00e9c2a8ad10d723aaee5ee08f2888f016babe4d712a0f1fa50012e4ebe6626b34973c26ad6728e36da",
670
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Curve25519.php": "5404d91b94a8e6c442c3eb30b763f1dd0c1234b845b967b7048f71d5a0b6e1ab287b44f43e06ae5bd6fce31f78154b8655353d7df86b6ac699a41200b9df33d7",
671
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Curve25519\/Fe.php": "937defa56e99d4f38a81b88c03c649deca5b0f41f5d0b8e340cadccb34ef0677563f18967bb9f63e9547137a2a1827f9e37c62005fe745aff3764e39adf86cee",
672
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Curve25519\/Ge\/Cached.php": "3db1263681f9414d237a8318c08ad07bbe3279b7310e21a40c22033f5d90eb5d7074dbde430eec7910a8d7e4286fa6c0131938c92045520f56fe6acc37af70af",
673
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Curve25519\/Ge\/P1p1.php": "d757efd8638aa0c1609d59c47f3b18608a0fc6e1e5bc3cb94f16fd3fa2d6125872a796f4837cd8b940ca6988db92d3c668bba684c721476ee5fdb6fb6d50670e",
674
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Curve25519\/Ge\/P2.php": "cd70c62efef16eb21967d5bb0489dadef845fb3cd4faf0b1bb7d080a8685164b2b0fde4d8865dec22037795eea6df605dc2151f20871c31d5e9e0084f0066219",
675
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Curve25519\/Ge\/P3.php": "56c14b848691af72c00f5dcc3d31281a300d0ea9b6ec273ff929cf30d2279cf34d51891729a5b095445fffa8a63b8c8147f4d1ea24935c86b0216b3c40aa4241",
676
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Curve25519\/Ge\/Precomp.php": "f6c53daf36931b4289248a231da52759e91e5c38af10b2cb89a1bd7e55d29e316dc77d144fb9e52ca1cbf50db84234aeebf13603c62d58d5b3ee58dc19cc18f0",
677
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Curve25519\/H.php": "c2e48f6273cabcdc40f20fd0f7ea55975fc9da5a419b1c9cb834b694c858533f9a0d3e3ce768b532ea6b69ff5d2df1ae4c246a15b7129916d4034ac497ca2be4",
678
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Ed25519.php": "eda61c7ee144449df655ea9a9142d0b26624644542012652598bdc51493f61938c13651b32b05e942d31d3cfbfb7899b8621f4ebd8a5909a1ed12704b2bcfbca",
679
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/HChaCha20.php": "b5005439c15ef7aed83b566e670053819f59c415d9c5f607550c756622d7161ca32fe65dad8f688e6a292f88192637260d859302064b416465c08bbf7f6dbe13",
680
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/HSalsa20.php": "c882b541376c8eea8ab3bb63d8b51dddb345cc45ade8d5d264dbaa96427f72f0201aea828e696808155da7a978c4a1fad09723d42ec393117693e48187cf2a4f",
681
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Poly1305.php": "c438e61d6b330be26cff863f8b5c42fa3284d6e8abdd1e43a2023c2695dec643d2641b2239a9b0fbea1a34e9e8011d5094b4eb024b111b6fa903a1c026328747",
682
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Poly1305\/State.php": "4558eb5b05c7664408a4e793c2b85a4c2593ab8a1118c3b89db712f337a12346e2e882a0c638c32af733f5589a310b4a528c9bc02c136692ae82f3ac7e6cddab",
683
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Salsa20.php": "2836d7eeeec597187c456ec790107a5dc478a1f79c1c1e4ede4314bb830f865f189e048e3dc55742703e2fb7bf31275f515cca57ab5bc47332961bbdcac7c490",
684
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/SipHash.php": "345fc6b9f37659ec9830c9b3bd1459257b81568dc73809c023c551dd825981b0da6b150b6b7cd57b00097ae9cd3b742d730ebfda2d2e459ebd7d5257fc967156",
685
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Util.php": "81aac8187fcd44a14ae856e34d7337c012ff3603c606e1b9ff5a95fd5cdeb962725b70672a57b600d344fb2f34aeea00ddc8f1d4d8f8888961fae9171f8262d1",
686
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/X25519.php": "d11fca34bc3d313e365ca47981a0efb880a3cc8be3e2cb00da7df69de8d52f2f1fc793c1654cce1385ea66aec40eb5339c5cbf120c127cb399b72fe84b7297c4",
687
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/XChaCha20.php": "de5d7f3dd4402fe3c99b66a92fa4f0766beec66928c8996b3754b2f7a8869b65035c6ebafcc8ba2fe9b309adf541e89eba9491554f1ba548af6139770aedabf8",
688
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Core\/Xsalsa20.php": "6abb7e9217d5463d373023d5aab49c41cd3e1026835985dd13256e68374ef63b90b7dd033f7fe14ea60229a98e5e64d0d0f23b7a382ecc9d8b41746bbe3fec11",
689
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/Crypto.php": "257d3d05f1acc745b21f25652ddf0b09b5a68b2b75abaa9216bee10ea958f8ed1d3c964dda5326216366d9cca4a71e8678c23994fd07eca2582e3d8c8aa75500",
690
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/namespaced\/File.php": "d7cce5179670dc18544eace3bf8b8b9863e62fc9520526da2870e45d5d400004fdeeb3c0f44a90caf0742f89b633e7fe3f996bd5f89af4c7f52ea37f429e453b",
691
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/phpunit.xml.dist": "0f8b25b7effe47068dfafdc568c3298d7c5f2d4eb1abc040c8dcda1b0daea8523a1f82d8e00d6475ffde3cb566c18d17ccfd07db59c72bda11f40d555b692d32",
692
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/psalm-above-3.xml": "5bb5402c96cd45a0d88542bfaa12ee03c26c3242f42f1e33a2a32e5a16143e6b66e7dd4bca7cbe30f73ee9eea7e72862e356f1bc4c4daaaaf1ebcb248d63b230",
693
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/psalm-below-3.xml": "9ef67d2d8ee81c94d0ed80d592894be0c200045b295178f246865d12a54d963e97b4a8d75ab88595bbb73d74c75ab2275a54b9a33733bea2d15487c5894f515c",
694
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Compat.php": "1c233a4b931c13b00e243f699eed9e81fc683846e089a24ad90dd17f786bfdec9ab32509eb9666074c9fc2a168ea8d411144274e6c4d4413996c78bd3c536515",
695
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/BLAKE2b.php": "27fdd20dc655cc7f58454cfa97fb974e4d99f6da5b97d79e669d41b9c5bfd1be18fa34f0ef7a353731a3bebb11b56fcb68818cabb3d8ff026682e7b39106c6f5",
696
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Base64\/Common.php": "c8512fc6d570a3198107493c7b8d20f38539caec221adb14161d7efbd6ab7d1d0bef4cb5528fcd84cd9484f1a9e0fbeb45aaa2365012680b0106ea92f8873281",
697
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Base64\/Original.php": "4564f7cfef60c318abe626832bcd355cffbe04d020e04d18c5554fc1610c4a1b0ae8d1111681e2a458ae0b9d7ef3528bd62aef019fe3c1a3f9d28b5ae58da86f",
698
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Base64\/UrlSafe.php": "dcbd158a52f33b9c64c8046c8f091d9af95657a562ac694c9ac0beb3a1876d55a3f23cd42c1777d9cf2a55cdae38d88ec54628b2d5fccd6befc92d4d51eaca2a",
699
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/ChaCha20.php": "f0015a4f95fb6028c015c954992233d76ff0b07c7c60de6347e7b7ff1cf704e80de4ed5b3e236502fddd3c56071aa8012758d905031d6154f965c4898251329c",
700
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/ChaCha20\/Ctx.php": "aeb8c31a1bb46b8519f280f23d349fa93911bf766715c0964c0a901369d0f0599e87c6e13459734f582a04ce74d9ba9f3ed7553d4b7214855a815424a8a8610d",
701
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/ChaCha20\/IetfCtx.php": "d22a84b5bbe07297fa80c989e93681b27b3ee502a9b77b63e2b08eccdca03cb98c39834feec5fce3cb0e1915f2944b06e94fe555da123de982fedc61b30c1f91",
702
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Curve25519.php": "b25ba0383cbaa00339f5cbaff6b400a25f3bd4d244d2fe70a08b987ead0ebb04a7f51b9476baf01fea5967610911f809114e39d21d4e278a9be72b48ca39b09e",
703
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Curve25519\/Fe.php": "0fad7d424e7f3fbc0abd6a4f9113c83523aadc3f9d3423a94da0954f56d31705ca567ffad0972794bfbba00c4909c8638130b99a983cc52022d262d6b7d145bb",
704
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Curve25519\/Ge\/Cached.php": "58ed8181f08dd61076c0ae9ce176455d951de04b9b1b03260c593d009414e9757d9120ea9e94040ddc1e0867f8a6574dc55e3acf82f946100d03d4506c9f778b",
705
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Curve25519\/Ge\/P1p1.php": "63b5f5a6c7061826799c2e3285884ac2108adb19ea246475b98fb68a26aebd694eeba56191fe15fbc1a9ecb9b85c139bf9e8b65b4456b8fb42652fcf29097fad",
706
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Curve25519\/Ge\/P2.php": "4caf0b912ad4bd82f8c447fc25829177323ba7af6d2355a7709b8ef99a855b51158e5252a1739cf6e9ae72b780e415af0cf3d510bded3fbce3542c99cf057535",
707
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Curve25519\/Ge\/P3.php": "5bd84bc8087c48e62e9d29451c0165376ae8486ad9288556c81e4cb897822cdaf95a2df6093f16e2a336839d0a4ea7c1535361bf041d8be0fddeb1eb245eae55",
708
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Curve25519\/Ge\/Precomp.php": "a58cbf2c93a75948b4576395ba1ebcef5a35b6dfb4625690e872010a44edd92939ba146b145cf40bc2cb6e45da0e19f169a45b575d813a70428f171459ee2d8c",
709
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Curve25519\/H.php": "0ce669e4f370acdbf6cf27d5a525b0a3a3bb7c794b8a2ccc7b2f3a3670fbb048a8493e3e6306a5f148204f50a5458d47ffe4a2705520e15631b02d45d39b0676",
710
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Curve25519\/README.md": "3f50765b54a3cf172c9cdaf2541a54273b811df61330af83883de5309103d6309a0900ecbae056f60aa831e438543c16c809fe183cc15c6a2f2bf15f6f910cf7",
711
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Ed25519.php": "89eada60bdd8739af528cd74b771a2ac04e36aa3e588549c7e8a82d2267a4df5eb4ef13c806185ac65bcd33fcba0f49a03cdbc03f143ffaa576ba6f4ab5efaa7",
712
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/HChaCha20.php": "e221d5f3c4818256a895cc05a8e68ae2b3cced7eaf4e425f3c373d59b2cec31fa7b498e5e42af7e374e70c3a176f966da3cccc4be97b646182a8bef2817986cd",
713
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/HSalsa20.php": "05e5376ceaa53ddb24971a43ded855892cf37fe0f03647660f573334ca79e61edafdd511c418cdb3d42e62298462e729c69b4dae3eb802c4749774b43d659536",
714
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Poly1305.php": "1bc3f6e6323d44ab76eca14cce61e7043ee98d8f7c50f29a5e29704c35adee345faaac767af588e1c6566f5732c1ec40ea815c51711056737460c9143adef1e8",
715
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Poly1305\/State.php": "9a69f92ff7c3e384cd57c0d5fddf9111d57abc9849acebb329ffd1ac4f53e539e1548140f4a430f628cb378d7fc980494307df13e4d1837b0af377bd7811c6d5",
716
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Ristretto255.php": "c4fcc5c22d8ece4e704c847ca01ce6edba7682fb2b9b91d74d664a204cd5955128c3bf8089a855312244f28c4ef6953927832ed989a03edf6eaec5c26df1722e",
717
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Salsa20.php": "8c2ad19b46f527ef9c091cbab17f64d36610745ef32f778e3911e1aa2a142e88c0f6e005ced046a678d66982d2e9ca48677f082697af3999cb62fecee4d800bb",
718
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/SecretStream\/State.php": "629c6f96a7bba323ddb8eb422e7048839c188560932cb4306b9f11ba8a2b15afdfc037fc14ce8725ed3efc72c26700cf6cd2ca4a85870fa885aad6b6d57a4a0c",
719
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/SipHash.php": "6f24cd7d32eb80c943461199a0937b0acdf01560542c54ca916fae6843c3dc5fa65d751380434508aa50501f7dfb6c227e9330996956c4a8c8b32b6ae55bebba",
720
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/Util.php": "fe12c7259ad5daa7eecd8e199c77f822e612333169878309cec5b5483a9bcc775261c344a31023c2741d53f37f05a0f6dc6289dc45c7d7b8ac7fedafd5458d57",
721
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/X25519.php": "ea1d665ec23534de7f18c4f48094de4463753baf8b9ba011e38b969873bbaaa32e6b90bbbd0597baed3687c28e37fe394c224a229d734671b7d7e03197d039f1",
722
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/XChaCha20.php": "56d827be22c68fe9a2cc01b9f5890846197c5831c3c0f129d9b8c522391b7d7391a217a2dc48a4bd78e81c3d2f3bd8187546d311f991148fdf43a8a67730c81e",
723
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core\/XSalsa20.php": "c0367d97622bfb654340a6a7948e8ca4ed399d106dd8b27169a9f5d9bc6532129548b4dabf9f12ffba654f490b8adfa07b0b76935bda15705560feb7c590a3bb",
724
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/BLAKE2b.php": "97cb339b44cc54299394b4fc27c8ab13d5a8d48aa4c8fce71733a27cea5d3226df4341bf9722fb4f4ba71c38f5491d677774245d75bd91a693269aaba0487036",
725
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/ChaCha20.php": "da693dd0be25c739b477673933d361ed4b2f83110ae98f7c6805af20789fb4379b4b7a4ae34aca588666cfbdf61c2dd5776f8a4b1ee0215dae64ea09c6479a10",
726
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/ChaCha20\/Ctx.php": "621194fbbe2eb42c04c9d94e45e3a0ebafdb4cd87195b924705f8c2a9e54c9dc52fa6dcb39967ea1dc4ceeb6f2d20659a1b0aced8035529376f6244ffaa96f07",
727
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/ChaCha20\/IetfCtx.php": "b4a0690f9af7ace9fb3f8c10ca78989573a1cd49d3309f9c0011501daa3c44f7b616868e417096076846b19502ddaaaacb7c85f9b5c8622c57e4882982e09a10",
728
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Curve25519.php": "fd10531c29a88f84f8b7de7c09a0e9e66472658827bcbdc55dcb1fba54f620b32dfe9359788e67abe4f6ffed3e4841e6b74939d7504188cfda243512a86c7eb4",
729
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Curve25519\/Fe.php": "e6e5ce11b327d42167d51d2fa462ca6a54bf180229261af9ac1189fab30941148136ddabfff606dcf656985cb9da9bee93902f1863a84a3e5d42bfccbb0111d3",
730
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Curve25519\/Ge\/Cached.php": "350f529a5a178921a2f40818a1668c3effdeac12b9b8aded2f57f1654343d0f7f535c780c5a271d9b7772969fff9381befcb85aaf676650c67b6e583d616c064",
731
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Curve25519\/Ge\/P1p1.php": "fc8344d196cfa17fb61ab576b0a73f0ecbdfdf03de53d669cbf56bf10cf13eabd8c8a83d3eab7d9f9436b4dbb8d0785f9929c190059e0695579811405f3c840a",
732
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Curve25519\/Ge\/P2.php": "6c4051bff3e25a7863fcfef3b9c1f028fa8b94d301e4de5dcb6654c629bc95f44978fdb697698375e3cfd1dfb9ae6a3c8dfcad0bd5138e51cd5d5315b5e5b788",
733
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Curve25519\/Ge\/P3.php": "d6ee2e6bd34cba83a2025bd79e2d8a829d39f148c65ceee5a382662ef25b1c684552e0486ca29215f52d5d1e140176bdf6e2c40febd55970db55675b76d448e2",
734
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Curve25519\/Ge\/Precomp.php": "397b94e8292ad4f09cc37f1b08a7f364e12d6acb74f125ff0148c5562631f632a2ecc44db517cbd5ea61865e70732e6223a0c736b831c751df859a7d2afc4ae6",
735
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Curve25519\/H.php": "7bd14df9e3afbf8bc2ba27d5faf6ba72f17eed218cb7e89f4a458f500f6d9a60c52eaf5f1fd656d7de492246b0b0ac3d5904da319c5d85b754c64ce4b1f1b433",
736
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Curve25519\/README.md": "3f50765b54a3cf172c9cdaf2541a54273b811df61330af83883de5309103d6309a0900ecbae056f60aa831e438543c16c809fe183cc15c6a2f2bf15f6f910cf7",
737
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Ed25519.php": "30b970fe798803452a504ac453c70b5a2b51cf3094639dc58195b3c8e44fc37089c58bec2337d7f79ca60c91c4951af5dfa89e9dfbe3ae327084a806a6b8db7f",
738
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/HChaCha20.php": "d4fdd553cde5a1ff277805bbba85128e3ea59e4fc32eaacbc8502414148933c760ef6da06fd967bc594f9d22523c62e45ebd7cc9411ad4b76e2d76c0fc2c00c5",
739
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/HSalsa20.php": "8bbde85156bb88b6f0f14cab67840cabf1e1c456f9459edc145e09907161bd6fbea93fd37f121678064de6922102e78789cbfa3c2eddfcb40b93178fa3fbab6e",
740
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Int32.php": "325772c5cadd6953316e83afe2a04804041292f25cb16e6027ea230e20aebcdd819c937977918161eeb9c43187fc105be2824949c9d6059e9c0a39e0cbc42219",
741
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Int64.php": "8fde2b57266d78e8b03d8c3f89a1fbca3329bb6d0ed4526b3c6dbf5a0e92ef9d8e9e3697cd23b7eb5f7524fba7474cc5a2e06f1ba6faa04f7cb8729c985a5794",
742
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Poly1305.php": "f0cc2f5cf32a37ad6c3dbaff1a8a155ff334995eab78ab42f2e5bd950390babaee0c1588e3f17d4e73cf970b8e3c34f536096d7da23182f526b0eed704e3ecc8",
743
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Poly1305\/State.php": "8656ebf7aa0c2c7e8cf01546a261bf5e9f6c374eb5f40f8133bcb33e35bda2f19f47471b2ae6af6224df7ab9bf3886cc43b88049e8ddbe54b8dd129b28491129",
744
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Salsa20.php": "bbb3dc0a30030d9c5f5ef1ef63e36f9a067d67891185b9620ebee17a67bee31a7abc420abb7b82f38e913b5de54d235859f0e8f5f718d8f02316f4fb03e24b2a",
745
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/SecretStream\/State.php": "69d505517dbbdd2e77cf5aed72673edffa2aa008e70325db88877ba5673ac3ac070bc4c19cf13707932b0b4d71ee0a9b007e06a0f822292ec278a60def7cf511",
746
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/SipHash.php": "8c3c2d2e4c656ee6f7af729856cc4c79918ae2e09a167d6d0cb92f7dc9240c0bdaa36e65a167f5b63961d9f9ac4df2c19e50c848e5a6da5855566deb5b9ab8b4",
747
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/Util.php": "d6ff44eb1015687847600f8b7f6a80974f4de1cb80224ea7f733e908fd53ba2aa669b97d891fe89bf0bb8d358c15a2bbf0661a779e68a715cde0405455127eb4",
748
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/X25519.php": "9e2d803c100fc9a3749100dda30fabe25c6ec59382be64f9995b6505e1652d5b2762111f2243b69316abd942c88106fa5239adcae842971f22fedd8e3aedd954",
749
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/XChaCha20.php": "1d4ef660701da25af79c9d4af2f158e3f62afbc1e5c2aa062f64b970dd33378d5f67c9f0172991985ddd65a976759e09f4604ffdf6ae158bd8a98f4e97af851d",
750
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Core32\/XSalsa20.php": "ffcbccb7d8a1d0262c5e74cbc679022bbcf1acf9160599ce2b92f66e261996f0e93b419231fd41ca95852e09b7a892dd8e98101c3426d30cb294f869908ee21b",
751
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Crypto.php": "1af076765319483b5e0c2a3ed9d5a12133fd41b7172cd15073da3723200c41cdf077dbee04f1e4badc2b86ee5e23965dfd0e8f3af3f52b3b584ab2f775f64cf7",
752
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/Crypto32.php": "9fd3ecc6e6faec645f2c5166ca551cbb4ff8430664bdb46c383da399048de42ab505a05c709b6ed0de245402a1abd701f21398252f059003a59fd55bffd6399b",
753
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/File.php": "4f2a6c996bd3fe4a07e4e1d49d2790e68798add08c4887efb3d7bdc7beb5ec2c1601b8e77a0b40e570211f7d3b4e5a5f97471f60df8b31434487495677052640",
754
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/PHP52\/SplFixedArray.php": "2adc50710dd4bc2cc1138b741cde09f225f727f2177d006ce8ca82691de0336dc51b6c30384938eef1693ae92628460f8984aaacf336815dea092de4ed1521b5",
755
+        "providers\/Telnyx\/vendor\/paragonie\/sodium_compat\/src\/SodiumException.php": "705f6e9777db6be71970f7e218339e36d50023abf723446195cef782976d7431f815a90d1ed83e32ec527303057287f890215b4b0a9a8c992a13d111e8bfb947",
756
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/CHANGELOG.md": "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e",
757
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/LICENSE": "8756122099aea86ddf6f176a480c0454f2be6dd278e475bd6be7d7ab3d572162f1bd44c9f623e52e53514cb15336be6e84a5eafc8e2a347b481ab5799ebd6e17",
758
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/README.md": "b552bcb37ad765a0aba888fe43d2e2f41b5bee6c90e734c365797e74dd0b8c4df017ae74dab2458edb410630299efd7b649438db57acd53fefb1723e233416f3",
759
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/VERSION": "294108697ec66acf16af2f9518c5999605a8585058ad25dc9303029fd890e6835b2fcda23fff2ad60058f8f6a8a19c945d998e4e228453d4946e395b9aa2055d",
760
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/build.php": "485d76b827a54d8455550e8a8f8d14862f9444381da251e66c2bb8ceaf2106a554c1cd339666b1260450749d0244d6b9ba0c6d0a2220ab2411aa4041fc83f8ad",
761
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/composer.json": "e05f4af7ceef33d82ed5704be36e1b9839236d13073d0e23ef77d33ce7ec303cc2cfc2ddcd25318f1a5295bbe3b61a13bc2fe72f55c226e2f072e2a0b1959481",
762
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/composer.lock": "2b8c24986c6cbd290c0ce53ac4f773836751aebfd65a2350fd07b4cf45292ce2667a54494fa098da13a385ce7a9e10a2ed55d20f7c8dd6817f93f33a6cc710fd",
763
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/data\/ca-certificates.crt": "659e8d36bcb65a7fdd299ee008fc4ecd42be87d8ae7d7d15828567b9be44b4ed8a316978f2f7d3d5d7e96a4da0b30bb8bdcfae5202ef099691daa796318a869e",
764
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/docker-compose.yml": "1fe4c651e406095f0ff1bfc196406d473184bf53cf80f7c67dc79f1aa94b26db74174e0e9bc47adc95eb2a5f6eb950255c4a5cf44ccb7029ba712df3be9e6384",
765
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/docker\/Dockerfile": "a63d1fabd8c19fef37b90922aa4bb21fbd1094635666cf2a3a4db47009888bfd3f1ad5c34c05184e2ccc8f581971f6dae91c1ff137730821422cd482c39e9390",
766
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/docker\/entrypoint.sh": "2bf3911c365a271fc52d17a0aac1687abf52e5286a5d52cd34367e18651dcfd6ef1f791b54105b7742f5d691564ddca3c05a9ba4ce8edfbc68fe919e0bdf6c1e",
767
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/examples\/example_webhook.php": "336b92a647e49d8c994c8e6dc6b26670f0a58cb57d4679d0ba7177fa1f56a84a628e5385dd4c1c25a1395b1d8499e54d34eb2c20f9742a2a2a3d0cb20c36be08",
768
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/examples\/simple_webhook.php": "ed299912ca9a55170796df76b25c5c92462660b065ef7eabf24bf7f552e75fe44512fc3fa977fae2a9dd5e9be1ea28100a456de926fd7f24c32152f577f8e46b",
769
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/examples\/verify_sms_demo.php": "042dee741d4fe90d78edcd0614df6a371cee77d1a95d34623b4e558ead69378c693a33d044f450ea204efd7253e7eeee1e5a4119708dfddbafeea358bc5408b0",
770
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/init.php": "82a207681a76c9b00d1a35fcfe64753cf286d9d0122366f8c1f3009ecd6c548369d2b65d5b4e03f20faa9502b967a3bdae30865e5bf8598eba630b5f9555542f",
771
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Address.php": "a01e1efcaab0209fa7cf32ed85722ff793b9c0f750daf7d3bcd0499037dea764f2a61defa54b4bbaf602f8d0f5f477fd4198e35d6d8b47b82fd13c7a7e70ad59",
772
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/AlphanumericSenderID.php": "c6f7d381cd9901af59d67c66fbe6ace0729c77ac2b2962ce41351ed076cb39c9049aeeb72ba0e3933ebce4ab8a936b86a7e21d30a1c07b2b08cad9da2abcda1e",
773
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/ApiOperations\/All.php": "5a6381d1492e2ebd1498fb4371b55c7e112ebf2c898e1861d7dfd2345db8c56df221795208a29b2a0e42295846fcf98f6a60fa8839df7e28fb66b9bde9226ce5",
774
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/ApiOperations\/Create.php": "811f9227ecc5acb172e8e7120541227de0bc22cbf66a41490b743b3e49647a38889d5cfa5d64139b602572f0fcc0fbb96e3971c78801ed9acf7b50db2ab7499c",
775
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/ApiOperations\/Delete.php": "e3cde9f67ab7281870c7399c4e76ff5807791b94b595567f56ee4ee494574e0f6f282a8d0c024c78c1709940198460f386ab8de6118a85de7d8a52feea0b0dd9",
776
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/ApiOperations\/NestedResource.php": "209aecf9e6abb679b4f1ec2b59b1ce363a73970f6d389829b77802cb88b7bb368506e4d0aad42f090b715b4d4a580fdbe5c8479c02227102b4d147d615fbdb8e",
777
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/ApiOperations\/Request.php": "afcba7de3fa312bc9e532e43bdcab8fcc5ca8b532c6f7bec08f94a8d7b2849467266f98af029bd688a136ac24ab2b7f438ca2fc666395c589d578e9d0156053b",
778
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/ApiOperations\/Retrieve.php": "6f29bd2711e3c6b586c2bf6d9805b986a5f76fb0cd8c98c63259cd9873eeacd679f9718dd333110966ec3bb772e2ad06da7b1586bb590180770bf300aef63c8f",
779
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/ApiOperations\/Update.php": "1d353ac81bc74cd57c75f01da21d6c59e053813930a0eb0fa054417bc87b6a140f64393bc04ac312b8c16803bb4c3eabae278839973f772e3202df32828480c0",
780
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/ApiRequestor.php": "deeca798d9ba058eced71d846bd22cac360cbb25bd1271db25cd0ebdb29b1af9ee863b362849035e8a9f6ee62bd49b8415cec97e1fc01e674ad6942ac987b6e0",
781
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/ApiResource.php": "f093051a36277165763e1ee66594056cc266fdb89caec9ab9223ae6af9add8ea4a20e6e3ea6fff4e9625fcbb95f430686f1f89db36f981d7d54034d79bf397a4",
782
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/ApiResponse.php": "0d292d053a85224f4ac839f54253decab0eec5ae9861ca95314e98cad0fec2d2f0a7e712a8ec433adb302b6702d69262c8866b20fd08d67b2d18571965bf6789",
783
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/AvailablePhoneNumber.php": "7c82ca4fa28264c4fdd910c71741270657e52cdbc760343339bbb7c1d5980d27b7af476f7e1bd431926d428dba685a6e34d250f9678ef0a4e3cd8c4b06289e55",
784
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Balance.php": "333bbe5f278ca247d8287c8da5cf3b3f6a96c896a82e3c3b54d01277e3cdc82dd5bbda2a1253fb473a29c49d3030b73b24eb8231cc34f85b0a43bd853682e000",
785
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/BillingGroup.php": "60d9fed23d1520237a50a707986709f3b700d42d049e4070a48fbb50f257a98eab779f45a15939af3d5bce811014c01abbcb86fa1b9ccc5b89d55f44c4b1a308",
786
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Call.php": "eec97591c5e7af2b057dac6e6498cbb2c1fee0439b1b7f31c2d879a5a0fdb5a3eb5ba3bb7e3c5a9195d9019e9df82c99a491ec52f15bec59b496435c0787d43e",
787
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/CallControlApplication.php": "fee499465ecfdd2d5aee0479d3770a80219a5837bed934e0930413e6dde740be21bcd965216c782e0765ba18fd71714ac69a5ee887497845ccc1bd7797d6cac4",
788
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Collection.php": "ba4afd20a921ae7c838a74bd9efcc4e468fc12ecae86b2222f97c9405d376a77533f55924bd1d577429825e746ac59142f6d4576f4d446cb3757cb36b65894fd",
789
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Conference.php": "ef9da126fc06537687947c8eea71fc34a53a7d44607d60bcaea7d8c7f55e76a94a9d7e0057f9abf7efb1f4f270680cba042112a127c2c487fe3c617c5102be29",
790
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Connection.php": "c5f43a62ff80b2e91556dc63ad2f78cd83b4fcae4a7a28ede36388177591fbfc6c20b244f6fd4e540cd9401e34b04946bf422eedfce25316e61c89f15de97665",
791
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/CredentialConnection.php": "fe9d8b7b34a24f5b3b83d6a2597359fedce871db3a526124832d4bf4129e7515366ae16517b8dae259305ae69f95655aaa8b4710a9addc23fffee0e70b70b74c",
792
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/ErrorObject.php": "cf83764f49da72bbc816c8741644e15b9a74481145c6c0c11c390221ee4c7ae485cfc09d77db24a48b0756b69c85570242bb2b903c39ca699e636a299ec4dd31",
793
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Event.php": "4e4ccaef81755432630c46881a958928c8b633ef1dea76d05f05711da17f68bf6e5b7b77395abf297b3ab128c065da7b4ed38d1be3a45306eb6d7a1080e72994",
794
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Exception\/ApiConnectionException.php": "b2a920958f3e1664a6ea5c5f32c73f9914b3f59d8a927c4e920d385ce87a6676475823729f203b09f5530da667f52e3dc3d4471fa498277270ee9360d0797b5f",
795
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Exception\/ApiErrorException.php": "b775efde92c04d1a53dd3f948f2efd92baf1f1dcb5092ed0863f37bb71fe03052562fa89349b1030f3d27a0dffa974ee47c9a3655b40a3941b05e721e7fe97c9",
796
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Exception\/AuthenticationException.php": "f8154528a04642cdd24f3de876b1a38d6f97e357d36badafd39e596ca739df7fb77f4259de1efde8bc300f126b20f6e242db4c1e3a25503565df579b62676ec7",
797
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Exception\/BadMethodCallException.php": "5e6df108c1df11bc1275948d96829f0ca6ff039126934ec57dbeee74913af00a64e6a9f2b58f42bf74aebeb94596c45cbcf66e5a4afa8924b238ca63d424f452",
798
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Exception\/ExceptionInterface.php": "77d5904b79a9a5b265ef121cd19d91b952f631ac7436e7896bb0786d9afc0b7ffe54c7ea901091baefa0154b91abfbb3f9f3a7fcfea4053f27cb44be2d7cb23f",
799
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Exception\/InvalidArgumentException.php": "f2872cf684dba5abd50bf876971e32364a23c9259c1e85a01575348614274453d00cc655b01c2dbf2c78c88f4a6143cb486c786dd1664204dc7676a64a9cac4c",
800
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Exception\/InvalidRequestException.php": "fa310ff5d5ea8f02f731089c27e6903d9b0e692a3faf272efd19ae4f1075a2a1219d167730b21cac6a30e705816c4230e2511fdda981fb47714f4d81606ffcdd",
801
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Exception\/PermissionException.php": "4cc209df863027760738530c5c01962702970a73ac7f11be232234413376dfd34db049f4e49305c8a15ee1f016b26f1c128312930e10cab174e80d6ba20cb12f",
802
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Exception\/RateLimitException.php": "c37157b02475d2a3940dc7d007b84cc3c86cab88b42e841a392e3ce4919e637c9b59bc7b33ad3ed8b4b32e74dddafd8e61a6f30d60029b8b1ecc82b8faad4833",
803
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Exception\/SignatureVerificationException.php": "3aaa44cc52efcc4caeaee624c070e8ec87b665decbdf00d8aef04ac857358028e4bc0495c4a86c504f3ccc6d753413c5ed685816e3b80851026bf2034514cb59",
804
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Exception\/UnexpectedValueException.php": "33504e45241779bae5e9c1d6ace82a75d545e6f7ae76f7d7f071fa4bbab13b2c23d11e59230da3c242b548ee7b5386bf4795e0d06d1719812348d1f9efb0c1cb",
805
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Exception\/UnknownApiErrorException.php": "cf5cc44f46c03d9d0de656e2ae61d7b077d123a4b6666a4b0f57fafa2033e072ceb5b14d6a47987bb14e0acd48ae00b39d4d6ac1849fadc879bcc43ed1acb44a",
806
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/FQDN.php": "b7d44de17cfcd207ac1fe6aada6c24871a98dadafc4cddebe28b135c6e507634608e1b6c7052a40cc750f6515fe19c2de29864d4b9551e7002fd800cc6cc05fa",
807
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/FQDNConnection.php": "527d18ad480447e4d79e567e7a91796ca31bb778f10011aa9fafafba6e769d387fdfbc306a6f1ba58e583bc7c37a9a66f1961494d3639dcdcd8912efcd0e6a55",
808
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Fax.php": "fd8af5f711fb5341e2b86a7fc66a49707bd31efabd2cd63a1d5153c24462f07341d6af618b7e82ff1faeb9bdc203f62b6dd5570d74754e052300d0d7edd0424b",
809
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/FaxApplication.php": "f489a9e161565a6e7f55a4d90fc05bdc8147a8947788a757a2b5464059ff2c49e61fa26b6d1f0b43fbf9ce8d0c08328e276442ab4d2d100e7ef34e9b2e0860c0",
810
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/HttpClient\/ClientInterface.php": "da6ee5de3e8aec8ac144511858cb3bec53bfd2aa0b5ff27eb43c7f72dcdbfb1646da223cbd861db7595db904007ff4c8d6a010122547a98bc1d2c07139328a80",
811
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/HttpClient\/CurlClient.php": "dfcbf2f40053699b94de74defc4a57461c2e07280976a377cf4ec3600e6279fa9cc434060b0291c7e10a634647e1a86e67cbaaadc49783eb532681ca25256a42",
812
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/IP.php": "624821d6dcc5d30a1a08368bacba88cc7ce8b768bb3315b3f8013606e303fa8940c13da8ece0c67a43329a0cfd86d8bd09682963eb54138f4253eb2f159c7560",
813
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/IPConnection.php": "01239dc2096fbe207ce1a5a58dad8d25795b9a8a81dbdd4290730009f2fafee76d74335aa951fb7b54e930e4e9530a0566daa9ef7e99ea60a50b8daf956f11dd",
814
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/InboundChannel.php": "c37478b08abc62ca491806db6e2814c4a28a11357fef873f6aff8867e179dc8d89817ee3db3fdaa84150111cbeb426ad0282dfd7550eb815dca100843f542178",
815
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Message.php": "18acf4bf51ec27d330df16216924c65a45db59895b610a3c803ef1d09beb7d96d20753b4ec16be06ed40f2886ad46bb3d866f14a87021484ede5d33ac1a93c4a",
816
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/MessagingHostedNumberOrder.php": "ecee6ab7a46ebf03b93870017aba4ce00c10ee36342a6d3ead209078aacf4ebcb798ae129535fb15af860355b52ea72ae6bcbf0e5261a9d66224e43560858227",
817
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/MessagingPhoneNumber.php": "2a2caa5e44efc5de92ef9b0f8ed0a68af1ab2c80932f4cd7fe79caa87ca1e146af3bd0e1d16d977738da2a3af1fb3cef77081c32a0dac50bbe8ef54a108efbc9",
818
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/MessagingProfile.php": "7a561dcea7b45a4ad4c3dbfc6baa766f011de2b2dee9a23e512689b374017b05f4fcc5c3510f19111a9d8484ed93a5e05d3dc01f35d75e356f475a894596dc49",
819
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/MobileOperatorNetwork.php": "d4436bfd9a628713889a37846829763909033339a086b6983eac792e9af42c0df2a8bcbd688c5c54a196d1fcb3d22aae7b45e9e18c015592d979e9a924c42ffd",
820
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/NumberLookup.php": "cac3b5f1ea0ca30f9121849a8aa52ed2e18b7776c4f1d552dca4c3536e0d4eb96af45267bb687319a9ec715972bc95a19c7dda54c33a2701e20cff9564dfcee5",
821
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/NumberOrder.php": "52067d9999c150fbefcbba9969b308bb6118eabe25bd08f30cc4978cdebd68fce4479e53d71ce29632133e8c69bb4ce9276301f5a36ea95bd77d29fd057f5d46",
822
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/NumberOrderDocument.php": "007830f9c03979a7811a4e0dd0c74c4b2b6d05e05b56b9d6ceb5a6e55167eb95b2546087ae17328715e01d486c0e58e396bc41816b44866391b98d48ca246d03",
823
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/NumberReservation.php": "988c853084f13e0d86445d6638517f84ef3d90c3f618c2c85c0bd8ab790012c3986a1a3eb3e00fef7759d04a6a1957bd9521bb8da6ade8c05fd2e02a8040f6a3",
824
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/OtaUpdate.php": "3c9579c6ac1ef6f31ff572fa3fb7562b3618182cb36eab3f406d8fbe6fc7b1d35a996e47923074428583ee3653aaff3792f9fdc47eabe1627f1a85722fd9dbf0",
825
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/OutboundVoiceProfile.php": "d0c5985f6f629904f4c95b892e329f280f7e0e13b8794d1950e216ef4c28ede7b94baa99f18803ff6f60b09d6178ad39fe5d3c182e984c2b4b57e9732991597e",
826
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/PhoneNumber.php": "8106765a769bf3f6190783917aa923f3f7690af5b7bf971e3dbe73ee5f227b27531a553cff9cc425ccfc7cf2ac52bcfc685f3d3b178875f8fa837a5de99a077c",
827
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/PhoneNumber\/Messaging.php": "d0aded1cbbd4c6108b0fc6e6773dbd03040af54c967f0a8aa9b2523db769317182889c882e6efe6fb0e187ac3f2919563aa6a937c77f4c1ff94e5bbc31f4d9d6",
828
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/PhoneNumber\/Voice.php": "e7e8184351cb186fee77019e88600dcb15da0435161d1878799433686e012167ab3347d7f02efb5cd511b5d02cd7b6547453f6ecaab623ed23fac7c91b0a7333",
829
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/PortingOrder.php": "ad9a683aab02c8817796e62131fa9cad6f3490d3afe231b5718b3b4f0689a535543362a88333ab808c36e9c41bfc8b7b6178be7fbd5b12f38b6d806053726997",
830
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/PortingPhoneNumber.php": "ff2e1e98371b6a7b0cc5265d1ab82f053d97711a72633a7d3911a4211dacf75c08083d6629aa4fc028643c0dc929d3ab56132f6f21808b875a9ce679e56fe055",
831
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Portout.php": "71de0eb22350f649e5023b2c4a374b3d10a4beb0f8066d67482c62f68a39219d9cda4bd95d91e1df2fc215479f45b1ab79bfc0ccc2d39267d2f268356ae83ec8",
832
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/RegulatoryRequirement.php": "0658d49bc2c20a9a16ac72ea01b5306eda422d81747529c3373333facb5ce1940252387aa498d2957dec62f0eeaa8aac3979ffd84ca72308e660a1a0708796d4",
833
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/RequestTelemetry.php": "cefdb55dce61e5f276bd49f6b49e57c78085338537e56cce6fea5a81cd1d2235f1eaa78be326cbd513117be88a046177afb628659088b66ce423799995c53709",
834
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/ShortCode.php": "4abc882d0dbc72becbff07212d17b8e1383b0efb43818a7eab983fd2a08c3f591a4f4ba2f185003fab0622a43329c969d2fcc80b23cb94410007a0879309ad49",
835
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/SimCard.php": "46289711eda27b37931b0d9f7e9624c114ef9c1e997ea88055dfdf6fe6dfaf7f9169b9a67cbfe48100dc4df2b73ba4d27328b0ca3ff0af3655789535ec3c0b26",
836
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/TelephonyCredential.php": "497a3dde2d7fcf8bf57b502c71daa5e166010daae45e30e1db7ebacb3a37028fc70c7cdcf39a356dd32f845664e8e9723a366fa69610c8f9bd31fa59b3300624",
837
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Telnyx.php": "f5ecf9589eaf7db991051de8482d582b36edc387b8a7ca48c80a419c1a99e1393d7f099aa4ad3e87adb4706ab62c8714dc843c9a8ce77d6fe6ea5ab929d9a882",
838
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/TelnyxObject.php": "0f45c91559ef686a3eb4ce3777ab7d43ba288b380ffd1031cc3c562138410d3582c251e2d986e8a84a2c189257ed4307500e3fa0d662a48a30b28a9622ae8ad2",
839
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Util\/AutoPagingIterator.php": "d03ac3841bb553d847be9ea73ab9debd8c1f2c829b0d38ac4416a121ac535a5ece2ecd9943d89e720cb5abb1c907ca9b96df899a561c190ccd6843bde785114b",
840
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Util\/CaseInsensitiveArray.php": "d5bcc37aeab4fcbbe0b9f4a9057a5654f6080ed899ae54f8ef18bfc907f244071a6693386dd306caceb6bf338883a13c7972574ac5d700aa00e22ec363932cd6",
841
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Util\/DefaultLogger.php": "50a69f9f6ad628e489a05fdad0df811c926c957c301adb0b4b906dcce9733a0598f6c2eb126865c54a0100131dc4230a834b1e98275237ce8e90bff2e96cd0fb",
842
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Util\/LoggerInterface.php": "8d2dc2c59af5e625eaeef0b85b09f78a42e533b62fee84717d67a4c706fbacd94674f439d3ac60984c0a3947b7d2f5a8ccfb64e071c41d063b8298f57578f88c",
843
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Util\/ObjectTypes.php": "99ce4f7d4d4d9d43e24f3124a7c21b9540267aa160c780efe69d6559843a12948f3790b179db66282b0adda384309a793636d71aeb97d9aab0a62dccfbe2b51b",
844
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Util\/RandomGenerator.php": "292c880420b28390e3d734c6343acd48f322db0c474f80430402916de1dcbf8e988b3d2753a7c18e763e632f474284b213ccc8e8fe4e52f00569e72728dcccb4",
845
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Util\/RequestOptions.php": "00b6d4890b5a38f42f13ffdca556bbf1377c05c8a79ad2d6d0b69b7e27deb70252c15088458da4bbd56e7832cc6b2828e261241661dc344727e2bfb170465de2",
846
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Util\/Set.php": "9cfa1c1bc6c012e8a7a797ba8a7893382eeeb234da73f93594a159f78b9858c984dec1e42da5a6cdb240f00d27d250e3fd6a7842d40c23513661201a148a6c5e",
847
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Util\/Util.php": "4556fc8b785486adfb60ea8001296ad0ae7b13d785f92d545324b557fc4aad85a69ec19dbca27dd868050d64670e4e2be2e3a4f50e4aaac609b0089c0e9e2749",
848
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Verification.php": "b63d4f9d717ba204dcedd1c3315db3300567fe09563faed0e4b8f1415171e43e0068fb06ebb2f42c808602248f623f5773414a1612539a873070f461398be650",
849
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/VerifyProfile.php": "fbdf0818dbe1fdcd6bf13720f21ab6552a3ee7930c80a9adc44c3863ebb3df990b18adc8beee6770f4fca9bcda0d514a689d051c129d871eca48f2c0eccd7649",
850
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/VerifyVerification.php": "f2883946ac990666dfa62e07dad649ae0c9de75d5682857cd22419fda8926d45d504ce4fbf38896a1cbf25323a604a818d3b89f05baf58d91cef497c54d981e7",
851
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/Webhook.php": "b451d90496fcad105eb4f61d5716b93878405315742c09d7c4be96c6b9c0427e35c03c1a664ab2f30f1288566b45117f87b069a3ce96d64111ef6a1ef289ac9e",
852
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/lib\/WebhookSignature.php": "ad990cd80d771718468e39aab1b06809a0efb9bb47f5ea4d42a649dbe481f5929fcbd502da6140f1438920e96ce2e4af82d9cfd810b0ddd0eaea391599685c0d",
853
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/phpunit.no_autoload.xml": "06ad2f4fe0a292902757629f5605509f32a0d1dca527550619c98a61519d83fc70f3c886b12f5e5734b1031186fd9c7fed6fba813cd816b0f07d36c2a6bf11e4",
854
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/phpunit.xml": "82ac037adc20f2aa76682878094e8bffbfe31782dc6a94e2987bac5546e3ffec90577d03715f4ce481cc977685eec9e4109a61b4b46bc19351c2cad555d7cadf",
855
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/TelnyxMock.php": "e8e93ca1114530cb7e9cad46eb20e32072934496d515a9391ce8093773450dd60f3288f9d3ba46533a0f650fe67b508d5e54bbfc6e1642443d1fc043b88eaaeb",
856
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/TestCase.php": "9945df738b56e344648cc00d3d4b94345c15d8749ce511b5095a87d5e52aed35d8e3c773276d9dde9d9fa04eada784a55e4876ebf70a198ba719c8e94c8c32d8",
857
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/AddressTest.php": "dd980e7890ad3dc1d12858f2d241a461689a34892bd780a8db034e620c23d01587996042c2c12d82333b2072bfcca6585afb06213694b7415b0b13d3084b83f5",
858
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ApiOperations\/AllTest.php": "6031bc6fa9e899f06af9465468fb9e15bf5a9a7c1051fb52fbd383ea879842e72ba4b5347d07566182c632b5f66d5f2d4bdf73c1368a3581c6010330bff91ec9",
859
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ApiOperations\/CreateTest.php": "c94c7e854a40716aec0e257c4d7fa279c3e941d64a37e167d4885dae5a0e22a513c8f3b018c436eff90ee045432c5e34b96aeb7d879380e9386c2bc177b94f39",
860
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ApiOperations\/DeleteTest.php": "02ea2d3adfd1d83770f10dc42cc2c12c28079ca80933fbe02219ea79fe7eb6958d2b1d76cb7a0bfee9e308c01efb1eff61901e22d192e15e89ae67f7edcabe5e",
861
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ApiOperations\/RequestTest.php": "f6e158958616f0637f827b94cce168e873e0d3be09e4ec27165f984af3d89c0be4d5d5cd3ed66df5b6237bf183003a0de1c652f599827fd01a2ee7ad47d5fd61",
862
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ApiOperations\/RetrieveTest.php": "b26b8f61eb3cb893ce4ff9517817295fe9b727dd570b1cf79ace36e16902e0ab9f460d6b65342afa28c59236b59ec0ba0809e1cee673f69ea26489fdbf5f4f42",
863
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ApiOperations\/UpdateTest.php": "6aafed3640a1173822ac9a26c002168eeef552f9b681fab9ec4f191df4f988a920d8c290b2f875c02596ef613273ed003e4b5a6bb6e0bc2760f54ffff445cdd1",
864
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ApiRequestorTest.php": "5a1234c4a1e4107aaf970bf87f0fdb1420979dd575a548e589b046cd7feea4dc914f25bf15474fe5bcd9773c94184b610d06b309d48639964a78e6137078cb5a",
865
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ApiResourceTest.php": "05562966c7ecea541b0ae95f67a11d9e2b86e45439b436b319e252d5998e0eb7a6c9b677e233572fc616caee856d9764b56feed80fd07cc1bec0d861490753b4",
866
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ApiResponseTest.php": "6f8d458b49e34df5c0634276659fd441e4140fb4dade92b384230e4e2b897e0da6d0e82c373b1eca98770dc3396ffc8b924672ce2141426706c624d00ffc7af9",
867
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/AvailablePhoneNumberTest.php": "354326429958fdd199df78d11bbc582a0988018b8f907d93808cbd53243f50332482c0603bf4ff12db2a8977ffe7e663ea9d6e8cb5f485aece0d46ae8942833d",
868
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/BalanceTest.php": "8f866f88a8a59754e2fce7d5fe2a0bf50399fd21711cef171873a45308ff96f929b23163495c273e96c9894b7ea39ee5149c45e764fa0de3b51807a329c674c6",
869
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/BillingGroupTest.php": "4333c81ee3ac767fa600095d95f324286d289c7e105ab251f635d9a942e75c418bde60f96c5954ae29dc152ee5fe7679bc5a8b67452f5fa1f59a411dc4854c69",
870
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/CallControlApplicationTest.php": "2bb4f83cdf82457840352c5beaaed8963aba1dcb59711e310d5aaed0d35429730796b412f1aa4e85d5be5a2288ebdd12fc2be9ad75549506d1a613d604d20749",
871
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/CallTest.php": "50f830a3a3c28953ec53c244d22381910307513ba18b7199d5e7bffc5747863e4da975fa972114b2f8a81d0c24afb2f72df8315010febd8d606d086d79d82165",
872
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/CollectionTest.php": "9e742f72d8a223e64bf1a25362f9a28356c0b55037811510692880a359ee5e39266d9e76aa0832de39530e26798806929fb9ab9795a04651ff316f609e2211f8",
873
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ConferenceTest.php": "4e8ab0baaf21da65e3942b0d98caff11b7a30c24bae10ba546b82f7031d7a85b9d88087f9ac8172e69546eb7635bc1cf8f39b509017b82116e0e13b557bc1f7e",
874
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ConnectionTest.php": "429f80316a563f45783c87db6b6d3dd1564190b5c6a259f254e91ad8b71b2aa5e6ed40b9cf1a98632b7c89b66441e07f0285d434c78dd9729c032c7a4891d4ee",
875
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/CredentialConnectionTest.php": "a1c37f36e418debb034faa2b7df5095eee175ac8801baed517089622123dcc4af642448aecde7aa8b19cf67629de087e4995ec816d791b5007923ee614590c1c",
876
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ErrorObjectTest.php": "97344e9d24c204ae429b856d0b32299de4380ec52e9cfbdef6090add25355d268e3dd3ec35ae7c5e0893f5bb204624930d1a856932243180bb71b40e5a1dc08f",
877
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/EventTest.php": "5152c008cb3de14a47586eeaf3ef778629b2beef87fe154a2c40c337c3f918d664c0ea44d8339e22846fedc696fe6b98f0bb0b557d3f88a3ac62990445a55ec5",
878
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/Exception\/ApiErrorExceptionTest.php": "7d54379e1ab9f7d6bddb721ea1c284a8d023674e24e99d115f388ae367250089e10b5962e2bd091e3ebbedd0cc83bb4f821eb0a986ae11487e341569ef7f5c6e",
879
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/Exception\/InvalidRequestExceptionTest.php": "a7da1818af1dfb3eaade1e1a122a8a3224e03a557396e11528af75b13cfae07764f82a282a3161d514358b4c55312193c73b5a8900fd70463fe0a66b448cc9f8",
880
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/Exception\/SignatureVerificationExceptionTest.php": "1bb0fd1563a5c91b78b02e4f66f3cf0288986f546a0805830e0d4ad1ac449549930558caf86c06cdc578279323c43e4739747961065d5ddfa198dbbcd9540599",
881
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/FQDNConnectionTest.php": "0af10bfb2398682865c4ee72cfb34425fe73b0fd20c86b51c61c4cf72f8c4d39a4ecfa21e4ae2e07a67fdf956057549f0c8c4f77e27e65dc1b75dae8b9b849c9",
882
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/FQDNTest.php": "625370468fb338819fb823fbd38656799a8750f5093eebf75c02cfb592969a8635a442ec2febfe07705a5d6feea362b7644c25c67ae653a245bdf55fc178a2ed",
883
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/FaxApplicationTest.php": "64a60460c62983cb0afc2c76880628e16270f14b0b761a8d62766cbe4c0fb33dfc7bd93ae0cb62de25a8f2b3e1994826fcbfe300ea37353f398c4cc8ed7dd62b",
884
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/FaxTest.php": "a920c8ac18021bedbbc4972109afb0cd0afc16e5d86df2fffa2f8e0bdf837e5684124f926f01daf0bae439473022899498441a770ad8cc52479da3d012f1ea1f",
885
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/HttpClient\/CurlClientTest.php": "cff15215b95a804e4ee233df60671c5c1e9270f621025f6ea7cd5a0bdbb55175caa6c43c62e176300bde05c9ee90d84efda0dcdf0d0b5dda4dab2a47d1a669b7",
886
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/IPConnectionTest.php": "6e034e287616ac89e5059d337c682e3fde010130f4403dc76fe4efa12742c40dac114ddc1aaf7ce9e553c597d9ac27170419c5e33fb1439c31c6b585953ff1a4",
887
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/IPTest.php": "7ff33e91d1c7b8bdbef1ca1f5e373150a05f709e524d5a62b000b5c8b8d697ce42306ea8df917305d9ef2a4ea19f797ca28e2f8d0d5f9e3e31c4ebe5eab55ee9",
888
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/InboundChannelTest.php": "c430f6df3eb5add5bda2342e4b4a3acd77b33d74758516782ee0a045d75e7387aaccf36017fdaef18d71cf8865a28faaa0cf07a4f31c9876858719d84d479657",
889
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/MessageTest.php": "08ae5ad7b98362fa7c1478254f851078ef7e9a223c74f3fc57619d2b9c255259edefefc400e261cceafce7072fa7457b8c1cb4dc8dda29b51e432f6d274a8c3a",
890
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/MessagingHostedNumberOrderTest.php": "f8f8ac7271fb01b07815e2a92d7a0974e4320de63942eadc12df307c9458a7cbda7ddae505a731c491e4aa6bcdda7bec04786890df80dd9acd422593f2a02c0e",
891
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/MessagingPhoneNumberTest.php": "7827d12be3191d1329168c6b277899b81df17aa18b775be538b9b29ec9a90868969c05cf61d53715c42105b92cc37977270c1a7b78bee3d13214d8ece51172f2",
892
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/MessagingProfileTest.php": "0949c56ac67ee6f87854959635dbd003391e497325305692784905987d114b399e4c648252f314bc1147e385daf4e60198cbfd6aa940a6cb24992b8cb5abc24e",
893
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/MobileOperatorNetworkTest.php": "6cdaa23aa8cd0a0e9cc43b6f17c86d9c1f7793f7eb30b774f4a8ae9754488e59e0c180823c31d062abaa356578a8718c65f367588c61015e5e36f9f98e7a5cbe",
894
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/NumberLookupTest.php": "e03a73e589abd73cf52a637dd7d273dd2477533b66bcb75685552b77b47f7b58116c4637477da7f9ccb36a408909d91d3f0d3079396aca9bee996b862f358499",
895
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/NumberOrderDocumentTest.php": "06f3e8f8e8dcf5d8c96f25a6f1888d59e9433654ff060701bcc5cb9f54b07357bb3606ac17af3e3913033fb639358df85c6d5c55bff114407168333d7d49cbec",
896
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/NumberOrderTest.php": "176ca2e94df05262e8a43f14e112fb62108ce886bd90a690e8b907881c696e35bd223f08a4960fb58ebebd20cd42bd4217ffa14132e53ddac260926c6d7e8842",
897
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/NumberReservationTest.php": "11742f7449c279908848fd493817731f3f1343895e16d3426a7a7f9fc3d4cc27e275a858e16d7efb8e9c18d32de1ffffc92929e8e3ba277157ab7304c3023c86",
898
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/OtaUpdateTest.php": "14830affab4936804afdd723714f2dc76c520fc2fd6e4d36d7bb255ef566836eafb6b29c18c5adb8785eed39f4bab030e3cd1aab1ef0293d9660b38a10fd6a45",
899
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/OutboundVoiceProfileTest.php": "e49828087e2114fb11569db7387a0acb7cce8bdb0cd655b280b567445ba2dbf16f8b66a88369876e7a2530fb282bf5a04be702719adf4ace871c2b6df8fa5edf",
900
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/PhoneNumber\/MessagingTest.php": "b3c5665f4661624f58f02b814ab1edbee5ceb8c26643bd356b486f049dbb498a44da0af43daf200890c79acad16d51c169d7aa1a2ad4befe074b0ac539ebe3c0",
901
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/PhoneNumber\/VoiceTest.php": "af08b444289d0194437c414916a8ec9285b98413d78e74d1c832b9b45583f9037832a538751628b5dc86b5a13c40c63e9dd360b719501762e8e868fcaa6fb215",
902
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/PhoneNumberTest.php": "7a07f41165e45e5fab268b0e01523c2f67f0ad146965c401856582c4b4a3f63e53324585b1785b41cbeb637d8e61e26e2bfdb57feaf6c6c04cc33be8e4864df8",
903
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/PortingOrderTest.php": "48d2ed4bb9354c772eef6484a0c9a195487c39f26bee3d143ddf64ae7da15e42e5f280a3e26eaa280940230fdee52ea09b7e5320823d4baefa73eec4490537ad",
904
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/PortingPhoneNumberTest.php": "476748b7e467c4f5a648c394eb19dbf297aebc2c16357c946dbc4f363241639dd1001985a7bb21166d5bc77bff1e31edce6e379dbda10f04406377dafcae1bd5",
905
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/PortoutTest.php": "cd262d5eae7c9ef9ba8c76856ef2d4f604484e6bf8646e9ad5231e89f5d45c8176a8ac33a757c53e4be8e2c98e6bb750c6041aefe8b2a589ac1e70a2db4493b2",
906
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/RegulatoryRequirementTest.php": "daa2836606e7c3f34fa122045e982e42f5da86b46f367ddcd7fe9b12e2a3fe5d472d4f38403d4b63aa0c58473d3b5901b8dd49b93a56fa3e76a0bdcf88ebade0",
907
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/RequestTelemetryTest.php": "61190b3601f7c2c72f55e9b1634cfaf11ca53231cf4b5f854ab14859b97f5dc0f07f6c95b8f7c3516ed253e13768b7d4ed9c1d15d0772fd1850eb894f5821152",
908
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/ShortCodeTest.php": "f2e867e0b75d8334ccce51f7bdce842b350e7028319e8d388e0512b5e119585952a54ea79762010f12de8ffcd1c440638ba5300ddbe59adfdcefc712d8e079ac",
909
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/SimCardTest.php": "7000edb2f9b739bdbd44fceeee2e4a16c708efb22c7e38483569d5416f3c107bcecdc759e2e6108553193ba99acc542f5bf3bc353ee1428593a81b80d89ad7c8",
910
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/TelephonyCredentialTest.php": "1f65bad536cd49b2df684db54533b9799856b32464b80700bed5008c9379c414f756d075ab8e231d83f5bd9c1729dba064a5ab5c7e515ca5c32e85698e2036ad",
911
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/TelnyxObjectTest.php": "6214f2c38865c7a183f6a3fd64bc79e7f04963bd726fc124a87b65412075fd236e00cb5f5ed514a3ca2847faec77f4e7a14c59e8906478543daea9c4ddecb7b7",
912
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/TelnyxTelemetryTest.php": "ced938d8d20bdcd0d465155e1bd3ffbaec8ba96a6392c42dbec27a1d10a04da17b90fd3b91322c94b54fcd5a974528e6f10d081ca9b1915a8c8166e0727ceb31",
913
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/TelnyxTest.php": "d88d70053ebb64905acccf7e3cf651ea40c9155130e351d56135c96ada96263311faeabc83d4cef1e72387302ea4a11edf338c3744093d9828e056351eefe11a",
914
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/Util\/CaseInsensitiveArrayTest.php": "671262198a48a16dc2ddb7ecf1c7fd309241db9c74c11072d86cbd2f56403973e4bb17ca5bc6c489bddf46cc391098dd6b666b134fded9430c211c2a3193fc58",
915
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/Util\/DefaultLoggerTest.php": "39942a071430588bf6c089f5d0c97596b3b46b5b7a2b45d900cc41670dcf4bcf0d34e37895e494f0c89242e52d11d8a62f419650407c26ed91b43ea18c816e9e",
916
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/Util\/ObjectTypesTest.php": "2d697994485e6c8f9084f9155a5a5b753261bcd2afcc9dfc5760daa5d4196b7c5baee49b264142a705ca7dd6c5d2cde227db3c1f860173aee6769299db95cd83",
917
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/Util\/RequestOptionsTest.php": "86d628c4b19e4b7d057cac471219603643b6405e83745535b6c5f743fe84d5cf918a273f9e8e22c5eded36cc20ce49453e90c0ae05a9ed437059ddc287ccb5f7",
918
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/Util\/SetTest.php": "c91cbf6d983f16e033eec154e56705b1d942243371df25d5cec7cb375a359faf29fec0c87fa5f3e4d7aad512d7e757361cf409e60d643fff7fa8fef72d9ff172",
919
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/Util\/UtilTest.php": "10f13d306d3ac2211b67e759a6e1fbbbdcbc1cb791db4531ac799a8f84be67b3ab43cc85498b786b0630510324bf5039ac7ed39e2252f607f7937e802f9b578d",
920
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/VerificationTest.php": "8ea7985bfc5075c0e5d3a8b0b703af578479e481d769a0e8659d4b0996314aae15de36cc7022e087c0625c5976255aae323f9ac141e9e4fef3939a23fda6d260",
921
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/VerifyProfileTest.php": "c0986530c0ddd14e2227cbf9ceb0614aeec3c3b2dc37b5bce0de0d174ebd047f61fa28ba0787b4de1fd3efb5d77d5924e36ebf6fbba09711d0237f520365e8fc",
922
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/api_resources\/WebhookTest.php": "7e06c31d714348c6c9a6cf14c4a21a1f593287fe61e41630a6d766f15cf2595dccb1cd92981578cc205f6c89839a07c7c845efca2b44521d0aa36c0be9e444f7",
923
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/bootstrap.no_autoload.php": "cb002f7c8f77834b6414db6535f083bcd227ee6085363fa3cb0f66b55226680a45c8562fd8458249868465957b2aeae134b3379f8ee2ed22c96425475e9c0af1",
924
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/bootstrap.php": "50e143ed68aceb91d3e119d5a31521e76bfe9876bd780c90ac83afb7ca4f32be48ff81c33c134109eafe1d22f35e0957a9a834966b8853df99dc1df04795adf4",
925
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/data\/test.png": "6ad523f5b65487369d305613366b9f68dcdeee225291766e3b25faf45439ca069f614030c08ca54c714fdbf7a944fac489b1515a8bf9e0d3191e1bcbbfe6a9df",
926
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/tests\/openapi\/README.md": "0c54fffd5b7a5f393358864ff9e3bd3793075d6060cc1336603b2455d60f16d160ffd47b52bca6834acf0d9713855b386f69580099a3dcc131e8d5d617975ff2",
927
+        "providers\/Telnyx\/vendor\/telnyx\/telnyx-php\/update_certs.php": "6a7fd896832dbc4c039fc907c74f25fad01f26882809d1ed0bef2870ba7db5d5930311208e2864190209862a077e4397dabcc1760ef2ec7e29127868016fc0d8",
928
+        "providers\/Twilio\/readme.txt": "879f75eaefe03b56788a884a5cb031533b33a94acd816b9e3e51a9cf0db826de700062955fc45d9561bd4c69f71178e2976f702e801fc06c3c076494c55c8bcb",
929
+        "templates\/content\/index.php": "63d6e27dee39188b80cef2b095db84791e02af0526b80d41bd37845386714f9f82cc9dafaf97fa355b927ab9b74527199ec70604480e09feb10a2b076e313b5a",
930
+        "templates\/index.php": "15ea019ef66fa303773941fa9ca673e472e9521b3f9fdb9052870e6f0596ca3939b247c8924ec0d67e0f3fee6e612e2c447a1297cf23cb5b6144e58a6197d65e",
931
+        "templates\/navigation\/index.php": "809473d6820d964c49f32e64f568f20142a0a6e14af2921201d2fa63e0d49d6328530dd1110312325afa83a01a1402815c5b0219d103dcf4cb0e5d7fd4cbfacc",
932
+        "templates\/settings\/admin.php": "b40addf8d462029c095e75fa92423b63d35179f174170db9a0c0ff10f6b388b4194a8d9edacb6c1f908b35bc604c0f76ffc63c2cd271143dbfcd10b3ed0be063",
933
+        "templates\/settings\/personal.php": "81312f8aff45cf49957b73099beddc082c23dda3af4bd63275b3df3b293cbf0c60099348237e7a4b41838ed8f7d5573ce74d28ea1926f7309a39d3d7aca2bf80"
934
+    },
935
+    "signature": "jVjDRcBOTXauAAc5KViIxCoNjOJdoaOfOnIJlNoVUt\/62jGB9xPtM3YdbaNRmdixA57DU3mg4XeSvuQj02AwcyaraqBOvkCZL9wjulJupTcf7FNR\/13yBxdSuAkZcwSO4wCND344F6reU341UekDApyxzePJaClDYjWtlMrLcKIaFX+CVkW36\/YiimUHoDyqYZSSh62ydlC3Q\/BOCc2c3gVFt973RF4TrbIA29JjUZ5SGfHnowstff8kFxfP0SrGtIyyVbBr+OF5liLWyu7DA900zBRcr6jc0FPxDf+NupN+dTbxW\/rqmvkLNIHqZriTuqdid25DCxS3CdZFRvFFV+QVjkttcfYF6r42MXV1VIK9AyMCZbQy99e2X\/+Viq47LrOf2oYlFfUpC0aJYSo9NAr4Y4P5ZQknn8kx+UEbRyQCA6C41oQi68I7Q2PsRTE07+0R9Os6sKkMncOz2rl6rOAHBpET8VzJjQe\/re7fEtqggQohsTrYq\/ehpQztQt5Lq1eCmzwEhpPQN1fDN4wtDpRg2MEDCeHhSIBKGm4I9oiqLDBKkBe85jWclWZGGCtByXKAstSt\/eZyypccbQ5BUNiRVDLDGV5Nipmu5peyjfGlAaEQ3TAL33tNmXxNzt3R4d0+Z+Wbzx1JrTH2XBHMdDDnRHTAyEpPU3EVyPiO\/FE=",
936
+    "certificate": "-----BEGIN CERTIFICATE-----\r\nMIIECTCCAvECAhG8MA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMjIwMjI1MTYwMjIyWhcNMzIwNjAyMTYwMjIyWjAZMRcwFQYD\r\nVQQDDA5zbXNfcmVsZW50bGVzczCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC\r\nggIBALbJJdLJIooOqb46AyOdNlWR9LXm3hWzjNBkH0o8wtMFEnotUOLcbaXbmTun\r\niG0Q0eunZGLSF6in+kY5M420Jh9bbDP6bYI8iDG6CSDkmKgnfcdJRlB6i7g0qBG8\r\noMzOB1x7ZVTef8Ho2ylTMWCxCfTlcQ15okAUpLU1G37I5rg0DZH2fPdGs9PMg11a\r\n64Tofl2GJSf9aHsgLi0AXXVzSN\/96wmK2fJYBqTVsPo5qIqKtMVWduhDXsb9yT4q\r\nDMYzyHrr8ydrMSGPwfs940R00hG2qHJcuKKGjYCCtu7djMfpKA9fqsGZBE6IWlVH\r\nCZxYIHPaEfHOybPR5d2GIKzncUQjtO2\/9rsju31GwzrVswG7w0tQUIIaj5AFLIL3\r\njnagjo2LH11ta9mB+DikaZDfd4VYEEfkTJA4BjnNCDa9pYOaFBGGwJMBSH3eWJCZ\r\nURBtk2NBnIheFRaGWRAzUpKAc+ZYdnmuAqe3Eh1en9GNlKTMCO+mAHkFJp3z8Nai\r\n1ijEVK+PIgtrzqc48ft0r6L43Zd184JnSIscBm\/9GUb0sCf+Uv4WFBKm4c7nrWtM\r\nC1LMKqmj2OYD1fZJ65M1VrkAqh8VXNtqQI1caBGMkcs4\/\/1eo\/XomL6sEkvfa9Y2\r\n1OywnVt52ZeLHyUS2P1mvPyWZgL8AxIie82Mtp7ZWX9Q8ubbAgMBAAEwDQYJKoZI\r\nhvcNAQELBQADggEBAI6OdKpKpevWVprPZ1TzUpq5ATj2JyCZySYC71Ud8l3lAEmn\r\nuh9ok5P7ccY\/c\/9\/ePWuvGxNSHmk1+nEEWC8XNXY5OoU9+i+g7vXd6EKOsowallw\r\nvWZB2rjl6+eNC\/AVa0NE2d9C6AWZtLxiV6rVsmkNUbBS6orHq8JJ2PSJKPT0\/nfM\r\nWL+ZORuFguWazEsy9oZBlplaWNxyAgq\/L66SKXynQPe74kZeVdZ5aQluHnBKZAoh\r\n6v0c2YiaoG5Mg6tDWcx4zM8HXv39Nbg2hcAtP2j3F9EkHZaytW9nM7nTIOxZJtR\/\r\nuGJtkj5+e1NQaMYn2NDiYSZALGUQ3YkHv4OIzDY=\r\n-----END CERTIFICATE-----"
937
+}
0 938
\ No newline at end of file
1 939
new file mode 100644
... ...
@@ -0,0 +1,4271 @@
1
+/**
2
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
3
+ *
4
+ * @author Double Bastion LLC
5
+ *
6
+ * @license GNU AGPL version 3 or any later version
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
10
+ * License as published by the Free Software Foundation; either
11
+ * version 3 of the License, or any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
17
+ *
18
+ * You should have received a copy of the GNU Affero General Public
19
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+@font-face {
24
+    font-family: 'Inter';
25
+    src: url('../fonts/Inter-Bold.woff2') format('woff2'),
26
+         url('../fonts/Inter-Bold.woff') format('woff');
27
+    font-weight: 700;
28
+    font-style: normal;
29
+}
30
+@font-face {
31
+    font-family: 'Inter';
32
+    src: url('../fonts/Inter-BoldItalic.woff2') format('woff2'),
33
+         url('../fonts/Inter-BoldItalic.woff') format('woff');
34
+    font-weight: 700;
35
+    font-style: italic;
36
+}
37
+@font-face {
38
+    font-family: 'Inter';
39
+    src: url('../fonts/Inter-MediumItalic.woff2') format('woff2'),
40
+         url('../fonts/Inter-MediumItalic.woff') format('woff');
41
+    font-weight: 500;
42
+    font-style: italic;
43
+}
44
+@font-face {
45
+    font-family: 'Inter';
46
+    src: url('../fonts/Inter-SemiBold.woff2') format('woff2'),
47
+         url('../fonts/Inter-SemiBold.woff') format('woff');
48
+    font-weight: 600;
49
+    font-style: normal;
50
+}
51
+@font-face {
52
+    font-family: 'Inter';
53
+    src: url('../fonts/Inter-Regular.woff2') format('woff2'),
54
+         url('../fonts/Inter-Regular.woff') format('woff');
55
+    font-weight: 400;
56
+    font-style: normal;
57
+}
58
+@font-face {
59
+    font-family: 'Inter';
60
+    src: url('../fonts/Inter-SemiBoldItalic.woff2') format('woff2'),
61
+         url('../fonts/Inter-SemiBoldItalic.woff') format('woff');
62
+    font-weight: 600;
63
+    font-style: italic;
64
+}
65
+@font-face {
66
+    font-family: 'Inter';
67
+    src: url('../fonts/Inter-Italic.woff2') format('woff2'),
68
+         url('../fonts/Inter-Italic.woff') format('woff');
69
+    font-weight: 400;
70
+    font-style: italic;
71
+}
72
+@font-face {
73
+    font-family: 'Inter';
74
+    src: url('../fonts/Inter-Medium.woff2') format('woff2'),
75
+         url('../fonts/Inter-Medium.woff') format('woff');
76
+    font-weight: 500;
77
+    font-style: normal;
78
+}
79
+
80
+@font-face {
81
+    font-family: 'Open Sans';
82
+    src: url('../fonts/opensans-light.woff2') format('woff2'),
83
+         url('../fonts/opensans-light.woff') format('woff');
84
+    font-weight: 300;
85
+    font-style: normal;
86
+}
87
+@font-face {
88
+    font-family: 'Open Sans';
89
+    src: url('../fonts/opensans-lightitalic.woff2') format('woff2'),
90
+         url('../fonts/opensans-lightitalic.woff') format('woff');
91
+    font-weight: 300;
92
+    font-style: italic;
93
+}
94
+@font-face {
95
+    font-family: 'Open Sans';
96
+    src: url('../fonts/opensans-regular.woff2') format('woff2'),
97
+         url('../fonts/opensans-regular.woff') format('woff');
98
+    font-weight: 400;
99
+    font-style: normal;
100
+}
101
+@font-face {
102
+    font-family: 'Open Sans';
103
+    src: url('../fonts/opensans-italic.woff2') format('woff2'),
104
+         url('../fonts/opensans-italic.woff') format('woff');
105
+    font-weight: 400;
106
+    font-style: italic;
107
+}
108
+@font-face {
109
+    font-family: 'Open Sans';
110
+    src: url('../fonts/opensans-semibold.woff2') format('woff2'),
111
+         url('../fonts/opensans-semibold.woff') format('woff');
112
+    font-weight: 600;
113
+    font-style: normal;
114
+}
115
+@font-face {
116
+    font-family: 'Open Sans';
117
+    src: url('../fonts/opensans-semibolditalic.woff2') format('woff2'),
118
+         url('../fonts/opensans-semibolditalic.woff') format('woff');
119
+    font-weight: 600;
120
+    font-style: italic;
121
+}
122
+@font-face {
123
+    font-family: 'Open Sans';
124
+    src: url('../fonts/opensans-bold.woff2') format('woff2'),
125
+         url('../fonts/opensans-bold.woff') format('woff');
126
+    font-weight: 700;
127
+    font-style: normal;
128
+}
129
+@font-face {
130
+    font-family: 'Open Sans';
131
+    src: url('../fonts/opensans-bolditalic.woff2') format('woff2'),
132
+         url('../fonts/opensans-bolditalic.woff') format('woff');
133
+    font-weight: 700;
134
+    font-style: italic;
135
+}
136
+@font-face {
137
+    font-family: 'Open Sans';
138
+    src: url('../fonts/opensans-extrabold.woff2') format('woff2'),
139
+         url('../fonts/opensans-extrabold.woff') format('woff');
140
+    font-weight: 800;
141
+    font-style: normal;
142
+}
143
+@font-face {
144
+    font-family: 'Open Sans';
145
+    src: url('../fonts/opensans-extrabolditalic.woff2') format('woff2'),
146
+         url('../fonts/opensans-extrabolditalic.woff') format('woff');
147
+    font-weight: 800;
148
+    font-style: italic;
149
+}
150
+
151
+#smsrelentless_vbar {
152
+   font-family: 'Open Sans';
153
+}
154
+
155
+div > label {
156
+   position: relative;
157
+}
158
+
159
+label span {
160
+   display: inline-block;
161
+   min-width: 110px;
162
+   padding: 0px 0px 8px 0px;
163
+}
164
+
165
+select {
166
+   min-height: 25px;
167
+   box-sizing: border-box;
168
+   text-overflow: inherit;
169
+}
170
+
171
+.providerSettings {
172
+   background-color: #F7F7F7;
173
+   padding: 14px;
174
+}
175
+
176
+.providerName {
177
+   font-size: 18px;
178
+   font-weight: bold;
179
+   margin-bottom: 20px;
180
+}
181
+
182
+#smsrelentless_vbar {
183
+   padding: 18px;
184
+   color: #6d6c6c;
185
+}
186
+
187
+.smsr_textbox {
188
+   display: block;
189
+   box-sizing: content-box;
190
+   width: 70%;
191
+   font-family: 'Inter';
192
+   font-size: 15px;
193
+}
194
+
195
+.smsr_textbox[type='password'] {
196
+   font-size: 10px !important;
197
+}
198
+
199
+.smsr_textboxspec {
200
+   box-sizing: content-box;
201
+   width: 70%;
202
+   font-family: 'Inter';
203
+   font-size: 15px;
204
+}
205
+
206
+#copyToClipboardtel, #copyToClipboardnex, #copyToClipboardtwil, #copyToClipboardflow {
207
+   display: inline-block;
208
+   width: 18px;
209
+   height: 18px;
210
+   margin: 0px 0px -4px 5px;
211
+   cursor: pointer;
212
+}
213
+
214
+#copyToClipboardtel:hover, #copyToClipboardnex:hover, #copyToClipboardtwil:hover, #copyToClipboardflow:hover {
215
+   background-color: #E0E0E0;
216
+}
217
+
218
+#telapi_url, #nexapi_url, #twilapi_url, #twilapi_url_rec, #flowapi_url, #flowapi_url_rec {
219
+   display: inline-block;
220
+   box-sizing: content-box;
221
+   width: 70%;
222
+   font-family: 'Inter';
223
+   font-size: 15px !important;
224
+}
225
+
226
+#generate_tel_rcpt, #generate_tel_delrcpt, #generate_nex_rcpt, #generate_nex_delrcpt, #generate_twil_rcpt, #generate_twil_delrcpt, #generate_flow_rcpt, #generate_flow_delrcpt {
227
+   display: block;
228
+   white-space: normal;
229
+   word-wrap: break-word;
230
+}
231
+
232
+.generateUrl {
233
+   color: #161616;
234
+   background-color: #e3ecf0 !important;
235
+   font-family: 'Inter';
236
+}
237
+
238
+.generateUrl:hover {
239
+   background-color: #c2dcea !important;
240
+}
241
+
242
+.generateUrl:active {
243
+   background-color: #b5cfdd !important;
244
+}
245
+
246
+.setlabeltext {
247
+  font-size: 15px;
248
+}
249
+
250
+#smsr_save_msg {
251
+   display: inline;
252
+   color: #181918;
253
+   background-color: #a5e5b3;
254
+   font-weight: bold;
255
+}
256
+
257
+#get_notify {
258
+   display: block;
259
+   margin-bottom: 18px;
260
+   cursor: pointer;
261
+}
262
+
263
+#includesmsinemail, #showdisplaynames, #adddisplaynames, #showallmessages {
264
+   display: block;
265
+   margin-bottom: 14px;
266
+   cursor: pointer;
267
+}
268
+
269
+#currentbaldiv, #smsnumbersdiv {
270
+   display: block;
271
+   position: relative;
272
+   font-size: 15px;
273
+   font-weight: bold;
274
+   height: 30px;
275
+   margin: 0px 0px 14px 0px;
276
+   background-color: #4CA3D9;
277
+   border-radius: 20px;
278
+}
279
+
280
+.providername {
281
+  color: #FFFFFF;
282
+}
283
+
284
+.providername:hover {
285
+  color: #2c0cfc;
286
+}
287
+
288
+#currentbalance {
289
+  display: inline;
290
+  position: absolute;
291
+  margin: 3px 0px 0px 110px;
292
+  color: #262626;
293
+  font-weight: 600;
294
+}
295
+
296
+#smsprovider {
297
+  display: inline;
298
+  position: absolute;
299
+  width: 102px;
300
+  height: 22px;
301
+  margin: 3px 0px 0px 0px;
302
+  padding: 0px 0px 1px 0px !important;
303
+  -moz-box-sizing: border-box;
304
+  -webkit-box-sizing: border-box;
305
+  box-sizing: border-box;
306
+  background: #fcfcfc;
307
+  font-family: 'Inter' !important;
308
+  font-size: 14.5px;
309
+  font-weight: 600;
310
+  color: #565656;
311
+  text-align: center;
312
+  border-radius: 20px;
313
+}
314
+
315
+#currentsmsnmbrs {
316
+  display: inline-block;
317
+  position: absolute;
318
+  height: 22px;
319
+  width: 54%;
320
+  padding: 0 !important;
321
+  margin: 2px 0px 0px 0px;
322
+  text-align: center;
323
+  text-overflow: inherit;
324
+  font-family: 'Inter' !important;
325
+  font-size: 14px;
326
+  font-weight: 600;
327
+  color: #565656;
328
+  -moz-box-sizing: border-box;
329
+  -webkit-box-sizing: border-box;
330
+  box-sizing: border-box;
331
+  background: #fcfcfc;
332
+  border-radius: 20px;
333
+}
334
+
335
+#refreshSenderIDs {
336
+  display: block;
337
+  position: relative;
338
+  min-width: 24px;
339
+  min-height: 24px;
340
+  float: right;
341
+  padding-left: 0;
342
+  margin-top: 2.6px;
343
+  margin-right: 4px;
344
+  background-image: url('../img/refresh.svg');
345
+  background-repeat: no-repeat;
346
+  background-size: 110% 110%;
347
+  background-position: center center;
348
+  cursor: pointer;
349
+  background-color: #ffffff;
350
+}
351
+
352
+.cllridcls {
353
+  position: relative;
354
+  display: inline;
355
+  font-size: 17px;
356
+  color: #000000;
357
+}
358
+
359
+.tooltipbalanceid  {
360
+  position: relative;
361
+  display: inline-block;
362
+  float: right;
363
+  font-size: 15px;
364
+  color: #000000;
365
+  z-index: 9;
366
+}
367
+
368
+.tooltipsetid  {
369
+  position: relative;
370
+  display: inline-block;
371
+  float: right;
372
+  font-size: 15px;
373
+  color: #000000;
374
+  z-index: 8;
375
+}
376
+
377
+.tooltipbalanceid #infobalance {
378
+  display: block;
379
+  position: relative;
380
+  margin: 4px 14px 0px 0px;
381
+  color: #000000;
382
+  font-size: 19px;
383
+  font-weight: bold;
384
+  font-family: 'Open Sans';
385
+  font-style: italic;
386
+  z-index: 6;
387
+}
388
+
389
+.tooltipbalanceid .balancetooltip {
390
+  display: block;
391
+  position: absolute;
392
+  visibility: hidden;
393
+  width: 264px;
394
+  background-color: #fafafa;
395
+  font-size: 14px;
396
+  font-weight: bold;
397
+  color: #595959;
398
+  text-align: left;
399
+  border-radius: 5px;
400
+  padding: 5px 5px 5px 8px;
401
+  margin: -4px 0px 0px -244px;
402
+  box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
403
+  -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
404
+  -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
405
+  z-index: 6;
406
+}
407
+
408
+.tooltipbalanceid:hover .balancetooltip {
409
+   visibility: visible;
410
+}
411
+
412
+#infotipid {
413
+   display: block;
414
+   position: relative;
415
+   margin: 3.5px 12px 0px 0px;
416
+   color: #000000;
417
+   font-size: 19px;
418
+   font-weight: bold;
419
+   font-family: 'Open Sans';
420
+   font-style: italic;
421
+   z-index: 5;
422
+}
423
+
424
+#setcalleridtp {
425
+   display: block;
426
+   position: absolute;
427
+   width: 274px;
428
+   overflow-y: scroll;
429
+   visibility: hidden;
430
+   background-color: #fafafa;
431
+   border-radius: 5px;
432
+   margin: -5px 0px 0px -223px;
433
+   scrollbar-width: auto;
434
+   scrollbar-color: #a2a2a2 #ececec;
435
+   box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
436
+   -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
437
+   -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
438
+   z-index: 10;
439
+}
440
+
441
+.calleridtooltip {
442
+   display: block;
443
+   position: relative;
444
+   width: auto;
445
+   height: auto;
446
+   background-color: #f4f4f4;
447
+   font-size: 14px;
448
+   font-weight: bold;
449
+   color: #595959;
450
+   text-align: left;
451
+   padding: 5px 12px 5px 10px;
452
+   z-index: 10;
453
+}
454
+
455
+.tooltipsetid:hover #setcalleridtp {
456
+   visibility: visible;
457
+}
458
+
459
+.pflabels {
460
+   font-size: 15px;
461
+   font-weight: bold;
462
+}
463
+
464
+.srheader {
465
+   display: block;
466
+   position: relative;
467
+   margin: 0px 0px 7px 0px;
468
+   font-size: 15px;
469
+   font-weight: bold;
470
+}
471
+
472
+.sendtomultrcvrs {
473
+   display: block;
474
+   position: relative;
475
+   margin: 0px 0px 7px 0px;
476
+   font-size: 17px;
477
+}
478
+
479
+.smsnbformat {
480
+   display: block;
481
+   position: relative;
482
+   margin: 0px;
483
+   font-size: 15px;
484
+   font-weight: bold;
485
+}
486
+
487
+.smsrelentless_box {
488
+   width: 400px;
489
+   display: block;
490
+}
491
+.indtext {
492
+   display: inline-block;
493
+   padding-left: 10px;
494
+}
495
+
496
+#settings-dscr {
497
+   padding-top: 3px;
498
+}
499
+
500
+#sms_upload_msg {
501
+   display: block;
502
+   color: #181918;
503
+   background-color: #a5e5b3;
504
+   font-weight: bold;
505
+}
506
+
507
+#sms_submit_msg {
508
+   display: none;
509
+   margin: 14px 0px 8px 0px;
510
+   padding: 1px 20px 1px 20px;
511
+   width: 100%;
512
+   color: #181918;
513
+   background-color: #a5e5b3;
514
+   font-size: 15px;
515
+   font-weight: bold;
516
+   text-align: center;
517
+   border-radius: 14px;
518
+}
519
+
520
+#pickedfilename {
521
+   font-size: 13px;
522
+}
523
+
524
+#smstodiv {
525
+   display: block;
526
+   position: relative;
527
+   height: 32px;
528
+}
529
+
530
+#smsto {
531
+   display: block;
532
+   width: 99%;
533
+   max-height: 32px;
534
+   padding: 0px 15px 0px 15px;
535
+   color: #565656;
536
+   font-family: 'Inter';
537
+   font-size: 15px;
538
+   font-weight: 600;
539
+   border-radius: 20px;
540
+}
541
+
542
+#sendtomultiple {
543
+   display: inline-block;
544
+   position: relative;
545
+   margin: 10px 0px 12px 0px;
546
+   font-size: 15px;
547
+   font-weight: bold;
548
+}
549
+
550
+#entermessage {
551
+   display: block;
552
+   position: relative;
553
+   margin: 4px 0px 0px 0px;
554
+   font-size: 15px;
555
+   font-weight: bold;
556
+}
557
+
558
+#uploadfileforsms {
559
+   margin-left: 7px;
560
+   background-color: #ffffff;
561
+   border-radius: 3px !important;
562
+}
563
+
564
+.entertime {
565
+   display: inline-block;
566
+   font-size: 15px;
567
+   font-weight: 700;
568
+   margin: 0 0 9px 0;
569
+}
570
+
571
+#sendmediafl {
572
+   display: block;
573
+   position: relative;
574
+   margin: 0px 0px 20px 0px;
575
+   font-size: 15px;
576
+   font-weight: 700;
577
+}
578
+
579
+#tomultchckbx {
580
+   display: inline-block;
581
+   position: absolute;
582
+   margin: 3px 0px 0px 10px;
583
+}
584
+
585
+#mediafilechckbx {
586
+   display: inline-block;
587
+   position: absolute;
588
+   margin: -7px 0px 0px 10px;
589
+}
590
+
591
+#deleteoldchckbox {
592
+   display: inline-block;
593
+   position: absolute;
594
+   margin: 3.5px 0px 0px 10px;
595
+}
596
+
597
+#tomultchckbx:hover, #mediafilechckbx:hover, #deleteoldchckbox:hover {
598
+   cursor: pointer;
599
+}
600
+
601
+.maxmessagelength {
602
+   display: none;
603
+   position: relative;
604
+   margin: 2px 7px 4px 0px;
605
+   font-size: 15px;
606
+   color: #000000;
607
+   z-index: 6;
608
+}
609
+
610
+#maxlengthinfo {
611
+   display: block;
612
+   position: absolute;
613
+   width: 274px;
614
+   height: 200px;
615
+   overflow-y: scroll;
616
+   visibility: hidden;
617
+   background-color: #fafafa;
618
+   border-radius: 5px;
619
+   margin: -11px 0px 0px -6px;
620
+   scrollbar-width: auto;
621
+   scrollbar-color: #a2a2a2 #ececec;
622
+   box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
623
+   -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
624
+   -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
625
+   z-index: 10;
626
+}
627
+
628
+.maxlengthtooltip {
629
+   display: block;
630
+   position: relative;
631
+   width: auto;
632
+   height: auto;
633
+   background-color: #f4f4f4;
634
+   font-size: 14px;
635
+   font-weight: bold;
636
+   color: #595959;
637
+   text-align: left;
638
+   padding: 5px 12px 5px 10px;
639
+   z-index: 10;
640
+}
641
+
642
+.maxmessagelength:hover #maxlengthinfo {
643
+   visibility: visible;
644
+}
645
+
646
+.up-bttn-wrapper {
647
+  display: block;
648
+  position: relative;
649
+  overflow: hidden;
650
+  padding-top: 20px;
651
+  padding-bottom: 30px;
652
+}
653
+
654
+#smstext {
655
+  display: inline-block;
656
+  color: #2a2a2a;
657
+  width: 100%;
658
+  height: 130px;
659
+  text-align: left;
660
+  font-family: 'Inter';
661
+  font-size: 15px;
662
+  font-weight: 500;
663
+  border-radius: 6px;
664
+  resize: vertical;
665
+  white-space: pre-wrap;
666
+}
667
+
668
+#char_count {
669
+  display: none;
670
+  font-size: 14px;
671
+  font-weight: bold;
672
+}
673
+
674
+#mtextSize {
675
+  display: none;
676
+  margin-left: 10px;
677
+  font-size: 14px;
678
+  font-weight: bold;
679
+  color: #4CA3D9;
680
+}
681
+
682
+#submitsms {
683
+   display: block;
684
+   position: relative;
685
+   margin-top: 14px;
686
+   color: white;
687
+   font-family: 'Open Sans';
688
+   font-weight: 700;
689
+   font-size: 15px;
690
+   background-color: #4CA3D9;
691
+   border-radius: 20px;
692
+   cursor: pointer;
693
+   opacity: 1 !important;
694
+}
695
+
696
+#submitsms:hover {
697
+   border-color: #5CAECC;
698
+}
699
+
700
+#submitsms:active {
701
+   background: #4B96B1;
702
+   border-color: #4B96B1;
703
+}
704
+
705
+#multiplerecivers {
706
+   display: none;
707
+   background: #e8f6ff;
708
+   border-radius: 6px;
709
+   padding: 5px;
710
+   margin: 0px 0px 20px 0px;
711
+}
712
+
713
+#multsetrows {
714
+  display: block;
715
+  padding: 5px;
716
+}
717
+
718
+#multsmsinterval {
719
+  display: block;
720
+  width: 100px;
721
+  height: 25px;
722
+  font-family: 'Inter';
723
+  font-size: 14px;
724
+  font-weight: 600;
725
+  padding: 0px 0px 0px 10px;
726
+  border-radius: 20px;
727
+}
728
+
729
+#app {
730
+  position: relative;
731
+  display: flex;
732
+  min-height: 100%;
733
+  min-width: 100%;
734
+}
735
+
736
+#app-content {
737
+   position: relative;
738
+   z-index: 1000;
739
+   flex-basis: 100vw;
740
+   min-width: 0;
741
+   min-height: 100%;
742
+   margin: 0 !important;
743
+   overflow-y: scroll;
744
+}
745
+
746
+#viewerContainer {
747
+   display: block;
748
+   position: relative;
749
+   width: 100%;
750
+   height: 100%;
751
+}
752
+
753
+.pdfViewer #viewer {
754
+   display: block;
755
+   position: relative;
756
+   min-width: 100%;
757
+   min-height: 100%;
758
+}
759
+
760
+#smsdocpreview {
761
+   display: inline-block;
762
+   position: relative;
763
+   width: 100%;
764
+   height: 100%;
765
+   margin-top: -50px;
766
+}
767
+
768
+#outerContainer {
769
+   display: block;
770
+   position: relative;
771
+   width: 100%;
772
+   height: 100%;
773
+}
774
+
775
+#mainContainer {
776
+   display: block;
777
+   position: relative;
778
+   width: 100%;
779
+   height: 100%;
780
+}
781
+
782
+.texttooltip {
783
+  font-family: 'Open Sans';
784
+  font-style: italic;
785
+  color: #000000;
786
+  font-size: 19px;
787
+  font-weight: bold;
788
+  margin: 0px 0px 4px 4px;
789
+}
790
+
791
+.fortooltip {
792
+   position: relative;
793
+   display: inline-block;
794
+   margin: 0px;
795
+   font-size: 15px;
796
+   color: #000000;
797
+   z-index: 7;
798
+}
799
+
800
+.fortooltipsec {
801
+   position: relative;
802
+   display: inline-block;
803
+   font-size: 15px;
804
+   color: #000000;
805
+   padding: 2px 0px 4px 2px;
806
+   z-index: 3;
807
+}
808
+
809
+.fortooltiptert {
810
+   position: relative;
811
+   display: inline-block;
812
+   font-size: 15px;
813
+   color: #000000;
814
+   padding: 2px 0px 4px 2px;
815
+   z-index: 0;
816
+}
817
+
818
+.fortooltipfourth {
819
+   position: relative;
820
+   display: inline-block;
821
+   font-size: 15px;
822
+   color: #000000;
823
+   padding: 2px 0px 4px 2px;
824
+   z-index: 4;
825
+}
826
+
827
+#tonmbrformat {
828
+   display: block;
829
+   position: absolute;
830
+   width: 274px;
831
+   overflow-y: scroll;
832
+   visibility: hidden;
833
+   background-color: #fafafa;
834
+   border-radius: 5px;
835
+   margin: -11px 0px 0px -6px;
836
+   scrollbar-width: auto;
837
+   scrollbar-color: #a2a2a2 #ececec;
838
+   box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
839
+   -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
840
+   -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
841
+   z-index: 10;
842
+}
843
+
844
+.fortooltiptext {
845
+   display: block;
846
+   position: relative;
847
+   width: auto;
848
+   height: auto;
849
+   background-color: #f4f4f4;
850
+   font-size: 14px;
851
+   font-weight: bold;
852
+   color: #595959;
853
+   text-align: left;
854
+   padding: 5px 12px 5px 10px;
855
+   z-index: 10;
856
+}
857
+
858
+.fortooltip:hover #tonmbrformat {
859
+   visibility: visible;
860
+}
861
+
862
+#uploadfileinfo {
863
+   display: block;
864
+   position: absolute;
865
+   width: 274px;
866
+   overflow-y: scroll;
867
+   visibility: hidden;
868
+   background-color: #fafafa;
869
+   border-radius: 5px;
870
+   margin: -11px 0px 0px -6px;
871
+   scrollbar-width: auto;
872
+   scrollbar-color: #a2a2a2 #ececec;
873
+   box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
874
+   -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
875
+   -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
876
+   z-index: 10;
877
+}
878
+
879
+.fortooltiptextsec {
880
+   display: block;
881
+   position: relative;
882
+   width: auto;
883
+   height: auto;
884
+   background-color: #f4f4f4;
885
+   font-size: 14px;
886
+   font-weight: bold;
887
+   color: #595959;
888
+   text-align: left;
889
+   padding: 5px 12px 5px 10px;
890
+   z-index: 10;
891
+}
892
+
893
+.fortooltipsec:hover #uploadfileinfo {
894
+   visibility: visible;
895
+}
896
+
897
+#deleteoldinfo {
898
+   display: block;
899
+   position: absolute;
900
+   width: 274px;
901
+   height: 200px;
902
+   overflow-y: scroll;
903
+   visibility: hidden;
904
+   background-color: #fafafa;
905
+   border-radius: 5px;
906
+   margin: -11px 0px 0px -6px;
907
+   scrollbar-width: auto;
908
+   scrollbar-color: #a2a2a2 #ececec;
909
+   box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
910
+   -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
911
+   -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
912
+   z-index: 10;
913
+}
914
+
915
+.fortooltiptexttert {
916
+   display: block;
917
+   position: relative;
918
+   width: auto;
919
+   height: auto;
920
+   background-color: #f4f4f4;
921
+   font-size: 14px;
922
+   font-weight: bold;
923
+   color: #595959;
924
+   text-align: left;
925
+   padding: 5px 12px 5px 10px;
926
+   z-index: 10;
927
+}
928
+
929
+.fortooltiptert:hover #deleteoldinfo {
930
+   visibility: visible;
931
+}
932
+
933
+#uploadmmfileinfo {
934
+   display: block;
935
+   position: absolute;
936
+   width: 274px;
937
+   height: 350px;
938
+   overflow-y: scroll;
939
+   visibility: hidden;
940
+   background-color: #fafafa;
941
+   border-radius: 5px;
942
+   margin: -11px 0px 0px -16px;
943
+   scrollbar-width: auto;
944
+   scrollbar-color: #a2a2a2 #ececec;
945
+   box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
946
+   -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
947
+   -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
948
+   z-index: 10;
949
+}
950
+
951
+#tooltiptextfourth {
952
+   display: block;
953
+   position: relative;
954
+   width: auto;
955
+   height: auto;
956
+   background-color: #f4f4f4;
957
+   font-size: 14px;
958
+   font-weight: bold;
959
+   color: #595959;
960
+   text-align: left;
961
+   padding: 5px 12px 5px 10px;
962
+   z-index: 10;
963
+}
964
+
965
+.fortooltipfourth:hover #uploadmmfileinfo {
966
+   visibility: visible;
967
+}
968
+
969
+.fileupload {
970
+   display: none;
971
+}
972
+
973
+.uploadflbt {
974
+   width: 411px;
975
+}
976
+
977
+#infotipmms {
978
+   display: block;
979
+   position: relative;
980
+   margin: 0px;
981
+   color: #000000;
982
+   font-size: 19px;
983
+   font-weight: bold;
984
+   font-family: 'Open Sans';
985
+   font-style: italic;
986
+   z-index: 5;
987
+}
988
+
989
+#mmsfoldersview {
990
+   display: none;
991
+   position: relative;
992
+   width: 100%;
993
+   height: 100%;
994
+   margin-top: -50px;
995
+   background-color: #f4f9ff;
996
+}
997
+
998
+#upmediafiles {
999
+   display: none;
1000
+   background: #e8f6ff;
1001
+   border-radius: 6px;
1002
+   padding: 10px;
1003
+   margin: 0px 0px 20px 0px;
1004
+}
1005
+
1006
+.uploadflbt .icon-upload {
1007
+   display: inline;
1008
+}
1009
+
1010
+.pfprompt {
1011
+   font-size: 15px;
1012
+   font-weight: bold;
1013
+}
1014
+
1015
+.fileuploadstl, .filesfromnc {
1016
+  display: block;
1017
+  font-size: 15px;
1018
+  font-weight: bold;
1019
+  color: #000000;
1020
+}
1021
+
1022
+#uploadfileformms {
1023
+  margin-left: 21px;
1024
+  background-color: #ffffff;
1025
+  border-radius: 3px !important;
1026
+}
1027
+
1028
+#filestotsize {
1029
+  display: none;
1030
+  position: relative;
1031
+  height: auto;
1032
+  padding: 0px 0px 8px 0px;
1033
+  font-size: 14px;
1034
+  font-weight: bold;
1035
+  color: #189558;
1036
+}
1037
+
1038
+#filessizetext {
1039
+  display: inline;
1040
+  position: relative;
1041
+  padding-left: 10px;
1042
+}
1043
+
1044
+#fileuploadednm #induploadfile .indivflcls {
1045
+  display: inline-block;
1046
+  position: relative;
1047
+  height:auto;
1048
+  max-width: 90%;
1049
+  overflow: visible;
1050
+  white-space: normal;
1051
+  word-break: break-all;
1052
+  text-overflow: ellipsis;
1053
+  font-size: 15px;
1054
+  color: #0e6ba0;
1055
+}
1056
+
1057
+#fileuploadednm #induploadfile .indivflcls:hover {
1058
+  cursor: pointer;
1059
+  text-decoration: underline;
1060
+}
1061
+
1062
+#fileuploadednm #induploadfile .indupfldl {
1063
+  position: relative;
1064
+  display: inline-block;
1065
+  float: right;
1066
+  cursor: pointer;
1067
+  width: 20px;
1068
+  color: #0e6ba0;
1069
+  text-align: center;
1070
+  font-size: 15px;
1071
+}
1072
+
1073
+#fileuploadednm #induploadfile .indupfldl:hover {
1074
+  background-color: #e8f6ff;
1075
+  cursor: pointer;
1076
+}
1077
+
1078
+#filespickednc .indivflpckd {
1079
+  display: inline-block;
1080
+  position: relative;
1081
+  height:auto;
1082
+  max-width: 90%;
1083
+  overflow: visible;
1084
+  white-space: normal;
1085
+  word-break: break-all;
1086
+  text-overflow: ellipsis;
1087
+  color: #0e6ba0;
1088
+}
1089
+
1090
+.indivflpckd:hover {
1091
+  cursor: pointer;
1092
+  text-decoration: underline;
1093
+}
1094
+
1095
+.indpckfldl {
1096
+  position: relative;
1097
+  display: inline-block;
1098
+  float: right;
1099
+  cursor: pointer;
1100
+  width: 20px;
1101
+  color: #0e6ba0;
1102
+  text-align: center;
1103
+}
1104
+
1105
+#filespickednc .indpckfldl:hover {
1106
+  background-color: #e8f6ff;
1107
+  cursor: pointer;
1108
+}
1109
+
1110
+#pf_upload_msg, #pf_choose_msg {
1111
+  display: block;
1112
+  color: #181918;
1113
+  background-color: #a5e5b3;
1114
+  font-weight: bold;
1115
+  text-align: center;
1116
+  border-radius: 3px;
1117
+}
1118
+
1119
+#choosefilen {
1120
+  display: inline;
1121
+  position: relative;
1122
+  margin: 0px 0px 20px 16px;
1123
+  padding-top: 15px;
1124
+  background-image: url('../img/nextcloud_logo.svg');
1125
+  background-repeat: no-repeat;
1126
+  background-size: 110% 125%;
1127
+  background-position: center center;
1128
+  min-width: 66px;
1129
+  min-height: 30px;
1130
+  cursor:pointer;
1131
+}
1132
+
1133
+#choosefilen:active {
1134
+  background-image: url('../img/nextcloud_logo_bright.svg');
1135
+  background-repeat: no-repeat;
1136
+  background-size: 110% 125%;
1137
+  background-position: center center;
1138
+  min-width: 66px;
1139
+  min-height: 30px;
1140
+}
1141
+
1142
+#pickFromNext, #uploadFile {
1143
+  display: inline-block;
1144
+  position: relative;
1145
+  font-size: 15px;
1146
+  font-weight: bold;
1147
+  color: #6d6c6c;
1148
+}
1149
+
1150
+#filespickednc .indivflpckd {
1151
+  display: inline-block;
1152
+  position: relative;
1153
+  height:auto;
1154
+  max-width: 90%;
1155
+  overflow: visible;
1156
+  white-space: normal;
1157
+  word-break: break-all;
1158
+  text-overflow: ellipsis;
1159
+  color: #0e6ba0;
1160
+}
1161
+
1162
+#filespickednc .indpckfldl:hover {
1163
+  background-color: #e8f6ff;
1164
+  cursor: pointer;
1165
+}
1166
+
1167
+.uploadflbt {
1168
+  width: 411px;
1169
+}
1170
+
1171
+.uploadflbt .icon-upload {
1172
+  display: inline;
1173
+}
1174
+
1175
+.uploadphnfiledv {
1176
+  display: inline-block;
1177
+  position: relative;
1178
+  margin: 16px 0;
1179
+}
1180
+
1181
+.uploadfiledv {
1182
+  display: inline-block;
1183
+  position: relative;
1184
+  margin: 16px 0px 22px 0px;
1185
+}
1186
+
1187
+#mmsfileuploadednm .indivflcls {
1188
+  display: inline-block;
1189
+  position: relative;
1190
+  height:auto;
1191
+  max-width: 90%;
1192
+  overflow: visible;
1193
+  white-space: normal;
1194
+  word-break: break-all;
1195
+  text-overflow: ellipsis;
1196
+  color: #0e6ba0;
1197
+}
1198
+
1199
+#mmsfileuploadednm .indivflcls:hover {
1200
+  cursor: pointer;
1201
+  text-decoration: underline;
1202
+}
1203
+
1204
+#mmsfileuploadednm .indupfldl {
1205
+  position: relative;
1206
+  display: inline-block;
1207
+  float: right;
1208
+  cursor: pointer;
1209
+  width: 20px;
1210
+  color: #0e6ba0;
1211
+  text-align: center;
1212
+}
1213
+
1214
+#mmsfileuploadednm .indupfldl:hover {
1215
+  background-color: #e8f6ff;
1216
+  cursor: pointer;
1217
+}
1218
+
1219
+#filessizetext {
1220
+  display: inline;
1221
+  position: relative;
1222
+  padding-left: 10px;
1223
+}
1224
+
1225
+.srheaderch {
1226
+  display: block;
1227
+  position: relative;
1228
+  margin: 0px 0px 15px 0px;
1229
+  font-size: 15px;
1230
+  font-weight: bold;
1231
+}
1232
+
1233
+.indgenflclsmms, .indgenpckfls {
1234
+  display: block;
1235
+  margin: 10px 6px 0px 6px;
1236
+}
1237
+
1238
+#pickfilesNext {
1239
+  display: block;
1240
+  margin: 20px 0px 0px 0px;
1241
+}
1242
+
1243
+#dirbuttons {
1244
+  margin-top: 20px;
1245
+}
1246
+
1247
+button, input, textarea, div[contenteditable="true"], div[contenteditable="false"] {
1248
+  min-height: 9px;
1249
+}
1250
+
1251
+#choosefilen {
1252
+  display: inline;
1253
+  position: relative;
1254
+  margin: 4px 0px 20px 16px;
1255
+  background-image: url('../img/nextcloud_logo.svg');
1256
+  background-repeat: no-repeat;
1257
+  background-size: 110% 125%;
1258
+  background-position: center center;
1259
+  min-width: 66px;
1260
+  min-height: 30px;
1261
+  cursor:pointer;
1262
+}
1263
+
1264
+#choosefilen:active {
1265
+  background-image: url('../img/nextcloud_logo_bright.svg');
1266
+  background-repeat: no-repeat;
1267
+  background-size: 110% 125%;
1268
+  background-position: center center;
1269
+  min-width: 66px;
1270
+  min-height: 30px;
1271
+}
1272
+
1273
+#pickid, #showsum {
1274
+  display: inline-block;
1275
+  position: relative;
1276
+  font-size: 15px;
1277
+  font-weight: bold;
1278
+  margin: 3px 4px 0px 14px;
1279
+  color: #FFFFFF;
1280
+}
1281
+
1282
+.smsrelentless_checkbox:hover {
1283
+  cursor: pointer;
1284
+}
1285
+
1286
+#smstables {
1287
+  display: block; 
1288
+  position: relative;
1289
+  min-width: 100%;
1290
+  min-height: 100%;
1291
+  font-family: 'Inter' !important;
1292
+}
1293
+
1294
+#smsRGreyLogo {
1295
+  display: block;
1296
+  position: relative;
1297
+  background-image: url('../img/sms_relentless_grey.svg');
1298
+  background-repeat: no-repeat;
1299
+  background-position: center center;
1300
+  width: 100%;
1301
+  height: 675px;
1302
+}
1303
+
1304
+#recSmsTable, #sentSmsTable {
1305
+  display: block;
1306
+  position: relative;
1307
+  top: 0px;
1308
+  width: 100%;
1309
+  height: auto;
1310
+  font-size: 14px;
1311
+  z-index: 50;
1312
+  background: #FFFFFF;
1313
+}
1314
+
1315
+.receivedrows, .receivedrowsbody, .sentrows, .sentrowsbody, .groupedmsgrows {
1316
+  border: 1px solid #f3f3f3;
1317
+  padding: 8px;
1318
+}
1319
+
1320
+#conversationsTable {
1321
+  display: block;
1322
+  position: relative;
1323
+  top: 0;
1324
+  bottom: 0;
1325
+  font-size: 14px;
1326
+  background-color: #ffffff;
1327
+  z-index: 1000;
1328
+}
1329
+
1330
+#conversationsTable td {
1331
+  text-align: left;
1332
+  vertical-align: top;
1333
+  border: 1px solid #f3f3f3;
1334
+  padding: 2px;
1335
+}
1336
+
1337
+#conversationsTable tr:hover {
1338
+  background-color: #ffffff;
1339
+}
1340
+
1341
+#convArchAndActive {
1342
+  overflow-y: auto;
1343
+  margin-top: -2.5px;
1344
+  min-width: 245px;
1345
+}
1346
+
1347
+#conversationsText {
1348
+  overflow-y: auto;
1349
+  margin-top: -2.5px;
1350
+}
1351
+
1352
+#totalConvNmbr {
1353
+  display: block;
1354
+  position: relative;
1355
+  width: 100%;
1356
+  height: auto;
1357
+  margin: -1px 0 0 0;
1358
+  padding: 0 0 0 7px;
1359
+  font-size: 13px;
1360
+  font-weight: 600;
1361
+  color: #4cbc86;
1362
+  white-space: normal;
1363
+  word-break: break-word;
1364
+}
1365
+
1366
+#activeCvImg {
1367
+  display: inline-block;
1368
+  position: relative;
1369
+  width: 12px;
1370
+  height: 12px;
1371
+  margin: 0px 4px 0px 14px;
1372
+  background-image: url('../img/active_small.svg');
1373
+  background-repeat: no-repeat;
1374
+  background-position: center center;
1375
+  vertical-align: middle;
1376
+}
1377
+
1378
+#archivedCvImg {
1379
+  display: inline-block;
1380
+  position: relative;
1381
+  width: 15px;
1382
+  height: 15px;
1383
+  margin: 0px 6px 0px 4px;
1384
+  background-image: url('../img/archived_small.svg');
1385
+  background-repeat: no-repeat;
1386
+  background-position: center center;
1387
+  vertical-align: text-top;
1388
+}
1389
+
1390
+#convTextHeader {
1391
+  position: sticky;
1392
+  top: 0;
1393
+  min-height: 30px;
1394
+  margin-bottom: 8px;
1395
+  background-color: #e3f4fa;
1396
+  border-radius: 4px;
1397
+  font-size: 15px;
1398
+  font-weight: 700;
1399
+  box-shadow: 0 8px 10px rgba(0, 0, 0, 0.1);
1400
+  z-index: 1000;
1401
+}
1402
+
1403
+#convTextTbl {
1404
+  display: table;
1405
+  table-layout: fixed;
1406
+  position: relative;
1407
+  margin: 0;
1408
+  border: none;
1409
+  font-size: 14px;
1410
+  width: 100%;
1411
+  height: 100%;
1412
+}
1413
+
1414
+#convTextTbl tr:hover {
1415
+  background-color: transparent;
1416
+}
1417
+
1418
+#convTextTbl td {
1419
+  height: 100%;
1420
+  margin: 0;
1421
+  padding: 0;
1422
+  border: none;
1423
+  text-align: center;
1424
+}
1425
+
1426
+#archUnarchAct {
1427
+  display: block;
1428
+  width: 20.8px;
1429
+  height: 26px;
1430
+  z-index: 999999;
1431
+}
1432
+
1433
+.archiveConv {
1434
+  display: block;
1435
+  position: absolute;
1436
+  width: 20.8px;
1437
+  height: 26px;
1438
+  top: 1px;
1439
+  left: 12.5px;
1440
+  background-image: url('../img/archive.svg');
1441
+  background-repeat: no-repeat;
1442
+  background-position: center center;
1443
+  cursor: pointer;
1444
+}
1445
+
1446
+.archiveConv:hover {
1447
+  background-image: url('../img/archive_red.svg');
1448
+}
1449
+
1450
+.unarchiveConv {
1451
+  display: block;
1452
+  position: absolute;
1453
+  width: 20.8px;
1454
+  height: 26px;
1455
+  top: 1px;
1456
+  left: 11px;
1457
+  background-image: url('../img/unarchive.svg');
1458
+  background-repeat: no-repeat;
1459
+  background-position: center center;
1460
+  cursor: pointer;
1461
+}
1462
+
1463
+.unarchiveConv:hover {
1464
+  background-image: url('../img/unarchive_red.svg');
1465
+}
1466
+
1467
+#filterSection {
1468
+  display: block;
1469
+  position: relative;
1470
+  height: 16px;
1471
+  margin: 4px 6px 0 6px;
1472
+  background-color: #f0fbff;
1473
+  border-radius: 10px;
1474
+  border: none;
1475
+  cursor: pointer;
1476
+  text-align: center;
1477
+}
1478
+
1479
+#filterSecImg {
1480
+  display: inline-block;
1481
+  position: relative;
1482
+  width: 10.7px;
1483
+  height: 10.7px;
1484
+  margin: 0 auto 4.5px auto;
1485
+  background-image: url('../img/filter_blue.svg');
1486
+  background-repeat: no-repeat;
1487
+  background-position: center center;
1488
+  cursor: pointer;
1489
+}
1490
+
1491
+#filterByTag {
1492
+  display: none;
1493
+  width: 100%;
1494
+  height: auto;
1495
+  margin: 1px 0 2px;
1496
+}
1497
+
1498
+#filterByTagImg {
1499
+  display: inline-block;
1500
+  position: relative;
1501
+  width: 12px;
1502
+  height: 12px;
1503
+  margin: 0 13px 0 8px;
1504
+  background-image: url('../img/tag.svg');
1505
+  background-repeat: no-repeat;
1506
+  background-position: center center;
1507
+}
1508
+
1509
+#tagFilter {
1510
+  display: inline-block;
1511
+  position: relative;
1512
+  height: 20px;
1513
+  width: 79%;
1514
+  margin: 0;
1515
+  padding: 0 9px;
1516
+  text-align: left;
1517
+  text-overflow: inherit;
1518
+  font-family: 'Inter' !important;
1519
+  font-size: 14px;
1520
+  font-weight: 600;
1521
+  color: #565656;
1522
+  -moz-box-sizing: border-box;
1523
+  -webkit-box-sizing: border-box;
1524
+  box-sizing: border-box;
1525
+  background-color: #f0fbff;
1526
+  border-radius: 20px;
1527
+  border: none;
1528
+}
1529
+
1530
+#clearTagFilter {
1531
+  display: inline-block;
1532
+  position: relative;
1533
+  width: 18px;
1534
+  height: 18px;
1535
+  margin: 0 0 -4px 9px;
1536
+  background-image: url('../img/clearfilters_small.svg');
1537
+  background-repeat: no-repeat;
1538
+  background-position: center center;
1539
+  cursor: pointer;
1540
+}
1541
+
1542
+#filterByFlag {
1543
+  display: none;
1544
+  width: 100%;
1545
+  height: auto;
1546
+  margin: 1px 0 2px 0;
1547
+}
1548
+
1549
+#filterByFlagImg {
1550
+  display: inline-block;
1551
+  position: relative;
1552
+  width: 15px;
1553
+  height: 15px;
1554
+  margin: 0 10px 0 8px;
1555
+  background-image: url('../img/flag_red.svg');
1556
+  background-repeat: no-repeat;
1557
+  background-position: center center;
1558
+}
1559
+
1560
+#flagFilter {
1561
+  display: inline-block;
1562
+  position: relative;
1563
+  height: 20px;
1564
+  width: 79%;
1565
+  margin: 0;
1566
+  padding: 0 9px;
1567
+  text-align: left;
1568
+  text-overflow: inherit;
1569
+  font-family: 'Inter' !important;
1570
+  font-size: 14px;
1571
+  font-weight: 600;
1572
+  color: #565656;
1573
+  -moz-box-sizing: border-box;
1574
+  -webkit-box-sizing: border-box;
1575
+  box-sizing: border-box;
1576
+  background-color: #f0fbff;
1577
+  border-radius: 20px;
1578
+  border: none;
1579
+}
1580
+
1581
+#clearFlagFilter {
1582
+  display: inline-block;
1583
+  position: relative;
1584
+  width: 18px;
1585
+  height: 18px;
1586
+  margin: 0 0 -4px 9px;
1587
+  background-image: url('../img/clearfilters_small.svg');
1588
+  background-repeat: no-repeat;
1589
+  background-position: center center;
1590
+  cursor: pointer;
1591
+}
1592
+
1593
+#convBarTitle {
1594
+  width: 90% !important;
1595
+  vertical-align: middle !important;
1596
+  white-space: normal;
1597
+}
1598
+
1599
+#titleFirstRow {
1600
+  display: block;
1601
+  position: relative;
1602
+  width: 100%;
1603
+  height: auto;
1604
+  text-align: center;
1605
+  color: #353535;
1606
+}
1607
+
1608
+#titleSecRow {
1609
+  display: none;
1610
+  position: relative;
1611
+  width: 100%;
1612
+  height: auto;
1613
+  color: #353535;
1614
+}
1615
+
1616
+#titleConvDesc, #titleConvTag, #titleConvFlag, #titleConvDelete {
1617
+  display: block;
1618
+  position: relative;
1619
+  width: 100%;
1620
+  height: auto;
1621
+  text-align: left;
1622
+  margin: 6px 0 6px 11px;
1623
+}
1624
+
1625
+.cvFlagRedCvt {
1626
+  display: inline-block;
1627
+  position: relative;
1628
+  width: 15px;
1629
+  height: 15px;
1630
+  margin: 0;
1631
+  background-image: url('../img/flag_red.svg');
1632
+  background-repeat: no-repeat;
1633
+  background-position: center center;
1634
+}
1635
+
1636
+.cvFlagEmptyCvt {
1637
+  display: inline-block;
1638
+  position: relative;
1639
+  width: 15px;
1640
+  height: 15px;
1641
+  margin: 0;
1642
+  background-image: url('../img/flag_empty.svg');
1643
+  background-repeat: no-repeat;
1644
+  background-position: center center;
1645
+}
1646
+
1647
+.convTagCvt {
1648
+  display: inline-block;
1649
+  position: relative;
1650
+  width: 12px;
1651
+  height: 12px;
1652
+  margin: 0 0 -0.3px 0;
1653
+  background-image: url('../img/tag.svg');
1654
+  background-repeat: no-repeat;
1655
+  background-position: center center;
1656
+}
1657
+
1658
+.convTagAddedCvt {
1659
+  display: inline-block;
1660
+  position: relative;
1661
+  width: 12px;
1662
+  height: 12px;
1663
+  margin: 0 4.5px -0.3px 0;
1664
+  background-image: url('../img/tag_added.svg');
1665
+  background-repeat: no-repeat;
1666
+  background-position: center center;
1667
+}
1668
+
1669
+.convDescCvt {
1670
+  display: inline-block;
1671
+  position: relative;
1672
+  width: 12px;
1673
+  height: 11px;
1674
+  margin: 6px 0 0 0;
1675
+  background-image: url('../img/description.svg');
1676
+  background-repeat: no-repeat;
1677
+  background-position: center center;
1678
+  vertical-align: top;
1679
+}
1680
+
1681
+.convDescAddedCvt {
1682
+  display: inline-block;
1683
+  position: relative;
1684
+  width: 12px;
1685
+  height: 11px;
1686
+  margin: 6px 0 0 0;
1687
+  background-image: url('../img/description_added.svg');
1688
+  background-repeat: no-repeat;
1689
+  background-position: center center;
1690
+  vertical-align: top;
1691
+}
1692
+
1693
+.cvTagContent {
1694
+  display: inline-block;
1695
+  margin: 0 0 0 10px;
1696
+  width: 94%;
1697
+}
1698
+
1699
+.cvFlagContent {
1700
+  display: inline-block;
1701
+  margin: 0 0 0 10px;
1702
+  width: 94%;
1703
+}
1704
+
1705
+.cvDescContent {
1706
+  display: inline-block;
1707
+  margin: 0 0 0 14px;
1708
+  width: 94%;
1709
+}
1710
+
1711
+#deleteAllMsgConv {
1712
+  display: inline-block;
1713
+  position: relative;
1714
+  width: 16px;
1715
+  height: 20px;
1716
+  margin: 0 10px -1px -1px;
1717
+  background-image: url('../img/garbage.svg');
1718
+  background-repeat: no-repeat;
1719
+  background-position: center center;
1720
+  cursor: pointer;
1721
+}
1722
+
1723
+#deleteMsgsCvText {
1724
+  display: inline-block;
1725
+  position: relative;
1726
+  margin: 0;
1727
+  font-size: 14px;
1728
+  color: #7d1d84;
1729
+}
1730
+
1731
+#expandTitle {
1732
+  display: block;
1733
+  position: relative;
1734
+  width: 100%;
1735
+  height: 13px;
1736
+  margin: -6px auto 0 auto;
1737
+  text-align: center;
1738
+}
1739
+
1740
+#expandTitleImg {
1741
+  display: block;
1742
+  position: relative;
1743
+  width: 60px;
1744
+  height: 13px;
1745
+  margin: 0 auto;
1746
+  background-image: url('../img/arrowDown_small.svg');
1747
+  background-repeat: no-repeat;
1748
+  background-position: center center;
1749
+  cursor: pointer;
1750
+}
1751
+
1752
+.convPart {
1753
+  display: block;
1754
+  position: absolute;
1755
+  width: 16px;
1756
+  height: 20px;
1757
+  top: 8px;
1758
+  right: 10px;
1759
+  background-image: url('../img/participants.svg');
1760
+  background-repeat: no-repeat;
1761
+  background-position: center center;
1762
+  cursor: pointer;
1763
+}
1764
+
1765
+.convPartRed {
1766
+  display: block;
1767
+  position: absolute;
1768
+  width: 16px;
1769
+  height: 20px;
1770
+  top: 8px;
1771
+  right: 10px;
1772
+  background-image: url('../img/participants_red.svg');
1773
+  background-repeat: no-repeat;
1774
+  background-position: center center;
1775
+  cursor: pointer;
1776
+}
1777
+
1778
+.removeConv {
1779
+  display: block;
1780
+  position: absolute;
1781
+  width: 16px;
1782
+  height: 20px;
1783
+  top: 5px;
1784
+  right: 12.5px;
1785
+  background-image: url('../img/garbage.svg');
1786
+  background-repeat: no-repeat;
1787
+  background-position: center center;
1788
+  cursor: pointer;
1789
+}
1790
+
1791
+.removeConv:hover {
1792
+  background-image: url('../img/garbage_bright.svg');
1793
+}
1794
+
1795
+.removeConvGrey {
1796
+  display: block;
1797
+  position: relative;
1798
+  width: 16px;
1799
+  height: 20px;
1800
+  float: right;
1801
+  margin: 5px 12.5px 0 0;
1802
+  background-image: url('../img/garbage_grey.svg');
1803
+  background-repeat: no-repeat;
1804
+  background-position: center center;
1805
+}
1806
+
1807
+#convListRowCell {
1808
+  display: block;
1809
+  width: 100%;
1810
+  height: auto;
1811
+  min-height: 358px;
1812
+  margin: 0;
1813
+  padding: 0 0 0 7px;
1814
+  overflow: scroll;
1815
+  white-space: nowrap;
1816
+}
1817
+
1818
+.convsListArch {
1819
+  display: block;
1820
+  position: relative;
1821
+  margin: 7px 6px;
1822
+  padding: 3px 10px;
1823
+  border: none;
1824
+  border-radius: 10px;
1825
+  background-color: #fcf5fb;
1826
+  font-size: 14px;
1827
+  white-space: normal;
1828
+  word-break: break-word;
1829
+  cursor: pointer;
1830
+}
1831
+
1832
+.convsListAct {
1833
+  display: block;
1834
+  position: relative;
1835
+  margin: 7px 6px;
1836
+  padding: 3px 10px;
1837
+  border: none;
1838
+  border-radius: 10px;
1839
+  background-color: #effcfc;
1840
+  font-size: 14px;
1841
+  white-space: normal;
1842
+  word-break: break-word;
1843
+  cursor: pointer;
1844
+}
1845
+
1846
+.archConvImg {
1847
+  display: block; 
1848
+  position: relative;
1849
+  float: right;
1850
+  margin: 3.6px -3px 0 6px;
1851
+}
1852
+
1853
+.activeConvImg {
1854
+  display: block; 
1855
+  position: relative;
1856
+  float: right;
1857
+  margin: 1.8px -1.8px 0 6px;
1858
+}
1859
+
1860
+.convLastMsgFrom {
1861
+  display: inline-block;
1862
+  margin-right: 8px;
1863
+  padding: 0;
1864
+  font-size: 12.5px;
1865
+  color: #353535;
1866
+  cursor: pointer;
1867
+}
1868
+
1869
+.convLastMsgTo {
1870
+  display: inline-block;
1871
+  margin: 0;
1872
+  padding: 0;
1873
+  font-size: 12.5px;
1874
+  color: #353535;
1875
+  line-height: 14px;
1876
+  cursor: pointer;
1877
+}
1878
+
1879
+.msgAuthorNameConv {
1880
+  border: none;
1881
+  border-radius: 20px;
1882
+  padding: 2px 8px;
1883
+  margin: 0 4px 0 0;
1884
+  color: #535353;
1885
+  background-color: #ebf4ff !important;
1886
+  cursor: pointer;
1887
+}
1888
+
1889
+.convLastMsg {
1890
+  font-size: 14px;
1891
+  font-weight: 500;
1892
+  margin: 5px 0 4px 0;
1893
+  color: #353535;
1894
+  white-space: normal;
1895
+  word-break: break-word;
1896
+  overflow: hidden;
1897
+  text-overflow: ellipsis;
1898
+  display: -webkit-box;
1899
+  -webkit-line-clamp: 3;
1900
+  -webkit-box-orient: vertical;
1901
+  cursor: pointer;
1902
+}
1903
+
1904
+.dateSection {
1905
+  display: block;
1906
+  position: relative;
1907
+  width: 100%;
1908
+  height: auto;
1909
+  cursor: pointer;
1910
+}
1911
+
1912
+.dateClock {
1913
+  display: inline-block;
1914
+  position: relative;
1915
+  width: 14px;
1916
+  height: 14px;
1917
+  margin: 0 0 -2.3px 0;
1918
+  background-image: url('../img/clock.svg');
1919
+  background-repeat: no-repeat;
1920
+  background-position: center center;
1921
+}
1922
+
1923
+.convLastMsgDate {
1924
+  display: inline-block;
1925
+  position: relative;
1926
+  margin: 1px 0 0 6px;
1927
+  font-size: 12.5px;
1928
+  line-height: normal;
1929
+  color: #353535;
1930
+  cursor: pointer;
1931
+}
1932
+
1933
+.convDesc {
1934
+  display: inline-block;
1935
+  position: relative;
1936
+  width: 12px;
1937
+  height: 11px;
1938
+  margin: 0 0 -0.2px 0;
1939
+  background-image: url('../img/description.svg');
1940
+  background-repeat: no-repeat;
1941
+  background-position: center center;
1942
+  cursor: pointer;
1943
+}
1944
+
1945
+.convDescAdded {
1946
+  display: inline-block;
1947
+  position: relative;
1948
+  width: 12px;
1949
+  height: 11px;
1950
+  margin: 0 0 -0.2px 0;
1951
+  background-image: url('../img/description_added.svg');
1952
+  background-repeat: no-repeat;
1953
+  background-position: center center;
1954
+  cursor: pointer;
1955
+}
1956
+
1957
+.convTag {
1958
+  display: inline-block;
1959
+  position: relative;
1960
+  width: 12px;
1961
+  height: 12px;
1962
+  margin: 0 0 -0.3px 11px;
1963
+  background-image: url('../img/tag.svg');
1964
+  background-repeat: no-repeat;
1965
+  background-position: center center;
1966
+  cursor: pointer;
1967
+}
1968
+
1969
+.convTagAdded {
1970
+  display: inline-block;
1971
+  position: relative;
1972
+  width: 12px;
1973
+  height: 12px;
1974
+  margin: 0 0 -0.3px 11px;
1975
+  background-image: url('../img/tag_added.svg');
1976
+  background-repeat: no-repeat;
1977
+  background-position: center center;
1978
+  cursor: pointer;
1979
+}
1980
+
1981
+.archactTag {
1982
+  display: inline-block;
1983
+  position: relative;
1984
+  width: 76%;
1985
+  height: 20px;
1986
+  margin: 0 0 -2px 7px;
1987
+  font-weight: 500;
1988
+  font-size: 14px;
1989
+  color: #39608a;
1990
+  overflow: hidden;
1991
+  text-overflow: ellipsis;
1992
+  white-space: nowrap;
1993
+  word-break: break-word;
1994
+  cursor: pointer;
1995
+}
1996
+
1997
+.cvFlagEmpty {
1998
+  display: inline-block;
1999
+  position: absolute;
2000
+  width: 15px;
2001
+  height: 15px;
2002
+  right: 8px;
2003
+  bottom: 8px;
2004
+  background-image: url('../img/flag_empty.svg');
2005
+  background-repeat: no-repeat;
2006
+  background-position: center center;
2007
+  cursor: pointer;
2008
+}
2009
+
2010
+.cvFlagRed {
2011
+  display: inline-block;
2012
+  position: absolute;
2013
+  width: 15px;
2014
+  height: 15px;
2015
+  right: 8px;
2016
+  bottom: 8px;
2017
+  background-image: url('../img/flag_red.svg');
2018
+  background-repeat: no-repeat;
2019
+  background-position: center center;
2020
+  cursor: pointer;
2021
+}
2022
+
2023
+#convDescWindow, #convTagWindow, #convFlagWindow {
2024
+  display: block;
2025
+  position: absolute;
2026
+  width: 338px;
2027
+  height: auto;
2028
+  white-space: pre-wrap;
2029
+  border-radius: 6px;
2030
+  background-color: #ffffff;
2031
+  box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
2032
+  -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
2033
+  -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
2034
+  z-index: 5100;
2035
+}
2036
+
2037
+#closeDescWindow, #closeTagWindow, #closeFlagWindow {
2038
+  display: block;
2039
+  position: absolute;
2040
+  width: 12px;
2041
+  height: 12px;
2042
+  right: 8px;
2043
+  top: 8px;
2044
+  padding: 0;
2045
+  background-image: url('../img/closewnd.svg');
2046
+  background-repeat: no-repeat;
2047
+  background-position: center center;
2048
+  cursor: pointer;
2049
+}
2050
+
2051
+#dragDescWindow, #dragTagWindow, #dragFlagWindow {
2052
+  display: block;
2053
+  position: relative;
2054
+  width: 40px;
2055
+  height: 20px;
2056
+  margin: -3px auto 0px auto;
2057
+  cursor: grab;
2058
+  text-align: center;
2059
+}
2060
+
2061
+#convTitle {
2062
+  display: block;
2063
+  margin: 1px 29px 4px 29px;
2064
+  width: 84%;
2065
+  text-align: center;
2066
+  color: #353535;
2067
+  font-family: Inter;
2068
+  font-size: 15px;
2069
+  font-weight: 400;
2070
+}
2071
+
2072
+#convBetween {
2073
+  display: block;
2074
+  margin: 1px 23px 0 23px;
2075
+  text-align: center;
2076
+  color: #353535;
2077
+  font-family: Inter;
2078
+  font-size: 15px;
2079
+  font-weight: 400;
2080
+}
2081
+
2082
+#descriptionText {
2083
+  display: block;
2084
+  width: 84%;
2085
+  height: 170px;
2086
+  margin: 6px auto 0 auto;
2087
+  padding: 3px 5px;
2088
+  color: #363636;
2089
+  text-align: left;
2090
+  font-family: 'Inter';
2091
+  font-size: 15px;
2092
+  font-weight: 500;
2093
+  border-radius: 6px;
2094
+  resize: none;
2095
+  white-space: pre-wrap;
2096
+  border: 1px solid #dedede;
2097
+  background-color: #f1f1f1;
2098
+  overflow-y: auto;
2099
+}
2100
+
2101
+#saveConvDesc, #saveConvTag, #setConvFlag {
2102
+  display: block;
2103
+  border-radius: 20px !important;
2104
+  padding: 0px 14px !important;
2105
+  margin: 10px auto !important;
2106
+  min-height: 30px !important;
2107
+  height: 30px !important;
2108
+  color: #ffffff !important;
2109
+  background-color: #40c1a3 !important;
2110
+}
2111
+
2112
+#tagText {
2113
+  display: block;
2114
+  width: 84%;
2115
+  height: 40px;
2116
+  margin: 6px auto 0 auto;
2117
+  padding: 3px 5px;
2118
+  color: #363636;
2119
+  text-align: left;
2120
+  font-family: 'Inter';
2121
+  font-size: 15px;
2122
+  font-weight: 500;
2123
+  border-radius: 6px;
2124
+  white-space: pre-wrap;
2125
+  border: 1px solid #dedede;
2126
+  background-color: #f1f1f1;
2127
+  overflow-x: auto;
2128
+}
2129
+
2130
+#sendMsgReplySec {
2131
+  display: none;
2132
+  position: sticky;
2133
+  height: 148px;
2134
+  bottom: 17px;
2135
+  background-color: #ffffff;
2136
+}
2137
+
2138
+#expToSendReply {
2139
+  display: block;
2140
+  position: sticky;
2141
+  width: 100%;
2142
+  bottom: 0;
2143
+  height: 17px;
2144
+  background-color: #e3f4fa;
2145
+  border-radius: 4px;
2146
+  cursor: pointer;
2147
+}
2148
+
2149
+#expandWindowRplSec {
2150
+  display: block;
2151
+  margin: 0 auto 0 auto;
2152
+  cursor: pointer;
2153
+}
2154
+
2155
+#fromPhnNmbrCv {
2156
+  display: inline-block;
2157
+  width: 50%;
2158
+  height: auto;
2159
+  margin: 6px 0px 2px 8px;
2160
+  font-size: 14.5px;
2161
+  font-weight: 500;
2162
+  color: #222222;
2163
+  white-space: wrap;
2164
+}
2165
+
2166
+#selectToNbConv {
2167
+  height: 26px;
2168
+  width: auto;
2169
+  margin: 0;
2170
+  text-align: left;
2171
+  color: #222222;
2172
+  background-color: #ffffff !important;
2173
+  border: 1px solid #d8d8d8;
2174
+}
2175
+
2176
+#toPhnNmbrCv {
2177
+  display: inline-block;
2178
+  width: 50%;
2179
+  height: auto;
2180
+  margin: 6px 0px 2px -20px;
2181
+  font-size: 14.5px;
2182
+  font-weight: 500;
2183
+  color: #222222;
2184
+  text-align: right;
2185
+  white-space: wrap;
2186
+}
2187
+
2188
+#sendMsgConvSec {
2189
+  display: block;
2190
+  height: auto;
2191
+  margin: 0 auto;
2192
+  border: none;
2193
+}
2194
+
2195
+#sendMsgConvSec td {
2196
+  background-color: #ffffff;
2197
+  border: none;
2198
+}
2199
+
2200
+#sendMsgConvTextSec {
2201
+  display: inline-block;
2202
+  height: 72px;
2203
+  padding: 3px 5px;
2204
+  color: #000000;
2205
+  text-align: left;
2206
+  font-family: 'Inter';
2207
+  font-size: 15px;
2208
+  border-radius: 6px;
2209
+  resize: none;
2210
+  white-space: pre-wrap;
2211
+  border: 1px solid #dedede;
2212
+  background-color: #ffffff;
2213
+  overflow-y: auto;
2214
+}
2215
+
2216
+#sendMsgBtnConv {
2217
+  display: flex;
2218
+  position: relative;
2219
+  width: 200px;
2220
+  height: 20px;
2221
+  padding: 0;
2222
+  margin: 0 auto;
2223
+  bottom: 1.8px;
2224
+  color: #ffffff;
2225
+  background-color: #40c1a3;
2226
+  border: 1px solid #40c1a3;
2227
+  border-radius: 20px;
2228
+  text-align: center;
2229
+  font-weight: 500;
2230
+  cursor: pointer;
2231
+  line-height: normal;
2232
+  justify-content: center;
2233
+}
2234
+
2235
+#grpdbynamelstcv {
2236
+  display: none;
2237
+  position: absolute;
2238
+  top: 31px;
2239
+  right: 16px;
2240
+  width: 200px;
2241
+  height: auto;
2242
+  padding: 17px 19px 17px 20px;
2243
+  font-size: 15px;
2244
+  font-weight: 500;
2245
+  color: #0a559e;
2246
+  cursor: pointer;
2247
+  border-radius: 6px;
2248
+  white-space: normal;
2249
+  background-color: #ffffff;
2250
+  box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
2251
+  -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
2252
+  -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
2253
+  z-index: 999999;
2254
+}
2255
+
2256
+#closeConvPart {
2257
+  display: inline-block;
2258
+  position: absolute;
2259
+  width: 10px;
2260
+  height: 10px;
2261
+  top: -7px;
2262
+  right: -7px;
2263
+  background-image: url('../img/closeconvpart.svg');
2264
+  background-repeat: no-repeat;
2265
+  background-position: center center;
2266
+  cursor: pointer;
2267
+}
2268
+
2269
+#betweenNmbrs, #btwnNbCvTitle {
2270
+  display: inline-block;
2271
+  position: relative;
2272
+  width: 20px;
2273
+  height: 8px;
2274
+  margin: 0 6px 1px 6px;
2275
+  background-image: url('../img/between.svg');
2276
+  background-repeat: no-repeat;
2277
+  background-position: center center;
2278
+}
2279
+
2280
+#convImgGrey {
2281
+  position: absolute;
2282
+  display: block;
2283
+}
2284
+
2285
+#groupedSmsTable {
2286
+  display: block;
2287
+  position: relative;
2288
+  top: 0px;
2289
+  width: 100%;
2290
+  height: auto;
2291
+  font-size: 14px;
2292
+  z-index: 50;
2293
+  background: #FFFFFF;
2294
+}
2295
+
2296
+#groupedSmsTable td {
2297
+  text-align: left;
2298
+  vertical-align: top;
2299
+  border: 1px solid #f3f3f3;
2300
+  padding: 5px;
2301
+}
2302
+
2303
+.groupedrowsbody {
2304
+  border: 1px solid #f3f3f3;
2305
+  padding: 8px;
2306
+}
2307
+
2308
+.groupedLstNmbr {
2309
+  overflow: scroll;
2310
+  white-space: nowrap;
2311
+}
2312
+
2313
+.groupedLstNames {
2314
+  overflow: scroll;
2315
+  white-space: nowrap;
2316
+}
2317
+
2318
+.groupedLstMsgs {
2319
+  overflow: scroll;
2320
+  white-space: nowrap;
2321
+  min-width: 250px;
2322
+}
2323
+
2324
+.groupedSentMsg {
2325
+  display: block;
2326
+  width: 95%;
2327
+  float: right;
2328
+  margin: 6px 6px 6px 0px;
2329
+  padding: 8px 10px;
2330
+  border: none;
2331
+  border-radius: 10px;
2332
+  background-color: #f2fbff;
2333
+  font-size: 14px;
2334
+  white-space: normal;
2335
+  word-break: break-word;
2336
+}
2337
+
2338
+.groupedRecMsg {
2339
+  display: block; 
2340
+  width: 95%;
2341
+  float: left;
2342
+  margin: 6px 0px;
2343
+  padding: 8px 10px;
2344
+  border: none;
2345
+  border-radius: 10px;
2346
+  background-color: #f2fff8;
2347
+  font-size: 14px;
2348
+  white-space: normal;
2349
+  word-break: break-word;
2350
+}
2351
+
2352
+.fixedRowHeight {
2353
+  max-height: 300px;
2354
+}
2355
+
2356
+.expandGrpRow {
2357
+  display: block;
2358
+  margin:-3px auto 7px auto;
2359
+  cursor: pointer;
2360
+}
2361
+
2362
+.dispNameList {
2363
+  display: block;
2364
+  margin: 2px 0px;
2365
+  font-size: 14.5px;
2366
+  font-weight: 500;
2367
+  color: #0a559e;
2368
+  cursor: pointer;
2369
+}
2370
+
2371
+.dispNameList:hover {
2372
+  color: #1483f0;
2373
+}
2374
+
2375
+.phoneNmbrRow {
2376
+  font-size: 14.5px;
2377
+  font-weight: 500;
2378
+  color: #06866f;
2379
+  cursor: pointer;
2380
+}
2381
+
2382
+.phoneNmbrRow:hover {
2383
+  color: #08b899;
2384
+}
2385
+
2386
+#selectListedNmbrs {
2387
+  display: block;
2388
+  width: 100%;
2389
+  font-family: 'Inter';
2390
+}
2391
+
2392
+.sentMssgStatus {
2393
+  display: inline-block;
2394
+  margin: 0px 6px 0px 6.5px;
2395
+  vertical-align: middle;
2396
+}
2397
+
2398
+.saveRestrictions, .saveAutoReply {
2399
+  display: inline-block;
2400
+  border-radius: 8px !important;
2401
+  padding: 0px 14px !important;
2402
+  margin: 0px 0px 0px 10px !important;
2403
+  color: #ffffff !important;
2404
+  background-color: #59d0b4 !important;
2405
+}
2406
+
2407
+.savealwdKeys {
2408
+  display: inline-block;
2409
+  border-radius: 8px !important;
2410
+  padding: 0px 14px !important;
2411
+  margin: 0 !important;
2412
+  color: #ffffff !important;
2413
+  background-color: #59d0b4 !important;
2414
+}
2415
+
2416
+.saveRestrictions:hover, .saveAutoReply:hover, .savealwdKeys:hover {
2417
+  background-color: #40c1a3 !important;
2418
+}
2419
+
2420
+.saveRestrictions:active, .saveAutoReply:active, .savealwdKeys:active {
2421
+  background-color: #3aad92 !important;
2422
+}
2423
+
2424
+#save_admin_settings {
2425
+  display: inline-block;
2426
+  border-radius: 8px !important;
2427
+  padding: 0px 14px !important;
2428
+  color: #ffffff !important;
2429
+  background-color: #1e89c2 !important;
2430
+}
2431
+
2432
+#save_admin_settings:hover {
2433
+  background-color: #0369a0  !important;
2434
+}
2435
+
2436
+#save_admin_settings:active {
2437
+  background-color: #025480  !important;
2438
+}
2439
+
2440
+#phoneNmbrRestr th {
2441
+  font-weight: 500;
2442
+}
2443
+
2444
+#tnxKeysAccessTbl th, #plvKeysAccessTbl th, #twlKeysAccessTbl th, #flrKeysAccessTbl th {
2445
+  font-weight: 500;
2446
+  color: #222222;
2447
+}
2448
+
2449
+.restrAuthor {
2450
+  width: 200px;
2451
+  height: 40px !important;
2452
+}
2453
+
2454
+.restrPhoneNmbr, .arplPhoneNmbr {
2455
+  width: 194px;
2456
+  height: 40px !important;
2457
+}
2458
+
2459
+.restrGroups, .restrUsers {
2460
+  width: 330px;
2461
+  height: 40px !important;
2462
+  border: 1px solid #000;
2463
+  border-radius: 6px;
2464
+  margin: 0px 1px 0px 0px;
2465
+  padding: 0px 4px;
2466
+  overflow: hidden;
2467
+}
2468
+
2469
+.restrGroups:hover, .restrUsers:hover {
2470
+  overflow: auto !important;
2471
+}
2472
+
2473
+.alwdKeysGroups, .alwdKeysUsers {
2474
+  width: 398px;
2475
+  min-height: 80px !important;
2476
+  background-color: #ffffff !important;
2477
+  border: 1px solid #000;
2478
+  border-radius: 6px;
2479
+  margin: 0px 1px 0px 0px;
2480
+  padding: 0px 4px;
2481
+  overflow-y: scroll;
2482
+  white-space: pre-wrap;
2483
+}
2484
+
2485
+.alwdKeysGroups:hover, .alwdKeysUsers:hover {
2486
+  overflow: auto !important;
2487
+}
2488
+
2489
+.topLeftCorner {
2490
+  vertical-align: top;
2491
+  text-align: left;
2492
+}
2493
+
2494
+.alwdDelGroups, .alwdDelUsrs {
2495
+  width: 398px;
2496
+  height: auto;
2497
+  border: none;
2498
+  border-radius: 6px;
2499
+  margin: 3px 0 0 0;
2500
+  padding: 0px 1px;
2501
+  line-height: 1.5;
2502
+  white-space: wrap;
2503
+  overflow: auto;
2504
+}
2505
+
2506
+.alwDelCkbx {
2507
+  display: inline-block;
2508
+  position: relative;
2509
+  height: 14px !important;
2510
+  vertical-align: initial !important;
2511
+}
2512
+
2513
+#addRestrRow, #addArplRow {
2514
+  display: block;
2515
+  margin: 10px 0px 0px 6px;
2516
+  width: 16px;
2517
+  height: 16px;
2518
+  cursor: pointer;
2519
+  border-radius: 2px;
2520
+}
2521
+
2522
+#autoReplyTbl td {
2523
+  text-align: left;
2524
+  vertical-align: top;
2525
+  padding: 0px 0px 10px 0px;
2526
+}
2527
+
2528
+#autoReplyTbl th {
2529
+  font-weight: 500;
2530
+}
2531
+
2532
+.arplAuthor {
2533
+  width: 200px;
2534
+  height: 38px !important;
2535
+}
2536
+
2537
+.arplMode {
2538
+  display: inline-block;
2539
+  width: 330px;
2540
+  height: 184px;
2541
+  border: 1px solid #000;
2542
+  border-radius: 6px;
2543
+  margin: 0px 4px 0px 0px;
2544
+  overflow: visible;
2545
+}
2546
+
2547
+.modeContent .date-picker-x {
2548
+  top: -170px !important;
2549
+  left: -170px !important;
2550
+}
2551
+
2552
+.arplText {
2553
+  display: inline-block;
2554
+  color: #000000;
2555
+  width: 330px;
2556
+  height: 184px;
2557
+  font-size: 15px;
2558
+  text-align: left;
2559
+  border: 1px solid #000;
2560
+  border-radius: 6px;
2561
+  margin: 0px 1px 0px 0px;
2562
+  resize: vertical;
2563
+  white-space: pre-wrap;
2564
+  overflow: auto;
2565
+}
2566
+
2567
+.selectArplMode {
2568
+  display: block;
2569
+  width: 322px;
2570
+  margin: 4px 0px 0px 4px;
2571
+  cursor: pointer;
2572
+  font-weight: 500;
2573
+}
2574
+
2575
+.daysOfWeek {
2576
+  display: block;
2577
+  width: 100%;
2578
+  height: 26px;
2579
+  margin: 3px auto;
2580
+  font-weight: 500;
2581
+  text-align: center;
2582
+}
2583
+
2584
+.daysInWeek {
2585
+  display: block;
2586
+  position: relative;
2587
+  width: 322px;
2588
+  height: auto;
2589
+  margin: 0px 0px 0px 4px !important;
2590
+  text-align: center;
2591
+  border: 1px solid #000;
2592
+  border-radius: 6px;
2593
+}
2594
+
2595
+.chooseTInterval {
2596
+  display: block;
2597
+  width: 100%;
2598
+  height: 26px;
2599
+  margin: 5px auto 0px auto;
2600
+  font-weight: 500;
2601
+  text-align: center;
2602
+}
2603
+
2604
+.selectArplHours {
2605
+  display: block;
2606
+  width: 100%;
2607
+  text-align: center;
2608
+}
2609
+
2610
+.tooltipautoreply {
2611
+  display: inline-block;
2612
+  position: absolute;
2613
+  font-size: 15px;
2614
+  z-index: 9;
2615
+}
2616
+
2617
+.tooltipautoreplyst, .tooltipautoreplypn, .tooltiprestrict {
2618
+  display: inline-block;
2619
+  position: absolute;
2620
+  font-size: 15px;
2621
+  z-index: 7;
2622
+}
2623
+
2624
+#infoautoreply, #infoautoreplyst, #infoautoreplypn, #inforestrict {
2625
+  display: inline-block;
2626
+  position: relative;
2627
+  margin: -2px 0px 0px 10px;
2628
+  color: #000000;
2629
+  font-size: 18px;
2630
+  font-weight: bold;
2631
+  font-family: 'Open Sans';
2632
+  font-style: italic;
2633
+  cursor: pointer;
2634
+}
2635
+
2636
+.autorpltooltip, .autorpltooltipst, .autorpltooltippn, .restricttooltext {
2637
+  display: block;
2638
+  position: absolute;
2639
+  visibility: hidden;
2640
+  width: 330px;
2641
+  height: auto;
2642
+  background-color: #fafafa;
2643
+  font-size: 15px;
2644
+  font-weight: 600;
2645
+  white-space: normal;
2646
+  color: #595959;
2647
+  text-align: left;
2648
+  border-radius: 5px;
2649
+  padding: 5px 5px 5px 8px;
2650
+  margin: -4px 0px 0px -150px;
2651
+  box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
2652
+  -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
2653
+  -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
2654
+}
2655
+
2656
+.tooltipautoreply:hover .autorpltooltip, .tooltipautoreplyst:hover .autorpltooltipst, .tooltipautoreplypn:hover .autorpltooltippn, .tooltiprestrict:hover .restricttooltext  {
2657
+   visibility: visible;
2658
+}
2659
+
2660
+.selectHrMin {
2661
+  font-weight: 500 !important;
2662
+  color: #01446d !important;
2663
+}
2664
+
2665
+.chooseDateIntvl {
2666
+  display: block;
2667
+  width: 100%;
2668
+  height: 32px;
2669
+  margin: 19px auto 4px auto;
2670
+  font-weight: 500;
2671
+  text-align: center;
2672
+}
2673
+
2674
+.arplstrtendDates {
2675
+  display: block;
2676
+  position: absolute;
2677
+  width: 330px;
2678
+  height: auto;
2679
+}
2680
+
2681
+.stdtTitle {
2682
+  display: inline-block;
2683
+  position: absolute;
2684
+  width: 140px;
2685
+  height: 38px;
2686
+  left: 10px;
2687
+  top: 2px;
2688
+  font-weight: 500;
2689
+  text-align: center;
2690
+}
2691
+
2692
+.enddtTitle {
2693
+  display: inline-block;
2694
+  position: absolute;
2695
+  width: 140px;
2696
+  height: 38px;
2697
+  right: 10px;
2698
+  top: 2px;
2699
+  font-weight: 500;
2700
+  text-align: center;
2701
+}
2702
+
2703
+.startDate {
2704
+  display: inline-block;
2705
+  position: absolute;
2706
+  width: 140px;
2707
+  height: 38px;
2708
+  left: 10px;
2709
+  top: 26px;
2710
+  border: 1px solid #3b3b3b;
2711
+  border-radius: 6px;
2712
+  text-align: center;
2713
+  font-weight: 500;
2714
+  color: #01446d !important;
2715
+}
2716
+
2717
+.endDate {
2718
+  display: inline-block;
2719
+  position: absolute;
2720
+  width: 140px;
2721
+  height: 38px;
2722
+  right: 10px;
2723
+  top: 26px;
2724
+  border: 1px solid #3b3b3b;
2725
+  border-radius: 6px;
2726
+  text-align: center;
2727
+  font-weight: 500;
2728
+  color: #01446d !important;
2729
+}
2730
+
2731
+#adminOverlay {
2732
+  display: block;
2733
+  position: absolute;
2734
+  top: 0;
2735
+  left: 0;
2736
+  opacity: 0;
2737
+  z-index: 4990;
2738
+}
2739
+
2740
+.grpsList, .usrsList {
2741
+  display: block;
2742
+  position: absolute;
2743
+  width: 300px;
2744
+  max-height: 400px;
2745
+  z-index: 5000;
2746
+  overflow: auto;
2747
+  background-color: #ffffff;
2748
+}
2749
+
2750
+.groupsList, .usersList {
2751
+  display: block;
2752
+  position: relative;
2753
+  float: left;
2754
+  padding: 6px 4px;
2755
+  width: 300px;
2756
+  height: auto;
2757
+  color: #353535;
2758
+  border-radius: 6px;
2759
+  border: 1px solid #dadada;
2760
+  cursor: pointer;
2761
+}
2762
+
2763
+.groupsList:hover, .usersList:hover {
2764
+  background-color: #f1f1f1;
2765
+}
2766
+
2767
+.selectedGrps, .selectedUsrs {
2768
+  display: inline-block;
2769
+  position: relative;
2770
+  margin: 6px 1px 0px 1px;
2771
+  padding: 0px 6px;
2772
+  color: #353535;
2773
+  background-color: #ffffff;
2774
+  border: 1px solid #dadada;
2775
+  border-radius: 6px;
2776
+  box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
2777
+  -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
2778
+  -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
2779
+}
2780
+
2781
+.removeGroup, .removeUser {
2782
+  margin: 0px 0px 0px 6px;
2783
+  width: 9px;
2784
+  height: 9px;
2785
+  cursor: pointer;
2786
+}
2787
+
2788
+.showAllGroups, .showAllUsers {
2789
+  max-width: 40px !important;
2790
+  margin: 3px 10px 0px 6px;
2791
+  background-color: #ffffff;
2792
+  border-radius: 6px;
2793
+  padding: 4px 4px 0px 4px;
2794
+  z-index: 5000;
2795
+}
2796
+
2797
+.showAllGroupsak {
2798
+  max-width: 40px !important;
2799
+  margin: 3px 12px 0px 6px;
2800
+  background-color: #F7F7F7;
2801
+  border-radius: 6px;
2802
+  padding: 4px 4px 0px 4px;
2803
+}
2804
+
2805
+.showAllUsersak {
2806
+  max-width: 40px !important;
2807
+  margin: 3px 10px 0px 6px;
2808
+  background-color: #F7F7F7;
2809
+  border-radius: 6px;
2810
+  padding: 4px 4px 0px 4px;
2811
+}
2812
+
2813
+.showByNmbrTitle {
2814
+  display: block;
2815
+  width: 100%;
2816
+  color: #353535;
2817
+  text-align: center;
2818
+  font-size: 16px; 
2819
+  font-weight: 500;
2820
+  margin: 0px auto 5px auto;
2821
+}
2822
+
2823
+#refreshMsgsWrap, #refreshMsgsWraptf {
2824
+  display: block;
2825
+  position: sticky;
2826
+  width: 21px;
2827
+  height: 21px;
2828
+  bottom: 12px;
2829
+  left: 0;
2830
+}
2831
+
2832
+#refreshMsgsConv, #refreshMsgsConvtf {
2833
+  display: inline-block;
2834
+  position: relative;
2835
+  background-image: url("../img/refresh.svg");
2836
+  background-repeat: no-repeat;
2837
+  background-color: transparent !important;
2838
+  width: 21px;
2839
+  height: 21px;
2840
+  opacity: 0.30;
2841
+  border: none;
2842
+  cursor: pointer;
2843
+  z-index: 5300;
2844
+}
2845
+
2846
+#refreshMsgsConv:hover, #refreshMsgsConvtf:hover {
2847
+  opacity: 1;
2848
+}
2849
+
2850
+#stopAutoRefreshSent {
2851
+  display: none;
2852
+  position: fixed;
2853
+  left: 340px;
2854
+  top: 50.7px;
2855
+  z-index: 5000;
2856
+}
2857
+
2858
+#stopAutoRefreshSentBtn {
2859
+  display: inline-block;
2860
+  position: relative;
2861
+  width: auto;
2862
+  height: auto;
2863
+  vertical-align: top;
2864
+  border: 1px solid #c6cedb;
2865
+  border-radius: 20px;
2866
+  color: #0a559e;
2867
+  font-family: 'Open Sans' !important;
2868
+  font-size: 12px;
2869
+  font-weight: 400;
2870
+  padding: 0px 9px;
2871
+  text-align: center;
2872
+  cursor: pointer;
2873
+}
2874
+
2875
+#stopAutoRefreshSentBtn:hover {
2876
+  border: 1px solid #79a2be;
2877
+  box-shadow: 0 0 6px rgba(0, 0, 0, 0.23);
2878
+  -webkit-box-shadow: 0 0 6px rgba(0, 0, 0, 0.23);
2879
+  -moz-box-shadow: 0 0 6px rgba(0, 0, 0, 0.23);
2880
+}
2881
+
2882
+.mmstblUrls {
2883
+  color: #09579b;
2884
+  cursor: pointer;
2885
+}
2886
+
2887
+.mmstblUrls:hover {
2888
+  color: #1479d3;
2889
+}
2890
+
2891
+.marksent {
2892
+  background-color: #F2FBFF !important;
2893
+}
2894
+
2895
+.markreceived {
2896
+  background-color: #F2FFF5 !important;
2897
+}
2898
+
2899
+#sentfiltersrow, #recfiltersrow, #grpfiltersrow {
2900
+  display: none;
2901
+  position: sticky;
2902
+  top: 27px;
2903
+  background: #FFFFFF;
2904
+  box-shadow: 0 6px 7px rgba(0, 0, 0, 0.1);
2905
+  z-index: 1000;
2906
+}
2907
+
2908
+#sentSmsTable th, #recSmsTable th, #groupedSmsTable th {
2909
+  position: sticky;
2910
+  top: 27px;
2911
+  z-index: 999;
2912
+  border: 1px solid #f3f3f3;
2913
+  padding: 7px;
2914
+  background-color: #bfe5f2;
2915
+  font-size: 15px;
2916
+  font-weight: bold;
2917
+  text-align: center;
2918
+}
2919
+
2920
+#sentSmsTable td, #recSmsTable td {
2921
+  border: 1px solid #f3f3f3;
2922
+  padding: 5px;
2923
+  white-space: normal;
2924
+}
2925
+
2926
+.datecolsent {
2927
+  text-align: center;
2928
+}
2929
+
2930
+.sentdbidcolumn {
2931
+  text-align: center;
2932
+}
2933
+
2934
+.dbidcolumnrec {
2935
+  width: 50px;
2936
+  text-align: center;
2937
+}
2938
+
2939
+.messagecolumnsent {
2940
+  background: #fffff2;
2941
+  text-align: left;
2942
+  font-weight: 500;
2943
+  width: 260px;
2944
+  word-break: break-word;
2945
+}
2946
+
2947
+.messagecolumnrec {
2948
+  background: #fffff2;
2949
+  text-align: left;
2950
+  font-weight: 500;
2951
+  width: 526px;
2952
+  word-break: break-word;
2953
+}
2954
+
2955
+.messageAuthorName {
2956
+  border: none;
2957
+  border-radius: 20px;
2958
+  padding: 4px 10px;
2959
+  margin: 0px 4px 0px 0px;
2960
+  color: #414141;
2961
+  background-color: #eff9ff;
2962
+}
2963
+
2964
+.msgAuthorNameGrp {
2965
+  border: none;
2966
+  border-radius: 20px;
2967
+  padding: 3px 8px;
2968
+  margin: 0px 4px 0px 0px;
2969
+  color: #616161;
2970
+  background-color: #e8edff !important;
2971
+}
2972
+
2973
+.addNameToPhNb {
2974
+  cursor: pointer;
2975
+  border-radius: 20px;
2976
+}
2977
+
2978
+.listToFromMsgs {
2979
+  display: block;
2980
+  margin: 0 auto;
2981
+  width: 30px;
2982
+  text-align: center;
2983
+  cursor: pointer;
2984
+}
2985
+
2986
+.lstMsgConv {
2987
+  display: block;
2988
+  position: relative;
2989
+  width: 30px;
2990
+  height: auto;
2991
+  text-align: center;
2992
+  margin: 4px auto 0 auto;
2993
+}
2994
+
2995
+.lstMsgConvImg {
2996
+  cursor: pointer;
2997
+  height: auto;
2998
+}
2999
+
3000
+.lstMsgToFromImg {
3001
+  cursor: pointer;
3002
+  height: auto;
3003
+}
3004
+
3005
+.lstMsgToFromImg:hover, .lstMsgConvImg:hover {
3006
+  box-shadow: 0 0 7px rgba(0, 0, 0, 0.25);
3007
+  -webkit-box-shadow: 0 0 7px rgba(0, 0, 0, 0.25);
3008
+  -moz-box-shadow: 0 0 7px rgba(0, 0, 0, 0.25);
3009
+}
3010
+
3011
+.lstMsgToFromImg:active, .lstMsgConvImg:hover {
3012
+  box-shadow: 0 0 9px rgba(0, 0, 0, 0.25);
3013
+  -webkit-box-shadow: 0 0 9px rgba(0, 0, 0, 0.25);
3014
+  -moz-box-shadow: 0 0 9px rgba(0, 0, 0, 0.25);
3015
+}
3016
+
3017
+#loadMoreMsgs, #loadMoreMsgsusr {
3018
+  display: none;
3019
+  width: 180px;
3020
+  height: auto;
3021
+  margin: 1px auto 2px auto;
3022
+  padding: 0px 0px 2px 0px;
3023
+  border: 1px solid #b8d4e6;
3024
+  border-radius: 20px;
3025
+  color: #6c91b2;
3026
+  line-height: normal;
3027
+  text-align: center;
3028
+  font-size: 14.5px;
3029
+  font-weight: 500;
3030
+  cursor: pointer;
3031
+}
3032
+
3033
+#loadMoreMsgs:hover, #loadMoreMsgsusr:hover {
3034
+  color: #3a6c9a;
3035
+  border: 1px solid #95bad3;
3036
+}
3037
+
3038
+#loadMoreMsgs:active, #loadMoreMsgsusr:active {
3039
+  box-shadow: 0 0 6px rgba(0, 0, 0, 0.23);
3040
+  -webkit-box-shadow: 0 0 6px rgba(0, 0, 0, 0.23);
3041
+  -moz-box-shadow: 0 0 6px rgba(0, 0, 0, 0.23);
3042
+  border: 1px solid #79a2be;
3043
+}
3044
+
3045
+.addNameToPhNb:hover {
3046
+  box-shadow: 0 0 8px rgba(0, 0, 0, 0.23);
3047
+  -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.23);
3048
+  -moz-box-shadow: 0 0 8px rgba(0, 0, 0, 0.23);
3049
+}
3050
+
3051
+.addNameToPhNb:active {
3052
+  box-shadow: 0 0 12px rgba(0, 0, 0, 0.33);
3053
+  -webkit-box-shadow: 0 0 12px rgba(0, 0, 0, 0.33);
3054
+  -moz-box-shadow: 0 0 12px rgba(0, 0, 0, 0.33);
3055
+}
3056
+
3057
+#recTblOverlay, #alertMsgOverlay {
3058
+  display: block;
3059
+  position: absolute;
3060
+  top: 0;
3061
+  left: 0;
3062
+  width: 100%;
3063
+  height: 100%;
3064
+  background-color: #000000;
3065
+  opacity: 0.09;
3066
+  z-index: 5050;
3067
+}
3068
+
3069
+#disNameWindow, #alertMessage, #alertConfMessage {
3070
+  display: block;
3071
+  position: absolute;
3072
+  width: 338px;
3073
+  height: auto;
3074
+  white-space: pre-wrap;
3075
+  border-radius: 6px;
3076
+  background-color: #ffffff;
3077
+  box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
3078
+  -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
3079
+  -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
3080
+  z-index: 5100;
3081
+}
3082
+
3083
+#alertTextWrap {
3084
+  display: block;
3085
+  text-align: left;
3086
+  font-family: 'Inter';
3087
+  font-size: 15px;
3088
+  margin: 30px 22px 16px 22px;
3089
+  color: #353535;
3090
+  white-space: pre-wrap;
3091
+  word-break: break-word;
3092
+}
3093
+
3094
+#closeDisNmWindow {
3095
+  display: block;
3096
+  position: absolute;
3097
+  width: 12px;
3098
+  height: 12px;
3099
+  right: 8px;
3100
+  top: 10px;
3101
+  padding: 0;
3102
+  background-image: url('../img/closewnd.svg');
3103
+  background-repeat: no-repeat;
3104
+  background-position: center center;
3105
+  cursor: pointer;
3106
+}
3107
+
3108
+#closeFrmMsgWindow, #closeAlertWnd, #closeAlertWndcf {
3109
+  display: block;
3110
+  position: absolute;
3111
+  width: 12px;
3112
+  height: 12px;
3113
+  right: 8px;
3114
+  top: 10px;
3115
+  padding: 0;
3116
+  background-image: url('../img/closewnd.svg');
3117
+  background-repeat: no-repeat;
3118
+  background-position: center center;
3119
+  cursor: pointer;
3120
+}
3121
+
3122
+#sendMsgConvBtn {
3123
+  display: flex;
3124
+  width: 200px;
3125
+  height: 20px;
3126
+  padding: 0;
3127
+  margin: -2px auto 0 auto;
3128
+  color: #ffffff;
3129
+  background: #40c1a3;
3130
+  border: 1px solid #40c1a3;
3131
+  border-radius: 20px;
3132
+  text-align: center;
3133
+  font-weight: 500;
3134
+  cursor: pointer;
3135
+  line-height: normal;
3136
+  justify-content: center;
3137
+  align-items: center;
3138
+}
3139
+
3140
+#sendMsgConvBtn:hover {
3141
+  background-color:  #3bb397 !important;
3142
+  box-shadow: 0 0 6px rgba(0, 0, 0, 0.23);
3143
+  -webkit-box-shadow: 0 0 6px rgba(0, 0, 0, 0.23);
3144
+  -moz-box-shadow: 0 0 6px rgba(0, 0, 0, 0.23);
3145
+}
3146
+
3147
+#sendMsgConvBtn:active {
3148
+  background-color: #33a087 !important;
3149
+  box-shadow: 0 0 6px rgba(0, 0, 0, 0.23);
3150
+  -webkit-box-shadow: 0 0 6px rgba(0, 0, 0, 0.23);
3151
+  -moz-box-shadow: 0 0 6px rgba(0, 0, 0, 0.23);
3152
+}
3153
+
3154
+#saveDispName, #alertOk {
3155
+  display: block;
3156
+  border-radius: 20px !important;
3157
+  padding: 0px 14px !important;
3158
+  margin: 10px auto !important;
3159
+  min-height: 30px !important;
3160
+  height: 30px !important;
3161
+  color: #ffffff !important;
3162
+  background-color: #40c1a3 !important;
3163
+}
3164
+
3165
+#cancelOkWrap {
3166
+  display: block;
3167
+  width: 100%; 
3168
+  margin: 10px auto !important;
3169
+  text-align: center;
3170
+}
3171
+
3172
+#confirmOk, #confirmCancel {
3173
+  display: inline-block;
3174
+  min-width: 76px;
3175
+  border-radius: 20px !important;
3176
+  padding: 0px 14px !important;
3177
+  margin: 0 5px;
3178
+  min-height: 30px !important;
3179
+  height: 30px !important;
3180
+  color: #ffffff !important;
3181
+  background-color: #40c1a3 !important;
3182
+}
3183
+
3184
+#saveDispName:hover, #alertOk:hover, #confirmOk:hover, #confirmCancel:hover {
3185
+  background-color:  #3bb397 !important;
3186
+}
3187
+
3188
+#saveDispName:active, #alertOk:active, #confirmOk:active, #confirmCancel:active {
3189
+  background-color: #33a087 !important;
3190
+}
3191
+
3192
+#sendMsgReply {
3193
+  display: none;
3194
+}
3195
+
3196
+#sendMsgConv {
3197
+  width: 92%;
3198
+  height: auto;
3199
+  margin: 0 auto;
3200
+  border: none;
3201
+}
3202
+
3203
+#sendMsgConv td {
3204
+  background-color: #ffffff;
3205
+  border: none;
3206
+}
3207
+
3208
+#sendMsgConvText {
3209
+  display: inline-block;
3210
+  width: 100%;
3211
+  height: 72px;
3212
+  padding: 3px 5px;
3213
+  color: #000000;
3214
+  text-align: left;
3215
+  font-family: 'Inter';
3216
+  font-size: 15px;
3217
+  border-radius: 6px;
3218
+  resize: none;
3219
+  white-space: pre-wrap;
3220
+  border: 1px solid #dedede;
3221
+  background-color: #ffffff;
3222
+  overflow-y: auto;
3223
+}
3224
+
3225
+#fromPhoneNmbrConv {
3226
+  display: inline-block;
3227
+  width: 50%;
3228
+  height: auto;
3229
+  margin: 6px 0px 2px 10px;
3230
+  font-size: 14.5px;
3231
+  font-weight: 500;
3232
+  color: #222222;
3233
+}
3234
+
3235
+#toPhoneNmbrConv {
3236
+  display: inline-block;
3237
+  width: 50%;
3238
+  height: auto;
3239
+  margin: 6px 0px 2px -20px;
3240
+  font-size: 14.5px;
3241
+  font-weight: 500;
3242
+  color: #222222;
3243
+  text-align: right;
3244
+}
3245
+
3246
+#selectFromNbConv {
3247
+  height: 26px;
3248
+  width: auto;
3249
+  margin: 0;
3250
+  text-align: left;
3251
+  color: #222222;
3252
+  background-color: #ffffff !important;
3253
+  border: 1px solid #d8d8d8;
3254
+}
3255
+
3256
+#listAllMsgsFromTo {
3257
+  display: block;
3258
+  position: absolute;
3259
+  width: 600px;
3260
+  height: 490px;
3261
+  font-family: 'Inter' !important;
3262
+  white-space: pre-wrap;
3263
+  border-radius: 6px;
3264
+  background-color: #ffffff;
3265
+  box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
3266
+  -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
3267
+  -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
3268
+  z-index: 5100;
3269
+}
3270
+
3271
+#listAllMsgsConv {
3272
+  display: block;
3273
+  position: absolute;
3274
+  width: 600px;
3275
+  height: 490px;
3276
+  font-family: 'Inter' !important;
3277
+  white-space: pre-wrap;
3278
+  border-radius: 6px;
3279
+  background-color: #ffffff;
3280
+  box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
3281
+  -webkit-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
3282
+  -moz-box-shadow: 0 0 23px rgba(0, 0, 0, 0.23);
3283
+  z-index: 5100;
3284
+}
3285
+
3286
+#expandWindowRplCtn {
3287
+  display: block;
3288
+  width: 100%;
3289
+  height: 14px;
3290
+  margin: 4px auto 0 auto;
3291
+  text-align: center;
3292
+}
3293
+
3294
+#expandWindowRpl {
3295
+  cursor: pointer;
3296
+}
3297
+
3298
+#dragDispNmWindow {
3299
+  display: block;
3300
+  position: relative;
3301
+  width: 40px;
3302
+  height: 20px;
3303
+  margin:-3px auto 0px auto;
3304
+  cursor: grab;
3305
+  text-align: center;
3306
+  z-index: 99999;
3307
+}
3308
+
3309
+#draglstMsgmWindow {
3310
+  display: block;
3311
+  position: relative;
3312
+  width: 500px;
3313
+  width: 80%;
3314
+  height: 20px;
3315
+  margin:-3px auto 0px auto;
3316
+  cursor: grab;
3317
+  text-align: center;
3318
+}
3319
+
3320
+#draglstMsgmWindowsc {
3321
+  display: block;
3322
+  position: relative;
3323
+  width: 80%;
3324
+  height: 20px;
3325
+  margin: 8px auto 0 auto;
3326
+  cursor: grab;
3327
+  text-align: center;
3328
+}
3329
+
3330
+#frmMsgLstWrap {
3331
+  display: block;
3332
+  position: relative;
3333
+  width: 560px;
3334
+  height: 400px;
3335
+  margin: 0 auto;
3336
+  overflow-y: auto;
3337
+  overflow-x: hidden;
3338
+}
3339
+
3340
+#frmMsgLstTbl {
3341
+  position: relative;
3342
+  width: 100%;
3343
+  height: 100%;
3344
+}
3345
+
3346
+#frmMsgLstTbl td {
3347
+  text-align: left;
3348
+  vertical-align: top;
3349
+  background-color: #ffffff !important;
3350
+}
3351
+
3352
+.groupedLstNamespn {
3353
+  display: block;
3354
+  position: fixed;
3355
+  width: 130px;
3356
+  height: auto;
3357
+  padding: 0px 0px 0px 4px;
3358
+  overflow-y: auto;
3359
+  white-space: pre-wrap;
3360
+}
3361
+
3362
+#msgListRowCell {
3363
+  display: block;
3364
+  width: 428px;
3365
+  height: auto;
3366
+  min-height: 358px;
3367
+  margin: 0px 0px 0px 130px;
3368
+  padding: 0px 0px 0px 4px;
3369
+  overflow: scroll;
3370
+  white-space: nowrap;
3371
+}
3372
+
3373
+.dispNameListAll {
3374
+  display: block;
3375
+  width: 100%;
3376
+  height: auto;
3377
+  border: 1px solid #c6cedb;
3378
+  border-radius: 20px;
3379
+  margin: 6px 0px 0px 0px;
3380
+  color: #04957b;
3381
+  font-size: 13px;
3382
+  padding: 0px 9px;
3383
+  text-align: center;
3384
+  font-weight: 500;
3385
+  cursor: pointer;
3386
+}
3387
+
3388
+#selectAllChckbx:hover {
3389
+  cursor: pointer;
3390
+}
3391
+
3392
+.indivchckbx:hover {
3393
+  cursor: pointer;
3394
+}
3395
+
3396
+.selectsmsdv {
3397
+  width: 30px;
3398
+  padding: 5px 5px 5px 7px;
3399
+  text-align: center;
3400
+}
3401
+
3402
+#selectalldv {
3403
+  width: 30px;
3404
+  padding: 5px 5px 5px 7px;
3405
+}
3406
+
3407
+.indivfilter {
3408
+  height: 30px;
3409
+  font-weight: bold;
3410
+  padding: 0px;
3411
+}
3412
+
3413
+.selectalldvfilter {
3414
+  border: 1px solid #f3f3f3;
3415
+  padding: 3px;
3416
+  margin: 0px; 
3417
+}
3418
+
3419
+.filterbuttonsrec, .filterbuttonsent {
3420
+  display: block;
3421
+  position: relative;
3422
+  margin: 5px auto !important;
3423
+  border-radius: 3px !important;
3424
+  background-color: #ffffff !important;
3425
+  background-image: url('../img/filter_icon.svg');
3426
+  background-repeat: no-repeat;
3427
+  background-position: center center;
3428
+  cursor: pointer;
3429
+}
3430
+
3431
+#clearrecfilters, #clearsentfilters, #cleargrpfilter {
3432
+  display: inline-block;
3433
+  width: 22px;
3434
+  height: 22px;
3435
+  background-color: #ffffff;
3436
+  background-image: url('../img/clearfilters.svg');
3437
+  background-repeat: no-repeat;
3438
+  background-position: center center;
3439
+  margin: 0px 0px 8px 0px;
3440
+  border: none;
3441
+  cursor: pointer;
3442
+}
3443
+
3444
+#deleterecrows, #deletesentrows {
3445
+  display: inline-block;
3446
+  width: 16px;
3447
+  height: 20px;
3448
+  background-color: #ffffff;
3449
+  background-image: url('../img/garbage.svg');
3450
+  background-repeat: no-repeat;
3451
+  background-position: center center;
3452
+  margin: 0px 0px 4px 0px;
3453
+  border: none;
3454
+  cursor: pointer;
3455
+}
3456
+
3457
+#deleterecrows:active, #deletesentrows:active {
3458
+  background-image: url('../img/garbage_bright.svg');
3459
+}
3460
+
3461
+#toptablerec, #toptablesent, #toptablegrp {
3462
+  display: block;
3463
+  position: sticky;
3464
+  top: 0px;
3465
+  height: 27px;
3466
+  width: 100%;
3467
+  z-index: 1001;
3468
+}
3469
+
3470
+.topbuttonandpage {
3471
+  display: block;
3472
+  position: relative;
3473
+  width: 100%;
3474
+  height: 27px;
3475
+  border-radius: 0px 24px 0px 0px;
3476
+  background: #FFFFFF;
3477
+  z-index: 1001;
3478
+}
3479
+
3480
+#paginationrec, #paginationsent, #paginationgrp {
3481
+  display: block;
3482
+  position: relative;
3483
+  float: right;
3484
+  width: auto;
3485
+  margin: -25px 14px 0px 0px;
3486
+  font-size: 15px;
3487
+  font-weight: 600;
3488
+  color: #0082C9;
3489
+  z-index: 5002;
3490
+}
3491
+
3492
+.arrowDownCl {
3493
+  background-image: url('../img/arrowDown.svg');
3494
+  background-repeat: no-repeat;
3495
+  background-position: center center;
3496
+  z-index: 1010;
3497
+}
3498
+
3499
+.arrowUpCl {
3500
+  background-image: url('../img/arrowUp.svg');
3501
+  background-repeat: no-repeat;
3502
+  background-position: center center;
3503
+  z-index: 1010;   
3504
+}
3505
+
3506
+#recarrow, #sentarrow {
3507
+  display: block;
3508
+  position: relative;
3509
+  float: left;
3510
+  margin: 3.8px 0px 0px 7px;
3511
+  width: 17px;
3512
+  height: 17px;
3513
+  border: none;
3514
+  cursor: pointer;
3515
+}
3516
+
3517
+#totalrecmessages, #totalsentmessages, #totalgrpmessages {
3518
+  display: block;
3519
+  position: relative;
3520
+  padding: 10px 0px 0px 7px;
3521
+  font-size: 14px;
3522
+  font-weight: bold;
3523
+  color: #4cbc86;
3524
+}
3525
+
3526
+.pagenumbers, .pagenumbersbottom, .pagenumbersrec, .pagenumbersbottomrec, .pagenumbersgrp {
3527
+  color: #0082C9;
3528
+}
3529
+
3530
+#dbidtextsent {
3531
+  display: block;
3532
+  margin: auto;
3533
+  width: 95%;
3534
+  padding: 0 3px !important;
3535
+  text-align: center;
3536
+}
3537
+
3538
+#dbidtextrec {
3539
+  display: block;
3540
+  margin: auto;
3541
+  width: 95%;
3542
+  padding: 0 3px !important;
3543
+  text-align: center;
3544
+}
3545
+
3546
+#useridtext {
3547
+  display: block;
3548
+  margin: auto;
3549
+  width: 95%;
3550
+}
3551
+
3552
+#useridtextrec {
3553
+  display: block;
3554
+  margin: auto;
3555
+  width: 95%;
3556
+}
3557
+
3558
+#messageidtext {
3559
+  display: block;
3560
+  margin: auto;
3561
+  width: 95%;
3562
+}
3563
+
3564
+#messageidtextrec {
3565
+  display: block;
3566
+  margin: auto;
3567
+  width: 95%;
3568
+}
3569
+
3570
+#datetext {
3571
+  display: block;
3572
+  margin: auto;
3573
+  width: 95px;
3574
+}
3575
+
3576
+#datetextrec {
3577
+  display: block;
3578
+  margin: auto;
3579
+  width: 95%;
3580
+}
3581
+
3582
+#fromtext {
3583
+  display: block;
3584
+  margin: auto;
3585
+  width: 95%;
3586
+}
3587
+
3588
+#fromtextrec {
3589
+  display: block;
3590
+  margin: auto;
3591
+  width: 95%;
3592
+}
3593
+
3594
+#totext {
3595
+  display: block;
3596
+  margin: auto;
3597
+  width: 95%;
3598
+}
3599
+
3600
+#totextrec {
3601
+  display: block;
3602
+  margin: auto;
3603
+  width: 95%;
3604
+}
3605
+
3606
+#networktext {
3607
+  display: block;
3608
+  margin: auto;
3609
+  width: 95%;
3610
+}
3611
+
3612
+#pricetext {
3613
+  display: block;
3614
+  margin: auto;
3615
+  width: 95%;
3616
+}
3617
+
3618
+#statustext {
3619
+  display: block;
3620
+  margin: auto;
3621
+  width: 95%;
3622
+}
3623
+
3624
+#deliveryrcpttext {
3625
+  display: block;
3626
+  margin: auto;
3627
+  width: 95%;
3628
+}
3629
+
3630
+#messagetext {
3631
+  display: block;
3632
+  margin: auto;
3633
+  width: 95%;
3634
+}
3635
+
3636
+#messagetextrec {
3637
+  display: block;
3638
+  margin: auto;
3639
+  width: 95%;
3640
+}
3641
+
3642
+#databaseidfilter {
3643
+  display: block;
3644
+  margin-left: auto;
3645
+  margin-right: auto;
3646
+}
3647
+
3648
+#sentstatuscolumn {
3649
+  max-width: 160px;
3650
+}
3651
+
3652
+.useridcolrec {
3653
+  width: 124px;
3654
+  background-color: #ffffff;
3655
+  text-align: center;
3656
+}
3657
+
3658
+.messageidcolsent {
3659
+  overflow: visible;
3660
+  word-break: break-all;
3661
+  text-align: center;
3662
+  max-width: 180px;
3663
+}
3664
+
3665
+.messageidcolrec {
3666
+  overflow: visible;
3667
+  word-break: break-all;
3668
+  width: 420px;
3669
+  text-align: center;
3670
+}
3671
+
3672
+.datecolrec {
3673
+  width: 160px;
3674
+  text-align: center;
3675
+}
3676
+
3677
+.fromcolumnrec {
3678
+  width: 140px;
3679
+  text-align: center;
3680
+  background-color: #f2fff5;
3681
+}
3682
+
3683
+.tocolrec {
3684
+  width: 140px;
3685
+  background-color: #f2fbff;
3686
+  text-align: center;
3687
+}
3688
+
3689
+.networkcolumnsent {
3690
+  max-width: 90px;
3691
+  background-color: #ffffff;
3692
+  word-break: break-word;
3693
+  text-align: center;
3694
+}
3695
+
3696
+.networkNmContent {
3697
+  display: none;
3698
+}
3699
+
3700
+.phNetworkImg {
3701
+  cursor: pointer;
3702
+}
3703
+
3704
+.recNetworkImg {
3705
+  cursor: pointer;
3706
+}
3707
+
3708
+.useridcolsent, .pricecolumnsent {
3709
+  background-color: #ffffff;
3710
+  text-align: center;
3711
+}
3712
+
3713
+.statuscolumnsent {
3714
+  background-color: #ffffff;
3715
+  text-align: center;
3716
+  max-width: 200px;
3717
+}
3718
+
3719
+.deliveryrcptcolsent {
3720
+  background-color: #ffffff;
3721
+  text-align: center;
3722
+  max-width: 124px;
3723
+  word-break: break-word;
3724
+}
3725
+
3726
+.tocolumnsent {
3727
+  background-color: #f2fbff;
3728
+  text-align: center;
3729
+}
3730
+
3731
+.fromcolumnsent {
3732
+  background-color: #f2fff5;
3733
+  text-align: center;
3734
+}
3735
+
3736
+.active {
3737
+  color: #c62b71;
3738
+}
3739
+
3740
+#deleteoldmssgs {
3741
+  display: inline-block;
3742
+  position: relative;
3743
+  margin: 10px 0px 10px 1px;
3744
+  font-size: 15px;
3745
+  font-weight: bold;
3746
+}
3747
+
3748
+#deleteoldsms {
3749
+  display: none;
3750
+  background: #e8f6ff;
3751
+  border-radius: 6px;
3752
+  padding: 5px;
3753
+}
3754
+
3755
+#delOldrecSMS, #delOldsentSMS {
3756
+  display: block;
3757
+  background-color: #0082C9;
3758
+  color: #ffffff;
3759
+  margin: 10px 0px 10px 5px;
3760
+  border-radius: 20px;
3761
+  font-family: 'Open Sans';
3762
+  font-size: 14px;
3763
+}
3764
+
3765
+#delOldrecSMS:active, #delOldsentSMS:active {
3766
+  background: #00a2f9;
3767
+}
3768
+
3769
+#delsetrows {
3770
+  display: block;
3771
+  padding: 5px;
3772
+}
3773
+
3774
+.deletesmsolder {
3775
+  display: inline;
3776
+  font-size: 15px;
3777
+  font-weight: bold;
3778
+}
3779
+
3780
+#oldrecSmsInterval, #oldsentSmsInterval {
3781
+  display: inline;
3782
+  width: 60px;
3783
+  height: 25px;
3784
+  padding: 0px 0px 0px 10px;
3785
+  font-family: 'Inter';
3786
+  font-size: 14px;
3787
+  font-weight: 600;
3788
+  border-radius: 20px;
3789
+}
3790
+
3791
+#upArrow {
3792
+  background-image: url("../img/arrow-top.svg");
3793
+  background-repeat: no-repeat;
3794
+  background-color: transparent !important;
3795
+  opacity: 0.30;
3796
+  position: fixed;
3797
+  bottom: 30px;
3798
+  right: 8px;
3799
+  width: 42px;
3800
+  height: 42px;
3801
+  border: none;
3802
+  cursor: pointer;
3803
+  display: none;
3804
+  z-index: 1010;
3805
+}
3806
+
3807
+#upArrow:hover {
3808
+  opacity: 1;
3809
+}
3810
+
3811
+#arrowupWrap {
3812
+  display: block;
3813
+  position: sticky;
3814
+  width: 21px;
3815
+  height: 21px;
3816
+  bottom: 12px;
3817
+  left: 530px;
3818
+}
3819
+
3820
+#upArrowSmall {
3821
+  position: relative;
3822
+  background-image: url("../img/arrow-top-small.svg");
3823
+  background-repeat: no-repeat;
3824
+  background-color: transparent !important;
3825
+  width: 21px;
3826
+  height: 21px;
3827
+  opacity: 0.30;
3828
+  border: none;
3829
+  cursor: pointer;
3830
+  display: none;
3831
+  z-index: 5300;
3832
+}
3833
+
3834
+#upArrowSmall:hover {
3835
+  opacity: 1;
3836
+}
3837
+
3838
+.opensmsfolder {
3839
+  display: block;
3840
+  position: relative;
3841
+  margin: 10px 0px 10px 0px !important;
3842
+  padding: 7px 0 7px 0 !important;
3843
+  width: 100% !important;
3844
+  color: #FFFFFF !important;
3845
+  font-family: 'Open Sans' !important;
3846
+  font-size: 15px !important;
3847
+  background-color: #CB99C5 !important;
3848
+}
3849
+
3850
+.opensmsfolder:hover {
3851
+  border: 2px;
3852
+  background-color: #c18bba !important;
3853
+}
3854
+
3855
+.opensmsfolder:active {
3856
+  background-color: #b777af !important;
3857
+  border: 2px;
3858
+  color: #FFFFFF !important;
3859
+  border-color: #b777af;
3860
+}
3861
+
3862
+.opensmsfolder:focus {
3863
+  background-color: #a3669b !important;
3864
+  border: 2px;
3865
+  border-color: #a3669b;
3866
+}
3867
+
3868
+#save_sms_settings {
3869
+  display: inline-block;
3870
+  border-radius: 8px !important;
3871
+  padding: 0px 14px !important;
3872
+  color: #ffffff !important;
3873
+  background-color: #1e89c2 !important;
3874
+}
3875
+
3876
+#save_sms_settings:hover {
3877
+  background-color: #0369a0 !important;
3878
+}
3879
+
3880
+#save_sms_settings:active {
3881
+  background-color: #025480 !important;
3882
+}
3883
+
3884
+/* Timer for page auto-refresh */
3885
+#refreshTimerSent {
3886
+  display: none;
3887
+  margin: 1.5px 0px 0px 6px;
3888
+}
3889
+
3890
+.arftimer {
3891
+  background: -webkit-linear-gradient(left, #3c76bd 50%, #eee 50%);
3892
+  border-radius: 100%;
3893
+  height: calc(var(--size) * 1px);
3894
+  width: calc(var(--size) * 1px);
3895
+  position: relative;
3896
+  -webkit-animation: time calc(var(--duration) * 1s) steps(1000, start) infinite;
3897
+  -webkit-mask: radial-gradient(transparent 50%,#000 50%);
3898
+  mask: radial-gradient(transparent 50%,#000 50%);
3899
+}
3900
+
3901
+.arfmask {
3902
+  border-radius: 100% 0 0 100% / 50% 0 0 50%;
3903
+  height: 100%;
3904
+  left: 0;
3905
+  position: absolute;
3906
+  top: 0;
3907
+  width: 50%;
3908
+  -webkit-animation: mask calc(var(--duration) * 1s) steps(500, start) infinite;
3909
+  -webkit-transform-origin: 100% 50%;
3910
+}
3911
+
3912
+@-webkit-keyframes time {
3913
+  100% {
3914
+      -webkit-transform: rotate(360deg);
3915
+  }
3916
+}
3917
+
3918
+@-webkit-keyframes mask {
3919
+  0% {
3920
+      background: #eee;
3921
+      -webkit-transform: rotate(0deg);
3922
+  }
3923
+  50% {
3924
+      background: #eee;
3925
+      -webkit-transform: rotate(-180deg);
3926
+  }
3927
+  50.01% {
3928
+      background: #3c76bd;
3929
+      -webkit-transform: rotate(0deg);
3930
+  }
3931
+  100% {
3932
+      background: #3c76bd;
3933
+      -webkit-transform: rotate(-180deg);
3934
+  }
3935
+}
3936
+
3937
+#sms_relentless_adm {
3938
+  font-family: 'Inter';
3939
+}
3940
+
3941
+.arplAuthor, .arplPhoneNmbr, .selectArplMode, .daysInWeek, .startDate, .endDate, .arplText, .restrAuthor {
3942
+  font-family: 'Inter' !important;
3943
+}
3944
+
3945
+.indivfilterrec, .indivfiltersent {
3946
+  font-family: 'Inter';
3947
+  padding: 0 4px !important;
3948
+}
3949
+
3950
+@media only screen and (max-width: 600px) {
3951
+  #convImgGrey {
3952
+    display: none;
3953
+  }
3954
+  #grpdbynamelstcv {
3955
+    right: -130px;
3956
+  }
3957
+  #filterByTagImg, #filterByFlagImg {
3958
+    display: none;
3959
+  }
3960
+  #convDescWindow, #convTagWindow, #convFlagWindow {
3961
+    width: 100vw;
3962
+    left: 0 !important;
3963
+    top: 0 !important;
3964
+  }
3965
+  #listAllMsgsFromTo, #listAllMsgsConv {
3966
+    width: 100vw;
3967
+    height: calc(100vh - 120px);
3968
+    top: 0 !important;
3969
+    left: 0 !important;
3970
+    padding: 0 20px 0 20px;
3971
+  }
3972
+  #frmMsgLstWrap {
3973
+    height: calc(100vh - 232px);
3974
+  }
3975
+  .groupedLstNamespn {
3976
+    margin-top: 24px;
3977
+  }
3978
+  #frmMsgLstTbl {
3979
+    width: 92vw;
3980
+  }
3981
+  #msgListRowCell {
3982
+    width: auto;
3983
+  }
3984
+  #draglstMsgmWindowsc {
3985
+    margin: 6px auto 0 auto;
3986
+  }
3987
+  #fromPhoneNmbrConv {
3988
+    display: block;
3989
+    margin: 6px 0 2px 0;
3990
+  }
3991
+  #toPhoneNmbrConv {
3992
+    display: block;
3993
+    margin-left: 0 !important;
3994
+    text-align: left;
3995
+  }
3996
+  #alertMessage, #alertConfMessage {
3997
+    width: 100vw !important;
3998
+    left: 0 !important;
3999
+    background-color: #fbfbfb;
4000
+  }
4001
+  #disNameWindow {
4002
+    width: 100vw !important;
4003
+    left: 0 !important;
4004
+    top: 0 !important;
4005
+    background-color: #fbfbfb;
4006
+  }
4007
+  #sendMsgReplySec {
4008
+    height: auto;
4009
+  }
4010
+  #fromPhnNmbrCv, #toPhnNmbrCv {   
4011
+    display: block;
4012
+    text-align: left;
4013
+    margin: 0;
4014
+  }
4015
+  #sentSmsTable th, #recSmsTable th, #groupedSmsTable th {
4016
+    top: 0;
4017
+  }
4018
+  #stopAutoRefreshSent {
4019
+    left: auto;
4020
+    right: 2px !important;
4021
+  }
4022
+  #titleFirstRow {
4023
+    margin: 23px auto 0 auto;
4024
+  }
4025
+}
4026
+
4027
+@media only screen and (max-width: 1020px) {
4028
+  #recarrow, #sentarrow {
4029
+    display: block;
4030
+    position: relative;
4031
+    float: left;
4032
+    width: 17px;
4033
+    height: 17px;
4034
+    margin: 3.8px 0px 0px 50px;
4035
+    border: none;
4036
+    cursor: pointer;
4037
+    z-index: 5010;
4038
+  }
4039
+  #stopAutoRefreshSent {
4040
+    display: none;
4041
+    position: fixed;
4042
+    left: 86px;
4043
+    top: 50.7px;
4044
+    z-index: 5000;
4045
+  }
4046
+}
4047
+
4048
+/* Changes for dark themes */
4049
+[data-theme-dark] .srheader,
4050
+[data-theme-dark-highcontrast] .srheader {
4051
+  display: block;
4052
+  position: relative;
4053
+  margin: 0px 0px 7px 0px;
4054
+  color: #fafafa;
4055
+  font-size: 15px;
4056
+  font-weight: 700;
4057
+}
4058
+
4059
+[data-theme-dark] #sendtomultiple,
4060
+[data-theme-dark-highcontrast] #sendtomultiple {
4061
+  display: inline-block;
4062
+  position: relative;
4063
+  margin: 10px 0px 12px 0px;
4064
+  color: #fafafa;
4065
+  font-size: 15px;
4066
+  font-weight: 700;
4067
+}
4068
+
4069
+[data-theme-dark] #entermessage,
4070
+[data-theme-dark-highcontrast] #entermessage {
4071
+  display: block;
4072
+  position: relative;
4073
+  margin: 10px 0px 0px 0px;
4074
+  color: #fafafa;
4075
+  font-size: 15px;
4076
+  font-weight: 700;
4077
+}
4078
+
4079
+[data-theme-dark] #sendmediafl,
4080
+[data-theme-dark-highcontrast] #sendmediafl {
4081
+  display: block;
4082
+  position: relative;
4083
+  margin: 0px 0px 20px 0px;
4084
+  color: #fafafa;
4085
+  font-size: 15px;
4086
+  font-weight: 700;
4087
+}
4088
+
4089
+[data-theme-dark] #deleteoldmssgs,
4090
+[data-theme-dark-highcontrast] #deleteoldmssgs {
4091
+  display: inline-block;
4092
+  position: relative;
4093
+  margin: 10px 0px 10px 1px;
4094
+  color: #fafafa;
4095
+  font-size: 15px;
4096
+  font-weight: 700;
4097
+}
4098
+
4099
+[data-theme-dark] #smsto,
4100
+[data-theme-dark-highcontrast] #smsto {
4101
+  display: block;
4102
+  width: 99%;
4103
+  max-height: 32px;
4104
+  padding: 0px 15px 0px 15px;
4105
+  color: #fafafa;
4106
+  font-family: 'Inter';
4107
+  font-size: 15px;
4108
+  font-weight: 600;
4109
+  border-radius: 20px;
4110
+}
4111
+
4112
+[data-theme-dark] #smstext,
4113
+[data-theme-dark-highcontrast] #smstext {
4114
+  display: inline-block;
4115
+  color: #ffffff;
4116
+  width: 100%;
4117
+  height: 130px;
4118
+  text-align: left;
4119
+  font-family: 'Inter';
4120
+  font-size: 15px;
4121
+  border-radius: 6px;
4122
+  resize: vertical;
4123
+  white-space: pre-wrap;
4124
+}
4125
+
4126
+[data-theme-dark] .arplText,
4127
+[data-theme-dark-highcontrast] .arplText {
4128
+  display: inline-block;
4129
+  color: #fafafa;
4130
+  width: 330px;
4131
+  height: 184px;
4132
+  font-size: 15px;
4133
+  text-align: left;
4134
+  border: 1px solid #000;
4135
+  border-radius: 6px;
4136
+  margin: 0px 1px 0px 0px;
4137
+  resize: vertical;
4138
+  white-space: pre-wrap;
4139
+  overflow: auto;
4140
+}
4141
+
4142
+[data-theme-dark] #oldrecSmsInterval, [data-theme-dark] #oldsentSmsInterval,
4143
+[data-theme-dark-highcontrast] #oldrecSmsInterval, [data-theme-dark-highcontrast] #oldsentSmsInterval {
4144
+  display: inline;
4145
+  width: 60px;
4146
+  height: 25px;
4147
+  padding: 0px 0px 0px 10px;
4148
+  color: #fafafa;
4149
+  font-family: 'Inter';
4150
+  font-size: 14px;
4151
+  font-weight: 600;
4152
+  border-radius: 20px;
4153
+}
4154
+
4155
+[data-theme-dark] .tooltipbalanceid #infobalance,
4156
+[data-theme-dark-highcontrast] .tooltipbalanceid #infobalance {
4157
+  display: block;
4158
+  position: relative;
4159
+  margin: 4px 14px 0px 0px;
4160
+  color: #fafafa;
4161
+  font-size: 21px;
4162
+  font-weight: bold;
4163
+  font-family: 'Open Sans';
4164
+  font-style: italic;
4165
+  z-index: 6;
4166
+}
4167
+
4168
+[data-theme-dark] #infotipid,
4169
+[data-theme-dark-highcontrast] #infotipid {
4170
+  display: block;
4171
+  position: relative;
4172
+  margin: 4px 14px 0px 0px;
4173
+  color: #fafafa;
4174
+  font-size: 19px;
4175
+  font-weight: 700;
4176
+  font-family: 'Open Sans';
4177
+  font-style: italic;
4178
+  z-index: 5;
4179
+}
4180
+
4181
+[data-theme-dark] #inforestrict,
4182
+[data-theme-dark-highcontrast] #inforestrict {
4183
+  display: inline-block;
4184
+  position: relative;
4185
+  margin: -2px 0px 0px 10px;
4186
+  color: #fafafa;
4187
+  font-size: 18px;
4188
+  font-weight: bold;
4189
+  font-family: 'Open Sans';
4190
+  font-style: italic;
4191
+  cursor: pointer;
4192
+}
4193
+
4194
+[data-theme-dark] .fortooltip .texttooltip, [data-theme-dark] .maxmessagelength .texttooltip,
4195
+[data-theme-dark-highcontrast] .fortooltip .texttooltip, [data-theme-dark-highcontrast] .maxmessagelength .texttooltip {
4196
+  font-family: 'Open Sans';
4197
+  font-style: italic;
4198
+  color: #fafafa;
4199
+  font-size: 19px;
4200
+  font-weight: 700;
4201
+  margin: 0px 0px 4px 4px;
4202
+}
4203
+
4204
+[data-theme-dark] #uploadfileforsms,
4205
+[data-theme-dark-highcontrast] #uploadfileforsms {
4206
+  margin-left: 7px;
4207
+  background-color: #434343;
4208
+  border-radius: 3px !important;
4209
+}
4210
+
4211
+[data-theme-dark] #uploadfileformms,
4212
+[data-theme-dark-highcontrast] #uploadfileformms {
4213
+  margin-left: 21px;
4214
+  background-color: #434343;
4215
+  border-radius: 3px !important;
4216
+}
4217
+
4218
+[data-theme-dark] .smsnbformat a,
4219
+[data-theme-dark-highcontrast] .smsnbformat a {
4220
+  color: #cedfff !important;
4221
+}
4222
+
4223
+[data-theme-dark] .smsnbformat font,
4224
+[data-theme-dark-highcontrast] .smsnbformat font {
4225
+  color: #f7547a !important;
4226
+}
4227
+
4228
+[data-theme-dark] .indivfiltersent, [data-theme-dark] .indivfilterrec,
4229
+[data-theme-dark-highcontrast] .indivfiltersent, [data-theme-dark-highcontrast] .indivfilterrec {
4230
+  color: #ffffff !important;
4231
+  padding: 0 4px !important;
4232
+  font-family: 'Inter';
4233
+}
4234
+
4235
+[data-theme-dark] #recSmsTable, [data-theme-dark] #groupedSmsTable, [data-theme-dark] #sentSmsTable,
4236
+[data-theme-dark-highcontrast] #recSmsTable, [data-theme-dark-highcontrast] #groupedSmsTable, [data-theme-dark-highcontrast] #sentSmsTable {
4237
+  color: #000000 !important;
4238
+}
4239
+
4240
+[data-theme-dark] .providerSettings .setlabeltext,
4241
+[data-theme-dark-highcontrast] .providerSettings .setlabeltext {
4242
+  color: #272727;
4243
+}
4244
+
4245
+[data-theme-dark] .providerName,
4246
+[data-theme-dark-highcontrast] .providerName  {
4247
+  font-size: 18px;
4248
+  font-weight: bold;
4249
+  margin-bottom: 20px;
4250
+  color: #272727;
4251
+}
4252
+
4253
+[data-theme-dark] .selectHrMin, 
4254
+[data-theme-dark-highcontrast] .selectHrMin,
4255
+[data-theme-dark] .startDate,
4256
+[data-theme-dark-highcontrast] .startDate,
4257
+[data-theme-dark] .endDate,
4258
+[data-theme-dark-highcontrast] .endDate {
4259
+  color: #ffffff !important;
4260
+}
4261
+
4262
+[data-theme-dark] #infoautoreply, [data-theme-dark] #infoautoreplyst, [data-theme-dark] #infoautoreplypn,
4263
+[data-theme-dark-highcontrast] #infoautoreply, [data-theme-dark-highcontrast] #infoautoreplyst, [data-theme-dark-highcontrast] #infoautoreplypn {
4264
+  color: #ffffff;
4265
+}
4266
+
4267
+[data-theme-dark] .generateUrl,
4268
+[data-theme-dark-highcontrast] .generateUrl {
4269
+  color: #013351 !important;
4270
+  font-family: 'Inter';
4271
+}
0 4272
new file mode 100644
... ...
@@ -0,0 +1,886 @@
1
+/**
2
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
3
+ *
4
+ * @author Double Bastion LLC
5
+ *
6
+ * @license GNU AGPL version 3 or any later version
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
10
+ * License as published by the Free Software Foundation; either
11
+ * version 3 of the License, or any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
17
+ *
18
+ * You should have received a copy of the GNU Affero General Public
19
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+$(document).ready(function() {
24
+
25
+  var userid = "<?php p($userId); ?>";
26
+  var ctappdir = 'apps';
27
+
28
+  // Get app directory
29
+  var getappdirurl = OC.generateUrl('/apps/sms_relentless/user/getappdirectory');
30
+
31
+  $.ajax({
32
+     method: 'GET',
33
+     url: getappdirurl + '/' + userid,
34
+     contentType: 'application/json',
35
+     success: function(appdirfdb) {
36
+
37
+                   ctappdir = appdirfdb;
38
+
39
+		  // Get admin settings
40
+		  var baseUrlget = OC.generateUrl('/apps/sms_relentless/user/getadminsettings');
41
+
42
+		  $.ajax({
43
+		     method: 'GET',
44
+		     url: baseUrlget + '/' + userid,
45
+		     contentType: 'application/json',
46
+		     success: function(settingsadm) {
47
+
48
+			  $("#telapi_key").val(settingsadm.telapi_key);
49
+			  $("#tel_pub_key").val(settingsadm.tel_pub_key);
50
+			  $("#telapi_url_rec").val(settingsadm.telapi_url_rec);
51
+			  $("#telapi_url").val(settingsadm.telapi_url);
52
+			  $("#messaging_profile_id").val(settingsadm.messaging_profile_id);
53
+			  $("#nexapi_key").val(settingsadm.nexapi_key);
54
+			  $("#nexapi_secret").val(settingsadm.nexapi_secret);
55
+			  $("#nexapi_url_rec").val(settingsadm.nexapi_url_rec);
56
+			  $("#nexapi_url").val(settingsadm.nexapi_url);
57
+			  $("#twilapi_key").val(settingsadm.twilapi_key);
58
+			  $("#twilapi_secret").val(settingsadm.twilapi_secret);
59
+			  $("#twilapi_url_rec").val(settingsadm.twilapi_url_rec);
60
+			  $("#twilapi_url").val(settingsadm.twilapi_url);
61
+			  $("#flowapi_key").val(settingsadm.flowapi_key);
62
+			  $("#flowapi_secret").val(settingsadm.flowapi_secret);
63
+			  $("#flowapi_url_rec").val(settingsadm.flowapi_url_rec);
64
+			  $("#flowapi_url").val(settingsadm.flowapi_url);
65
+			  $("#tel_sender_name").val(settingsadm.tel_sender_name);
66
+			  $("#nex_sender_name").val(settingsadm.nex_sender_name);
67
+			  $("#twil_sender_name").val(settingsadm.twil_sender_name);
68
+
69
+			  var crntadmDispName = settingsadm.admdisplayname;
70
+			  var allRestrictions = settingsadm.restrictions;
71
+			  var allGroups = settingsadm.allgroups;
72
+			  var allUsers = settingsadm.allusers;
73
+			  var allGroupswadm = settingsadm.allgroupswadm;
74
+			  var allUserswadm = settingsadm.alluserswadm;
75
+			  var tnxallowedgrp = settingsadm.allowedkeysuse.tnx_groups_allowed;
76
+			  var tnxallowedusr = settingsadm.allowedkeysuse.tnx_users_allowed;
77
+			  var plvallowedgrp = settingsadm.allowedkeysuse.plv_groups_allowed;
78
+			  var plvallowedusr = settingsadm.allowedkeysuse.plv_users_allowed;
79
+			  var twlallowedgrp = settingsadm.allowedkeysuse.twl_groups_allowed;
80
+			  var twlallowedusr = settingsadm.allowedkeysuse.twl_users_allowed;
81
+			  var flrallowedgrp = settingsadm.allowedkeysuse.flr_groups_allowed;
82
+			  var flrallowedusr = settingsadm.allowedkeysuse.flr_users_allowed;
83
+
84
+			  var tnxallowedgrpdel = settingsadm.allowedkeysuse.tnx_groups_del;
85
+			  var tnxallowedusrdel = settingsadm.allowedkeysuse.tnx_users_del;
86
+			  var plvallowedgrpdel = settingsadm.allowedkeysuse.plv_groups_del;
87
+			  var plvallowedusrdel = settingsadm.allowedkeysuse.plv_users_del;
88
+			  var twlallowedgrpdel = settingsadm.allowedkeysuse.twl_groups_del;
89
+			  var twlallowedusrdel = settingsadm.allowedkeysuse.twl_users_del;
90
+			  var flrallowedgrpdel = settingsadm.allowedkeysuse.flr_groups_del;
91
+			  var flrallowedusrdel = settingsadm.allowedkeysuse.flr_users_del;
92
+
93
+			  if (tnxallowedgrpdel == 1) { $("#alwDelGrps-tnx").attr("checked", true); } else { $("#alwDelGrps-tnx").attr("checked", false); }
94
+			  if (tnxallowedusrdel == 1) { $("#alwDelUsrs-tnx").attr("checked", true); } else { $("#alwDelUsrs-tnx").attr("checked", false); }
95
+			  if (plvallowedgrpdel == 1) { $("#alwDelGrps-plv").attr("checked", true); } else { $("#alwDelGrps-plv").attr("checked", false); }
96
+			  if (plvallowedusrdel == 1) { $("#alwDelUsrs-plv").attr("checked", true); } else { $("#alwDelUsrs-plv").attr("checked", false); }
97
+			  if (twlallowedgrpdel == 1) { $("#alwDelGrps-twl").attr("checked", true); } else { $("#alwDelGrps-twl").attr("checked", false); }
98
+			  if (twlallowedusrdel == 1) { $("#alwDelUsrs-twl").attr("checked", true); } else { $("#alwDelUsrs-twl").attr("checked", false); }
99
+			  if (flrallowedgrpdel == 1) { $("#alwDelGrps-flr").attr("checked", true); } else { $("#alwDelGrps-flr").attr("checked", false); }
100
+			  if (flrallowedusrdel == 1) { $("#alwDelUsrs-flr").attr("checked", true); } else { $("#alwDelUsrs-flr").attr("checked", false); }
101
+
102
+			  if (settingsadm.show_all_messages == 1) { $("#showallmessages").attr("checked", true); } else { $("#showallmessages").attr("checked", false); }
103
+
104
+			  // List all the groups and users allowed to access the API keys, for each provider
105
+			  if (tnxallowedgrp) {
106
+			      var tnxallowedgrparr = tnxallowedgrp.split("|");
107
+			      for (var g = 0; g < tnxallowedgrparr.length; g++) {
108
+				   $("#alwdakeyGrps-tnx").append("<div class='selectedGrps'>"+ tnxallowedgrparr[g] +"<img id='rmvGrp-tnx-"+ tnxallowedgrparr[g] +"' class='removeGroup' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this group'></div>");
109
+			      }
110
+			  }
111
+
112
+			  if (tnxallowedusr) {
113
+			      var tnxallowedusrarr = tnxallowedusr.split("|");
114
+			      for (var g = 0; g < tnxallowedusrarr.length; g++) {
115
+				   $("#alwdakeyUsrs-tnx").append("<div class='selectedUsrs'>"+ tnxallowedusrarr[g] +"<img id='rmvUsr-tnx-"+ tnxallowedusrarr[g] +"' class='removeUser' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this user'></div>");
116
+			      }
117
+			  }
118
+
119
+			  if (plvallowedgrp) {
120
+			      var plvallowedgrparr = plvallowedgrp.split("|");
121
+			      for (var g = 0; g < plvallowedgrparr.length; g++) {
122
+				   $("#alwdakeyGrps-plv").append("<div class='selectedGrps'>"+ plvallowedgrparr[g] +"<img id='rmvGrp-plv-"+ plvallowedgrparr[g] +"' class='removeGroup' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this group'></div>");
123
+			      }
124
+			  }
125
+
126
+			  if (plvallowedusr) {
127
+			      var plvallowedusrarr = plvallowedusr.split("|");
128
+			      for (var g = 0; g < plvallowedusrarr.length; g++) {
129
+				   $("#alwdakeyUsrs-plv").append("<div class='selectedUsrs'>"+ plvallowedusrarr[g] +"<img id='rmvUsr-plv-"+ plvallowedusrarr[g] +"' class='removeUser' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this user'></div>");
130
+			      }
131
+			  }
132
+
133
+			  if (twlallowedgrp) {
134
+			      var twlallowedgrparr = twlallowedgrp.split("|");
135
+			      for (var g = 0; g < twlallowedgrparr.length; g++) {
136
+				   $("#alwdakeyGrps-twl").append("<div class='selectedGrps'>"+ twlallowedgrparr[g] +"<img id='rmvGrp-twl-"+ twlallowedgrparr[g] +"' class='removeGroup' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this group'></div>");
137
+			      }
138
+			  }
139
+
140
+			  if (twlallowedusr) {
141
+			      var twlallowedusrarr = twlallowedusr.split("|");
142
+			      for (var g = 0; g < twlallowedusrarr.length; g++) {
143
+				   $("#alwdakeyUsrs-twl").append("<div class='selectedUsrs'>"+ twlallowedusrarr[g] +"<img id='rmvUsr-twl-"+ twlallowedusrarr[g] +"' class='removeUser' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this user'></div>");
144
+			      }
145
+			  }
146
+
147
+			  if (flrallowedgrp) {
148
+			      var flrallowedgrparr = flrallowedgrp.split("|");
149
+			      for (var g = 0; g < flrallowedgrparr.length; g++) {
150
+				   $("#alwdakeyGrps-flr").append("<div class='selectedGrps'>"+ flrallowedgrparr[g] +"<img id='rmvGrp-flr-"+ flrallowedgrparr[g] +"' class='removeGroup' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this group'></div>");
151
+			      }
152
+			  }
153
+
154
+			  if (flrallowedusr) {
155
+			      var flrallowedusrarr = flrallowedusr.split("|");
156
+			      for (var g = 0; g < flrallowedusrarr.length; g++) {
157
+				   $("#alwdakeyUsrs-flr").append("<div class='selectedUsrs'>"+ flrallowedusrarr[g] +"<img id='rmvUsr-flr-"+ flrallowedusrarr[g] +"' class='removeUser' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this user'></div>");
158
+			      }
159
+			  }
160
+
161
+
162
+			  // Create a list with all the available groups, excluding the admin group
163
+			  var grpsListItemswadm = "";
164
+			  $.each(allGroupswadm, function(key, value) {
165
+				 grpsListItemswadm += "<div class='groupsList'>"+ value +"</div>";
166
+			  });
167
+
168
+			  // Create a list with all the available users, excluding the admins
169
+			  var usersListItemswadm = "";
170
+			  $.each(allUserswadm, function(key, usrval) {
171
+				 usersListItemswadm += "<div class='usersList'>"+ usrval +"</div>";
172
+			  });
173
+			  
174
+
175
+			  function showListsalwdk() {
176
+
177
+			      // Append the list of available groups to the table of groups and users allowed to use the API keys
178
+			      $('[id^="showakeyGrps-"]').click(function() {
179
+				 var crtid = $(this).attr("id").split("-")[1];
180
+				 $("#grpsadapik-"+ crtid).remove();
181
+				 $("#showakeyGrps-"+ crtid).append("<div id='grpsadapik-"+ crtid +"' class='grpsList'>"+ grpsListItemswadm +"</div>");
182
+				 $("#adminOverlay").remove();
183
+				 $("#app-content").append("<div id='adminOverlay'></div>");
184
+				 $("#adminOverlay").css({ "width" : parseInt($("#sms_relentless_adm").width() + 400) +"px", "height" : $("#sms_relentless_adm").height() +"px" });
185
+
186
+				 $("#adminOverlay").click(function() { 
187
+				    $("#adminOverlay").remove();
188
+				    $("#grpsadapik-"+ crtid).remove();
189
+				    $("#usrsadapik-"+ crtid).remove();
190
+				 });
191
+
192
+				 // Select a group
193
+				 $(".groupsList").click(function() {
194
+				    var slctdGrp = $(this).text();
195
+				    $("#grpsadapik-"+ crtid).remove();
196
+				    var addedTxtgrp = $("#alwdakeyGrps-"+ crtid).text();
197
+
198
+				    if (addedTxtgrp.indexOf(slctdGrp) == -1) {
199
+					$("#alwdakeyGrps-"+ crtid).append("<div class='selectedGrps'>"+ slctdGrp +"<img id='rmvGrp-"+ crtid +"-"+ slctdGrp +"' class='removeGroup' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this group'></div>");
200
+				    } else { showAlert("That group has already been added!"); }
201
+
202
+				    // Remove a group from list
203
+				    $('[id^="rmvGrp-"]').click(function() {
204
+				       $(this).closest(".selectedGrps").remove();
205
+				    });
206
+				 });
207
+
208
+			      });
209
+
210
+			      // Append the list of available users to the table of groups and users allowed to use the API keys
211
+			      $('[id^="showakeyUsrs-"]').click(function() {
212
+
213
+				 var crtidusr = $(this).attr("id").split("-")[1];
214
+				 $("#usrsadapik-"+ crtidusr).remove();
215
+				 $("#showakeyUsrs-"+ crtidusr).append("<div id='usrsadapik-"+ crtidusr +"' class='usrsList'>"+ usersListItemswadm +"</div>");
216
+				 $("#adminOverlay").remove();
217
+				 $("#app-content").append("<div id='adminOverlay'></div>");
218
+				 $("#adminOverlay").css({ "width" : parseInt($("#sms_relentless_adm").width() + 400) +"px", "height" : $("#sms_relentless_adm").height() +"px" });
219
+
220
+				 $("#adminOverlay").click(function() { 
221
+				    $("#adminOverlay").remove(); 
222
+				    $("#grpsadapik-"+ crtidusr).remove();
223
+				    $("#usrsadapik-"+ crtidusr).remove();
224
+				 });
225
+
226
+				 // Select a user
227
+				 $(".usersList").click(function() {
228
+				    var slctdUsr = $(this).text();
229
+				    var addedTxtusr = $("#alwdakeyUsrs-"+ crtidusr).text();
230
+
231
+				    if (addedTxtusr.indexOf(slctdUsr) == -1) {
232
+					$("#alwdakeyUsrs-"+ crtidusr).append("<div class='selectedUsrs'>"+ slctdUsr +"<img id='rmvUsr-"+ crtidusr +"-"+ slctdUsr +"' class='removeUser' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this user'></div>");
233
+				    } else { showAlert("That user has already been added!"); }
234
+
235
+				    // Remove a user from list
236
+				    $('[id^="rmvUsr-"]').click(function() {
237
+				       $(this).closest(".selectedUsrs").remove();
238
+				    });
239
+				 });
240
+
241
+			      });
242
+
243
+			      // Remove a group from the list 
244
+			      $('[id^="rmvGrp-"]').click(function() {
245
+				 $(this).closest(".selectedGrps").remove();
246
+			      });
247
+
248
+			      // Remove a user from the list
249
+			      $('[id^="rmvUsr-"]').click(function() {
250
+				 $(this).closest(".selectedUsrs").remove();
251
+			      });
252
+
253
+			  }
254
+			  showListsalwdk();
255
+
256
+
257
+			  // Save the data
258
+			  function saveAlwdRow() {
259
+			     $('[id^="alwdrstsave-"]').unbind("click");
260
+			     $('[id^="alwdrstsave-"]').click(function(event) {
261
+
262
+				 event.preventDefault();
263
+				 var crntprov = $(this).attr("id").replace("alwdrstsave-", "");
264
+				 
265
+				 if ($(this).attr("value") == "Save") {
266
+
267
+				     var selGroups = [];
268
+				     $("#alwdakeyGrps-"+ crntprov +" .selectedGrps").each(function() {
269
+					selGroups.push($(this).text());
270
+				     });
271
+				     if (selGroups.length == 0) { selGroups.push(""); }
272
+
273
+				     var selUsers = [];
274
+				     $("#alwdakeyUsrs-"+ crntprov +" .selectedUsrs").each(function() {
275
+					selUsers.push($(this).text());
276
+				     });
277
+				     if (selUsers.length == 0) { selUsers.push(""); }
278
+
279
+				     // Check if the access key fields have been left empty
280
+				     if (crntprov == 'tnx' && ($("#telapi_key").val().trim() == '' || $("#tel_pub_key").val().trim() == '' || $("#messaging_profile_id").val().trim() == '')) {
281
+					 showAlert("Please first fill in the fields: 'Telnyx API Secret Key', 'Telnyx Account Public Key' and 'Messaging Profile ID'");
282
+					 return;
283
+				     } else if (crntprov == 'plv' && ($("#nexapi_key").val().trim() == '' || $("#nexapi_secret").val().trim() == '')) {
284
+					 showAlert("Please first fill in the fields: 'Plivo Auth ID' and 'Plivo Auth Token'.");
285
+					 return;
286
+				     } else if (crntprov == 'twl' && ($("#twilapi_key").val().trim() == '' || $("#twilapi_secret").val().trim() == '')) {
287
+					 showAlert("Please first fill in the fields: 'Twilio Account SID' and 'Twilio Auth Token'.");
288
+					 return;
289
+				     } else if (crntprov == 'flr' && ($("#flowapi_key").val().trim() == '' || $("#flowapi_secret").val().trim() == '')) {
290
+					 showAlert("Please first fill in the fields: 'Flowroute Access Key' and 'Flowroute Secret Key'.");
291
+					 return;
292
+				     }
293
+
294
+                                     var delGroups = 0;
295
+		                     if ($("#alwDelGrps-"+ crntprov +"").is(':checked')) { delGroups = 1; }
296
+
297
+                                     var delUsers = 0;
298
+		                     if ($("#alwDelUsrs-"+ crntprov +"").is(':checked')) { delUsers = 1; }
299
+
300
+				     var saveAlwdUrl = OC.generateUrl('/apps/sms_relentless/user/updatekeysallowedusers');
301
+
302
+				     var alwddatatosend = { 
303
+					      userId: userid,
304
+					      groups: selGroups,
305
+					      users: selUsers,
306
+                                              groupsdel: delGroups,
307
+                                              usersdel: delUsers,
308
+					      provider: crntprov
309
+				     };
310
+
311
+				     $.ajax({
312
+					   method: 'PUT',
313
+					   url: saveAlwdUrl + '/' + userid,
314
+					   contentType: 'application/json',
315
+					   data: JSON.stringify(alwddatatosend),
316
+					   success: function(messagesent) {
317
+					                if (messagesent == 'success') {
318
+					                    showAlert('The allowed groups and users have been successfully saved to the database! However, to be able to send and receive messages using the shared keys from above, the allowed users have to generate and save the 2 webhook URLs corresponding to this SMS provider, on their own Settings page.');
319
+					                } else if (messagesent != 'success' && messagesent != 'failure') {
320
+					                    showAlert(messagesent);
321
+					                } else if (messagesent == 'failure') {
322
+					                    showAlert('Error while trying to save the allowed groups and users!');
323
+					                }
324
+					   },
325
+					   error: function() {
326
+							showAlert('Error while attempting to save the allowed groups and users! You can check the Nextcloud log to find more details about this issue.');
327
+					   }
328
+				     });
329
+
330
+				     $(this).attr("value", "Edit");
331
+
332
+				} else { $("#alwdrstsave-"+ crntprov).attr("value", "Save"); }
333
+
334
+			     });
335
+			  }
336
+			  saveAlwdRow();
337
+
338
+
339
+
340
+			  // Phone number restrictions
341
+
342
+			  // Create a list with all the available groups
343
+			  var grpsListItems = "";
344
+			  $.each(allGroups, function(key, value) {
345
+				 grpsListItems += "<div class='groupsList'>"+ value +"</div>";
346
+			  });
347
+
348
+			  // Create a list with all the available users
349
+			  var usersListItems = "";
350
+			  $.each(allUsers, function(key, usrval) {
351
+				 usersListItems += "<div class='usersList'>"+ usrval +"</div>";
352
+			  });
353
+
354
+
355
+			  if (allRestrictions.length > 0) {
356
+			      var restrNmb = allRestrictions.length;
357
+			  } else {
358
+			      var restrNmb = 0;
359
+			  }
360
+
361
+
362
+			  // List the access restrictions for groups and users
363
+			  if (restrNmb == 0) {
364
+
365
+			      $("#phoneNmbrRestr").append("<tr><td><input type='text' class='restrAuthor' value='"+ crntadmDispName +"' disabled></td><td><select id='rstphn-"+ restrNmb +"' class='restrPhoneNmbr'></select></td><td><div id='rstgrp-"+ restrNmb +"' class='restrGroups'></div></td><td><div id='showGrps-"+ restrNmb +"' class='showAllGroups'><img src='/" + ctappdir + "/sms_relentless/img/group.svg' style='cursor:pointer' title='Show all groups'></div></td><td><div id='rstusr-"+ restrNmb +"' class='restrUsers'></div></td><td><div id='showUsr-"+ restrNmb +"' class='showAllUsers'><img src='/" + ctappdir + "/sms_relentless/img/user.svg' style='cursor:pointer' title='Show all users'></div></td><td><img id='rmRow-"+ restrNmb +"' class='removeRow' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this row from the database' style='cursor:pointer;margin:6px 7px 0px 6px;'></td><td><input type='submit' id='rstsave-"+ restrNmb +"' class='saveRestrictions' value='Save' title='Save Row' /></td></tr>");
366
+			      $("#phoneNmbrRestr").append("<div><img id='addRestrRow' src='/" + ctappdir + "/sms_relentless/img/add.svg' title='Add Row'></div>");
367
+
368
+			  } else {
369
+
370
+			      for (k = 0; k < restrNmb; k++) {
371
+
372
+				   if (allRestrictions[k].groups) {
373
+				       var groupsfdbpre = allRestrictions[k].groups.split("|");
374
+				       var groupsfdb = "";
375
+				       for (var g = 0; g < groupsfdbpre.length; g++) {
376
+					    groupsfdb += "<div class='selectedGrps'>"+ groupsfdbpre[g] +"<img id='rmvGrp-"+ groupsfdbpre[g] +"' class='removeGroup' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this group'></div>";
377
+				       }
378
+				   } else { var groupsfdb = ""; }
379
+
380
+				   if (allRestrictions[k].users) {
381
+				       var usersfdbpre = allRestrictions[k].users.split("|");
382
+				       var usersfdb = "";
383
+				       for (var u = 0; u < usersfdbpre.length; u++) {
384
+					    usersfdb += "<div class='selectedUsrs'>"+ usersfdbpre[u] +"<img id='rmvUsr-"+ usersfdbpre[u] +"' class='removeUser' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this user'></div>";
385
+				       }
386
+				   } else { var usersfdb = ""; }
387
+
388
+				   $("#phoneNmbrRestr").append("<tr><td><input type='text' class='restrAuthor' value='"+ allRestrictions[k].saved_by_dsplname +"' disabled></td><td><select id='rstphn-"+ k +"' class='restrPhoneNmbr' style='pointer-events:none'><option selected>"+ allRestrictions[k].phone_number +"</option></select></td><td><div id='rstgrp-"+ k +"' class='restrGroups'>"+ groupsfdb +"</div></td><td><div id='showGrps-"+ k +"' class='showAllGroups'><img src='/" + ctappdir + "/sms_relentless/img/group.svg' style='cursor:pointer' title='Show all groups'></div></td><td><div id='rstusr-"+ k +"' class='restrUsers'>"+ usersfdb +"</div></td><td><div id='showUsr-"+ k +"' class='showAllUsers'><img src='/" + ctappdir + "/sms_relentless/img/user.svg' style='cursor:pointer' title='Show all users'></div></td><td><img id='rmRow-"+ k +"' class='removeRow' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this row from the database' style='cursor:pointer;margin:6px 7px 0px 6px;'></td><td><input type='submit' id='rstsave-"+ k +"' class='saveRestrictions' value='Edit' title='Edit Row' /></td></tr>");
389
+			      }
390
+			      $("#phoneNmbrRestr").append("<div><img id='addRestrRow' src='/" + ctappdir + "/sms_relentless/img/add.svg' title='Add Row'></div>");
391
+			  }
392
+
393
+
394
+			  // Get the available phone numbers from all providers associated with the access keys entered on the Settings page
395
+			  $("#phoneNumberTh").addClass('icon-loading');
396
+			  var getnumbersUrl = OC.generateUrl("/apps/sms_relentless/user/getsmsnumbers");
397
+			  var numbersListItems = '';
398
+
399
+			  $.ajax({
400
+				  url: getnumbersUrl + '/' + userid,
401
+				  type: "POST",
402
+				  cache: false,
403
+				  processData: false,
404
+				  contentType: false,
405
+				  success: function(currentnmbrs) {
406
+
407
+					            $("#phoneNumberTh").removeClass('icon-loading');
408
+
409
+						    // Create a list with all the available phone numbers
410
+					            numbersListItems = "<option value='' selected>Select phone number</option>";
411
+
412
+						    $.each(currentnmbrs, function(key, indsmsnmb) {
413
+							   numbersListItems += "<option value='"+ indsmsnmb +"'>"+ indsmsnmb +"</option>";
414
+						    });
415
+
416
+						    if (restrNmb == 0) { var indRow = 0; } else { var indRow = parseInt(restrNmb + 1); }
417
+
418
+						    // Append the list of available phone numbers
419
+						    $("#rstphn-"+ indRow).empty();
420
+						    $("#rstphn-"+ indRow).append(numbersListItems);
421
+			
422
+				  },
423
+				  error: function() {
424
+					            $("#phoneNumberTh").removeClass('icon-loading'); 
425
+					            showAlert("Error while attempting to retrieve the available phone numbers!");
426
+				  }
427
+			  });
428
+
429
+
430
+			  function showLists() {
431
+
432
+			      // Append the list of available groups to the restrictions table
433
+			      $('[id^="showGrps-"]').click(function() {
434
+				 var crtnmbr = $(this).attr("id").replace("showGrps-", "");
435
+				 $("#grpL-"+ crtnmbr).remove();
436
+				 $("#showGrps-"+ crtnmbr).append("<div id='grpL-"+ crtnmbr +"' class='grpsList'>"+ grpsListItems +"</div>");
437
+				 $("#adminOverlay").remove();
438
+				 $("#app-content").append("<div id='adminOverlay'></div>");
439
+				 $("#adminOverlay").css({ "width" : parseInt($("#sms_relentless_adm").width() + 400) +"px", "height" : $("#sms_relentless_adm").height() +"px" });
440
+
441
+				 $("#adminOverlay").click(function() { 
442
+				    $("#adminOverlay").remove(); 
443
+				    $("#grpL-"+ crtnmbr).remove(); 
444
+				    $("#usrL-"+ crtnmbr).remove();
445
+				 });
446
+
447
+				 // Select a group
448
+				 $(".groupsList").click(function() {
449
+				    var slctdGrp = $(this).text();
450
+				    $("#grpL-"+ crtnmbr).remove();
451
+				    var addedTxtgrp = $("#rstgrp-"+ crtnmbr).text();
452
+
453
+				    if (addedTxtgrp.indexOf(slctdGrp) == -1) {
454
+					$("#rstgrp-"+ crtnmbr).append("<div class='selectedGrps'>"+ slctdGrp +"<img id='rmvGrp-"+ slctdGrp +"' class='removeGroup' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this group'></div>");
455
+				    } else { showAlert("That group has already been added!"); }
456
+
457
+				    // Remove a group from list
458
+				    $('[id^="rmvGrp-"]').click(function() {
459
+				       $(this).closest(".selectedGrps").remove();
460
+				    });
461
+				 });
462
+
463
+			      });
464
+
465
+			      // Append the list of available users to the restrictions table
466
+			      $('[id^="showUsr-"]').click(function() {
467
+
468
+				 var ctusrnmbr = $(this).attr("id").replace("showUsr-", "");
469
+				 $("#usrL-"+ ctusrnmbr).remove();
470
+				 $("#showUsr-"+ ctusrnmbr).append("<div id='usrL-"+ ctusrnmbr +"' class='usrsList'>"+ usersListItems +"</div>");
471
+				 $("#adminOverlay").remove();
472
+				 $("#app-content").append("<div id='adminOverlay'></div>");
473
+				 $("#adminOverlay").css({ "width" : parseInt($("#sms_relentless_adm").width() + 400) +"px", "height" : $("#sms_relentless_adm").height() +"px" });
474
+
475
+				 $("#adminOverlay").click(function() { 
476
+				    $("#adminOverlay").remove(); 
477
+				    $("#grpL-"+ ctusrnmbr).remove(); 
478
+				    $("#usrL-"+ ctusrnmbr).remove();
479
+				 });
480
+
481
+				 // Select a user
482
+				 $(".usersList").click(function() {
483
+				    var slctdUsr = $(this).text();
484
+				    var addedTxtusr = $("#rstusr-"+ ctusrnmbr).text();
485
+
486
+				    if (addedTxtusr.indexOf(slctdUsr) == -1) {
487
+					$("#rstusr-"+ ctusrnmbr).append("<div class='selectedUsrs'>"+ slctdUsr +"<img id='rmvUsr-"+ slctdUsr +"' class='removeUser' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this user'></div>");
488
+				    } else { showAlert("That user has already been added!"); }
489
+
490
+				    // Remove a user from list
491
+				    $('[id^="rmvUsr-"]').click(function() {
492
+				       $(this).closest(".selectedUsrs").remove();
493
+				    });
494
+				 });
495
+
496
+			      });
497
+
498
+			      // Remove a group from the list 
499
+			      $('[id^="rmvGrp-"]').click(function() {
500
+				 $(this).closest(".selectedGrps").remove();
501
+			      });
502
+
503
+			      // Remove a user from the list
504
+			      $('[id^="rmvUsr-"]').click(function() {
505
+				 $(this).closest(".selectedUsrs").remove();
506
+			      });
507
+
508
+			  }
509
+			  showLists();
510
+
511
+
512
+			  // Save the data
513
+			  function saveRestrRow() {
514
+
515
+			     $('[id^="rstsave-"]').unbind("click");
516
+			     $('[id^="rstsave-"]').click(function(event) {
517
+
518
+				 event.preventDefault();
519
+				 var crntrwnmbr = $(this).attr("id").replace("rstsave-", "");
520
+
521
+				 if ($(this).attr("value") == "Save") {
522
+
523
+				     var phoneNmbr = $("#rstphn-"+ crntrwnmbr).val();
524
+				     var slctdGroups = [];
525
+				     $("#rstgrp-"+ crntrwnmbr +" .selectedGrps").each(function() {
526
+					slctdGroups.push($(this).text());
527
+				     });
528
+				     var slctdUsers = [];
529
+				     $("#rstusr-"+ crntrwnmbr +" .selectedUsrs").each(function() {
530
+					slctdUsers.push($(this).text());
531
+				     });
532
+
533
+				     if (phoneNmbr != '') {
534
+
535
+				       if (slctdGroups.length > 0 || slctdUsers.length > 0) {
536
+
537
+					 var saveRestrUrl = OC.generateUrl('/apps/sms_relentless/user/updatenumberrestrictions');
538
+
539
+					 var datatosend = { 
540
+					      userId: userid,
541
+					      savedByDsplname: crntadmDispName,
542
+					      phoneNumber: phoneNmbr,
543
+					      groups: slctdGroups,
544
+					      users: slctdUsers
545
+					 };
546
+
547
+					 $.ajax({
548
+					   method: 'PUT',
549
+					   url: saveRestrUrl + '/' + userid,
550
+					   contentType: 'application/json',
551
+					   data: JSON.stringify(datatosend),
552
+					   success: function(messagetosend) {
553
+					                if (messagetosend == 'success') {
554
+					                    showAlert('The restrictions have been successfully saved to the database!');
555
+					                } else {
556
+					                    showAlert('Error while trying to save the restrictions!');
557
+					                }
558
+					   },
559
+					   error: function() {
560
+							showAlert('Error while attempting to save the restrictions! You can check the Nextcloud log to find more details about this issue.');
561
+					   }
562
+					 });
563
+
564
+				       } else { showAlert("You must select at least a group or a user in order to restrict access to a phone number."); return; }
565
+
566
+				     } else { showAlert("Please select a phone number!"); return; }
567
+
568
+				     $(this).attr("value", "Edit");
569
+
570
+				} else {
571
+
572
+				     $("#rstsave-"+ crntrwnmbr).attr("value", "Save");
573
+				}
574
+
575
+			     });
576
+			  }
577
+			  saveRestrRow();
578
+
579
+			  // Remove a row
580
+			  function removeRestrRow() {
581
+
582
+			       $('[id^="rmRow-"]').click(function() {
583
+
584
+				  var slctRowRmv = $(this).attr("id").replace("rmRow-", "");
585
+				  var crntPhNmbr = $("#rstphn-"+ slctRowRmv).val();
586
+
587
+				  confirmAlert("Do you really want to remove this row from the database ?");
588
+
589
+				  $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
590
+
591
+				  $("#confirmOk").click(function() {
592
+
593
+				      $("#alertMsgOverlay").remove();
594
+				      $("#alertConfMessage").remove();
595
+
596
+				      var rmvRestrUrl = OC.generateUrl('/apps/sms_relentless/user/removenumberrestrictions');
597
+				      $.ajax({
598
+					   url: rmvRestrUrl + '/' + userid,
599
+					   method: "POST",
600
+					   dataType: "text",
601
+					   data: { phoneNumber: crntPhNmbr },
602
+					   success: function(delresult) {
603
+
604
+					                     if (delresult.indexOf("success") > -1) {
605
+					                         showAlert("The restriction has been removed successfully!");
606
+					                         $("#rstphn-"+ slctRowRmv).closest("tr").remove();
607
+					                     } else {
608
+					                         showAlert("Error while trying to remove restriction data!");
609
+					                     }
610
+					   },
611
+					   error: function() { showAlert("Error while attempting to remove restriction data! You can check the Nextcloud log to find more details about this issue."); }
612
+				       });
613
+				  });
614
+			       });
615
+			  }
616
+			  removeRestrRow();
617
+
618
+			  // Add a new row
619
+			  $("#addRestrRow").click(function() {
620
+			      if ($("#phoneNmbrRestr").find("tr:last-child").find(".restrPhoneNmbr").length > 0) {
621
+				  var lastrstAuth = $("#phoneNmbrRestr").find("tr:last-child").find(".restrPhoneNmbr").attr("id").replace("rstphn-", "");
622
+				  var indRowAdd = parseInt(lastrstAuth + 1);
623
+			      } else { var indRowAdd = 0; }
624
+			      $("#phoneNmbrRestr").append("<tr><td><input type='text' class='restrAuthor' value='"+ crntadmDispName +"' disabled></td><td><select id='rstphn-"+ indRowAdd +"' class='restrPhoneNmbr'>"+ numbersListItems +"</select></td><td><div id='rstgrp-"+ indRowAdd +"' class='restrGroups'></div></td><td><div id='showGrps-"+ indRowAdd +"' class='showAllGroups'><img src='/" + ctappdir + "/sms_relentless/img/group.svg' style='cursor:pointer' title='Show all groups'></div></td><td><div id='rstusr-"+ indRowAdd +"' class='restrUsers'></div></td><td><div id='showUsr-"+ indRowAdd +"' class='showAllUsers'><img src='/" + ctappdir + "/sms_relentless/img/user.svg' style='cursor:pointer' title='Show all users'></div></td><td><img id='rmRow-"+ indRowAdd +"' class='removeRow' src='/" + ctappdir + "/sms_relentless/img/closewnd.svg' title='Remove this row from the database' style='cursor:pointer;margin:6px 7px 0px 6px;'></td><td><input type='submit' id='rstsave-"+ indRowAdd +"' class='saveRestrictions' value='Save' title='Save Row' /></td></tr>");
625
+			      showLists();
626
+			      saveRestrRow();
627
+			      removeRestrRow();
628
+
629
+			      // Check if the same phone number has been already restricted
630
+			      $("#rstphn-"+ indRowAdd).change(function() {
631
+				 var selectedPhNmbr = $("#rstphn-"+ indRowAdd).val();
632
+				 var allPHoneRestr = $("#phoneNmbrRestr").find("tr").find(".restrPhoneNmbr");
633
+				 var phNmbrChck = 0;
634
+				 allPHoneRestr.each(function() {
635
+				    var slctdphnmbr = ($(this).val())? $(this).val() : $(this).text();
636
+				    if (selectedPhNmbr == slctdphnmbr) { phNmbrChck++; }
637
+				 });
638
+
639
+				 if (phNmbrChck == 2) {
640
+				     showAlert("This phone number is already in the list of restricted phone numbers. Please edit its own row, or choose a different phone number to restrict access to.");
641
+				     $(this).val('');
642
+				     return;
643
+				 }
644
+			      });
645
+			  });
646
+
647
+		     },
648
+		     error: function() {
649
+				showAlert('Error while getting the admin settings! You can check the Nextcloud log to find more details about this issue.');
650
+		     }
651
+		  });
652
+
653
+
654
+
655
+		  // Save admin settings
656
+		  function randomStr(strlength) {
657
+			var fintext = "";
658
+			var keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
659
+			for (var i = 0; i < strlength; i++) {
660
+			     fintext += keyspace.charAt(Math.floor(Math.random() * keyspace.length));
661
+			}
662
+			return fintext;
663
+		  }
664
+
665
+		  $("#generate_tel_rcpt").on("click", function(event) {
666
+
667
+		     var teltokenrec = randomStr(70);
668
+		     var telnyxwhurlrec = window.location.origin + OC.generateUrl('/apps/sms_relentless/api/recsmstel?telrecparam=') + teltokenrec;
669
+
670
+		     $("#telapi_url_rec").val(telnyxwhurlrec);
671
+		  });
672
+
673
+		  $("#copyToClipboardtel").on("click", function(event) {
674
+		     var $tempEl = $("<input>");
675
+		     $("body").append($tempEl);
676
+		     $tempEl.val($("#telapi_url_rec").val()).select();
677
+		     document.execCommand("Copy");
678
+		     $tempEl.remove();
679
+		     showAlert("The link has been copied to your clipboard!");
680
+		  });
681
+
682
+		  $("#generate_tel_delrcpt").on("click", function(event) {
683
+
684
+		     var teltoken = randomStr(70);
685
+		     var telnyxwhurl = window.location.origin + OC.generateUrl('/apps/sms_relentless/api/recdeliverytel?teldrparam=') + teltoken;
686
+
687
+		     $("#telapi_url").val(telnyxwhurl);
688
+		  });
689
+
690
+		  $("#generate_nex_rcpt").on("click", function(event) {
691
+
692
+		     var plivotokenrec = randomStr(70);
693
+		     var plivowhurlrec = window.location.origin + OC.generateUrl('/apps/sms_relentless/api/recsmsnex?plivorecparam=') + plivotokenrec;
694
+
695
+		     $("#nexapi_url_rec").val(plivowhurlrec);
696
+		  });
697
+
698
+		  $("#copyToClipboardnex").on("click", function(event) {
699
+		     var $tempElpl = $("<input>");
700
+		     $("body").append($tempElpl);
701
+		     $tempElpl.val($("#nexapi_url_rec").val()).select();
702
+		     document.execCommand("Copy");
703
+		     $tempElpl.remove();
704
+		     showAlert("The link has been copied to your clipboard!");
705
+		  });
706
+
707
+		  $("#generate_nex_delrcpt").on("click", function(event) {
708
+
709
+		     var plivotoken = randomStr(70);
710
+		     var plivodrwhurl = window.location.origin + OC.generateUrl('/apps/sms_relentless/api/recdeliverynex?plivodrparam=') + plivotoken;
711
+
712
+		     $("#nexapi_url").val(plivodrwhurl);
713
+		  });
714
+
715
+		  $("#generate_twil_rcpt").on("click", function(event) {
716
+
717
+		     var twiltokenrec = randomStr(35);
718
+		     var twilwhurlrec = window.location.origin + OC.generateUrl('/apps/sms_relentless/api/recsmstwil?twilrecparam=') + twiltokenrec;
719
+
720
+		     $("#twilapi_url_rec").val(twilwhurlrec);
721
+		  });
722
+
723
+		  $("#copyToClipboardtwil").on("click", function(event) {
724
+		     var $tempElpl = $("<input>");
725
+		     $("body").append($tempElpl);
726
+		     $tempElpl.val($("#twilapi_url_rec").val()).select();
727
+		     document.execCommand("Copy");
728
+		     $tempElpl.remove();
729
+		     showAlert("The link has been copied to your clipboard!");
730
+		  });
731
+
732
+		  $("#generate_twil_delrcpt").on("click", function(event) {
733
+
734
+		     var twiltoken = randomStr(35);
735
+		     var twildrwhurl = window.location.origin + OC.generateUrl('/apps/sms_relentless/api/recdeliverytwil?twildrparam=') + twiltoken;
736
+
737
+		     $("#twilapi_url").val(twildrwhurl);
738
+		  });
739
+
740
+		  $("#generate_flow_rcpt").on("click", function(event) {
741
+
742
+		     var flowtokenrec = randomStr(70);
743
+		     var flowwhurlrec = window.location.origin + OC.generateUrl('/apps/sms_relentless/api/recsmsflow?flowrecparam=') + flowtokenrec;
744
+
745
+		     $("#flowapi_url_rec").val(flowwhurlrec);
746
+		  });
747
+
748
+		  $("#copyToClipboardflow").on("click", function(event) {
749
+		     var $tempElpl = $("<input>");
750
+		     $("body").append($tempElpl);
751
+		     $tempElpl.val($("#flowapi_url_rec").val()).select();
752
+		     document.execCommand("Copy");
753
+		     $tempElpl.remove();
754
+		     showAlert("The link has been copied to your clipboard!");
755
+		  });
756
+
757
+		  $("#generate_flow_delrcpt").on("click", function(event) {
758
+
759
+		     var flowtoken = randomStr(70);
760
+		     var flowdrwhurl = window.location.origin + OC.generateUrl('/apps/sms_relentless/api/recdeliveryflow?flowdrparam=') + flowtoken;
761
+
762
+		     $("#flowapi_url").val(flowdrwhurl);
763
+		  });
764
+
765
+		  // Add group icons
766
+		  $(".srGroupImg").each(function() {
767
+		     $(this).attr("src", "/" + ctappdir + "/sms_relentless/img/group.svg");
768
+		  });
769
+
770
+		  // Add user icons
771
+		  $(".srUserImg").each(function() {
772
+		     $(this).attr("src", "/" + ctappdir + "/sms_relentless/img/user.svg");
773
+		  });
774
+
775
+		  $("#save_admin_settings").on("click", function(event) {
776
+
777
+		    event.preventDefault();
778
+		    OC.msg.startAction('#smsr_save_msg', t('sms_relentless', 'Saved'));
779
+
780
+		    var baseUrlsv = OC.generateUrl('/apps/sms_relentless/user/updateadminsettings');
781
+
782
+		    var showallmsgs = 0;
783
+		    if ($("#showallmessages").is(':checked')) {
784
+			showallmsgs = 1;
785
+		    }
786
+
787
+		    var telsenderinit = $("#tel_sender_name").val();
788
+		    var telsenderproc = telsenderinit.replace(/[^A-Za-z 0-9]/g, '');
789
+
790
+		    var nexsenderinit = $("#nex_sender_name").val();
791
+		    var nexsenderproc = nexsenderinit.replace(/[^A-Za-z 0-9]/g, '');
792
+
793
+		    var twilsenderinit = $("#twil_sender_name").val();
794
+		    var twilsenderproc = twilsenderinit.replace(/[^A-Za-z 0-9]/g, '');
795
+
796
+		    var datatosave = {
797
+				      userId: userid,
798
+				      telapiKey: $("#telapi_key").val(),
799
+				      telPubKey: $("#tel_pub_key").val(),
800
+				      telapiUrlRec: $("#telapi_url_rec").val(),
801
+				      telapiUrl: $("#telapi_url").val(),
802
+				      messagingProfileId: $("#messaging_profile_id").val(),
803
+				      nexapiKey: $("#nexapi_key").val(),
804
+				      nexapiSecret: $("#nexapi_secret").val(),
805
+				      nexapiUrlRec: $("#nexapi_url_rec").val(),
806
+				      nexapiUrl: $("#nexapi_url").val(),
807
+				      twilapiKey: $("#twilapi_key").val(),
808
+				      twilapiSecret: $("#twilapi_secret").val(),
809
+				      twilapiUrlRec: $("#twilapi_url_rec").val(),
810
+				      twilapiUrl: $("#twilapi_url").val(),
811
+				      flowapiKey: $("#flowapi_key").val(),
812
+				      flowapiSecret: $("#flowapi_secret").val(),
813
+				      flowapiUrlRec: $("#flowapi_url_rec").val(),
814
+				      flowapiUrl: $("#flowapi_url").val(),
815
+				      telSenderName: telsenderproc,
816
+				      nexSenderName: nexsenderproc,
817
+				      twilSenderName: twilsenderproc,
818
+				      showAllMessages: showallmsgs
819
+		    };
820
+
821
+
822
+		    $.ajax({
823
+		       method: 'PUT',
824
+		       url: baseUrlsv + '/' + userid,
825
+		       contentType: 'application/json',
826
+		       data: JSON.stringify(datatosave),
827
+		       success: function() {
828
+		       },
829
+		       error: function() {
830
+			    showAlert('Error while attempting to save the settings! You can check the Nextcloud log to find more details about this issue.');
831
+		       }
832
+		    });
833
+
834
+		  });
835
+
836
+		  function showAlert(alertText) {
837
+
838
+		     let alertwnd = "<div id='alertMessage'>";
839
+		     alertwnd += "<a id='closeAlertWnd' title='Close this window'></a>";
840
+		     alertwnd += "<div id='alertTextWrap'>"+ alertText +"</div>";
841
+		     alertwnd += "<input type='submit' id='alertOk' value='OK'>";
842
+		     alertwnd += "</div>";
843
+
844
+		     $("#content").append("<div id='alertMsgOverlay'></div>");
845
+		     $("#content").append(alertwnd);
846
+
847
+		     let topDist = parseInt((window.innerHeight / 2).toFixed(2) - 152) +"px";
848
+		     let leftDist = parseInt((window.innerWidth / 2).toFixed(2) - 150) +"px";
849
+		     $("#alertMessage").css({ "top" : topDist, "left" : leftDist });
850
+
851
+		     $("#closeAlertWnd").click(function() { $("#alertMsgOverlay").remove(); $("#alertMessage").remove(); });
852
+		     $("#alertMsgOverlay").click(function() { $("#alertMsgOverlay").remove(); $("#alertMessage").remove(); });
853
+		     $("#alertOk").click(function() { $("#alertMsgOverlay").remove(); $("#alertMessage").remove(); });
854
+		  }
855
+
856
+		  function confirmAlert(alertText) {
857
+
858
+		     $("#alertMsgOverlay").remove();
859
+		     $("#alertConfMessage").remove();
860
+
861
+		     let alertwndcf = "<div id='alertConfMessage'>";
862
+		     alertwndcf += "<a id='closeAlertWndcf' title='Close this window'></a>";
863
+		     alertwndcf += "<div id='alertTextWrap'>"+ alertText +"</div>";
864
+		     alertwndcf += "<div id='cancelOkWrap'><input type='submit' id='confirmCancel' value='Cancel'>";
865
+		     alertwndcf += "<input type='submit' id='confirmOk' value='OK'></div>";
866
+		     alertwndcf += "</div>";
867
+
868
+		     $("#content").append("<div id='alertMsgOverlay'></div>");
869
+		     $("#content").append(alertwndcf);
870
+
871
+		     let topDist = parseInt((window.innerHeight / 2).toFixed(2) - 152) +"px";
872
+		     let leftDist = parseInt((window.innerWidth / 2).toFixed(2) - 150) +"px";
873
+		     $("#alertConfMessage").css({ "top" : topDist, "left" : leftDist });
874
+
875
+		     $("#closeAlertWndcf").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
876
+		     $("#alertMsgOverlay").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
877
+		  }
878
+
879
+
880
+     },
881
+     error: function(appdirfdb) {
882
+                alert("An error occurred while getting the app's directory. You can check the Nextcloud log to find more details about this issue.");
883
+     }
884
+   });
885
+
886
+});
0 887
new file mode 100644
... ...
@@ -0,0 +1,7079 @@
1
+/**
2
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
3
+ *
4
+ * @author Double Bastion LLC
5
+ *
6
+ * @license GNU AGPL version 3 or any later version
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
10
+ * License as published by the Free Software Foundation; either
11
+ * version 3 of the License, or any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
17
+ *
18
+ * You should have received a copy of the GNU Affero General Public
19
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+$(document).ready(function() {
24
+
25
+  var userid = "<?php p($userId); ?>";
26
+  var parseddata = null;
27
+  var sentparseddata = null;
28
+  var groupedparsed = null;
29
+  var messagesperpage = 100;
30
+  var newMsgInterval = 5000;
31
+  var archivedConvNmbr = null;
32
+  var newMsgRcd = 0;
33
+  var intervalRfrSent = 0;
34
+  var intervalNmfr = null;
35
+  var ctappdir = 'apps';
36
+
37
+  // Get the app's directory
38
+  var getappdirurl = OC.generateUrl('/apps/sms_relentless/user/getappdirectory');
39
+
40
+  $.ajax({
41
+     method: 'GET',
42
+     url: getappdirurl + '/' + userid,
43
+     contentType: 'application/json',
44
+     success: function(appdirfdb) {
45
+                ctappdir = appdirfdb;
46
+     },
47
+     error: function() {
48
+                alert("An error occurred while getting the app's directory. You can check the Nextcloud log to find more details about this issue.");
49
+     }
50
+  });
51
+
52
+  // Get the number of messages per page and the time interval for checking for new received messages, from the database
53
+  var getNoPerPageUrl = OC.generateUrl("/apps/sms_relentless/user/getmsgsperpgnewmsgarchnb");
54
+
55
+  $.ajax({
56
+        url: getNoPerPageUrl + '/' + userid,
57
+        method: 'GET',
58
+        success: function(mesperpagedb) {
59
+
60
+                 if (mesperpagedb.msgsperpage) { messagesperpage = mesperpagedb.msgsperpage; }
61
+                 if (mesperpagedb.newmsgcheck) { newMsgInterval = mesperpagedb.newmsgcheck * 1000; }
62
+                 if (mesperpagedb.archconvnb == 0 || mesperpagedb.archconvnb) { archivedConvNmbr = mesperpagedb.archconvnb; }
63
+        },
64
+        error: function() {
65
+                 showAlert("Error while getting the number of messages per page. You can check the Nextcloud log to find more details about this issue!");
66
+        }
67
+  });
68
+
69
+  // Get the 'new received message' indicator from the database
70
+  function checkIfNewMessage() {
71
+
72
+        var getNewMsgInd = OC.generateUrl("/apps/sms_relentless/user/getnewmsgindicator");
73
+
74
+        $.ajax({
75
+              url: getNewMsgInd + '/' + userid,
76
+              method: 'GET',
77
+              success: function(newmsgdb) {
78
+                       newMsgRcd = newmsgdb;
79
+                       if (newMsgRcd == 1) { 
80
+
81
+                           if ($("#listAllMsgsFromTo").is(":visible")) { $('#smstables').empty(); setTimeout(function() { $("#refreshMsgsConvtf").click(); }, 500); }
82
+                           if ($("#listAllMsgsConv").is(":visible")) { $('#smstables').empty(); setTimeout(function() { $("#refreshMsgsConv").click(); }, 500); }
83
+                           if ($("#conversationsTable").is(":visible")) {
84
+
85
+                               var archCvId = '';
86
+                               var actCvId = '';
87
+
88
+                               $(".convsListArch").each(function() { 
89
+		                   if ($(this).css('background-color') === "rgb(241, 224, 239)") {
90
+                                       archCvId = $(this).attr("id");
91
+		                   }
92
+                               });
93
+
94
+		               $(".convsListAct").each(function() {
95
+		                   if ($(this).css('background-color') === "rgb(215, 239, 239)") {
96
+                                       actCvId = $(this).attr("id");
97
+		                   }
98
+		               });
99
+
100
+                               $('#smstables').empty();
101
+                               $("#conversationsshow").click();
102
+                               setTimeout(function() { if (actCvId != '') { document.getElementById(actCvId).click(); } else if (archCvId != '') { document.getElementById(actCvId).click(); } }, 800);
103
+
104
+                           } else {
105
+                               $('#smstables').empty();
106
+                               $("#receivedsmstableshow").click();
107
+                           }
108
+                       }
109
+              },
110
+              error: function() {
111
+                           // showAlert("Error while getting the 'new received message' indicator. You can check the Nextcloud log to find more details about this issue!");
112
+              }
113
+        });
114
+  }
115
+
116
+
117
+  // List received messages
118
+  $("#receivedsmstableshow").on("click", function(event) {
119
+
120
+     $('#smstables').empty();
121
+     clearInterval(intervalNmfr);
122
+
123
+     var getReceivedUrl = OC.generateUrl("/apps/sms_relentless/user/getreceivedtable");
124
+
125
+     $('#smstables').addClass('icon-loading');
126
+
127
+     $.ajax({
128
+          url: getReceivedUrl + '/' + userid,
129
+          method: 'GET',
130
+          contentType: 'application/json',
131
+          success: function(datafdb) {
132
+
133
+                var parseddata = datafdb.datarows;
134
+
135
+                $('#smstables').append("<div id='toptablerec'><div class='topbuttonandpage'><span id='recarrow' title='Show/Hide filters and Delete button'></span></div><div id='paginationrec' class='recpages'>Pages </div></div>");
136
+                $('#smstables').append("<table id='recSmsTable'></table>");
137
+
138
+                $('#recSmsTable').append("<tr id='recfiltersrow'><td class='selectalldvfilter'><button id='clearrecfilters' title='Clear all filters.'></button><button id='deleterecrows' title='Permanently delete the selected row(s) from below from the database.'></button></td><td class='selectalldvfilter'><input type='text' id='dbidtextrec' class='indivfilterrec' title='Enter a database ID number to apply the filter.'><input type='submit' id='databaseidfilter' class='filterbuttonsrec' value='' title='Filter rows by the specified database ID.' /></td><td class='selectalldvfilter'><input type='text' id='useridtextrec' class='indivfilterrec' title='Enter a Nextcloud username to apply the filter.' /><input type='submit' id='useridfilter' class='filterbuttonsrec' value='' title='Filter rows by the specified username.' /></td><td class='selectalldvfilter'><input type='text' id='messageidtextrec' class='indivfilterrec' title='Enter a fragment from a message ID to apply the filter.'  /><input type='submit' id='messageidfilter' class='filterbuttonsrec' value='' title='Filter rows by the specified string.' /></td><td class='selectalldvfilter'><input type='text' id='datetextrec' class='indivfilterrec' title='Enter a fragment of a date to apply the filter.'/><input type='submit' id='datefilter' class='filterbuttonsrec' value='' title='Filter rows by the specified string.' /></td><td class='selectalldvfilter'><input type='text' id='fromtextrec' class='indivfilterrec' title='Enter a fragment of a sender&#146s phone number or alphanumeric sender ID, to apply the filter.' /><input type='submit' id='fromfilter' class='filterbuttonsrec' value='' title='Filter rows by the specified string.' /></td><td class='selectalldvfilter'><input type='text' id='totextrec' class='indivfilterrec' value='' title='Enter a fragment of a recipient&#146s phone number to apply the filter.'  /><input type='submit' id='tofilter' class='filterbuttonsrec' value='' title='Filter rows by the specified string.' /></td><td class='selectalldvfilter'><input type='text' id='messagetextrec' class='indivfilterrec' title='Enter a fragment of a message to apply the filter.' /><input type='submit' id='messagefilter' class='filterbuttonsrec' value='' title='Filter rows by the specified string.'/></td></tr>");
139
+                $('#recSmsTable').append("<tr class='receivedrows' id='recheaderrow'><th id='selectalldv' class='selectsmsdv'><input type='checkbox' id='selectAllChckbx' class ='indivchckbx' title='Select all rows from all pages.' /></th><th title='The database ID of each message.'>ID</th><th>User ID</th><th>Message ID</th><th>Date</th><th>From</th><th>To</th><th>Received Message</th></tr>");
140
+
141
+                $('#recfiltersrow').hide();
142
+
143
+                if (datafdb.showdispnm == 1) {
144
+
145
+                    for (var i = 0; i < parseddata.length; i++) {
146
+
147
+                         if (parseddata[i].author_displayname) {
148
+                             var procrcmessage = "<span class='messageAuthorName'>"+ parseddata[i].author_displayname + ":</span>" + parseddata[i].message +"<div id='showMsgConv-"+ i +"' class='lstMsgConv'><img class='lstMsgConvImg' src='/" + ctappdir + "/sms_relentless/img/reply.svg' title='Show all the messages exchanged between the current 2 phone numbers.'></div>";
149
+                         } else {
150
+                             var procrcmessage = parseddata[i].message +"<div id='showMsgConv-"+ i +"' class='lstMsgConv'><img class='lstMsgConvImg' src='/" + ctappdir + "/sms_relentless/img/reply.svg' title='Show all the messages exchanged between the current 2 phone numbers.'></div>";
151
+                         }
152
+
153
+                         if (parseddata[i].internal_sender == 0) {
154
+                             var procrecFrom = "<div id='frmNmbr-"+ i +"'><div id='addDispName-"+ i +"' style='display:block;margin-right:5px;'><img class='addNameToPhNb' src='/" + ctappdir + "/sms_relentless/img/user-grey.svg' title='Associate a Display Name with this phone number'></div>"+ parseddata[i].from +"<div id='showMsgFrom-"+ i +"' class='listToFromMsgs'><img class='lstMsgToFromImg' src='/" + ctappdir + "/sms_relentless/img/list.svg' title='Show all the messages sent/received to/from this phone number, that I am allowed to see.'></div></div>";
155
+                         } else {
156
+                             var procrecFrom = "<div id='frmNmbr-"+ i +"'>"+ parseddata[i].from +"<div id='showMsgFrom-"+ i +"' class='listToFromMsgs'><img class='lstMsgToFromImg' src = '/" + ctappdir + "/sms_relentless/img/list.svg' title='Show all the messages sent/received to/from this phone number, that I am allowed to see.'></div></div>";
157
+                         }
158
+
159
+                         var procrecTo = "<div id='toNmbr-"+ i +"'>"+ parseddata[i].to +"<div id='showMsgTo-"+ i +"' class='listToFromMsgs'><img class='lstMsgToFromImg' src = '/" + ctappdir + "/sms_relentless/img/list.svg' title='Show all the messages sent/received to/from this phone number, that I am allowed to see.'></div></div>";
160
+
161
+                         $("#recSmsTable").append("<tr id='singlerow_"+ i +"' class='receivedrowsbody'><td class='selectsmsdv'><input type='checkbox' id='selectspec_"+ i +"' class='indivchckbx' /></td><td class='dbidcolumnrec'>"+ parseddata[i].id +"</td><td class='useridcolrec'>"+ parseddata[i].user_id +"</td><td class='messageidcolrec'>"+ parseddata[i].message_id +"</td><td class='datecolrec'>"+ parseddata[i].date +"</td><td class='fromcolumnrec'>"+ procrecFrom +"</td><td class='tocolrec'>"+ procrecTo +"</td><td class='messagecolumnrec'>"+ procrcmessage +"</td></tr>");
162
+                    }
163
+
164
+                } else {
165
+
166
+                    for (var i = 0; i < parseddata.length; i++) {
167
+
168
+                         var procrcmessage = parseddata[i].message +"<div id='showMsgConv-"+ i +"' class='lstMsgConv'><img class='lstMsgConvImg' src='/" + ctappdir + "/sms_relentless/img/reply.svg' title='Show all the messages exchanged between the current 2 phone numbers.'></div>";
169
+
170
+                         if (parseddata[i].internal_sender == 0) {
171
+                             var procrecFrom = "<div id='frmNmbr-"+ i +"'><div id='addDispName-"+ i +"' style='display:block;margin-right:5px;'><img class='addNameToPhNb' src='/" + ctappdir + "/sms_relentless/img/user-grey.svg' title='Associate a Display Name with this phone number'></div>"+ parseddata[i].from +"<div id='showMsgFrom-"+ i +"' class='listToFromMsgs'><img class='lstMsgToFromImg' src='/" + ctappdir + "/sms_relentless/img/list.svg' title='Show all the messages sent/received to/from this phone number, that I am allowed to see.'></div></div>";
172
+                         } else {
173
+                             var procrecFrom = "<div id='frmNmbr-"+ i +"'>"+ parseddata[i].from +"<div id='showMsgFrom-"+ i +"' class='listToFromMsgs'><img class='lstMsgToFromImg' src = '/" + ctappdir + "/sms_relentless/img/list.svg' title='Show all the messages sent/received to/from this phone number, that I am allowed to see.'></div></div>";
174
+                         }
175
+
176
+                         var procrecTo = "<div id='toNmbr-"+ i +"'>"+ parseddata[i].to +"<div id='showMsgTo-"+ i +"' class='listToFromMsgs'><img class='lstMsgToFromImg' src = '/" + ctappdir + "/sms_relentless/img/list.svg' title='Show all the messages sent/received to/from this phone number, that I am allowed to see.'></div></div>";
177
+
178
+                         $("#recSmsTable").append("<tr id='singlerow_"+ i +"' class='receivedrowsbody'><td class='selectsmsdv'><input type='checkbox' id='selectspec_"+ i +"' class='indivchckbx' /></td><td class='dbidcolumnrec'>"+ parseddata[i].id +"</td><td class='useridcolrec'>"+ parseddata[i].user_id +"</td><td class='messageidcolrec'>"+ parseddata[i].message_id +"</td><td class='datecolrec'>"+ parseddata[i].date +"</td><td class='fromcolumnrec'>"+ procrecFrom +"</td><td class='tocolrec'>"+ procrecTo +"</td><td class='messagecolumnrec'>"+ procrcmessage +"</td></tr>");
179
+                    }
180
+                }
181
+
182
+                $('#smstables').append("<div id='totalrecmessages'>Total displayed messages: " + parseddata.length + "</div>");
183
+
184
+                $('#smstables').removeClass('icon-loading');
185
+                $('#recarrow').removeClass('arrowUpCl');
186
+                $('#recarrow').addClass('arrowDownCl');
187
+
188
+                // Show the pop-up window that lists all the messages exchanged between the current 2 phone numbers
189
+                function showRecMsgPerConv(phNumberFrom, phNumberTo) {
190
+
191
+                   let allfrmtomsg = "<div id='listAllMsgsConv'>";
192
+                   allfrmtomsg += "<div id='draglstMsgmWindow'><img src='/" + ctappdir + "/sms_relentless/img/dots.svg' style='cursor:grab'></div>";
193
+                   allfrmtomsg += "<a id='closeFrmMsgWindow' title='Close this window'></a>";
194
+                   allfrmtomsg += "<div class='showByNmbrTitle'>Messages exchanged between <span style='color:#04957b'>"+ phNumberFrom +"</span> and <span style='color:#04957b'>"+ phNumberTo +"</span></div>";
195
+                   allfrmtomsg += "<div id='frmMsgLstWrap'>";
196
+                   allfrmtomsg += "<table id='frmMsgLstTbl'>";
197
+                   allfrmtomsg += "<tr class='groupedrowsbody'><td><div id='grpdbynamelst' class='groupedLstNamespn'></div></td><td><div id='loadMoreMsgs' title='Click to load older messages.'>Load more messages</div><div id='loadMoreMsgsusr' title='Click to load older messages.'>Load more messages</div><div id='msgListRowCell' class='groupedLstMsgspn'></div><div id='refreshMsgsWrap'><div id='refreshMsgsConv' title='Refresh list of messages'></div></div><div id='arrowupWrap'><div id='upArrowSmall' title='Scroll to the top'></div></div></td></tr>";
198
+                   allfrmtomsg += "</table></div>";
199
+                   allfrmtomsg += "<div id='sendMsgReply'><table id='sendMsgConv'><tr><td><div id='fromPhoneNmbrConv'>From: <select id='selectFromNbConv'></select></div><div id='toPhoneNmbrConv'>To: <span id='toNmbrConv' style='color:#04957b'>"+ phNumberFrom +"</span></div></td></tr>";
200
+                   allfrmtomsg += "<tr><td><textarea id='sendMsgConvText' placeholder='Enter a message here, then press Send SMS.'></textarea></td></tr></table>";
201
+                   allfrmtomsg += "<div id='sendMsgConvBtn'>Send SMS</div></div>";
202
+                   allfrmtomsg += "<div id='expandWindowRplCtn' title='Expand to send a reply'><img id='expandWindowRpl' src='/" + ctappdir + "/sms_relentless/img/arrowDown.svg'></div>";
203
+                   allfrmtomsg += "<div id='draglstMsgmWindowsc'><img src='/" + ctappdir + "/sms_relentless/img/dots.svg' style='padding:4px;vertical-align:top;cursor:grab;'></div>";
204
+                   allfrmtomsg += "</div>";
205
+
206
+                   $("#content").append("<div id='recTblOverlay'></div>");
207
+                   $("#content").append(allfrmtomsg);
208
+
209
+                   let topDist = parseInt((window.innerHeight / 2).toFixed(2) - 340) +"px";
210
+                   let leftDist = parseInt((window.innerWidth / 2).toFixed(2) - 300) +"px";
211
+                   $("#listAllMsgsConv").css({ "top" : topDist, "left" : leftDist });
212
+
213
+                   $("#closeFrmMsgWindow").click(function() { $("#listAllMsgsConv").remove(); $("#recTblOverlay").remove(); });
214
+                   $("#recTblOverlay").click(function() { $("#listAllMsgsConv").remove(); $("#recTblOverlay").remove(); });
215
+
216
+
217
+	           // Expand the window when clicking on the arrow, to be able to send a reply message
218
+                   $("#expandWindowRpl").unbind("click");
219
+	           $("#expandWindowRpl").click(function() {
220
+
221
+	              if ($(this).attr('src') == '/' + ctappdir + '/sms_relentless/img/arrowDown.svg') {
222
+                          $("#sendMsgReply").css("display", "block");
223
+                          if ($(window).width() > 600) {
224
+                              $("#listAllMsgsConv").css("height", "618px");
225
+                          } else {
226
+                              $("#listAllMsgsConv").css("height", parseInt($(window).height() - 32) + "px");
227
+                              $("#frmMsgLstWrap").css("height", parseInt($(window).height() - 304) + "px");
228
+                          }
229
+	                  $(this).attr('src', '/' + ctappdir + '/sms_relentless/img/arrowUp.svg');
230
+                          $(this).attr('title', 'Collapse');
231
+
232
+	              } else {
233
+
234
+                          $("#sendMsgReply").css("display", "none");
235
+                          if ($(window).width() > 600) {
236
+                              $("#listAllMsgsConv").css("height", "490px");
237
+                          } else {
238
+                              $("#listAllMsgsConv").css("height", parseInt($(window).height() - 120) + "px");
239
+                              $("#frmMsgLstWrap").css("height", parseInt($(window).height() - 232) + "px");
240
+                          }
241
+                          $(this).attr('src', '/' + ctappdir + '/sms_relentless/img/arrowDown.svg');
242
+                          $(this).attr('title', 'Expand to send a reply');
243
+	              }
244
+	           });
245
+
246
+
247
+                   // Send a message from the 'conversation' window
248
+                   $("#sendMsgConvBtn").click(function() {
249
+
250
+                      $("#sendMsgConv,#sendMsgConvBtn").addClass('icon-loading');
251
+                      var msgToSend = $("#sendMsgConvText").val();
252
+                      var selectedid = $("#selectFromNbConv").val();
253
+                      var toNumber = $("#toNmbrConv").text();
254
+                      var receiversNumbers = [toNumber];
255
+
256
+		      if (selectedid != '') { 
257
+
258
+			  var sendersplit = selectedid.split(":");
259
+			  var providercap = sendersplit[0];
260
+			  var provsec = sendersplit[1];
261
+
262
+			  if (/[a-zA-Z]/.test(provsec)) {
263
+			      var alphanumcheck = true;
264
+			  } else { var alphanumcheck = false; }
265
+
266
+			  if (providercap == 'Tx' && alphanumcheck == false) {  
267
+			      var senderproc = selectedid.replace(/[^0-9]/g, "");
268
+			      var selectedsender = "+" + senderproc;
269
+			      var providerUsed = "telnyx";
270
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstel");
271
+			  } else if (providercap == 'Pl' && alphanumcheck == false) {
272
+			      var selectedsender = selectedid.replace(/[^0-9]/g, "");
273
+			      var providerUsed = "plivo";
274
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsnex");
275
+			  } else if (providercap == 'Tw' && alphanumcheck == false) {  
276
+			      var senderproc = selectedid.replace(/[^0-9]/g, "");
277
+			      var selectedsender = "+" + senderproc;
278
+			      var providerUsed = "twilio";
279
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstwil");
280
+			  } else if (providercap == 'Fl' && alphanumcheck == false) {  
281
+			      var senderproc = selectedid.replace(/[^0-9]/g, "");
282
+			      var selectedsender = "+" + senderproc;
283
+			      var providerUsed = "flowroute";
284
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsflow");
285
+			  } else if (providercap == 'Tx' && alphanumcheck == true) {
286
+			      var selectedsender = provsec;
287
+			      var providerUsed = "telnyx";
288
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstel");
289
+			  } else if (providercap == 'Pl' && alphanumcheck == true) {
290
+			      var selectedsender = provsec;
291
+			      var providerUsed = "plivo";
292
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsnex");
293
+			  } else if (providercap == 'Tw' && alphanumcheck == true) {
294
+			      var selectedsender = provsec;
295
+			      var providerUsed = "twilio";
296
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstwil");
297
+			  } else if (providercap == 'Fl' && alphanumcheck == true) {
298
+			      var selectedsender = provsec;
299
+			      var providerUsed = "flowroute";
300
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsflow");
301
+			  }
302
+
303
+                          var uploadedtomms = [];
304
+
305
+	                  if (msgToSend != '') {
306
+
307
+				  $.ajax({
308
+				     url: relbaseUrl + '/' + userid,
309
+				     type: "POST",
310
+				     data: {
311
+				           receiversPhoneNbs: receiversNumbers,
312
+				           fromsender: selectedsender,
313
+				           waitinterval: 1000,
314
+				           sentsmstext: msgToSend,
315
+				           ismms: 0,
316
+				           mmsfiles: uploadedtomms
317
+				         },
318
+				     success: function(displayname) {
319
+
320
+                                           var tzdate = new Date();
321
+                                           var presDatest = new Date(tzdate.getTime() - (tzdate.getTimezoneOffset() * 60000)).toJSON();
322
+                                           var presDatedb = presDatest.split(".")[0];
323
+                                           var presDatesc = presDatedb.split("T");
324
+                                           var presDate = presDatesc[0] +" "+ presDatesc[1];
325
+                                           var sentMessageStatus = '';
326
+
327
+                                           if (displayname) {
328
+                                               var msgToSendproc = "<span class='msgAuthorNameGrp'>"+ displayname + ":</span>" + msgToSend; 
329
+                                           } else { var msgToSendproc = msgToSend; }
330
+
331
+                                           $("#msgListRowCell").append("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ selectedsender +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ receiversNumbers[0] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ msgToSendproc +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ presDate +"</div><div class='sentMssgStatus'>"+ sentMessageStatus +"</div></div>");
332
+
333
+                                           // Scroll down to the bottom of the window
334
+                                           $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
335
+
336
+                                           $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
337
+				     },
338
+				     error: function() {
339
+                                           showAlert("Error while sending the message. You can check your Nextcloud log to find out more about this issue.");
340
+				           $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
341
+				     }
342
+				  });
343
+			  } else {
344
+                                  showAlert("Please enter a message in the text box!");
345
+				  $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
346
+			  }
347
+		      } else {
348
+                              showAlert("Please choose a Sender ID from the 'From' drop-down list!");
349
+			      $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
350
+		      }
351
+                   });
352
+
353
+
354
+	           // Make the window draggable
355
+	           function makeMgrWndDraggable(e) {
356
+
357
+			   window.pmdragging = {};
358
+			   pmdragging.pageX0 = e.pageX;
359
+			   pmdragging.pageY0 = e.pageY;
360
+			   pmdragging.elem = $("#listAllMsgsConv");
361
+			   pmdragging.offset0 = $("#listAllMsgsConv").offset();
362
+
363
+			   function handle_dragging(e) {
364
+			       let left = pmdragging.offset0.left + (e.pageX - pmdragging.pageX0);
365
+			       let top = pmdragging.offset0.top + (e.pageY - pmdragging.pageY0);
366
+			       $(pmdragging.elem).offset({top: top, left: left});
367
+			   }
368
+
369
+			   function handle_mouseup(e) {
370
+			       $('body').off('mousemove', handle_dragging).off('mouseup', handle_mouseup);
371
+			   }
372
+
373
+			   $('body').on('mouseup', handle_mouseup).on('mousemove', handle_dragging);
374
+	           }
375
+	           $("#draglstMsgmWindow").mousedown(makeMgrWndDraggable);
376
+	           $("#draglstMsgmWindowsc").mousedown(makeMgrWndDraggable);
377
+
378
+
379
+                   // Append the available phone numbers to the From drop-down list
380
+                   var availPhoneNmbrs = [];
381
+                   $("#currentsmsnmbrs .optselectsmsnb").each(function() {
382
+                      var crtphnmbr = $(this).attr("value");
383
+                      if (crtphnmbr != "") { availPhoneNmbrs.push(crtphnmbr); }
384
+                   });
385
+
386
+                   if (availPhoneNmbrs.length > 0) {
387
+                       var avphopt = "";
388
+                       for (let d = 0; d < availPhoneNmbrs.length; d++) {
389
+                            if (availPhoneNmbrs[d].indexOf(phNumberTo) === -1) {
390
+                                avphopt += "<option value='"+ availPhoneNmbrs[d] +"'>"+ availPhoneNmbrs[d] +"</option>";
391
+                            } else {
392
+                                avphopt += "<option value='"+ availPhoneNmbrs[d] +"' selected>"+ availPhoneNmbrs[d] +"</option>";
393
+                            }
394
+                       }
395
+                       $("#selectFromNbConv").append(avphopt);
396
+
397
+                   } else { $("#selectFromNbConv").append("<option value='' selected>No IDs</option>"); }
398
+
399
+
400
+                   // Get the messages exchanged between the current 2 phone numbers, from the database
401
+                   function getMsgsForNumbers(phNumberFrom, phNumberTo) {
402
+
403
+			   let getGrpConvUrl = OC.generateUrl("/apps/sms_relentless/user/getgroupedforreply");
404
+
405
+			   $('#listAllMsgsConv').addClass('icon-loading');
406
+
407
+			   let totalPhNmbrs = 0;
408
+
409
+			   $.ajax({
410
+				  method: 'POST',
411
+				  url: getGrpConvUrl + '/' + userid,
412
+				  contentType: 'application/json',
413
+		                  data: JSON.stringify({ "phoneNmbrFrom": phNumberFrom, "phoneNmbrTo": phNumberTo }),
414
+				  success: function(groupedperconv) {
415
+
416
+					     $('#listAllMsgsConv').removeClass('icon-loading');
417
+
418
+					     let fromtoNmbrsData = [];
419
+
420
+					     for (let i = 0; i < groupedperconv.length; i++) {
421
+
422
+						     if (groupedperconv[i].author_displayname) {
423
+							 var authordnm = groupedperconv[i].author_displayname;
424
+						     } else { 
425
+							 var authordnm = '';
426
+						     }
427
+
428
+						     var sentfromnmbrarr = groupedperconv[i].from.split(": ");
429
+						     if (sentfromnmbrarr[1]) {
430
+					                 var groupednbfrom = sentfromnmbrarr[1];
431
+                                                     } else {
432
+					                 var groupednbfrom = sentfromnmbrarr[0];
433
+                                                     }
434
+
435
+						     var modmessagerec = '';
436
+						     if (groupedperconv[i].author_displayname) {
437
+							 modmessagerec = "<span class='msgAuthorNameGrp'>"+ groupedperconv[i].author_displayname + ":</span>" + groupedperconv[i].message;
438
+						     } else {
439
+					                 modmessagerec = groupedperconv[i].message;
440
+		                                     }
441
+
442
+						     if (groupedperconv[i].to.indexOf(": ") > -1) {
443
+						         var groupednmbrtopre = groupedperconv[i].to.split(": ");
444
+						         var groupednmbrto = groupednmbrtopre[1];
445
+						     } else { 
446
+						         var groupednmbrto = groupedperconv[i].to;
447
+						     }
448
+
449
+						     fromtoNmbrsData.push({
450
+						               'author_displayname': authordnm,
451
+						               'from': groupednbfrom,
452
+						               'to': groupednmbrto,
453
+						               'message': modmessagerec,
454
+						               'date': groupedperconv[i].date,
455
+						               'status': groupedperconv[i].deliveryreceipt,
456
+						               'table': groupedperconv[i].table
457
+						     });
458
+					     }
459
+
460
+
461
+					     // Remove the duplicates
462
+					     let noDupMsgData = [];
463
+					     $.each(fromtoNmbrsData, function(i, e) {
464
+						    let matchingData = $.grep(noDupMsgData, function(item) {
465
+						            return item.from == e.from && item.to == e.to && item.message == e.message && item.table == 'received' && e.table == 'sent';
466
+						    });
467
+						    if (matchingData.length === 0) {
468
+							noDupMsgData.push(e);
469
+						    }
470
+					     });
471
+
472
+					     let messagesPerNmbr = {};
473
+					     let msgsNamesPerNmbr = {};
474
+					     let msgsNmbrsNames = {};
475
+
476
+					     let displayNamesarr = [];
477
+					     let convData = [];
478
+
479
+					     for (let n = 0; n < noDupMsgData.length; n++) {
480
+
481
+					          if (noDupMsgData[n]['from'] == phNumberFrom && noDupMsgData[n]['table'] == 'sent') {
482
+
483
+					              convData.push({
484
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
485
+					                             'message': noDupMsgData[n]['message'],
486
+					                             'from': noDupMsgData[n]['from'],
487
+					                             'to': noDupMsgData[n]['to'],
488
+					                             'date': noDupMsgData[n]['date'],
489
+					                             'direction': 'sent_from',
490
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
491
+					                             'table': noDupMsgData[n]['table']
492
+					              });
493
+
494
+					          } else if (noDupMsgData[n]['to'] == phNumberFrom && noDupMsgData[n]['table'] == 'sent') {
495
+
496
+					              convData.push({
497
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
498
+					                             'message': noDupMsgData[n]['message'],
499
+					                             'from': noDupMsgData[n]['from'],
500
+					                             'to': noDupMsgData[n]['to'],
501
+					                             'date': noDupMsgData[n]['date'],
502
+					                             'direction': 'sent_to',
503
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
504
+					                             'table': noDupMsgData[n]['table']
505
+					              });
506
+
507
+
508
+					          } else if (noDupMsgData[n]['from'] == phNumberFrom && noDupMsgData[n]['table'] == 'received') {
509
+
510
+					              convData.push({
511
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
512
+					                             'message': noDupMsgData[n]['message'],
513
+					                             'from': noDupMsgData[n]['from'],
514
+					                             'to': noDupMsgData[n]['to'],
515
+					                             'date': noDupMsgData[n]['date'],
516
+					                             'direction': 'received_from',
517
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
518
+					                             'table': noDupMsgData[n]['table']
519
+					              });
520
+
521
+					          } else if (noDupMsgData[n]['to'] == phNumberFrom && noDupMsgData[n]['table'] == 'received') {
522
+
523
+					              convData.push({
524
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
525
+					                             'message': noDupMsgData[n]['message'],
526
+					                             'from': noDupMsgData[n]['from'],
527
+					                             'to': noDupMsgData[n]['to'],
528
+					                             'date': noDupMsgData[n]['date'],
529
+					                             'direction': 'received_on',
530
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
531
+					                             'table': noDupMsgData[n]['table']
532
+					              });
533
+					          }
534
+					     }
535
+
536
+					     // Sort messages by date
537
+					     convData.sort(function(a, b) {
538
+                                                return new Date(b.date) - new Date(a.date);
539
+					     });
540
+
541
+					     // Collect the display names of the users that sent messages from the current numbers
542
+					     let selectedNames = [];
543
+					     let displayNames = '';
544
+					     for (let v = 0; v < convData.length; v++) {
545
+					          if (selectedNames.indexOf(convData[v]['author_displayname']) == -1) { 
546
+					              selectedNames.push(convData[v]['author_displayname']);
547
+					              displayNames += "<div id='diplNm_"+ phNumberFrom +"_"+ v +"' class='dispNameList' name='"+ convData[v]['author_displayname'] +"'>"+ convData[v]['author_displayname'] +"</div>";
548
+					          }
549
+					     }
550
+					     displayNames += "<div id='diplNmAllMsgcv' class='dispNameListAll' title='Show all the messages exchanged between the current 2 phone numbers.'>All messages</div>";
551
+
552
+					     // Store the display names for the current numbers, to be able to see them later
553
+					     let ctPhNumber = phNumberFrom;
554
+					     msgsNamesPerNmbr[ctPhNumber] = displayNames;
555
+
556
+					     // Store the messages sent by each user, to be able to see them later when clicking on the user's name
557
+					     for (let h = 0; h < selectedNames.length; h++) {
558
+
559
+					          let rowMessageArrpn = [];
560
+
561
+					          for (let b = 0; b < convData.length; b++) {
562
+
563
+					               if (selectedNames[h] == convData[b]['author_displayname']) {
564
+
565
+							   if (convData[b]['direction'] == 'sent_from') {
566
+                                                               if (convData[b]['status']) {
567
+							           if (convData[b]['status'].indexOf("delivered") > -1 || convData[b]['status'].indexOf("delivery success") > -1 || convData[b]['status'].indexOf("Retrieved") > -1) {
568
+					                               if (convData[b]['status'].indexOf("undelivered") > -1) {
569
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
570
+                                                                       } else {
571
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
572
+                                                                       }
573
+							           } else {
574
+							               var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
575
+							           }
576
+							       } else {
577
+							           var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
578
+                                                               }
579
+							       rowMessageArrpn.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
580
+							   } else if (convData[b]['direction'] == 'sent_to') {
581
+                                                               if (convData[b]['status']) {
582
+							           if (convData[b]['status'].indexOf("delivered") > -1 || convData[b]['status'].indexOf("delivery success") > -1 || convData[b]['status'].indexOf("Retrieved") > -1) {
583
+					                               if (convData[b]['status'].indexOf("undelivered") > -1) {
584
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
585
+                                                                       } else {
586
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
587
+                                                                       }
588
+							           } else {
589
+							               var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
590
+							           }
591
+                                                               } else {
592
+                                                                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
593
+                                                               }
594
+							       rowMessageArrpn.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
595
+							   } else if (convData[b]['direction'] == 'received_from') {
596
+							       rowMessageArrpn.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div></div>");
597
+							   } else if (convData[b]['direction'] == 'received_on') {
598
+							       rowMessageArrpn.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div></div>");
599
+					                   }
600
+					               }
601
+					          }
602
+					          let crtNmber = phNumberFrom;
603
+					          let crtName = selectedNames[h];
604
+					          msgsNmbrsNames[crtNmber] = msgsNmbrsNames[crtNmber] || {};
605
+		                                  msgsNmbrsNames[crtNmber][crtName] = rowMessageArrpn;
606
+					     }
607
+
608
+		                             // The number of messages to be loaded by default
609
+		                             let nmbTblDefault = 50;
610
+
611
+		                             // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
612
+		                             if (convData.length > nmbTblDefault) {
613
+		                                 $("#loadMoreMsgs").css("display", "block");
614
+		                                 var nmbToBeLoaded = nmbTblDefault;
615
+		                             } else { var nmbToBeLoaded = convData.length; }
616
+
617
+					     let rowMessageArr = [];
618
+
619
+					     for (var m = nmbToBeLoaded - 1; m >= 0; m--) {
620
+
621
+					          if (convData[m]['direction'] == 'sent_from') {
622
+					              if (convData[m]['status']) {
623
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
624
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
625
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
626
+                                                              } else {
627
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
628
+                                                              }
629
+						          } else {
630
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
631
+						          }
632
+					              } else {
633
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
634
+					              }
635
+					              rowMessageArr.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
636
+
637
+					          } else if (convData[m]['direction'] == 'sent_to') {
638
+                                                      if (convData[m]['status']) {
639
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
640
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
641
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
642
+                                                              } else {
643
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
644
+                                                              }
645
+						          } else {
646
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
647
+						          }
648
+					              } else {
649
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
650
+					              }
651
+					              rowMessageArr.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
652
+
653
+					          } else if (convData[m]['direction'] == 'received_from') {
654
+
655
+						      rowMessageArr.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
656
+
657
+					          } else if (convData[m]['direction'] == 'received_on') {
658
+
659
+						      rowMessageArr.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
660
+					          }
661
+					     }
662
+
663
+					     let convDataPerNmbr = rowMessageArr.join("");
664
+		                             $("#grpdbynamelst").empty();
665
+		                             $("#grpdbynamelst").append(displayNames);
666
+		                             $("#msgListRowCell").empty();
667
+		                             $("#msgListRowCell").append(convDataPerNmbr);
668
+
669
+					     // Store the messages for the current From number, to be able to see them later
670
+					     let rowMessageArrcpt = [];
671
+					     for (let m = 0; m < convData.length; m++) {
672
+
673
+					          if (convData[m]['direction'] == 'sent_from') {
674
+					              if (convData[m]['status']) {
675
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
676
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
677
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
678
+                                                              } else {
679
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
680
+                                                              }
681
+						          } else {
682
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
683
+						          }
684
+					              } else {
685
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
686
+					              }
687
+					              rowMessageArrcpt.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
688
+
689
+					          } else if (convData[m]['direction'] == 'sent_to') {
690
+					              if (convData[m]['status']) {
691
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
692
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
693
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
694
+                                                              } else {
695
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
696
+                                                              }
697
+						          } else {
698
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
699
+						          }
700
+					              } else {
701
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
702
+					              }
703
+					              rowMessageArrcpt.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
704
+
705
+					          } else if (convData[m]['direction'] == 'received_from') {
706
+
707
+						      rowMessageArrcpt.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
708
+
709
+					          } else if (convData[m]['direction'] == 'received_on') {
710
+
711
+						      rowMessageArrcpt.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
712
+					          }
713
+					     }
714
+
715
+					     messagesPerNmbr[phNumberFrom] = rowMessageArrcpt;
716
+
717
+		                             // Scroll down to the bottom of the window
718
+	                                     $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
719
+
720
+		                             // Load more messages
721
+		                             let clickNmb = 0;
722
+		                             $("#loadMoreMsgs").click(function() {
723
+
724
+		                                 clickNmb++;
725
+
726
+		                                 var crefnb = (clickNmb + 1) * nmbToBeLoaded;
727
+
728
+		                                 if (crefnb > convData.length) {
729
+		                                     var nmbmsg = convData.length - 1;
730
+		                                     $("#loadMoreMsgs").css("display", "none");
731
+		                                 } else { 
732
+		                                     var nmbmsg = crefnb - 1;
733
+		                                 }
734
+
735
+		                                 let rowMessageArrAdd = [];
736
+
737
+		                                 for (let m = nmbmsg; m >= clickNmb * nmbToBeLoaded; m--) {
738
+
739
+					              if (convData[m]['direction'] == 'sent_from') {
740
+					                  if (convData[m]['status']) {
741
+						              if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
742
+				                                  if (convData[m]['status'].indexOf("undelivered") > -1) {
743
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
744
+                                                                  } else {
745
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
746
+                                                                  }
747
+						              } else {
748
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
749
+						              }
750
+					                  } else {
751
+					                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
752
+					                  }    
753
+					                  rowMessageArrAdd.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
754
+
755
+					              } else if (convData[m]['direction'] == 'sent_to') {
756
+					                  if (convData[m]['status']) {
757
+						              if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
758
+				                                  if (convData[m]['status'].indexOf("undelivered") > -1) {
759
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
760
+                                                                  } else {
761
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
762
+                                                                  }
763
+						              } else {
764
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
765
+						              }
766
+					                  } else {
767
+					                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
768
+					                  }
769
+					                  rowMessageArrAdd.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
770
+
771
+					              } else if (convData[m]['direction'] == 'received_from') {
772
+
773
+							  rowMessageArrAdd.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
774
+
775
+					              } else if (convData[m]['direction'] == 'received_on') {
776
+
777
+							  rowMessageArrAdd.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
778
+					              }
779
+		                                 }
780
+
781
+					         let convDataPerNmbrad = rowMessageArrAdd.join("");
782
+
783
+		                                 let scrlheight = $("#msgListRowCell").height();
784
+		                                 $("#msgListRowCell").prepend(convDataPerNmbrad);
785
+
786
+		                                 $("#frmMsgLstWrap").animate({scrollTop: $("#msgListRowCell").height() - scrlheight}, 0);
787
+
788
+		                             });
789
+
790
+
791
+					     // Show the messages sent by each user whose name is clicked
792
+					     $('[id*="diplNm_"]').click(function() {
793
+
794
+					         let crntNmbr = $(this).attr("id").split("_")[1];
795
+					         let crntDisName = $(this).attr("name");                               
796
+		                                 $("#loadMoreMsgs").css("display", "none");
797
+
798
+		                                 let convDataprn = [];
799
+		                                 $.each(msgsNmbrsNames[crntNmbr][crntDisName], function(index, item) {
800
+		                                        convDataprn.push(item);
801
+		                                 });
802
+
803
+		                                 // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
804
+		                                 if (convDataprn.length > nmbTblDefault) {
805
+		                                     $("#loadMoreMsgsusr").css("display", "block");
806
+		                                     let nmbToBeLoaded = nmbTblDefault;
807
+		                                 } else {
808
+		                                     $("#loadMoreMsgsusr").css("display", "none");
809
+		                                     let nmbToBeLoaded = convDataprn.length;
810
+		                                 }
811
+
812
+					         let rowMessageArrprnst = [];
813
+
814
+					         for (let n = nmbToBeLoaded - 1; n >= 0; n--) {
815
+		                                      rowMessageArrprnst.push(convDataprn[n]);
816
+					         }
817
+
818
+					         let convDataPerNmbrprnst = rowMessageArrprnst.join("");
819
+
820
+		                                 $("#msgListRowCell").empty();
821
+		                                 $("#msgListRowCell").append(convDataPerNmbrprnst);
822
+
823
+		                                 // Scroll down to the bottom of the window
824
+		                                 $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
825
+
826
+		                                 // Load more messages
827
+		                                 let clckNb = 0;
828
+		                                 $("#loadMoreMsgsusr").unbind("click");
829
+		                                 $("#loadMoreMsgsusr").click(function() {
830
+
831
+		                                     clckNb++;
832
+		                                     var crefnb = (clckNb + 1) * nmbToBeLoaded;
833
+
834
+		                                     $("#loadMoreMsgs").css("display", "none");
835
+
836
+		                                     if (crefnb > convDataprn.length) {
837
+		                                         var nmbmsg = convDataprn.length - 1;
838
+		                                         $("#loadMoreMsgsusr").css("display", "none");
839
+		                                     } else { 
840
+		                                         var nmbmsg = crefnb - 1;
841
+		                                         $("#loadMoreMsgsusr").css("display", "block");
842
+		                                     }
843
+
844
+		                                     var rowMessageArrAddst = [];
845
+
846
+		                                     for (var q = nmbmsg; q >= clckNb * nmbToBeLoaded; q--) {
847
+
848
+		                                          rowMessageArrAddst.push(convDataprn[q]);
849
+		                                     }
850
+
851
+					             var convDataPerNmbradst = rowMessageArrAddst.join("");
852
+
853
+		                                     var scrlheight = $("#msgListRowCell").height();
854
+		                                     $("#msgListRowCell").prepend(convDataPerNmbradst);
855
+
856
+		                                     $("#frmMsgLstWrap").animate({scrollTop: $("#msgListRowCell").height() - scrlheight}, 0);
857
+		                                 });
858
+
859
+
860
+					         $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
861
+					         $("#diplNmAllMsgcv").css("color", "#04957b");
862
+					         $(this).css("color", "#1b8efe");
863
+					     });
864
+
865
+
866
+					     // Show again all the messages exchanged between the current two phone numbers
867
+					     $("#diplNmAllMsgcv").click(function() {
868
+
869
+		                                 $("#loadMoreMsgsusr").css("display", "none");
870
+
871
+		                                 let convDataprn = [];
872
+		                                 $.each(messagesPerNmbr[phNumberFrom], function(index, item) {
873
+		                                        convDataprn.push(item);
874
+		                                 });
875
+
876
+		                                 // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
877
+		                                 if (convDataprn.length > nmbTblDefault) {
878
+		                                     $("#loadMoreMsgs").css("display", "block");
879
+		                                     let nmbToBeLoaded = nmbTblDefault;
880
+		                                 } else {
881
+		                                     $("#loadMoreMsgs").css("display", "none");
882
+		                                     let nmbToBeLoaded = convDataprn.length;
883
+		                                 }
884
+
885
+					         let rowMessageArrprnst = [];
886
+
887
+					         for (let n = nmbToBeLoaded - 1; n >= 0; n--) {
888
+		                                      rowMessageArrprnst.push(convDataprn[n]);
889
+					         }
890
+
891
+					         let convDataPerNmbrprnst = rowMessageArrprnst.join("");
892
+
893
+		                                 $("#msgListRowCell").empty();
894
+		                                 $("#msgListRowCell").append(convDataPerNmbrprnst);
895
+
896
+		                                 // Scroll down to the bottom of the window
897
+		                                 $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
898
+
899
+
900
+		                                 // Load more messages
901
+		                                 let clckNb = 0;
902
+		                                 $("#loadMoreMsgs").unbind("click");
903
+		                                 $("#loadMoreMsgs").click(function() {
904
+
905
+		                                     clckNb++;
906
+		                                     var crefnb = (clckNb + 1) * nmbToBeLoaded;
907
+
908
+		                                     $("#loadMoreMsgsusr").css("display", "none");
909
+
910
+		                                     if (crefnb > convDataprn.length) {
911
+		                                         var nmbmsg = convDataprn.length - 1;
912
+		                                         $("#loadMoreMsgs").css("display", "none");
913
+		                                     } else {
914
+		                                         var nmbmsg = crefnb - 1;
915
+		                                         $("#loadMoreMsgs").css("display", "block");
916
+		                                     }
917
+
918
+		                                     let rowMessageArrAddst = [];
919
+
920
+		                                     for (var q = nmbmsg; q >= clckNb * nmbToBeLoaded; q--) {
921
+
922
+		                                          rowMessageArrAddst.push(convDataprn[q]);
923
+		                                     }
924
+
925
+					             let convDataPerNmbradst = rowMessageArrAddst.join("");
926
+
927
+		                                     let scrlheight = $("#msgListRowCell").height();
928
+		                                     $("#msgListRowCell").prepend(convDataPerNmbradst);
929
+
930
+		                                     $("#frmMsgLstWrap").animate({scrollTop: $("#msgListRowCell").height() - scrlheight}, 0);
931
+		                                 });
932
+
933
+					         $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
934
+					         $("#diplNmAllMsgcv").css("color", "#04957b");
935
+					         $(this).css("color", "#04c6a4");
936
+
937
+					     });
938
+
939
+
940
+					     // Show the scroll-up arrow
941
+					     $("#frmMsgLstWrap").scroll(function() {
942
+						if ($(this).scrollTop() > 900) {
943
+						      $('#upArrowSmall').fadeIn();
944
+						} else {
945
+						      $('#upArrowSmall').fadeOut();
946
+						}
947
+					     });
948
+
949
+					     $("#upArrowSmall").unbind("click");
950
+					     $("#upArrowSmall").click(function() {
951
+						$("#frmMsgLstWrap").animate({scrollTop : 0},400);
952
+					     });
953
+
954
+
955
+					     // Download MMS files when clicking on their URLs
956
+					     $('[id^="mmsTblUrl-"]').on('click', function(evt) {
957
+
958
+					        var clckedUrl = $(this).text();
959
+					        var flNamearr = clckedUrl.split("/");
960
+					        var flName = flNamearr.reverse()[0];
961
+
962
+					        confirmAlert("Download this file only if you trust the sender and the domain of the URL.");
963
+
964
+					        $("#confirmOk").click(function() {
965
+
966
+					           $("#alertMsgOverlay").remove();
967
+					           $("#alertConfMessage").remove();
968
+
969
+					           var mmsLink = document.createElement("a");
970
+					           mmsLink.setAttribute('href', clckedUrl);
971
+					           mmsLink.setAttribute('download', flName);
972
+                                                   mmsLink.setAttribute('target', '_blank');
973
+					           document.body.appendChild(mmsLink);
974
+					           mmsLink.click();
975
+					           mmsLink.remove();
976
+					        });
977
+
978
+					        $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
979
+					     });
980
+
981
+				  },
982
+				  error: function() {
983
+		                             showAlert("Error while attempting to get message data from the database!");
984
+					     $('#listAllMsgsConv').removeClass('icon-loading');
985
+				  }
986
+			   });
987
+
988
+                   }
989
+
990
+                   getMsgsForNumbers(phNumberFrom, phNumberTo);
991
+
992
+                   $("#refreshMsgsConv").click(function() { getMsgsForNumbers(phNumberFrom, phNumberTo); setTimeout(function() { $("#diplNmAllMsgcv").click(); }, 1000); });
993
+                }
994
+
995
+                $('[id^="showMsgConv-"]').click(function() {
996
+
997
+                   let ctrwnmbr = $(this).attr("id").replace("showMsgConv-", "");
998
+                   let phNumberFrom = $("#frmNmbr-"+ ctrwnmbr).text();
999
+                   let phNumberTo = $("#toNmbr-"+ ctrwnmbr).text().split(": ")[1];
1000
+
1001
+                   showRecMsgPerConv(phNumberFrom, phNumberTo);
1002
+                });
1003
+
1004
+
1005
+                // Show the pop-up window that lists all the messages sent/received to/from a phone number
1006
+                function showMsgPerNmbr(clckPhNumber) {
1007
+
1008
+                   var allfrmtomsg = "<div id='listAllMsgsFromTo'>";
1009
+                   allfrmtomsg += "<div id='draglstMsgmWindow'><img src='/" + ctappdir + "/sms_relentless/img/dots.svg' style='cursor:grab'></div>";
1010
+                   allfrmtomsg += "<a id='closeFrmMsgWindow' title='Close this window'></a>";
1011
+                   allfrmtomsg += "<div class='showByNmbrTitle'>Messages sent/received to/from  <span style='color:#04957b'>"+ clckPhNumber +"</span></div>";
1012
+                   allfrmtomsg += "<div id='frmMsgLstWrap'>";
1013
+                   allfrmtomsg += "<table id='frmMsgLstTbl'>";
1014
+                   allfrmtomsg += "<tr class='groupedrowsbody'><td><div id='grpdbynamelst' class='groupedLstNamespn'></div></td><td><div id='loadMoreMsgs' title='Click to load older messages.'>Load more messages</div><div id='loadMoreMsgsusr' title='Click to load older messages.'>Load more messages</div><div id='msgListRowCell' class='groupedLstMsgspn'></div><div id='refreshMsgsWraptf'><div id='refreshMsgsConvtf' title='Refresh list of messages'></div></div><div id='arrowupWrap'><div id='upArrowSmall' title='Scroll to the top'></div></div></td></tr>";
1015
+                   allfrmtomsg += "</table></div>";
1016
+                   allfrmtomsg += "<div id='sendMsgReply'><table id='sendMsgConv'><tr><td><div id='fromPhoneNmbrConv'>From: <select id='selectFromNbConv'></select></div><div id='toPhoneNmbrConv'>To: <span id='toNmbrConv' style='color:#04957b'>"+ clckPhNumber +"</span></div></td></tr>";
1017
+                   allfrmtomsg += "<tr><td><textarea id='sendMsgConvText' placeholder='Enter a message here, then press Send SMS.'></textarea></td></tr></table>";
1018
+                   allfrmtomsg += "<div id='sendMsgConvBtn'>Send SMS</div></div>";
1019
+                   allfrmtomsg += "<div id='expandWindowRplCtn' title='Expand to send a message'><img id='expandWindowRpl' src='/" + ctappdir + "/sms_relentless/img/arrowDown.svg'></div>";
1020
+                   allfrmtomsg += "<div id='draglstMsgmWindowsc'><img src='/" + ctappdir + "/sms_relentless/img/dots.svg' style='padding:4px;vertical-align:top;cursor:grab'></div>";
1021
+                   allfrmtomsg += "</div>";
1022
+
1023
+                   $("#content").append("<div id='recTblOverlay'></div>");
1024
+                   $("#content").append(allfrmtomsg);
1025
+
1026
+                   var topDist = parseInt((window.innerHeight / 2).toFixed(2) - 340) +"px";
1027
+                   var leftDist = parseInt((window.innerWidth / 2).toFixed(2) - 300) +"px";
1028
+                   $("#listAllMsgsFromTo").css({ "top" : topDist, "left" : leftDist });
1029
+
1030
+                   $("#closeFrmMsgWindow").click(function() { $("#listAllMsgsFromTo").remove(); $("#recTblOverlay").remove(); });
1031
+                   $("#recTblOverlay").click(function() { $("#listAllMsgsFromTo").remove(); $("#recTblOverlay").remove(); });
1032
+
1033
+	           // Expand the window when clicking on the arrow, to be able to send a reply message
1034
+                   $("#expandWindowRpl").unbind("click");
1035
+	           $("#expandWindowRpl").click(function() {
1036
+
1037
+	              if ($(this).attr('src') == '/' + ctappdir + '/sms_relentless/img/arrowDown.svg') {
1038
+                          $("#sendMsgReply").css("display", "block");
1039
+                          if ($(window).width() > 600) {
1040
+                              $("#listAllMsgsFromTo").css("height", "618px");
1041
+                          } else {
1042
+                              $("#listAllMsgsFromTo").css("height", parseInt($(window).height() - 32) + "px");
1043
+                              $("#frmMsgLstWrap").css("height", parseInt($(window).height() - 304) + "px");
1044
+                          }
1045
+	                  $(this).attr('src', '/' + ctappdir + '/sms_relentless/img/arrowUp.svg');
1046
+                          $(this).attr('title', 'Collapse');
1047
+
1048
+	              } else {
1049
+
1050
+                          $("#sendMsgReply").css("display", "none");
1051
+                          if ($(window).width() > 600) {
1052
+                              $("#listAllMsgsFromTo").css("height", "490px");
1053
+                          } else {
1054
+                              $("#listAllMsgsFromTo").css("height", parseInt($(window).height() - 120) + "px");
1055
+                              $("#frmMsgLstWrap").css("height", parseInt($(window).height() - 232) + "px");
1056
+                          }
1057
+                          $(this).attr('src', '/' + ctappdir + '/sms_relentless/img/arrowDown.svg');
1058
+                          $(this).attr('title', 'Expand to send a reply');
1059
+	              }
1060
+	           });
1061
+
1062
+
1063
+                   // Send a message from the 'conversation' window
1064
+                   $("#sendMsgConvBtn").click(function() {
1065
+
1066
+                      $("#sendMsgConv,#sendMsgConvBtn").addClass('icon-loading');
1067
+                      var msgToSend = $("#sendMsgConvText").val();
1068
+                      var selectedid = $("#selectFromNbConv").val();
1069
+                      var toNumber = $("#toNmbrConv").text();
1070
+                      var receiversNumbers = [toNumber];
1071
+
1072
+		      if (selectedid != '') { 
1073
+
1074
+			  var sendersplit = selectedid.split(":");
1075
+			  var providercap = sendersplit[0];
1076
+			  var provsec = sendersplit[1];
1077
+
1078
+			  if (/[a-zA-Z]/.test(provsec)) {
1079
+			      var alphanumcheck = true;
1080
+			  } else { var alphanumcheck = false; }
1081
+
1082
+			  if (providercap == 'Tx' && alphanumcheck == false) {  
1083
+			      var senderproc = selectedid.replace(/[^0-9]/g, "");
1084
+			      var selectedsender = "+" + senderproc;
1085
+			      var providerUsed = "telnyx";
1086
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstel");
1087
+			  } else if (providercap == 'Pl' && alphanumcheck == false) {
1088
+			      var selectedsender = selectedid.replace(/[^0-9]/g, "");
1089
+			      var providerUsed = "plivo";
1090
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsnex");
1091
+			  } else if (providercap == 'Tw' && alphanumcheck == false) {  
1092
+			      var senderproc = selectedid.replace(/[^0-9]/g, "");
1093
+			      var selectedsender = "+" + senderproc;
1094
+			      var providerUsed = "twilio";
1095
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstwil");
1096
+			  } else if (providercap == 'Fl' && alphanumcheck == false) {  
1097
+			      var senderproc = selectedid.replace(/[^0-9]/g, "");
1098
+			      var selectedsender = "+" + senderproc;
1099
+			      var providerUsed = "flowroute";
1100
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsflow");
1101
+			  } else if (providercap == 'Tx' && alphanumcheck == true) {
1102
+			      var selectedsender = provsec;
1103
+			      var providerUsed = "telnyx";
1104
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstel");
1105
+			  } else if (providercap == 'Pl' && alphanumcheck == true) {
1106
+			      var selectedsender = provsec;
1107
+			      var providerUsed = "plivo";
1108
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsnex");
1109
+			  } else if (providercap == 'Tw' && alphanumcheck == true) {
1110
+			      var selectedsender = provsec;
1111
+			      var providerUsed = "twilio";
1112
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstwil");
1113
+			  } else if (providercap == 'Fl' && alphanumcheck == true) {
1114
+			      var selectedsender = provsec;
1115
+			      var providerUsed = "flowroute";
1116
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsflow");
1117
+			  }
1118
+
1119
+                          var uploadedtomms = [];
1120
+
1121
+	                  if (msgToSend != '') {
1122
+
1123
+				  $.ajax({
1124
+				     url: relbaseUrl + '/' + userid,
1125
+				     type: "POST",
1126
+				     data: {
1127
+				           receiversPhoneNbs: receiversNumbers,
1128
+				           fromsender: selectedsender,
1129
+				           waitinterval: 1000,
1130
+				           sentsmstext: msgToSend,
1131
+				           ismms: 0,
1132
+				           mmsfiles: uploadedtomms
1133
+				         },
1134
+				     success: function(displayname) {
1135
+
1136
+                                           var tzdate = new Date();
1137
+                                           var presDatest = new Date(tzdate.getTime() - (tzdate.getTimezoneOffset() * 60000)).toJSON();
1138
+                                           var presDatedb = presDatest.split(".")[0];
1139
+                                           var presDatesc = presDatedb.split("T");
1140
+                                           var presDate = presDatesc[0] +" "+ presDatesc[1];
1141
+                                           var sentMessageStatus = '';
1142
+
1143
+                                           if (displayname) {
1144
+                                               var msgToSendproc = "<span class='msgAuthorNameGrp'>"+ displayname + ":</span>" + msgToSend; 
1145
+                                           } else { var msgToSendproc = msgToSend; }
1146
+
1147
+                                           $("#msgListRowCell").append("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ selectedsender +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ receiversNumbers[0] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ msgToSendproc +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ presDate +"</div><div class='sentMssgStatus'>"+ sentMessageStatus +"</div></div>");
1148
+
1149
+                                           // Scroll down to the bottom of the window
1150
+                                           $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
1151
+
1152
+                                           $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
1153
+				     },
1154
+				     error: function() {
1155
+                                           showAlert("Error while sending the message. You can check your Nextcloud log to find out more about this issue.");
1156
+				           $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
1157
+				     }
1158
+				  });
1159
+			  } else {
1160
+                                  showAlert("Please enter a message in the text box!");
1161
+				  $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
1162
+			  }
1163
+		      } else {
1164
+                              showAlert("Please choose a Sender ID from the 'From' drop-down list!");
1165
+			      $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
1166
+		      }
1167
+
1168
+                   });
1169
+
1170
+
1171
+	           // Make the window draggable
1172
+	           function makeMgrWndDraggable(e) {
1173
+
1174
+			   window.pmdragging = {};
1175
+			   pmdragging.pageX0 = e.pageX;
1176
+			   pmdragging.pageY0 = e.pageY;
1177
+			   pmdragging.elem = $("#listAllMsgsFromTo");
1178
+			   pmdragging.offset0 = $("#listAllMsgsFromTo").offset();
1179
+
1180
+			   function handle_dragging(e) {
1181
+			       var left = pmdragging.offset0.left + (e.pageX - pmdragging.pageX0);
1182
+			       var top = pmdragging.offset0.top + (e.pageY - pmdragging.pageY0);
1183
+			       $(pmdragging.elem).offset({top: top, left: left});
1184
+			   }
1185
+
1186
+			   function handle_mouseup(e) {
1187
+			       $('body').off('mousemove', handle_dragging).off('mouseup', handle_mouseup);
1188
+			   }
1189
+
1190
+			   $('body').on('mouseup', handle_mouseup).on('mousemove', handle_dragging);
1191
+	           }
1192
+	           $("#draglstMsgmWindow").mousedown(makeMgrWndDraggable);
1193
+	           $("#draglstMsgmWindowsc").mousedown(makeMgrWndDraggable);
1194
+
1195
+
1196
+                   // Append the available phone numbers to the From drop-down list
1197
+                   var availPhoneNmbrs = [];
1198
+                   $("#currentsmsnmbrs .optselectsmsnb").each(function() {
1199
+                      var crtphnmbr = $(this).attr("value");
1200
+                      if (crtphnmbr != "") { availPhoneNmbrs.push(crtphnmbr); }
1201
+                   });
1202
+
1203
+                   if (availPhoneNmbrs.length > 0) {
1204
+                       var avphopt = "";
1205
+                       for (let d = 0; d < availPhoneNmbrs.length; d++) {
1206
+                            avphopt += "<option value='"+ availPhoneNmbrs[d] +"'>"+ availPhoneNmbrs[d] +"</option>";
1207
+                       }
1208
+                       $("#selectFromNbConv").append(avphopt);
1209
+
1210
+                   } else { $("#selectFromNbConv").append("<option value='' selected>No IDs</option>"); }
1211
+
1212
+
1213
+                   // Get the sent/received messages for the current phone number, from the database
1214
+                   function getMsgsPerNmbr(clckPhNumber) {
1215
+
1216
+			   var getGroupedPnUrl = OC.generateUrl("/apps/sms_relentless/user/getgroupedpernumber");
1217
+
1218
+			   $('#listAllMsgsFromTo').addClass('icon-loading');
1219
+			   var totalPhNmbrs = 0;
1220
+
1221
+			   $.ajax({
1222
+				  method: 'POST',
1223
+				  url: getGroupedPnUrl + '/' + userid,
1224
+				  contentType: 'application/json',
1225
+		                  data: JSON.stringify({ "phoneNumber": clckPhNumber }),
1226
+				  success: function(groupedpernb) {
1227
+
1228
+					     $('#listAllMsgsFromTo').removeClass('icon-loading');
1229
+
1230
+					     var fromtoNmbrsData = [];
1231
+
1232
+					     for (var i = 0; i < groupedpernb.length; i++) {
1233
+
1234
+						     if (groupedpernb[i].author_displayname) {
1235
+							 var authordnm = groupedpernb[i].author_displayname;
1236
+						     } else { 
1237
+							 var authordnm = '';
1238
+						     }
1239
+
1240
+						     var sentfromnmbrarr = groupedpernb[i].from.split(": ");
1241
+						     if (sentfromnmbrarr[1]) {
1242
+							 var groupednbfrom = sentfromnmbrarr[1];
1243
+						     } else {
1244
+							 var groupednbfrom = sentfromnmbrarr[0];
1245
+						     }
1246
+
1247
+						     var modmessagerec = '';
1248
+						     if (groupedpernb[i].author_displayname) {
1249
+							 modmessagerec = "<span class='msgAuthorNameGrp'>"+ groupedpernb[i].author_displayname + ":</span>" + groupedpernb[i].message;
1250
+						     } else {
1251
+					                 modmessagerec = groupedpernb[i].message;
1252
+		                                     }
1253
+
1254
+						     if (groupedpernb[i].to.indexOf(": ") > -1) {
1255
+						         var groupednmbrtopre = groupedpernb[i].to.split(": ");
1256
+						         var groupednmbrto = groupednmbrtopre[1];
1257
+						     } else { 
1258
+						         var groupednmbrto = groupedpernb[i].to;
1259
+						     }
1260
+
1261
+						     fromtoNmbrsData.push({
1262
+						               'author_displayname': authordnm,
1263
+						               'from': groupednbfrom,
1264
+						               'to': groupednmbrto,
1265
+						               'message': modmessagerec,
1266
+						               'date': groupedpernb[i].date,
1267
+						               'status': groupedpernb[i].deliveryreceipt,
1268
+						               'table': groupedpernb[i].table
1269
+						     });
1270
+					     }
1271
+
1272
+
1273
+					     // Remove the duplicates
1274
+					     var noDupMsgData = [];
1275
+					     $.each(fromtoNmbrsData, function(i, e) {
1276
+						    var matchingData = $.grep(noDupMsgData, function(item) {
1277
+						            return item.from == e.from && item.to == e.to && item.message == e.message && item.table == 'received' && e.table == 'sent';
1278
+						    });
1279
+						    if (matchingData.length === 0) {
1280
+							noDupMsgData.push(e);
1281
+						    }
1282
+					     });
1283
+
1284
+					     var messagesPerNmbr = {};
1285
+					     var msgsNamesPerNmbr = {};
1286
+					     var msgsNmbrsNames = {};
1287
+
1288
+					     var displayNamesarr = [];
1289
+					     var convData = [];
1290
+
1291
+					     for (var n = 0; n < noDupMsgData.length; n++) {
1292
+
1293
+					          if (noDupMsgData[n]['from'] == clckPhNumber && noDupMsgData[n]['table'] == 'sent') {
1294
+
1295
+					              convData.push({
1296
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
1297
+					                             'message': noDupMsgData[n]['message'],
1298
+					                             'from': noDupMsgData[n]['from'],
1299
+					                             'to': noDupMsgData[n]['to'],
1300
+					                             'date': noDupMsgData[n]['date'],
1301
+					                             'direction': 'sent_from',
1302
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
1303
+					                             'table': noDupMsgData[n]['table']
1304
+					              });
1305
+
1306
+					          } else if (noDupMsgData[n]['to'] == clckPhNumber && noDupMsgData[n]['table'] == 'sent') {
1307
+
1308
+					              convData.push({
1309
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
1310
+					                             'message': noDupMsgData[n]['message'],
1311
+					                             'from': noDupMsgData[n]['from'],
1312
+					                             'to': noDupMsgData[n]['to'],
1313
+					                             'date': noDupMsgData[n]['date'],
1314
+					                             'direction': 'sent_to',
1315
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
1316
+					                             'table': noDupMsgData[n]['table']
1317
+					              });
1318
+
1319
+
1320
+					          } else if (noDupMsgData[n]['from'] == clckPhNumber && noDupMsgData[n]['table'] == 'received') {
1321
+
1322
+					              convData.push({
1323
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
1324
+					                             'message': noDupMsgData[n]['message'],
1325
+					                             'from': noDupMsgData[n]['from'],
1326
+					                             'to': noDupMsgData[n]['to'],
1327
+					                             'date': noDupMsgData[n]['date'],
1328
+					                             'direction': 'received_from',
1329
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
1330
+					                             'table': noDupMsgData[n]['table']
1331
+					              });
1332
+
1333
+					          } else if (noDupMsgData[n]['to'] == clckPhNumber && noDupMsgData[n]['table'] == 'received') {
1334
+
1335
+					              convData.push({
1336
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
1337
+					                             'message': noDupMsgData[n]['message'],
1338
+					                             'from': noDupMsgData[n]['from'],
1339
+					                             'to': noDupMsgData[n]['to'],
1340
+					                             'date': noDupMsgData[n]['date'],
1341
+					                             'direction': 'received_on',
1342
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
1343
+					                             'table': noDupMsgData[n]['table']
1344
+					              });
1345
+					          }
1346
+					     }
1347
+
1348
+					     // Sort messages by date
1349
+					     convData.sort(function(a, b) {
1350
+                                                return new Date(b.date) - new Date(a.date);
1351
+					     });
1352
+
1353
+					     // Collect the display names of the users that sent messages from the current number
1354
+					     var selectedNames = [];
1355
+					     var displayNames = '';
1356
+					     for (var v = 0; v < convData.length; v++) {
1357
+					          if (selectedNames.indexOf(convData[v]['author_displayname']) == -1) { 
1358
+					              selectedNames.push(convData[v]['author_displayname']);
1359
+					              displayNames += "<div id='diplNm_"+ clckPhNumber +"_"+ v +"' class='dispNameList' name='"+ convData[v]['author_displayname'] +"'>"+ convData[v]['author_displayname'] +"</div>";
1360
+					          }
1361
+					     }
1362
+					     displayNames += "<div id='diplNmAllMsg' class='dispNameListAll' title='Show all the messages for this number.'>"+ clckPhNumber +"</div>";
1363
+
1364
+					     // Store the display names for the current number, to be able to see them later
1365
+					     var ctPhNumber = clckPhNumber;
1366
+					     msgsNamesPerNmbr[ctPhNumber] = displayNames;
1367
+
1368
+					     // Store the messages sent by each user, to be able to see them later when clicking on the user's name
1369
+					     for (var h = 0; h < selectedNames.length; h++) {
1370
+
1371
+					          var rowMessageArrpn = [];
1372
+					          for (var b = 0; b < convData.length; b++) {
1373
+
1374
+					               if (selectedNames[h] == convData[b]['author_displayname']) {
1375
+
1376
+							   if (convData[b]['direction'] == 'sent_from') {
1377
+							       if (convData[b]['status']) {
1378
+							           if (convData[b]['status'].indexOf("delivered") > -1 || convData[b]['status'].indexOf("delivery success") > -1 || convData[b]['status'].indexOf("Retrieved") > -1) {
1379
+					                               if (convData[b]['status'].indexOf("undelivered") > -1) {
1380
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1381
+                                                                       } else {
1382
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
1383
+                                                                       }
1384
+							           } else {
1385
+							               var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1386
+							           }
1387
+							       } else {
1388
+							               var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1389
+							       }
1390
+							       rowMessageArrpn.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
1391
+							   } else if (convData[b]['direction'] == 'sent_to') {
1392
+							       if (convData[b]['status']) {
1393
+							           if (convData[b]['status'].indexOf("delivered") > -1 || convData[b]['status'].indexOf("delivery success") > -1 || convData[b]['status'].indexOf("Retrieved") > -1) {
1394
+					                               if (convData[b]['status'].indexOf("undelivered") > -1) {
1395
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1396
+                                                                       } else {
1397
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
1398
+                                                                       }
1399
+							           } else {
1400
+							               var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1401
+							           }
1402
+							       } else {
1403
+							           var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1404
+							       }
1405
+							       rowMessageArrpn.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
1406
+							   } else if (convData[b]['direction'] == 'received_from') {
1407
+							       rowMessageArrpn.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div></div>");
1408
+							   } else if (convData[b]['direction'] == 'received_on') {
1409
+							       rowMessageArrpn.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div></div>");
1410
+					                   }
1411
+					               }
1412
+					          }
1413
+					          var crtNmber = clckPhNumber;
1414
+					          var crtName = selectedNames[h];
1415
+					          msgsNmbrsNames[crtNmber] = msgsNmbrsNames[crtNmber] || {};
1416
+		                                  msgsNmbrsNames[crtNmber][crtName] = rowMessageArrpn;
1417
+					     }
1418
+
1419
+		                             // The number of messages to be loaded by default
1420
+		                             var nmbTblDefault = 50;
1421
+
1422
+		                             // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
1423
+		                             if (convData.length > nmbTblDefault) {
1424
+		                                 $("#loadMoreMsgs").css("display", "block");
1425
+		                                 var nmbToBeLoaded = nmbTblDefault;
1426
+		                             } else { var nmbToBeLoaded = convData.length; }
1427
+
1428
+					     var rowMessageArr = [];
1429
+					     for (var m = nmbToBeLoaded - 1; m >= 0; m--) {
1430
+
1431
+					          if (convData[m]['direction'] == 'sent_from') {
1432
+					              if (convData[m]['status']) {
1433
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
1434
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
1435
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1436
+                                                              } else {
1437
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
1438
+                                                              }
1439
+						          } else {
1440
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1441
+						          }
1442
+					              } else {
1443
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1444
+					              }
1445
+					              rowMessageArr.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
1446
+
1447
+					          } else if (convData[m]['direction'] == 'sent_to') {
1448
+					              if (convData[m]['status']) {
1449
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
1450
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
1451
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1452
+                                                              } else {
1453
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
1454
+                                                              }
1455
+						          } else {
1456
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1457
+						          }
1458
+					              } else {
1459
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1460
+					              }
1461
+					              rowMessageArr.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
1462
+
1463
+					          } else if (convData[m]['direction'] == 'received_from') {
1464
+
1465
+						      rowMessageArr.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
1466
+
1467
+					          } else if (convData[m]['direction'] == 'received_on') {
1468
+
1469
+						      rowMessageArr.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
1470
+					          }
1471
+					     }
1472
+
1473
+					     var convDataPerNmbr = rowMessageArr.join("");
1474
+
1475
+		                             $("#grpdbynamelst").empty();
1476
+		                             $("#grpdbynamelst").append(displayNames);
1477
+		                             $("#msgListRowCell").empty();
1478
+		                             $("#msgListRowCell").append(convDataPerNmbr);
1479
+
1480
+					     // Store the messages for the current number, to be able to see them later, when clicking on the number
1481
+					     var rowMessageArrcpt = [];
1482
+					     for (var m = 0; m < convData.length; m++) {
1483
+
1484
+					          if (convData[m]['direction'] == 'sent_from') {
1485
+					              if (convData[m]['status']) {
1486
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
1487
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
1488
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1489
+                                                              } else {
1490
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
1491
+                                                              }
1492
+						          } else {
1493
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1494
+						          }
1495
+					              } else {
1496
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1497
+					              }
1498
+					              rowMessageArrcpt.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
1499
+
1500
+					          } else if (convData[m]['direction'] == 'sent_to') {
1501
+					              if (convData[m]['status']) {
1502
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
1503
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
1504
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1505
+                                                              } else {
1506
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
1507
+                                                              }
1508
+						          } else {
1509
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1510
+						          }
1511
+					              } else {
1512
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1513
+					              }
1514
+					              rowMessageArrcpt.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
1515
+
1516
+					          } else if (convData[m]['direction'] == 'received_from') {
1517
+
1518
+						      rowMessageArrcpt.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
1519
+
1520
+					          } else if (convData[m]['direction'] == 'received_on') {
1521
+
1522
+						      rowMessageArrcpt.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
1523
+					          }
1524
+					     }
1525
+
1526
+					     messagesPerNmbr[clckPhNumber] = rowMessageArrcpt;
1527
+
1528
+		                             // Scroll down to the bottom of the window
1529
+	                                     $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
1530
+
1531
+		                             // Load more messages
1532
+		                             var clickNmb = 0;
1533
+		                             $("#loadMoreMsgs").click(function() {
1534
+
1535
+		                                 clickNmb++;
1536
+
1537
+		                                 var crefnb = (clickNmb + 1) * nmbToBeLoaded;
1538
+
1539
+		                                 if (crefnb > convData.length) {
1540
+		                                     var nmbmsg = convData.length - 1;
1541
+		                                     $("#loadMoreMsgs").css("display", "none");
1542
+		                                 } else { 
1543
+		                                     var nmbmsg = crefnb - 1;
1544
+		                                 }
1545
+
1546
+		                                 var rowMessageArrAdd = [];
1547
+
1548
+		                                 for (var m = nmbmsg; m >= clickNmb * nmbToBeLoaded; m--) {
1549
+
1550
+					              if (convData[m]['direction'] == 'sent_from') {
1551
+					                  if (convData[m]['status']) {
1552
+						              if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
1553
+				                                  if (convData[m]['status'].indexOf("undelivered") > -1) {
1554
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1555
+                                                                  } else {
1556
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
1557
+                                                                  }
1558
+						              } else {
1559
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1560
+						              }
1561
+					                  } else {
1562
+					                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1563
+					                  }
1564
+					                  rowMessageArrAdd.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
1565
+
1566
+					              } else if (convData[m]['direction'] == 'sent_to') {
1567
+					                  if (convData[m]['status']) {
1568
+						              if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
1569
+				                                  if (convData[m]['status'].indexOf("undelivered") > -1) {
1570
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1571
+                                                                  } else {
1572
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
1573
+                                                                  }
1574
+						              } else {
1575
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1576
+						              }
1577
+					                  } else {
1578
+					                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
1579
+					                  }
1580
+					                  rowMessageArrAdd.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
1581
+
1582
+					              } else if (convData[m]['direction'] == 'received_from') {
1583
+
1584
+							  rowMessageArrAdd.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
1585
+
1586
+					              } else if (convData[m]['direction'] == 'received_on') {
1587
+
1588
+							  rowMessageArrAdd.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
1589
+					              }
1590
+		                                 }
1591
+
1592
+					         var convDataPerNmbrad = rowMessageArrAdd.join("");
1593
+
1594
+		                                 var scrlheight = $("#msgListRowCell").height();
1595
+		                                 $("#msgListRowCell").prepend(convDataPerNmbrad);
1596
+
1597
+		                                 $("#frmMsgLstWrap").animate({scrollTop: $("#msgListRowCell").height() - scrlheight}, 0);
1598
+		                             });
1599
+
1600
+
1601
+					     // Show the messages sent by each user whose name is clicked
1602
+					     $('[id*="diplNm_"]').click(function() {
1603
+
1604
+					         var crntNmbr = $(this).attr("id").split("_")[1];
1605
+					         var crntDisName = $(this).attr("name");
1606
+		                                 $("#loadMoreMsgs").css("display", "none");
1607
+
1608
+		                                 var convDataprn = [];
1609
+		                                 $.each(msgsNmbrsNames[crntNmbr][crntDisName], function(index, item) {
1610
+		                                        convDataprn.push(item);
1611
+		                                 });
1612
+
1613
+		                                 // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
1614
+		                                 if (convDataprn.length > nmbTblDefault) {
1615
+		                                     $("#loadMoreMsgsusr").css("display", "block");
1616
+		                                     var nmbToBeLoaded = nmbTblDefault;
1617
+		                                 } else {
1618
+		                                     $("#loadMoreMsgsusr").css("display", "none");
1619
+		                                     var nmbToBeLoaded = convDataprn.length;
1620
+		                                 }
1621
+
1622
+					         var rowMessageArrprnst = [];
1623
+
1624
+					         for (var n = nmbToBeLoaded - 1; n >= 0; n--) {
1625
+		                                      rowMessageArrprnst.push(convDataprn[n]);
1626
+					         }
1627
+
1628
+					         var convDataPerNmbrprnst = rowMessageArrprnst.join("");
1629
+
1630
+		                                 $("#msgListRowCell").empty();
1631
+		                                 $("#msgListRowCell").append(convDataPerNmbrprnst);
1632
+
1633
+		                                 // Scroll down to the bottom of the window
1634
+		                                 $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
1635
+
1636
+		                                 // Load more messages
1637
+		                                 var clckNb = 0;
1638
+		                                 $("#loadMoreMsgsusr").unbind("click");
1639
+		                                 $("#loadMoreMsgsusr").click(function() {
1640
+
1641
+		                                     clckNb++;
1642
+		                                     var crefnb = (clckNb + 1) * nmbToBeLoaded;
1643
+
1644
+		                                     $("#loadMoreMsgs").css("display", "none");
1645
+
1646
+		                                     if (crefnb > convDataprn.length) {
1647
+		                                         var nmbmsg = convDataprn.length - 1;
1648
+		                                         $("#loadMoreMsgsusr").css("display", "none");
1649
+		                                     } else { 
1650
+		                                         var nmbmsg = crefnb - 1;
1651
+		                                         $("#loadMoreMsgsusr").css("display", "block");
1652
+		                                     }
1653
+
1654
+		                                     var rowMessageArrAddst = [];
1655
+
1656
+		                                     for (var q = nmbmsg; q >= clckNb * nmbToBeLoaded; q--) {
1657
+
1658
+		                                          rowMessageArrAddst.push(convDataprn[q]);
1659
+		                                     }
1660
+
1661
+					             var convDataPerNmbradst = rowMessageArrAddst.join("");
1662
+
1663
+		                                     var scrlheight = $("#msgListRowCell").height();
1664
+		                                     $("#msgListRowCell").prepend(convDataPerNmbradst);
1665
+
1666
+		                                     $("#frmMsgLstWrap").animate({scrollTop: $("#msgListRowCell").height() - scrlheight}, 0);
1667
+		                                 });
1668
+
1669
+					         $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
1670
+					         $("#diplNmAllMsg").css("color", "#04957b");
1671
+					         $(this).css("color", "#1b8efe");
1672
+					     });
1673
+
1674
+
1675
+					     // Show again all the messages sent/received to/from the clicked number
1676
+					     $("#diplNmAllMsg").click(function() {
1677
+
1678
+		                                 $("#loadMoreMsgsusr").css("display", "none");
1679
+
1680
+		                                 var convDataprn = [];
1681
+		                                 $.each(messagesPerNmbr[clckPhNumber], function(index, item) {
1682
+		                                        convDataprn.push(item);
1683
+		                                 });
1684
+
1685
+
1686
+		                                 // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
1687
+		                                 if (convDataprn.length > nmbTblDefault) {
1688
+		                                     $("#loadMoreMsgs").css("display", "block");
1689
+		                                     var nmbToBeLoaded = nmbTblDefault;
1690
+		                                 } else {
1691
+		                                     $("#loadMoreMsgs").css("display", "none");
1692
+		                                     var nmbToBeLoaded = convDataprn.length;
1693
+		                                 }
1694
+
1695
+					         var rowMessageArrprnst = [];
1696
+
1697
+					         for (var n = nmbToBeLoaded - 1; n >= 0; n--) {
1698
+		                                      rowMessageArrprnst.push(convDataprn[n]);
1699
+					         }
1700
+
1701
+					         var convDataPerNmbrprnst = rowMessageArrprnst.join("");
1702
+
1703
+		                                 $("#msgListRowCell").empty();
1704
+		                                 $("#msgListRowCell").append(convDataPerNmbrprnst);
1705
+
1706
+		                                 // Scroll down to the bottom of the window
1707
+		                                 $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
1708
+
1709
+
1710
+		                                 // Load more messages
1711
+		                                 var clckNb = 0;
1712
+		                                 $("#loadMoreMsgs").unbind("click");
1713
+		                                 $("#loadMoreMsgs").click(function() {
1714
+
1715
+		                                     clckNb++;
1716
+		                                     var crefnb = (clckNb + 1) * nmbToBeLoaded;
1717
+
1718
+		                                     $("#loadMoreMsgsusr").css("display", "none");
1719
+
1720
+		                                     if (crefnb > convDataprn.length) {
1721
+		                                         var nmbmsg = convDataprn.length - 1;
1722
+		                                         $("#loadMoreMsgs").css("display", "none");
1723
+		                                     } else { 
1724
+		                                         var nmbmsg = crefnb - 1;
1725
+		                                         $("#loadMoreMsgs").css("display", "block");
1726
+		                                     }
1727
+
1728
+		                                     var rowMessageArrAddst = [];
1729
+
1730
+		                                     for (var q = nmbmsg; q >= clckNb * nmbToBeLoaded; q--) {
1731
+
1732
+		                                          rowMessageArrAddst.push(convDataprn[q]);
1733
+		                                     }
1734
+
1735
+					             var convDataPerNmbradst = rowMessageArrAddst.join("");
1736
+
1737
+		                                     var scrlheight = $("#msgListRowCell").height();
1738
+		                                     $("#msgListRowCell").prepend(convDataPerNmbradst);
1739
+
1740
+		                                     $("#frmMsgLstWrap").animate({scrollTop: $("#msgListRowCell").height() - scrlheight}, 0);
1741
+		                                 });
1742
+
1743
+
1744
+					         $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
1745
+					         $("#diplNmAllMsg").css("color", "#04957b");
1746
+					         $(this).css("color", "#04c6a4");
1747
+
1748
+					     });
1749
+
1750
+
1751
+					     // Show the scroll-up arrow
1752
+					     $("#frmMsgLstWrap").scroll(function() {
1753
+						if ($(this).scrollTop() > 900) {
1754
+						      $('#upArrowSmall').fadeIn();
1755
+						} else {
1756
+						      $('#upArrowSmall').fadeOut();
1757
+						}
1758
+					     });
1759
+
1760
+					     $("#upArrowSmall").unbind("click");
1761
+					     $("#upArrowSmall").click(function() {
1762
+						$("#frmMsgLstWrap").animate({scrollTop : 0},400);
1763
+					     });
1764
+
1765
+
1766
+					     // Download MMS files when clicking on their URLs
1767
+					     $('[id^="mmsTblUrl-"]').on('click', function(evt) {
1768
+
1769
+					        var clckedUrl = $(this).text();
1770
+					        var flNamearr = clckedUrl.split("/");
1771
+					        var flName = flNamearr.reverse()[0];
1772
+
1773
+					        confirmAlert("Download this file only if you trust the sender and the domain of the URL.");
1774
+
1775
+					        $("#confirmOk").click(function() {
1776
+
1777
+					           $("#alertMsgOverlay").remove();
1778
+					           $("#alertConfMessage").remove();
1779
+
1780
+					           var mmsLink = document.createElement("a");
1781
+					           mmsLink.setAttribute('href', clckedUrl);
1782
+					           mmsLink.setAttribute('download', flName);
1783
+                                                   mmsLink.setAttribute('target', '_blank');
1784
+					           document.body.appendChild(mmsLink);
1785
+					           mmsLink.click();
1786
+					           mmsLink.remove();
1787
+					        });
1788
+
1789
+					        $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
1790
+					     });
1791
+
1792
+				  },
1793
+				  error: function() {
1794
+		                             showAlert("Error while attempting to get message data from the database!");
1795
+					     $('#listAllMsgsFromTo').removeClass('icon-loading');
1796
+				  }
1797
+			   });
1798
+
1799
+                   }
1800
+
1801
+                   getMsgsPerNmbr(clckPhNumber);
1802
+
1803
+                   $("#refreshMsgsConvtf").click(function() { getMsgsPerNmbr(clckPhNumber); setTimeout(function() { $("#diplNmAllMsg").click(); }, 1000); });
1804
+                }
1805
+
1806
+                $('[id^="showMsgFrom-"]').click(function() {
1807
+
1808
+                   var ctrwnb = $(this).attr("id").replace("showMsgFrom-", "");
1809
+                   var clckPhNumber = $("#frmNmbr-"+ ctrwnb).text();
1810
+
1811
+                   showMsgPerNmbr(clckPhNumber);
1812
+                })
1813
+
1814
+                $('[id^="showMsgTo-"]').click(function() {
1815
+                   var ctrwnbTo = $(this).attr("id").replace("showMsgTo-", "");
1816
+                   if ($("#toNmbr-"+ ctrwnbTo).text().indexOf(":") > -1) {
1817
+                       var clckPhNbTo = $("#toNmbr-"+ ctrwnbTo).text().split(": ")[1];
1818
+                   } else { var clckPhNbTo = $("#toNmbr-"+ ctrwnbTo).text(); };
1819
+
1820
+                   showMsgPerNmbr(clckPhNbTo);
1821
+                })
1822
+
1823
+                // Show the pop-up window for adding a Display Name to the 'From' numbers of unknown senders
1824
+                $('[id^="addDispName-"]').click(function() {
1825
+
1826
+                   var crrownb = $(this).attr("id").replace("addDispName-", "");
1827
+                   var slctPhoneNb = $("#frmNmbr-"+ crrownb).text();
1828
+
1829
+                   var addDNameWindow = "<div id='disNameWindow'>";
1830
+                   addDNameWindow += "<div id='dragDispNmWindow'><img src='/" + ctappdir + "/sms_relentless/img/dots.svg'></div>";
1831
+                   addDNameWindow += "<a id='closeDisNmWindow' title='Close this window'></a>";
1832
+                   addDNameWindow += "<div style='display:block;text-align:left;margin:14px 22px 0px 22px;color:#353535;font-family:Inter;font-size:15px;font-weight:400;'>If this is an external phone number (the number of a person that doesn't have a Nextcloud account), you can save a Display Name for this number, so that all the messages coming from it will be preceded by the specified Display Name:</div>";
1833
+                   addDNameWindow += "<div style='display:block;text-align:center;color:#49B382;font-family:Inter;font-size:15px;font-weight:600;margin:6px 0px 10px 0px;'>"+ slctPhoneNb +"</div>";
1834
+                   addDNameWindow += "<input type='text' id='saveDispNmText' placeholder='Eg: John Smith' style='display:block;width:80%;height:30px;margin:10px auto;padding:0px 12px;border-radius: 20px;'>";
1835
+                   addDNameWindow += "<input type='submit' id='saveDispName' value='Save'>";
1836
+                   addDNameWindow += "</div>";
1837
+
1838
+                   $("#content").append("<div id='recTblOverlay'></div>");
1839
+                   $("#content").append(addDNameWindow);
1840
+
1841
+                   var topNmDist = parseInt((window.innerHeight / 2).toFixed(2) - 180) +"px";
1842
+                   var leftNmDist = parseInt((window.innerWidth / 2).toFixed(2) - 150) +"px";
1843
+                   $("#disNameWindow").css({ "top" : topNmDist, "left" : leftNmDist });
1844
+
1845
+                   $("#closeDisNmWindow").click(function() { $("#disNameWindow").remove(); $("#recTblOverlay").remove(); });
1846
+                   $("#recTblOverlay").click(function() { $("#disNameWindow").remove(); $("#recTblOverlay").remove(); });
1847
+
1848
+
1849
+	           // Make the window draggable
1850
+	           function makeMgrWndDraggable(e) {
1851
+
1852
+			   window.pmdragging = {};
1853
+			   pmdragging.pageX0 = e.pageX;
1854
+			   pmdragging.pageY0 = e.pageY;
1855
+			   pmdragging.elem = $("#disNameWindow");
1856
+			   pmdragging.offset0 = $("#disNameWindow").offset();
1857
+
1858
+			   function handle_dragging(e) {
1859
+			       var left = pmdragging.offset0.left + (e.pageX - pmdragging.pageX0);
1860
+			       var top = pmdragging.offset0.top + (e.pageY - pmdragging.pageY0);
1861
+			       $(pmdragging.elem).offset({top: top, left: left});
1862
+			   }
1863
+
1864
+			   function handle_mouseup(e) {
1865
+			       $('body').off('mousemove', handle_dragging).off('mouseup', handle_mouseup);
1866
+			   }
1867
+
1868
+			   $('body').on('mouseup', handle_mouseup).on('mousemove', handle_dragging);
1869
+	           }
1870
+	           $("#dragDispNmWindow").mousedown(makeMgrWndDraggable);
1871
+
1872
+                   // Save the Display Name
1873
+                   $("#saveDispName").click(function() {
1874
+
1875
+                      var dispNmText = $("#saveDispNmText").val();
1876
+
1877
+                      if (/^[a-zA-Z0-9\s\-\/\.\)\(\']+$/.test(dispNmText) && dispNmText.length < 256) {
1878
+
1879
+                             var saveDispNameUrl = OC.generateUrl("/apps/sms_relentless/user/savedisplayname");
1880
+
1881
+			     $.ajax({
1882
+				  url: saveDispNameUrl + '/' + userid,
1883
+				  method: 'POST',
1884
+				  dataType:'text',
1885
+                                  data: { 
1886
+                                          authorDisplayname: dispNmText,
1887
+                                          from: slctPhoneNb
1888
+                                         },
1889
+				  success: function(respupdname) {
1890
+                                               showAlert(respupdname);
1891
+                                               $("#disNameWindow").remove();
1892
+                                               $("#recTblOverlay").remove();
1893
+                                  },
1894
+				  error: function() {
1895
+                                               showAlert("Error while attempting to save the new Display Name to the database.");
1896
+                                               $("#disNameWindow").remove();
1897
+                                               $("#recTblOverlay").remove();
1898
+                                  }
1899
+			     });
1900
+
1901
+                      } else {
1902
+                              showAlert("The Display Name should contain only letters, numbers, spaces, hyphens (-), slashes (/), periods (.), round brackets (()) and single quotation marks ('), it should not be empty and should have less than 256 characters.");
1903
+                      }
1904
+                   });
1905
+
1906
+                });
1907
+
1908
+
1909
+                // Add pagination
1910
+                var rowsShown = messagesperpage;
1911
+                var rowsTotal = $("#recSmsTable tr").length;
1912
+
1913
+                var numPages = (rowsTotal - 2) / rowsShown;
1914
+
1915
+                for (i = 0; i < numPages; i++) {
1916
+                     var pageNum = i + 1;
1917
+                     $('#paginationrec').append('<a href="#" rel="' + i + '" class="pagenumbersrec">' + pageNum + '</a> ');
1918
+                }
1919
+
1920
+                $('#paginationrec').children(":first").addClass('active');
1921
+
1922
+                $('#paginationrec a:first').addClass('active');
1923
+
1924
+                // Show table page when clicking a page number
1925
+                $('.recpages a').bind('click', function() {
1926
+
1927
+                   $('#paginationrec').children().removeClass('active');
1928
+
1929
+                   $(this).addClass('active');
1930
+
1931
+                   var currentPageNo = $(this).text();
1932
+
1933
+                   $('#paginationrec a').each(function() {
1934
+                       if ($(this).text() == currentPageNo) {
1935
+                           $(this).addClass('active');
1936
+                       }
1937
+                   });
1938
+
1939
+                   // Sort table rows
1940
+		   var rows = $('#recSmsTable tr').get();
1941
+
1942
+		   rows.sort(function(a, b) {
1943
+
1944
+		        var A = parseInt($('td.dbidcolumnrec', a).text());
1945
+		        var B = parseInt($('td.dbidcolumnrec', b).text());
1946
+
1947
+		        if (A < B) {
1948
+		            return -1;
1949
+		        }
1950
+
1951
+		        if (A > B) {
1952
+		            return 1;
1953
+		        }
1954
+
1955
+		        return 0;
1956
+		   });
1957
+
1958
+		   $.each(rows, function(index, row) {
1959
+		      $('#recSmsTable').append(row);
1960
+		   });
1961
+
1962
+                   var currPage = $(this).attr('rel');
1963
+                   var startItem = currPage * rowsShown;
1964
+                   var endItem = startItem + rowsShown;
1965
+
1966
+                   $(".receivedrowsbody").hide().slice(startItem, endItem).css('display', 'table-row');
1967
+
1968
+                   $('#totalrecmessages').remove();
1969
+                   $('#smstables').append("<div id='totalrecmessages'>Total displayed messages: " + parseddata.length + "</div>");
1970
+                });
1971
+
1972
+                $('#paginationrec').children(":last").trigger('click');
1973
+
1974
+                // Select all records
1975
+                $('#selectAllChckbx').change(function() {
1976
+                  if ($(this).is(':checked')) {
1977
+                       $(".indivchckbx").prop("checked", true);
1978
+                  } else {
1979
+                       $(".indivchckbx").prop("checked", false);
1980
+                  }
1981
+                });
1982
+
1983
+                function reorderRecRows() {
1984
+                   var currenttext = $(".filterbuttonsrec").closest('[class="filterbuttonsrec"]').find('[class="indivfilterrec"]').text();
1985
+                   if (currenttext == '') {
1986
+                       $('tr').sort(function (a, b) {
1987
+                          return parseInt($('td.dbidcolumnrec', b).text()) < parseInt($('td.dbidcolumnrec', a).text());
1988
+                       }).appendTo("#recSmsTable");
1989
+                   }
1990
+                }
1991
+
1992
+                // Filter rows
1993
+                $("#databaseidfilter").on("click", function(event) {
1994
+
1995
+                      var databaseId = $("#dbidtextrec").val();
1996
+                      var msgrowsNo = 0;
1997
+
1998
+                      $(".receivedrowsbody").each(function() {
1999
+
2000
+                          var checkrecEmpty1 = 0;
2001
+                          $(".indivfilterrec").not("#dbidtextrec").each(function() {
2002
+                              if ($(this).val() != '') {
2003
+                                  checkrecEmpty1 = 1;
2004
+                              }
2005
+                          });
2006
+
2007
+                          if (checkrecEmpty1 == 0) {
2008
+                              $(this).show();
2009
+                          }
2010
+
2011
+                          if (databaseId != '') {
2012
+                             if ($(this).find('[class="dbidcolumnrec"]').text() == databaseId) {
2013
+                                $("#recSmsTable").append(this);
2014
+                                if ($(this).is(":visible")) { msgrowsNo++; }
2015
+                             } else {
2016
+                                $(this).hide();
2017
+                             }
2018
+                          } else {
2019
+                                $(this).show();
2020
+                                msgrowsNo++;
2021
+                          }
2022
+                      });
2023
+
2024
+                      reorderRecRows();
2025
+                      $('#totalrecmessages').remove();
2026
+                      $('#smstables').append("<div id='totalrecmessages'>Total filtered messages: " + msgrowsNo + "</div>");
2027
+                });
2028
+
2029
+
2030
+                $("#useridfilter").on("click", function(event) {
2031
+
2032
+                      var useridtxt = $("#useridtextrec").val().toLowerCase();
2033
+                      var msgrowsNo = 0;
2034
+
2035
+                      $(".receivedrowsbody").each(function() {
2036
+
2037
+                          var checkrecEmpty2 = 0;
2038
+                          $(".indivfilterrec").not("#useridtextrec").each(function() {
2039
+                              if ($(this).val() != '') {
2040
+                                  checkrecEmpty2 = 1;
2041
+                              }
2042
+                          });
2043
+
2044
+                          if (checkrecEmpty2 == 0) {
2045
+                              $(this).show();
2046
+                          }
2047
+
2048
+                          if (useridtxt != '') {
2049
+                             var useridfound = $(this).find('[class="useridcolrec"]').text().toLowerCase();
2050
+                             if(useridfound.indexOf(useridtxt) != -1) {
2051
+                                $("#recSmsTable").append(this);
2052
+                                if ($(this).is(":visible")) { msgrowsNo++; }
2053
+                             } else {
2054
+                                $(this).hide();
2055
+                             }
2056
+                          } else {
2057
+                                $(this).show();
2058
+                                msgrowsNo++;
2059
+                          }
2060
+                      });
2061
+
2062
+                      reorderRecRows();
2063
+                      $('#totalrecmessages').remove();
2064
+                      $('#smstables').append("<div id='totalrecmessages'>Total filtered messages: " + msgrowsNo + "</div>");
2065
+                });
2066
+
2067
+                $("#messageidfilter").on("click", function(event) {
2068
+
2069
+                      var messageidtxt = $("#messageidtextrec").val().toLowerCase();
2070
+                      var msgrowsNo = 0;
2071
+
2072
+                      $(".receivedrowsbody").each(function() {
2073
+
2074
+                          var checkrecEmpty3 = 0;
2075
+                          $(".indivfilterrec").not("#messageidtextrec").each(function() {
2076
+                              if ($(this).val() != '') {
2077
+                                  checkrecEmpty3 = 1;
2078
+                              }
2079
+                          });
2080
+
2081
+                          if (checkrecEmpty3 == 0) {
2082
+                              $(this).show();
2083
+                          }
2084
+
2085
+                          if (messageidtxt != '') {
2086
+                             var foundtdmssgid = $(this).find('[class="messageidcolrec"]').text().toLowerCase();
2087
+                             if (foundtdmssgid.indexOf(messageidtxt) != -1) {
2088
+                                $("#recSmsTable").append(this);
2089
+                                if ($(this).is(":visible")) { msgrowsNo++; }
2090
+                             } else {
2091
+                                $(this).hide();
2092
+                             }
2093
+                          } else {
2094
+                                $(this).show();
2095
+                                msgrowsNo++;
2096
+                          }
2097
+                      });
2098
+
2099
+                      reorderRecRows();
2100
+                      $('#totalrecmessages').remove();
2101
+                      $('#smstables').append("<div id='totalrecmessages'>Total filtered messages: " + msgrowsNo + "</div>");
2102
+                });
2103
+
2104
+                $("#datefilter").on("click", function(event) {
2105
+
2106
+                      var datetxtvr = $("#datetextrec").val().toLowerCase();
2107
+                      var msgrowsNo = 0;
2108
+
2109
+                      $(".receivedrowsbody").each(function() {
2110
+
2111
+                          var checkrecEmpty4 = 0;
2112
+                          $(".indivfilterrec").not("#datetextrec").each(function() {
2113
+                              if ($(this).val() != '') {
2114
+                                  checkrecEmpty4 = 1;
2115
+                              }
2116
+                          });
2117
+
2118
+                          if (checkrecEmpty4 == 0) {
2119
+                              $(this).show();
2120
+                          }
2121
+
2122
+                          if (datetxtvr != '') {
2123
+                              var founddate = $(this).find('[class="datecolrec"]').text().toLowerCase();
2124
+                              if (founddate.indexOf(datetxtvr) != -1) {
2125
+                                  $("#recSmsTable").append(this);
2126
+                                  if ($(this).is(":visible")) { msgrowsNo++; }
2127
+                              } else {
2128
+                                  $(this).hide();
2129
+                              }
2130
+                          } else {
2131
+                                  $(this).show();
2132
+                                  msgrowsNo++;
2133
+                          }
2134
+                      });
2135
+
2136
+                      reorderRecRows();
2137
+                      $('#totalrecmessages').remove();
2138
+                      $('#smstables').append("<div id='totalrecmessages'>Total filtered messages: " + msgrowsNo + "</div>");
2139
+                });
2140
+
2141
+                $("#fromfilter").on("click", function(event) {
2142
+
2143
+                      var fromtxtvr = $("#fromtextrec").val().toLowerCase();
2144
+                      var msgrowsNo = 0;
2145
+
2146
+                      $(".receivedrowsbody").each(function() {
2147
+
2148
+                          var checkrecEmpty5 = 0;
2149
+                          $(".indivfilterrec").not("#fromtextrec").each(function() {
2150
+                              if ($(this).val() != '') {
2151
+                                  checkrecEmpty5 = 1;
2152
+                              }
2153
+                          });
2154
+
2155
+                          if (checkrecEmpty5 == 0) {
2156
+                              $(this).show();
2157
+                          }
2158
+
2159
+                          if (fromtxtvr != '') {
2160
+                             var foundfrom = $(this).find('[class="fromcolumnrec"]').text().toLowerCase();
2161
+                             if (foundfrom.indexOf(fromtxtvr) != -1) {
2162
+                                 $("#recSmsTable").append(this);
2163
+                                 if ($(this).is(":visible")) { msgrowsNo++; }
2164
+                             } else {
2165
+                                 $(this).hide();
2166
+                             }
2167
+                          } else {
2168
+                                 $(this).show();
2169
+                                 msgrowsNo++;
2170
+                          }
2171
+                      });
2172
+
2173
+                      reorderRecRows();
2174
+                      $('#totalrecmessages').remove();
2175
+                      $('#smstables').append("<div id='totalrecmessages'>Total filtered messages: " + msgrowsNo + "</div>");
2176
+                });
2177
+
2178
+                $("#tofilter").on("click", function(event) {
2179
+
2180
+                      var totxtvr = $("#totextrec").val().toLowerCase();
2181
+                      var msgrowsNo = 0;
2182
+
2183
+                      $(".receivedrowsbody").each(function() {
2184
+
2185
+                          var checkrecEmpty6 = 0;
2186
+                          $(".indivfilterrec").not("#totextrec").each(function() {
2187
+                              if ($(this).val() != '') {
2188
+                                  checkrecEmpty6 = 1;
2189
+                              }
2190
+                          });
2191
+
2192
+                          if (checkrecEmpty6 == 0) {
2193
+                              $(this).show();
2194
+                          }
2195
+
2196
+                          if (totxtvr != '') {
2197
+                             var foundto = $(this).find('[class="tocolrec"]').text().toLowerCase();
2198
+                             if (foundto.indexOf(totxtvr) != -1) {
2199
+                                 $("#recSmsTable").append(this);
2200
+                                 if ($(this).is(":visible")) { msgrowsNo++; }
2201
+                             } else {
2202
+                                 $(this).hide();
2203
+                             }
2204
+                          } else {
2205
+                                 $(this).show();
2206
+                                 msgrowsNo++;
2207
+                          }
2208
+                      });
2209
+
2210
+                      reorderRecRows();
2211
+                      $('#totalrecmessages').remove();
2212
+                      $('#smstables').append("<div id='totalrecmessages'>Total filtered messages: " + msgrowsNo + "</div>");
2213
+                });
2214
+
2215
+                $("#messagefilter").on("click", function(event) {
2216
+
2217
+                      var messagetxtvr = $("#messagetextrec").val().toLowerCase();
2218
+                      var msgrowsNo = 0;
2219
+
2220
+                      $(".receivedrowsbody").each(function() {
2221
+
2222
+                          var checkrecEmpty7 = 0;
2223
+                          $(".indivfilterrec").not("#messagetextrec").each(function() {
2224
+                              if ($(this).val() != '') {
2225
+                                  checkrecEmpty7 = 1;
2226
+                              }
2227
+                          });
2228
+
2229
+                          if (checkrecEmpty7 == 0) {
2230
+                              $(this).show();
2231
+                          }
2232
+
2233
+                          if (messagetxtvr != '') {
2234
+                             var foundmessage = $(this).find('[class="messagecolumnrec"]').text().toLowerCase();
2235
+                             if (foundmessage.indexOf(messagetxtvr) != -1) {
2236
+                                $("#recSmsTable").append(this);
2237
+                                if ($(this).is(":visible")) { msgrowsNo++; }
2238
+                             } else {
2239
+                                $(this).hide();
2240
+                             }
2241
+                          } else {
2242
+                                $(this).show();
2243
+                                msgrowsNo++;
2244
+                          }
2245
+                      });
2246
+
2247
+                      reorderRecRows();
2248
+                      $('#totalrecmessages').remove();
2249
+                      $('#smstables').append("<div id='totalrecmessages'>Total filtered messages: " + msgrowsNo + "</div>");
2250
+               });
2251
+
2252
+               // Clear all filters
2253
+               $("#clearrecfilters").on("click", function(event) {
2254
+                      $(".receivedrowsbody").each(function() {
2255
+                          $(this).show();
2256
+                      });
2257
+                      $(".indivfilterrec").val("");
2258
+                      $('#totalrecmessages').remove();
2259
+                      $('#smstables').append("<div id='totalrecmessages'>Total displayed messages: " + parseddata.length + "</div>");
2260
+               });
2261
+
2262
+               // Delete selected rows from the database
2263
+               $("#deleterecrows").on("click", function() {
2264
+                  var checkcheckbx = $("#recSmsTable input[type=checkbox]:checked").length;
2265
+                  if (checkcheckbx == 0) {
2266
+                      showAlert("Please select the row(s) to permanently delete from the database !");
2267
+                  } else {
2268
+                          var checkboxIds = [];
2269
+                          $(".receivedrowsbody").each(function() {
2270
+                             var rowcheckbx = $(this).find('input[type="checkbox"]');
2271
+                             if (rowcheckbx.is(":checked")) {
2272
+                                 var dbrowid = $(this).find('[class="dbidcolumnrec"]').text() + "|" + $(this).find('[class="messageidcolrec"]').text();
2273
+                                 checkboxIds.push(dbrowid);
2274
+                             }
2275
+                          });
2276
+
2277
+		          confirmAlert("Please note that the row(s) you selected will be permanently deleted from the database, without being saved before removal. This action cannot be undone ! If you really want to permanently delete the selected row(s) press 'OK'.");
2278
+
2279
+		          $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
2280
+
2281
+		          $("#confirmOk").click(function() {
2282
+
2283
+		              $("#alertMsgOverlay").remove();
2284
+		              $("#alertConfMessage").remove();
2285
+
2286
+                              var deleterecRowsUrl = OC.generateUrl("/apps/sms_relentless/user/removerecrows");
2287
+                              $('#smstables').addClass('icon-loading');
2288
+
2289
+                              $.ajax({
2290
+                                   url: deleterecRowsUrl + '/' + userid,
2291
+                                   type: "POST",
2292
+                                   data: { "recmessagedbIDs": checkboxIds },
2293
+                                   success: function(delmsgrec) {
2294
+		                              $('#smstables').removeClass('icon-loading');
2295
+                                              if (delmsgrec == "success") {
2296
+                                                  showAlert("The row(s) have been deleted successfully !");
2297
+                                                  $('#receivedsmstableshow').click();
2298
+                                              } else if (delmsgrec == "not allowed") {
2299
+                                                  showAlert("At least one message couldn't be deleted because of permission issues. Non-admin users can delete the messages sent/received from/on the numbers shared with them only if they are allowed by an admin.");
2300
+                                              } else {
2301
+                                                  showAlert("There was an error while deleting the selected row(s) !");
2302
+                                              }
2303
+                                   },
2304
+                                   error: function() {
2305
+                                              $('#smstables').removeClass('icon-loading');
2306
+                                              showAlert("There was an error while attempting to delete the selected row(s) !");
2307
+                                   }
2308
+                              });
2309
+                          });
2310
+
2311
+                  }
2312
+               });
2313
+
2314
+
2315
+               // Show/Hide filter row
2316
+	       $('#recarrow').on('click', function() {
2317
+	          if ($('#recfiltersrow').is(':visible')) {
2318
+		      $('#recfiltersrow').hide();
2319
+                      $('#recheaderrow').css('top', '0px');
2320
+                      $(this).removeClass('arrowUpCl');
2321
+                      $(this).addClass('arrowDownCl');
2322
+		  } else {
2323
+		      $('#recfiltersrow').show();
2324
+                      $('#recheaderrow').css('top', '158px');
2325
+                      $(this).removeClass('arrowDownCl');
2326
+                      $(this).addClass('arrowUpCl');
2327
+                  }
2328
+               });
2329
+
2330
+               $("#app-content").animate({scrollTop:$("#recSmsTable").prop("scrollHeight")},200);
2331
+
2332
+
2333
+               // Download MMS files when clicking on their URLs
2334
+               $('[id^="mmsTblUrl-"]').on('click', function(evt) {
2335
+
2336
+                  var clckedUrl = $(this).text();
2337
+                  var flNamearr = clckedUrl.split("/");
2338
+                  var flName = flNamearr.reverse()[0];
2339
+
2340
+                  confirmAlert("Download this file only if you trust the sender and the domain of the URL.");
2341
+
2342
+		  $("#confirmOk").click(function() {
2343
+
2344
+                     $("#alertMsgOverlay").remove();
2345
+		     $("#alertConfMessage").remove();
2346
+
2347
+		     var mmsLink = document.createElement("a");
2348
+		     mmsLink.setAttribute('href', clckedUrl);
2349
+		     mmsLink.setAttribute('download', flName);
2350
+		     mmsLink.setAttribute('target', '_blank');
2351
+		     document.body.appendChild(mmsLink);
2352
+		     mmsLink.click();
2353
+		     mmsLink.remove();
2354
+                  });
2355
+
2356
+		  $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
2357
+               });
2358
+
2359
+          },
2360
+          error: function() {
2361
+                      showAlert("Error. You can check the Nextcloud log to find more details about this issue.");
2362
+                      $('#smstables').removeClass('icon-loading');
2363
+          }
2364
+     });
2365
+
2366
+     // Look for the 'new received message' indicator in the database, to know if the received messages list needs to be refreshed
2367
+     intervalNmfr = setInterval(function() { checkIfNewMessage(); }, newMsgInterval);
2368
+
2369
+     $("#stopAutoRefreshSent").css("display", "none");
2370
+
2371
+  });
2372
+
2373
+
2374
+  // List sent messages
2375
+  $("#sentsmstableshow").on("click", function(event) {
2376
+
2377
+     $('#smstables').empty();
2378
+     clearInterval(intervalNmfr);
2379
+
2380
+     var getSentUrl = OC.generateUrl("/apps/sms_relentless/user/getsenttable");
2381
+     $('#smstables').addClass('icon-loading');
2382
+
2383
+     $.ajax({
2384
+          url: getSentUrl + '/' + userid,
2385
+          method: "GET",
2386
+          contentType: 'application/json',
2387
+          success: function(sentdatafdb) {
2388
+
2389
+                var sentparseddata = sentdatafdb.datarows;
2390
+
2391
+                $('#smstables').append("<div id='toptablesent'><div class='topbuttonandpage'><span id='sentarrow' title='Show/Hide filters and Delete button'></span></div><div id='paginationsent' class='pages'>Pages </div></div>");
2392
+                $('#smstables').append("<table id='sentSmsTable'></table>");
2393
+                $('#sentSmsTable').append("<tr id='sentfiltersrow'><td class='selectalldvfilter'><button id='clearsentfilters' title='Clear all filters.'></button><button id='deletesentrows' title='Permanently delete the selected row(s) from below from the database.'></button></td><td class='selectalldvfilter'><input type='text' id='dbidtextsent' class='indivfiltersent' title='Enter a database ID number to apply the filter.'><input type='submit' id='databaseidfilter' class='filterbuttonsent' value='' title='Filter rows by the specified database ID.' /></td><td class='selectalldvfilter'><input type='text' id='useridtext' class='indivfiltersent' title='Enter a Nextcloud username to apply the filter.' /><input type='submit' id='useridfilter' class='filterbuttonsent' value='' title='Filter rows by the specified username.' /></td><td class='selectalldvfilter'><input type='text' id='messageidtext' class='indivfiltersent' title='Enter a fragment from a message ID to apply the filter.'  /><input type='submit' id='messageidfilter' class='filterbuttonsent' value='' title='Filter rows by the specified string.' /></td><td class='selectalldvfilter'><input type='text' id='datetext' class='indivfiltersent' title='Enter a fragment of a date to apply the filter.'/><input type='submit' id='datefilter' class='filterbuttonsent' value='' title='Filter rows by the specified string.' /></td><td class='selectalldvfilter'><input type='text' id='fromtext' class='indivfiltersent' title='Enter a fragment of a sender&#146s phone number or alphanumeric Sender ID, to apply the filter.' /><input type='submit' id='fromfilter' class='filterbuttonsent' value='' title='Filter rows by the specified string.' /></td><td class='selectalldvfilter'><input type='text' id='totext' class='indivfiltersent' value='' title='Enter a fragment of a recipient&#146s phone number to apply the filter.'  /><input type='submit' id='tofilter' class='filterbuttonsent' value='' title='Filter rows by the specified string.' /></td><td class='selectalldvfilter'><input type='text' id='networktext' class='indivfiltersent' title='Enter a fragment of a network number to apply the filter.' /><input type='submit' id='networkfilter' class='filterbuttonsent' value='' title='Filter rows by the specified string.'/></td><td class='selectalldvfilter'><input type='text' id='pricetext' class='indivfiltersent' title='Enter a fragment of a price string to apply the filter.' /><input type='submit' id='pricefilter' class='filterbuttonsent' value='' title='Filter rows by the specified string.'/></td><td class='selectalldvfilter'><input type='text' id='statustext' class='indivfiltersent' title='Enter a fragment of a status to apply the filter.' /><input type='submit' id='statusfilter' class='filterbuttonsent' value='' title='Filter rows by the specified string.'/></td><td class='selectalldvfilter'><input type='text' id='deliveryrcpttext' class='indivfiltersent' title='Enter a fragment of a delivery receit to apply the filter.' /><input type='submit' id='deliveryrecfilter' class='filterbuttonsent' value='' title='Filter rows by the specified string.'/></td><td class='selectalldvfilter'><input type='text' id='messagetext' class='indivfiltersent' title='Enter a fragment of a message to apply the filter.' /><input type='submit' id='messagefilter' class='filterbuttonsent' value='' title='Filter rows by the specified string.'/></td></tr>");
2394
+                $('#sentSmsTable').append("<tr class='sentrows' id='sentheaderrow'><th id='selectalldv' class='selectsmsdv'><input type='checkbox' id='selectAllChckbx' class ='indivchckbx' title='Select all rows from all pages.' /></th><th title='The database ID of each message.'>ID</th><th>User ID</th><th>Message ID</th><th>Date</th><th>From</th><th>To</th><th>Network</th><th title=\"The currency is the currency configured in the client account, on the SMS provider's website.\">Price</th><th id='sentstatuscolumn' title=\"This column generally shows the status received from the recipient's carrier, or any errors generated when attempting to send the message.\">Status</th><th title='Not all delivery receipts guarantee that the target received the message. Some delivery receipts represent successful completion of just one step in the delivery process, such as transmitting the message to another telephony operator.'>Delivery<br>Receit</th><th>Sent Message</th></tr>");
2395
+
2396
+                $('#sentfiltersrow').hide();
2397
+
2398
+                if (sentdatafdb.showdispnm == 1) {
2399
+
2400
+                    for (var i = 0; i < sentparseddata.length; i++) {
2401
+
2402
+                         if (sentparseddata[i].author_displayname) {
2403
+                             var procmessage = "<span class='messageAuthorName'>"+ sentparseddata[i].author_displayname + ":</span>" + sentparseddata[i].message +"<div id='showMsgConv-"+ i +"' class='lstMsgConv'><img class='lstMsgConvImg' src='/" + ctappdir + "/sms_relentless/img/reply.svg' title='Show all the messages exchanged between the current 2 phone numbers.'></div>";
2404
+                         } else {
2405
+                             var procmessage = sentparseddata[i].message +"<div id='showMsgConv-"+ i +"' class='lstMsgConv'><img class='lstMsgConvImg' src='/" + ctappdir + "/sms_relentless/img/reply.svg' title='Show all the messages exchanged between the current 2 phone numbers.'></div>";
2406
+                         }
2407
+
2408
+                         var procsentFrom = "<div id='frmNmbr-"+ i +"'>"+ sentparseddata[i].from +"<div id='showMsgFrom-"+ i +"' class='listToFromMsgs'><img class='lstMsgToFromImg' src='/" + ctappdir + "/sms_relentless/img/list.svg' title='Show all the messages sent/received to/from this phone number, that I am allowed to see.'></div></div>";
2409
+
2410
+                         var procsentTo = "<div id='toNmbr-"+ i +"'>"+ sentparseddata[i].to +"<div id='showMsgTo-"+ i +"' class='listToFromMsgs'><img class='lstMsgToFromImg' src='/" + ctappdir + "/sms_relentless/img/list.svg' title='Show all the messages sent/received to/from this phone number, that I am allowed to see.'></div></div>";
2411
+
2412
+                         $('#sentSmsTable').append("<tr id='singlerow_"+ i +"' class='sentrowsbody'><td class='selectsmsdv'><input type='checkbox' id='selectspec_"+ i +"' class='indivchckbx' /></td><td class='sentdbidcolumn'>"+ sentparseddata[i].id +"</td><td class='useridcolsent'>"+ sentparseddata[i].user_id +"</td><td class='messageidcolsent'>"+ sentparseddata[i].message_id +"</td><td class='datecolsent'>"+ sentparseddata[i].date +"</td><td class='fromcolumnsent'>"+ procsentFrom +"</td><td class='tocolumnsent'>"+ procsentTo +"</td><td class='networkcolumnsent'><div class='networkNmContent'>"+ sentparseddata[i].network +"</div><div id='phNetwork-"+ i +"' class='phNetworkImg' title='Click to see the name of the receiver`s carrier'><img src='/" + ctappdir + "/sms_relentless/img/network.svg' class='recNetworkImg'></div></td><td class='pricecolumnsent'>"+ sentparseddata[i].price +"</td><td class='statuscolumnsent'>"+ sentparseddata[i].status +"</td><td class='deliveryrcptcolsent'>"+ sentparseddata[i].deliveryreceipt +"</td><td class='messagecolumnsent'>"+ procmessage +"</td></tr>");
2413
+                    }
2414
+
2415
+                } else {
2416
+
2417
+                    for (var i = 0; i < sentparseddata.length; i++) {
2418
+
2419
+                         var procmessage = sentparseddata[i].message +"<div id='showMsgConv-"+ i +"' class='lstMsgConv'><img class='lstMsgConvImg' src='/" + ctappdir + "/sms_relentless/img/reply.svg' title='Show all the messages exchanged between the current 2 phone numbers.'></div>";
2420
+
2421
+                         var procsentFrom = "<div id='frmNmbr-"+ i +"'>"+ sentparseddata[i].from +"<div id='showMsgFrom-"+ i +"' class='listToFromMsgs'><img class='lstMsgToFromImg' src='/" + ctappdir + "/sms_relentless/img/list.svg' title='Show all the messages sent/received to/from this phone number, that I am allowed to see.'></div></div>";
2422
+
2423
+                         var procsentTo = "<div id='toNmbr-"+ i +"'>"+ sentparseddata[i].to +"<div id='showMsgTo-"+ i +"' class='listToFromMsgs'><img class='lstMsgToFromImg' src='/" + ctappdir + "/sms_relentless/img/list.svg' title='Show all the messages sent/received to/from this phone number, that I am allowed to see.'></div></div>";
2424
+
2425
+                         $('#sentSmsTable').append("<tr id='singlerow_"+ i +"' class='sentrowsbody'><td class='selectsmsdv'><input type='checkbox' id='selectspec_"+ i +"' class='indivchckbx' /></td><td class='sentdbidcolumn'>"+ sentparseddata[i].id +"</td><td class='useridcolsent'>"+ sentparseddata[i].user_id +"</td><td class='messageidcolsent'>"+ sentparseddata[i].message_id +"</td><td class='datecolsent'>"+ sentparseddata[i].date +"</td><td class='fromcolumnsent'>"+ procsentFrom +"</td><td class='tocolumnsent'>"+ procsentTo +"</td><td class='networkcolumnsent'><div class='networkNmContent'>"+ sentparseddata[i].network +"</div><div id='phNetwork-"+ i +"' class='phNetworkImg' title='Click to see the name of the receiver`s carrier'><img src='/" + ctappdir + "/sms_relentless/img/network.svg' class='recNetworkImg'></div></td><td class='pricecolumnsent'>"+ sentparseddata[i].price +"</td><td class='statuscolumnsent'>"+ sentparseddata[i].status +"</td><td class='deliveryrcptcolsent'>"+ sentparseddata[i].deliveryreceipt +"</td><td class='messagecolumnsent'>"+ procmessage +"</td></tr>");
2426
+                    }
2427
+                }
2428
+
2429
+                $('#smstables').append("<div id='totalsentmessages'><span>Total displayed messages: " + sentparseddata.length + "</span></div>");
2430
+
2431
+                $('#smstables').removeClass('icon-loading');
2432
+
2433
+                $('#sentarrow').removeClass('arrowUpCl');
2434
+                $('#sentarrow').addClass('arrowDownCl');
2435
+
2436
+                // Show the name of the carrier's network
2437
+                $('[id^="phNetwork-"]').click(function(){
2438
+                   var ntwrkText = $(this).closest(".networkcolumnsent").find('[class="networkNmContent"]').text();
2439
+                   if (ntwrkText) {
2440
+                       if (/^[0-9\s]*$/.test(ntwrkText)) {
2441
+                           showAlert("The code of the receiver's carrier is:<span style='display:block;text-align:center;font-weight:700;'>"+ ntwrkText +"</span>You can look up the name of the carrier on <a href='https://en.wikipedia.org/wiki/Mobile_country_code#National_operators' style='color:#1b60ba' target='_blank' rel='noreferrer noopener'>this Wikipedia page</a>, taking into account that the first 3 digits specify the mobile country code, while the last 2 or 3 digits specify the mobile network code.");
2442
+                       } else {
2443
+                           showAlert("The name of the receiver's carrier is:<br>"+ ntwrkText);
2444
+                       }
2445
+                   } else { 
2446
+                       showAlert("The name of the receiver's carrier is not known."); 
2447
+                   }
2448
+                });
2449
+
2450
+                // Show the pop-up window that lists all the messages exchanged between the current 2 phone numbers
2451
+                function showSentMsgPerConv(phNumberFrom, phNumberTo) {
2452
+
2453
+                   let allfrmtomsg = "<div id='listAllMsgsConv'>";
2454
+                   allfrmtomsg += "<div id='draglstMsgmWindow'><img src='/" + ctappdir + "/sms_relentless/img/dots.svg' style='cursor:grab'></div>";
2455
+                   allfrmtomsg += "<a id='closeFrmMsgWindow' title='Close this window'></a>";
2456
+                   allfrmtomsg += "<div class='showByNmbrTitle'>Messages exchanged between <span style='color:#04957b'>"+ phNumberFrom +"</span> and <span style='color:#04957b'>"+ phNumberTo +"</span></div>";
2457
+                   allfrmtomsg += "<div id='frmMsgLstWrap'>";
2458
+                   allfrmtomsg += "<table id='frmMsgLstTbl'>";
2459
+                   allfrmtomsg += "<tr class='groupedrowsbody'><td><div id='grpdbynamelst' class='groupedLstNamespn'></div></td><td><div id='loadMoreMsgs' title='Click to load older messages.'>Load more messages</div><div id='loadMoreMsgsusr' title='Click to load older messages.'>Load more messages</div><div id='msgListRowCell' class='groupedLstMsgspn'></div><div id='refreshMsgsWrap'><div id='refreshMsgsConv' title='Refresh list of messages'></div></div><div id='arrowupWrap'><div id='upArrowSmall' title='Scroll to the top'></div></div></td></tr>";
2460
+                   allfrmtomsg += "</table></div>";
2461
+                   allfrmtomsg += "<div id='sendMsgReply'><table id='sendMsgConv'><tr><td><div id='fromPhoneNmbrConv'>From: <select id='selectFromNbConv'></select></div><div id='toPhoneNmbrConv'>To: <span id='toNmbrConv' style='color:#04957b'>"+ phNumberTo +"</span></div></td></tr>";
2462
+                   allfrmtomsg += "<tr><td><textarea id='sendMsgConvText' placeholder='Enter a message here, then press Send SMS.'></textarea></td></tr></table>";
2463
+                   allfrmtomsg += "<div id='sendMsgConvBtn'>Send SMS</div></div>";
2464
+                   allfrmtomsg += "<div id='expandWindowRplCtn' title='Expand to send a reply'><img id='expandWindowRpl' src='/" + ctappdir + "/sms_relentless/img/arrowDown.svg'></div>";
2465
+                   allfrmtomsg += "<div id='draglstMsgmWindowsc'><img src='/" + ctappdir + "/sms_relentless/img/dots.svg' style='padding:4px;vertical-align:top;cursor:grab;'></div>";
2466
+                   allfrmtomsg += "</div>";
2467
+
2468
+                   $("#content").append("<div id='recTblOverlay'></div>");
2469
+                   $("#content").append(allfrmtomsg);
2470
+
2471
+                   let topDist = parseInt((window.innerHeight / 2).toFixed(2) - 340) +"px";
2472
+                   let leftDist = parseInt((window.innerWidth / 2).toFixed(2) - 300) +"px";
2473
+                   $("#listAllMsgsConv").css({ "top" : topDist, "left" : leftDist });
2474
+
2475
+                   $("#closeFrmMsgWindow").click(function() { $("#listAllMsgsConv").remove(); $("#recTblOverlay").remove(); });
2476
+                   $("#recTblOverlay").click(function() { $("#listAllMsgsConv").remove(); $("#recTblOverlay").remove(); });
2477
+
2478
+	           // Expand the window when clicking on the arrow, to be able to send a reply message
2479
+                   $("#expandWindowRpl").unbind("click");
2480
+	           $("#expandWindowRpl").click(function() {
2481
+
2482
+	              if ($(this).attr('src') == '/' + ctappdir + '/sms_relentless/img/arrowDown.svg') {
2483
+                          $("#sendMsgReply").css("display", "block");
2484
+                          if ($(window).width() > 600) {
2485
+                              $("#listAllMsgsConv").css("height", "618px");
2486
+                          } else {
2487
+                              $("#listAllMsgsConv").css("height", parseInt($(window).height() - 32) + "px");
2488
+                              $("#frmMsgLstWrap").css("height", parseInt($(window).height() - 304) + "px");
2489
+                          }
2490
+	                  $(this).attr('src', '/' + ctappdir + '/sms_relentless/img/arrowUp.svg');
2491
+                          $(this).attr('title', 'Collapse');
2492
+
2493
+	              } else {
2494
+
2495
+                          $("#sendMsgReply").css("display", "none");
2496
+                          if ($(window).width() > 600) {
2497
+                              $("#listAllMsgsConv").css("height", "490px");
2498
+                          } else {
2499
+                              $("#listAllMsgsConv").css("height", parseInt($(window).height() - 120) + "px");
2500
+                              $("#frmMsgLstWrap").css("height", parseInt($(window).height() - 232) + "px");
2501
+                          }
2502
+                          $(this).attr('src', '/' + ctappdir + '/sms_relentless/img/arrowDown.svg');
2503
+                          $(this).attr('title', 'Expand to send a reply');
2504
+	              }
2505
+	           });
2506
+
2507
+
2508
+                   // Send a message from the 'conversation' window
2509
+                   $("#sendMsgConvBtn").click(function() {
2510
+
2511
+                      $("#sendMsgConv,#sendMsgConvBtn").addClass('icon-loading');
2512
+                      var msgToSend = $("#sendMsgConvText").val();
2513
+                      var selectedid = $("#selectFromNbConv").val();
2514
+                      var toNumber = $("#toNmbrConv").text();
2515
+                      var receiversNumbers = [toNumber];
2516
+
2517
+		      if (selectedid != '') { 
2518
+
2519
+			  var sendersplit = selectedid.split(":");
2520
+			  var providercap = sendersplit[0];
2521
+			  var provsec = sendersplit[1];
2522
+
2523
+			  if (/[a-zA-Z]/.test(provsec)) {
2524
+			      var alphanumcheck = true;
2525
+			  } else { var alphanumcheck = false; }
2526
+
2527
+			  if (providercap == 'Tx' && alphanumcheck == false) {  
2528
+			      var senderproc = selectedid.replace(/[^0-9]/g, "");
2529
+			      var selectedsender = "+" + senderproc;
2530
+			      var providerUsed = "telnyx";
2531
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstel");
2532
+			  } else if (providercap == 'Pl' && alphanumcheck == false) {
2533
+			      var selectedsender = selectedid.replace(/[^0-9]/g, "");
2534
+			      var providerUsed = "plivo";
2535
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsnex");
2536
+			  } else if (providercap == 'Tw' && alphanumcheck == false) {  
2537
+			      var senderproc = selectedid.replace(/[^0-9]/g, "");
2538
+			      var selectedsender = "+" + senderproc;
2539
+			      var providerUsed = "twilio";
2540
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstwil");
2541
+			  } else if (providercap == 'Fl' && alphanumcheck == false) {  
2542
+			      var senderproc = selectedid.replace(/[^0-9]/g, "");
2543
+			      var selectedsender = "+" + senderproc;
2544
+			      var providerUsed = "flowroute";
2545
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsflow");
2546
+			  } else if (providercap == 'Tx' && alphanumcheck == true) {
2547
+			      var selectedsender = provsec;
2548
+			      var providerUsed = "telnyx";
2549
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstel");
2550
+			  } else if (providercap == 'Pl' && alphanumcheck == true) {
2551
+			      var selectedsender = provsec;
2552
+			      var providerUsed = "plivo";
2553
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsnex");
2554
+			  } else if (providercap == 'Tw' && alphanumcheck == true) {
2555
+			      var selectedsender = provsec;
2556
+			      var providerUsed = "twilio";
2557
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstwil");
2558
+			  } else if (providercap == 'Fl' && alphanumcheck == true) {
2559
+			      var selectedsender = provsec;
2560
+			      var providerUsed = "flowroute";
2561
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsflow");
2562
+			  }
2563
+
2564
+                          var uploadedtomms = [];
2565
+
2566
+	                  if (msgToSend != '') {
2567
+
2568
+				  $.ajax({
2569
+				     url: relbaseUrl + '/' + userid,
2570
+				     type: "POST",
2571
+				     data: {
2572
+				           receiversPhoneNbs: receiversNumbers,
2573
+				           fromsender: selectedsender,
2574
+				           waitinterval: 1000,
2575
+				           sentsmstext: msgToSend,
2576
+				           ismms: 0,
2577
+				           mmsfiles: uploadedtomms
2578
+				         },
2579
+				     success: function(displayname) {
2580
+
2581
+                                           var tzdate = new Date();
2582
+                                           var presDatest = new Date(tzdate.getTime() - (tzdate.getTimezoneOffset() * 60000)).toJSON();
2583
+                                           var presDatedb = presDatest.split(".")[0];
2584
+                                           var presDatesc = presDatedb.split("T");
2585
+                                           var presDate = presDatesc[0] +" "+ presDatesc[1];
2586
+                                           var sentMessageStatus = '';
2587
+
2588
+                                           if (displayname) {
2589
+                                               var msgToSendproc = "<span class='msgAuthorNameGrp'>"+ displayname + ":</span>" + msgToSend; 
2590
+                                           } else { var msgToSendproc = msgToSend; }
2591
+
2592
+                                           $("#msgListRowCell").append("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ selectedsender +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ receiversNumbers[0] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ msgToSendproc +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ presDate +"</div><div class='sentMssgStatus'>"+ sentMessageStatus +"</div></div>");
2593
+
2594
+                                           // Scroll down to the bottom of the window
2595
+                                           $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
2596
+
2597
+                                           $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
2598
+				     },
2599
+				     error: function() {
2600
+				           showAlert("Error while sending the message. You can check your Nextcloud log to find out more about this issue.");
2601
+				           $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
2602
+				     }
2603
+				  });
2604
+			  } else {
2605
+				  showAlert("Please enter a message in the text box!");
2606
+				  $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
2607
+			  }
2608
+		      } else {
2609
+			      showAlert("Please choose a Sender ID from the 'From' drop-down list!");
2610
+			      $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
2611
+		      }
2612
+                   });
2613
+
2614
+
2615
+	           // Make the window draggable
2616
+	           function makeMgrWndDraggable(e) {
2617
+
2618
+			   window.pmdragging = {};
2619
+			   pmdragging.pageX0 = e.pageX;
2620
+			   pmdragging.pageY0 = e.pageY;
2621
+			   pmdragging.elem = $("#listAllMsgsConv");
2622
+			   pmdragging.offset0 = $("#listAllMsgsConv").offset();
2623
+
2624
+			   function handle_dragging(e) {
2625
+			       let left = pmdragging.offset0.left + (e.pageX - pmdragging.pageX0);
2626
+			       let top = pmdragging.offset0.top + (e.pageY - pmdragging.pageY0);
2627
+			       $(pmdragging.elem).offset({top: top, left: left});
2628
+			   }
2629
+
2630
+			   function handle_mouseup(e) {
2631
+			       $('body').off('mousemove', handle_dragging).off('mouseup', handle_mouseup);
2632
+			   }
2633
+
2634
+			   $('body').on('mouseup', handle_mouseup).on('mousemove', handle_dragging);
2635
+	           }
2636
+	           $("#draglstMsgmWindow").mousedown(makeMgrWndDraggable);
2637
+	           $("#draglstMsgmWindowsc").mousedown(makeMgrWndDraggable);
2638
+
2639
+
2640
+                   // Append the available phone numbers to the From drop-down list
2641
+                   var availPhoneNmbrs = [];
2642
+                   $("#currentsmsnmbrs .optselectsmsnb").each(function() {
2643
+                      var crtphnmbr = $(this).attr("value");
2644
+                      if (crtphnmbr != "") { availPhoneNmbrs.push(crtphnmbr); }
2645
+                   });
2646
+
2647
+                   if (availPhoneNmbrs.length > 0) {
2648
+                       var avphopt = "";
2649
+                       for (let d = 0; d < availPhoneNmbrs.length; d++) {
2650
+                            if (availPhoneNmbrs[d].indexOf(phNumberFrom) === -1) {
2651
+                                avphopt += "<option value='"+ availPhoneNmbrs[d] +"'>"+ availPhoneNmbrs[d] +"</option>";
2652
+                            } else {
2653
+                                avphopt += "<option value='"+ availPhoneNmbrs[d] +"' selected>"+ availPhoneNmbrs[d] +"</option>";
2654
+                            }
2655
+                       }
2656
+                       $("#selectFromNbConv").append(avphopt);
2657
+
2658
+                   } else { $("#selectFromNbConv").append("<option value='' selected>No IDs</option>"); }
2659
+
2660
+
2661
+                   // Get the messages exchanged between the current 2 phone numbers, from the database
2662
+                   function getMsgsForNumbersSec(phNumberFrom, phNumberTo) {
2663
+
2664
+			   let getGrpConvUrl = OC.generateUrl("/apps/sms_relentless/user/getgroupedforreply");
2665
+
2666
+			   $('#listAllMsgsConv').addClass('icon-loading');
2667
+			   let totalPhNmbrs = 0;
2668
+
2669
+			   $.ajax({
2670
+				  method: 'POST',
2671
+				  url: getGrpConvUrl + '/' + userid,
2672
+				  contentType: 'application/json',
2673
+		                  data: JSON.stringify({ "phoneNmbrFrom": phNumberFrom, "phoneNmbrTo": phNumberTo }),
2674
+				  success: function(groupedperconv) {
2675
+
2676
+					     $('#listAllMsgsConv').removeClass('icon-loading');
2677
+
2678
+					     let fromtoNmbrsData = [];
2679
+
2680
+					     for (let i = 0; i < groupedperconv.length; i++) {
2681
+
2682
+						     if (groupedperconv[i].author_displayname) {
2683
+							 var authordnm = groupedperconv[i].author_displayname;
2684
+						     } else { 
2685
+							 var authordnm = '';
2686
+						     }
2687
+
2688
+						     var sentfromnmbrarr = groupedperconv[i].from.split(": ");
2689
+						     if (sentfromnmbrarr[1]) {
2690
+							 var groupednbfrom = sentfromnmbrarr[1];
2691
+						     } else {
2692
+							 var groupednbfrom = sentfromnmbrarr[0];
2693
+						     }
2694
+
2695
+						     var modmessagerec = '';
2696
+						     if (groupedperconv[i].author_displayname) {
2697
+							 modmessagerec = "<span class='msgAuthorNameGrp'>"+ groupedperconv[i].author_displayname + ":</span>" + groupedperconv[i].message;
2698
+						     } else {
2699
+					                 modmessagerec = groupedperconv[i].message;
2700
+		                                     }
2701
+
2702
+						     if (groupedperconv[i].to.indexOf(": ") > -1) {
2703
+						         var groupednmbrtopre = groupedperconv[i].to.split(": ");
2704
+						         var groupednmbrto = groupednmbrtopre[1];
2705
+						     } else { 
2706
+						         var groupednmbrto = groupedperconv[i].to;
2707
+						     }
2708
+
2709
+						     fromtoNmbrsData.push({
2710
+						               'author_displayname': authordnm,
2711
+						               'from': groupednbfrom,
2712
+						               'to': groupednmbrto,
2713
+						               'message': modmessagerec,
2714
+						               'date': groupedperconv[i].date,
2715
+						               'status': groupedperconv[i].deliveryreceipt,
2716
+						               'table': groupedperconv[i].table
2717
+						     });
2718
+					     }
2719
+
2720
+
2721
+					     // Remove the duplicates
2722
+					     let noDupMsgData = [];
2723
+					     $.each(fromtoNmbrsData, function(i, e) {
2724
+						    let matchingData = $.grep(noDupMsgData, function(item) {
2725
+						            return item.from == e.from && item.to == e.to && item.message == e.message && item.table == 'received' && e.table == 'sent';
2726
+						    });
2727
+						    if (matchingData.length === 0) {
2728
+							noDupMsgData.push(e);
2729
+						    }
2730
+					     });
2731
+
2732
+					     let messagesPerNmbr = {};
2733
+					     let msgsNamesPerNmbr = {};
2734
+					     let msgsNmbrsNames = {};
2735
+
2736
+					     let displayNamesarr = [];
2737
+					     let convData = [];
2738
+
2739
+					     for (let n = 0; n < noDupMsgData.length; n++) {
2740
+
2741
+					          if (noDupMsgData[n]['from'] == phNumberTo && noDupMsgData[n]['table'] == 'sent') {
2742
+
2743
+					              convData.push({
2744
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
2745
+					                             'message': noDupMsgData[n]['message'],
2746
+					                             'from': noDupMsgData[n]['from'],
2747
+					                             'to': noDupMsgData[n]['to'],
2748
+					                             'date': noDupMsgData[n]['date'],
2749
+					                             'direction': 'sent_from',
2750
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
2751
+					                             'table': noDupMsgData[n]['table']
2752
+					              });
2753
+
2754
+					          } else if (noDupMsgData[n]['to'] == phNumberTo && noDupMsgData[n]['table'] == 'sent') {
2755
+
2756
+					              convData.push({
2757
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
2758
+					                             'message': noDupMsgData[n]['message'],
2759
+					                             'from': noDupMsgData[n]['from'],
2760
+					                             'to': noDupMsgData[n]['to'],
2761
+					                             'date': noDupMsgData[n]['date'],
2762
+					                             'direction': 'sent_to',
2763
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
2764
+					                             'table': noDupMsgData[n]['table']
2765
+					              });
2766
+
2767
+
2768
+					          } else if (noDupMsgData[n]['from'] == phNumberTo && noDupMsgData[n]['table'] == 'received') {
2769
+
2770
+					              convData.push({
2771
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
2772
+					                             'message': noDupMsgData[n]['message'],
2773
+					                             'from': noDupMsgData[n]['from'],
2774
+					                             'to': noDupMsgData[n]['to'],
2775
+					                             'date': noDupMsgData[n]['date'],
2776
+					                             'direction': 'received_from',
2777
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
2778
+					                             'table': noDupMsgData[n]['table']
2779
+					              });
2780
+
2781
+					          } else if (noDupMsgData[n]['to'] == phNumberTo && noDupMsgData[n]['table'] == 'received') {
2782
+
2783
+					              convData.push({
2784
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
2785
+					                             'message': noDupMsgData[n]['message'],
2786
+					                             'from': noDupMsgData[n]['from'],
2787
+					                             'to': noDupMsgData[n]['to'],
2788
+					                             'date': noDupMsgData[n]['date'],
2789
+					                             'direction': 'received_on',
2790
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
2791
+					                             'table': noDupMsgData[n]['table']
2792
+					              });
2793
+					          }
2794
+					     }
2795
+
2796
+					     // Sort messages by date
2797
+					     convData.sort(function(a, b) {
2798
+                                                return new Date(b.date) - new Date(a.date);
2799
+					     });
2800
+
2801
+					     // Collect the display names of the users that sent messages from the current numbers
2802
+					     let selectedNames = [];
2803
+					     let displayNames = '';
2804
+					     for (let v = 0; v < convData.length; v++) {
2805
+					          if (selectedNames.indexOf(convData[v]['author_displayname']) == -1) {
2806
+					              selectedNames.push(convData[v]['author_displayname']);
2807
+					              displayNames += "<div id='diplNm_"+ phNumberTo +"_"+ v +"' class='dispNameList' name='"+ convData[v]['author_displayname'] +"'>"+ convData[v]['author_displayname'] +"</div>";
2808
+					          }
2809
+					     }
2810
+					     displayNames += "<div id='diplNmAllMsgcv' class='dispNameListAll' title='Show all the messages exchanged between the current 2 phone numbers.'>All messages</div>";
2811
+
2812
+					     // Store the display names for the current numbers, to be able to see them later
2813
+					     let ctPhNumber = phNumberTo;
2814
+					     msgsNamesPerNmbr[ctPhNumber] = displayNames;
2815
+
2816
+					     // Store the messages sent by each user, to be able to see them later when clicking on the user's name
2817
+					     for (let h = 0; h < selectedNames.length; h++) {
2818
+
2819
+					          let rowMessageArrpn = [];
2820
+					          for (let b = 0; b < convData.length; b++) {
2821
+
2822
+					               if (selectedNames[h] == convData[b]['author_displayname']) {
2823
+
2824
+							   if (convData[b]['direction'] == 'sent_from') {
2825
+							       if (convData[b]['status']) {
2826
+							           if (convData[b]['status'].indexOf("delivered") > -1 || convData[b]['status'].indexOf("delivery success") > -1 || convData[b]['status'].indexOf("Retrieved") > -1) {
2827
+					                               if (convData[b]['status'].indexOf("undelivered") > -1) {
2828
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2829
+                                                                       } else {
2830
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
2831
+                                                                       }
2832
+							           } else {
2833
+							               var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2834
+							           }
2835
+							       } else {
2836
+							           var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2837
+							       }
2838
+							       rowMessageArrpn.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
2839
+							   } else if (convData[b]['direction'] == 'sent_to') {
2840
+							       if (convData[b]['status']) {
2841
+							           if (convData[b]['status'].indexOf("delivered") > -1 || convData[b]['status'].indexOf("delivery success") > -1 || convData[b]['status'].indexOf("Retrieved") > -1) {
2842
+					                               if (convData[b]['status'].indexOf("undelivered") > -1) {
2843
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2844
+                                                                       } else {
2845
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
2846
+                                                                       }
2847
+							           } else {
2848
+							               var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2849
+							           }
2850
+							       } else {
2851
+							           var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2852
+							       }
2853
+							       rowMessageArrpn.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
2854
+							   } else if (convData[b]['direction'] == 'received_from') {
2855
+							       rowMessageArrpn.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div></div>");
2856
+							   } else if (convData[b]['direction'] == 'received_on') {
2857
+							       rowMessageArrpn.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div></div>");
2858
+					                   }
2859
+					               }
2860
+					          }
2861
+					          let crtNmber = phNumberTo;
2862
+					          let crtName = selectedNames[h];
2863
+					          msgsNmbrsNames[crtNmber] = msgsNmbrsNames[crtNmber] || {};
2864
+		                                  msgsNmbrsNames[crtNmber][crtName] = rowMessageArrpn;
2865
+					     }
2866
+
2867
+		                             // The number of messages to be loaded by default
2868
+		                             let nmbTblDefault = 50;
2869
+
2870
+		                             // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
2871
+		                             if (convData.length > nmbTblDefault) {
2872
+		                                 $("#loadMoreMsgs").css("display", "block");
2873
+		                                 var nmbToBeLoaded = nmbTblDefault;
2874
+		                             } else { var nmbToBeLoaded = convData.length; }
2875
+
2876
+					     let rowMessageArr = [];
2877
+					     for (var m = nmbToBeLoaded - 1; m >= 0; m--) {
2878
+
2879
+					          if (convData[m]['direction'] == 'sent_from') {
2880
+					              if (convData[m]['status']) {
2881
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
2882
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
2883
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2884
+                                                              } else {
2885
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
2886
+                                                              }
2887
+						          } else {
2888
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2889
+						          }
2890
+					              } else {
2891
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2892
+					              }
2893
+					              rowMessageArr.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
2894
+
2895
+					          } else if (convData[m]['direction'] == 'sent_to') {
2896
+					              if (convData[m]['status']) {
2897
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
2898
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
2899
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2900
+                                                              } else {
2901
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
2902
+                                                              }
2903
+						          } else {
2904
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2905
+						          }
2906
+					              } else {
2907
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2908
+					              }
2909
+					              rowMessageArr.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
2910
+
2911
+					          } else if (convData[m]['direction'] == 'received_from') {
2912
+
2913
+						      rowMessageArr.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
2914
+
2915
+					          } else if (convData[m]['direction'] == 'received_on') {
2916
+
2917
+						      rowMessageArr.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
2918
+					          }
2919
+					     }
2920
+
2921
+					     let convDataPerNmbr = rowMessageArr.join("");
2922
+
2923
+		                             $("#grpdbynamelst").empty();
2924
+		                             $("#grpdbynamelst").append(displayNames);
2925
+		                             $("#msgListRowCell").empty();
2926
+		                             $("#msgListRowCell").append(convDataPerNmbr);
2927
+
2928
+					     // Store the messages for the current To number, to be able to see them later
2929
+					     let rowMessageArrcpt = [];
2930
+					     for (let m = 0; m < convData.length; m++) {
2931
+
2932
+					          if (convData[m]['direction'] == 'sent_from') {
2933
+					              if (convData[m]['status']) {
2934
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
2935
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
2936
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2937
+                                                              } else {
2938
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
2939
+                                                              }
2940
+						          } else {
2941
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2942
+						          }
2943
+					              } else {
2944
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2945
+					              }
2946
+					              rowMessageArrcpt.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
2947
+
2948
+					          } else if (convData[m]['direction'] == 'sent_to') {
2949
+					              if (convData[m]['status']) {
2950
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
2951
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
2952
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2953
+                                                              } else {
2954
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
2955
+                                                              }
2956
+						          } else {
2957
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2958
+						          }
2959
+					              } else {
2960
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
2961
+					              }
2962
+					              rowMessageArrcpt.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
2963
+
2964
+					          } else if (convData[m]['direction'] == 'received_from') {
2965
+
2966
+						      rowMessageArrcpt.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
2967
+
2968
+					          } else if (convData[m]['direction'] == 'received_on') {
2969
+
2970
+						      rowMessageArrcpt.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
2971
+					          }
2972
+					     }
2973
+
2974
+					     messagesPerNmbr[phNumberTo] = rowMessageArrcpt;
2975
+
2976
+		                             // Scroll down to the bottom of the window
2977
+		                             $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
2978
+
2979
+		                             // Load more messages
2980
+		                             let clickNmb = 0;
2981
+		                             $("#loadMoreMsgs").click(function() {
2982
+
2983
+		                                 clickNmb++;
2984
+
2985
+		                                 var crefnb = (clickNmb + 1) * nmbToBeLoaded;
2986
+
2987
+		                                 if (crefnb > convData.length) {
2988
+		                                     var nmbmsg = convData.length - 1;
2989
+		                                     $("#loadMoreMsgs").css("display", "none");
2990
+		                                 } else { 
2991
+		                                     var nmbmsg = crefnb - 1;
2992
+		                                 }
2993
+
2994
+		                                 var rowMessageArrAdd = [];
2995
+
2996
+		                                 for (let m = nmbmsg; m >= clickNmb * nmbToBeLoaded; m--) {
2997
+
2998
+					              if (convData[m]['direction'] == 'sent_from') {
2999
+					                  if (convData[m]['status']) {
3000
+						              if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
3001
+				                                  if (convData[m]['status'].indexOf("undelivered") > -1) {
3002
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3003
+                                                                  } else {
3004
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
3005
+                                                                  }
3006
+						              } else {
3007
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3008
+						              }
3009
+					                  } else {
3010
+					                          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3011
+					                  }
3012
+					                  rowMessageArrAdd.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
3013
+
3014
+					              } else if (convData[m]['direction'] == 'sent_to') {
3015
+					                  if (convData[m]['status']) {
3016
+						              if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
3017
+				                                  if (convData[m]['status'].indexOf("undelivered") > -1) {
3018
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3019
+                                                                  } else {
3020
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
3021
+                                                                  }
3022
+						              } else {
3023
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3024
+						              }
3025
+					                  } else {
3026
+					                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3027
+					                  }
3028
+					                  rowMessageArrAdd.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
3029
+
3030
+					              } else if (convData[m]['direction'] == 'received_from') {
3031
+
3032
+							  rowMessageArrAdd.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
3033
+
3034
+					              } else if (convData[m]['direction'] == 'received_on') {
3035
+
3036
+							  rowMessageArrAdd.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
3037
+					              }
3038
+		                                 }
3039
+
3040
+					         let convDataPerNmbrad = rowMessageArrAdd.join("");
3041
+
3042
+		                                 let scrlheight = $("#msgListRowCell").height();
3043
+		                                 $("#msgListRowCell").prepend(convDataPerNmbrad);
3044
+
3045
+		                                 $("#frmMsgLstWrap").animate({scrollTop: $("#msgListRowCell").height() - scrlheight}, 0);
3046
+		                             });
3047
+
3048
+
3049
+					     // Show the messages sent by each user whose name is clicked
3050
+					     $('[id*="diplNm_"]').click(function() {
3051
+
3052
+					         let crntNmbr = $(this).attr("id").split("_")[1];
3053
+					         let crntDisName = $(this).attr("name");                               
3054
+		                                 $("#loadMoreMsgs").css("display", "none");
3055
+
3056
+		                                 let convDataprn = [];
3057
+		                                 $.each(msgsNmbrsNames[crntNmbr][crntDisName], function(index, item) {
3058
+		                                        convDataprn.push(item);
3059
+		                                 });
3060
+
3061
+		                                 // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
3062
+		                                 if (convDataprn.length > nmbTblDefault) {
3063
+		                                     $("#loadMoreMsgsusr").css("display", "block");
3064
+		                                     let nmbToBeLoaded = nmbTblDefault;
3065
+		                                 } else {
3066
+		                                     $("#loadMoreMsgsusr").css("display", "none");
3067
+		                                     let nmbToBeLoaded = convDataprn.length;
3068
+		                                 }
3069
+
3070
+					         let rowMessageArrprnst = [];
3071
+
3072
+					         for (let n = nmbToBeLoaded - 1; n >= 0; n--) {
3073
+		                                      rowMessageArrprnst.push(convDataprn[n]);
3074
+					         }
3075
+
3076
+					         let convDataPerNmbrprnst = rowMessageArrprnst.join("");
3077
+
3078
+		                                 $("#msgListRowCell").empty();
3079
+		                                 $("#msgListRowCell").append(convDataPerNmbrprnst);
3080
+
3081
+		                                 // Scroll down to the bottom of the window
3082
+		                                 $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
3083
+
3084
+		                                 // Load more messages
3085
+		                                 let clckNb = 0;
3086
+		                                 $("#loadMoreMsgsusr").unbind("click");
3087
+		                                 $("#loadMoreMsgsusr").click(function() {
3088
+
3089
+		                                     clckNb++;
3090
+		                                     var crefnb = (clckNb + 1) * nmbToBeLoaded;
3091
+
3092
+		                                     $("#loadMoreMsgs").css("display", "none");
3093
+
3094
+		                                     if (crefnb > convDataprn.length) {
3095
+		                                         var nmbmsg = convDataprn.length - 1;
3096
+		                                         $("#loadMoreMsgsusr").css("display", "none");
3097
+		                                     } else { 
3098
+		                                         var nmbmsg = crefnb - 1;
3099
+		                                         $("#loadMoreMsgsusr").css("display", "block");
3100
+		                                     }
3101
+
3102
+		                                     var rowMessageArrAddst = [];
3103
+
3104
+		                                     for (var q = nmbmsg; q >= clckNb * nmbToBeLoaded; q--) {
3105
+
3106
+		                                          rowMessageArrAddst.push(convDataprn[q]);
3107
+		                                     }
3108
+
3109
+					             var convDataPerNmbradst = rowMessageArrAddst.join("");
3110
+
3111
+		                                     var scrlheight = $("#msgListRowCell").height();
3112
+		                                     $("#msgListRowCell").prepend(convDataPerNmbradst);
3113
+
3114
+		                                     $("#frmMsgLstWrap").animate({scrollTop: $("#msgListRowCell").height() - scrlheight}, 0);
3115
+		                                 });
3116
+
3117
+
3118
+					         $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
3119
+					         $("#diplNmAllMsgcv").css("color", "#04957b");
3120
+					         $(this).css("color", "#1b8efe");
3121
+					     });
3122
+
3123
+
3124
+					     // Show again all the messages sent/received to/from the clicked number
3125
+					     $("#diplNmAllMsgcv").click(function() {
3126
+
3127
+		                                 $("#loadMoreMsgsusr").css("display", "none");
3128
+
3129
+		                                 let convDataprn = [];
3130
+		                                 $.each(messagesPerNmbr[phNumberTo], function(index, item) {
3131
+		                                        convDataprn.push(item);
3132
+		                                 });
3133
+
3134
+		                                 // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
3135
+		                                 if (convDataprn.length > nmbTblDefault) {
3136
+		                                     $("#loadMoreMsgs").css("display", "block");
3137
+		                                     let nmbToBeLoaded = nmbTblDefault;
3138
+		                                 } else {
3139
+		                                     $("#loadMoreMsgs").css("display", "none");
3140
+		                                     let nmbToBeLoaded = convDataprn.length;
3141
+		                                 }
3142
+
3143
+					         let rowMessageArrprnst = [];
3144
+
3145
+					         for (let n = nmbToBeLoaded - 1; n >= 0; n--) {
3146
+		                                      rowMessageArrprnst.push(convDataprn[n]);
3147
+					         }
3148
+
3149
+					         let convDataPerNmbrprnst = rowMessageArrprnst.join("");
3150
+
3151
+		                                 $("#msgListRowCell").empty();
3152
+		                                 $("#msgListRowCell").append(convDataPerNmbrprnst);
3153
+
3154
+		                                 // Scroll down to the bottom of the window
3155
+		                                 $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
3156
+
3157
+
3158
+		                                 // Load more messages
3159
+		                                 let clckNb = 0;
3160
+		                                 $("#loadMoreMsgs").unbind("click");
3161
+		                                 $("#loadMoreMsgs").click(function() {
3162
+
3163
+		                                     clckNb++;
3164
+		                                     var crefnb = (clckNb + 1) * nmbToBeLoaded;
3165
+
3166
+		                                     $("#loadMoreMsgsusr").css("display", "none");
3167
+
3168
+		                                     if (crefnb > convDataprn.length) {
3169
+		                                         var nmbmsg = convDataprn.length - 1;
3170
+		                                         $("#loadMoreMsgs").css("display", "none");
3171
+		                                     } else { 
3172
+		                                         var nmbmsg = crefnb - 1;
3173
+		                                         $("#loadMoreMsgs").css("display", "block");
3174
+		                                     }
3175
+
3176
+		                                     var rowMessageArrAddst = [];
3177
+
3178
+		                                     for (var q = nmbmsg; q >= clckNb * nmbToBeLoaded; q--) {
3179
+
3180
+		                                          rowMessageArrAddst.push(convDataprn[q]);
3181
+		                                     }
3182
+
3183
+					             var convDataPerNmbradst = rowMessageArrAddst.join("");
3184
+
3185
+		                                     var scrlheight = $("#msgListRowCell").height();
3186
+		                                     $("#msgListRowCell").prepend(convDataPerNmbradst);
3187
+
3188
+		                                     $("#frmMsgLstWrap").animate({scrollTop: $("#msgListRowCell").height() - scrlheight}, 0);
3189
+		                                 });
3190
+
3191
+					         $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
3192
+					         $("#diplNmAllMsgcv").css("color", "#04957b");
3193
+					         $(this).css("color", "#04c6a4");
3194
+					     });
3195
+
3196
+
3197
+					     // Show the scroll-up arrow
3198
+					     $("#frmMsgLstWrap").scroll(function() {
3199
+						if ($(this).scrollTop() > 900) {
3200
+						      $('#upArrowSmall').fadeIn();
3201
+						} else {
3202
+						      $('#upArrowSmall').fadeOut();
3203
+						}
3204
+					     });
3205
+
3206
+					     $("#upArrowSmall").unbind("click");
3207
+					     $("#upArrowSmall").click(function() {
3208
+						$("#frmMsgLstWrap").animate({scrollTop : 0},400);
3209
+					     });
3210
+
3211
+
3212
+					     // Download MMS files when clicking on their URLs
3213
+					     $('[id^="mmsTblUrl-"]').on('click', function(evt) {
3214
+
3215
+					        var clckedUrl = $(this).text();
3216
+					        var flNamearr = clckedUrl.split("/");
3217
+					        var flName = flNamearr.reverse()[0];
3218
+
3219
+					        confirmAlert("Download this file only if you trust the sender and the domain of the URL.");
3220
+
3221
+					        $("#confirmOk").click(function() {
3222
+
3223
+					           $("#alertMsgOverlay").remove();
3224
+					           $("#alertConfMessage").remove();
3225
+
3226
+					           var mmsLink = document.createElement("a");
3227
+					           mmsLink.setAttribute('href', clckedUrl);
3228
+					           mmsLink.setAttribute('download', flName);
3229
+                                                   mmsLink.setAttribute('target', '_blank');
3230
+					           document.body.appendChild(mmsLink);
3231
+					           mmsLink.click();
3232
+					           mmsLink.remove();
3233
+					        });
3234
+
3235
+					        $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
3236
+					     });
3237
+
3238
+				  },
3239
+				  error: function() {
3240
+					     showAlert("Error while attempting to get message data from the database!");
3241
+					     $('#listAllMsgsConv').removeClass('icon-loading');
3242
+				  }
3243
+			   });
3244
+                   }
3245
+
3246
+                   getMsgsForNumbersSec(phNumberFrom, phNumberTo);
3247
+
3248
+                   $("#refreshMsgsConv").click(function() { getMsgsForNumbersSec(phNumberFrom, phNumberTo); setTimeout(function() { $("#diplNmAllMsgcv").click(); }, 1000); });
3249
+                }
3250
+
3251
+                $('[id^="showMsgConv-"]').click(function() {
3252
+
3253
+                   let ctrwnmbr = $(this).attr("id").replace("showMsgConv-", "");
3254
+                   let phNumberFrom = $("#frmNmbr-"+ ctrwnmbr).text().split(": ")[1];
3255
+                   let phNumberTo = $("#toNmbr-"+ ctrwnmbr).text();
3256
+
3257
+                   showSentMsgPerConv(phNumberFrom, phNumberTo);
3258
+                });
3259
+
3260
+
3261
+                // Show the pop-up window that lists all the messages sent/received to/from a phone number
3262
+                function showMsgPerNmbr(clckPhNumber) {
3263
+
3264
+                   var allfrmtomsg = "<div id='listAllMsgsFromTo'>";
3265
+                   allfrmtomsg += "<div id='draglstMsgmWindow'><img src='/" + ctappdir + "/sms_relentless/img/dots.svg' style='cursor:grab'></div>";
3266
+                   allfrmtomsg += "<a id='closeFrmMsgWindow' title='Close this window'></a>";
3267
+                   allfrmtomsg += "<div class='showByNmbrTitle'>Messages sent/received to/from  <span style='color:#04957b'>"+ clckPhNumber +"</span></div>";
3268
+                   allfrmtomsg += "<div id='frmMsgLstWrap'>";
3269
+                   allfrmtomsg += "<table id='frmMsgLstTbl'>";
3270
+                   allfrmtomsg += "<tr class='groupedrowsbody'><td><div id='grpdbynamelst' class='groupedLstNamespn'></div></td><td><div id='loadMoreMsgs' title='Click to load older messages.'>Load more messages</div><div id='loadMoreMsgsusr' title='Click to load older messages.'>Load more messages</div><div id='msgListRowCell' class='groupedLstMsgspn'></div><div id='refreshMsgsWraptf'><div id='refreshMsgsConvtf' title='Refresh list of messages'></div></div><div id='arrowupWrap'><div id='upArrowSmall' title='Scroll to the top'></div></div></td></tr>";
3271
+                   allfrmtomsg += "</table></div>";
3272
+                   allfrmtomsg += "<div id='sendMsgReply'><table id='sendMsgConv'><tr><td><div id='fromPhoneNmbrConv'>From: <select id='selectFromNbConv'></select></div><div id='toPhoneNmbrConv'>To: <span id='toNmbrConv' style='color:#04957b'>"+ clckPhNumber +"</span></div></td></tr>";
3273
+                   allfrmtomsg += "<tr><td><textarea id='sendMsgConvText' placeholder='Enter a message here, then press Send SMS.'></textarea></td></tr></table>";
3274
+                   allfrmtomsg += "<div id='sendMsgConvBtn'>Send SMS</div></div>";
3275
+                   allfrmtomsg += "<div id='expandWindowRplCtn' title='Expand to send a message'><img id='expandWindowRpl' src='/" + ctappdir + "/sms_relentless/img/arrowDown.svg'></div>";
3276
+                   allfrmtomsg += "<div id='draglstMsgmWindowsc'><img src='/" + ctappdir + "/sms_relentless/img/dots.svg' style='padding:4px;vertical-align:top;cursor:grab;'></div>";
3277
+                   allfrmtomsg += "</div>";
3278
+
3279
+                   $("#content").append("<div id='recTblOverlay'></div>");
3280
+                   $("#content").append(allfrmtomsg);
3281
+
3282
+                   var topDist = parseInt((window.innerHeight / 2).toFixed(2) - 340) +"px";
3283
+                   var leftDist = parseInt((window.innerWidth / 2).toFixed(2) - 300) +"px";
3284
+                   $("#listAllMsgsFromTo").css({ "top" : topDist, "left" : leftDist });
3285
+
3286
+                   $("#closeFrmMsgWindow").click(function() { $("#listAllMsgsFromTo").remove(); $("#recTblOverlay").remove(); });
3287
+                   $("#recTblOverlay").click(function() { $("#listAllMsgsFromTo").remove(); $("#recTblOverlay").remove(); });
3288
+
3289
+	           // Expand the window when clicking on the arrow, to be able to send a reply message
3290
+                   $("#expandWindowRpl").unbind("click");
3291
+	           $("#expandWindowRpl").click(function() {
3292
+
3293
+	              if ($(this).attr('src') == '/' + ctappdir + '/sms_relentless/img/arrowDown.svg') {
3294
+                          $("#sendMsgReply").css("display", "block");
3295
+                          if ($(window).width() > 600) {
3296
+                              $("#listAllMsgsFromTo").css("height", "618px");
3297
+                          } else {
3298
+                              $("#listAllMsgsFromTo").css("height", parseInt($(window).height() - 32) + "px");
3299
+                              $("#frmMsgLstWrap").css("height", parseInt($(window).height() - 304) + "px");
3300
+                          }
3301
+	                  $(this).attr('src', '/' + ctappdir + '/sms_relentless/img/arrowUp.svg');
3302
+                          $(this).attr('title', 'Collapse');
3303
+
3304
+	              } else {
3305
+
3306
+                          $("#sendMsgReply").css("display", "none");
3307
+                          if ($(window).width() > 600) {
3308
+                              $("#listAllMsgsFromTo").css("height", "490px");
3309
+                          } else {
3310
+                              $("#listAllMsgsFromTo").css("height", parseInt($(window).height() - 120) + "px");
3311
+                              $("#frmMsgLstWrap").css("height", parseInt($(window).height() - 232) + "px");
3312
+                          }
3313
+                          $(this).attr('src', '/' + ctappdir + '/sms_relentless/img/arrowDown.svg');
3314
+                          $(this).attr('title', 'Expand to send a reply');
3315
+	              }
3316
+	           });
3317
+
3318
+
3319
+                   // Send a message from the 'conversation' window
3320
+                   $("#sendMsgConvBtn").click(function() {
3321
+
3322
+                      $("#sendMsgConv,#sendMsgConvBtn").addClass('icon-loading');
3323
+                      var msgToSend = $("#sendMsgConvText").val();
3324
+                      var selectedid = $("#selectFromNbConv").val();
3325
+                      var toNumber = $("#toNmbrConv").text();
3326
+                      var receiversNumbers = [toNumber];
3327
+
3328
+		      if (selectedid != '') {
3329
+
3330
+			  var sendersplit = selectedid.split(":");
3331
+			  var providercap = sendersplit[0];
3332
+			  var provsec = sendersplit[1];
3333
+
3334
+			  if (/[a-zA-Z]/.test(provsec)) {
3335
+			      var alphanumcheck = true;
3336
+			  } else { var alphanumcheck = false; }
3337
+
3338
+			  if (providercap == 'Tx' && alphanumcheck == false) {  
3339
+			      var senderproc = selectedid.replace(/[^0-9]/g, "");
3340
+			      var selectedsender = "+" + senderproc;
3341
+			      var providerUsed = "telnyx";
3342
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstel");
3343
+			  } else if (providercap == 'Pl' && alphanumcheck == false) {
3344
+			      var selectedsender = selectedid.replace(/[^0-9]/g, "");
3345
+			      var providerUsed = "plivo";
3346
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsnex");
3347
+			  } else if (providercap == 'Tw' && alphanumcheck == false) {  
3348
+			      var senderproc = selectedid.replace(/[^0-9]/g, "");
3349
+			      var selectedsender = "+" + senderproc;
3350
+			      var providerUsed = "twilio";
3351
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstwil");
3352
+			  } else if (providercap == 'Fl' && alphanumcheck == false) {  
3353
+			      var senderproc = selectedid.replace(/[^0-9]/g, "");
3354
+			      var selectedsender = "+" + senderproc;
3355
+			      var providerUsed = "flowroute";
3356
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsflow");
3357
+			  } else if (providercap == 'Tx' && alphanumcheck == true) {
3358
+			      var selectedsender = provsec;
3359
+			      var providerUsed = "telnyx";
3360
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstel");
3361
+			  } else if (providercap == 'Pl' && alphanumcheck == true) {
3362
+			      var selectedsender = provsec;
3363
+			      var providerUsed = "plivo";
3364
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsnex");
3365
+			  } else if (providercap == 'Tw' && alphanumcheck == true) {
3366
+			      var selectedsender = provsec;
3367
+			      var providerUsed = "twilio";
3368
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstwil");
3369
+			  } else if (providercap == 'Fl' && alphanumcheck == true) {
3370
+			      var selectedsender = provsec;
3371
+			      var providerUsed = "flowroute";
3372
+			      var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsflow");
3373
+			  }
3374
+
3375
+                          var uploadedtomms = [];
3376
+
3377
+	                  if (msgToSend != '') {
3378
+
3379
+				  $.ajax({
3380
+				     url: relbaseUrl + '/' + userid,
3381
+				     type: "POST",
3382
+				     data: {
3383
+				           receiversPhoneNbs: receiversNumbers,
3384
+				           fromsender: selectedsender,
3385
+				           waitinterval: 1000,
3386
+				           sentsmstext: msgToSend,
3387
+				           ismms: 0,
3388
+				           mmsfiles: uploadedtomms
3389
+				         },
3390
+				     success: function(displayname) {
3391
+
3392
+                                           var tzdate = new Date();
3393
+                                           var presDatest = new Date(tzdate.getTime() - (tzdate.getTimezoneOffset() * 60000)).toJSON();
3394
+                                           var presDatedb = presDatest.split(".")[0];
3395
+                                           var presDatesc = presDatedb.split("T");
3396
+                                           var presDate = presDatesc[0] +" "+ presDatesc[1];
3397
+                                           var sentMessageStatus = '';
3398
+
3399
+                                           if (displayname) {
3400
+                                               var msgToSendproc = "<span class='msgAuthorNameGrp'>"+ displayname + ":</span>" + msgToSend; 
3401
+                                           } else { var msgToSendproc = msgToSend; }
3402
+
3403
+                                           $("#msgListRowCell").append("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ selectedsender +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ receiversNumbers[0] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ msgToSendproc +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ presDate +"</div><div class='sentMssgStatus'>"+ sentMessageStatus +"</div></div>");
3404
+
3405
+                                           // Scroll down to the bottom of the window
3406
+                                           $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
3407
+
3408
+                                           $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
3409
+				     },
3410
+				     error: function() {
3411
+				           showAlert("Error while sending the message. You can check your Nextcloud log to find out more about this issue.");
3412
+				           $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
3413
+				     }
3414
+				  });
3415
+			  } else {
3416
+				  showAlert("Please enter a message in the text box!");
3417
+				  $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
3418
+			  }
3419
+		      } else {
3420
+			      showAlert("Please choose a Sender ID from the 'From' drop-down list!");
3421
+			      $("#sendMsgConv,#sendMsgConvBtn").removeClass('icon-loading');
3422
+		      }
3423
+
3424
+                   });
3425
+
3426
+
3427
+	           // Make the window draggable
3428
+	           function makeMgrWndDraggable(e) {
3429
+
3430
+			   window.pmdragging = {};
3431
+			   pmdragging.pageX0 = e.pageX;
3432
+			   pmdragging.pageY0 = e.pageY;
3433
+			   pmdragging.elem = $("#listAllMsgsFromTo");
3434
+			   pmdragging.offset0 = $("#listAllMsgsFromTo").offset();
3435
+
3436
+			   function handle_dragging(e) {
3437
+			       var left = pmdragging.offset0.left + (e.pageX - pmdragging.pageX0);
3438
+			       var top = pmdragging.offset0.top + (e.pageY - pmdragging.pageY0);
3439
+			       $(pmdragging.elem).offset({top: top, left: left});
3440
+			   }
3441
+
3442
+			   function handle_mouseup(e) {
3443
+			       $('body').off('mousemove', handle_dragging).off('mouseup', handle_mouseup);
3444
+			   }
3445
+
3446
+			   $('body').on('mouseup', handle_mouseup).on('mousemove', handle_dragging);
3447
+	           }
3448
+	           $("#draglstMsgmWindow").mousedown(makeMgrWndDraggable);
3449
+	           $("#draglstMsgmWindowsc").mousedown(makeMgrWndDraggable);
3450
+
3451
+
3452
+                   // Append the available phone numbers to the From drop-down list
3453
+                   var availPhoneNmbrs = [];
3454
+                   $("#currentsmsnmbrs .optselectsmsnb").each(function() {
3455
+                      var crtphnmbr = $(this).attr("value");
3456
+                      if (crtphnmbr != "") { availPhoneNmbrs.push(crtphnmbr); }
3457
+                   });
3458
+
3459
+                   if (availPhoneNmbrs.length > 0) {
3460
+                       var avphopt = "";
3461
+                       for (let d = 0; d < availPhoneNmbrs.length; d++) {
3462
+                            avphopt += "<option value='"+ availPhoneNmbrs[d] +"'>"+ availPhoneNmbrs[d] +"</option>";
3463
+                       }
3464
+                       $("#selectFromNbConv").append(avphopt);
3465
+
3466
+                   } else { $("#selectFromNbConv").append("<option value='' selected>No IDs</option>"); }
3467
+
3468
+
3469
+                   // Get the sent/received messages for the current phone number, from the database
3470
+                   function getMsgsPerNmbrSec(clckPhNumber) {
3471
+
3472
+			   var getGroupedPnUrl = OC.generateUrl("/apps/sms_relentless/user/getgroupedpernumber");
3473
+
3474
+			   $('#listAllMsgsFromTo').addClass('icon-loading');
3475
+			   var totalPhNmbrs = 0;
3476
+
3477
+			   $.ajax({
3478
+				  method: 'POST',
3479
+				  url: getGroupedPnUrl + '/' + userid,
3480
+				  contentType: 'application/json',
3481
+		                  data: JSON.stringify({ "phoneNumber": clckPhNumber }),
3482
+				  success: function(groupedpernb) {
3483
+
3484
+					     $('#listAllMsgsFromTo').removeClass('icon-loading');
3485
+
3486
+					     var fromtoNmbrsData = [];
3487
+
3488
+					     for (var i = 0; i < groupedpernb.length; i++) {
3489
+
3490
+						     if (groupedpernb[i].author_displayname) {
3491
+							 var authordnm = groupedpernb[i].author_displayname;
3492
+						     } else { 
3493
+							 var authordnm = '';
3494
+						     }
3495
+
3496
+						     var sentfromnmbrarr = groupedpernb[i].from.split(": ");
3497
+						     if (sentfromnmbrarr[1]) {
3498
+							 var groupednbfrom = sentfromnmbrarr[1];
3499
+						     } else {
3500
+							 var groupednbfrom = sentfromnmbrarr[0];
3501
+						     }
3502
+
3503
+						     var modmessagesent = '';
3504
+						     if (groupedpernb[i].author_displayname) {
3505
+							 modmessagesent = "<span class='msgAuthorNameGrp'>"+ groupedpernb[i].author_displayname + ":</span>" + groupedpernb[i].message;
3506
+						     } else {
3507
+					                 modmessagesent = groupedpernb[i].message;
3508
+		                                     }
3509
+
3510
+						     if (groupedpernb[i].to.indexOf(": ") > -1) {
3511
+						         var groupednmbrtopre = groupedpernb[i].to.split(": ");
3512
+						         var groupednmbrto = groupednmbrtopre[1];
3513
+						     } else { 
3514
+						         var groupednmbrto = groupedpernb[i].to;
3515
+						     }
3516
+
3517
+						     fromtoNmbrsData.push({
3518
+						               'author_displayname': authordnm,
3519
+						               'from': groupednbfrom,
3520
+						               'to': groupednmbrto,
3521
+						               'message': modmessagesent,
3522
+						               'date': groupedpernb[i].date,
3523
+						               'status': groupedpernb[i].deliveryreceipt,
3524
+						               'table': groupedpernb[i].table
3525
+						     });
3526
+					     }
3527
+
3528
+
3529
+					     // Remove the duplicates
3530
+					     var noDupMsgData = [];
3531
+					     $.each(fromtoNmbrsData, function(i, e) {
3532
+						    var matchingData = $.grep(noDupMsgData, function(item) {
3533
+						            return item.from == e.from && item.to == e.to && item.message == e.message && item.table == 'received' && e.table == 'sent';
3534
+						    });
3535
+						    if (matchingData.length === 0) {
3536
+							noDupMsgData.push(e);
3537
+						    }
3538
+					     });
3539
+
3540
+					     var messagesPerNmbr = {};
3541
+					     var msgsNamesPerNmbr = {};
3542
+					     var msgsNmbrsNames = {};
3543
+
3544
+					     var displayNamesarr = [];
3545
+					     var convData = [];
3546
+
3547
+					     for (var n = 0; n < noDupMsgData.length; n++) {
3548
+
3549
+					          if (noDupMsgData[n]['from'] == clckPhNumber && noDupMsgData[n]['table'] == 'sent') {
3550
+
3551
+					              convData.push({
3552
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
3553
+					                             'message': noDupMsgData[n]['message'],
3554
+					                             'from': noDupMsgData[n]['from'],
3555
+					                             'to': noDupMsgData[n]['to'],
3556
+					                             'date': noDupMsgData[n]['date'],
3557
+					                             'direction': 'sent_from',
3558
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
3559
+					                             'table': noDupMsgData[n]['table']
3560
+					              });
3561
+
3562
+					          } else if (noDupMsgData[n]['to'] == clckPhNumber && noDupMsgData[n]['table'] == 'sent') {
3563
+
3564
+					              convData.push({
3565
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
3566
+					                             'message': noDupMsgData[n]['message'],
3567
+					                             'from': noDupMsgData[n]['from'],
3568
+					                             'to': noDupMsgData[n]['to'],
3569
+					                             'date': noDupMsgData[n]['date'],
3570
+					                             'direction': 'sent_to',
3571
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
3572
+					                             'table': noDupMsgData[n]['table']
3573
+					              });
3574
+
3575
+
3576
+					          } else if (noDupMsgData[n]['from'] == clckPhNumber && noDupMsgData[n]['table'] == 'received') {
3577
+
3578
+					              convData.push({
3579
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
3580
+					                             'message': noDupMsgData[n]['message'],
3581
+					                             'from': noDupMsgData[n]['from'],
3582
+					                             'to': noDupMsgData[n]['to'],
3583
+					                             'date': noDupMsgData[n]['date'],
3584
+					                             'direction': 'received_from',
3585
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
3586
+					                             'table': noDupMsgData[n]['table']
3587
+					              });
3588
+
3589
+					          } else if (noDupMsgData[n]['to'] == clckPhNumber && noDupMsgData[n]['table'] == 'received') {
3590
+
3591
+					              convData.push({
3592
+					                             'author_displayname': noDupMsgData[n]['author_displayname'],
3593
+					                             'message': noDupMsgData[n]['message'],
3594
+					                             'from': noDupMsgData[n]['from'],
3595
+					                             'to': noDupMsgData[n]['to'],
3596
+					                             'date': noDupMsgData[n]['date'],
3597
+					                             'direction': 'received_on',
3598
+					                             'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
3599
+					                             'table': noDupMsgData[n]['table']
3600
+					              });
3601
+					          }
3602
+					     }
3603
+
3604
+					     // Sort messages by date
3605
+					     convData.sort(function(a, b) {
3606
+                                                return new Date(b.date) - new Date(a.date);
3607
+					     });
3608
+
3609
+					     // Collect the display names of the users that sent messages from the current number
3610
+					     var selectedNames = [];
3611
+					     var displayNames = '';
3612
+					     for (var v = 0; v < convData.length; v++) {
3613
+					          if (selectedNames.indexOf(convData[v]['author_displayname']) == -1) { 
3614
+					              selectedNames.push(convData[v]['author_displayname']);
3615
+					              displayNames += "<div id='diplNm_"+ clckPhNumber +"_"+ v +"' class='dispNameList' name='"+ convData[v]['author_displayname'] +"'>"+ convData[v]['author_displayname'] +"</div>";
3616
+					          }
3617
+					     }
3618
+					     displayNames += "<div id='diplNmAllMsg' class='dispNameListAll' title='Show all the messages for this number.'>"+ clckPhNumber +"</div>";
3619
+
3620
+					     // Store the display names for the current number, to be able to see them later
3621
+					     var ctPhNumber = clckPhNumber;
3622
+					     msgsNamesPerNmbr[ctPhNumber] = displayNames;
3623
+
3624
+					     // Store the messages sent by each user, to be able to see them later when clicking on the user's name
3625
+					     for (var h = 0; h < selectedNames.length; h++) {
3626
+
3627
+					          var rowMessageArrpn = [];
3628
+					          for (var b = 0; b < convData.length; b++) {
3629
+
3630
+					               if (selectedNames[h] == convData[b]['author_displayname']) {
3631
+
3632
+							   if (convData[b]['direction'] == 'sent_from') {
3633
+							       if (convData[b]['status']) {
3634
+							           if (convData[b]['status'].indexOf("delivered") > -1 || convData[b]['status'].indexOf("delivery success") > -1 || convData[b]['status'].indexOf("Retrieved") > -1) {
3635
+					                               if (convData[b]['status'].indexOf("undelivered") > -1) {
3636
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3637
+                                                                       } else {
3638
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
3639
+                                                                       }
3640
+							           } else {
3641
+							               var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3642
+							           }
3643
+							       } else {
3644
+							           var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3645
+							       }
3646
+							       rowMessageArrpn.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
3647
+							   } else if (convData[b]['direction'] == 'sent_to') {
3648
+							       if (convData[b]['status']) {
3649
+							           if (convData[b]['status'].indexOf("delivered") > -1 || convData[b]['status'].indexOf("delivery success") > -1 || convData[b]['status'].indexOf("Retrieved") > -1) {
3650
+					                               if (convData[b]['status'].indexOf("undelivered") > -1) {
3651
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3652
+                                                                       } else {
3653
+							                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
3654
+                                                                       }
3655
+							           } else {
3656
+							               var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3657
+							           }
3658
+							       } else {
3659
+							           var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3660
+							       }
3661
+							       rowMessageArrpn.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
3662
+							   } else if (convData[b]['direction'] == 'received_from') {
3663
+							       rowMessageArrpn.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div></div>");
3664
+							   } else if (convData[b]['direction'] == 'received_on') {
3665
+							       rowMessageArrpn.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div></div>");
3666
+					                   }
3667
+					               }
3668
+					          }
3669
+					          var crtNmber = clckPhNumber;
3670
+					          var crtName = selectedNames[h];
3671
+					          msgsNmbrsNames[crtNmber] = msgsNmbrsNames[crtNmber] || {};
3672
+		                                  msgsNmbrsNames[crtNmber][crtName] = rowMessageArrpn;
3673
+					     }
3674
+
3675
+		                             // The number of messages to be loaded by default
3676
+		                             var nmbTblDefault = 50;
3677
+
3678
+		                             // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
3679
+		                             if (convData.length > nmbTblDefault) {
3680
+		                                 $("#loadMoreMsgs").css("display", "block");
3681
+		                                 var nmbToBeLoaded = nmbTblDefault;
3682
+		                             } else { var nmbToBeLoaded = convData.length; }
3683
+
3684
+					     var rowMessageArr = [];
3685
+					     for (var m = nmbToBeLoaded - 1; m >= 0; m--) {
3686
+
3687
+					          if (convData[m]['direction'] == 'sent_from') {
3688
+					              if (convData[m]['status']) {
3689
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
3690
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
3691
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3692
+                                                              } else {
3693
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
3694
+                                                              }
3695
+						          } else {
3696
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3697
+						          }
3698
+					              } else {
3699
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3700
+					              }    
3701
+					              rowMessageArr.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
3702
+
3703
+					          } else if (convData[m]['direction'] == 'sent_to') {
3704
+					              if (convData[m]['status']) {
3705
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
3706
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
3707
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3708
+                                                              } else {
3709
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
3710
+                                                              }
3711
+						          } else {
3712
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3713
+						          }
3714
+					              } else {
3715
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3716
+					              }
3717
+					              rowMessageArr.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
3718
+
3719
+					          } else if (convData[m]['direction'] == 'received_from') {
3720
+
3721
+						      rowMessageArr.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
3722
+
3723
+					          } else if (convData[m]['direction'] == 'received_on') {
3724
+
3725
+						      rowMessageArr.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
3726
+					          }
3727
+					     }
3728
+
3729
+					     var convDataPerNmbr = rowMessageArr.join("");
3730
+		                             $("#grpdbynamelst").empty();
3731
+		                             $("#grpdbynamelst").append(displayNames);
3732
+		                             $("#msgListRowCell").empty();
3733
+		                             $("#msgListRowCell").append(convDataPerNmbr);
3734
+
3735
+					     // Store the messages for the current number, to be able to see them later, when clicking on the number
3736
+					     var rowMessageArrcpt = [];
3737
+					     for (var m = 0; m < convData.length; m++) {
3738
+
3739
+					          if (convData[m]['direction'] == 'sent_from') {
3740
+					              if (convData[m]['status']) {
3741
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
3742
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
3743
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3744
+                                                              } else {
3745
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
3746
+                                                              }
3747
+						          } else {
3748
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3749
+						          }
3750
+					              } else {
3751
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3752
+					              }
3753
+					              rowMessageArrcpt.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
3754
+
3755
+					          } else if (convData[m]['direction'] == 'sent_to') {
3756
+					              if (convData[m]['status']) {
3757
+						          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
3758
+				                              if (convData[m]['status'].indexOf("undelivered") > -1) {
3759
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3760
+                                                              } else {
3761
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
3762
+                                                              }
3763
+						          } else {
3764
+						              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3765
+						          }
3766
+					              } else {
3767
+					                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3768
+					              }
3769
+					              rowMessageArrcpt.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
3770
+
3771
+					          } else if (convData[m]['direction'] == 'received_from') {
3772
+
3773
+						      rowMessageArrcpt.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
3774
+
3775
+					          } else if (convData[m]['direction'] == 'received_on') {
3776
+
3777
+						      rowMessageArrcpt.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
3778
+					          }
3779
+					     }
3780
+
3781
+					     messagesPerNmbr[clckPhNumber] = rowMessageArrcpt;
3782
+
3783
+		                             // Scroll down to the bottom of the window
3784
+		                             $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
3785
+
3786
+		                             // Load more messages
3787
+		                             var clickNmb = 0;
3788
+		                             $("#loadMoreMsgs").click(function() {
3789
+
3790
+		                                 clickNmb++;
3791
+
3792
+		                                 var crefnb = (clickNmb + 1) * nmbToBeLoaded;
3793
+
3794
+		                                 if (crefnb > convData.length) {
3795
+		                                     var nmbmsg = convData.length - 1;
3796
+		                                     $("#loadMoreMsgs").css("display", "none");
3797
+		                                 } else { 
3798
+		                                     var nmbmsg = crefnb - 1;
3799
+		                                 }
3800
+
3801
+		                                 var rowMessageArrAdd = [];
3802
+
3803
+		                                 for (var m = nmbmsg; m >= clickNmb * nmbToBeLoaded; m--) {
3804
+
3805
+					              if (convData[m]['direction'] == 'sent_from') {
3806
+					                  if (convData[m]['status']) {
3807
+						              if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
3808
+				                                  if (convData[m]['status'].indexOf("undelivered") > -1) {
3809
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3810
+                                                                  } else {
3811
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
3812
+                                                                  }
3813
+						              } else {
3814
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3815
+						              }
3816
+					                  } else {
3817
+					                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3818
+					                  }
3819
+					                  rowMessageArrAdd.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
3820
+
3821
+					              } else if (convData[m]['direction'] == 'sent_to') {
3822
+					                  if (convData[m]['status']) {
3823
+						              if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
3824
+				                                  if (convData[m]['status'].indexOf("undelivered") > -1) {
3825
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3826
+                                                                  } else {
3827
+						                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
3828
+                                                                  }
3829
+						              } else {
3830
+						                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3831
+						              }
3832
+					                  } else {
3833
+					                      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
3834
+					                  }
3835
+					                  rowMessageArrAdd.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
3836
+
3837
+					              } else if (convData[m]['direction'] == 'received_from') {
3838
+
3839
+							  rowMessageArrAdd.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
3840
+
3841
+					              } else if (convData[m]['direction'] == 'received_on') {
3842
+
3843
+							  rowMessageArrAdd.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
3844
+					              }
3845
+		                                 }
3846
+
3847
+					         var convDataPerNmbrad = rowMessageArrAdd.join("");
3848
+
3849
+		                                 var scrlheight = $("#msgListRowCell").height();
3850
+		                                 $("#msgListRowCell").prepend(convDataPerNmbrad);
3851
+
3852
+		                                 $("#frmMsgLstWrap").animate({scrollTop: $("#msgListRowCell").height() - scrlheight}, 0);
3853
+		                             });
3854
+
3855
+
3856
+					     // Show the messages sent by each user whose name is clicked
3857
+					     $('[id*="diplNm_"]').click(function() {
3858
+
3859
+					         var crntNmbr = $(this).attr("id").split("_")[1];
3860
+					         var crntDisName = $(this).attr("name");                               
3861
+		                                 $("#loadMoreMsgs").css("display", "none");
3862
+
3863
+		                                 var convDataprn = [];
3864
+		                                 $.each(msgsNmbrsNames[crntNmbr][crntDisName], function(index, item) {
3865
+		                                        convDataprn.push(item);
3866
+		                                 });
3867
+
3868
+		                                 // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
3869
+		                                 if (convDataprn.length > nmbTblDefault) {
3870
+		                                     $("#loadMoreMsgsusr").css("display", "block");
3871
+		                                     var nmbToBeLoaded = nmbTblDefault;
3872
+		                                 } else {
3873
+		                                     $("#loadMoreMsgsusr").css("display", "none");
3874
+		                                     var nmbToBeLoaded = convDataprn.length;
3875
+		                                 }
3876
+
3877
+					         var rowMessageArrprnst = [];
3878
+
3879
+					         for (var n = nmbToBeLoaded - 1; n >= 0; n--) {
3880
+		                                      rowMessageArrprnst.push(convDataprn[n]);
3881
+					         }
3882
+
3883
+					         var convDataPerNmbrprnst = rowMessageArrprnst.join("");
3884
+
3885
+		                                 $("#msgListRowCell").empty();
3886
+		                                 $("#msgListRowCell").append(convDataPerNmbrprnst);
3887
+
3888
+		                                 // Scroll down to the bottom of the window
3889
+		                                 $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
3890
+
3891
+		                                 // Load more messages
3892
+		                                 var clckNb = 0;
3893
+		                                 $("#loadMoreMsgsusr").unbind("click");
3894
+		                                 $("#loadMoreMsgsusr").click(function() {
3895
+
3896
+		                                     clckNb++;
3897
+		                                     var crefnb = (clckNb + 1) * nmbToBeLoaded;
3898
+
3899
+		                                     $("#loadMoreMsgs").css("display", "none");
3900
+
3901
+		                                     if (crefnb > convDataprn.length) {
3902
+		                                         var nmbmsg = convDataprn.length - 1;
3903
+		                                         $("#loadMoreMsgsusr").css("display", "none");
3904
+		                                     } else { 
3905
+		                                         var nmbmsg = crefnb - 1;
3906
+		                                         $("#loadMoreMsgsusr").css("display", "block");
3907
+		                                     }
3908
+
3909
+		                                     var rowMessageArrAddst = [];
3910
+
3911
+		                                     for (var q = nmbmsg; q >= clckNb * nmbToBeLoaded; q--) {
3912
+
3913
+		                                          rowMessageArrAddst.push(convDataprn[q]);
3914
+		                                     }
3915
+
3916
+					             var convDataPerNmbradst = rowMessageArrAddst.join("");
3917
+
3918
+		                                     var scrlheight = $("#msgListRowCell").height();
3919
+		                                     $("#msgListRowCell").prepend(convDataPerNmbradst);
3920
+
3921
+		                                     $("#frmMsgLstWrap").animate({scrollTop: $("#msgListRowCell").height() - scrlheight}, 0);
3922
+		                                 });
3923
+
3924
+
3925
+					         $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
3926
+					         $("#diplNmAllMsg").css("color", "#04957b");
3927
+					         $(this).css("color", "#1b8efe");
3928
+					     });
3929
+
3930
+
3931
+					     // Show again all the messages sent/received to/from the clicked number
3932
+					     $("#diplNmAllMsg").click(function() {
3933
+
3934
+		                                 $("#loadMoreMsgsusr").css("display", "none");
3935
+
3936
+		                                 var convDataprn = [];
3937
+		                                 $.each(messagesPerNmbr[clckPhNumber], function(index, item) {
3938
+		                                        convDataprn.push(item);
3939
+		                                 });
3940
+
3941
+		                                 // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
3942
+		                                 if (convDataprn.length > nmbTblDefault) {
3943
+		                                     $("#loadMoreMsgs").css("display", "block");
3944
+		                                     var nmbToBeLoaded = nmbTblDefault;
3945
+		                                 } else {
3946
+		                                     $("#loadMoreMsgs").css("display", "none");
3947
+		                                     var nmbToBeLoaded = convDataprn.length;
3948
+		                                 }
3949
+
3950
+					         var rowMessageArrprnst = [];
3951
+
3952
+					         for (var n = nmbToBeLoaded - 1; n >= 0; n--) {
3953
+		                                      rowMessageArrprnst.push(convDataprn[n]);
3954
+					         }
3955
+
3956
+					         var convDataPerNmbrprnst = rowMessageArrprnst.join("");
3957
+
3958
+		                                 $("#msgListRowCell").empty();
3959
+		                                 $("#msgListRowCell").append(convDataPerNmbrprnst);
3960
+
3961
+		                                 // Scroll down to the bottom of the window
3962
+		                                 $("#frmMsgLstWrap").animate({scrollTop:$("#frmMsgLstTbl").prop("scrollHeight")},200);
3963
+
3964
+
3965
+		                                 // Load more messages
3966
+		                                 var clckNb = 0;
3967
+		                                 $("#loadMoreMsgs").unbind("click");
3968
+		                                 $("#loadMoreMsgs").click(function() {
3969
+
3970
+		                                     clckNb++;
3971
+		                                     var crefnb = (clckNb + 1) * nmbToBeLoaded;
3972
+
3973
+		                                     $("#loadMoreMsgsusr").css("display", "none");
3974
+
3975
+		                                     if (crefnb > convDataprn.length) {
3976
+		                                         var nmbmsg = convDataprn.length - 1;
3977
+		                                         $("#loadMoreMsgs").css("display", "none");
3978
+		                                     } else {
3979
+		                                         var nmbmsg = crefnb - 1;
3980
+		                                         $("#loadMoreMsgs").css("display", "block");
3981
+		                                     }
3982
+
3983
+		                                     var rowMessageArrAddst = [];
3984
+
3985
+		                                     for (var q = nmbmsg; q >= clckNb * nmbToBeLoaded; q--) {
3986
+
3987
+		                                          rowMessageArrAddst.push(convDataprn[q]);
3988
+		                                     }
3989
+
3990
+					             var convDataPerNmbradst = rowMessageArrAddst.join("");
3991
+
3992
+		                                     var scrlheight = $("#msgListRowCell").height();
3993
+		                                     $("#msgListRowCell").prepend(convDataPerNmbradst);
3994
+
3995
+		                                     $("#frmMsgLstWrap").animate({scrollTop: $("#msgListRowCell").height() - scrlheight}, 0);
3996
+		                                 });
3997
+
3998
+
3999
+					         $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
4000
+					         $("#diplNmAllMsg").css("color", "#04957b");
4001
+					         $(this).css("color", "#04c6a4");
4002
+					     });
4003
+
4004
+
4005
+					     // Show the scroll-up arrow
4006
+					     $("#frmMsgLstWrap").scroll(function() {
4007
+						if ($(this).scrollTop() > 900) {
4008
+						      $('#upArrowSmall').fadeIn();
4009
+						} else {
4010
+						      $('#upArrowSmall').fadeOut();
4011
+						}
4012
+					     });
4013
+
4014
+					     $("#upArrowSmall").unbind("click");
4015
+					     $("#upArrowSmall").click(function() {
4016
+						$("#frmMsgLstWrap").animate({scrollTop : 0},400);
4017
+					     });
4018
+
4019
+
4020
+					     // Download MMS files when clicking on their URLs
4021
+					     $('[id^="mmsTblUrl-"]').on('click', function(evt) {
4022
+
4023
+					        var clckedUrl = $(this).text();
4024
+					        var flNamearr = clckedUrl.split("/");
4025
+					        var flName = flNamearr.reverse()[0];
4026
+
4027
+					        confirmAlert("Download this file only if you trust the sender and the domain of the URL.");
4028
+
4029
+					        $("#confirmOk").click(function() {
4030
+
4031
+					           $("#alertMsgOverlay").remove();
4032
+					           $("#alertConfMessage").remove();
4033
+
4034
+					           var mmsLink = document.createElement("a");
4035
+					           mmsLink.setAttribute('href', clckedUrl);
4036
+					           mmsLink.setAttribute('download', flName);
4037
+                                                   mmsLink.setAttribute('target', '_blank');
4038
+					           document.body.appendChild(mmsLink);
4039
+					           mmsLink.click();
4040
+					           mmsLink.remove();
4041
+					        });
4042
+
4043
+					        $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
4044
+					     });
4045
+
4046
+				  },
4047
+				  error: function() {
4048
+					     showAlert("Error while attempting to get message data from the database!");
4049
+					     $('#listAllMsgsFromTo').removeClass('icon-loading');
4050
+				  }
4051
+			   });
4052
+                   }
4053
+
4054
+                   getMsgsPerNmbrSec(clckPhNumber);
4055
+
4056
+                   $("#refreshMsgsConvtf").click(function() { getMsgsPerNmbrSec(clckPhNumber); setTimeout(function() { $("#diplNmAllMsg").click(); }, 1000); });
4057
+                }
4058
+
4059
+
4060
+                $('[id^="showMsgFrom-"]').click(function() {
4061
+
4062
+                   var ctrwnb = $(this).attr("id").replace("showMsgFrom-", "");
4063
+                   if ($("#frmNmbr-"+ ctrwnb).text().indexOf(":") > -1) {
4064
+                       var clckPhNumber = $("#frmNmbr-"+ ctrwnb).text().split(": ")[1];
4065
+                   } else { var clckPhNumber = $("#frmNmbr-"+ ctrwnb).text(); }
4066
+
4067
+                   showMsgPerNmbr(clckPhNumber);
4068
+                })
4069
+
4070
+                $('[id^="showMsgTo-"]').click(function() {
4071
+                   var ctrwnbTo = $(this).attr("id").replace("showMsgTo-", "");
4072
+                   var clckPhNbTo = $("#toNmbr-"+ ctrwnbTo).text();
4073
+
4074
+                   showMsgPerNmbr(clckPhNbTo);
4075
+                })
4076
+
4077
+
4078
+                // Add pagination
4079
+                var rowsShown = messagesperpage;
4080
+                var rowsTotal = $("#sentSmsTable tr").length;
4081
+                var numPages = (rowsTotal - 2) / rowsShown;
4082
+
4083
+                for (i = 0; i < numPages; i++) {
4084
+                     var pageNum = i + 1;
4085
+                     $('#paginationsent').append('<a href="#" rel="' + i + '" class="pagenumbers">' + pageNum + '</a> ');
4086
+                }
4087
+
4088
+                $('#paginationsent').children(":first").addClass('active');
4089
+
4090
+                $('#paginationsent a:first').addClass('active');
4091
+
4092
+                // Show table page when clicking on page number
4093
+                $('.pages a').bind('click', function () {
4094
+
4095
+                      $('#paginationsent').children().removeClass('active');
4096
+
4097
+                      $(this).addClass('active');
4098
+
4099
+                      var currentsentPgNo = $(this).text();
4100
+
4101
+                      $('#paginationsent a').each(function() {
4102
+                         if ($(this).text() == currentsentPgNo) {
4103
+                             $(this).addClass('active');
4104
+                         }
4105
+                      });
4106
+
4107
+                      // Sort table rows
4108
+		      var rows = $('#sentSmsTable tr').get();
4109
+
4110
+		      rows.sort(function(a, b) {
4111
+
4112
+		           var A = parseInt($('td.sentdbidcolumn', a).text());
4113
+		           var B = parseInt($('td.sentdbidcolumn', b).text());
4114
+
4115
+		           if (A < B) {
4116
+		               return -1;
4117
+		           }
4118
+
4119
+		           if (A > B) {
4120
+		               return 1;
4121
+		           }
4122
+
4123
+		           return 0;
4124
+		      });
4125
+
4126
+		      $.each(rows, function(index, row) {
4127
+		         $('#sentSmsTable').append(row);
4128
+		      });
4129
+
4130
+                      var currPage = $(this).attr('rel');
4131
+                      var startItem = currPage * rowsShown;
4132
+                      var endItem = startItem + rowsShown;
4133
+
4134
+                      $('.sentrowsbody').hide().slice(startItem, endItem).css('display', 'table-row');
4135
+
4136
+                      $('#totalsentmessages').remove();
4137
+                      $('#smstables').append("<div id='totalsentmessages'>Total displayed messages: " + sentparseddata.length + "</div>");
4138
+                });
4139
+
4140
+                $('#paginationsent').children(":last").trigger('click');
4141
+
4142
+                // Select all records
4143
+                $('#selectAllChckbx').change(function() {
4144
+                   if ($(this).is(':checked')) {
4145
+                       $(".indivchckbx").prop("checked", true);
4146
+                   } else {
4147
+                       $(".indivchckbx").prop("checked", false);
4148
+                   }
4149
+                });
4150
+
4151
+                function reorderSentRows() {
4152
+                    var currenttext = $(".filterbuttonsent").closest('[class="filterbuttonsent"]').find('[class="indivfiltersent"]').text();
4153
+                    if (currenttext == '') {
4154
+                        $('tr').sort(function (a, b) {
4155
+                           return parseInt($('td.sentdbidcolumn', b).text()) < parseInt($('td.sentdbidcolumn', a).text());
4156
+                        }).appendTo("#sentSmsTable");
4157
+                    }
4158
+                }
4159
+
4160
+                // Filter rows
4161
+                $("#databaseidfilter").on("click", function(event) {
4162
+
4163
+                       var databaseId = $("#dbidtextsent").val();
4164
+                       var msgrowsNo = 0;
4165
+
4166
+                       $(".sentrowsbody").each(function() {
4167
+
4168
+                          var checkEmpty = 0;
4169
+                          $(".indivfiltersent").not("#dbidtextsent").each(function() {
4170
+                              if ($(this).val() != '') {
4171
+                                  checkEmpty = 1;
4172
+                              }
4173
+                          });
4174
+
4175
+                          if (checkEmpty == 0) {
4176
+                              $(this).show();
4177
+                          }
4178
+
4179
+                          if (databaseId != '') {
4180
+                             if ($(this).find('[class="sentdbidcolumn"]').text() == databaseId) {
4181
+                                 $("#sentSmsTable").append(this);
4182
+                                 if ($(this).is(":visible")) { msgrowsNo++; }
4183
+                             } else {
4184
+                                 $(this).hide();
4185
+                             }
4186
+                          } else {
4187
+                                 $(this).show();
4188
+                                 msgrowsNo++;
4189
+                          }
4190
+                       });
4191
+
4192
+                       reorderSentRows();
4193
+                       $('#totalsentmessages').remove();
4194
+                       $('#smstables').append("<div id='totalsentmessages'>Total filtered messages: " + msgrowsNo + "</div>");
4195
+                });
4196
+
4197
+                $("#useridfilter").on("click", function(event) {
4198
+
4199
+                       var useridtxt = $("#useridtext").val().toLowerCase();
4200
+                       var msgrowsNo = 0;
4201
+
4202
+                       $(".sentrowsbody").each(function() {
4203
+
4204
+                          var checkEmpty1 = 0;
4205
+                          $(".indivfiltersent").not("#useridtext").each(function() {
4206
+                              if ($(this).val() != '') {
4207
+                                  checkEmpty1 = 1;
4208
+                              }
4209
+                          });
4210
+
4211
+                          if (checkEmpty1 == 0) {
4212
+                              $(this).show();
4213
+                          }
4214
+
4215
+                          if (useridtxt != '') {
4216
+                              var founduserid = $(this).find('[class="useridcolsent"]').text().toLowerCase();
4217
+                              if (founduserid.indexOf(useridtxt) != -1) {
4218
+                                  $("#sentSmsTable").append(this);
4219
+                                  if ($(this).is(":visible")) { msgrowsNo++; }
4220
+                             } else {
4221
+                                  $(this).hide();
4222
+                             }
4223
+                          } else {
4224
+                                  $(this).show();
4225
+                                  msgrowsNo++;
4226
+                          }
4227
+                       });
4228
+
4229
+                       reorderSentRows();
4230
+                       $('#totalsentmessages').remove();
4231
+                       $('#smstables').append("<div id='totalsentmessages'>Total filtered messages: " + msgrowsNo + "</div>");
4232
+                });
4233
+
4234
+                $("#messageidfilter").on("click", function(event) {
4235
+
4236
+                       var messageidtxt = $("#messageidtext").val().toLowerCase();
4237
+                       var msgrowsNo = 0;
4238
+
4239
+                       $(".sentrowsbody").each(function() {
4240
+
4241
+                          var checkEmpty2 = 0;
4242
+                          $(".indivfiltersent").not("#messageidtext").each(function() {
4243
+                              if ($(this).val() != '') {
4244
+                                  checkEmpty2 = 1;
4245
+                              }
4246
+                          });
4247
+
4248
+                          if (checkEmpty2 == 0) {
4249
+                              $(this).show();
4250
+                          }
4251
+
4252
+                          if (messageidtxt != '') {
4253
+                              var foundtdmssgid = $(this).find('[class="messageidcolsent"]').text().toLowerCase();
4254
+                              if (foundtdmssgid.indexOf(messageidtxt) != -1) {
4255
+                                  $("#sentSmsTable").append(this);
4256
+                                  if ($(this).is(":visible")) { msgrowsNo++; }
4257
+                              } else {
4258
+                                  $(this).hide();
4259
+                              }
4260
+                          } else {
4261
+                                  $(this).show();
4262
+                                  msgrowsNo++;
4263
+                          }
4264
+                       });
4265
+
4266
+                       reorderSentRows();
4267
+                       $('#totalsentmessages').remove();
4268
+                       $('#smstables').append("<div id='totalsentmessages'>Total filtered messages: " + msgrowsNo + "</div>");
4269
+                });
4270
+
4271
+                $("#datefilter").on("click", function(event) {
4272
+
4273
+                       var datetxtvr = $("#datetext").val().toLowerCase();
4274
+                       var msgrowsNo = 0;
4275
+
4276
+                       $(".sentrowsbody").each(function() {
4277
+
4278
+                          var checkEmpty3 = 0;
4279
+                          $(".indivfiltersent").not("#datetext").each(function() {
4280
+                              if ($(this).val() != '') {
4281
+                                  checkEmpty3 = 1;
4282
+                              }
4283
+                          });
4284
+
4285
+                          if (checkEmpty3 == 0) {
4286
+                              $(this).show();
4287
+                          }
4288
+
4289
+                          if (datetxtvr != '') {
4290
+                             var founddate = $(this).find('[class="datecolsent"]').text().toLowerCase();
4291
+                             if (founddate.indexOf(datetxtvr) != -1) {
4292
+                                 $("#sentSmsTable").append(this);
4293
+                                 if ($(this).is(":visible")) { msgrowsNo++; }
4294
+                             } else {
4295
+                                 $(this).hide();
4296
+                             }
4297
+                          } else {
4298
+                                 $(this).show();
4299
+                                 msgrowsNo++;
4300
+                          }
4301
+                       });
4302
+
4303
+                       reorderSentRows();
4304
+                       $('#totalsentmessages').remove();
4305
+                       $('#smstables').append("<div id='totalsentmessages'>Total filtered messages: " + msgrowsNo + "</div>");
4306
+                });
4307
+
4308
+                $("#fromfilter").on("click", function(event) {
4309
+
4310
+                       var fromtxtvr = $("#fromtext").val().toLowerCase();
4311
+                       var msgrowsNo = 0;
4312
+
4313
+                       $(".sentrowsbody").each(function() {
4314
+
4315
+                          var checkEmpty4 = 0;
4316
+                          $(".indivfiltersent").not("#fromtext").each(function() {
4317
+                              if ($(this).val() != '') {
4318
+                                  checkEmpty4 = 1;
4319
+                              }
4320
+                          });
4321
+
4322
+                          if (checkEmpty4 == 0) {
4323
+                              $(this).show();
4324
+                          }
4325
+
4326
+                          if (fromtxtvr != '') {
4327
+                             var foundfrom = $(this).find('[class="fromcolumnsent"]').text().toLowerCase();
4328
+                             if (foundfrom.indexOf(fromtxtvr) != -1) {
4329
+                                 $("#sentSmsTable").append(this);
4330
+                                 if ($(this).is(":visible")) { msgrowsNo++; }
4331
+                             } else {
4332
+                                 $(this).hide();
4333
+                             }
4334
+                          } else {
4335
+                                 $(this).show();
4336
+                                 msgrowsNo++;
4337
+                          }
4338
+                       });
4339
+
4340
+                       reorderSentRows();
4341
+                       $('#totalsentmessages').remove();
4342
+                       $('#smstables').append("<div id='totalsentmessages'>Total filtered messages: " + msgrowsNo + "</div>");
4343
+                });
4344
+
4345
+                $("#tofilter").on("click", function(event) {
4346
+
4347
+                      var totxtvr = $("#totext").val().toLowerCase();
4348
+                      var msgrowsNo = 0;
4349
+
4350
+                      $(".sentrowsbody").each(function() {
4351
+
4352
+                          var checkEmpty5 = 0;
4353
+                          $(".indivfiltersent").not("#totext").each(function() {
4354
+                              if ($(this).val() != '') {
4355
+                                  checkEmpty5 = 1;
4356
+                              }
4357
+                          });
4358
+
4359
+                          if (checkEmpty5 == 0) {
4360
+                              $(this).show();
4361
+                          }
4362
+
4363
+                          if (totxtvr != '') {
4364
+                             var foundto = $(this).find('[class="tocolumnsent"]').text().toLowerCase();
4365
+                             if (foundto.indexOf(totxtvr) != -1) {
4366
+                                 $("#sentSmsTable").append(this);
4367
+                                 if ($(this).is(":visible")) { msgrowsNo++; }
4368
+                             } else {
4369
+                                 $(this).hide();
4370
+                             }
4371
+                          } else {
4372
+                                 $(this).show();
4373
+                                 msgrowsNo++;
4374
+                          }
4375
+                      });
4376
+
4377
+                      reorderSentRows();
4378
+                      $('#totalsentmessages').remove();
4379
+                      $('#smstables').append("<div id='totalsentmessages'>Total filtered messages: " + msgrowsNo + "</div>");
4380
+                });
4381
+
4382
+                $("#networkfilter").on("click", function(event) {
4383
+
4384
+                      var networktxtvr = $("#networktext").val().toLowerCase();
4385
+                      var msgrowsNo = 0;
4386
+
4387
+                      $(".sentrowsbody").each(function() {
4388
+
4389
+                          var checkEmpty6 = 0;
4390
+                          $(".indivfiltersent").not("#networktext").each(function() {
4391
+                              if ($(this).val() != '') {
4392
+                                  checkEmpty6 = 1;
4393
+                              }
4394
+                          });
4395
+
4396
+                          if (checkEmpty6 == 0) {
4397
+                              $(this).show();
4398
+                          }
4399
+
4400
+                          if (networktxtvr != '') {
4401
+                              var foundnetwork = $(this).find('[class="networkNmContent"]').text().toLowerCase();
4402
+                              if (foundnetwork.indexOf(networktxtvr) != -1) {
4403
+                                  $("#sentSmsTable").append(this);
4404
+                                  if ($(this).is(":visible")) { msgrowsNo++; }
4405
+                              } else {
4406
+                                  $(this).hide();
4407
+                              }
4408
+                          } else {
4409
+                                  $(this).show();
4410
+                                  msgrowsNo++;
4411
+                          }
4412
+                      });
4413
+
4414
+                      reorderSentRows();
4415
+                      $('#totalsentmessages').remove();
4416
+                      $('#smstables').append("<div id='totalsentmessages'>Total filtered messages: " + msgrowsNo + "</div>");
4417
+                });
4418
+
4419
+                $("#pricefilter").on("click", function(event) {
4420
+
4421
+                      var pricetxtvr = $("#pricetext").val().toLowerCase();
4422
+                      var msgrowsNo = 0;
4423
+
4424
+                      $(".sentrowsbody").each(function() {
4425
+
4426
+                          var checkEmpty7 = 0;
4427
+                          $(".indivfiltersent").not("#pricetext").each(function() {
4428
+                              if ($(this).val() != '') {
4429
+                                  checkEmpty7 = 1;
4430
+                              }
4431
+                          });
4432
+
4433
+                          if (checkEmpty7 == 0) {
4434
+                              $(this).show();
4435
+                          }
4436
+
4437
+                          if (pricetxtvr != '') {
4438
+                              var foundprice = $(this).find('[class="pricecolumnsent"]').text().toLowerCase();
4439
+                              if (foundprice.indexOf(pricetxtvr) != -1) {
4440
+                                  $("#sentSmsTable").append(this);
4441
+                                  if ($(this).is(":visible")) { msgrowsNo++; }
4442
+                              } else {
4443
+                                  $(this).hide();
4444
+                              }
4445
+                          } else {
4446
+                                  $(this).show();
4447
+                                  msgrowsNo++;
4448
+                          }
4449
+                      });
4450
+
4451
+                      reorderSentRows();
4452
+                      $('#totalsentmessages').remove();
4453
+                      $('#smstables').append("<div id='totalsentmessages'>Total filtered messages: " + msgrowsNo + "</div>");
4454
+                });
4455
+
4456
+                $("#statusfilter").on("click", function(event) {
4457
+
4458
+                      var statustxtvr = $("#statustext").val().toLowerCase();
4459
+                      var msgrowsNo = 0;
4460
+
4461
+                      $(".sentrowsbody").each(function() {
4462
+
4463
+                          var checkEmpty8 = 0;
4464
+                          $(".indivfiltersent").not("#statustext").each(function() {
4465
+                              if ($(this).val() != '') {
4466
+                                  checkEmpty8 = 1;
4467
+                              }
4468
+                          });
4469
+
4470
+                          if (checkEmpty8 == 0) {
4471
+                              $(this).show();
4472
+                          }
4473
+
4474
+                          if (statustxtvr != '') {
4475
+                              var foundstatus = $(this).find('[class="statuscolumnsent"]').text().toLowerCase();
4476
+                              if (foundstatus.indexOf(statustxtvr) != -1) {
4477
+                                  $("#sentSmsTable").append(this);
4478
+                                  if ($(this).is(":visible")) { msgrowsNo++; }
4479
+                              } else {
4480
+                                  $(this).hide();
4481
+                              }
4482
+                          } else {
4483
+                                  $(this).show();
4484
+                                  msgrowsNo++;
4485
+                          }
4486
+                      });
4487
+
4488
+                      reorderSentRows();
4489
+                      $('#totalsentmessages').remove();
4490
+                      $('#smstables').append("<div id='totalsentmessages'>Total filtered messages: " + msgrowsNo + "</div>");
4491
+                });
4492
+
4493
+                $("#deliveryrecfilter").on("click", function(event) {
4494
+
4495
+                      var deliverytxtvr = $("#deliveryrcpttext").val().toLowerCase();
4496
+                      var msgrowsNo = 0;
4497
+
4498
+                      $(".sentrowsbody").each(function() {
4499
+
4500
+                          var checkEmpty9 = 0;
4501
+                          $(".indivfiltersent").not("#deliveryrcpttext").each(function() {
4502
+                              if ($(this).val() != '') {
4503
+                                  checkEmpty9 = 1;
4504
+                              }
4505
+                          });
4506
+
4507
+                          if (checkEmpty9 == 0) {
4508
+                              $(this).show();
4509
+                          }
4510
+
4511
+                          if (deliverytxtvr != '') {
4512
+                              var founddeliveryrcpt = $(this).find('[class="deliveryrcptcolsent"]').text().toLowerCase();
4513
+                              if (founddeliveryrcpt.indexOf(deliverytxtvr) != -1) {
4514
+                                  $("#sentSmsTable").append(this);
4515
+                                  if ($(this).is(":visible")) { msgrowsNo++; }
4516
+                              } else {
4517
+                                  $(this).hide();
4518
+                              }
4519
+                          } else {
4520
+                                  $(this).show();
4521
+                                  msgrowsNo++;
4522
+                          }
4523
+                      });
4524
+
4525
+                      reorderSentRows();
4526
+                      $('#totalsentmessages').remove();
4527
+                      $('#smstables').append("<div id='totalsentmessages'>Total filtered messages: " + msgrowsNo + "</div>");
4528
+                });
4529
+
4530
+                $("#messagefilter").on("click", function(event) {
4531
+
4532
+                      var messagetxtvr = $("#messagetext").val().toLowerCase();
4533
+                      var msgrowsNo = 0;
4534
+
4535
+                      $(".sentrowsbody").each(function() {
4536
+
4537
+                          var checkEmpty10 = 0;
4538
+                          $(".indivfiltersent").not("#messagetext").each(function() {
4539
+                              if ($(this).val() != '') {
4540
+                                  checkEmpty10 = 1;
4541
+                              }
4542
+                          });
4543
+
4544
+                          if (checkEmpty10 == 0) {
4545
+                              $(this).show();
4546
+                          }
4547
+
4548
+                          if (messagetxtvr != '') {
4549
+                              var foundmessage = $(this).find('[class="messagecolumnsent"]').text().toLowerCase();
4550
+                              if (foundmessage.indexOf(messagetxtvr) != -1) {
4551
+                                  $("#sentSmsTable").append(this);
4552
+                                  if ($(this).is(":visible")) { msgrowsNo++; }
4553
+                              } else {
4554
+                                  $(this).hide();
4555
+                              }
4556
+                          } else {
4557
+                                  $(this).show();
4558
+                                  msgrowsNo++;
4559
+                          }
4560
+                      });
4561
+
4562
+                      reorderSentRows();
4563
+                      $('#totalsentmessages').remove();
4564
+                      $('#smstables').append("<div id='totalsentmessages'>Total filtered messages: " + msgrowsNo + "</div>");
4565
+                });
4566
+
4567
+                // Clear all filters
4568
+                $("#clearsentfilters").on("click", function(event) {
4569
+                       $(".sentrowsbody").each(function() {
4570
+                          $(this).show();
4571
+                       });
4572
+                       $(".indivfiltersent").val("");
4573
+                       $('#totalsentmessages').remove();
4574
+                       $('#smstables').append("<div id='totalsentmessages'>Total displayed messages: " + sentparseddata.length + "</div>");
4575
+                });
4576
+
4577
+                // Delete selected rows from the database
4578
+                $("#deletesentrows").on("click", function() {
4579
+
4580
+                   var checkcheckbx = $("#sentSmsTable input[type=checkbox]:checked").length;
4581
+                   if (checkcheckbx == 0) {
4582
+                       showAlert("Please select the row(s) to permanently delete from the database !");
4583
+                   } else {
4584
+                          var sentcheckboxIds = [];
4585
+                          $(".sentrowsbody").each(function() {
4586
+                             var sentrowcheckbx = $(this).find('input[type="checkbox"]');
4587
+                             if (sentrowcheckbx.is(":checked")) {
4588
+                                 var dbrowid = $(this).find('[class="sentdbidcolumn"]').text() + "|" + $(this).find('[class="messageidcolsent"]').text();
4589
+                                 sentcheckboxIds.push(dbrowid);
4590
+                             }
4591
+                          });
4592
+
4593
+		          confirmAlert("Please note that the row(s) you selected will be permanently deleted from the database, without being saved before removal. This action cannot be undone ! If you really want to permanently delete the selected row(s) press 'OK'.");
4594
+
4595
+		          $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
4596
+
4597
+		          $("#confirmOk").click(function() {
4598
+
4599
+		              $("#alertMsgOverlay").remove();
4600
+		              $("#alertConfMessage").remove();
4601
+
4602
+                              var deletesentRowsUrl = OC.generateUrl("/apps/sms_relentless/user/removesentrows");
4603
+                              $('#smstables').addClass('icon-loading');
4604
+
4605
+                              $.ajax({
4606
+                                   url: deletesentRowsUrl + '/' + userid,
4607
+                                   type: "POST",
4608
+                                   data: { "sentmessagedbIDs": sentcheckboxIds },
4609
+                                   success: function(delmsgsent) {
4610
+				            $('#smstables').removeClass('icon-loading');
4611
+                                            if (delmsgsent == "success") {
4612
+                                                showAlert("The row(s) have been deleted successfully !");
4613
+                                                $('#sentsmstableshow').click();
4614
+                                            } else if (delmsgsent == "not allowed") {
4615
+                                                showAlert("At least one message couldn't be deleted because of permission issues. Non-admin users can delete the messages sent/received from/on the numbers shared with them only if they are allowed by an admin.");
4616
+                                            } else {
4617
+                                                showAlert("There was an error while deleting the selected row(s) !");
4618
+                                            }
4619
+                                   },
4620
+                                   error: function() {
4621
+                                            $('#smstables').removeClass('icon-loading');
4622
+                                            showAlert("There was an error while attempting to delete the selected row(s) !");
4623
+                                   }
4624
+                              });
4625
+                          });
4626
+                    }
4627
+                });
4628
+
4629
+                // Show/Hide filter row
4630
+	        $('#sentarrow').on('click', function() {
4631
+	           if ($('#sentfiltersrow').is(':visible')) {
4632
+		       $('#sentfiltersrow').hide();
4633
+                       $('#sentheaderrow').css('top', '0px');
4634
+                       $(this).removeClass('arrowUpCl');
4635
+                       $(this).addClass('arrowDownCl');
4636
+		   } else {
4637
+		       $('#sentfiltersrow').show();
4638
+                       $('#sentheaderrow').css('top', '158px');
4639
+                       $(this).removeClass('arrowDownCl');
4640
+                       $(this).addClass('arrowUpCl');
4641
+                   }
4642
+                });
4643
+
4644
+                $("#app-content").animate({scrollTop:$("#sentSmsTable").prop("scrollHeight")},200);
4645
+
4646
+
4647
+                // Download MMS files when clicking on their URLs
4648
+                $('[id^="mmsTblUrl-"]').on('click', function(evt) {
4649
+
4650
+                   var clckedUrl = $(this).text();
4651
+                   var flNamearr = clckedUrl.split("/");
4652
+                   var flName = flNamearr.reverse()[0];
4653
+
4654
+                   confirmAlert("Download this file only if you trust the sender and the domain of the URL.");
4655
+
4656
+		   $("#confirmOk").click(function() {
4657
+
4658
+                      $("#alertMsgOverlay").remove();
4659
+		      $("#alertConfMessage").remove();
4660
+
4661
+		      var mmsLink = document.createElement("a");
4662
+		      mmsLink.setAttribute('href', clckedUrl);
4663
+		      mmsLink.setAttribute('download', flName);
4664
+                      mmsLink.setAttribute('target', '_blank');
4665
+		      document.body.appendChild(mmsLink);
4666
+		      mmsLink.click();
4667
+		      mmsLink.remove();
4668
+                   });
4669
+
4670
+		   $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
4671
+                });
4672
+
4673
+          },
4674
+          error: function() {
4675
+                showAlert("Error! You can check the Nextcloud log to find more details about this issue.");
4676
+                $('#smstables').removeClass('icon-loading');
4677
+          }
4678
+     });
4679
+
4680
+     // Look for the 'new received message' indicator in the database, to know if the received messages list needs to be refreshed
4681
+     intervalNmfr = setInterval(function() { checkIfNewMessage(); }, newMsgInterval);
4682
+
4683
+     // Show the auto-refresh button
4684
+     $("#stopAutoRefreshSent").css("display", "inline-block");
4685
+
4686
+  });
4687
+
4688
+
4689
+  // List conversations
4690
+  $("#conversationsshow").on("click", function(event) {
4691
+
4692
+     $('#smstables').empty();
4693
+     $("#stopAutoRefreshSent").css("display", "none");
4694
+     clearInterval(intervalNmfr);
4695
+     $('#smstables').append("<table id='conversationsTable'><tr><td><div id='convArchAndActive'></div></td><td><div id='conversationsText'></div></td></tr></table>");
4696
+     $("#conversationsTable").css({ "width" : $("#smstables").width(), "height" : $("#smstables").height() - 10 });
4697
+     $("#convArchAndActive").css({ "width" : $("#conversationsTable").width() * 0.25, "height" : $("#conversationsTable").height() });
4698
+     $("#conversationsText").css({ "width" : $("#conversationsTable").width() * 0.74, "height" : $("#conversationsTable").height() });
4699
+     $("#conversationsText").append("<div id='convImgGrey'><img src='/" + ctappdir + "/sms_relentless/img/conversations.svg'></div>");
4700
+     $("#convImgGrey").css({ "top" : $("#conversationsTable").height() * 0.5 - 109, "left" : $("#conversationsTable").width() * 0.63 - 144 });
4701
+     $("#convTextHeader").css("width", $("#conversationsTable").width() * 0.74);
4702
+
4703
+     var getConvUrl = OC.generateUrl("/apps/sms_relentless/user/getconversations");
4704
+     $('#smstables').addClass('icon-loading');
4705
+
4706
+     $.ajax({
4707
+          url: getConvUrl + '/' + userid,
4708
+          method: 'GET',
4709
+          contentType: 'application/json',
4710
+          success: function(convdatafdb) {
4711
+
4712
+                     $('#smstables').removeClass('icon-loading');
4713
+                     if (convdatafdb.length == 0) { showAlert("The conversations list is empty. It will be populated after you'll send messages."); }
4714
+
4715
+		     let convArchived = [];
4716
+                     let convActive = [];
4717
+
4718
+		     for (let c = 0; c < convdatafdb.length; c++) {
4719
+                          if (convdatafdb[c]['archived'] == 1) {
4720
+                              convArchived.push({
4721
+                                'conversation_id': convdatafdb[c]['conversation_id'],
4722
+                                'archived': convdatafdb[c]['archived'],
4723
+                                'last_archived': convdatafdb[c]['last_archived'],
4724
+                                'last_unarchived': convdatafdb[c]['last_unarchived'],
4725
+                                'archived_by': convdatafdb[c]['archived_by'],
4726
+                                'unarchived_by': convdatafdb[c]['unarchived_by'],
4727
+                                'last_msg_date': convdatafdb[c]['last_msg_date'],
4728
+                                'last_msg_from': convdatafdb[c]['last_msg_from'],
4729
+                                'last_msg_to': convdatafdb[c]['last_msg_to'],
4730
+                                'last_message': convdatafdb[c]['last_message'],
4731
+                                'lastmsgdisplayname': convdatafdb[c]['lastmsgdisplayname'],
4732
+                                'flagged': convdatafdb[c]['flagged'],
4733
+                                'flagunflagby': convdatafdb[c]['flagunflagby'],
4734
+                                'flagunflagdate': convdatafdb[c]['flagunflagdate'],
4735
+                                'tag': (convdatafdb[c]['tag'] != null)? convdatafdb[c]['tag'] : "",
4736
+                                'taguntagby': convdatafdb[c]['taguntagby'],
4737
+                                'taguntagdate': convdatafdb[c]['taguntagdate'],
4738
+                                'description': (convdatafdb[c]['description'] != null)? convdatafdb[c]['description'] : "",
4739
+                                'descriptionby': convdatafdb[c]['descriptionby'],
4740
+                                'descriptiondate': convdatafdb[c]['descriptiondate']
4741
+                              });
4742
+                          } else {
4743
+                              convActive.push({
4744
+                                'conversation_id': convdatafdb[c]['conversation_id'],
4745
+                                'archived': convdatafdb[c]['archived'],
4746
+                                'last_archived': convdatafdb[c]['last_archived'],
4747
+                                'last_unarchived': convdatafdb[c]['last_unarchived'],
4748
+                                'archived_by': convdatafdb[c]['archived_by'],
4749
+                                'unarchived_by': convdatafdb[c]['unarchived_by'],
4750
+                                'last_msg_date': convdatafdb[c]['last_msg_date'],
4751
+                                'last_msg_from': convdatafdb[c]['last_msg_from'],
4752
+                                'last_msg_to': convdatafdb[c]['last_msg_to'],
4753
+                                'last_message': convdatafdb[c]['last_message'],
4754
+                                'lastmsgdisplayname': convdatafdb[c]['lastmsgdisplayname'],
4755
+                                'flagged': convdatafdb[c]['flagged'],
4756
+                                'flagunflagby': convdatafdb[c]['flagunflagby'],
4757
+                                'flagunflagdate': convdatafdb[c]['flagunflagdate'],
4758
+                                'tag': (convdatafdb[c]['tag'] != null)? convdatafdb[c]['tag'] : "",
4759
+                                'taguntagby': convdatafdb[c]['taguntagby'],
4760
+                                'taguntagdate': convdatafdb[c]['taguntagdate'],
4761
+                                'description': (convdatafdb[c]['description'] != null)? convdatafdb[c]['description'] : "",
4762
+                                'descriptionby': convdatafdb[c]['descriptionby'],
4763
+                                'descriptiondate': convdatafdb[c]['descriptiondate']
4764
+                              });
4765
+                          }
4766
+                     }
4767
+
4768
+                     // Order the array of archived conversations by date
4769
+		     convArchived.sort(function(a, b) {
4770
+                          let c = new Date(a.last_msg_date);
4771
+                          let d = new Date(b.last_msg_date);
4772
+                          return c-d;
4773
+		     });
4774
+
4775
+                     // Order the array of active conversations by date
4776
+		     convActive.sort(function(a, b) {
4777
+                          let c = new Date(a.last_msg_date);
4778
+                          let d = new Date(b.last_msg_date);
4779
+                          return c-d;
4780
+		     });
4781
+
4782
+
4783
+                     // List the conversations 
4784
+                     var taggsArrin = [];
4785
+
4786
+	             if (archivedConvNmbr == 0) {
4787
+	                 // Don't list any archived conversations
4788
+	                 var archivedCvNb = 0;
4789
+
4790
+	             } else if (archivedConvNmbr != 0 && archivedConvNmbr != null) {
4791
+
4792
+                         var archCount = 0;
4793
+	                 let fcnv = (archivedConvNmbr <= convArchived.length)? convArchived.length - archivedConvNmbr : 0;
4794
+	                 for (let s = fcnv; s < convArchived.length; s++) {
4795
+
4796
+	                      var emptyRedFlags = (convArchived[s]['flagged'] == 1)? "cvFlagRed" : "cvFlagEmpty";
4797
+	                      if (convArchived[s]['tag'] != "") { var cvTagTxts = convArchived[s]['tag']; var cvTagAdds = "convTagAdded"; taggsArrin.push(convArchived[s]['tag']); } else { var cvTagTxts = ""; var cvTagAdds = "convTag"; }
4798
+	                      var cvDescAdds = (convArchived[s]['description'] != "")? "convDescAdded" : "convDesc";
4799
+	                      $("#convArchAndActive").append("<div class='convsListArch convsLst' id='indArchConv-"+ s +"'><div id='archivedImg-"+ s +"' class='archactImg archConvImg' data-conversationid='"+ convArchived[s]['conversation_id'] +"' data-archivedyesno='"+ convArchived[s]['archived'] +"' data-archdispname='"+ convArchived[s]['archived_by'] +"' data-unarchdispname='"+ convArchived[s]['unarchived_by'] +"' data-lastarchived='"+ convArchived[s]['last_archived'] +"' data-lastunarchived='"+ convArchived[s]['last_unarchived'] +"' data-convdescription='"+ convArchived[s]['description'] +"' data-convdescchangeby='"+ convArchived[s]['descriptionby'] +"' data-convdescchangedate='"+ convArchived[s]['descriptiondate'] +"' data-tag='"+ cvTagTxts +"' data-taguntagby='"+ convArchived[s]['taguntagby'] +"' data-taguntagdate='"+ convArchived[s]['taguntagdate'] +"' data-flagged='"+ convArchived[s]['flagged'] +"' data-flagunflagby='"+ convArchived[s]['flagunflagby'] +"' data-flagunflagdate='"+ convArchived[s]['flagunflagdate'] +"'><img src='/" + ctappdir + "/sms_relentless/img/archived.svg' title='Archived conversation'></div><div class='convLastMsgFrom' id='indArchCvFrom-"+ s +"'>From: "+ convArchived[s]['last_msg_from'] +"</div><div class='convLastMsgTo' id='indArchCvTo-"+ s +"'>To: "+ convArchived[s]['last_msg_to'] +"</div><div class='convLastMsg'><span class='msgAuthorNameConv'>"+ convArchived[s]['lastmsgdisplayname'] +":</span>"+ convArchived[s]['last_message'] +"</div><div class='dateSection'><div class='dateClock' title='Last message date. (Archived conversations are ordered by the date of the last message.)'></div><div class='convLastMsgDate'>"+ convArchived[s]['last_msg_date'] +"</div></div><div id='addArchDesc-"+ s +"' class='"+ cvDescAdds +"' title='Click to add or modify description.'></div><div id='addArchTag-"+ s +"' class='"+ cvTagAdds +"' title='Click to add or modify tag.'></div><div class='archactTag'>"+ cvTagTxts +"</div><div id='addArchFlag-"+ s +"' class='"+ emptyRedFlags +"' title='Click to set or remove flag.'></div></div>");
4800
+                              archCount++;
4801
+	                 }
4802
+	                 var archivedCvNb = archCount;
4803
+
4804
+	             } else {
4805
+
4806
+	                 for (let a = 0; a < convArchived.length; a++) {
4807
+
4808
+	                      var emptyRedFlaga = (convArchived[a]['flagged'] == 1)? "cvFlagRed" : "cvFlagEmpty";
4809
+	                      if (convArchived[a]['tag'] != "") { var cvTagTxta = convArchived[a]['tag']; var cvTagAdda = "convTagAdded"; taggsArrin.push(convArchived[a]['tag']); } else { var cvTagTxta = ""; var cvTagAdda = "convTag"; }
4810
+	                      var cvDescAdda = (convArchived[a]['description'] != "")? "convDescAdded" : "convDesc";
4811
+	                      $("#convArchAndActive").append("<div class='convsListArch convsLst' id='indArchConv-"+ a +"'><div id='archivedImg-"+ a +"' class='archactImg archConvImg' data-conversationid='"+ convArchived[a]['conversation_id'] +"' data-archivedyesno='"+ convArchived[a]['archived'] +"' data-archdispname='"+ convArchived[a]['archived_by'] +"' data-unarchdispname='"+ convArchived[a]['unarchived_by'] +"' data-lastarchived='"+ convArchived[a]['last_archived'] +"' data-lastunarchived='"+ convArchived[a]['last_unarchived'] +"' data-convdescription='"+ convArchived[a]['description'] +"' data-convdescchangeby='"+ convArchived[a]['descriptionby'] +"' data-convdescchangedate='"+ convArchived[a]['descriptiondate'] +"' data-tag='"+ cvTagTxta +"' data-taguntagby='"+ convArchived[a]['taguntagby'] +"' data-taguntagdate='"+ convArchived[a]['taguntagdate'] +"' data-flagged='"+ convArchived[a]['flagged'] +"' data-flagunflagby='"+ convArchived[a]['flagunflagby'] +"' data-flagunflagdate='"+ convArchived[a]['flagunflagdate'] +"'><img src='/" + ctappdir + "/sms_relentless/img/archived.svg' title='Archived conversation'></div><div class='convLastMsgFrom' id='indArchCvFrom-"+ a +"'>From: "+ convArchived[a]['last_msg_from'] +"</div><div class='convLastMsgTo' id='indArchCvTo-"+ a +"'>To: "+ convArchived[a]['last_msg_to'] +"</div><div class='convLastMsg'><span class='msgAuthorNameConv'>"+ convArchived[a]['lastmsgdisplayname'] +":</span>"+ convArchived[a]['last_message'] +"</div><div class='dateSection'><div class='dateClock' title='Last message date. (Archived conversations are ordered by the date of the last message.)'></div><div class='convLastMsgDate'>"+ convArchived[a]['last_msg_date'] +"</div></div><div id='addArchDesc-"+ a +"' class='"+ cvDescAdda +"' title='Click to add or modify description.'></div><div id='addArchTag-"+ a +"' class='"+ cvTagAdda +"' title='Click to add or modify tag.'></div><div class='archactTag'>"+ cvTagTxta +"</div><div id='addArchFlag-"+ a +"' class='"+ emptyRedFlaga +"' title='Click to set or remove flag.'></div></div>");
4812
+	                 }
4813
+	                 var archivedCvNb = convArchived.length;
4814
+	             }
4815
+
4816
+	             for (let t = 0; t < convActive.length; t++) {
4817
+
4818
+	                  var emptyRedFlagt = (convActive[t]['flagged'] == 1)? "cvFlagRed" : "cvFlagEmpty";
4819
+	                  if (convActive[t]['tag'] != "") { var cvTagTxtt = convActive[t]['tag']; var cvTagAddt = "convTagAdded"; taggsArrin.push(convActive[t]['tag']); } else { var cvTagTxtt = ""; var cvTagAddt = "convTag"; }
4820
+	                  var cvDescAddt = (convActive[t]['description'] != "")? "convDescAdded" : "convDesc";
4821
+	                  $("#convArchAndActive").append("<div class='convsListAct convsLst' id='indActConv-"+ t +"'><div id='activeImg-"+ t +"' class='archactImg activeConvImg' data-conversationid='"+ convActive[t]['conversation_id'] +"' data-archivedyesno='"+ convActive[t]['archived'] +"' data-archdispname='"+ convActive[t]['archived_by'] +"' data-unarchdispname='"+ convActive[t]['unarchived_by'] +"' data-lastarchived='"+ convActive[t]['last_archived'] +"' data-lastunarchived='"+ convActive[t]['last_unarchived'] +"' data-convdescription='"+ convActive[t]['description'] +"' data-convdescchangeby='"+ convActive[t]['descriptionby'] +"' data-convdescchangedate='"+ convActive[t]['descriptiondate'] +"' data-tag='"+ cvTagTxtt +"' data-taguntagby='"+ convActive[t]['taguntagby'] +"' data-taguntagdate='"+ convActive[t]['taguntagdate'] +"' data-flagged='"+ convActive[t]['flagged'] +"' data-flagunflagby='"+ convActive[t]['flagunflagby'] +"' data-flagunflagdate='"+ convActive[t]['flagunflagdate'] +"'><img src='/" + ctappdir + "/sms_relentless/img/active.svg' title='Active conversation'></div><div class='convLastMsgFrom' id='indActCvFrom-"+ t +"'>From: "+ convActive[t]['last_msg_from'] +"</div><div class='convLastMsgTo' id='indActCvTo-"+ t +"'>To: "+ convActive[t]['last_msg_to'] +"</div><div class='convLastMsg'><span class='msgAuthorNameConv'>"+ convActive[t]['lastmsgdisplayname'] +":</span>"+ convActive[t]['last_message'] +"</div><div class='dateSection'><div class='dateClock' title='Last message date. (Active conversations are ordered by the date of the last message.)'></div><div class='convLastMsgDate'>"+ convActive[t]['last_msg_date'] +"</div></div><div id='addActDesc-"+ t +"' class='"+ cvDescAddt +"' title='Click to add or modify description.'></div><div id='addActTag-"+ t +"' class='"+ cvTagAddt +"' title='Click to add or modify tag.'></div><div class='archactTag'>"+ cvTagTxtt +"</div><div id='addActFlag-"+ t +"' class='"+ emptyRedFlagt +"' title='Click to set or remove flag.'></div></div>");
4822
+	             }
4823
+
4824
+                     // Remove the duplicates from the tags array
4825
+                     function uniqueElem(value, index, array) { return array.indexOf(value) === index; }
4826
+                     var taggsArr = taggsArrin.filter(uniqueElem);
4827
+
4828
+	             // Add the row that specifies the number of conversations displayed
4829
+	             var totalConvNb = archivedCvNb + convActive.length;
4830
+	             $("#convArchAndActive").append("<div id='totalConvNmbr'>"+ totalConvNb +" conversations displayed (<span id='archivedCvImg' title='Archived conversations'></span>"+ archivedCvNb +"<span id='activeCvImg' title='Active conversations'></span>"+ convActive.length +" )</div>");
4831
+
4832
+		     // Remove the empty display names, if any
4833
+		     $(".msgAuthorNameConv").each(function() { if ($(this).text() == ":") { $(this).remove(); } });
4834
+
4835
+                     function convListContent() {
4836
+
4837
+		             // Scroll to the bottom of the conversations list
4838
+		             $("#convArchAndActive").animate({scrollTop: $("#convArchAndActive").prop("scrollHeight")}, 200);
4839
+
4840
+		             // Show all the content of the truncated messages when hovering over them
4841
+		             $(".convLastMsg").each(function() {
4842
+		                $(this).on("mouseenter", function() {
4843
+		                  $(this).css("-webkit-line-clamp", "none");
4844
+		                });
4845
+		                $(this).on("mouseleave", function() {
4846
+		                  $(this).css("-webkit-line-clamp", "3");
4847
+		                });
4848
+		             });
4849
+
4850
+		             // Show the pop-up window for adding or modifying the conversation description
4851
+		             $('[id^="addArchDesc-"],[id^="addActDesc-"]').click(function(evt) {
4852
+
4853
+		                evt.stopPropagation();
4854
+		                var conversationId = $(this).closest(".convsLst").find(".archactImg").data("conversationid");
4855
+		                var cvDesc = $(this).closest(".convsLst").find(".archactImg").data("convdescription");
4856
+		                var cvDescChangeBy = $(this).closest(".convsLst").find(".archactImg").data("convdescchangeby");
4857
+		                var cvDescChangeDate = $(this).closest(".convsLst").find(".archactImg").data("convdescchangedate");
4858
+		                var lstmsgFrom = $(this).closest(".convsLst").find(".convLastMsgFrom").text().replace("From: ", "");
4859
+		                var lstmsgTo = $(this).closest(".convsLst").find(".convLastMsgTo").text().replace("To: ", "");;
4860
+
4861
+		                if (cvDescChangeBy) { var convDescTitle = "<span style='font-weight:500'>Description</span> last saved by <span style='font-weight:500;color:#365b8b;'>"+ cvDescChangeBy +"</span> at "+ cvDescChangeDate +":"; } else { var convDescTitle = "Add a description for this conversation:"; }
4862
+		                if (cvDesc) { var convTextContent = cvDesc; } else { var convTextContent = ""; }
4863
+
4864
+		                var addDescWindow = "<div id='convDescWindow'>";
4865
+		                addDescWindow += "<div id='dragDescWindow'><img src='/" + ctappdir + "/sms_relentless/img/dots.svg' style='cursor:grab'></div>";
4866
+		                addDescWindow += "<a id='closeDescWindow' title='Close this window'></a>";
4867
+		                addDescWindow += "<div id='convBetween'>"+ lstmsgFrom +"<div id='btwnNbCvTitle'></div>"+ lstmsgTo +"</div>";
4868
+		                addDescWindow += "<div id='convTitle'>"+ convDescTitle +"</div>";
4869
+		                addDescWindow += "<textarea id='descriptionText' placeholder='Eg: Second conversation with John Smith.' disabled>"+ convTextContent +"</textarea>";
4870
+		                addDescWindow += "<input type='submit' id='saveConvDesc' value='Edit'>";
4871
+		                addDescWindow += "</div>";
4872
+
4873
+		                $("#content").append("<div id='recTblOverlay'></div>");
4874
+		                $("#content").append(addDescWindow);
4875
+
4876
+		                var topNmDist = parseInt((window.innerHeight / 2).toFixed(2) - 180) +"px";
4877
+		                var leftNmDist = parseInt((window.innerWidth / 2).toFixed(2) - 150) +"px";
4878
+		                $("#convDescWindow").css({ "top" : topNmDist, "left" : leftNmDist });
4879
+
4880
+		                $("#closeDescWindow").click(function() { $("#convDescWindow").remove(); $("#recTblOverlay").remove(); });
4881
+		                $("#recTblOverlay").click(function() { $("#convDescWindow").remove(); $("#recTblOverlay").remove(); });
4882
+
4883
+			        // Make the window draggable
4884
+			        function makeMgrWndDraggable(e) {
4885
+
4886
+				   window.pmdragging = {};
4887
+				   pmdragging.pageX0 = e.pageX;
4888
+				   pmdragging.pageY0 = e.pageY;
4889
+				   pmdragging.elem = $("#convDescWindow");
4890
+				   pmdragging.offset0 = $("#convDescWindow").offset();
4891
+
4892
+				   function handle_dragging(e) {
4893
+				       var left = pmdragging.offset0.left + (e.pageX - pmdragging.pageX0);
4894
+				       var top = pmdragging.offset0.top + (e.pageY - pmdragging.pageY0);
4895
+				       $(pmdragging.elem).offset({top: top, left: left});
4896
+				   }
4897
+
4898
+				   function handle_mouseup(e) {
4899
+				       $('body').off('mousemove', handle_dragging).off('mouseup', handle_mouseup);
4900
+				   }
4901
+
4902
+				   $('body').on('mouseup', handle_mouseup).on('mousemove', handle_dragging);
4903
+			        }
4904
+			        $("#dragDescWindow").mousedown(makeMgrWndDraggable);
4905
+
4906
+
4907
+		                // Save the description
4908
+		                $("#saveConvDesc").click(function() {
4909
+
4910
+		                   if ($(this).val() == "Save") {
4911
+
4912
+		                       $("#descriptionText").prop("disabled", false);
4913
+		                       $("#descriptionText").css("background-color", "#ffffff");
4914
+		                       var descText = $("#descriptionText").val();
4915
+
4916
+		                       if (/^[a-zA-Z0-9\'\.\,\)\(\/\-\s\r\n]*$/.test(descText)) {
4917
+
4918
+		                            var saveConvDescUrl = OC.generateUrl("/apps/sms_relentless/user/saveconvdescription");
4919
+
4920
+		                            $.ajax({
4921
+					       url: saveConvDescUrl + '/' + userid,
4922
+					       type: 'POST',
4923
+		                               data: { 
4924
+		                                      convDescription: descText,
4925
+		                                      convId: conversationId
4926
+		                                 },
4927
+					       success: function(respupdesc) {
4928
+		                                           showAlert(respupdesc);
4929
+		                                           $("#convDescWindow").remove();
4930
+		                                           $("#recTblOverlay").remove();
4931
+
4932
+		                                           // Refresh the conversations list
4933
+						           var archCvIdsc = '';
4934
+						           var actCvIdsc = '';
4935
+
4936
+						           $(".convsListArch").each(function() { 
4937
+							       if ($(this).css('background-color') === "rgb(241, 224, 239)") {
4938
+						                   archCvIdsc = $(this).attr("id");
4939
+							       }
4940
+						           });
4941
+
4942
+							   $(".convsListAct").each(function() {
4943
+							       if ($(this).css('background-color') === "rgb(215, 239, 239)") {
4944
+						                   actCvIdsc = $(this).attr("id");
4945
+							       }
4946
+							   });
4947
+
4948
+						           $('#smstables').empty();
4949
+						           $("#conversationsshow").click();
4950
+						           setTimeout(function() { if (actCvIdsc != '') { document.getElementById(actCvIdsc).click(); } else if (archCvIdsc != '') { document.getElementById(actCvIdsc).click(); } }, 800);
4951
+		                               },
4952
+					       error: function() {
4953
+		                                           showAlert("Error while attempting to save the conversation description to the database.");
4954
+		                                           $("#convDescWindow").remove();
4955
+		                                           $("#recTblOverlay").remove();
4956
+		                               }
4957
+					    });
4958
+
4959
+		                       } else {
4960
+		                               showAlert("The conversation description must contain only letters, numbers, spaces, commas (,), hyphens (-), slashes (/), periods (.), round brackets (()), single quotation marks ('), new lines, or an empty string.");
4961
+		                       }
4962
+
4963
+		                   } else {
4964
+
4965
+		                       $(this).attr("value", "Save");
4966
+		                       $("#descriptionText").prop("disabled", false);
4967
+		                       $("#descriptionText").css("background-color", "#ffffff");
4968
+		                   }
4969
+		                });
4970
+		             });
4971
+
4972
+
4973
+		             // Show the pop-up window for adding or modifying the conversation tag
4974
+		             $('[id^="addArchTag-"],[id^="addActTag-"]').click(function(ev) {
4975
+
4976
+		                ev.stopPropagation();
4977
+		                var conversationIdt = $(this).closest(".convsLst").find(".archactImg").data("conversationid");
4978
+		                var cvTag = $(this).closest(".convsLst").find(".archactImg").data("tag");
4979
+		                var cvTagChangeBy = $(this).closest(".convsLst").find(".archactImg").data("taguntagby");
4980
+		                var cvTagChangeDate = $(this).closest(".convsLst").find(".archactImg").data("taguntagdate");
4981
+		                var lstmsgFromt = $(this).closest(".convsLst").find(".convLastMsgFrom").text().replace("From: ", "");
4982
+		                var lstmsgTot = $(this).closest(".convsLst").find(".convLastMsgTo").text().replace("To: ", "");;
4983
+
4984
+		                if (cvTagChangeBy) { var convTagTitle = "<span style='font-weight:500'>Tag</span> last saved by <span style='font-weight:500;color:#365b8b;'>"+ cvTagChangeBy +"</span> at "+ cvTagChangeDate +":"; } else { var convTagTitle = "Add a tag to this conversation:"; }
4985
+		                if (cvTag) { var tagTextContent = cvTag; } else { var tagTextContent = ""; }
4986
+
4987
+		                var addTagWindow = "<div id='convTagWindow'>";
4988
+		                addTagWindow += "<div id='dragTagWindow'><img src='/" + ctappdir + "/sms_relentless/img/dots.svg' style='cursor:grab'></div>";
4989
+		                addTagWindow += "<a id='closeTagWindow' title='Close this window'></a>";
4990
+		                addTagWindow += "<div id='convBetween'>"+ lstmsgFromt +"<div id='btwnNbCvTitle'></div>"+ lstmsgTot +"</div>";
4991
+		                addTagWindow += "<div id='convTitle'>"+ convTagTitle +"</div>";
4992
+		                addTagWindow += "<input type='text' id='tagText' placeholder='Eg: urgent' disabled value='"+ tagTextContent +"'>";
4993
+		                addTagWindow += "<input type='submit' id='saveConvTag' value='Edit'>";
4994
+		                addTagWindow += "</div>";
4995
+
4996
+		                $("#content").append("<div id='recTblOverlay'></div>");
4997
+		                $("#content").append(addTagWindow);
4998
+
4999
+		                var topNmDistt = parseInt((window.innerHeight / 2).toFixed(2) - 180) +"px";
5000
+		                var leftNmDistt = parseInt((window.innerWidth / 2).toFixed(2) - 150) +"px";
5001
+		                $("#convTagWindow").css({ "top" : topNmDistt, "left" : leftNmDistt });
5002
+
5003
+		                $("#closeTagWindow").click(function() { $("#convTagWindow").remove(); $("#recTblOverlay").remove(); });
5004
+		                $("#recTblOverlay").click(function() { $("#convTagWindow").remove(); $("#recTblOverlay").remove(); });
5005
+
5006
+			        // Make the window draggable
5007
+			        function makeMgrWndDraggable(e) {
5008
+
5009
+				   window.pmdragging = {};
5010
+				   pmdragging.pageX0 = e.pageX;
5011
+				   pmdragging.pageY0 = e.pageY;
5012
+				   pmdragging.elem = $("#convTagWindow");
5013
+				   pmdragging.offset0 = $("#convTagWindow").offset();
5014
+
5015
+				   function handle_dragging(e) {
5016
+				       var left = pmdragging.offset0.left + (e.pageX - pmdragging.pageX0);
5017
+				       var top = pmdragging.offset0.top + (e.pageY - pmdragging.pageY0);
5018
+				       $(pmdragging.elem).offset({top: top, left: left});
5019
+				   }
5020
+
5021
+				   function handle_mouseup(e) {
5022
+				       $('body').off('mousemove', handle_dragging).off('mouseup', handle_mouseup);
5023
+				   }
5024
+
5025
+				   $('body').on('mouseup', handle_mouseup).on('mousemove', handle_dragging);
5026
+			        }
5027
+			        $("#dragTagWindow").mousedown(makeMgrWndDraggable);
5028
+
5029
+		                // Save the tag
5030
+		                $("#saveConvTag").click(function() {
5031
+
5032
+		                   if ($(this).val() == "Save") {
5033
+
5034
+		                       $("#tagText").prop("disabled", false);
5035
+		                       $("#tagText").css("background-color", "#ffffff");
5036
+		                       var tagTextCt = $("#tagText").val();
5037
+
5038
+		                       if (tagTextCt.length <= 100) {
5039
+
5040
+		                           if (/^[a-zA-Z0-9\'\.\,\)\(\/\-\s\r\n]*$/.test(tagTextCt)) {
5041
+
5042
+		                                var saveConvTagUrl = OC.generateUrl("/apps/sms_relentless/user/saveconvtag");
5043
+
5044
+		                                $.ajax({
5045
+						   url: saveConvTagUrl + '/' + userid,
5046
+						   type: 'POST',
5047
+		                                   data: { 
5048
+		                                          convTag: tagTextCt,
5049
+		                                          convId: conversationIdt
5050
+		                                          },
5051
+						   success: function(respuptag) {
5052
+		                                               showAlert(respuptag);
5053
+		                                               $("#convTagWindow").remove();
5054
+		                                               $("#recTblOverlay").remove();
5055
+
5056
+		                                               // Refresh the conversations list
5057
+						               var archCvIdsc = '';
5058
+						               var actCvIdsc = '';
5059
+
5060
+						               $(".convsListArch").each(function() { 
5061
+								   if ($(this).css('background-color') === "rgb(241, 224, 239)") {
5062
+						                       archCvIdsc = $(this).attr("id");
5063
+								   }
5064
+						               });
5065
+
5066
+							       $(".convsListAct").each(function() {
5067
+								   if ($(this).css('background-color') === "rgb(215, 239, 239)") {
5068
+						                       actCvIdsc = $(this).attr("id");
5069
+								   }
5070
+							       });
5071
+
5072
+						               $('#smstables').empty();
5073
+						               $("#conversationsshow").click();
5074
+						               setTimeout(function() { if (actCvIdsc != '') { document.getElementById(actCvIdsc).click(); } else if (archCvIdsc != '') { document.getElementById(actCvIdsc).click(); } }, 800);
5075
+		                                   },
5076
+						   error: function() {
5077
+		                                           showAlert("Error while attempting to save the conversation tag to the database.");
5078
+		                                           $("#convTagWindow").remove();
5079
+		                                           $("#recTblOverlay").remove();
5080
+		                                   }
5081
+					        });
5082
+
5083
+		                           } else { showAlert("The conversation tag must contain only letters, numbers, spaces, commas (,), hyphens (-), slashes (/), periods (.), round brackets (()), single quotation marks ('), new lines, or an empty string."); }
5084
+
5085
+		                       } else { showAlert("The conversation tag cannot exceed 100 characters in length."); }
5086
+
5087
+		                   } else {
5088
+
5089
+		                       $(this).attr("value", "Save");
5090
+		                       $("#tagText").prop("disabled", false);
5091
+		                       $("#tagText").css("background-color", "#ffffff");
5092
+		                   }
5093
+		                });
5094
+		             });
5095
+
5096
+
5097
+		             // Show the pop-up window for adding or modifying the conversation flag
5098
+		             $('[id^="addArchFlag-"],[id^="addActFlag-"]').click(function(ev) {
5099
+
5100
+		                ev.stopPropagation();
5101
+		                var conversationIdf = $(this).closest(".convsLst").find(".archactImg").data("conversationid");
5102
+		                var cvFlag = $(this).closest(".convsLst").find(".archactImg").data("flagged");
5103
+		                var cvFlagChangeBy = $(this).closest(".convsLst").find(".archactImg").data("flagunflagby");
5104
+		                var cvFlagChangeDate = $(this).closest(".convsLst").find(".archactImg").data("flagunflagdate");
5105
+		                var lstmsgFromf = $(this).closest(".convsLst").find(".convLastMsgFrom").text().replace("From: ", "");
5106
+		                var lstmsgTof = $(this).closest(".convsLst").find(".convLastMsgTo").text().replace("To: ", "");;
5107
+
5108
+		                if (cvFlag == 1) { var flgSetRem = "set"; } else if (cvFlag == 0) { var flgSetRem = "removed"; } else { var flgSetRem = "modified"; }
5109
+		                if (cvFlagChangeBy) { var convFlagTitle = "<span style='font-weight:500'>Flag</span> last "+ flgSetRem +" by <span style='font-weight:500;color:#365b8b;'>"+ cvFlagChangeBy +"</span> at "+ cvFlagChangeDate +":"; } else { var convFlagTitle = "Set a flag for this conversation:"; }
5110
+
5111
+		                var addFlagWindow = "<div id='convFlagWindow'>";
5112
+		                addFlagWindow += "<div id='dragFlagWindow'><img src='/" + ctappdir + "/sms_relentless/img/dots.svg' style='cursor:grab'></div>";
5113
+		                addFlagWindow += "<a id='closeFlagWindow' title='Close this window'></a>";
5114
+		                addFlagWindow += "<div id='convBetween'>"+ lstmsgFromf +"<div id='btwnNbCvTitle'></div>"+ lstmsgTof +"</div>";
5115
+		                addFlagWindow += "<div id='convTitle'>"+ convFlagTitle +"</div>";
5116
+		                addFlagWindow += "<input type='submit' id='setConvFlag'>";
5117
+		                addFlagWindow += "</div>";
5118
+
5119
+		                $("#content").append("<div id='recTblOverlay'></div>");
5120
+		                $("#content").append(addFlagWindow);
5121
+
5122
+		                if (cvFlag == 1) { $("#setConvFlag").prop("value", "Remove flag"); } else { $("#setConvFlag").prop("value", "Set flag"); }
5123
+
5124
+		                var topNmDistf = parseInt((window.innerHeight / 2).toFixed(2) - 180) +"px";
5125
+		                var leftNmDistf = parseInt((window.innerWidth / 2).toFixed(2) - 150) +"px";
5126
+		                $("#convFlagWindow").css({ "top" : topNmDistf, "left" : leftNmDistf });
5127
+
5128
+		                $("#closeFlagWindow").click(function() { $("#convFlagWindow").remove(); $("#recTblOverlay").remove(); });
5129
+		                $("#recTblOverlay").click(function() { $("#convFlagWindow").remove(); $("#recTblOverlay").remove(); });
5130
+
5131
+			        // Make the window draggable
5132
+			        function makeMgrWndDraggable(e) {
5133
+
5134
+				   window.pmdragging = {};
5135
+				   pmdragging.pageX0 = e.pageX;
5136
+				   pmdragging.pageY0 = e.pageY;
5137
+				   pmdragging.elem = $("#convFlagWindow");
5138
+				   pmdragging.offset0 = $("#convFlagWindow").offset();
5139
+
5140
+				   function handle_dragging(e) {
5141
+				       var left = pmdragging.offset0.left + (e.pageX - pmdragging.pageX0);
5142
+				       var top = pmdragging.offset0.top + (e.pageY - pmdragging.pageY0);
5143
+				       $(pmdragging.elem).offset({top: top, left: left});
5144
+				   }
5145
+
5146
+				   function handle_mouseup(e) {
5147
+				       $('body').off('mousemove', handle_dragging).off('mouseup', handle_mouseup);
5148
+				   }
5149
+
5150
+				   $('body').on('mouseup', handle_mouseup).on('mousemove', handle_dragging);
5151
+			        }
5152
+			        $("#dragFlagWindow").mousedown(makeMgrWndDraggable);
5153
+
5154
+		                // Save the flag
5155
+		                $("#setConvFlag").click(function() {
5156
+
5157
+		                   if ($(this).val() == "Set flag") { var convFlag = 1; } else { var convFlag = 0; }
5158
+
5159
+		                   var saveConvFlagUrl = OC.generateUrl("/apps/sms_relentless/user/saveconvflag");
5160
+
5161
+		                   $.ajax({
5162
+					   url: saveConvFlagUrl + '/' + userid,
5163
+					   type: 'POST',
5164
+		                           data: { 
5165
+		                                  convFlag: convFlag,
5166
+		                                  convId: conversationIdf
5167
+		                                  },
5168
+					   success: function(respupflag) {
5169
+
5170
+		                                       if (respupflag != "success") { showAlert("Error while trying to save the conversation flag to the database."); }
5171
+
5172
+		                                       $("#convFlagWindow").remove();
5173
+		                                       $("#recTblOverlay").remove();
5174
+
5175
+		                                       // Refresh the conversations list
5176
+					               var archCvIdsc = '';
5177
+					               var actCvIdsc = '';
5178
+
5179
+					               $(".convsListArch").each(function() { 
5180
+							   if ($(this).css('background-color') === "rgb(241, 224, 239)") {
5181
+					                       archCvIdsc = $(this).attr("id");
5182
+							   }
5183
+					               });
5184
+
5185
+						       $(".convsListAct").each(function() {
5186
+							   if ($(this).css('background-color') === "rgb(215, 239, 239)") {
5187
+					                       actCvIdsc = $(this).attr("id");
5188
+							   }
5189
+						       });
5190
+
5191
+					               $('#smstables').empty();
5192
+					               $("#conversationsshow").click();
5193
+					               setTimeout(function() { if (actCvIdsc != '') { document.getElementById(actCvIdsc).click(); } else if (archCvIdsc != '') { document.getElementById(actCvIdsc).click(); } }, 800);
5194
+		                           },
5195
+					   error: function() {
5196
+		                                   showAlert("Error while attempting to save the conversation flag to the database.");
5197
+		                                   $("#convFlagWindow").remove();
5198
+		                                   $("#recTblOverlay").remove();
5199
+		                           }
5200
+				   });
5201
+		                });
5202
+		             });
5203
+
5204
+
5205
+		             // Get the messages exchanged between the current 2 phone numbers, from the database
5206
+		             function getMsgsForNmbrs(phNumberFrom, phNumberTo, conversationId, archivedConv, archivedBy, unarchivedBy, lastArchived, lastUnarchived, flagged, flagunflagby, flagunflagdate, tag, taguntagby, taguntagdate, convdescription, convdescchangeby, convdescchangedate) {
5207
+
5208
+				   let getGrpConvUrl = OC.generateUrl("/apps/sms_relentless/user/getgroupedforreply");
5209
+
5210
+				   $('#conversationsText').addClass('icon-loading');
5211
+
5212
+				   let totalPhNmbrs = 0;
5213
+
5214
+				   $.ajax({
5215
+					  method: 'POST',
5216
+					  url: getGrpConvUrl + '/' + userid,
5217
+					  contentType: 'application/json',
5218
+				          data: JSON.stringify({ "phoneNmbrFrom": phNumberFrom, "phoneNmbrTo": phNumberTo }),
5219
+					  success: function(groupedperconv) {
5220
+
5221
+						     $('#conversationsText').removeClass('icon-loading');
5222
+
5223
+						     let fromtoNmbrsData = [];
5224
+
5225
+						     for (let i = 0; i < groupedperconv.length; i++) {
5226
+
5227
+							     if (groupedperconv[i].author_displayname) {
5228
+								 var authordnm = groupedperconv[i].author_displayname;
5229
+							     } else { 
5230
+								 var authordnm = '';
5231
+							     }
5232
+
5233
+							     var sentfromnmbrarr = groupedperconv[i].from.split(": ");
5234
+							     if (sentfromnmbrarr[1]) {
5235
+							         var groupednbfrom = sentfromnmbrarr[1];
5236
+		                                             } else {
5237
+							         var groupednbfrom = sentfromnmbrarr[0];
5238
+		                                             }
5239
+
5240
+							     var modmessagerec = '';
5241
+							     if (groupedperconv[i].author_displayname) {
5242
+								 modmessagerec = "<span class='msgAuthorNameGrp'>"+ groupedperconv[i].author_displayname + ":</span>" + groupedperconv[i].message;
5243
+							     } else {
5244
+							         modmessagerec = groupedperconv[i].message;
5245
+				                             }
5246
+
5247
+							     if (groupedperconv[i].to.indexOf(": ") > -1) {
5248
+								 var groupednmbrtopre = groupedperconv[i].to.split(": ");
5249
+								 var groupednmbrto = groupednmbrtopre[1];
5250
+							     } else { 
5251
+								 var groupednmbrto = groupedperconv[i].to;
5252
+							     }
5253
+
5254
+							     fromtoNmbrsData.push({
5255
+								       'author_displayname': authordnm,
5256
+								       'from': groupednbfrom,
5257
+								       'to': groupednmbrto,
5258
+								       'message': modmessagerec,
5259
+								       'date': groupedperconv[i].date,
5260
+								       'status': groupedperconv[i].deliveryreceipt,
5261
+								       'table': groupedperconv[i].table
5262
+							     });
5263
+						     }
5264
+
5265
+
5266
+						     // Remove the duplicates
5267
+						     let noDupMsgData = [];
5268
+						     $.each(fromtoNmbrsData, function(i, e) {
5269
+							    let matchingData = $.grep(noDupMsgData, function(item) {
5270
+								    return item.from == e.from && item.to == e.to && item.message == e.message && item.table == 'received' && e.table == 'sent';
5271
+							    });
5272
+							    if (matchingData.length === 0) {
5273
+								noDupMsgData.push(e);
5274
+							    }
5275
+						     });
5276
+
5277
+						     let messagesPerNmbr = {};
5278
+						     let msgsNamesPerNmbr = {};
5279
+						     let msgsNmbrsNames = {};
5280
+
5281
+						     let displayNamesarr = [];
5282
+						     let convData = [];
5283
+
5284
+						     for (let n = 0; n < noDupMsgData.length; n++) {
5285
+
5286
+							  if (noDupMsgData[n]['from'] == phNumberFrom && noDupMsgData[n]['table'] == 'sent') {
5287
+
5288
+							      convData.push({
5289
+							                     'author_displayname': noDupMsgData[n]['author_displayname'],
5290
+							                     'message': noDupMsgData[n]['message'],
5291
+							                     'from': noDupMsgData[n]['from'],
5292
+							                     'to': noDupMsgData[n]['to'],
5293
+							                     'date': noDupMsgData[n]['date'],
5294
+							                     'direction': 'sent_from',
5295
+					                                     'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
5296
+							                     'table': noDupMsgData[n]['table']
5297
+							      });
5298
+
5299
+							  } else if (noDupMsgData[n]['to'] == phNumberFrom && noDupMsgData[n]['table'] == 'sent') {
5300
+
5301
+							      convData.push({
5302
+							                     'author_displayname': noDupMsgData[n]['author_displayname'],
5303
+							                     'message': noDupMsgData[n]['message'],
5304
+							                     'from': noDupMsgData[n]['from'],
5305
+							                     'to': noDupMsgData[n]['to'],
5306
+							                     'date': noDupMsgData[n]['date'],
5307
+							                     'direction': 'sent_to',
5308
+					                                     'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
5309
+							                     'table': noDupMsgData[n]['table']
5310
+							      });
5311
+
5312
+
5313
+							  } else if (noDupMsgData[n]['from'] == phNumberFrom && noDupMsgData[n]['table'] == 'received') {
5314
+
5315
+							      convData.push({
5316
+							                     'author_displayname': noDupMsgData[n]['author_displayname'],
5317
+							                     'message': noDupMsgData[n]['message'],
5318
+							                     'from': noDupMsgData[n]['from'],
5319
+							                     'to': noDupMsgData[n]['to'],
5320
+							                     'date': noDupMsgData[n]['date'],
5321
+							                     'direction': 'received_from',
5322
+					                                     'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
5323
+							                     'table': noDupMsgData[n]['table']
5324
+							      });
5325
+
5326
+							  } else if (noDupMsgData[n]['to'] == phNumberFrom && noDupMsgData[n]['table'] == 'received') {
5327
+
5328
+							      convData.push({
5329
+							                     'author_displayname': noDupMsgData[n]['author_displayname'],
5330
+							                     'message': noDupMsgData[n]['message'],
5331
+							                     'from': noDupMsgData[n]['from'],
5332
+							                     'to': noDupMsgData[n]['to'],
5333
+							                     'date': noDupMsgData[n]['date'],
5334
+							                     'direction': 'received_on',
5335
+					                                     'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
5336
+							                     'table': noDupMsgData[n]['table']
5337
+							      });
5338
+							  }
5339
+						     }
5340
+
5341
+						     // Sort messages by date
5342
+						     convData.sort(function(a, b) {
5343
+		                                        return new Date(b.date) - new Date(a.date);
5344
+						     });
5345
+
5346
+						     // Collect the display names of the users that sent messages from the current numbers
5347
+						     let selectedNames = [];
5348
+						     let displayNames = '';
5349
+						     for (let v = 0; v < convData.length; v++) {
5350
+							  if (selectedNames.indexOf(convData[v]['author_displayname']) == -1) { 
5351
+							      selectedNames.push(convData[v]['author_displayname']);
5352
+							      displayNames += "<div id='diplNm_"+ phNumberFrom +"_"+ v +"' class='dispNameList' name='"+ convData[v]['author_displayname'] +"'>"+ convData[v]['author_displayname'] +"</div>";
5353
+							  }
5354
+						     }
5355
+						     displayNames += "<div id='diplNmAllMsgcv' class='dispNameListAll' title='Show all the messages exchanged between the current 2 phone numbers.'>All messages</div>";
5356
+
5357
+						     // Store the display names for the current numbers, to be able to see them later
5358
+						     let ctPhNumber = phNumberFrom;
5359
+						     msgsNamesPerNmbr[ctPhNumber] = displayNames;
5360
+
5361
+						     // Store the messages sent by each user, to be able to see them later when clicking on the user's name
5362
+						     for (let h = 0; h < selectedNames.length; h++) {
5363
+
5364
+							  let rowMessageArrpn = [];
5365
+
5366
+							  for (let b = 0; b < convData.length; b++) {
5367
+
5368
+							       if (selectedNames[h] == convData[b]['author_displayname']) {
5369
+
5370
+								   if (convData[b]['direction'] == 'sent_from') {
5371
+		                                                       if (convData[b]['status']) {
5372
+									   if (convData[b]['status'].indexOf("delivered") > -1 || convData[b]['status'].indexOf("delivery success") > -1 || convData[b]['status'].indexOf("Retrieved") > -1) {
5373
+							                       if (convData[b]['status'].indexOf("undelivered") > -1) {
5374
+									           var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5375
+		                                                               } else {
5376
+									           var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
5377
+		                                                               }
5378
+									   } else {
5379
+									       var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5380
+									   }
5381
+								       } else {
5382
+									   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5383
+		                                                       }
5384
+								       rowMessageArrpn.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
5385
+								   } else if (convData[b]['direction'] == 'sent_to') {
5386
+		                                                       if (convData[b]['status']) {
5387
+									   if (convData[b]['status'].indexOf("delivered") > -1 || convData[b]['status'].indexOf("delivery success") > -1 || convData[b]['status'].indexOf("Retrieved") > -1) {
5388
+							                       if (convData[b]['status'].indexOf("undelivered") > -1) {
5389
+									           var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5390
+		                                                               } else {
5391
+									           var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
5392
+		                                                               }
5393
+									   } else {
5394
+									       var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5395
+									   }
5396
+		                                                       } else {
5397
+		                                                           var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5398
+		                                                       }
5399
+								       rowMessageArrpn.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
5400
+								   } else if (convData[b]['direction'] == 'received_from') {
5401
+								       rowMessageArrpn.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div></div>");
5402
+								   } else if (convData[b]['direction'] == 'received_on') {
5403
+								       rowMessageArrpn.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div></div>");
5404
+							           }
5405
+							       }
5406
+							  }
5407
+							  let crtNmber = phNumberFrom;
5408
+							  let crtName = selectedNames[h];
5409
+							  msgsNmbrsNames[crtNmber] = msgsNmbrsNames[crtNmber] || {};
5410
+				                          msgsNmbrsNames[crtNmber][crtName] = rowMessageArrpn;
5411
+						     }
5412
+
5413
+				                     // The number of messages to be loaded by default
5414
+				                     var nmbTblDefault = 50;
5415
+
5416
+				                     // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
5417
+				                     if (convData.length > nmbTblDefault) {
5418
+				                         $("#loadMoreMsgs").css("display", "block");
5419
+				                         var nmbToBeLoaded = nmbTblDefault;
5420
+				                     } else { var nmbToBeLoaded = convData.length; }
5421
+
5422
+						     let rowMessageArr = [];
5423
+
5424
+						     for (var m = nmbToBeLoaded - 1; m >= 0; m--) {
5425
+
5426
+							  if (convData[m]['direction'] == 'sent_from') {
5427
+							      if (convData[m]['status']) {
5428
+								  if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
5429
+						                      if (convData[m]['status'].indexOf("undelivered") > -1) {
5430
+								          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5431
+		                                                      } else {
5432
+								          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
5433
+		                                                      }
5434
+								  } else {
5435
+								      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5436
+								  }
5437
+							      } else {
5438
+							          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5439
+							      }
5440
+							      rowMessageArr.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
5441
+
5442
+							  } else if (convData[m]['direction'] == 'sent_to') {
5443
+		                                              if (convData[m]['status']) {
5444
+								  if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
5445
+						                      if (convData[m]['status'].indexOf("undelivered") > -1) {
5446
+								          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5447
+		                                                      } else {
5448
+								          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
5449
+		                                                      }
5450
+								  } else {
5451
+								      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5452
+								  }
5453
+							      } else {
5454
+							          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5455
+							      }
5456
+							      rowMessageArr.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
5457
+
5458
+							  } else if (convData[m]['direction'] == 'received_from') {
5459
+
5460
+							      rowMessageArr.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
5461
+
5462
+							  } else if (convData[m]['direction'] == 'received_on') {
5463
+
5464
+							      rowMessageArr.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
5465
+							  }
5466
+						     }
5467
+
5468
+						     let convDataPerNmbr = rowMessageArr.join("");
5469
+
5470
+
5471
+		                                     if (archivedConv == 1) {
5472
+		                                         var archiveImg = "unarchiveConv";
5473
+		                                         var archTitle = "Unarchive this conversation.";
5474
+		                                         var removeConvImg = "removeConv";
5475
+		                                         var removeConvTitle = "Permanently delete all the messages in this conversation.";
5476
+		                                         var archornottitle = "Archived Conversation";
5477
+		                                     } else {
5478
+		                                         var archiveImg = "archiveConv";
5479
+		                                         var archTitle = "Archive this conversation.";
5480
+		                                         var removeConvImg = "removeConvGrey";
5481
+		                                         var removeConvTitle = "Only archived conversations can be deleted.";
5482
+		                                         var archornottitle = "Active Conversation";
5483
+		                                     }
5484
+
5485
+		                                     if (archivedBy == null || archivedBy == '') {
5486
+		                                         var lastArchUnarch = "<font style='color:#178e84;font-weight:600;'>Active Conversation</font> | "+ phNumberFrom +"<div id='betweenNmbrs'></div>"+ phNumberTo +"";
5487
+		                                     } else if (archivedConv == 1 && archivedBy && lastArchived) {
5488
+		                                         var lastArchUnarch = "<font style='color:#9e6897;font-weight:600;'>Archived Conversation</font> | "+ phNumberFrom +"<div id='betweenNmbrs'></div>"+ phNumberTo +" | Last archived by <font style='color:#365b8b;font-weight:600;'>"+ archivedBy + "</font> on "+ lastArchived;
5489
+		                                     } else if (archivedConv == 0 && unarchivedBy && lastUnarchived) {
5490
+		                                         var lastArchUnarch = "<font style='color:#178e84;font-weight:600;'>Active Conversation</font> | "+ phNumberFrom +"<div id='betweenNmbrs'></div>"+ phNumberTo +" | Last unarchived by <font style='color:#365b8b;font-weight:600;'>"+ unarchivedBy + "</font> on "+ lastUnarchived;
5491
+		                                     }
5492
+
5493
+		                                     if (convdescription) {
5494
+		                                         var cvDescAdded = "convDescAddedCvt";
5495
+		                                         var cvDescText = convdescription + " (<span style='font-weight:500'>Description</span> last saved by <span style='font-weight:500;color:#365b8b;'>"+ convdescchangeby +"</span> at "+ convdescchangedate +".)"; 
5496
+		                                     } else { 
5497
+		                                         var cvDescAdded = "convDescCvt"; var cvDescText = ""; 
5498
+		                                     }
5499
+
5500
+		                                     if (tag) { 
5501
+		                                         var cvTagAdded = "convTagAddedCvt"; 
5502
+		                                         var cvTagText = "<span style='font-size:14px;font-weight:500;color:#39608a;'>"+ tag + "</span> (<span style='font-weight:500'>Tag</span> last saved by <span style='font-weight:500;color:#365b8b;'>"+ taguntagby +"</span> at "+ taguntagdate +".)"; 
5503
+		                                     } else { 
5504
+		                                         var cvTagAdded = "convTagCvt"; var cvTagText = ""; 
5505
+		                                     }
5506
+
5507
+		                                     if (flagged == 1) { 
5508
+		                                         var cvFlagAdded = "cvFlagRedCvt"; 
5509
+		                                         var cvFlagText = "(<span style='font-weight:500'>Flag</span> last set by <span style='font-weight:500;color:#365b8b;'>"+ flagunflagby +"</span> at "+ flagunflagdate +".)"; 
5510
+		                                     } else if (flagged == 0) { 
5511
+		                                         var cvFlagAdded = "cvFlagEmptyCvt"; 
5512
+		                                         var cvFlagText = "(<span style='font-weight:500'>Flag</span> last removed by <span style='font-weight:500;color:#365b8b;'>"+ flagunflagby +"</span> at "+ flagunflagdate +".)"; 
5513
+		                                     } else { 
5514
+		                                         var cvFlagAdded = "cvFlagEmptyCvt";
5515
+		                                         var cvFlagText = "";
5516
+		                                     }
5517
+
5518
+				                     $("#conversationsText").empty();
5519
+		                                     $("#conversationsText").append("<div id='convTextHeader'><table id='convTextTbl'><tr><td style='width:5% !important'><div id='archUnarchAct' class='"+ archiveImg +"' title='"+ archTitle +"'></div></td><td id='convBarTitle'><div id='titleFirstRow'>"+ lastArchUnarch +"</div><div id='titleSecRow'><div id='titleConvDesc'><div class='"+ cvDescAdded +"' title='Conversation description'></div><div class='cvDescContent'>"+ cvDescText +"</div></div><div id='titleConvTag'><div class='"+ cvTagAdded +"' title='Conversation tag'></div><div class='cvTagContent'>"+ cvTagText +"</div></div><div id='titleConvFlag'><div class='"+ cvFlagAdded +"' title='Conversation flag'></div><div class='cvFlagContent'>"+ cvFlagText +"</div></div><div id='titleConvDelete'><div id='deleteAllMsgConv' title='Permanently delete the entire conversation from the database'></div><div id='deleteMsgsCvText'>Permanently delete from the database all the messages included in this conversation.</div></div></div><div id='expandTitle'><div id='expandTitleImg'></div></div></td><td style='width:5% !important'><div id='convParticipants' class='convPart' title='Show the list with conversation participants.'></div></td></tr></table></div><div id='grpdbynamelstcv'></div><div id='loadMoreMsgs' title='Click to load older messages.'>Load more messages</div><div id='loadMoreMsgsusr' title='Click to load older messages.'>Load more messages</div>");
5520
+		                                     $("#conversationsText").append("<div id='loadMoreMsgs' title='Click to load older messages.'>Load more messages</div><div id='loadMoreMsgsusr' title='Click to load older messages.'>Load more messages</div><div id='convListRowCell'></div>");
5521
+
5522
+		                                     var allmsgconv = "<div id='sendMsgReplySec'><table id='sendMsgConvSec'><tr><td><div id='fromPhnNmbrCv'>From: <select id='selectFromNbConv'></select></div><div id='toPhnNmbrCv'>To: <select id='selectToNbConv'></select></div></td></tr>";
5523
+		                                     allmsgconv += "<tr><td><textarea id='sendMsgConvTextSec' placeholder='Enter a message here, then press Send SMS.'></textarea></td></tr></table>";
5524
+		                                     allmsgconv += "<div id='sendMsgBtnConv'>Send SMS</div></div>";
5525
+		                                     allmsgconv += "<div id='expToSendReply' title='Expand to send a message'><img id='expandWindowRplSec' src='/" + ctappdir + "/sms_relentless/img/arrowDown.svg'></div>";
5526
+
5527
+		                                     $("#conversationsText").append(allmsgconv);
5528
+
5529
+				                     $("#convListRowCell").append(convDataPerNmbr);
5530
+
5531
+				                     if (convData.length > nmbTblDefault) {
5532
+				                         $("#loadMoreMsgs").css("display", "block");
5533
+				                     }
5534
+
5535
+		                                     $("#sendMsgConvSec").css("width", $("#conversationsText").width() - 20);
5536
+		                                     $("#sendMsgConvTextSec").css("width", $("#conversationsText").width() - 20);
5537
+
5538
+		                                     // Expand the conversation title bar to see the conversation details
5539
+		                                     $("#expandTitleImg").click(function() {
5540
+		                                        if ($("#titleSecRow").is(":visible")) {
5541
+		                                            $("#titleSecRow").css("display", "none"); 
5542
+		                                            $("#expandTitleImg").css("background-image", "url('/" + ctappdir + "/sms_relentless/img/arrowDown_small.svg')");
5543
+		                                            $("#expandTitleImg").prop("title", "Expand to see conversation details");
5544
+		                                        } else {
5545
+		                                            $("#titleSecRow").css("display", "block"); 
5546
+		                                            $("#expandTitleImg").css("background-image", "url('/" + ctappdir + "/sms_relentless/img/arrowUp_small.svg')");
5547
+		                                            $("#expandTitleImg").prop("title", "Collapse");
5548
+		                                        }
5549
+		                                     });
5550
+
5551
+		                                     // Delete all the messages in a conversation
5552
+		                                     $("#deleteAllMsgConv").click(function() {
5553
+
5554
+							  confirmAlert("Are you sure that you want to permanently delete from the database all the messages included in this conversation ? This action cannot be undone.");
5555
+
5556
+							  $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); return; });
5557
+
5558
+							  $("#confirmOk").click(function() {
5559
+
5560
+		                                              confirmAlert("Confirm that you want to permanently delete from the database all the messages included in this conversation !");
5561
+
5562
+							      $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); return; });
5563
+
5564
+							      $("#confirmOk").click(function() {
5565
+
5566
+								 $("#alertMsgOverlay").remove();
5567
+								 $("#alertConfMessage").remove();
5568
+
5569
+								 var deleteConvUrl = OC.generateUrl("/apps/sms_relentless/user/removeconvmsgs");
5570
+								 $('#smstables').addClass('icon-loading');
5571
+
5572
+								 $.ajax({
5573
+								      url: deleteConvUrl + '/' + userid,
5574
+								      type: "POST",
5575
+								      data: { "conversationId": conversationId },
5576
+								      success: function(delcvmsgres) {
5577
+						                                 $('#smstables').removeClass('icon-loading');
5578
+								                 if (delcvmsgres == "success") {
5579
+								                     showAlert("The messages included in this conversation have been deleted successfully !");
5580
+								                     $('#conversationsshow').click();
5581
+								                 } else if (delcvmsgres == "not allowed") { 
5582
+								                     showAlert("Only admins can delete messages !");
5583
+								                 } else {
5584
+								                     showAlert("There was an error while deleting the messages included in this conversation !");
5585
+								                 }
5586
+								      },
5587
+								      error: function() {
5588
+								                 $('#smstables').removeClass('icon-loading');
5589
+								                 showAlert("There was an error while attempting to delete the messages included in this conversation !");
5590
+								      }
5591
+								 });
5592
+							      });
5593
+							  });
5594
+		                                     });
5595
+
5596
+
5597
+						     // Expand the reply section when clicking on the arrow, to be able to send replies
5598
+						     $("#expToSendReply").unbind("click");
5599
+						     $("#expToSendReply").click(function() {
5600
+
5601
+							if ($("#expandWindowRplSec").attr('src') == '/' + ctappdir + '/sms_relentless/img/arrowDown.svg') {
5602
+							    $("#sendMsgReplySec").css("display", "block");
5603
+		                                            $("#conversationsText").animate({scrollTop: $("#conversationsText").prop("scrollHeight")}, 100);
5604
+							    $("#expandWindowRplSec").attr('src', '/' + ctappdir + '/sms_relentless/img/arrowUp.svg');
5605
+							    $(this).attr('title', 'Collapse');
5606
+							} else {
5607
+							    $("#sendMsgReplySec").css("display", "none");
5608
+							    $("#expandWindowRplSec").attr('src', '/' + ctappdir + '/sms_relentless/img/arrowDown.svg');
5609
+							    $(this).attr('title', 'Expand to send a reply');
5610
+							}
5611
+						     });
5612
+
5613
+						     // Append the available phone numbers to the From drop-down list
5614
+						     var availPhoneNmbrs = [];
5615
+						     $("#currentsmsnmbrs .optselectsmsnb").each(function() {
5616
+							var crtphnmbr = $(this).attr("value");
5617
+							if (crtphnmbr != "") { availPhoneNmbrs.push(crtphnmbr); }
5618
+						     });
5619
+
5620
+						     if (availPhoneNmbrs.length > 0) {
5621
+		                                         var extcheck = true;
5622
+							 var avphopt = "";
5623
+							 var avphoptto = "";
5624
+							 for (let d = 0; d < availPhoneNmbrs.length; d++) {
5625
+							      if (availPhoneNmbrs[d].indexOf(phNumberTo) === -1) {
5626
+								  avphopt += "<option value='"+ availPhoneNmbrs[d] +"'>"+ availPhoneNmbrs[d] +"</option>";
5627
+							      } else {
5628
+								  avphopt += "<option value='"+ availPhoneNmbrs[d] +"' selected>"+ availPhoneNmbrs[d] +"</option>";
5629
+		                                                  extcheck = false;
5630
+							      }
5631
+		                                              if (availPhoneNmbrs[d].indexOf("+") > -1) {
5632
+							          avphoptto += "<option value='"+ availPhoneNmbrs[d] +"'>"+ availPhoneNmbrs[d] +"</option>";
5633
+		                                              }
5634
+							 }
5635
+
5636
+							 $("#selectFromNbConv").append(avphopt);
5637
+							 if (extcheck) {
5638
+							     avphoptto += "<option value='"+ phNumberTo +"' selected>"+ phNumberTo +"</option>";
5639
+							 } else { avphoptto += "<option value='"+ phNumberFrom +"' selected>"+ phNumberFrom +"</option>"; }
5640
+							 $("#selectToNbConv").append(avphoptto);
5641
+
5642
+		                                         // Warn of beginning/continuing a different conversation if sending the message from/to a number different from the numbers that participate in the conversation
5643
+		                                         $("#selectFromNbConv").change(function() {
5644
+		                                            var selNmbr = $(this).val().split(": ")[1];
5645
+		                                            if (selNmbr != phNumberTo && selNmbr != phNumberFrom) { showAlert("You have selected a phone number that is different from the numbers that participate in this conversation. If you send a message from/to a different number than the 2 numbers that participate in the current conversation, you will begin or continue a different conversation. Thus, your message won't appear in the current conversation, but in a different one."); }
5646
+		                                         });
5647
+
5648
+		                                         $("#selectToNbConv").change(function() {
5649
+		                                            if ($(this).val().indexOf(": ") > -1) {
5650
+		                                                var selNmbrto = $(this).val().split(": ")[1];
5651
+		                                            } else { var selNmbrto = $(this).val(); }
5652
+		                                            if (selNmbrto != phNumberFrom && selNmbrto != phNumberTo) { showAlert("You have selected a phone number that is different from the numbers that participate in this conversation. If you send a message from/to a different number than the 2 numbers that participate in the current conversation, you will begin or continue a different conversation. Thus, your message won't appear in the current conversation, but in a different one."); }
5653
+		                                         });
5654
+
5655
+						     } else { 
5656
+		                                         $("#selectFromNbConv").append("<option value='' selected>No IDs</option>");
5657
+		                                         $("#selectToNbConv").append("<option value='"+ phNumberFrom +"' selected>"+ phNumberFrom +"</option>");
5658
+		                                     }
5659
+
5660
+						     // Send a message from the reply section
5661
+						     $("#sendMsgBtnConv").click(function() {
5662
+
5663
+							$("#sendMsgConvSec,#sendMsgBtnConv").addClass('icon-loading');
5664
+							var msgToSend = $("#sendMsgConvTextSec").val();
5665
+							var selectedid = $("#selectFromNbConv").val();
5666
+							var toNumberinit = $("#selectToNbConv").val().split("+");
5667
+		                                        var toNumber = "+" + toNumberinit[1];
5668
+							var receiversNumbers = [toNumber];
5669
+
5670
+							if (selectedid != '') {
5671
+
5672
+							    var sendersplit = selectedid.split(":");
5673
+							    var providercap = sendersplit[0];
5674
+							    var provsec = sendersplit[1];
5675
+
5676
+							    if (/[a-zA-Z]/.test(provsec)) {
5677
+								var alphanumcheck = true;
5678
+							    } else { var alphanumcheck = false; }
5679
+
5680
+							    if (providercap == 'Tx' && alphanumcheck == false) {  
5681
+								var senderproc = selectedid.replace(/[^0-9]/g, "");
5682
+								var selectedsender = "+" + senderproc;
5683
+								var providerUsed = "telnyx";
5684
+								var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstel");
5685
+							    } else if (providercap == 'Pl' && alphanumcheck == false) {
5686
+								var selectedsender = selectedid.replace(/[^0-9]/g, "");
5687
+								var providerUsed = "plivo";
5688
+								var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsnex");
5689
+							    } else if (providercap == 'Tw' && alphanumcheck == false) {  
5690
+								var senderproc = selectedid.replace(/[^0-9]/g, "");
5691
+								var selectedsender = "+" + senderproc;
5692
+								var providerUsed = "twilio";
5693
+								var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstwil");
5694
+							    } else if (providercap == 'Fl' && alphanumcheck == false) {  
5695
+								var senderproc = selectedid.replace(/[^0-9]/g, "");
5696
+								var selectedsender = "+" + senderproc;
5697
+								var providerUsed = "flowroute";
5698
+								var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsflow");
5699
+							    } else if (providercap == 'Tx' && alphanumcheck == true) {
5700
+								var selectedsender = provsec;
5701
+								var providerUsed = "telnyx";
5702
+								var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstel");
5703
+							    } else if (providercap == 'Pl' && alphanumcheck == true) {
5704
+								var selectedsender = provsec;
5705
+								var providerUsed = "plivo";
5706
+								var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsnex");
5707
+							    } else if (providercap == 'Tw' && alphanumcheck == true) {
5708
+								var selectedsender = provsec;
5709
+								var providerUsed = "twilio";
5710
+								var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmstwil");
5711
+							    } else if (providercap == 'Fl' && alphanumcheck == true) {
5712
+								var selectedsender = provsec;
5713
+								var providerUsed = "flowroute";
5714
+								var relbaseUrl = OC.generateUrl("/apps/sms_relentless/user/sendsmsflow");
5715
+							    }
5716
+
5717
+							  var uploadedtomms = [];
5718
+
5719
+							    if (msgToSend != '') {
5720
+
5721
+								  $.ajax({
5722
+								     url: relbaseUrl + '/' + userid,
5723
+								     type: "POST",
5724
+								     data: {
5725
+									   receiversPhoneNbs: receiversNumbers,
5726
+									   fromsender: selectedsender,
5727
+									   waitinterval: 1000,
5728
+									   sentsmstext: msgToSend,
5729
+									   ismms: 0,
5730
+									   mmsfiles: uploadedtomms
5731
+									 },
5732
+								     success: function(displayname) {
5733
+
5734
+								           var tzdate = new Date();
5735
+								           var presDatest = new Date(tzdate.getTime() - (tzdate.getTimezoneOffset() * 60000)).toJSON();
5736
+								           var presDatedb = presDatest.split(".")[0];
5737
+								           var presDatesc = presDatedb.split("T");
5738
+								           var presDate = presDatesc[0] +" "+ presDatesc[1];
5739
+								           var sentMessageStatus = '';
5740
+
5741
+								           if (displayname) {
5742
+								               var msgToSendproc = "<span class='msgAuthorNameGrp'>"+ displayname + ":</span>" + msgToSend; 
5743
+								           } else { var msgToSendproc = msgToSend; }
5744
+
5745
+								           $("#convListRowCell").append("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ selectedsender +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ receiversNumbers[0] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ msgToSendproc +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ presDate +"</div><div class='sentMssgStatus'>"+ sentMessageStatus +"</div></div>");
5746
+
5747
+								           // Scroll down to the bottom of the window
5748
+								           $("#conversationsText").animate({scrollTop:$("#conversationsText").prop("scrollHeight")},200);
5749
+
5750
+								           $("#sendMsgConvSec,#sendMsgBtnConv").removeClass('icon-loading');
5751
+								     },
5752
+								     error: function() {
5753
+									   showAlert("Error while sending the message. You can check your Nextcloud log to find out more about this issue.");
5754
+									   $("#sendMsgConvSec,#sendMsgBtnConv").removeClass('icon-loading');
5755
+								     }
5756
+								  });
5757
+							    } else {
5758
+								    showAlert("Please enter a message in the text box!");
5759
+								    $("#sendMsgConvSec,#sendMsgBtnConv").removeClass('icon-loading');
5760
+							    }
5761
+							} else {
5762
+								showAlert("Please choose a Sender ID from the 'From' drop-down list!");
5763
+								$("#sendMsgConvSec,#sendMsgBtnConv").removeClass('icon-loading');
5764
+							}
5765
+						     });
5766
+
5767
+
5768
+		                                     // Show the list with conversation participants
5769
+				                     $("#grpdbynamelstcv").empty();
5770
+		                                     $("#grpdbynamelstcv").append("<div style='display:block;position:relative;width:100%;height:0;'><div id='closeConvPart' title='Close the list of conversation participants.'></div></div>");
5771
+				                     $("#grpdbynamelstcv").append(displayNames);
5772
+
5773
+		                                     $("#convParticipants").click(function() { 
5774
+		                                        if ($("#grpdbynamelstcv").is(":visible")) {
5775
+		                                            $("#grpdbynamelstcv").css("display", "none");
5776
+		                                            $("#convParticipants").removeClass("convPartRed");
5777
+		                                            $("#convParticipants").addClass("convPart");
5778
+		                                            $("#convParticipants").prop("title", "Show the list with conversation participants.");
5779
+		                                        } else { 
5780
+		                                            $("#grpdbynamelstcv").css("display", "block");
5781
+		                                            $("#convParticipants").removeClass("convPart");
5782
+		                                            $("#convParticipants").addClass("convPartRed");
5783
+		                                            $("#convParticipants").prop("title", "Close the list with conversation participants.");
5784
+
5785
+				                            $("#closeConvPart").click(function() {
5786
+				                               $("#grpdbynamelstcv").css("display", "none");
5787
+				                               $("#convParticipants").removeClass("convPartRed");
5788
+				                               $("#convParticipants").addClass("convPart");
5789
+				                               $("#convParticipants").prop("title", "Show the list with conversation participants.");
5790
+				                            });
5791
+		                                        }
5792
+		                                     });
5793
+
5794
+
5795
+						     // Store the messages for the current From number, to be able to see them later
5796
+						     let rowMessageArrcpt = [];
5797
+						     for (let m = 0; m < convData.length; m++) {
5798
+
5799
+							  if (convData[m]['direction'] == 'sent_from') {
5800
+							      if (convData[m]['status']) {
5801
+								  if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
5802
+						                      if (convData[m]['status'].indexOf("undelivered") > -1) {
5803
+								          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5804
+		                                                      } else {
5805
+								          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
5806
+		                                                      }
5807
+								  } else {
5808
+								      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5809
+								  }
5810
+							      } else {
5811
+							          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5812
+							      }
5813
+							      rowMessageArrcpt.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
5814
+
5815
+							  } else if (convData[m]['direction'] == 'sent_to') {
5816
+							      if (convData[m]['status']) {
5817
+								  if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
5818
+						                      if (convData[m]['status'].indexOf("undelivered") > -1) {
5819
+								          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5820
+		                                                      } else {
5821
+								          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
5822
+		                                                      }
5823
+								  } else {
5824
+								      var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5825
+								  }
5826
+							      } else {
5827
+							          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5828
+							      }
5829
+							      rowMessageArrcpt.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
5830
+
5831
+							  } else if (convData[m]['direction'] == 'received_from') {
5832
+
5833
+							      rowMessageArrcpt.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
5834
+
5835
+							  } else if (convData[m]['direction'] == 'received_on') {
5836
+
5837
+							      rowMessageArrcpt.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
5838
+							  }
5839
+						     }
5840
+
5841
+						     messagesPerNmbr[phNumberFrom] = rowMessageArrcpt;
5842
+
5843
+				                     // Scroll down to the bottom of the window
5844
+			                             $("#conversationsText").animate({scrollTop: $("#conversationsText").prop("scrollHeight")},200);
5845
+
5846
+				                     // Load more messages
5847
+				                     var clickNmb = 0;
5848
+		                                     $("#loadMoreMsgs").unbind("click");
5849
+				                     $("#loadMoreMsgs").click(function() {
5850
+
5851
+				                         clickNmb++;
5852
+
5853
+				                         var crefnb = (clickNmb + 1) * nmbToBeLoaded;
5854
+
5855
+				                         if (crefnb > convData.length) {
5856
+				                             var nmbmsg = convData.length - 1;
5857
+				                             $("#loadMoreMsgs").css("display", "none");
5858
+				                         } else { 
5859
+				                             var nmbmsg = crefnb - 1;
5860
+				                         }
5861
+
5862
+				                         let rowMessageArrAdd = [];
5863
+
5864
+				                         for (let m = nmbmsg; m >= clickNmb * nmbToBeLoaded; m--) {
5865
+
5866
+							      if (convData[m]['direction'] == 'sent_from') {
5867
+							          if (convData[m]['status']) {
5868
+								      if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
5869
+						                          if (convData[m]['status'].indexOf("undelivered") > -1) {
5870
+								              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5871
+		                                                          } else {
5872
+								              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
5873
+		                                                          }
5874
+								      } else {
5875
+								          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5876
+								      }
5877
+							          } else {
5878
+							              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5879
+							          }    
5880
+							          rowMessageArrAdd.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
5881
+
5882
+							      } else if (convData[m]['direction'] == 'sent_to') {
5883
+							          if (convData[m]['status']) {
5884
+								      if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
5885
+						                          if (convData[m]['status'].indexOf("undelivered") > -1) {
5886
+								              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5887
+		                                                          } else {
5888
+								              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
5889
+		                                                          }
5890
+								      } else {
5891
+								          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5892
+								      }
5893
+							          } else {
5894
+							              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
5895
+							          }
5896
+							          rowMessageArrAdd.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
5897
+
5898
+							      } else if (convData[m]['direction'] == 'received_from') {
5899
+
5900
+								  rowMessageArrAdd.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
5901
+
5902
+							      } else if (convData[m]['direction'] == 'received_on') {
5903
+
5904
+								  rowMessageArrAdd.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
5905
+							      }
5906
+				                         }
5907
+
5908
+							 let convDataPerNmbrad = rowMessageArrAdd.join("");
5909
+
5910
+				                         let scrlheight = $("#convListRowCell").height();
5911
+				                         $("#convListRowCell").prepend(convDataPerNmbrad);
5912
+		                                         $("#conversationsText").animate({scrollTop: $("#convListRowCell").height() - scrlheight}, 0);
5913
+
5914
+				                     });
5915
+
5916
+
5917
+						     // Show the messages sent by each user whose name is clicked
5918
+						     $('[id*="diplNm_"]').click(function() {
5919
+
5920
+							 let crntNmbr = $(this).attr("id").split("_")[1];
5921
+							 let crntDisName = $(this).attr("name");                               
5922
+				                         $("#loadMoreMsgs").css("display", "none");
5923
+
5924
+				                         let convDataprn = [];
5925
+				                         $.each(msgsNmbrsNames[crntNmbr][crntDisName], function(index, item) {
5926
+				                                convDataprn.push(item);
5927
+				                         });
5928
+
5929
+				                         // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
5930
+				                         if (convDataprn.length > nmbTblDefault) {
5931
+				                             $("#loadMoreMsgsusr").css("display", "block");
5932
+				                             let nmbToBeLoaded = nmbTblDefault;
5933
+				                         } else {
5934
+				                             $("#loadMoreMsgsusr").css("display", "none");
5935
+				                             let nmbToBeLoaded = convDataprn.length;
5936
+				                         }
5937
+
5938
+							 let rowMessageArrprnst = [];
5939
+
5940
+							 for (let n = nmbToBeLoaded - 1; n >= 0; n--) {
5941
+				                              rowMessageArrprnst.push(convDataprn[n]);
5942
+							 }
5943
+
5944
+							 let convDataPerNmbrprnst = rowMessageArrprnst.join("");
5945
+
5946
+		                                         $("#convListRowCell").empty();
5947
+		                                         $("#convListRowCell").append(convDataPerNmbrprnst);
5948
+
5949
+				                         // Scroll down to the bottom of the window
5950
+				                         $("#conversationsText").animate({scrollTop: $("#conversationsText").prop("scrollHeight")}, 200);
5951
+
5952
+				                         // Load more messages
5953
+				                         var clckNb = 0;
5954
+				                         $("#loadMoreMsgsusr").unbind("click");
5955
+				                         $("#loadMoreMsgsusr").click(function() {
5956
+
5957
+				                             clckNb++;
5958
+				                             var crefnb = (clckNb + 1) * nmbToBeLoaded;
5959
+
5960
+				                             $("#loadMoreMsgs").css("display", "none");
5961
+
5962
+				                             if (crefnb > convDataprn.length) {
5963
+				                                 var nmbmsg = convDataprn.length - 1;
5964
+				                                 $("#loadMoreMsgsusr").css("display", "none");
5965
+				                             } else { 
5966
+				                                 var nmbmsg = crefnb - 1;
5967
+				                                 $("#loadMoreMsgsusr").css("display", "block");
5968
+				                             }
5969
+
5970
+				                             var rowMessageArrAddst = [];
5971
+
5972
+				                             for (var q = nmbmsg; q >= clckNb * nmbToBeLoaded; q--) {
5973
+
5974
+				                                  rowMessageArrAddst.push(convDataprn[q]);
5975
+				                             }
5976
+
5977
+							     var convDataPerNmbradst = rowMessageArrAddst.join("");
5978
+
5979
+				                             let scrlheight = $("#convListRowCell").height();
5980
+				                             $("#convListRowCell").prepend(convDataPerNmbradst);
5981
+
5982
+		                                             $("#conversationsText").animate({scrollTop: $("#convListRowCell").height() - scrlheight }, 0);
5983
+				                         });
5984
+
5985
+
5986
+							 $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
5987
+							 $("#diplNmAllMsgcv").css("color", "#04957b");
5988
+							 $(this).css("color", "#1b8efe");
5989
+						     });
5990
+
5991
+
5992
+						     // Show again all the messages exchanged between the current 2 phone numbers
5993
+						     $("#diplNmAllMsgcv").click(function() {
5994
+
5995
+				                         $("#loadMoreMsgsusr").css("display", "none");
5996
+
5997
+				                         let convDataprn = [];
5998
+				                         $.each(messagesPerNmbr[phNumberFrom], function(index, item) {
5999
+				                                convDataprn.push(item);
6000
+				                         });
6001
+
6002
+				                         // If the total number of messages is greater than the default number of messages to display, show the 'Load more messages' button
6003
+				                         if (convDataprn.length > nmbTblDefault) {
6004
+				                             $("#loadMoreMsgs").css("display", "block");
6005
+				                             let nmbToBeLoaded = nmbTblDefault;
6006
+				                         } else {
6007
+				                             $("#loadMoreMsgs").css("display", "none");
6008
+				                             let nmbToBeLoaded = convDataprn.length;
6009
+				                         }
6010
+
6011
+							 let rowMessageArrprnst = [];
6012
+
6013
+							 for (let n = nmbToBeLoaded - 1; n >= 0; n--) {
6014
+				                              rowMessageArrprnst.push(convDataprn[n]);
6015
+							 }
6016
+
6017
+							 let convDataPerNmbrprnst = rowMessageArrprnst.join("");
6018
+
6019
+				                         $("#convListRowCell").empty();
6020
+				                         $("#convListRowCell").append(convDataPerNmbrprnst);
6021
+
6022
+				                         // Scroll down to the bottom of the window
6023
+				                         $("#conversationsText").animate({scrollTop: $("#conversationsText").prop("scrollHeight")}, 200);
6024
+
6025
+
6026
+				                         // Load more messages
6027
+				                         let clckNb = 0;
6028
+				                         $("#loadMoreMsgs").unbind("click");
6029
+				                         $("#loadMoreMsgs").click(function() {
6030
+
6031
+				                             clckNb++;
6032
+				                             var crefnb = (clckNb + 1) * nmbToBeLoaded;
6033
+
6034
+				                             $("#loadMoreMsgsusr").css("display", "none");
6035
+
6036
+				                             if (crefnb > convDataprn.length) {
6037
+				                                 var nmbmsg = convDataprn.length - 1;
6038
+				                                 $("#loadMoreMsgs").css("display", "none");
6039
+				                             } else {
6040
+				                                 var nmbmsg = crefnb - 1;
6041
+				                                 $("#loadMoreMsgs").css("display", "block");
6042
+				                             }
6043
+
6044
+				                             let rowMessageArrAddst = [];
6045
+
6046
+				                             for (var q = nmbmsg; q >= clckNb * nmbToBeLoaded; q--) {
6047
+
6048
+				                                  rowMessageArrAddst.push(convDataprn[q]);
6049
+				                             }
6050
+
6051
+							     let convDataPerNmbradst = rowMessageArrAddst.join("");
6052
+
6053
+				                             let scrlheight = $("#convListRowCell").height();
6054
+				                             $("#convListRowCell").prepend(convDataPerNmbradst);
6055
+
6056
+		                                             $("#conversationsText").animate({scrollTop: $("#convListRowCell").height() - scrlheight }, 0);
6057
+
6058
+				                         });
6059
+
6060
+							 $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
6061
+							 $("#diplNmAllMsgcv").css("color", "#04957b");
6062
+							 $(this).css("color", "#04c6a4");
6063
+
6064
+						     });
6065
+
6066
+
6067
+						     // Show the scroll-up arrow
6068
+						     $("#conversationsText").scroll(function() {
6069
+							if ($(this).scrollTop() > 900) {
6070
+							      $('#upArrow').fadeIn();
6071
+							} else {
6072
+							      $('#upArrow').fadeOut();
6073
+							}
6074
+						     });
6075
+
6076
+						     $("#upArrow").click(function(e) {
6077
+							$("#conversationsText").animate({scrollTop: 0}, 400);
6078
+						     });
6079
+
6080
+
6081
+						     // Download MMS files when clicking on their URLs
6082
+						     $('[id^="mmsTblUrl-"]').on('click', function(evt) {
6083
+
6084
+							var clckedUrl = $(this).text();
6085
+							var flNamearr = clckedUrl.split("/");
6086
+							var flName = flNamearr.reverse()[0];
6087
+
6088
+							confirmAlert("Download this file only if you trust the sender and the domain of the URL.");
6089
+
6090
+							$("#confirmOk").click(function() {
6091
+
6092
+							   $("#alertMsgOverlay").remove();
6093
+							   $("#alertConfMessage").remove();
6094
+
6095
+							   var mmsLink = document.createElement("a");
6096
+							   mmsLink.setAttribute('href', clckedUrl);
6097
+							   mmsLink.setAttribute('download', flName);
6098
+		                                           mmsLink.setAttribute('target', '_blank');
6099
+							   document.body.appendChild(mmsLink);
6100
+							   mmsLink.click();
6101
+							   mmsLink.remove();
6102
+							});
6103
+
6104
+							$("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
6105
+						     });
6106
+
6107
+
6108
+						     // Archive/Unarchive the current conversation
6109
+						     $("#archUnarchAct").click(function() {
6110
+
6111
+		                                        if (archivedConv == 1) {
6112
+
6113
+							    confirmAlert("Do you really want to <b>unarchive</b> this conversation ?");
6114
+
6115
+							    $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
6116
+
6117
+							    $("#confirmOk").click(function() {
6118
+
6119
+							       $("#alertMsgOverlay").remove();
6120
+							       $("#alertConfMessage").remove();
6121
+
6122
+							       var unarchiveUrl = OC.generateUrl("/apps/sms_relentless/user/unarchiveconv");
6123
+		                                               $('#smstables').addClass('icon-loading');
6124
+
6125
+							       $.ajax({
6126
+								  url: unarchiveUrl + '/' + userid,
6127
+		                                                  type: "POST",
6128
+								  data: { "conversationId": conversationId },
6129
+								  success: function(respunarch) {
6130
+
6131
+								              if (respunarch == "success") {
6132
+
6133
+								                  $('#smstables').removeClass('icon-loading');
6134
+
6135
+		                                                                  // Refresh the conversations list and the current conversation
6136
+										  $('#smstables').empty();
6137
+										  $("#conversationsshow").click();
6138
+
6139
+		                                                                  setTimeout(function() {
6140
+										     $(".convsListAct").each(function() {
6141
+											 if ($(this).find('[id^="activeImg-"]').data("conversationid") == conversationId) {
6142
+											     let actCvIda = $(this).attr("id");
6143
+		                                                                             document.getElementById(actCvIda).click();
6144
+											 }
6145
+										     });
6146
+		                                                                  }, 800);
6147
+
6148
+								              } else {
6149
+								                  showAlert("There was an error while unarchiving the conversation !");
6150
+								              }
6151
+								  },
6152
+								  error: function() {
6153
+								              showAlert("Error while attempting to unarchive the conversation.");
6154
+		                                                              $('#smstables').removeClass('icon-loading');
6155
+								  }
6156
+							       });
6157
+							    });
6158
+
6159
+		                                        } else {
6160
+
6161
+							    confirmAlert("Do you really want to <b>archive</b> this conversation ?");
6162
+
6163
+							    $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
6164
+
6165
+							    $("#confirmOk").click(function() {
6166
+
6167
+							       $("#alertMsgOverlay").remove();
6168
+							       $("#alertConfMessage").remove();
6169
+
6170
+							       var archiveUrl = OC.generateUrl("/apps/sms_relentless/user/archiveconv");
6171
+		                                               $('#smstables').addClass('icon-loading');
6172
+
6173
+							       $.ajax({
6174
+								  url: archiveUrl + '/' + userid,
6175
+		                                                  type: "POST",
6176
+								  data: { "conversationId": conversationId },
6177
+								  success: function(resparch) {
6178
+
6179
+								              if (resparch == "success") {
6180
+
6181
+								                  $('#smstables').removeClass('icon-loading');
6182
+
6183
+		                                                                  // Refresh the conversations list and the current conversation
6184
+										  $('#smstables').empty();
6185
+										  $("#conversationsshow").click();
6186
+
6187
+		                                                                  setTimeout(function() {
6188
+										     $(".convsListArch").each(function() {
6189
+											 if ($(this).find('[id^="archivedImg-"]').data("conversationid") == conversationId) {
6190
+											     let actCvIdb = $(this).attr("id");
6191
+		                                                                             document.getElementById(actCvIdb).click();
6192
+											 }
6193
+										     });
6194
+		                                                                  }, 800);
6195
+
6196
+								              } else {
6197
+								                  showAlert("There was an error while archiving the conversation !");
6198
+								              }
6199
+								  },
6200
+								  error: function() {
6201
+								              showAlert("Error while attempting to archive the conversation.");
6202
+		                                                              $('#smstables').removeClass('icon-loading');
6203
+								  }
6204
+							       });
6205
+							    });
6206
+		                                        }
6207
+						     });
6208
+
6209
+					  },
6210
+					  error: function() {
6211
+				                     showAlert("Error while attempting to get conversation messages from the database!");
6212
+						     $('#listAllMsgsConv').removeClass('icon-loading');
6213
+					  }
6214
+				   });
6215
+		             }
6216
+
6217
+		             $('[id^="indArchConv-"]').click(function() {
6218
+
6219
+		                $(".convsListArch").each(function(){ $(this).css("background-color", "rgb(252, 245, 251)"); });
6220
+		                $(".convsListAct").each(function(){ $(this).css("background-color", "rgb(239, 252, 252)"); });
6221
+		                $(this).css("background-color", "rgb(241, 224, 239)");
6222
+
6223
+		                let crtordnmbr = $(this).attr("id").replace("indArchConv-", "");
6224
+		                let phnNmbrFrom = $("#indArchCvFrom-"+ crtordnmbr).text().split(": ")[1];
6225
+		                let phnNmbrTo = $("#indArchCvTo-"+ crtordnmbr).text().split(": ")[1];
6226
+		                let conversationId = $(this).find('[id^="archivedImg-"]').data("conversationid");
6227
+		                let archivedConv = $(this).find('[id^="archivedImg-"]').data("archivedyesno");
6228
+		                let archivedBy = $(this).find('[id^="archivedImg-"]').data("archdispname");
6229
+		                let unarchivedBy = $(this).find('[id^="archivedImg-"]').data("unarchdispname");
6230
+		                let lastArchived = $(this).find('[id^="archivedImg-"]').data("lastarchived");
6231
+		                let lastUnarchived = $(this).find('[id^="archivedImg-"]').data("lastunarchived");
6232
+		                let flagged = $(this).find('[id^="archivedImg-"]').data("flagged");
6233
+		                let flagunflagby = $(this).find('[id^="archivedImg-"]').data("flagunflagby");
6234
+		                let flagunflagdate = $(this).find('[id^="archivedImg-"]').data("flagunflagdate");
6235
+		                let tag = $(this).find('[id^="archivedImg-"]').data("tag");
6236
+		                let taguntagby = $(this).find('[id^="archivedImg-"]').data("taguntagby");
6237
+		                let taguntagdate = $(this).find('[id^="archivedImg-"]').data("taguntagdate");
6238
+		                let convdescription = $(this).find('[id^="archivedImg-"]').data("convdescription");
6239
+		                let convdescchangeby = $(this).find('[id^="archivedImg-"]').data("convdescchangeby");
6240
+		                let convdescchangedate = $(this).find('[id^="archivedImg-"]').data("convdescchangedate");
6241
+
6242
+		                $("#conversationsText").empty();
6243
+		                getMsgsForNmbrs(phnNmbrFrom, phnNmbrTo, conversationId, archivedConv, archivedBy, unarchivedBy, lastArchived, lastUnarchived, flagged, flagunflagby, flagunflagdate, tag, taguntagby, taguntagdate, convdescription, convdescchangeby, convdescchangedate);
6244
+		             });
6245
+
6246
+		             $('[id^="indActConv-"]').click(function() {
6247
+
6248
+		                $(".convsListArch").each(function(){ $(this).css("background-color", "rgb(252, 245, 251)"); });
6249
+		                $(".convsListAct").each(function(){ $(this).css("background-color", "rgb(239, 252, 252)"); });
6250
+		                $(this).css("background-color", "rgb(215, 239, 239)");
6251
+
6252
+		                let crtordnmbr = $(this).attr("id").replace("indActConv-", "");
6253
+		                let phnNmbrFrom = $("#indActCvFrom-"+ crtordnmbr).text().split(": ")[1];
6254
+		                let phnNmbrTo = $("#indActCvTo-"+ crtordnmbr).text().split(": ")[1];
6255
+		                let conversationId = $(this).find('[id^="activeImg-"]').data("conversationid");
6256
+		                let archivedConv = $(this).find('[id^="activeImg-"]').data("archivedyesno");
6257
+		                let archivedBy = $(this).find('[id^="activeImg-"]').data("archdispname");
6258
+		                let unarchivedBy = $(this).find('[id^="activeImg-"]').data("unarchdispname");
6259
+		                let lastArchived = $(this).find('[id^="activeImg-"]').data("lastarchived");
6260
+		                let lastUnarchived = $(this).find('[id^="activeImg-"]').data("lastunarchived");
6261
+		                let flagged = $(this).find('[id^="activeImg-"]').data("flagged");
6262
+		                let flagunflagby = $(this).find('[id^="activeImg-"]').data("flagunflagby");
6263
+		                let flagunflagdate = $(this).find('[id^="activeImg-"]').data("flagunflagdate");
6264
+		                let tag = $(this).find('[id^="activeImg-"]').data("tag");
6265
+		                let taguntagby = $(this).find('[id^="activeImg-"]').data("taguntagby");
6266
+		                let taguntagdate = $(this).find('[id^="activeImg-"]').data("taguntagdate");
6267
+		                let convdescription = $(this).find('[id^="activeImg-"]').data("convdescription");
6268
+		                let convdescchangeby = $(this).find('[id^="activeImg-"]').data("convdescchangeby");
6269
+		                let convdescchangedate = $(this).find('[id^="activeImg-"]').data("convdescchangedate");
6270
+
6271
+		                $("#conversationsText").empty();
6272
+		                getMsgsForNmbrs(phnNmbrFrom, phnNmbrTo, conversationId, archivedConv, archivedBy, unarchivedBy, lastArchived, lastUnarchived, flagged, flagunflagby, flagunflagdate, tag, taguntagby, taguntagdate, convdescription, convdescchangeby, convdescchangedate);
6273
+		             });
6274
+                     }
6275
+                     convListContent();
6276
+
6277
+                     // Add the filter section
6278
+                     $("#convArchAndActive").prepend("<div id='filterSection' title='Click to show filters'><div id='filterSecImg'></div></div>");
6279
+
6280
+                     // Add the 'Filter by flag' filter
6281
+                     $("#convArchAndActive").prepend("<div id='filterByFlag'><div id='filterByFlagImg'></div><select id='flagFilter'><option value='filterbyflag' selected='selected' disabled=''>Filter by flag</option><option value='flagged'>Flagged</option><option value='unflagged'>Unflagged</option></select><div id='clearFlagFilter' title='Clear all filters'></div></div>");
6282
+
6283
+                     $("#flagFilter").change(function() {
6284
+
6285
+                        var flagSel = $(this).val();
6286
+
6287
+                        $(".convsLst").each(function() { $(this).remove(); });
6288
+                        $("#totalConvNmbr").remove();
6289
+                        $('#tagFilter option[value="filterbytag"]').prop("selected", true);
6290
+                        $("#flagFilter").css("background-color", "#f5f0ff");
6291
+                        $("#tagFilter").css("background-color", "#f0fbff");
6292
+
6293
+                        if (flagSel == "flagged") {
6294
+
6295
+		             if (archivedConvNmbr == 0) {
6296
+		                 // Don't list any archived conversations
6297
+		                 var archivedCvNbf = 0;
6298
+
6299
+		             } else if (archivedConvNmbr != 0 && archivedConvNmbr != null) {
6300
+
6301
+                                 var archInd = 0;
6302
+		                 let fcnv = (archivedConvNmbr <= convArchived.length)? convArchived.length - archivedConvNmbr : 0;
6303
+		                 for (let s = fcnv; s < convArchived.length; s++) {
6304
+
6305
+                                      if (convArchived[s]['flagged'] == 1) {
6306
+		                          var emptyRedFlags = "cvFlagRed";
6307
+		                          if (convArchived[s]['tag'] != "") { var cvTagTxts = convArchived[s]['tag']; var cvTagAdds = "convTagAdded"; } else { var cvTagTxts = ""; var cvTagAdds = "convTag"; }
6308
+		                          var cvDescAdds = (convArchived[s]['description'] != "")? "convDescAdded" : "convDesc";
6309
+		                          $("#convArchAndActive").append("<div class='convsListArch convsLst' id='indArchConv-"+ s +"'><div id='archivedImg-"+ s +"' class='archactImg archConvImg' data-conversationid='"+ convArchived[s]['conversation_id'] +"' data-archivedyesno='"+ convArchived[s]['archived'] +"' data-archdispname='"+ convArchived[s]['archived_by'] +"' data-unarchdispname='"+ convArchived[s]['unarchived_by'] +"' data-lastarchived='"+ convArchived[s]['last_archived'] +"' data-lastunarchived='"+ convArchived[s]['last_unarchived'] +"' data-convdescription='"+ convArchived[s]['description'] +"' data-convdescchangeby='"+ convArchived[s]['descriptionby'] +"' data-convdescchangedate='"+ convArchived[s]['descriptiondate'] +"' data-tag='"+ cvTagTxts +"' data-taguntagby='"+ convArchived[s]['taguntagby'] +"' data-taguntagdate='"+ convArchived[s]['taguntagdate'] +"' data-flagged='"+ convArchived[s]['flagged'] +"' data-flagunflagby='"+ convArchived[s]['flagunflagby'] +"' data-flagunflagdate='"+ convArchived[s]['flagunflagdate'] +"'><img src='/" + ctappdir + "/sms_relentless/img/archived.svg' title='Archived conversation'></div><div class='convLastMsgFrom' id='indArchCvFrom-"+ s +"'>From: "+ convArchived[s]['last_msg_from'] +"</div><div class='convLastMsgTo' id='indArchCvTo-"+ s +"'>To: "+ convArchived[s]['last_msg_to'] +"</div><div class='convLastMsg'><span class='msgAuthorNameConv'>"+ convArchived[s]['lastmsgdisplayname'] +":</span>"+ convArchived[s]['last_message'] +"</div><div class='dateSection'><div class='dateClock' title='Last message date. (Archived conversations are ordered by the date of the last message.)'></div><div class='convLastMsgDate'>"+ convArchived[s]['last_msg_date'] +"</div></div><div id='addArchDesc-"+ s +"' class='"+ cvDescAdds +"' title='Click to add or modify description.'></div><div id='addArchTag-"+ s +"' class='"+ cvTagAdds +"' title='Click to add or modify tag.'></div><div class='archactTag'>"+ cvTagTxts +"</div><div id='addArchFlag-"+ s +"' class='"+ emptyRedFlags +"' title='Click to set or remove flag.'></div></div>");
6310
+                                          archInd++;
6311
+                                      }
6312
+		                 }
6313
+		                 var archivedCvNbf = archInd;
6314
+
6315
+		             } else {
6316
+
6317
+                                 var archInd = 0;
6318
+		                 for (let a = 0; a < convArchived.length; a++) {
6319
+
6320
+                                      if (convArchived[a]['flagged'] == 1) {
6321
+		                          var emptyRedFlaga = "cvFlagRed";
6322
+		                          if (convArchived[a]['tag'] != "") { var cvTagTxta = convArchived[a]['tag']; var cvTagAdda = "convTagAdded"; } else { var cvTagTxta = ""; var cvTagAdda = "convTag"; }
6323
+		                          var cvDescAdda = (convArchived[a]['description'] != "")? "convDescAdded" : "convDesc";
6324
+		                          $("#convArchAndActive").append("<div class='convsListArch convsLst' id='indArchConv-"+ a +"'><div id='archivedImg-"+ a +"' class='archactImg archConvImg' data-conversationid='"+ convArchived[a]['conversation_id'] +"' data-archivedyesno='"+ convArchived[a]['archived'] +"' data-archdispname='"+ convArchived[a]['archived_by'] +"' data-unarchdispname='"+ convArchived[a]['unarchived_by'] +"' data-lastarchived='"+ convArchived[a]['last_archived'] +"' data-lastunarchived='"+ convArchived[a]['last_unarchived'] +"' data-convdescription='"+ convArchived[a]['description'] +"' data-convdescchangeby='"+ convArchived[a]['descriptionby'] +"' data-convdescchangedate='"+ convArchived[a]['descriptiondate'] +"' data-tag='"+ cvTagTxta +"' data-taguntagby='"+ convArchived[a]['taguntagby'] +"' data-taguntagdate='"+ convArchived[a]['taguntagdate'] +"' data-flagged='"+ convArchived[a]['flagged'] +"' data-flagunflagby='"+ convArchived[a]['flagunflagby'] +"' data-flagunflagdate='"+ convArchived[a]['flagunflagdate'] +"'><img src='/" + ctappdir + "/sms_relentless/img/archived.svg' title='Archived conversation'></div><div class='convLastMsgFrom' id='indArchCvFrom-"+ a +"'>From: "+ convArchived[a]['last_msg_from'] +"</div><div class='convLastMsgTo' id='indArchCvTo-"+ a +"'>To: "+ convArchived[a]['last_msg_to'] +"</div><div class='convLastMsg'><span class='msgAuthorNameConv'>"+ convArchived[a]['lastmsgdisplayname'] +":</span>"+ convArchived[a]['last_message'] +"</div><div class='dateSection'><div class='dateClock' title='Last message date. (Archived conversations are ordered by the date of the last message.)'></div><div class='convLastMsgDate'>"+ convArchived[a]['last_msg_date'] +"</div></div><div id='addArchDesc-"+ a +"' class='"+ cvDescAdda +"' title='Click to add or modify description.'></div><div id='addArchTag-"+ a +"' class='"+ cvTagAdda +"' title='Click to add or modify tag.'></div><div class='archactTag'>"+ cvTagTxta +"</div><div id='addArchFlag-"+ a +"' class='"+ emptyRedFlaga +"' title='Click to set or remove flag.'></div></div>");
6325
+                                          archInd++;
6326
+                                      }
6327
+		                 }
6328
+		                 var archivedCvNbf = archInd;
6329
+		             }
6330
+
6331
+                             var actInd = 0;
6332
+		             for (let t = 0; t < convActive.length; t++) {
6333
+
6334
+                                  if (convActive[t]['flagged'] == 1) {
6335
+		                      var emptyRedFlagt = "cvFlagRed";
6336
+		                      if (convActive[t]['tag'] != "") { var cvTagTxtt = convActive[t]['tag']; var cvTagAddt = "convTagAdded"; } else { var cvTagTxtt = ""; var cvTagAddt = "convTag"; }
6337
+		                      var cvDescAddt = (convActive[t]['description'] != "")? "convDescAdded" : "convDesc";
6338
+		                      $("#convArchAndActive").append("<div class='convsListAct convsLst' id='indActConv-"+ t +"'><div id='activeImg-"+ t +"' class='archactImg activeConvImg' data-conversationid='"+ convActive[t]['conversation_id'] +"' data-archivedyesno='"+ convActive[t]['archived'] +"' data-archdispname='"+ convActive[t]['archived_by'] +"' data-unarchdispname='"+ convActive[t]['unarchived_by'] +"' data-lastarchived='"+ convActive[t]['last_archived'] +"' data-lastunarchived='"+ convActive[t]['last_unarchived'] +"' data-convdescription='"+ convActive[t]['description'] +"' data-convdescchangeby='"+ convActive[t]['descriptionby'] +"' data-convdescchangedate='"+ convActive[t]['descriptiondate'] +"' data-tag='"+ cvTagTxtt +"' data-taguntagby='"+ convActive[t]['taguntagby'] +"' data-taguntagdate='"+ convActive[t]['taguntagdate'] +"' data-flagged='"+ convActive[t]['flagged'] +"' data-flagunflagby='"+ convActive[t]['flagunflagby'] +"' data-flagunflagdate='"+ convActive[t]['flagunflagdate'] +"'><img src='/" + ctappdir + "/sms_relentless/img/active.svg' title='Active conversation'></div><div class='convLastMsgFrom' id='indActCvFrom-"+ t +"'>From: "+ convActive[t]['last_msg_from'] +"</div><div class='convLastMsgTo' id='indActCvTo-"+ t +"'>To: "+ convActive[t]['last_msg_to'] +"</div><div class='convLastMsg'><span class='msgAuthorNameConv'>"+ convActive[t]['lastmsgdisplayname'] +":</span>"+ convActive[t]['last_message'] +"</div><div class='dateSection'><div class='dateClock' title='Last message date. (Active conversations are ordered by the date of the last message.)'></div><div class='convLastMsgDate'>"+ convActive[t]['last_msg_date'] +"</div></div><div id='addActDesc-"+ t +"' class='"+ cvDescAddt +"' title='Click to add or modify description.'></div><div id='addActTag-"+ t +"' class='"+ cvTagAddt +"' title='Click to add or modify tag.'></div><div class='archactTag'>"+ cvTagTxtt +"</div><div id='addActFlag-"+ t +"' class='"+ emptyRedFlagt +"' title='Click to set or remove flag.'></div></div>");
6339
+                                      actInd++;
6340
+                                  }
6341
+		             }
6342
+
6343
+		             var totalConvNbf = archivedCvNbf + actInd;
6344
+
6345
+                        } else if (flagSel == "unflagged") {
6346
+
6347
+		             if (archivedConvNmbr == 0) {
6348
+		                 // Don't list any archived conversations
6349
+		                 var archivedCvNbf = 0;
6350
+
6351
+		             } else if (archivedConvNmbr != 0 && archivedConvNmbr != null) {
6352
+
6353
+                                 var archInd = 0;
6354
+		                 let fcnv = (archivedConvNmbr <= convArchived.length)? convArchived.length - archivedConvNmbr : 0;
6355
+		                 for (let s = fcnv; s < convArchived.length; s++) {
6356
+
6357
+                                      if (convArchived[s]['flagged'] != 1) {
6358
+		                          var emptyRedFlags = "cvFlagEmpty";
6359
+		                          if (convArchived[s]['tag'] != "") { var cvTagTxts = convArchived[s]['tag']; var cvTagAdds = "convTagAdded"; } else { var cvTagTxts = ""; var cvTagAdds = "convTag"; }
6360
+		                          var cvDescAdds = (convArchived[s]['description'] != "")? "convDescAdded" : "convDesc";
6361
+		                          $("#convArchAndActive").append("<div class='convsListArch convsLst' id='indArchConv-"+ s +"'><div id='archivedImg-"+ s +"' class='archactImg archConvImg' data-conversationid='"+ convArchived[s]['conversation_id'] +"' data-archivedyesno='"+ convArchived[s]['archived'] +"' data-archdispname='"+ convArchived[s]['archived_by'] +"' data-unarchdispname='"+ convArchived[s]['unarchived_by'] +"' data-lastarchived='"+ convArchived[s]['last_archived'] +"' data-lastunarchived='"+ convArchived[s]['last_unarchived'] +"' data-convdescription='"+ convArchived[s]['description'] +"' data-convdescchangeby='"+ convArchived[s]['descriptionby'] +"' data-convdescchangedate='"+ convArchived[s]['descriptiondate'] +"' data-tag='"+ cvTagTxts +"' data-taguntagby='"+ convArchived[s]['taguntagby'] +"' data-taguntagdate='"+ convArchived[s]['taguntagdate'] +"' data-flagged='"+ convArchived[s]['flagged'] +"' data-flagunflagby='"+ convArchived[s]['flagunflagby'] +"' data-flagunflagdate='"+ convArchived[s]['flagunflagdate'] +"'><img src='/" + ctappdir + "/sms_relentless/img/archived.svg' title='Archived conversation'></div><div class='convLastMsgFrom' id='indArchCvFrom-"+ s +"'>From: "+ convArchived[s]['last_msg_from'] +"</div><div class='convLastMsgTo' id='indArchCvTo-"+ s +"'>To: "+ convArchived[s]['last_msg_to'] +"</div><div class='convLastMsg'><span class='msgAuthorNameConv'>"+ convArchived[s]['lastmsgdisplayname'] +":</span>"+ convArchived[s]['last_message'] +"</div><div class='dateSection'><div class='dateClock' title='Last message date. (Archived conversations are ordered by the date of the last message.)'></div><div class='convLastMsgDate'>"+ convArchived[s]['last_msg_date'] +"</div></div><div id='addArchDesc-"+ s +"' class='"+ cvDescAdds +"' title='Click to add or modify description.'></div><div id='addArchTag-"+ s +"' class='"+ cvTagAdds +"' title='Click to add or modify tag.'></div><div class='archactTag'>"+ cvTagTxts +"</div><div id='addArchFlag-"+ s +"' class='"+ emptyRedFlags +"' title='Click to set or remove flag.'></div></div>");
6362
+                                          archInd++;
6363
+                                      }
6364
+		                 }
6365
+		                 var archivedCvNbf = archInd;
6366
+
6367
+		             } else {
6368
+
6369
+                                 var archInd = 0;
6370
+		                 for (let a = 0; a < convArchived.length; a++) {
6371
+
6372
+                                      if (convArchived[a]['flagged'] != 1) {
6373
+		                          var emptyRedFlaga = "cvFlagEmpty";
6374
+		                          if (convArchived[a]['tag'] != "") { var cvTagTxta = convArchived[a]['tag']; var cvTagAdda = "convTagAdded"; } else { var cvTagTxta = ''; var cvTagAdda = "convTag"; }
6375
+		                          var cvDescAdda = (convArchived[a]['description'] != "")? "convDescAdded" : "convDesc";
6376
+		                          $("#convArchAndActive").append("<div class='convsListArch convsLst' id='indArchConv-"+ a +"'><div id='archivedImg-"+ a +"' class='archactImg archConvImg' data-conversationid='"+ convArchived[a]['conversation_id'] +"' data-archivedyesno='"+ convArchived[a]['archived'] +"' data-archdispname='"+ convArchived[a]['archived_by'] +"' data-unarchdispname='"+ convArchived[a]['unarchived_by'] +"' data-lastarchived='"+ convArchived[a]['last_archived'] +"' data-lastunarchived='"+ convArchived[a]['last_unarchived'] +"' data-convdescription='"+ convArchived[a]['description'] +"' data-convdescchangeby='"+ convArchived[a]['descriptionby'] +"' data-convdescchangedate='"+ convArchived[a]['descriptiondate'] +"' data-tag='"+ cvTagTxta +"' data-taguntagby='"+ convArchived[a]['taguntagby'] +"' data-taguntagdate='"+ convArchived[a]['taguntagdate'] +"' data-flagged='"+ convArchived[a]['flagged'] +"' data-flagunflagby='"+ convArchived[a]['flagunflagby'] +"' data-flagunflagdate='"+ convArchived[a]['flagunflagdate'] +"'><img src='/" + ctappdir + "/sms_relentless/img/archived.svg' title='Archived conversation'></div><div class='convLastMsgFrom' id='indArchCvFrom-"+ a +"'>From: "+ convArchived[a]['last_msg_from'] +"</div><div class='convLastMsgTo' id='indArchCvTo-"+ a +"'>To: "+ convArchived[a]['last_msg_to'] +"</div><div class='convLastMsg'><span class='msgAuthorNameConv'>"+ convArchived[a]['lastmsgdisplayname'] +":</span>"+ convArchived[a]['last_message'] +"</div><div class='dateSection'><div class='dateClock' title='Last message date. (Archived conversations are ordered by the date of the last message.)'></div><div class='convLastMsgDate'>"+ convArchived[a]['last_msg_date'] +"</div></div><div id='addArchDesc-"+ a +"' class='"+ cvDescAdda +"' title='Click to add or modify description.'></div><div id='addArchTag-"+ a +"' class='"+ cvTagAdda +"' title='Click to add or modify tag.'></div><div class='archactTag'>"+ cvTagTxta +"</div><div id='addArchFlag-"+ a +"' class='"+ emptyRedFlaga +"' title='Click to set or remove flag.'></div></div>");
6377
+                                          archInd++;
6378
+                                      }
6379
+		                 }
6380
+		                 var archivedCvNbf = archInd;
6381
+		             }
6382
+
6383
+                             var actInd = 0;
6384
+		             for (let t = 0; t < convActive.length; t++) {
6385
+
6386
+                                  if (convActive[t]['flagged'] != 1) {
6387
+		                      var emptyRedFlagt = "cvFlagEmpty";
6388
+		                      if (convActive[t]['tag'] != "") { var cvTagTxtt = convActive[t]['tag']; var cvTagAddt = "convTagAdded"; } else { var cvTagTxtt = ""; var cvTagAddt = "convTag"; }
6389
+		                      var cvDescAddt = (convActive[t]['description'] != "")? "convDescAdded" : "convDesc";
6390
+		                      $("#convArchAndActive").append("<div class='convsListAct convsLst' id='indActConv-"+ t +"'><div id='activeImg-"+ t +"' class='archactImg activeConvImg' data-conversationid='"+ convActive[t]['conversation_id'] +"' data-archivedyesno='"+ convActive[t]['archived'] +"' data-archdispname='"+ convActive[t]['archived_by'] +"' data-unarchdispname='"+ convActive[t]['unarchived_by'] +"' data-lastarchived='"+ convActive[t]['last_archived'] +"' data-lastunarchived='"+ convActive[t]['last_unarchived'] +"' data-convdescription='"+ convActive[t]['description'] +"' data-convdescchangeby='"+ convActive[t]['descriptionby'] +"' data-convdescchangedate='"+ convActive[t]['descriptiondate'] +"' data-tag='"+ cvTagTxtt +"' data-taguntagby='"+ convActive[t]['taguntagby'] +"' data-taguntagdate='"+ convActive[t]['taguntagdate'] +"' data-flagged='"+ convActive[t]['flagged'] +"' data-flagunflagby='"+ convActive[t]['flagunflagby'] +"' data-flagunflagdate='"+ convActive[t]['flagunflagdate'] +"'><img src='/" + ctappdir + "/sms_relentless/img/active.svg' title='Active conversation'></div><div class='convLastMsgFrom' id='indActCvFrom-"+ t +"'>From: "+ convActive[t]['last_msg_from'] +"</div><div class='convLastMsgTo' id='indActCvTo-"+ t +"'>To: "+ convActive[t]['last_msg_to'] +"</div><div class='convLastMsg'><span class='msgAuthorNameConv'>"+ convActive[t]['lastmsgdisplayname'] +":</span>"+ convActive[t]['last_message'] +"</div><div class='dateSection'><div class='dateClock' title='Last message date. (Active conversations are ordered by the date of the last message.)'></div><div class='convLastMsgDate'>"+ convActive[t]['last_msg_date'] +"</div></div><div id='addActDesc-"+ t +"' class='"+ cvDescAddt +"' title='Click to add or modify description.'></div><div id='addActTag-"+ t +"' class='"+ cvTagAddt +"' title='Click to add or modify tag.'></div><div class='archactTag'>"+ cvTagTxtt +"</div><div id='addActFlag-"+ t +"' class='"+ emptyRedFlagt +"' title='Click to set or remove flag.'></div></div>");
6391
+                                      actInd++;
6392
+                                  }
6393
+		             }
6394
+
6395
+		             var totalConvNbf = archivedCvNbf + actInd;
6396
+                        }
6397
+
6398
+	                // Add the row that specifies the number of conversations displayed
6399
+	                $("#convArchAndActive").append("<div id='totalConvNmbr'>"+ totalConvNbf +" conversations displayed (<span id='archivedCvImg' title='Archived conversations'></span>"+ archivedCvNbf +"<span id='activeCvImg' title='Active conversations'></span>"+ actInd +" )</div>");
6400
+
6401
+		        // Remove the empty display names, if any
6402
+		        $(".msgAuthorNameConv").each(function() { if ($(this).text() == ":") { $(this).remove(); } });
6403
+
6404
+                        convListContent();
6405
+                     });
6406
+
6407
+                     // Clear the flag filter
6408
+                     $("#clearFlagFilter").click(function() { $("#conversationsshow").click(); });
6409
+
6410
+
6411
+                     // Add the 'Filter by tag' filter
6412
+                     var selectTagOpt = "<option value='filterbytag' selected='selected' disabled=''>Filter by tag</option>";
6413
+                     for (let v = 0; v < taggsArr.length; v++) {
6414
+                          selectTagOpt += "<option value='"+ taggsArr[v] +"'>"+ taggsArr[v] +"</option>";
6415
+                     }
6416
+                     selectTagOpt += "<option value=''>--- empty tag ---</option>";
6417
+                     $("#convArchAndActive").prepend("<div id='filterByTag'><div id='filterByTagImg'></div><select id='tagFilter'>"+ selectTagOpt +"</select><div id='clearTagFilter' title='Clear all filters'></div></div>");
6418
+
6419
+                     $("#tagFilter").change(function() {
6420
+
6421
+                        var tagSel = $(this).val();
6422
+
6423
+                        $(".convsLst").each(function() { $(this).remove(); });
6424
+                        $("#totalConvNmbr").remove();
6425
+                        $('#flagFilter option[value="filterbyflag"]').prop("selected", true);
6426
+                        $("#tagFilter").css("background-color", "#f5f0ff");
6427
+                        $("#flagFilter").css("background-color", "#f0fbff");
6428
+
6429
+			if (archivedConvNmbr == 0) {
6430
+		            // Don't list any archived conversations
6431
+		            var archivedCvNbt = 0;
6432
+
6433
+		        } else if (archivedConvNmbr != 0 && archivedConvNmbr != null) {
6434
+
6435
+                                 var archIndt = 0;
6436
+		                 let fcnv = (archivedConvNmbr <= convArchived.length)? convArchived.length - archivedConvNmbr : 0;
6437
+		                 for (let s = fcnv; s < convArchived.length; s++) {
6438
+
6439
+                                      if (String(convArchived[s]['tag']) == tagSel) {
6440
+		                          var emptyRedFlags = (convArchived[s]['flagged'] == 1)? "cvFlagRed" : "cvFlagEmpty";
6441
+		                          if (convArchived[s]['tag'] != "") { var cvTagTxts = convArchived[s]['tag']; var cvTagAdds = "convTagAdded"; } else { var cvTagTxts = ""; var cvTagAdds = "convTag"; }
6442
+		                          var cvDescAdds = (convArchived[s]['description'] != "")? "convDescAdded" : "convDesc";
6443
+		                          $("#convArchAndActive").append("<div class='convsListArch convsLst' id='indArchConv-"+ s +"'><div id='archivedImg-"+ s +"' class='archactImg archConvImg' data-conversationid='"+ convArchived[s]['conversation_id'] +"' data-archivedyesno='"+ convArchived[s]['archived'] +"' data-archdispname='"+ convArchived[s]['archived_by'] +"' data-unarchdispname='"+ convArchived[s]['unarchived_by'] +"' data-lastarchived='"+ convArchived[s]['last_archived'] +"' data-lastunarchived='"+ convArchived[s]['last_unarchived'] +"' data-convdescription='"+ convArchived[s]['description'] +"' data-convdescchangeby='"+ convArchived[s]['descriptionby'] +"' data-convdescchangedate='"+ convArchived[s]['descriptiondate'] +"' data-tag='"+ cvTagTxts +"' data-taguntagby='"+ convArchived[s]['taguntagby'] +"' data-taguntagdate='"+ convArchived[s]['taguntagdate'] +"' data-flagged='"+ convArchived[s]['flagged'] +"' data-flagunflagby='"+ convArchived[s]['flagunflagby'] +"' data-flagunflagdate='"+ convArchived[s]['flagunflagdate'] +"'><img src='/" + ctappdir + "/sms_relentless/img/archived.svg' title='Archived conversation'></div><div class='convLastMsgFrom' id='indArchCvFrom-"+ s +"'>From: "+ convArchived[s]['last_msg_from'] +"</div><div class='convLastMsgTo' id='indArchCvTo-"+ s +"'>To: "+ convArchived[s]['last_msg_to'] +"</div><div class='convLastMsg'><span class='msgAuthorNameConv'>"+ convArchived[s]['lastmsgdisplayname'] +":</span>"+ convArchived[s]['last_message'] +"</div><div class='dateSection'><div class='dateClock' title='Last message date. (Archived conversations are ordered by the date of the last message.)'></div><div class='convLastMsgDate'>"+ convArchived[s]['last_msg_date'] +"</div></div><div id='addArchDesc-"+ s +"' class='"+ cvDescAdds +"' title='Click to add or modify description.'></div><div id='addArchTag-"+ s +"' class='"+ cvTagAdds +"' title='Click to add or modify tag.'></div><div class='archactTag'>"+ cvTagTxts +"</div><div id='addArchFlag-"+ s +"' class='"+ emptyRedFlags +"' title='Click to set or remove flag.'></div></div>");
6444
+                                          archIndt++;
6445
+                                      }
6446
+		                 }
6447
+		                 var archivedCvNbt = archIndt;
6448
+
6449
+		        } else {
6450
+
6451
+                                 var archIndt = 0;
6452
+		                 for (let a = 0; a < convArchived.length; a++) {
6453
+
6454
+                                      if (String(convArchived[a]['tag']) == tagSel) {
6455
+		                          var emptyRedFlaga = (convArchived[a]['flagged'] == 1)? "cvFlagRed" : "cvFlagEmpty";
6456
+		                          if (convArchived[a]['tag'] != "") { var cvTagTxta = convArchived[a]['tag']; var cvTagAdda = "convTagAdded"; } else { var cvTagTxta = ""; var cvTagAdda = "convTag"; }
6457
+		                          var cvDescAdda = (convArchived[a]['description'] != "")? "convDescAdded" : "convDesc";
6458
+		                          $("#convArchAndActive").append("<div class='convsListArch convsLst' id='indArchConv-"+ a +"'><div id='archivedImg-"+ a +"' class='archactImg archConvImg' data-conversationid='"+ convArchived[a]['conversation_id'] +"' data-archivedyesno='"+ convArchived[a]['archived'] +"' data-archdispname='"+ convArchived[a]['archived_by'] +"' data-unarchdispname='"+ convArchived[a]['unarchived_by'] +"' data-lastarchived='"+ convArchived[a]['last_archived'] +"' data-lastunarchived='"+ convArchived[a]['last_unarchived'] +"' data-convdescription='"+ convArchived[a]['description'] +"' data-convdescchangeby='"+ convArchived[a]['descriptionby'] +"' data-convdescchangedate='"+ convArchived[a]['descriptiondate'] +"' data-tag='"+ cvTagTxta +"' data-taguntagby='"+ convArchived[a]['taguntagby'] +"' data-taguntagdate='"+ convArchived[a]['taguntagdate'] +"' data-flagged='"+ convArchived[a]['flagged'] +"' data-flagunflagby='"+ convArchived[a]['flagunflagby'] +"' data-flagunflagdate='"+ convArchived[a]['flagunflagdate'] +"'><img src='/" + ctappdir + "/sms_relentless/img/archived.svg' title='Archived conversation'></div><div class='convLastMsgFrom' id='indArchCvFrom-"+ a +"'>From: "+ convArchived[a]['last_msg_from'] +"</div><div class='convLastMsgTo' id='indArchCvTo-"+ a +"'>To: "+ convArchived[a]['last_msg_to'] +"</div><div class='convLastMsg'><span class='msgAuthorNameConv'>"+ convArchived[a]['lastmsgdisplayname'] +":</span>"+ convArchived[a]['last_message'] +"</div><div class='dateSection'><div class='dateClock' title='Last message date. (Archived conversations are ordered by the date of the last message.)'></div><div class='convLastMsgDate'>"+ convArchived[a]['last_msg_date'] +"</div></div><div id='addArchDesc-"+ a +"' class='"+ cvDescAdda +"' title='Click to add or modify description.'></div><div id='addArchTag-"+ a +"' class='"+ cvTagAdda +"' title='Click to add or modify tag.'></div><div class='archactTag'>"+ cvTagTxta +"</div><div id='addArchFlag-"+ a +"' class='"+ emptyRedFlaga +"' title='Click to set or remove flag.'></div></div>");
6459
+                                          archIndt++;
6460
+                                      }
6461
+		                 }
6462
+		                 var archivedCvNbt = archIndt;
6463
+		        }
6464
+
6465
+                        var actIndt = 0;
6466
+		        for (let t = 0; t < convActive.length; t++) {
6467
+
6468
+                             if (String(convActive[t]['tag']) == tagSel) {
6469
+		                 var emptyRedFlagt = (convActive[t]['flagged'] == 1)? "cvFlagRed" : "cvFlagEmpty";
6470
+		                 if (convActive[t]['tag'] != "") { var cvTagTxtt = convActive[t]['tag']; var cvTagAddt = "convTagAdded"; } else { var cvTagTxtt = ""; var cvTagAddt = "convTag"; }
6471
+		                 var cvDescAddt = (convActive[t]['description'] != "")? "convDescAdded" : "convDesc";
6472
+		                 $("#convArchAndActive").append("<div class='convsListAct convsLst' id='indActConv-"+ t +"'><div id='activeImg-"+ t +"' class='archactImg activeConvImg' data-conversationid='"+ convActive[t]['conversation_id'] +"' data-archivedyesno='"+ convActive[t]['archived'] +"' data-archdispname='"+ convActive[t]['archived_by'] +"' data-unarchdispname='"+ convActive[t]['unarchived_by'] +"' data-lastarchived='"+ convActive[t]['last_archived'] +"' data-lastunarchived='"+ convActive[t]['last_unarchived'] +"' data-convdescription='"+ convActive[t]['description'] +"' data-convdescchangeby='"+ convActive[t]['descriptionby'] +"' data-convdescchangedate='"+ convActive[t]['descriptiondate'] +"' data-tag='"+ cvTagTxtt +"' data-taguntagby='"+ convActive[t]['taguntagby'] +"' data-taguntagdate='"+ convActive[t]['taguntagdate'] +"' data-flagged='"+ convActive[t]['flagged'] +"' data-flagunflagby='"+ convActive[t]['flagunflagby'] +"' data-flagunflagdate='"+ convActive[t]['flagunflagdate'] +"'><img src='/" + ctappdir + "/sms_relentless/img/active.svg' title='Active conversation'></div><div class='convLastMsgFrom' id='indActCvFrom-"+ t +"'>From: "+ convActive[t]['last_msg_from'] +"</div><div class='convLastMsgTo' id='indActCvTo-"+ t +"'>To: "+ convActive[t]['last_msg_to'] +"</div><div class='convLastMsg'><span class='msgAuthorNameConv'>"+ convActive[t]['lastmsgdisplayname'] +":</span>"+ convActive[t]['last_message'] +"</div><div class='dateSection'><div class='dateClock' title='Last message date. (Active conversations are ordered by the date of the last message.)'></div><div class='convLastMsgDate'>"+ convActive[t]['last_msg_date'] +"</div></div><div id='addActDesc-"+ t +"' class='"+ cvDescAddt +"' title='Click to add or modify description.'></div><div id='addActTag-"+ t +"' class='"+ cvTagAddt +"' title='Click to add or modify tag.'></div><div class='archactTag'>"+ cvTagTxtt +"</div><div id='addActFlag-"+ t +"' class='"+ emptyRedFlagt +"' title='Click to set or remove flag.'></div></div>");
6473
+                                 actIndt++;
6474
+                             }
6475
+		        }
6476
+
6477
+		        var totalConvNbt = archivedCvNbt + actIndt;
6478
+
6479
+	                // Add the row that specifies the number of conversations displayed
6480
+	                $("#convArchAndActive").append("<div id='totalConvNmbr'>"+ totalConvNbt +" conversations displayed (<span id='archivedCvImg' title='Archived conversations'></span>"+ archivedCvNbt +"<span id='activeCvImg' title='Active conversations'></span>"+ actIndt +" )</div>");
6481
+
6482
+		        // Remove the empty display names, if any
6483
+		        $(".msgAuthorNameConv").each(function() { if ($(this).text() == ":") { $(this).remove(); } });
6484
+
6485
+                        convListContent();
6486
+                     });
6487
+
6488
+                     // Clear the tag filter
6489
+                     $("#clearTagFilter").click(function() { $("#conversationsshow").click(); });
6490
+
6491
+                     // Show/Hide the filters
6492
+                     $("#filterSection").click(function() {
6493
+                        if ($("#filterByTag").is(":visible")) {
6494
+                            $("#filterByTag,#filterByFlag").css("display", "none");
6495
+                            $("#filterSection").css("background-color", "#f0fbff");
6496
+                            $("#filterSection").prop("title", "Click to show filters");
6497
+                        } else {
6498
+                            $("#filterByTag,#filterByFlag").css("display", "block");
6499
+                            $("#filterSection").css("background-color", "#f0f5ff");
6500
+                            $("#filterSection").prop("title", "Click to hide filters");
6501
+                        }
6502
+                     });
6503
+
6504
+          },
6505
+          error: function() {
6506
+                     showAlert("Error! You can check the Nextcloud log to find more details about this issue.");
6507
+                     $('#smstables').removeClass('icon-loading');
6508
+          }
6509
+     });
6510
+
6511
+     // Look for the 'new received message' indicator in the database, to know if the received messages list needs to be refreshed
6512
+     intervalNmfr = setInterval(function() { checkIfNewMessage(); }, newMsgInterval);
6513
+
6514
+  });
6515
+
6516
+
6517
+  // List grouped messages
6518
+  $("#groupedtableshow").on("click", function(event) {
6519
+
6520
+     $('#smstables').empty();
6521
+     $("#stopAutoRefreshSent").css("display", "none");
6522
+     clearInterval(intervalNmfr);
6523
+
6524
+     var getGroupedUrl = OC.generateUrl("/apps/sms_relentless/user/getgroupedtable");
6525
+
6526
+     $('#smstables').addClass('icon-loading');
6527
+     var totalPhNmbrs = 0;
6528
+
6529
+     $.ajax({
6530
+          method: 'GET',
6531
+          url: getGroupedUrl + '/' + userid,
6532
+          contentType: 'application/json',
6533
+          success: function(groupedparsed) {
6534
+
6535
+		        $('#smstables').append("<div id='toptablegrp'><div class='topbuttonandpage'><span id='recarrow' title='Show/Hide filters'></span></div><div id='paginationgrp' class='grppages'>Pages </div></div>");
6536
+		        $('#smstables').append("<table id='groupedSmsTable'></table>");
6537
+
6538
+                        $('#groupedSmsTable').append("<tr id='grpfiltersrow'><td colspan='2'><div id='filterByNumber'></div></td><td><button id='cleargrpfilter' title='Clear the filter'></button></td></tr>");
6539
+                        $('#groupedSmsTable').append("<tr class='groupedmsgrows' id='grpheaderrow'><th>Phone Number</th><th>Senders / Receivers</th><th>Messages</th></tr>");
6540
+
6541
+                        $('#grpfiltersrow').hide();
6542
+
6543
+                        var fromtoNmbrsData = [];
6544
+                        var fromtoNumberArr = [];
6545
+
6546
+		        for (var i = 0; i < groupedparsed.length; i++) {
6547
+
6548
+			     if (groupedparsed[i].author_displayname) {
6549
+			         var authordnm = groupedparsed[i].author_displayname;
6550
+			     } else { 
6551
+			         var authordnm = '';
6552
+			     }
6553
+
6554
+			     var sentfromnmbrarr = groupedparsed[i].from.split(": ");
6555
+                             if (sentfromnmbrarr[1]) {
6556
+			         var groupednbfrom = sentfromnmbrarr[1];
6557
+                             } else {
6558
+			         var groupednbfrom = sentfromnmbrarr[0];
6559
+                             }
6560
+
6561
+                             var modmessage = '';
6562
+                             if (groupedparsed[i].author_displayname) {
6563
+			         modmessage = "<span class='msgAuthorNameGrp'>"+ groupedparsed[i].author_displayname + ":</span>" + groupedparsed[i].message;
6564
+                             } else {
6565
+			         modmessage = groupedparsed[i].message;
6566
+                             }
6567
+
6568
+                             if (groupedparsed[i].to.indexOf(": ") > -1) {
6569
+                                 var groupednmbrtopre = groupedparsed[i].to.split(": ");
6570
+                                 var groupednmbrto = groupednmbrtopre[1];
6571
+                             } else { 
6572
+                                 var groupednmbrto = groupedparsed[i].to;
6573
+                             }
6574
+
6575
+                             fromtoNmbrsData.push({
6576
+                                       'author_displayname': authordnm,
6577
+                                       'from': groupednbfrom,
6578
+                                       'to': groupednmbrto,
6579
+                                       'message': modmessage,
6580
+                                       'date': groupedparsed[i].date,
6581
+                                       'status': groupedparsed[i].deliveryreceipt,
6582
+                                       'table': groupedparsed[i].table
6583
+                             });
6584
+
6585
+                             if (fromtoNumberArr.indexOf(groupednbfrom) == -1) { fromtoNumberArr.push(groupednbfrom); }
6586
+                             if (fromtoNumberArr.indexOf(groupednmbrto) == -1) { fromtoNumberArr.push(groupednmbrto); }
6587
+		        }
6588
+
6589
+                        totalPhNmbrs = fromtoNumberArr.length;
6590
+
6591
+                        // Remove the duplicates
6592
+			var noDupMsgData = [];
6593
+			$.each(fromtoNmbrsData, function(i, e) {
6594
+			    var matchingData = $.grep(noDupMsgData, function(item) {
6595
+                                return item.from == e.from && item.to == e.to && item.message == e.message && item.table == 'received' && e.table == 'sent'
6596
+			    });
6597
+			    if (matchingData.length === 0) {
6598
+				noDupMsgData.push(e);
6599
+			    }
6600
+			});
6601
+
6602
+                        var messagesPerNmbr = {};
6603
+                        var msgsNamesPerNmbr = {};
6604
+                        var msgsNmbrsNames = {};
6605
+
6606
+                        for (var k = 0; k < fromtoNumberArr.length; k++) {
6607
+
6608
+                             var displayNamesarr = [];
6609
+                             var convData = [];
6610
+
6611
+                             for (var n = 0; n < noDupMsgData.length; n++) {
6612
+
6613
+                                  if (noDupMsgData[n]['from'] == fromtoNumberArr[k] && noDupMsgData[n]['table'] == 'sent') {
6614
+
6615
+                                      convData.push({
6616
+                                                     'author_displayname': noDupMsgData[n]['author_displayname'],
6617
+                                                     'message': noDupMsgData[n]['message'],
6618
+                                                     'from': noDupMsgData[n]['from'],
6619
+                                                     'to': noDupMsgData[n]['to'],
6620
+                                                     'date': noDupMsgData[n]['date'],
6621
+                                                     'direction': 'sent_from',
6622
+                                                     'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
6623
+                                                     'table': noDupMsgData[n]['table']
6624
+                                      });
6625
+
6626
+                                  } else if (noDupMsgData[n]['to'] == fromtoNumberArr[k] && noDupMsgData[n]['table'] == 'sent') {
6627
+
6628
+                                      convData.push({
6629
+                                                     'author_displayname': noDupMsgData[n]['author_displayname'],
6630
+                                                     'message': noDupMsgData[n]['message'],
6631
+                                                     'from': noDupMsgData[n]['from'],
6632
+                                                     'to': noDupMsgData[n]['to'],
6633
+                                                     'date': noDupMsgData[n]['date'],
6634
+                                                     'direction': 'sent_to',
6635
+                                                     'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
6636
+                                                     'table': noDupMsgData[n]['table']
6637
+                                      });
6638
+
6639
+
6640
+                                  } else if (noDupMsgData[n]['from'] == fromtoNumberArr[k] && noDupMsgData[n]['table'] == 'received') {
6641
+
6642
+                                      convData.push({
6643
+                                                     'author_displayname': noDupMsgData[n]['author_displayname'],
6644
+                                                     'message': noDupMsgData[n]['message'],
6645
+                                                     'from': noDupMsgData[n]['from'],
6646
+                                                     'to': noDupMsgData[n]['to'],
6647
+                                                     'date': noDupMsgData[n]['date'],
6648
+                                                     'direction': 'received_from',
6649
+                                                     'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
6650
+                                                     'table': noDupMsgData[n]['table']
6651
+                                      });
6652
+
6653
+                                  } else if (noDupMsgData[n]['to'] == fromtoNumberArr[k] && noDupMsgData[n]['table'] == 'received') {
6654
+
6655
+                                      convData.push({
6656
+                                                     'author_displayname': noDupMsgData[n]['author_displayname'],
6657
+                                                     'message': noDupMsgData[n]['message'],
6658
+                                                     'from': noDupMsgData[n]['from'],
6659
+                                                     'to': noDupMsgData[n]['to'],
6660
+                                                     'date': noDupMsgData[n]['date'],
6661
+                                                     'direction': 'received_on',
6662
+                                                     'status': (noDupMsgData[n]['status'] == null)? "" : noDupMsgData[n]['status'],
6663
+                                                     'table': noDupMsgData[n]['table']
6664
+                                      });
6665
+                                  }
6666
+                             }
6667
+
6668
+                             // Sort messages by date
6669
+		             convData.sort(function(a, b) {
6670
+                                return new Date(a.date) - new Date(b.date);
6671
+		             });
6672
+
6673
+                             // Collect the display names of the users that sent messages from the current number
6674
+                             var selectedNames = [];
6675
+                             var displayNames = '';
6676
+                             for (var v = 0; v < convData.length; v++) {
6677
+                                  if (selectedNames.indexOf(convData[v]['author_displayname']) == -1) { 
6678
+                                      selectedNames.push(convData[v]['author_displayname']);
6679
+                                      displayNames += "<div id='diplNm_"+ fromtoNumberArr[k] +"_"+ v +"' class='dispNameList' name='"+ convData[v]['author_displayname'] +"'>"+ convData[v]['author_displayname'] +"</div>";
6680
+                                  }
6681
+                             }
6682
+
6683
+                             // Store the display names for the current number, to be able to see them later when selecting the number from the drop-down list
6684
+                             var ctPhNumber = fromtoNumberArr[k];
6685
+                             msgsNamesPerNmbr[ctPhNumber] = displayNames;
6686
+
6687
+                             // Store the messages sent by each user, to be able to see them later when clicking on the user's name
6688
+                             for (var h = 0; h < selectedNames.length; h++) {
6689
+
6690
+                                  var rowMessageArrpn = [];
6691
+                                  for (var b = 0; b < convData.length; b++) {
6692
+
6693
+                                       if (selectedNames[h] == convData[b]['author_displayname']) {
6694
+
6695
+		                           if (convData[b]['direction'] == 'sent_from') {
6696
+		                               if (convData[b]['status']) {
6697
+					           if (convData[b]['status'].indexOf("delivered") > -1 || convData[b]['status'].indexOf("delivery success") > -1 || convData[b]['status'].indexOf("Retrieved") > -1) {
6698
+			                               if (convData[b]['status'].indexOf("undelivered") > -1) {
6699
+					                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
6700
+                                                       } else {
6701
+					                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
6702
+                                                       }
6703
+					           } else {
6704
+					               var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
6705
+					           }
6706
+		                               } else {
6707
+		                                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
6708
+		                               }
6709
+		                               rowMessageArrpn.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
6710
+		                           } else if (convData[b]['direction'] == 'sent_to') {
6711
+		                               if (convData[b]['status']) {
6712
+					           if (convData[b]['status'].indexOf("delivered") > -1 || convData[b]['status'].indexOf("delivery success") > -1 || convData[b]['status'].indexOf("Retrieved") > -1) {
6713
+			                               if (convData[b]['status'].indexOf("undelivered") > -1) {
6714
+					                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
6715
+                                                       } else {
6716
+					                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
6717
+                                                       }
6718
+					           } else {
6719
+					               var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
6720
+					           }
6721
+		                               } else {
6722
+		                                   var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
6723
+		                               }
6724
+		                               rowMessageArrpn.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
6725
+		                           } else if (convData[b]['direction'] == 'received_from') {
6726
+		                               rowMessageArrpn.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div></div>");
6727
+		                           } else if (convData[b]['direction'] == 'received_on') {
6728
+		                               rowMessageArrpn.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[b]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[b]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[b]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[b]['date'] +"</div></div>");
6729
+                                           }
6730
+                                       }
6731
+                                  }
6732
+                                  var convDataPerNmbrpn = rowMessageArrpn.join("<br>");
6733
+                                  var crtNmber = fromtoNumberArr[k];
6734
+                                  var crtName = selectedNames[h];
6735
+                                  msgsNmbrsNames[crtNmber] = msgsNmbrsNames[crtNmber] || {};
6736
+                                  msgsNmbrsNames[crtNmber][crtName] = convDataPerNmbrpn;
6737
+                             }
6738
+
6739
+                             var rowMessageArr = [];
6740
+                             for (var m = 0; m < convData.length; m++) {
6741
+
6742
+                                  if (convData[m]['direction'] == 'sent_from') {
6743
+                                      if (convData[m]['status']) {
6744
+				          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
6745
+		                              if (convData[m]['status'].indexOf("undelivered") > -1) {
6746
+				                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
6747
+                                              } else {
6748
+				                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
6749
+                                              }
6750
+				          } else {
6751
+				              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
6752
+				          }
6753
+                                      } else {
6754
+                                          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
6755
+                                      }
6756
+                                      rowMessageArr.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 6px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
6757
+
6758
+                                  } else if (convData[m]['direction'] == 'sent_to') {
6759
+                                      if (convData[m]['status']) {
6760
+				          if (convData[m]['status'].indexOf("delivered") > -1 || convData[m]['status'].indexOf("delivery success") > -1 || convData[m]['status'].indexOf("Retrieved") > -1) {
6761
+		                              if (convData[m]['status'].indexOf("undelivered") > -1) {
6762
+				                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
6763
+                                              } else {
6764
+				                  var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/check.svg' title='`delivery success` received.'>";
6765
+                                              }
6766
+				          } else {
6767
+				              var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
6768
+				          }
6769
+                                      } else {
6770
+                                          var sentMsgStatus = "<img src='/" + ctappdir + "/sms_relentless/img/question.svg' title='This message did not receive a `delivery success` receipt. However, it is still possible that it reached its destination.'>";
6771
+                                      }
6772
+                                      rowMessageArr.push("<div class='groupedSentMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;color:#06866f;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/outgoing.svg' title='Message sent to current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:inline-block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div><div class='sentMssgStatus'>"+ sentMsgStatus +"</div></div>");
6773
+
6774
+                                  } else if (convData[m]['direction'] == 'received_from') {
6775
+
6776
+		                      rowMessageArr.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received from current number.'></div><div style='display:inline-block;color:#06866f;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#353535;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
6777
+
6778
+                                  } else if (convData[m]['direction'] == 'received_on') {
6779
+
6780
+		                      rowMessageArr.push("<div class='groupedRecMsg'><div style='display:block;margin:0px 0px 6px 0px;'><div style='display:inline-block;margin:0px 12px 0px 3px;'><img src='/" + ctappdir + "/sms_relentless/img/incoming.svg' title='Message received on current number.'></div><div style='display:inline-block;color:#353535;'>From: "+ convData[m]['from'] +"</div><div style='display:inline-block;margin:0px 0px 0px 12px;color:#06866f;'>To: "+ convData[m]['to'] +"</div></div><div style='display:block;font-size:14px;color:#353535;font-weight:500;'>"+ convData[m]['message'] +"</div><div style='display:block;margin:6px 0px 0px 4px;font-size:12.5px;color:#353535;'>"+ convData[m]['date'] +"</div></div>");
6781
+                                  }
6782
+                             }
6783
+
6784
+                             var convDataPerNmbr = rowMessageArr.join("");
6785
+
6786
+                             var rowPhoneNumber = "<div id='nmbrow_"+ fromtoNumberArr[k] +"' class='phoneNmbrRow'>"+ fromtoNumberArr[k] +"</div>";
6787
+
6788
+		             $("#groupedSmsTable").append("<tr id='singlerow_"+ k +"' class='groupedrowsbody'><td><div class='groupedLstNmbr fixedRowHeight'>"+ rowPhoneNumber +"</div></td><td><div class='groupedLstNames fixedRowHeight'>"+ displayNames +"</div></td><td style='width:100%'><div class='groupedLstMsgs fixedRowHeight'>"+ convDataPerNmbr +"</div></td></tr>");
6789
+                             $("#groupedSmsTable").append("<tr id='expandRow_"+ k +"' class='groupedrowsexp'><td colspan='3'><div style='display:block;width:100%;height:14px;cursor:pointer;'><img class='expandGrpRow' src='/" + ctappdir + "/sms_relentless/img/arrowDown.svg'></div><td></tr>");
6790
+
6791
+                             // Store the messages for the current number, to be able to see them later, when clicking on the number
6792
+                             var ctNmbr = fromtoNumberArr[k];
6793
+                             messagesPerNmbr[ctNmbr] = convDataPerNmbr;
6794
+                        }
6795
+
6796
+
6797
+                        // Add the 'filter by number' drop-down list
6798
+                        var nmbrslst = "<option value='title'>Filter messages by number</option>";
6799
+                        for (var p = 0; p < fromtoNumberArr.length; p++) {
6800
+                             nmbrslst += "<option value='"+ fromtoNumberArr[p] +"'>"+ fromtoNumberArr[p] +"</option>";
6801
+                        }
6802
+                        $("#filterByNumber").append("<select id='selectListedNmbrs'>"+ nmbrslst +"</select>");
6803
+
6804
+
6805
+                        $("#selectListedNmbrs").change(function() {
6806
+
6807
+                          var selectedNmbr = $(this).val();
6808
+
6809
+                          if (selectedNmbr != "title") {
6810
+
6811
+                              $(".groupedrowsbody,.groupedrowsexp").each(function() { $(this).hide(); });
6812
+		              $("#groupedSmsTable").append("<tr id='singlerowfl_"+ fromtoNumberArr.indexOf(selectedNmbr) +"' class='groupedrowsbody'><td><div class='groupedLstNmbr fixedRowHeight'><div id='nmbrow_"+ selectedNmbr +"' style='font-size:15px;font-weight:500;color:#06866f;cursor:pointer;'>"+ selectedNmbr +"</div></div></td><td><div class='groupedLstNames fixedRowHeight'>"+ msgsNamesPerNmbr[selectedNmbr] +"</div></td><td style='width:100%'><div class='groupedLstMsgs fixedRowHeight'>"+ messagesPerNmbr[selectedNmbr] +"</div></td></tr>");
6813
+                              $("#groupedSmsTable").append("<tr id='expandRowfl_"+ fromtoNumberArr.indexOf(selectedNmbr) +"' class='groupedrowsexp'><td colspan='3'><div style='display:block;width:100%;height:14px;cursor:pointer;'><img class='expandGrpRow' src='/" + ctappdir + "/sms_relentless/img/arrowDown.svg'></div><td></tr>");
6814
+
6815
+
6816
+                               // Show the messages sent by each user whose name is listed for the phone number of the current row
6817
+                               $('[id*="diplNm_"]').click(function() {
6818
+
6819
+                                  var crntNmbr = $(this).attr("id").split("_")[1];
6820
+                                  var crntDisName = $(this).attr("name");                        
6821
+                                  var clsmsgcell = $(this).closest(".groupedrowsbody").find(".groupedLstMsgs");
6822
+                                  clsmsgcell.empty();
6823
+                                  clsmsgcell.html(msgsNmbrsNames[crntNmbr][crntDisName]);
6824
+
6825
+                                  $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
6826
+                                  $(this).css("color", "#1483f0");
6827
+                                  $("#nmbrow_"+ selectedNmbr).css("color", "#06866f");
6828
+                                  $(".groupedLstNmbr").each(function () { $(this).css("color", "#06866f"); });
6829
+                               });
6830
+
6831
+
6832
+		               // Show all the messages sent to/from the clicked number
6833
+		               $('[id*="nmbrow_"]').click(function() {
6834
+		                  var rwNmbr = $(this).attr("id").replace("nmbrow_", "");
6835
+		                  var rowmsgcell = $(this).closest(".groupedrowsbody").find(".groupedLstMsgs");
6836
+		                  rowmsgcell.empty();
6837
+		                  rowmsgcell.html(messagesPerNmbr[rwNmbr]);
6838
+
6839
+		                  $(".phoneNmbrRow").each(function() { $(this).css("color", "#06866f"); });
6840
+		                  $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
6841
+		                  $(this).css("color", "#08b899");
6842
+		               });
6843
+
6844
+
6845
+		               // Expand the rows to see all the messages
6846
+		               $('[id^="expandRowfl_"]').click(function() {
6847
+		                   var idnumbrfl = $(this).attr("id").replace("expandRowfl_", "");
6848
+		                   var crntExpandfl = $(this).find(".expandGrpRow");
6849
+
6850
+		                   if (crntExpandfl.attr('src') == '/' + ctappdir + '/sms_relentless/img/arrowDown.svg') {
6851
+                                       $("#singlerowfl_"+ idnumbrfl).find(".fixedRowHeight").removeClass("fixedRowHeight");
6852
+		                       crntExpandfl.attr('src', '/' + ctappdir + '/sms_relentless/img/arrowUp.svg');
6853
+		                   } else {
6854
+                                       $("#singlerowfl_"+ idnumbrfl).find(".groupedLstNmbr,.groupedLstNames,.groupedLstMsgs").addClass("fixedRowHeight");
6855
+                                       crntExpandfl.attr('src', '/' + ctappdir + '/sms_relentless/img/arrowDown.svg'); 
6856
+		                   }
6857
+		               });
6858
+
6859
+		               $('#totalgrpmessages').remove();
6860
+		               $('#smstables').append("<div id='totalgrpmessages'>Total displayed phone numbers: 1</div>");
6861
+                           }
6862
+                        });
6863
+
6864
+                        // Clear the 'filter by number' filter
6865
+                        $("#cleargrpfilter").click(function() {
6866
+                               $('[id^="singlerowfl_"]').remove();
6867
+                               $('[id^="expandRowfl_"]').remove();
6868
+                               $(".groupedrowsbody,.groupedrowsexp").each(function() { $(this).show(); });
6869
+                               $("#selectListedNmbrs").val("title");
6870
+		               $('#totalgrpmessages').remove();
6871
+		               $('#smstables').append("<div id='totalgrpmessages'>Total displayed phone numbers: "+ totalPhNmbrs +"</div>");
6872
+                        });
6873
+
6874
+                        // Show the messages sent by each user whose name is listed for the phone number on the current row
6875
+                        $('[id*="diplNm_"]').click(function() {
6876
+
6877
+                           var crntNmbr = $(this).attr("id").split("_")[1];
6878
+                           var crntDisName = $(this).attr("name");                               
6879
+                           var clsmsgcell = $(this).closest(".groupedrowsbody").find(".groupedLstMsgs");
6880
+                           clsmsgcell.empty();
6881
+                           clsmsgcell.html(msgsNmbrsNames[crntNmbr][crntDisName]);
6882
+
6883
+                           $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
6884
+                           $(this).css("color", "#1483f0");
6885
+                        });
6886
+
6887
+                        // Show all the messages sent to/from the clicked number
6888
+                        $('[id*="nmbrow_"]').click(function() {
6889
+                           var rwNmbr = $(this).attr("id").replace("nmbrow_", "");
6890
+                           var rowmsgcell = $(this).closest(".groupedrowsbody").find(".groupedLstMsgs");
6891
+                           rowmsgcell.empty();
6892
+                           rowmsgcell.html(messagesPerNmbr[rwNmbr]);
6893
+
6894
+                           $(".phoneNmbrRow").each(function() { $(this).css("color", "#06866f"); });
6895
+                           $(".dispNameList").each(function() { $(this).css("color", "#0a559e"); });
6896
+                           $(this).css("color", "#08b899");
6897
+                        });
6898
+
6899
+
6900
+		        $('#smstables').removeClass('icon-loading');
6901
+		        $('#recarrow').removeClass('arrowUpCl');
6902
+		        $('#recarrow').addClass('arrowDownCl');
6903
+
6904
+                        // Expand the rows to see all the messages
6905
+                        $('[id^="expandRow_"]').click(function() {
6906
+                            var idnumbr = $(this).attr("id").replace("expandRow_", "");
6907
+                            var crntExpand = $(this).find(".expandGrpRow");
6908
+
6909
+                            if (crntExpand.attr('src') == '/' + ctappdir + '/sms_relentless/img/arrowDown.svg') {
6910
+                                $("#singlerow_"+ idnumbr).find(".fixedRowHeight").removeClass("fixedRowHeight");
6911
+                                crntExpand.attr('src', '/' + ctappdir + '/sms_relentless/img/arrowUp.svg');
6912
+                            } else {
6913
+                                $("#singlerow_"+ idnumbr).find(".groupedLstNmbr,.groupedLstNames,.groupedLstMsgs").addClass("fixedRowHeight");
6914
+                                crntExpand.attr('src', '/' + ctappdir + '/sms_relentless/img/arrowDown.svg'); 
6915
+                            }
6916
+                        });
6917
+
6918
+
6919
+		        // Add pagination
6920
+		        var rowsShowngrp = messagesperpage;
6921
+		        var rowsTotalgrp = $("#groupedSmsTable tr").length;
6922
+
6923
+		        var numPagesgrp = ((rowsTotalgrp - 2) / rowsShowngrp) / 2;
6924
+
6925
+		        for (i = 0; i < numPagesgrp; i++) {
6926
+		             var pageNumgrp = i + 1;
6927
+		             $('#paginationgrp').append('<a href="#" rel="' + i + '" class="pagenumbersgrp">' + pageNumgrp + '</a> ');
6928
+		        }
6929
+
6930
+		        $('#paginationgrp').children(":first").addClass('active');
6931
+
6932
+		        $(".groupedrowsbody,.groupedrowsexp").hide();
6933
+
6934
+		        $('#paginationgrp a:first').addClass('active');
6935
+
6936
+		        // Show table page when clicking a page number
6937
+		        $('.grppages a').bind('click', function() {
6938
+
6939
+		           $('#paginationgrp').children().removeClass('active');
6940
+
6941
+		           $(this).addClass('active');
6942
+
6943
+		           var currentPageNogrp = $(this).text();
6944
+
6945
+		           $('#paginationgrp a').each(function() {
6946
+		               if ($(this).text() == currentPageNogrp) {
6947
+		                   $(this).addClass('active');
6948
+		               }
6949
+		           });
6950
+
6951
+		           var currPagegrp = $(this).attr('rel');
6952
+		           var startItemgrp = currPagegrp * rowsShowngrp;
6953
+		           var endItemgrp = startItemgrp + rowsShowngrp;
6954
+
6955
+		           $(".groupedrowsbody").hide().slice(startItemgrp, endItemgrp).css('display', 'table-row');
6956
+		           $(".groupedrowsexp").hide().slice(startItemgrp, endItemgrp).css('display', 'table-row');
6957
+
6958
+		           $('#totalgrpmessages').remove();
6959
+		           $('#smstables').append("<div id='totalgrpmessages'>Total displayed phone numbers: " + totalPhNmbrs + "</div>");
6960
+		        });
6961
+
6962
+                        $('#paginationgrp').children(":last").trigger('click');
6963
+
6964
+
6965
+		        // Show/Hide filter row
6966
+		        $('#recarrow').on('click', function() {
6967
+			   if ($('#grpfiltersrow').is(':visible')) {
6968
+			       $('#grpfiltersrow').hide();
6969
+		               $('#grpheaderrow').css('top', '0px');
6970
+		               $(this).removeClass('arrowUpCl');
6971
+		               $(this).addClass('arrowDownCl');
6972
+			   } else {
6973
+			       $('#grpfiltersrow').show();
6974
+		               $('#grpheaderrow').css('top', '158px');
6975
+		               $(this).removeClass('arrowDownCl');
6976
+		               $(this).addClass('arrowUpCl');
6977
+		           }
6978
+		        });
6979
+
6980
+
6981
+		        // Download MMS files when clicking on their URLs
6982
+		        $('[id^="mmsTblUrl-"]').on('click', function(evt) {
6983
+
6984
+		           var clckedUrl = $(this).text();
6985
+		           var flNamearr = clckedUrl.split("/");
6986
+		           var flName = flNamearr.reverse()[0];
6987
+
6988
+		           confirmAlert("Download this file only if you trust the sender and the domain of the URL.");
6989
+
6990
+			   $("#confirmOk").click(function() {
6991
+
6992
+		              $("#alertMsgOverlay").remove();
6993
+			      $("#alertConfMessage").remove();
6994
+
6995
+			      var mmsLink = document.createElement("a");
6996
+			      mmsLink.setAttribute('href', clckedUrl);
6997
+			      mmsLink.setAttribute('download', flName);
6998
+                              mmsLink.setAttribute('target', '_blank');
6999
+			      document.body.appendChild(mmsLink);
7000
+			      mmsLink.click();
7001
+			      mmsLink.remove();
7002
+		           });
7003
+
7004
+			   $("#confirmCancel").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
7005
+		        });
7006
+
7007
+          },
7008
+          error: function() {
7009
+
7010
+                        showAlert("Error while attempting to get the messages from the database.");
7011
+                        $('#smstables').removeClass('icon-loading');
7012
+          }
7013
+     });
7014
+  });
7015
+
7016
+
7017
+  function showAlert(alertText) {
7018
+
7019
+     let alertwnd = "<div id='alertMessage'>";
7020
+     alertwnd += "<a id='closeAlertWnd' title='Close this window'></a>";
7021
+     alertwnd += "<div id='alertTextWrap'>"+ alertText +"</div>";
7022
+     alertwnd += "<input type='submit' id='alertOk' value='OK'>";
7023
+     alertwnd += "</div>";
7024
+
7025
+     $("#content").append("<div id='alertMsgOverlay'></div>");
7026
+     $("#content").append(alertwnd);
7027
+
7028
+     let topDist = parseInt((window.innerHeight / 2).toFixed(2) - 152) +"px";
7029
+     let leftDist = parseInt((window.innerWidth / 2).toFixed(2) - 150) +"px";
7030
+     $("#alertMessage").css({ "top" : topDist, "left" : leftDist });
7031
+
7032
+     $("#closeAlertWnd").click(function() { $("#alertMsgOverlay").remove(); $("#alertMessage").remove(); });
7033
+     $("#alertMsgOverlay").click(function() { $("#alertMsgOverlay").remove(); $("#alertMessage").remove(); });
7034
+     $("#alertOk").click(function() { $("#alertMsgOverlay").remove(); $("#alertMessage").remove(); });
7035
+  }
7036
+
7037
+  function confirmAlert(alertText) {
7038
+
7039
+     $("#alertMsgOverlay").remove();
7040
+     $("#alertConfMessage").remove();
7041
+
7042
+     let alertwndcf = "<div id='alertConfMessage'>";
7043
+     alertwndcf += "<a id='closeAlertWndcf' title='Close this window'></a>";
7044
+     alertwndcf += "<div id='alertTextWrap'>"+ alertText +"</div>";
7045
+     alertwndcf += "<div id='cancelOkWrap'><input type='submit' id='confirmCancel' value='Cancel'>";
7046
+     alertwndcf += "<input type='submit' id='confirmOk' value='OK'></div>";
7047
+     alertwndcf += "</div>";
7048
+
7049
+     $("#content").append("<div id='alertMsgOverlay'></div>");
7050
+     $("#content").append(alertwndcf);
7051
+
7052
+     let topDist = parseInt((window.innerHeight / 2).toFixed(2) - 152) +"px";
7053
+     let leftDist = parseInt((window.innerWidth / 2).toFixed(2) - 150) +"px";
7054
+     $("#alertConfMessage").css({ "top" : topDist, "left" : leftDist });
7055
+
7056
+     $("#closeAlertWndcf").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
7057
+     $("#alertMsgOverlay").click(function() { $("#alertMsgOverlay").remove(); $("#alertConfMessage").remove(); });
7058
+  }
7059
+
7060
+
7061
+  // Append the auto-refresh button that refreshes the 'Sent SMS Messages' page
7062
+  $("#app-content").append("<div id='stopAutoRefreshSent'><div id='stopAutoRefreshSentBtn'>Start auto refresh</div><div id='refreshTimerSent' class='arftimer' style='--duration: 15;--size: 24;'><div class='arfmask'></div></div></div>");
7063
+
7064
+  $("#stopAutoRefreshSentBtn").click(function() {
7065
+     if ($("#stopAutoRefreshSentBtn").text() == "Stop auto refresh") {
7066
+         clearInterval(intervalRfrSent);
7067
+         $("#stopAutoRefreshSentBtn").text("Start auto refresh");
7068
+         $("#stopAutoRefreshSentBtn").css("color", "#0a559e");
7069
+         $("#refreshTimerSent").css("display", "none");
7070
+     } else {
7071
+         clearInterval(intervalRfrSent);
7072
+         intervalRfrSent = setInterval(function() { $("#sentsmstableshow").click(); }, 15000);
7073
+         $("#stopAutoRefreshSentBtn").text("Stop auto refresh");
7074
+         $("#stopAutoRefreshSentBtn").css("color", "#04957b");
7075
+         $("#refreshTimerSent").css("display", "inline-block");
7076
+     }
7077
+  });
7078
+
7079
+});
0 7080
new file mode 100644
... ...
@@ -0,0 +1,1539 @@
1
+<?php
2
+/**
3
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
4
+ *
5
+ * @author Double Bastion LLC
6
+ *
7
+ * @license GNU AGPL version 3 or any later version
8
+ *
9
+ * This program is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
11
+ * License as published by the Free Software Foundation; either
12
+ * version 3 of the License, or any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
18
+ *
19
+ * You should have received a copy of the GNU Affero General Public
20
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
23
+
24
+declare(strict_types=1);
25
+
26
+namespace OCA\SMSRelentless\Controller;
27
+
28
+use OCP\AppFramework\ApiController;
29
+use OCP\IRequest;
30
+use OCA\SMSRelentless\Service\SmsrelentlessService;
31
+use OCP\AppFramework\Http\DataResponse;
32
+use OCP\AppFramework\OCSController;
33
+use OCP\IUserSession;
34
+use OCP\IConfig;
35
+use \DateTime;
36
+use OCP\AppFramework\Controller;
37
+use OCP\Files\IAppData;
38
+use OCP\AppFramework\App;
39
+use OCP\Files\NotPermittedException;
40
+use \ReflectionClass;
41
+use OCP\Notification\INotification;
42
+use OCP\Notification\IManager;
43
+use OCP\IDBConnection;
44
+use OCP\IUserManager;
45
+use Plivo\RestClient;
46
+use Plivo\Util\signatureValidation;
47
+
48
+
49
+class AuthorApiController extends ApiController {
50
+
51
+    private $service;
52
+    private $userId;
53
+    private $config;
54
+    private $connection;
55
+    private $userManager;
56
+    private $manager;
57
+
58
+    public function __construct($appName, IRequest $request, SmsrelentlessService $service, $userId, IConfig $config, IDBConnection $connection, IUserManager $userManager, IManager $manager) {
59
+        parent::__construct(
60
+            $appName,
61
+            $request,
62
+            'PUT, POST, GET, DELETE, PATCH',
63
+            'Authorization, Content-Type, Accept',
64
+            1728000);
65
+
66
+        $this->service = $service;
67
+        $this->userId = $userId;
68
+        $this->config = $config;
69
+        $this->connection = $connection;
70
+        $this->userManager = $userManager;
71
+	$this->manager = $manager;
72
+    }
73
+
74
+
75
+    /**
76
+     * @NoAdminRequired
77
+     */
78
+    public function object_to_array($obj) {
79
+       if(is_object($obj)) $obj = (array)$this->dismount($obj);
80
+       if(is_array($obj)) {
81
+          $new = array();
82
+          foreach($obj as $key => $val) {
83
+              $new[$key] = $this->object_to_array($val);
84
+          }
85
+       }
86
+       else $new = $obj;
87
+       return $new;
88
+    }
89
+
90
+
91
+    /**
92
+     * @NoAdminRequired
93
+     */
94
+    public function dismount($object) {
95
+       $reflectionClass = new ReflectionClass(get_class($object));
96
+       $array = array();
97
+       foreach ($reflectionClass->getProperties() as $property) {
98
+          $property->setAccessible(true);
99
+          $array[$property->getName()] = $property->getValue($object);
100
+          $property->setAccessible(false);
101
+       }
102
+       return $array;
103
+    }
104
+
105
+
106
+    /**
107
+     * @NoAdminRequired
108
+     */
109
+    public function createMessageId() {
110
+
111
+             // Create a random string to use as message id for messages that don't have it
112
+	     $keypassin = substr(sha1((string) mt_rand()), 0, 32);
113
+	     $keysaltin = openssl_random_pseudo_bytes(24);
114
+	     $keyLengthin = 32;
115
+	     $iterationin = 50;
116
+	     $generated_keyin = openssl_pbkdf2($keypassin, $keysaltin, $keyLengthin, $iterationin, 'sha256');
117
+	     $ctdMessageId = "generated-id-" . bin2hex($generated_keyin);
118
+             return $ctdMessageId;
119
+    }
120
+
121
+
122
+    /**
123
+     * @NoAdminRequired
124
+     */
125
+    public function verifyHeader($receiveddata, $signature_header, $timestamp, $public_key = '', $tolerance = null ) {
126
+        // Typecast timestamp to int for comparisons
127
+        $timestamp = (int)$timestamp;
128
+
129
+        // Check if timestamp is within tolerance
130
+        if (($tolerance > 0) && (\abs(\time() - $timestamp) > $tolerance)) {
131
+             return false;
132
+        } else {
133
+
134
+            // Convert base64 string to bytes for sodium crypto functions
135
+            $public_key_bytes = base64_decode($public_key);
136
+            $signature_header_bytes = base64_decode($signature_header);
137
+
138
+            // Construct a message to test against the signature header using the timestamp and payload
139
+            $constructed_string = $timestamp . '|' . $receiveddata;
140
+
141
+            if (!\sodium_crypto_sign_verify_detached($signature_header_bytes, $constructed_string, $public_key_bytes)) {
142
+                return false;
143
+            } else {
144
+                return true;
145
+            }
146
+        }
147
+    }
148
+
149
+
150
+    /**
151
+     * @NoAdminRequired
152
+     * @NoCSRFRequired
153
+     * @PublicPage
154
+     */
155
+    public function recdeliveryreptel() {
156
+
157
+       $request = file_get_contents("php://input");
158
+       $recdata = json_decode($request, TRUE);
159
+
160
+       $delsmswebhookurl = $recdata["data"]["payload"]["webhook_url"];
161
+       $ncuserfortelnyxdel = $this->service->getuserbyteldelrwhurl($delsmswebhookurl);
162
+
163
+       if ($ncuserfortelnyxdel != '' && $ncuserfortelnyxdel != null && $ncuserfortelnyxdel != 'undefined') {
164
+
165
+	       $messageid = $recdata["data"]["payload"]["id"];
166
+
167
+	       $network = $recdata["data"]["payload"]["to"][0]["carrier"];
168
+	       $messageprice = $recdata["data"]["payload"]["cost"]["amount"];
169
+	       $deliverystatus = $recdata["data"]["payload"]["to"][0]["status"];
170
+
171
+	       $goterrorinit = $recdata["data"]["payload"]["errors"];
172
+
173
+	       if (!empty($goterrorinit)) {
174
+		   $retrievedtitle = $recdata["data"]["payload"]["errors"][0]["title"];
175
+		   $retrievedcode = $recdata["data"]["payload"]["errors"][0]["code"];
176
+		   $messagestatus = "(Error " . $retrievedcode . ") " . $retrievedtitle;
177
+	       } else {
178
+		   $messagestatus = "Success ! The message has been successfully accepted for delivery.";
179
+	       }
180
+
181
+	       return $this->service->updatedeliverystatustel($ncuserfortelnyxdel, $messageid, $network, $messageprice, $messagestatus, $deliverystatus); 
182
+
183
+       } else { return "access denied"; }
184
+
185
+    }
186
+
187
+
188
+    /**
189
+     * @NoAdminRequired
190
+     * @NoCSRFRequired
191
+     * @PublicPage
192
+     */
193
+    public function recdeliveryrepnex() {
194
+
195
+       $plivodrurl = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
196
+
197
+       $ncuserforplivodel = $this->service->getuserbyplivodelrwhurl($plivodrurl);
198
+
199
+       if ($ncuserforplivodel != '' && $ncuserforplivodel != null && $ncuserforplivodel != 'undefined') {
200
+
201
+	       $networkcode = "";
202
+	       $mStatus = ""; 
203
+
204
+	       if (isset($_REQUEST["MessageUUID"])) { $messageid = $_REQUEST["MessageUUID"]; } else { $messageid = ''; }
205
+	       if (isset($_REQUEST["MCC"]) && isset($_REQUEST["MNC"])) { $networkcode = $_REQUEST["MCC"] . " " . $_REQUEST["MNC"]; } else { $networkcode = ''; }
206
+	       if (isset($_REQUEST["TotalAmount"])) { $messageprice = $_REQUEST["TotalAmount"]; } else { $messageprice = ''; }
207
+	       if (isset($_REQUEST["ErrorCode"]) && $_REQUEST["ErrorCode"] == "") {
208
+                   $mStatus = "Success ! The message has been successfully accepted for delivery.";
209
+               } elseif (isset($_REQUEST["ErrorCode"]) && $_REQUEST["ErrorCode"] != "") {
210
+                   $mStatus = "Error " . $_REQUEST["ErrorCode"]; 
211
+               } else { $mStatus = ''; }
212
+
213
+	       if (isset($_REQUEST["Status"])) { $deliverystatus = $_REQUEST["Status"]; }
214
+
215
+	       return $this->service->updatedeliverystatusnex($ncuserforplivodel, $messageid, $networkcode, $messageprice, $mStatus, $deliverystatus);
216
+
217
+       } else { return "access denied"; }
218
+
219
+    }
220
+
221
+
222
+    /**
223
+     * @NoAdminRequired
224
+     * @NoCSRFRequired
225
+     * @PublicPage
226
+     */
227
+    public function recdeliveryreptwil() {
228
+
229
+       $twildrurl = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
230
+
231
+       $ncuserfortwildel = $this->service->getuserbytwildelrwhurl($twildrurl);
232
+
233
+       if ($ncuserfortwildel != '' && $ncuserfortwildel != null && $ncuserfortwildel != 'undefined') {
234
+
235
+           $messageid = $_REQUEST["SmsSid"];
236
+
237
+           if ($messageid != null) {
238
+
239
+               $credentialstw = $this->service->getapicredentials($ncuserfortwildel);
240
+               $sidtw = $credentialstw[15];
241
+               $tokentw = $credentialstw[16];
242
+               $msdetails = json_decode(file_get_contents("https://".$sidtw.":".$tokentw."@api.twilio.com/2010-04-01/Accounts/".$sidtw."/Messages/".$messageid.".json"));
243
+               $errorMessage = $msdetails->error_message;
244
+               $errorCode = $msdetails->error_code;
245
+               $deliverystatus = $msdetails->status;
246
+
247
+               if ($errorCode == null) { 
248
+                   $mStatus = 'Success ! The message has been successfully accepted for delivery.'; 
249
+               } else { $mStatus = 'Error ' . $errorCode . '. '. ($errorMessage != '') ? 'Message: '. $errorMessage : ''; }
250
+
251
+               $messagepricepre = $msdetails->price;
252
+
253
+               if ($messagepricepre) {
254
+                   $messageprice = str_replace("-", "", $messagepricepre);
255
+               } else { $messageprice = ""; }
256
+
257
+               $networkcode = '';
258
+
259
+	       return $this->service->updatedeliverystatustwil($ncuserfortwildel, $messageid, $networkcode, $messageprice, $mStatus, $deliverystatus);
260
+
261
+           } else { exit(); }
262
+
263
+       } else { exit(); }
264
+
265
+    }
266
+
267
+
268
+    /**
269
+     * @NoAdminRequired
270
+     * @NoCSRFRequired
271
+     * @PublicPage
272
+     */
273
+    public function recdeliveryrepflow() {
274
+
275
+       $flowdrurl = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
276
+
277
+       $ncuserforflowdel = $this->service->getuserbyflowdelrwhurl($flowdrurl);
278
+
279
+       if ($ncuserforflowdel != '' && $ncuserforflowdel != null && $ncuserforflowdel != 'undefined') {
280
+
281
+           $receivereq = file_get_contents('php://input');
282
+           $recmdec = json_decode($receivereq, true);
283
+           $recmsid = $recmdec['data']['id'];
284
+
285
+           $smsapicredfl = $this->service->getapicredentials($ncuserforflowdel);
286
+           $flowapikey = $smsapicredfl[20];
287
+           $flowapisecret = $smsapicredfl[21];
288
+
289
+           $getmsdetails = json_decode(file_get_contents("https://".$flowapikey.":".$flowapisecret."@api.flowroute.com/v2.1/messages/".$recmsid.""), true);
290
+           $messagepriceflinit = $getmsdetails['data']['attributes']['amount_display'];
291
+           $messagepricefl = str_replace("$", "", $messagepriceflinit);
292
+
293
+           $mdeliveryflinit = $getmsdetails['data']['attributes']['delivery_receipts'][0]['status'];
294
+
295
+           if ($mdeliveryflinit != 'message buffered') {
296
+               if ($mdeliveryflinit == 'Ok') {
297
+                   $messagedeliveryfl = "Issues";
298
+               } else { $messagedeliveryfl = $mdeliveryflinit; }
299
+           } else { $messagedeliveryfl = 'delivered'; }
300
+
301
+           $messagestatuscode = $getmsdetails['data']['attributes']['delivery_receipts'][0]['status_code'];
302
+           $messagestatusdescr = $getmsdetails['data']['attributes']['delivery_receipts'][0]['status_code_description'];
303
+
304
+           if ($messagestatuscode != '') { 
305
+               $messagestatusfl = (($messagestatusdescr != '') ? $messagestatusdescr . ". " : "") . "Status code: " . $messagestatuscode; 
306
+           } else { $messagestatusfl = "There were issues with message delivery."; }
307
+
308
+           $networkcodefl = '';
309
+
310
+           return $this->service->updatedeliverystatusflow($ncuserforflowdel, $recmsid, $networkcodefl, $messagepricefl,  $messagestatusfl, $messagedeliveryfl);
311
+
312
+       } else { return "access denied"; }
313
+
314
+    }
315
+
316
+
317
+    /**
318
+     * @NoAdminRequired
319
+     * @NoCSRFRequired
320
+     * @PublicPage
321
+     */
322
+    public function receivesmstel() {
323
+
324
+       $signature = $_SERVER['HTTP_TELNYX_SIGNATURE_ED25519'];
325
+       $timestamp = $_SERVER['HTTP_TELNYX_TIMESTAMP'];
326
+
327
+       $receivereq = file_get_contents('php://input');
328
+
329
+       $recmesdata = json_decode($receivereq, TRUE);
330
+
331
+       $recsmswebhookurl = $recmesdata["data"]["payload"]["webhook_url"];
332
+
333
+       $ncuserfortelnyx = $this->service->getuserbytelrecwhurl($recsmswebhookurl);
334
+
335
+       $txcredentials = $this->service->getapicredentials($ncuserfortelnyx);
336
+
337
+       $telpubkey = $txcredentials[1];
338
+       $telnyxkey = $txcredentials[0];
339
+       $teldelrecurl = $txcredentials[3];
340
+       $messagingprofid = $txcredentials[4];
341
+
342
+       // Verify message signature
343
+       $signatureverify = $this->verifyHeader($receivereq, $signature, $timestamp, $telpubkey, $tolerance = 30);
344
+
345
+       if ($signatureverify) {
346
+
347
+          if ($ncuserfortelnyx != '' && $ncuserfortelnyx != null && $ncuserfortelnyx != 'undefined') {
348
+
349
+//	       $messageid = $recmesdata["data"]["payload"]["id"];
350
+               if ($recmesdata) {
351
+                   if (isset($recmesdata["data"]["payload"]["id"])) {
352
+                       $messageid = $recmesdata["data"]["payload"]["id"];
353
+                   } else { $messageid = $this->createMessageId(); }
354
+               } else { $messageid = $this->createMessageId(); }
355
+
356
+	       $messagedate = date("Y-m-d H:i:s");
357
+
358
+	       $messagefrom = $recmesdata["data"]["payload"]["from"]["phone_number"];
359
+
360
+	       $messageto = "Telnyx: " . $recmesdata["data"]["payload"]["to"][0]["phone_number"];
361
+
362
+               $messagetopr = $recmesdata["data"]["payload"]["to"][0]["phone_number"];
363
+
364
+               $messagetoprtx = "Tx: " . $messagetopr;
365
+
366
+               // Check if the message is a MMS
367
+               if ($recmesdata["data"]["payload"]['type'] == 'MMS') {
368
+
369
+                   $includedFilestx = '';
370
+
371
+                   foreach ($recmesdata["data"]["payload"]['media'] as $telkey => $telvalue) {
372
+                        if (is_array($telvalue)) {
373
+                            foreach ($telvalue as $telkeysec => $telvaluesec) {
374
+                                if ($telkeysec == "url") {
375
+                                    $includedFilestx .= "<div id='mmsTblUrl-" . mt_rand(1, 10000) . "' class='mmstblUrls' title='Download this file only if you trust the sender and the domain of the URL.'>" . $telvaluesec . "</div><br><br>";
376
+                                }
377
+                            }
378
+                        }
379
+                   }
380
+
381
+                   $messagetexttel = $recmesdata["data"]["payload"]["text"] . "<br><br><br></b>--- The files included in the MMS follow. Download them only if you trust the sender and the domains of the URLs ---<br><br><br>" . $includedFilestx;
382
+                   $ismmstel = 1;
383
+               } else {
384
+                   $messagetexttel = $recmesdata["data"]["payload"]["text"];
385
+                   $ismmstel = 0;
386
+               }
387
+
388
+	       $recmessagearr = [$messageid, $messagedate, $messagefrom, $messageto, $messagetexttel];
389
+
390
+	       $this->service->insertrecsms($ncuserfortelnyx, $recmessagearr);
391
+
392
+
393
+               // Check if there is any auto-reply configured for the receiving number
394
+	       $telgetarpl = $this->connection->prepare('SELECT `phone_number`, `days_of_week`, `daily_start`, `daily_end`, `vacation_start`, `vacation_end`, `message_text` FROM 
395
+                                                        `*PREFIX*sms_relent_autorply` WHERE `phone_number` = ?');
396
+	       $telgetarplres = $telgetarpl->execute([$messagetoprtx]);
397
+	       $telarpldata = $telgetarplres->fetch();
398
+	       $telgetarplres->closeCursor();
399
+
400
+               if ($telarpldata) {
401
+
402
+                   $autoreplytext = $telarpldata['message_text'];
403
+
404
+                   // Get the Display Name of the current user
405
+                   $crtuser = $this->userManager->get($ncuserfortelnyx);
406
+                   $displaynm = $crtuser->getDisplayName();
407
+
408
+                   // Check if the auto-reply is in 'daily mode'
409
+                   if ($telarpldata['days_of_week']) {
410
+
411
+                       // Check if the auto-reply should be sent 
412
+                       $daysofweekarrinit = explode(",", $telarpldata['days_of_week']);
413
+
414
+                       $daysofweekarr = [];
415
+                       $fulldays = [];
416
+                       foreach ($daysofweekarrinit as $crtday) {
417
+                           if (strpos($crtday, "full") !== false) {
418
+                               $fulldays[] = $crtday;
419
+                           } else {
420
+                               $daysofweekarr[] = $crtday;
421
+                           }
422
+                       }
423
+
424
+                       $dailystart = $telarpldata['daily_start'];
425
+                       $dailyend = $telarpldata['daily_end'];
426
+
427
+                       $crntdate = date("Y-m-d");
428
+                       $crntDayNumber = date('N', strtotime($crntdate));
429
+
430
+                       if (in_array($crntDayNumber, $daysofweekarr)) {
431
+
432
+                           $crntimehrmin = date("H:i");
433
+                           $crntdatefmt = new DateTime($crntimehrmin);
434
+                           $startdatefmt = new DateTime($dailystart);
435
+                           $enddatefmt = new DateTime($dailyend);
436
+
437
+                           if ($crntdatefmt >= $startdatefmt && $enddatefmt > $crntdatefmt) {
438
+                               // OK
439
+                           } else {
440
+
441
+	                       // Send the auto-reply
442
+		               \Telnyx\Telnyx::setApiKey($telnyxkey);
443
+		               $messagedate = date("Y-m-d H:i:s");
444
+		               $message = \Telnyx\Message::Create(["from" => $messagetopr, "to" => $messagefrom, "text" => $autoreplytext, "webhook_url" => $teldelrecurl]);
445
+
446
+		               // Insert the sent SMS in the 'sms_relent_sent' table
447
+//		               $messageid = $message['id'];
448
+			       if ($message) {
449
+				   if (isset($message['id'])) {
450
+				       $messageid = $message['id'];
451
+				   } else { $messageid = $this->createMessageId(); }
452
+			       } else { $messageid = $this->createMessageId(); }
453
+
454
+		               $messagefromtx = "Telnyx: " . $messagetopr;
455
+		               $messagetotx = $messagefrom;
456
+		               $messagenetwork = null;
457
+		               $messageprice = null;
458
+		               $messagestatus = $message['to'][0]['status'];
459
+		               $messagedelivery = null;
460
+
461
+		               $sentmessagearr = [$messageid, $messagedate, $messagefromtx, $messagetotx, $messagenetwork, $messageprice, $messagestatus, $messagedelivery, $autoreplytext];
462
+
463
+		               $this->service->insertsentsms($ncuserfortelnyx, $displaynm, $sentmessagearr);
464
+                           }
465
+                       }
466
+
467
+                       if (in_array($crntDayNumber . "(full)", $fulldays)) {
468
+
469
+	                       // Send the auto-reply
470
+		               \Telnyx\Telnyx::setApiKey($telnyxkey);
471
+		               $messagedate = date("Y-m-d H:i:s");
472
+		               $message = \Telnyx\Message::Create(["from" => $messagetopr, "to" => $messagefrom, "text" => $autoreplytext, "webhook_url" => $teldelrecurl]);
473
+
474
+		               // Insert the sent SMS in the 'sms_relent_sent' table
475
+//		               $messageid = $message['id'];
476
+			       if ($message) {
477
+				   if (isset($message['id'])) {
478
+				       $messageid = $message['id'];
479
+				   } else { $messageid = $this->createMessageId(); }
480
+			       } else { $messageid = $this->createMessageId(); }
481
+		               $messagefromtx = "Telnyx: " . $messagetopr;
482
+		               $messagetotx = $messagefrom;
483
+		               $messagenetwork = null;
484
+		               $messageprice = null;
485
+		               $messagestatus = $message['to'][0]['status'];
486
+		               $messagedelivery = null;
487
+
488
+		               $sentmessagearr = [$messageid, $messagedate, $messagefromtx, $messagetotx, $messagenetwork, $messageprice, $messagestatus, $messagedelivery, $autoreplytext];
489
+
490
+		               $this->service->insertsentsms($ncuserfortelnyx, $displaynm, $sentmessagearr);
491
+                       }
492
+
493
+                   } elseif ($telarpldata['vacation_start'] && $telarpldata['vacation_end']) {
494
+
495
+                             $vacationstart = $telarpldata['vacation_start'];
496
+                             $vacationend = $telarpldata['vacation_end'];
497
+
498
+                             $crntimeymd = date("Y-m-d H:i:s");
499
+                             $crntdatevcfmt = new DateTime($crntimeymd);
500
+                             $startdatevcfmt = new DateTime($vacationstart);
501
+                             $enddatefvcmt = new DateTime($vacationend);
502
+
503
+                             if ($startdatevcfmt <= $crntdatevcfmt && $crntdatevcfmt <= $enddatefvcmt) {
504
+
505
+			         // Send the auto-reply
506
+			         \Telnyx\Telnyx::setApiKey($telnyxkey);
507
+			         $messagedate = date("Y-m-d H:i:s");
508
+			         $message = \Telnyx\Message::Create(["from" => $messagetopr, "to" => $messagefrom, "text" => $autoreplytext, "webhook_url" => $teldelrecurl]);
509
+
510
+			         // Insert the sent SMS in the 'sms_relent_sent' table
511
+//			         $messageid = $message['id'];
512
+			         if ($message) {
513
+				     if (isset($message['id'])) {
514
+				         $messageid = $message['id'];
515
+				     } else { $messageid = $this->createMessageId(); }
516
+			         } else { $messageid = $this->createMessageId(); }
517
+			         $messagefromtx = "Telnyx: " . $messagetopr;
518
+			         $messagetotx = $messagefrom;
519
+			         $messagenetwork = null;
520
+			         $messageprice = null;
521
+			         $messagestatus = $message['to'][0]['status'];
522
+			         $messagedelivery = null;
523
+
524
+			         $sentmessagearr = [$messageid, $messagedate, $messagefromtx, $messagetotx, $messagenetwork, $messageprice, $messagestatus, $messagedelivery, $autoreplytext];
525
+
526
+			         $this->service->insertsentsms($ncuserfortelnyx, $displaynm, $sentmessagearr);
527
+                           }
528
+
529
+                   }
530
+               }
531
+
532
+
533
+	       // Send notifications
534
+               $nameofhost = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'];
535
+
536
+	       $telsmsapicred = $this->service->getapicredentials($ncuserfortelnyx);
537
+	       $telnotify = $telsmsapicred[12];
538
+	       $emailaddress = $telsmsapicred[13];
539
+	       $includemessageinemail = $telsmsapicred[14];
540
+
541
+               if ($ismmstel == 0) { $smsormmstel = "SMS"; } else { $smsormmstel = "MMS"; }
542
+
543
+	       if ($telnotify != 0 ) {
544
+
545
+                   $allalloweduserstx = $this->service->getallowedusers($ncuserfortelnyx);
546
+
547
+                   foreach ($allalloweduserstx as $alusrkeytx => $specusrnametx) {
548
+
549
+		            $notificationtx = $this->manager->createNotification();
550
+		            $notificationtx->setApp('sms_relentless')
551
+			          ->setUser($specusrnametx)
552
+			          ->setDateTime(new \DateTime())
553
+			          ->setObject('sms_relentless', '11')
554
+			          ->setSubject('New SMS Message');
555
+		            $this->manager->notify($notificationtx);
556
+                   }
557
+	       }
558
+
559
+	       if ($emailaddress != '') {
560
+
561
+		   $gmtind = "UTC " . date('P');
562
+		   $smsdateinit = date("Y-m-d  H:i:s");
563
+		   $smsdate = $smsdateinit . " " . $gmtind;
564
+
565
+		   $subject = "New ". $smsormmstel ." message received";
566
+
567
+                   $messagetextnltel = str_replace("\n", "<br>", $messagetexttel);
568
+
569
+		   if ($includemessageinemail == 0) {
570
+		       $message = "Hello, <br><br> You have received a new message on ".$smsdate." .<br> You can check the new message by going to 'SMS Relentless' > 'Received SMS Messages'. <br><br> Yours, <br> SMS Relentless <br> An SMS application for Nextcloud <br> Host: '" . $nameofhost . "' <br>";
571
+		   } else {
572
+		       $message = "Hello, <br><br> You have received a new message on ".$smsdate." :<br><br><br> Message ID: ".$messageid." <br> Message Date: ".$messagedate." <br> From: ".$messagefrom." <br> To: ".$messageto."<br> Message Text: <br><br><b>".$messagetextnltel."</b><br><br>____________<br><br> Yours, <br> SMS Relentless <br> An SMS application for Nextcloud <br> Host: '".$nameofhost."' <br>";
573
+		   }
574
+
575
+                   $messagefin = chunk_split(base64_encode($message));
576
+
577
+		   $headers = "MIME-Version: 1.0" . "\r\n";
578
+		   $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
579
+                   $headers .= "Content-Transfer-Encoding: base64" . "\r\n";
580
+
581
+		   // Set the email sender
582
+		   $headers .= "From: " . $emailaddress . "\r\n";
583
+		   $headers .= "Reply-To: " . $emailaddress . "\r\n";
584
+
585
+		   mail($emailaddress, $subject, $messagefin, $headers);
586
+	       }
587
+
588
+	       return http_response_code(200);
589
+
590
+          } else { return "access denied"; }
591
+
592
+       } else { return "access denied"; }
593
+
594
+    }
595
+
596
+
597
+    /**
598
+     * @NoAdminRequired
599
+     * @NoCSRFRequired
600
+     * @PublicPage
601
+     */
602
+    public function receivesmsnex() {
603
+
604
+       $plivosignature = $_SERVER['HTTP_X_PLIVO_SIGNATURE_V2'];
605
+       $plivononce = $_SERVER["HTTP_X_PLIVO_SIGNATURE_V2_NONCE"];
606
+
607
+       $plivorecurl = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
608
+
609
+       $ncuserforplivo = $this->service->getuserbyplivorecwhurl($plivorecurl);
610
+
611
+       $smsapicred = $this->service->getapicredentials($ncuserforplivo);
612
+
613
+       $plivoapikey = $smsapicred[5];
614
+       $plivoauthtoken = $smsapicred[6];
615
+       $plivowhdelrcpt = $smsapicred[8];
616
+
617
+       $baseplivourlinit = explode("?", $plivorecurl);  
618
+       $baseplivoURI = $baseplivourlinit[0];
619
+
620
+       // Verify message signature
621
+       $SigValidation = new signatureValidation();
622
+       $signverify = $SigValidation->validateSignature($baseplivoURI, $plivononce, $plivosignature, $plivoauthtoken);
623
+
624
+       if ($signverify) {
625
+
626
+              if ($ncuserforplivo != '' && $ncuserforplivo != null && $ncuserforplivo != 'undefined') {
627
+
628
+//	          $messageid = $_REQUEST["MessageUUID"];
629
+	          if ($_REQUEST) {
630
+		      if (isset($_REQUEST["MessageUUID"])) {
631
+		          $messageid = $_REQUEST["MessageUUID"];
632
+		      } else { $messageid = $this->createMessageId(); }
633
+	          } else { $messageid = $this->createMessageId(); }
634
+
635
+	          $messagedate = date("Y-m-d H:i:s");
636
+
637
+	          $messagefrom = "+" . $_REQUEST['From'];
638
+	          $messageto = "Plivo: +" . $_REQUEST['To'];
639
+	          $messagetoprpl = "Pl: +" . $_REQUEST['To'];
640
+                  $messagetoplsp = "+" . $_REQUEST['To'];
641
+
642
+                  // Check if the message is a MMS
643
+                  if ($_REQUEST['Type'] == 'mms') {
644
+
645
+                      $includedFilespl = '';
646
+                      foreach ($_REQUEST as $plkey => $plvalue) {
647
+
648
+			   if (strpos($plkey, "Media") !== false && $plkey != "MediaCount") {
649
+                               $includedFilespl .= "<div id='mmsTblUrl-" . mt_rand(1, 10000) . "' class='mmstblUrls' title='Download this file only if you trust the sender and the domain of the URL.'>" . $plvalue . "</div><br><br>";
650
+			   }
651
+                      }
652
+
653
+                      $messagetextpl = $_REQUEST['Body'] . "<br><br><br></b>--- The files included in the MMS follow. Download them only if you trust the sender and the domains of the URLs ---<br><br><br>" . $includedFilespl;
654
+                      $ismmspl = 1;
655
+                  } else {
656
+                      $messagetextpl = $_REQUEST['Text'];
657
+                      $ismmspl = 0;
658
+                  }
659
+
660
+	          $recmessagearr = [$messageid, $messagedate, $messagefrom, $messageto, $messagetextpl];
661
+
662
+                  $this->service->insertrecsms($ncuserforplivo, $recmessagearr);
663
+
664
+
665
+                  // Check if there is any auto-reply configured for the receiving number
666
+	          $plgetarpl = $this->connection->prepare('SELECT `phone_number`, `days_of_week`, `daily_start`, `daily_end`, `vacation_start`, `vacation_end`, `message_text` FROM 
667
+                                                          `*PREFIX*sms_relent_autorply` WHERE `phone_number` = ?');
668
+	          $plgetarplres = $plgetarpl->execute([$messagetoprpl]);
669
+	          $plarpldata = $plgetarplres->fetch();
670
+	          $plgetarplres->closeCursor();
671
+
672
+                  if ($plarpldata) {
673
+
674
+                      $autoreplytext = $plarpldata['message_text'];
675
+
676
+                      // Get the Display Name of the current user
677
+                      $crtuser = $this->userManager->get($ncuserforplivo);
678
+                      $displaynm = $crtuser->getDisplayName();
679
+
680
+                      // Check if the auto-reply is in 'daily mode'
681
+                      if ($plarpldata['days_of_week']) {
682
+
683
+                          // Check if the auto-reply should be sent 
684
+                          $daysofweekarrinit = explode(",", $plarpldata['days_of_week']);
685
+
686
+                          $daysofweekarr = [];
687
+                          $fulldays = [];
688
+                          foreach ($daysofweekarrinit as $crtday) {
689
+                              if (strpos($crtday, "full") !== false) {
690
+                                  $fulldays[] = $crtday;
691
+                              } else {
692
+                                  $daysofweekarr[] = $crtday;
693
+                              }
694
+                          }
695
+
696
+                          $dailystart = $plarpldata['daily_start'];
697
+                          $dailyend = $plarpldata['daily_end'];
698
+
699
+                          $crntdate = date("Y-m-d");
700
+                          $crntDayNumber = date('N', strtotime($crntdate));
701
+
702
+                          if (in_array($crntDayNumber, $daysofweekarr)) {
703
+
704
+                              $crntimehrmin = date("H:i");
705
+                              $crntdatefmt = new DateTime($crntimehrmin);
706
+                              $startdatefmt = new DateTime($dailystart);
707
+                              $enddatefmt = new DateTime($dailyend);
708
+
709
+                              if ($crntdatefmt >= $startdatefmt && $enddatefmt > $crntdatefmt) {
710
+                                  // OK
711
+                              } else {
712
+
713
+                                  // Send the auto-reply
714
+		                  $client = new RestClient($plivoapikey, $plivoauthtoken);
715
+                                  $messagedatepl = date("Y-m-d H:i:s");
716
+		                  $response = $client->messages->create($messagetoplsp,[$messagefrom],$autoreplytext,["url" => $plivowhdelrcpt]);
717
+			          $messageidinit = $response->getmessageUuid(0);
718
+//		                  $messageid = $messageidinit[0];
719
+				  if ($messageidinit) {
720
+				      if (isset($messageidinit[0])) {
721
+					  $messageid = $messageidinit[0];
722
+				      } else { $messageid = $this->createMessageId(); }
723
+				  } else { $messageid = $this->createMessageId(); }
724
+
725
+		                  if (property_exists($response, 'error')) { 
726
+		                      $messagestatus = "Error: " . $response->error;
727
+		                  } else { $messagestatus = 'The message has been accepted for delivery.'; }
728
+
729
+                                  $messagefrompl = $messageto;
730
+			          $messagetopl = $messagefrom;
731
+			          $messagenetwork = '';
732
+			          $messageprice = '';
733
+
734
+			          $messagedelivery = '';
735
+
736
+			          $sentmessagearr = [$messageid, $messagedatepl, $messagefrompl, $messagetopl, $messagenetwork, $messageprice, $messagestatus, $messagedelivery, $autoreplytext];
737
+
738
+			          $this->service->insertsentsms($ncuserforplivo, $displaynm, $sentmessagearr);
739
+                              }
740
+                          }
741
+
742
+                          if (in_array($crntDayNumber, $fulldays)) {
743
+
744
+                                  // Send the auto-reply
745
+		                  $client = new RestClient($plivoapikey, $plivoauthtoken);
746
+                                  $messagedatepl = date("Y-m-d H:i:s");
747
+		                  $response = $client->messages->create($messagetoplsp,[$messagefrom],$autoreplytext,["url" => $plivowhdelrcpt]);
748
+			          $messageidinit = $response->getmessageUuid(0);
749
+//		                  $messageid = $messageidinit[0];
750
+				  if ($messageidinit) {
751
+				      if (isset($messageidinit[0])) {
752
+					  $messageid = $messageidinit[0];
753
+				      } else { $messageid = $this->createMessageId(); }
754
+				  } else { $messageid = $this->createMessageId(); }
755
+
756
+		                  if (property_exists($response, 'error')) { 
757
+		                      $messagestatus = "Error: " . $response->error;
758
+		                  } else { $messagestatus = 'The message has been accepted for delivery.'; }
759
+
760
+                                  $messagefrompl = $messageto;
761
+			          $messagetopl = $messagefrom;
762
+			          $messagenetwork = '';
763
+			          $messageprice = '';
764
+
765
+			          $messagedelivery = '';
766
+
767
+			          $sentmessagearr = [$messageid, $messagedatepl, $messagefrompl, $messagetopl, $messagenetwork, $messageprice, $messagestatus, $messagedelivery, $autoreplytext];
768
+
769
+			          $this->service->insertsentsms($ncuserforplivo, $displaynm, $sentmessagearr);
770
+                          }
771
+
772
+                      } elseif ($plarpldata['vacation_start'] && $plarpldata['vacation_end']) {
773
+
774
+                             $vacationstart = $plarpldata['vacation_start'];
775
+                             $vacationend = $plarpldata['vacation_end'];
776
+
777
+                             $crntimeymd = date("Y-m-d H:i:s");
778
+                             $crntdatevcfmt = new DateTime($crntimeymd);
779
+                             $startdatevcfmt = new DateTime($vacationstart);
780
+                             $enddatefvcmt = new DateTime($vacationend);
781
+
782
+                             if ($startdatevcfmt <= $crntdatevcfmt && $crntdatevcfmt <= $enddatefvcmt) {
783
+
784
+		                 $client = new RestClient($plivoapikey, $plivoauthtoken);
785
+                                 $messagedatepl = date("Y-m-d H:i:s");
786
+		                 $response = $client->messages->create($messagetoplsp,[$messagefrom],$autoreplytext,["url" => $plivowhdelrcpt]);
787
+
788
+			         $messageidinit = $response->getmessageUuid(0);
789
+//		                 $messageid = $messageidinit[0];
790
+				  if ($messageidinit) {
791
+				      if (isset($messageidinit[0])) {
792
+					  $messageid = $messageidinit[0];
793
+				      } else { $messageid = $this->createMessageId(); }
794
+				  } else { $messageid = $this->createMessageId(); }
795
+
796
+		                 if (property_exists($response, 'error')) { 
797
+		                     $messagestatus = "Error: " . $response->error;
798
+		                 } else { $messagestatus = 'The message has been accepted for delivery.'; }
799
+
800
+                                 $messagefrompl = $messageto;
801
+			         $messagetopl = $messagefrom;
802
+			         $messagenetwork = '';
803
+			         $messageprice = '';
804
+
805
+			         $messagedelivery = '';
806
+
807
+			         $sentmessagearr = [$messageid, $messagedatepl, $messagefrompl, $messagetopl, $messagenetwork, $messageprice, $messagestatus, $messagedelivery, $autoreplytext];
808
+
809
+			         $this->service->insertsentsms($ncuserforplivo, $displaynm, $sentmessagearr);
810
+                             }
811
+
812
+                      }
813
+                  }
814
+
815
+
816
+	          // Send notifications
817
+                  $nameofhost = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'];
818
+
819
+	          $nextnotify = $smsapicred[12];
820
+	          $emailaddress = $smsapicred[13];
821
+	          $includemessageinemail = $smsapicred[14];
822
+
823
+                  if ($ismmspl == 0) { $smsormmspl = "SMS"; } else { $smsormmspl = "MMS"; }
824
+
825
+	          if ($nextnotify != 0 ) {
826
+
827
+                      $allalloweduserspl = $this->service->getallowedusers($ncuserforplivo);
828
+
829
+                      foreach ($allalloweduserspl as $alusrkeypl => $specusrnamepl) {
830
+
831
+		               $notificationpl = $this->manager->createNotification();
832
+		               $notificationpl->setApp('sms_relentless')
833
+			                      ->setUser($specusrnamepl)
834
+			                      ->setDateTime(new \DateTime())
835
+			                      ->setObject('sms_relentless', '11')
836
+			                      ->setSubject('New SMS Message');
837
+		               $this->manager->notify($notificationpl);
838
+                      }
839
+	          }
840
+
841
+	          if ($emailaddress != '') {
842
+
843
+		      $gmtind = "UTC " . date('P');
844
+		      $smsdateinit = date("Y-m-d  H:i:s");
845
+		      $smsdate = $smsdateinit . " " . $gmtind;
846
+
847
+		      $subject = "New ". $smsormmspl ." message received";
848
+
849
+                      $messagetextnlpl = str_replace("\n", "<br>", $messagetextpl);
850
+
851
+		      if ($includemessageinemail == 0) {
852
+		          $message = "Hello, <br><br> You have received a new message on ".$smsdate." .<br> You can check the new message by going to 'SMS Relentless' > 'Received SMS Messages'. <br><br> Yours, <br> SMS Relentless <br> An SMS application for Nextcloud <br> Host: '".$nameofhost."' <br>";
853
+		      } else {
854
+		          $message = "Hello, <br><br> You have received a new message on ".$smsdate." :<br><br><br> Message ID: ".$messageid." <br> Message Date: ".$messagedate." <br> From: ".$messagefrom." <br> To: ".$messageto."<br> Message Text: <br><br><b>".$messagetextnlpl."</b><br><br>____________<br><br> Yours, <br> SMS Relentless <br> An SMS application for Nextcloud <br> Host: '".$nameofhost."' <br>";
855
+		      }
856
+
857
+                      $messagefin = chunk_split(base64_encode($message));
858
+
859
+		      $headers = "MIME-Version: 1.0" . "\r\n";
860
+		      $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
861
+                      $headers .= "Content-Transfer-Encoding: base64" . "\r\n";
862
+
863
+		      // Set the email sender
864
+		      $headers .= "From: " . $emailaddress . "\r\n";
865
+		      $headers .= "Reply-To: " . $emailaddress . "\r\n";
866
+
867
+		      mail($emailaddress, $subject, $messagefin, $headers);
868
+	          }
869
+
870
+	          return http_response_code(200);
871
+
872
+              } else { return "access denied"; }
873
+
874
+       } else { return "access denied"; }
875
+    }
876
+
877
+
878
+    /**
879
+     * @NoAdminRequired
880
+     * @NoCSRFRequired
881
+     * @PublicPage
882
+     */
883
+    public function receivesmstwil() {
884
+
885
+       $twilsig = $_SERVER['HTTP_X_TWILIO_SIGNATURE'];
886
+
887
+       $basepath = $this->config->getSystemValue('overwrite.cli.url');
888
+       $twilrecprm = $_GET["twilrecparam"];
889
+       $twilrecurl = $basepath . "/apps/sms_relentless/api/recsmstwil?twilrecparam=" . $twilrecprm;
890
+
891
+       $ncuserfortwil = $this->service->getuserbytwilrecwhurl($twilrecurl);
892
+
893
+       $smsapicred = $this->service->getapicredentials($ncuserfortwil);
894
+       $apikeyTw = $smsapicred[15];
895
+       $authTokenTw = $smsapicred[16];
896
+       $apidelrecurltw = $smsapicred[18];
897
+
898
+       $postVars = $_POST;
899
+       ksort($postVars);
900
+
901
+       $compurlpart = '';
902
+
903
+       foreach ($postVars as $twilkey => $twilvalue) {
904
+                $compurlpart .= $twilkey . $twilvalue;
905
+       }
906
+
907
+       $compURL1 = $basepath . "/apps/sms_relentless/api/recsmstwil?twilrecparam=" . $twilrecprm . $compurlpart;
908
+       $compURL2 = $basepath . "/apps/sms_relentless/api/recsmstwil?twilrecparam=" . $twilrecprm . "&twilrecparam=" . $twilrecprm . $compurlpart;
909
+       $computedsig1 = base64_encode(hash_hmac('sha1', $compURL1, $authTokenTw, true));
910
+       $computedsig2 = base64_encode(hash_hmac('sha1', $compURL2, $authTokenTw, true));
911
+
912
+       // Verify message signature
913
+       if (strcmp($computedsig1, $twilsig) == 0 || strcmp($computedsig2, $twilsig) == 0) {
914
+
915
+           if ($ncuserfortwil) {
916
+
917
+//	       $messageid = $_POST['MessageSid'];
918
+	       if ($_POST) {
919
+	           if (isset($_POST['MessageSid'])) {
920
+		       $messageid = $_POST['MessageSid'];
921
+	           } else { $messageid = $this->createMessageId(); }
922
+	       } else { $messageid = $this->createMessageId(); }
923
+
924
+	       $messagedate = date("Y-m-d H:i:s");
925
+
926
+	       $messagefrom = $_POST['From'];
927
+
928
+	       $messageto = "Twilio: " . $_POST['To'];
929
+
930
+	       $messagetoprtw = $_POST['To'];
931
+
932
+	       $messagetotwls = "Tw: " . $_POST['To'];
933
+
934
+               // Check if the new message is a MMS
935
+               if ($_POST['NumMedia'] != 0) {
936
+
937
+                   $includedFilestw = '';
938
+                   foreach ($_POST as $twkey => $twvalue) {
939
+
940
+			if (strpos($twkey, "MediaUrl") !== false) {
941
+
942
+                            $includedFilestw .= "<div id='mmsTblUrl-" . mt_rand(1, 10000) . "' class='mmstblUrls' title='Download this file only if you trust the sender and the domain of the URL.'>" . $twvalue . "</div><br><br>";
943
+			}
944
+                   }
945
+                   $messagetexttw = $_POST['Body'] . "<br><br><br></b>--- The files included in the MMS follow. Download them only if you trust the sender and the domains of the URLs ---<br><br><br>" . $includedFilestw;
946
+                   $ismmstw = 1;
947
+
948
+               } else {
949
+                   $messagetexttw = $_POST['Body'];
950
+                   $ismmstw = 0;
951
+               }
952
+
953
+	       $recmessagearr = [$messageid, $messagedate, $messagefrom, $messageto, $messagetexttw];
954
+
955
+	       $this->service->insertrecsms($ncuserfortwil, $recmessagearr);
956
+
957
+
958
+               // Check if there is any auto-reply configured for the receiving number
959
+	       $twilgetarpl = $this->connection->prepare('SELECT `phone_number`, `days_of_week`, `daily_start`, `daily_end`, `vacation_start`, `vacation_end`, `message_text` FROM 
960
+                                                         `*PREFIX*sms_relent_autorply` WHERE `phone_number` = ?');
961
+	       $twilgetarplres = $twilgetarpl->execute([$messagetotwls]);
962
+	       $twilarpldata = $twilgetarplres->fetch();
963
+	       $twilgetarplres->closeCursor();
964
+
965
+               if ($twilarpldata) {
966
+
967
+                   $autoreplytext = $twilarpldata['message_text'];
968
+
969
+                   // Get the Display Name of the current user
970
+                   $crtuser = $this->userManager->get($ncuserfortwil);
971
+                   $displaynm = $crtuser->getDisplayName();
972
+
973
+                   // Check if the auto-reply is in 'daily mode'
974
+                   if ($twilarpldata['days_of_week']) {
975
+
976
+                       // Check if the auto-reply should be sent 
977
+                       $daysofweekarrinit = explode(",", $twilarpldata['days_of_week']);
978
+
979
+                       $daysofweekarr = [];
980
+                       $fulldays = [];
981
+                       foreach ($daysofweekarrinit as $crtday) {
982
+                           if (strpos($crtday, "full") !== false) {
983
+                               $fulldays[] = str_replace("(full)", "", $crtday);
984
+                           } else {
985
+                               $daysofweekarr[] = $crtday;
986
+                           }
987
+                       }
988
+
989
+                       $dailystart = $twilarpldata['daily_start'];
990
+                       $dailyend = $twilarpldata['daily_end'];
991
+
992
+                       $crntdate = date("Y-m-d");
993
+                       $crntDayNumber = date('N', strtotime($crntdate));
994
+
995
+                       if (in_array($crntDayNumber, $daysofweekarr)) {
996
+
997
+                           $crntimehrmin = date("H:i");
998
+                           $crntdatefmt = new DateTime($crntimehrmin);
999
+                           $startdatefmt = new DateTime($dailystart);
1000
+                           $enddatefmt = new DateTime($dailyend);
1001
+
1002
+                           if ($crntdatefmt >= $startdatefmt && $enddatefmt > $crntdatefmt) {
1003
+                               // OK
1004
+                           } else {
1005
+
1006
+			       $datatoposttw = [["To" => $messagefrom, "From" => $messagetoprtw, "Body" => $autoreplytext, "StatusCallback" => $apidelrecurltw]];
1007
+
1008
+			       $postedsendingfl = implode('&', array_map('http_build_query', $datatoposttw));
1009
+			       $messagedatetw = date("Y-m-d H:i:s");
1010
+
1011
+			       $chtw = curl_init();
1012
+			       curl_setopt($chtw, CURLOPT_URL, 'https://api.twilio.com/2010-04-01/Accounts/' . $apikeyTw . '/Messages.json');
1013
+			       curl_setopt($chtw, CURLOPT_TIMEOUT, 300);
1014
+			       curl_setopt($chtw, CURLOPT_RETURNTRANSFER, 1);
1015
+			       curl_setopt($chtw, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
1016
+			       curl_setopt($chtw, CURLOPT_USERPWD, "$apikeyTw:$authTokenTw");
1017
+			       curl_setopt($chtw, CURLOPT_POST, 1);
1018
+			       curl_setopt($chtw, CURLOPT_POSTFIELDS, $postedsendingfl);
1019
+
1020
+			       $resulttw = curl_exec ($chtw);
1021
+			       $statusCodetw = curl_getinfo($chtw, CURLINFO_HTTP_CODE);
1022
+			       curl_close ($chtw);
1023
+
1024
+			       $decresulttw = json_decode($resulttw);
1025
+
1026
+//			       if ($resulttw) {
1027
+//				   $messageidtw = $decresulttw->sid;
1028
+//			       } else { $messageidtw = ''; }
1029
+
1030
+			       if ($resulttw) {
1031
+				   if (property_exists($decresulttw->sid)) {
1032
+				       $messageidtw = $decresulttw->sid;
1033
+				   } else { $messageidtw = $this->createMessageId(); }
1034
+			       } else { $messageidtw = $this->createMessageId(); }
1035
+
1036
+			       if (in_array($statusCodetw, [200, 201, 202, 203, 204, 205, 206])) {
1037
+				   $messagestatustw = 'The message has been accepted for delivery.';
1038
+			       } else {
1039
+				   $messagestatustw = 'An error occurred while trying to send the message.';
1040
+			       }
1041
+
1042
+			       $messagenetworktw = '';
1043
+			       $messagepricetw = '';
1044
+			       $messagedeliverytw = '';
1045
+
1046
+			       $sentmessagearr = [$messageidtw, $messagedatetw, $messageto, $messagefrom, $messagenetworktw, $messagepricetw, $messagestatustw, $messagedeliverytw, $autoreplytext];
1047
+
1048
+			       $this->service->insertsentsms($ncuserfortwil, $displaynm, $sentmessagearr);
1049
+                           }
1050
+                       }
1051
+
1052
+                       if (in_array($crntDayNumber, $fulldays)) {
1053
+
1054
+			       $datatoposttw = [["To" => $messagefrom, "From" => $messagetoprtw, "Body" => $autoreplytext, "StatusCallback" => $apidelrecurltw]];
1055
+
1056
+			       $postedsendingfl = implode('&', array_map('http_build_query', $datatoposttw));
1057
+			       $messagedatetw = date("Y-m-d H:i:s");
1058
+
1059
+			       $chtw = curl_init();
1060
+			       curl_setopt($chtw, CURLOPT_URL, 'https://api.twilio.com/2010-04-01/Accounts/' . $apikeyTw . '/Messages.json');
1061
+			       curl_setopt($chtw, CURLOPT_TIMEOUT, 300);
1062
+			       curl_setopt($chtw, CURLOPT_RETURNTRANSFER, 1);
1063
+			       curl_setopt($chtw, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
1064
+			       curl_setopt($chtw, CURLOPT_USERPWD, "$apikeyTw:$authTokenTw");
1065
+			       curl_setopt($chtw, CURLOPT_POST, 1);
1066
+			       curl_setopt($chtw, CURLOPT_POSTFIELDS, $postedsendingfl);
1067
+
1068
+			       $resulttw = curl_exec ($chtw);
1069
+			       $statusCodetw = curl_getinfo($chtw, CURLINFO_HTTP_CODE);
1070
+			       curl_close ($chtw);
1071
+
1072
+			       $decresulttw = json_decode($resulttw);
1073
+
1074
+//			       if ($resulttw) {
1075
+//				   $messageidtw = $decresulttw->sid;
1076
+//			       } else { $messageidtw = ''; }
1077
+
1078
+			       if ($resulttw) {
1079
+				   if (property_exists($decresulttw->sid)) {
1080
+				       $messageidtw = $decresulttw->sid;
1081
+				   } else { $messageidtw = $this->createMessageId(); }
1082
+			       } else { $messageidtw = $this->createMessageId(); }
1083
+
1084
+			       if (in_array($statusCodetw, [200, 201, 202, 203, 204, 205, 206])) {
1085
+				   $messagestatustw = 'The message has been accepted for delivery.';
1086
+			       } else {
1087
+				   $messagestatustw = 'An error occurred while trying to send the message.';
1088
+			       }
1089
+
1090
+			       $messagenetworktw = '';
1091
+			       $messagepricetw = '';
1092
+			       $messagedeliverytw = '';
1093
+
1094
+			       $sentmessagearr = [$messageidtw, $messagedatetw, $messageto, $messagefrom, $messagenetworktw, $messagepricetw, $messagestatustw, $messagedeliverytw, $autoreplytext];
1095
+
1096
+			       $this->service->insertsentsms($ncuserfortwil, $displaynm, $sentmessagearr);
1097
+                       }
1098
+
1099
+                   } elseif ($twilarpldata['vacation_start'] && $twilarpldata['vacation_end']) {
1100
+
1101
+                             $vacationstart = $twilarpldata['vacation_start'];
1102
+                             $vacationend = $twilarpldata['vacation_end'];
1103
+
1104
+                             $crntimeymd = date("Y-m-d H:i:s");
1105
+                             $crntdatevcfmt = new DateTime($crntimeymd);
1106
+                             $startdatevcfmt = new DateTime($vacationstart);
1107
+                             $enddatefvcmt = new DateTime($vacationend);
1108
+
1109
+                             if ($startdatevcfmt <= $crntdatevcfmt && $crntdatevcfmt <= $enddatefvcmt) {
1110
+
1111
+			         $datatoposttw = [["To" => $messagefrom, "From" => $messagetoprtw, "Body" => $autoreplytext, "StatusCallback" => $apidelrecurltw]];
1112
+
1113
+			         $postedsendingfl = implode('&', array_map('http_build_query', $datatoposttw));
1114
+			         $messagedatetw = date("Y-m-d H:i:s");
1115
+
1116
+			         $chtw = curl_init();
1117
+			         curl_setopt($chtw, CURLOPT_URL, 'https://api.twilio.com/2010-04-01/Accounts/' . $apikeyTw . '/Messages.json');
1118
+			         curl_setopt($chtw, CURLOPT_TIMEOUT, 300);
1119
+			         curl_setopt($chtw, CURLOPT_RETURNTRANSFER, 1);
1120
+			         curl_setopt($chtw, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
1121
+			         curl_setopt($chtw, CURLOPT_USERPWD, "$apikeyTw:$authTokenTw");
1122
+			         curl_setopt($chtw, CURLOPT_POST, 1);
1123
+			         curl_setopt($chtw, CURLOPT_POSTFIELDS, $postedsendingfl);
1124
+
1125
+			         $resulttw = curl_exec ($chtw);
1126
+			         $statusCodetw = curl_getinfo($chtw, CURLINFO_HTTP_CODE);
1127
+			         curl_close ($chtw);
1128
+
1129
+			         $decresulttw = json_decode($resulttw);
1130
+
1131
+//			         if ($resulttw) {
1132
+//				     $messageidtw = $decresulttw->sid;
1133
+//			         } else { $messageidtw = ''; }
1134
+
1135
+			         if ($resulttw) {
1136
+				     if (property_exists($decresulttw->sid)) {
1137
+				         $messageidtw = $decresulttw->sid;
1138
+				     } else { $messageidtw = $this->createMessageId(); }
1139
+			         } else { $messageidtw = $this->createMessageId(); }
1140
+
1141
+			         if (in_array($statusCodetw, [200, 201, 202, 203, 204, 205, 206])) {
1142
+				     $messagestatustw = 'The message has been accepted for delivery.';
1143
+			         } else {
1144
+				     $messagestatustw = 'An error occurred while trying to send the message.';
1145
+			         }
1146
+
1147
+			         $messagenetworktw = '';
1148
+			         $messagepricetw = '';
1149
+			         $messagedeliverytw = '';
1150
+
1151
+			         $sentmessagearr = [$messageidtw, $messagedatetw, $messageto, $messagefrom, $messagenetworktw, $messagepricetw, $messagestatustw, $messagedeliverytw, $autoreplytext];
1152
+
1153
+			         $this->service->insertsentsms($ncuserfortwil, $displaynm, $sentmessagearr);
1154
+                             }
1155
+
1156
+                   }
1157
+               }
1158
+
1159
+
1160
+	       // Send notifications
1161
+               $nameofhost = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'];
1162
+
1163
+	       $twilnotify = $smsapicred[12];
1164
+	       $emailaddress = $smsapicred[13];
1165
+	       $includemessageinemail = $smsapicred[14];
1166
+
1167
+               if ($ismmstw == 0) { $smsormmstw = "SMS"; } else { $smsormmstw = "MMS"; }
1168
+
1169
+	       if ($twilnotify != 0 ) {
1170
+
1171
+                   $allalloweduserstw = $this->service->getallowedusers($ncuserfortwil);
1172
+
1173
+                   foreach ($allalloweduserstw as $alusrkeytw => $specusrnametw) {
1174
+
1175
+	                    $notificationtw = $this->manager->createNotification();
1176
+		            $notificationtw->setApp('sms_relentless')
1177
+			                   ->setUser($specusrnametw)
1178
+			                   ->setDateTime(new \DateTime())
1179
+			                   ->setObject('sms_relentless', '11')
1180
+			                   ->setSubject('New SMS Message');
1181
+		            $this->manager->notify($notificationtw);
1182
+                   }
1183
+	       }
1184
+
1185
+	       if ($emailaddress != '') {
1186
+
1187
+		   $gmtind = "UTC " . date('P');
1188
+		   $smsdateinit = date("Y-m-d  H:i:s");
1189
+		   $smsdate = $smsdateinit . " " . $gmtind;
1190
+
1191
+		   $subject = "New ". $smsormmstw ." message received";
1192
+
1193
+                   $messagetextnltw = str_replace("\n", "<br>", $messagetexttw);
1194
+
1195
+		   if ($includemessageinemail == 0) {
1196
+		       $message = "Hello, <br><br> You have received a new message on ".$smsdate." .<br> You can check the new message by going to 'SMS Relentless' > 'Received SMS Messages'. <br><br> Yours, <br> SMS Relentless <br> An SMS application for Nextcloud <br> Host: '".$nameofhost."' <br>";
1197
+		   } else {
1198
+		       $message = "Hello, <br><br> You have received a new message on ".$smsdate." :<br><br><br> Message ID: ".$messageid." <br> Message Date: ".$messagedate." <br> From: ".$messagefrom." <br> To: ".$messageto."<br> Message Text: <br><br><b>".$messagetextnltw."</b><br><br>____________<br><br> Yours, <br> SMS Relentless <br> An SMS application for Nextcloud <br> Host: '".$nameofhost."' <br>";
1199
+		   }
1200
+
1201
+                   $messagefin = chunk_split(base64_encode($message));
1202
+
1203
+		   $headers = "MIME-Version: 1.0" . "\r\n";
1204
+		   $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
1205
+                   $headers .= "Content-Transfer-Encoding: base64" . "\r\n";
1206
+
1207
+		   // Set the email sender
1208
+		   $headers .= "From: " . $emailaddress . "\r\n";
1209
+		   $headers .= "Reply-To: " . $emailaddress . "\r\n";
1210
+
1211
+		   mail($emailaddress, $subject, $messagefin, $headers);
1212
+	       }
1213
+
1214
+               exit();
1215
+
1216
+           } else { exit(); }
1217
+
1218
+       } else { exit(); }
1219
+
1220
+    }
1221
+
1222
+
1223
+    /**
1224
+     * @NoAdminRequired
1225
+     * @NoCSRFRequired
1226
+     * @PublicPage
1227
+     */
1228
+    public function receivesmsflow() {
1229
+
1230
+       $flowdrurl = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
1231
+
1232
+       $receivesms = file_get_contents('php://input');
1233
+       $recsmsarr = json_decode($receivesms, true);
1234
+
1235
+       $ncuserforflowrec = $this->service->getuserbyflowrecwhurl($flowdrurl);
1236
+
1237
+       if ($ncuserforflowrec != '' && $ncuserforflowrec != null && $ncuserforflowrec != 'undefined') {
1238
+
1239
+//           $messageidfl = $recsmsarr['data']['id'];
1240
+           if ($recsmsarr) {
1241
+	       if (isset($recsmsarr['data']['id'])) {
1242
+	           $messageidfl = $recsmsarr['data']['id'];
1243
+	       } else { $messageidfl = $this->createMessageId(); }
1244
+           } else { $messageidfl = $this->createMessageId(); }
1245
+
1246
+           $messagedatefl = date("Y-m-d H:i:s");
1247
+
1248
+           $messagefromflpre = $recsmsarr['data']['attributes']['from'];
1249
+           if (substr($messagefromflpre, 0, 1) == '+') { $messagefromfl = $messagefromflpre; } else { $messagefromfl = '+' . $messagefromflpre; }
1250
+
1251
+           $messagetofl = "Flowroute: +" . $recsmsarr['data']['attributes']['to'];
1252
+           $messagetoprsl = "+" . $recsmsarr['data']['attributes']['to'];
1253
+           $messagetoprfl = "Fl: +" . $recsmsarr['data']['attributes']['to'];
1254
+
1255
+           // Check if the message is a MMS
1256
+           if ($recsmsarr['data']['attributes']['is_mms'] == true) {
1257
+
1258
+               $includedFilesfl = '';
1259
+               for ($k = 0; $k < count($recsmsarr['included']); $k++) {
1260
+
1261
+                    $includedFilesfl .= "<div id='mmsTblUrl-" . mt_rand(1, 10000) . "' class='mmstblUrls' title='Download this file only if you trust the sender and the domain of the URL.'>" . $recsmsarr['included'][$k]['attributes']['url'] . "</div><br><br>";
1262
+               }
1263
+               $messagetextfl = $recsmsarr['data']['attributes']['body'] . "<br><br><br></b>--- The files included in the MMS follow. Download them only if you trust the sender and the domains of the URLs ---<br><br><br>" . $includedFilesfl;
1264
+               $ismmsfl = 1;
1265
+           } else {
1266
+               $messagetextfl = $recsmsarr['data']['attributes']['body'];
1267
+               $ismmsfl = 0;
1268
+           }
1269
+
1270
+           $recmessagearr = [$messageidfl, $messagedatefl, $messagefromfl, $messagetofl, $messagetextfl];
1271
+
1272
+           $this->service->insertrecsms($ncuserforflowrec, $recmessagearr);
1273
+
1274
+           $flsmsapicred = $this->service->getapicredentials($ncuserforflowrec);
1275
+	   $flownotify = $flsmsapicred[12];
1276
+	   $emailaddress = $flsmsapicred[13];
1277
+	   $includemessageinemail = $flsmsapicred[14];
1278
+           $flowapikey = $flsmsapicred[20];
1279
+           $flowapisecret = $flsmsapicred[21];
1280
+           $flowdelrecurl = $flsmsapicred[23];
1281
+
1282
+
1283
+           // Check if there is any auto-reply configured for the receiving number
1284
+	   $flgetarpl = $this->connection->prepare('SELECT `phone_number`, `days_of_week`, `daily_start`, `daily_end`, `vacation_start`, `vacation_end`, `message_text` FROM 
1285
+                                                   `*PREFIX*sms_relent_autorply` WHERE `phone_number` = ?');
1286
+	   $flgetarplres = $flgetarpl->execute([$messagetoprfl]);
1287
+	   $flarpldata = $flgetarplres->fetch();
1288
+	   $flgetarplres->closeCursor();
1289
+
1290
+           if ($flarpldata) {
1291
+
1292
+               $autoreplytext = $flarpldata['message_text'];
1293
+
1294
+               // Get the Display Name of the current user
1295
+               $crtuser = $this->userManager->get($ncuserforflowrec);
1296
+               $displaynm = $crtuser->getDisplayName();
1297
+
1298
+               // Check if the auto-reply is in 'daily mode'
1299
+               if ($flarpldata['days_of_week']) {
1300
+
1301
+                   // Check if the auto-reply should be sent 
1302
+                   $daysofweekarrinit = explode(",", $flarpldata['days_of_week']);
1303
+
1304
+                   $daysofweekarr = [];
1305
+                   $fulldays = [];
1306
+                   foreach ($daysofweekarrinit as $crtday) {
1307
+                       if (strpos($crtday, "full") !== false) {
1308
+                           $fulldays[] = str_replace("(full)", "", $crtday);
1309
+                       } else {
1310
+                           $daysofweekarr[] = $crtday;
1311
+                       }
1312
+                   }
1313
+
1314
+                   $dailystart = $flarpldata['daily_start'];
1315
+                   $dailyend = $flarpldata['daily_end'];
1316
+
1317
+                   $crntdate = date("Y-m-d");
1318
+                   $crntDayNumber = date('N', strtotime($crntdate));
1319
+
1320
+                   if (in_array($crntDayNumber, $daysofweekarr)) {
1321
+
1322
+                       $crntimehrmin = date("H:i");
1323
+                       $crntdatefmt = new DateTime($crntimehrmin);
1324
+                       $startdatefmt = new DateTime($dailystart);
1325
+                       $enddatefmt = new DateTime($dailyend);
1326
+
1327
+                       if ($crntdatefmt >= $startdatefmt && $enddatefmt > $crntdatefmt) {
1328
+                           // OK
1329
+                       } else {
1330
+
1331
+                           // Send the auto-reply
1332
+		           $postedparamsfl = json_encode(["to" => $messagefromfl, "from" => $messagetoprsl, "body" => $autoreplytext, "dlr_callback" => $flowdelrecurl]);
1333
+		           $messagedatefl = date("Y-m-d H:i:s");
1334
+
1335
+		           $chfl = curl_init();
1336
+		           curl_setopt($chfl, CURLOPT_URL, 'https://' . $flowapikey . ':' . $flowapisecret . '@api.flowroute.com/v2.1/messages');
1337
+		           curl_setopt($chfl, CURLOPT_HTTPHEADER, array("Content-Type: application/vnd.api+json"));
1338
+		           curl_setopt($chfl, CURLOPT_TIMEOUT, 300);
1339
+		           curl_setopt($chfl, CURLOPT_RETURNTRANSFER, 1);
1340
+		           curl_setopt($chfl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
1341
+		           curl_setopt($chfl, CURLOPT_POST, 1);
1342
+		           curl_setopt($chfl, CURLOPT_POSTFIELDS, $postedparamsfl);
1343
+		           $resultfl = curl_exec ($chfl);
1344
+		           $statusCode = curl_getinfo($chfl, CURLINFO_HTTP_CODE);
1345
+		           curl_close ($chfl);
1346
+
1347
+		           $decresultfl = json_decode($resultfl);
1348
+
1349
+//		           if ($resultfl) {
1350
+//		               $messageidfl = $decresultfl->data->id;
1351
+//		           } else { $messageidfl = ''; }
1352
+
1353
+		           if ($resultfl) {
1354
+			       if (property_exists($decresultfl->data->id)) {
1355
+			           $messageidfl = $decresultfl->data->id;
1356
+			       } else { $messageidfl = $this->createMessageId(); }
1357
+		           } else { $messageidfl = $this->createMessageId(); }
1358
+
1359
+		           if (in_array($statusCode, [200, 201, 202, 203, 204, 205, 206])) {
1360
+		               $messagestatusfl = 'The message has been accepted for delivery.'; 
1361
+		           } else { 
1362
+		               $messagestatusfl = 'An error occurred while trying to send the message.'; 
1363
+		           }
1364
+
1365
+		           $messagefromflow = "Flowroute: " . $messagetoprsl;
1366
+                           $messagetoflow = $messagefromfl;
1367
+		           $messagenetworkfl = '';
1368
+		           $messagepricefl = '';
1369
+		           $messagedeliveryfl = '';
1370
+
1371
+		           $sentmessagearr = [$messageidfl, $messagedatefl, $messagefromflow, $messagetoflow, $messagenetworkfl, $messagepricefl, $messagestatusfl, $messagedeliveryfl, $autoreplytext];
1372
+
1373
+		           $this->service->insertsentsms($ncuserforflowrec, $displaynm, $sentmessagearr);
1374
+                       }
1375
+                   }
1376
+
1377
+                   if (in_array($crntDayNumber, $fulldays)) {
1378
+
1379
+                           // Send the auto-reply
1380
+		           $postedparamsfl = json_encode(["to" => $messagefromfl, "from" => $messagetoprsl, "body" => $autoreplytext, "dlr_callback" => $flowdelrecurl]);
1381
+		           $messagedatefl = date("Y-m-d H:i:s");
1382
+
1383
+		           $chfl = curl_init();
1384
+		           curl_setopt($chfl, CURLOPT_URL, 'https://' . $flowapikey . ':' . $flowapisecret . '@api.flowroute.com/v2.1/messages');
1385
+		           curl_setopt($chfl, CURLOPT_HTTPHEADER, array("Content-Type: application/vnd.api+json"));
1386
+		           curl_setopt($chfl, CURLOPT_TIMEOUT, 300);
1387
+		           curl_setopt($chfl, CURLOPT_RETURNTRANSFER, 1);
1388
+		           curl_setopt($chfl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
1389
+		           curl_setopt($chfl, CURLOPT_POST, 1);
1390
+		           curl_setopt($chfl, CURLOPT_POSTFIELDS, $postedparamsfl);
1391
+		           $resultfl = curl_exec ($chfl);
1392
+		           $statusCode = curl_getinfo($chfl, CURLINFO_HTTP_CODE);
1393
+		           curl_close ($chfl);
1394
+
1395
+		           $decresultfl = json_decode($resultfl);
1396
+
1397
+//		           if ($resultfl) {
1398
+//		               $messageidfl = $decresultfl->data->id;
1399
+//		           } else { $messageidfl = ''; }
1400
+
1401
+		           if ($resultfl) {
1402
+			       if (property_exists($decresultfl->data->id)) {
1403
+			           $messageidfl = $decresultfl->data->id;
1404
+			       } else { $messageidfl = $this->createMessageId(); }
1405
+		           } else { $messageidfl = $this->createMessageId(); }
1406
+
1407
+		           if (in_array($statusCode, [200, 201, 202, 203, 204, 205, 206])) {
1408
+		               $messagestatusfl = 'The message has been accepted for delivery.'; 
1409
+		           } else { 
1410
+		               $messagestatusfl = 'An error occurred while trying to send the message.'; 
1411
+		           }
1412
+
1413
+		           $messagefromflow = "Flowroute: " . $messagetoprsl;
1414
+                           $messagetoflow = $messagefromfl;
1415
+		           $messagenetworkfl = '';
1416
+		           $messagepricefl = '';
1417
+		           $messagedeliveryfl = '';
1418
+
1419
+		           $sentmessagearr = [$messageidfl, $messagedatefl, $messagefromflow, $messagetoflow, $messagenetworkfl, $messagepricefl, $messagestatusfl, $messagedeliveryfl, $autoreplytext];
1420
+
1421
+		           $this->service->insertsentsms($ncuserforflowrec, $displaynm, $sentmessagearr);
1422
+                   }
1423
+
1424
+               } elseif ($flarpldata['vacation_start'] && $flarpldata['vacation_end']) {
1425
+
1426
+                         $vacationstart = $flarpldata['vacation_start'];
1427
+                         $vacationend = $flarpldata['vacation_end'];
1428
+
1429
+                         $crntimeymd = date("Y-m-d H:i:s");
1430
+                         $crntdatevcfmt = new DateTime($crntimeymd);
1431
+                         $startdatevcfmt = new DateTime($vacationstart);
1432
+                         $enddatefvcmt = new DateTime($vacationend);
1433
+
1434
+                         if ($startdatevcfmt <= $crntdatevcfmt && $crntdatevcfmt <= $enddatefvcmt) {
1435
+
1436
+		             $postedparamsfl = json_encode(["to" => $messagefromfl, "from" => $messagetoprsl, "body" => $autoreplytext, "dlr_callback" => $flowdelrecurl]);
1437
+		             $messagedatefl = date("Y-m-d H:i:s");
1438
+
1439
+		             $chfl = curl_init();
1440
+		             curl_setopt($chfl, CURLOPT_URL, 'https://' . $flowapikey . ':' . $flowapisecret . '@api.flowroute.com/v2.1/messages');
1441
+		             curl_setopt($chfl, CURLOPT_HTTPHEADER, array("Content-Type: application/vnd.api+json"));
1442
+		             curl_setopt($chfl, CURLOPT_TIMEOUT, 300);
1443
+		             curl_setopt($chfl, CURLOPT_RETURNTRANSFER, 1);
1444
+		             curl_setopt($chfl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
1445
+		             curl_setopt($chfl, CURLOPT_POST, 1);
1446
+		             curl_setopt($chfl, CURLOPT_POSTFIELDS, $postedparamsfl);
1447
+		             $resultfl = curl_exec ($chfl);
1448
+		             $statusCode = curl_getinfo($chfl, CURLINFO_HTTP_CODE);
1449
+		             curl_close ($chfl);
1450
+
1451
+		             $decresultfl = json_decode($resultfl);
1452
+
1453
+//		             if ($resultfl) {
1454
+//		                 $messageidfl = $decresultfl->data->id;
1455
+//		             } else { $messageidfl = ''; }
1456
+
1457
+		             if ($resultfl) {
1458
+			         if (property_exists($decresultfl->data->id)) {
1459
+			             $messageidfl = $decresultfl->data->id;
1460
+			         } else { $messageidfl = $this->createMessageId(); }
1461
+		             } else { $messageidfl = $this->createMessageId(); }
1462
+
1463
+		             if (in_array($statusCode, [200, 201, 202, 203, 204, 205, 206])) {
1464
+		                 $messagestatusfl = 'The message has been accepted for delivery.'; 
1465
+		             } else { 
1466
+		                 $messagestatusfl = 'An error occurred while trying to send the message.'; 
1467
+		             }
1468
+
1469
+		             $messagefromflow = "Flowroute: " . $messagetoprsl;
1470
+                             $messagetoflow = $messagefromfl;
1471
+		             $messagenetworkfl = '';
1472
+		             $messagepricefl = '';
1473
+		             $messagedeliveryfl = '';
1474
+
1475
+		             $sentmessagearr = [$messageidfl, $messagedatefl, $messagefromflow, $messagetoflow, $messagenetworkfl, $messagepricefl, $messagestatusfl, $messagedeliveryfl, $autoreplytext];
1476
+
1477
+		             $this->service->insertsentsms($ncuserforflowrec, $displaynm, $sentmessagearr);
1478
+                         }
1479
+
1480
+               }
1481
+           }
1482
+
1483
+
1484
+	   // Send notifications
1485
+           $nameofhost = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'];
1486
+
1487
+           if ($ismmsfl == 0) { $smsormmsfl = "SMS"; } else { $smsormmsfl = "MMS"; }
1488
+
1489
+	   if ($flownotify != 0 ) {
1490
+
1491
+               $allallowedusersfl = $this->service->getallowedusers($ncuserforflowrec);
1492
+
1493
+               foreach ($allallowedusersfl as $alusrkeyfl => $specusrnamefl) {
1494
+
1495
+	                $notificationfl = $this->manager->createNotification();
1496
+	                $notificationfl->setApp('sms_relentless')
1497
+		                       ->setUser($specusrnamefl)
1498
+			               ->setDateTime(new \DateTime())
1499
+			               ->setObject('sms_relentless', '11')
1500
+			               ->setSubject('New SMS Message');
1501
+	                $this->manager->notify($notificationfl);
1502
+               }
1503
+	   }
1504
+
1505
+	   if ($emailaddress != '') {
1506
+
1507
+	       $gmtind = "UTC " . date('P');
1508
+	       $smsdateinit = date("Y-m-d  H:i:s");
1509
+	       $smsdate = $smsdateinit . " " . $gmtind;
1510
+
1511
+	       $subject = "New ". $smsormmsfl ." message received";
1512
+
1513
+               $messagetextnlfl = str_replace("\n", "<br>", $messagetextfl);
1514
+
1515
+	       if ($includemessageinemail == 0) {
1516
+	           $message = "Hello, <br><br> You have received a new message on ".$smsdate." .<br> You can check the new message by going to 'SMS Relentless' > 'Received SMS Messages'. <br><br> Yours, <br> SMS Relentless <br> An SMS application for Nextcloud <br> Host: '".$nameofhost."' <br>";
1517
+	       } else {
1518
+	           $message = "Hello, <br><br> You have received a new message on ".$smsdate." :<br><br><br> Message ID: ".$messageidfl." <br> Message Date: ".$messagedatefl." <br> From: ".$messagefromfl." <br> To: ".$messagetofl."<br> Message Text: <br><br><b>".$messagetextnlfl."</b><br><br>____________<br><br> Yours, <br> SMS Relentless <br> An SMS application for Nextcloud <br> Host: '".$nameofhost."' <br>";
1519
+	       }
1520
+
1521
+               $messagefin = chunk_split(base64_encode($message));
1522
+
1523
+	       $headers = "MIME-Version: 1.0" . "\r\n";
1524
+	       $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
1525
+               $headers .= "Content-Transfer-Encoding: base64" . "\r\n";
1526
+
1527
+	       // Set the email sender
1528
+	       $headers .= "From: " . $emailaddress . "\r\n";
1529
+	       $headers .= "Reply-To: " . $emailaddress . "\r\n";
1530
+
1531
+	       mail($emailaddress, $subject, $messagefin, $headers);
1532
+	   }
1533
+
1534
+           return http_response_code(200);
1535
+
1536
+       } else { return "access denied"; }
1537
+
1538
+    }
1539
+}
0 1540
new file mode 100644
... ...
@@ -0,0 +1,1249 @@
1
+<?php
2
+/**
3
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
4
+ *
5
+ * @author Double Bastion LLC
6
+ *
7
+ * @license GNU AGPL version 3 or any later version
8
+ *
9
+ * This program is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
11
+ * License as published by the Free Software Foundation; either
12
+ * version 3 of the License, or any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
18
+ *
19
+ * You should have received a copy of the GNU Affero General Public
20
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
23
+
24
+declare(strict_types=1);
25
+
26
+namespace OCA\SMSRelentless\Controller;
27
+
28
+use OCP\IRequest;
29
+use OCP\AppFramework\Controller;
30
+use OCA\SMSRelentless\Service\SmsrelentlessService;
31
+use OCP\AppFramework\App;
32
+use OC\Http\Client\Client;
33
+use OCP\Files\SimpleFS\ISimpleFile;
34
+use OCP\Files\SimpleFS\ISimpleFolder;
35
+use OCP\IL10N;
36
+use OCP\Files\Folder;
37
+use OCP\IConfig;
38
+use OC\Files\Filesystem;
39
+use OC\Files\View;
40
+use \ReflectionClass;
41
+use \FilesystemIterator;
42
+use \DateTime;
43
+use \DateInterval;
44
+use OCP\AppFramework\Http\DataResponse;
45
+use OCP\Files\NotFoundException;
46
+use OCP\Files\NotPermittedException;
47
+use Plivo\RestClient;
48
+use OCP\Share\IManager;
49
+use OCP\Constants;
50
+use OCP\IGroupManager;
51
+use OCP\IDBConnection;
52
+use OCP\IUserManager;
53
+use OC\URLGenerator;
54
+
55
+class SmsrelentlessController extends Controller {
56
+
57
+    private $service;
58
+    private $config;
59
+    private $userId;
60
+    private $folder;
61
+    private $filesystem;
62
+    private $view;
63
+    private $shareManager;
64
+    private $groupManager;
65
+    private $connection;
66
+    private $userManager;
67
+    private $urlGenerator;
68
+
69
+    public function __construct($appName, IRequest $request, SmsrelentlessService $service, IConfig $config, $userId, Folder $folder, Filesystem $filesystem, View $view, IManager $shareManager, IGroupManager $groupManager, IDBConnection $connection, IUserManager $userManager, URLGenerator $urlGenerator) {
70
+        parent::__construct($appName, $request);
71
+        $this->service = $service;
72
+        $this->config = $config;
73
+        $this->userId = $userId;
74
+        $this->folder = $folder;
75
+        $this->filesystem = $filesystem;
76
+        $this->view = $view;
77
+	$this->shareManager = $shareManager;
78
+        $this->groupManager = $groupManager;
79
+        $this->connection = $connection;
80
+        $this->userManager = $userManager;
81
+        $this->urlGenerator = $urlGenerator;
82
+    }
83
+
84
+
85
+    /**
86
+     * @NoAdminRequired
87
+     */
88
+    public function object_to_array($obj) {
89
+        if (is_object($obj)) $obj = (array)$this->dismount($obj);
90
+        if (is_array($obj)) {
91
+           $new = array();
92
+           foreach($obj as $key => $val) {
93
+               $new[$key] = $this->object_to_array($val);
94
+           }
95
+        }
96
+        else $new = $obj;
97
+        return $new;
98
+    }
99
+
100
+
101
+    /**
102
+     * @NoAdminRequired
103
+     */
104
+    public function dismount($object) {
105
+        $reflectionClass = new ReflectionClass(get_class($object));
106
+        $array = array();
107
+        foreach ($reflectionClass->getProperties() as $property) {
108
+           $property->setAccessible(true);
109
+           $array[$property->getName()] = $property->getValue($object);
110
+           $property->setAccessible(false);
111
+        }
112
+        return $array;
113
+    }
114
+
115
+
116
+    /**
117
+     * @NoAdminRequired
118
+     */
119
+    public function getappdirectory($userId) {
120
+        $apprelpath = $this->urlGenerator->linkTo('sms_relentless', 'COPYING.txt');
121
+        $apprelpatharr = explode("/", $apprelpath);
122
+        $currentappdir = $apprelpatharr[1];
123
+        return $currentappdir;
124
+    }
125
+
126
+
127
+    /**
128
+     * @NoAdminRequired
129
+     */
130
+    public function createMessageId() {
131
+             // Create a random string to use as message id for messages that don't have it
132
+	     $keypassin = substr(sha1((string) mt_rand()), 0, 32);
133
+	     $keysaltin = openssl_random_pseudo_bytes(24);
134
+	     $keyLengthin = 32;
135
+	     $iterationin = 50;
136
+	     $generated_keyin = openssl_pbkdf2($keypassin, $keysaltin, $keyLengthin, $iterationin, 'sha256');
137
+	     $ctdMessageId = "generated-id-" . bin2hex($generated_keyin);
138
+             return $ctdMessageId;
139
+    }
140
+
141
+
142
+    /**
143
+     * @NoAdminRequired
144
+     */
145
+    public function getbalancetel($userId) {
146
+
147
+        $telsmsapicred = $this->service->getapicredentials($this->userId);
148
+
149
+        $telapikey = $telsmsapicred[0];
150
+        $ch = curl_init();
151
+        $headerstel = array("Content-Type: application/json", "Accept: application/json", "Authorization: Bearer ".$telapikey);
152
+
153
+        curl_setopt($ch, CURLOPT_URL, "https://api.telnyx.com/v2/balance");
154
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
155
+        curl_setopt($ch, CURLOPT_HTTPHEADER, $headerstel);
156
+        $responsetel = curl_exec($ch);
157
+        $recdatatel = json_decode($responsetel, TRUE);
158
+        $telbalresponse = $recdatatel['data']['balance'];
159
+        $currentbalancetel = round(floatval($telbalresponse), 3);
160
+        curl_close($ch);
161
+
162
+        return $currentbalancetel;
163
+    }
164
+
165
+
166
+    /**
167
+     * @NoAdminRequired
168
+     */
169
+    public function getbalancenex($userId) {
170
+
171
+        $smsapicred = $this->service->getapicredentials($this->userId);
172
+        $smsapikey = $smsapicred[5];
173
+        $smsapisecret = $smsapicred[6];
174
+
175
+        if ($smsapikey == '' || $smsapisecret == '') {
176
+            $currentbalancenex = "N/A";
177
+        } else {
178
+            $getmesdata = "https://".$smsapikey.":".$smsapisecret."@api.plivo.com/v1/Account/".$smsapikey."/";
179
+            $mesdata = file_get_contents($getmesdata);
180
+            $datainit = json_decode($mesdata);
181
+            $balancenex = $datainit->cash_credits;
182
+            $currentbalancenex = round(floatval($balancenex), 3);
183
+        }
184
+        return $currentbalancenex;
185
+    }
186
+
187
+
188
+    /**
189
+     * @NoAdminRequired
190
+     */
191
+    public function getbalancetwil($userId) {
192
+
193
+        $smsapicred = $this->service->getapicredentials($this->userId);
194
+        $smsapisid = $smsapicred[15];
195
+        $smsapitoken = $smsapicred[16];
196
+
197
+        if ($smsapisid == '' || $smsapitoken == '') {
198
+            $currentbalancetwil = "N/A";
199
+        } else {
200
+
201
+            $twilbalance = json_decode(file_get_contents("https://".$smsapisid.":".$smsapitoken."@api.twilio.com/2010-04-01/Accounts/".$smsapisid."/Balance.json"));
202
+            $balancetwil = $twilbalance->balance;
203
+
204
+            $currentbalancetwil = round(floatval($balancetwil), 3);
205
+        }
206
+        return $currentbalancetwil;
207
+    }
208
+
209
+
210
+    /**
211
+     * @NoAdminRequired
212
+     */
213
+    public function getbalanceflow($userId) {
214
+
215
+        $currentbalanceflow = 'n/a';
216
+        return $currentbalanceflow;
217
+    }
218
+
219
+
220
+    /**
221
+     * @NoAdminRequired
222
+     */
223
+    public function getsmsnumbers($userId) {
224
+
225
+        return $this->service->getsmsnumbers($this->userId);
226
+    }
227
+
228
+
229
+    /**
230
+     * @NoAdminRequired
231
+     */
232
+    public function refreshavailablenumbers($userId) {
233
+
234
+        return $this->service->refreshavailablenumbers($this->userId);
235
+    }
236
+
237
+
238
+    /**
239
+     * @NoAdminRequired
240
+     */
241
+    public function cleantempdir($userId) {
242
+
243
+        // Create the temporary folder if it doesn't exist
244
+        if ($this->folder->nodeExists('SMS_Relentless/temp_files') == false) {
245
+            $this->folder->newFolder('SMS_Relentless/temp_files');
246
+        }
247
+        $datadir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/';
248
+        $targetdir = $datadir . $this->userId . "/files/SMS_Relentless/temp_files";
249
+        $fileSystemIterator = new FilesystemIterator($targetdir);
250
+
251
+        $dirfiles = [];
252
+        foreach ($fileSystemIterator as $fileInfo) {
253
+                 $dirfiles[] = $fileInfo->getFilename();
254
+        }
255
+
256
+        foreach ($dirfiles as $key => $indfile) {
257
+                 $thisuserroot = $this->view->getRoot();
258
+                 $tempfile = $thisuserroot . "/SMS_Relentless/temp_files/" . $indfile;
259
+                 $removetmpfile = $this->filesystem->unlink($tempfile);
260
+        }
261
+     }
262
+
263
+
264
+    /**
265
+     * @NoAdminRequired
266
+     */
267
+    public function cleanmultrecdir($userId) {
268
+
269
+        // Create the temporary folder if it doesn't exist
270
+        if ($this->folder->nodeExists('SMS_Relentless/multiple_recipients') == false) {
271
+            $this->folder->newFolder('SMS_Relentless/multiple_recipients');
272
+        }
273
+        $datadirmrc = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/';
274
+        $targetdirmrc = $datadirmrc . $this->userId . "/files/SMS_Relentless/multiple_recipients";
275
+        $fileSystemIteratormrc = new FilesystemIterator($targetdirmrc);
276
+
277
+        $dirfilesmrc = [];
278
+        foreach ($fileSystemIteratormrc as $fileInfomrc){
279
+                 $dirfilesmrc[] = $fileInfomrc->getFilename();
280
+        }
281
+
282
+        foreach ($dirfilesmrc as $mreckey => $mrecfile) {
283
+                 $thisuserrootmrc = $this->view->getRoot();
284
+                 $mrectempfile = $thisuserrootmrc . "/SMS_Relentless/multiple_recipients/" . $mrecfile;
285
+                 $removemrectmpfile = $this->filesystem->unlink($mrectempfile);
286
+        }
287
+     }
288
+
289
+
290
+    /**
291
+     * @NoAdminRequired
292
+     */
293
+    public function uploadNumbersFile($userId, $uploadfileforsms) {
294
+
295
+        // Create the temporary folder if it doesn't exist
296
+        if ($this->folder->nodeExists('SMS_Relentless/multiple_recipients') == false) {
297
+            $this->folder->newFolder('SMS_Relentless/multiple_recipients');
298
+        }
299
+
300
+        // First delete any file that has been previously uploaded
301
+        $datadir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/';
302
+        $targetdir = $datadir . $this->userId . "/files/SMS_Relentless/multiple_recipients";
303
+        $fileSystemIterator = new FilesystemIterator($targetdir);
304
+
305
+        $dirfiles = [];
306
+        foreach ($fileSystemIterator as $fileInfo){
307
+                 $dirfiles[] = $fileInfo->getFilename();
308
+        }
309
+
310
+        foreach ($dirfiles as $key => $indfile) {
311
+                 $thisuserroot = $this->view->getRoot();
312
+                 $tempfile = $thisuserroot . "/SMS_Relentless/multiple_recipients/" . $indfile;
313
+                 $removetmpfile = $this->filesystem->unlink($tempfile);
314
+        }
315
+
316
+        // Upload the new file
317
+        $fileContent = file_get_contents($_FILES['uploadfileforsms']['tmp_name']);
318
+        $fileName = $_FILES['uploadfileforsms']['name'];
319
+
320
+        $userroot = $this->view->getRoot();
321
+        $targetfile = $userroot . "/SMS_Relentless/multiple_recipients/" . $fileName;
322
+
323
+        $target = $this->folder->newFile($targetfile);
324
+        $target->putContent($fileContent);
325
+
326
+        // Extract the phone numbers from the file
327
+        $numberarraysec = str_replace(array(";", "|", "\r\n", "\r", "\n", "\t"), ",", $fileContent);
328
+        $numberarraytert = preg_replace("/[^0-9,]/", "", $numberarraysec);
329
+        $numberarrayfourth = explode(",", $numberarraytert);
330
+        $numberarrayfifth = array_filter(array_map('trim', $numberarrayfourth));
331
+        $numberarray = array_unique($numberarrayfifth);
332
+
333
+        return $numberarray;
334
+    }
335
+
336
+
337
+    /**
338
+     * @NoAdminRequired
339
+     */
340
+    public function uploadfile($uploadfileformms) {
341
+
342
+           $fileContent = file_get_contents($_FILES['uploadfileformms']['tmp_name']);
343
+           $fileName = $_FILES['uploadfileformms']['name'];
344
+           $fileSizeinit = $_FILES['uploadfileformms']['size'];
345
+           $fileSize = $fileSizeinit / 1024;
346
+
347
+           if ($this->folder->nodeExists('SMS_Relentless/temp_files') == false) {
348
+               $this->folder->newFolder('SMS_Relentless/temp_files');
349
+           }
350
+
351
+           $userroot = $this->view->getRoot();
352
+           $targetfile = $userroot . "/SMS_Relentless/temp_files/" . $fileName;
353
+
354
+           $target = $this->folder->newFile($targetfile);
355
+           $target->putContent($fileContent);
356
+
357
+           // Get the cumulative files size of the uploaded files
358
+           $datadir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/';
359
+           $targetdir = $datadir . $this->userId . "/files/SMS_Relentless/temp_files";
360
+
361
+           $fileSystemIterator = new FilesystemIterator($targetdir);
362
+
363
+           $dirfiles = [];
364
+           foreach ($fileSystemIterator as $fileInfo){
365
+                    $dirfiles[] = $fileInfo->getFilename();
366
+           }
367
+
368
+           $totalflsizeinit = 0;
369
+           foreach ($dirfiles as $key => $indfile) {
370
+                    $fileSizeinit = $this->filesystem->filesize($userroot . "/SMS_Relentless/temp_files/" . $indfile);
371
+                    $mbSize = round($fileSizeinit / 1024, 4);
372
+                    $totalflsizeinit += $mbSize;
373
+           }
374
+
375
+           $totalflsize = round($totalflsizeinit, 4);
376
+
377
+           return $totalflsize;
378
+    }
379
+
380
+
381
+    /**
382
+     * @NoAdminRequired
383
+     */
384
+    public function pickfile($path) {
385
+
386
+           if ($this->folder->nodeExists('SMS_Relentless/temp_files') == false) {
387
+               $this->folder->newFolder('SMS_Relentless/temp_files');
388
+           }
389
+
390
+           $datadir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/';
391
+
392
+           $fltgt = $datadir . $this->userId . "/files" . $path;
393
+
394
+           $fileContent = file_get_contents($fltgt);
395
+
396
+           $pkfilesize = round(filesize($fltgt) / 1024, 4);
397
+
398
+           $patharr = explode("/", $path);
399
+
400
+           $revarr = array_reverse($patharr);
401
+
402
+           $relflpath = "/SMS_Relentless/temp_files/" . $revarr[0]; 
403
+
404
+           $target = $this->folder->newFile($relflpath);
405
+
406
+           $target->putContent($fileContent);
407
+
408
+           // Get the cumulative files size of the uploaded files
409
+           $targetdir = $datadir . $this->userId . "/files/SMS_Relentless/temp_files";
410
+
411
+           $fileSystemIterator = new FilesystemIterator($targetdir);
412
+
413
+           $dirfiles = [];
414
+           foreach ($fileSystemIterator as $fileInfo) {
415
+                    $dirfiles[] = $fileInfo->getFilename();
416
+           }
417
+
418
+           $totalflsizeinit = 0;
419
+
420
+           foreach ($dirfiles as $key => $indfile) {
421
+
422
+                    $fileSizeinit = $this->filesystem->filesize("/SMS_Relentless/temp_files/" . $indfile);
423
+                    $mbSize = round($fileSizeinit / 1024, 4);
424
+                    $totalflsizeinit += $mbSize;
425
+           }
426
+
427
+           $totalflsize = round($totalflsizeinit, 4);
428
+
429
+           $pickresult = [$totalflsize, $pkfilesize];
430
+
431
+           return $pickresult;
432
+    }
433
+
434
+
435
+    /**
436
+     * @NoAdminRequired
437
+     */
438
+    public function removeupfile($removedfilename) {
439
+
440
+           $tmpfl = "/" . $this->userId . "/files/SMS_Relentless/temp_files/" . $removedfilename;
441
+
442
+           $removefile = $this->view->unlink($tmpfl);
443
+
444
+           // Get the cumulative files size of the uploaded files
445
+           $datadir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/';
446
+           $targetdir = $datadir . $this->userId . "/files/SMS_Relentless/temp_files";
447
+           $fileSystemIterator = new FilesystemIterator($targetdir);
448
+
449
+           $dirfiles = [];
450
+           foreach ($fileSystemIterator as $fileInfo){
451
+                    $dirfiles[] = $fileInfo->getFilename();
452
+           }
453
+
454
+           $totalflsizeinit = 0;
455
+
456
+           foreach ($dirfiles as $key => $indfile) {
457
+                    $fileSizeinit = $this->filesystem->filesize("/SMS_Relentless/temp_files/" . $indfile);
458
+                    $mbSize = round($fileSizeinit / 1024, 4);
459
+                    $totalflsizeinit += $mbSize;
460
+           }
461
+
462
+           $totalflsize = round($totalflsizeinit, 4);
463
+
464
+           return $totalflsize;
465
+    }
466
+
467
+
468
+    /**
469
+     * @NoAdminRequired
470
+     */
471
+    public function sendsmstel($userId, $receiversPhoneNbs, $fromsender, $waitinterval, $sentsmstext, $ismms, $mmsfiles) {
472
+
473
+         $telsmsapicred = $this->service->getapicredentials($this->userId);
474
+         $telnyxkey = $telsmsapicred[0];
475
+         $teldelrecurl = $telsmsapicred[3];
476
+         $messagingprofid = $telsmsapicred[4];
477
+         $addDisplName = $telsmsapicred[24];
478
+
479
+         // Get the Display Name of the current user
480
+         $crtuser = $this->userManager->get($this->userId);
481
+         $displayname = $crtuser->getDisplayName();
482
+
483
+         if ($addDisplName == 1) {
484
+             $sentsmstext = $displayname . ": " . $sentsmstext;
485
+         }
486
+
487
+         \Telnyx\Telnyx::setApiKey($telnyxkey);
488
+
489
+         $microinterval = $waitinterval * 1000;
490
+
491
+         foreach ($receiversPhoneNbs as $keytel => $tonumber) {
492
+
493
+             usleep($microinterval);
494
+
495
+             $messagedate = date("Y-m-d H:i:s");
496
+
497
+             if ($ismms == 0) {
498
+
499
+                 if (preg_match('/[A-Za-z]+/', $fromsender)) {
500
+                     $message = \Telnyx\Message::Create(["from" => $fromsender, "to" => $tonumber, "text" => $sentsmstext, "webhook_url" => $teldelrecurl, "messaging_profile_id" => $messagingprofid]);
501
+                 } else {
502
+                     $message = \Telnyx\Message::Create(["from" => $fromsender, "to" => $tonumber, "text" => $sentsmstext, "webhook_url" => $teldelrecurl]);
503
+                 }
504
+
505
+                 $messagetexttel = $sentsmstext;
506
+
507
+             } else {
508
+
509
+                 $mediaURLarr = [];
510
+                 $includedMediaFiles = '';
511
+
512
+                 for ($p = 0; $p < count($mmsfiles); $p++ ) {
513
+
514
+                      $userroot = $this->view->getRoot();
515
+                      $filetoshare = $userroot . "/SMS_Relentless/temp_files/".$mmsfiles[$p]."";
516
+
517
+                      $flsharetarget = $this->folder->newFile($filetoshare);
518
+
519
+	              $share = $this->shareManager->newShare();
520
+	              $share->setNode($flsharetarget);
521
+	              $share->setPermissions(Constants::PERMISSION_READ);
522
+	              $share->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK);
523
+	              $share->setSharedBy($this->userId);
524
+                      $expirydate = DateTime::createFromFormat('Y-m-d H:i:s', $messagedate);
525
+                      $expirydate->add(new \DateInterval('P1D'));
526
+                      $share->setExpirationDate($expirydate);
527
+                      $shared = $this->shareManager->createShare($share);
528
+                      $shareToken = $shared->getToken();
529
+
530
+                      $hostnm = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'];
531
+
532
+                      $mediaURLarr[] = $hostnm . "/s/" . $shareToken . "/download/" . $mmsfiles[$p];
533
+
534
+                      $includedMediaFiles .= "<div id='mmsTblUrl-" . mt_rand(1, 10000) . "' class='mmstblUrls' title='Download this file only if you trust the sender and the domain of the URL.'>" . $hostnm . "/s/" . $shareToken . "/download/" . $mmsfiles[$p] . "</div><br><br>";
535
+                 }
536
+
537
+                 if (preg_match('/[A-Za-z]+/', $fromsender)) {
538
+                     $message = \Telnyx\Message::Create(["from" => $fromsender, "to" => $tonumber, "text" => $sentsmstext, "webhook_url" => $teldelrecurl, "messaging_profile_id" => $messagingprofid, "subject" => "MMS", "media_urls" => $mediaURLarr]);
539
+                 } else {
540
+                     $message = \Telnyx\Message::Create(["from" => $fromsender, "to" => $tonumber, "text" => $sentsmstext, "webhook_url" => $teldelrecurl, "subject" => "MMS", "media_urls" => $mediaURLarr]);
541
+                 }
542
+
543
+                 $messagetexttel = $sentsmstext . "<br><br><br>--- File(s) included in MMS ---<br><br>" . $includedMediaFiles;
544
+             }
545
+
546
+             if ($message) {
547
+                 if (isset($message['id'])) { $messageid = $message['id']; } else { $messageid = $this->createMessageId(); }
548
+             } else { $messageid = $this->createMessageId(); }
549
+
550
+//             $messageid = $message['id'];
551
+             $messagefrom = "Telnyx: " . $fromsender;
552
+             $messageto = $tonumber;
553
+             $messagenetwork = null;
554
+             $messageprice = null;
555
+             $messagestatus = $message['to'][0]['status'];
556
+             $messagedelivery = null;
557
+
558
+             $sentmessagearr = [$messageid, $messagedate, $messagefrom, $messageto, $messagenetwork, $messageprice, $messagestatus, $messagedelivery, $messagetexttel];
559
+
560
+             $this->service->insertsentsms($this->userId, $displayname, $sentmessagearr);
561
+         }
562
+         return $displayname;
563
+    }
564
+
565
+
566
+    /**
567
+     * @NoAdminRequired
568
+     */
569
+    public function sendsmsnex($userId, $receiversPhoneNbs, $fromsender, $waitinterval, $sentsmstext, $ismms, $mmsfiles) {
570
+
571
+         $plsmsapicred = $this->service->getapicredentials($this->userId);
572
+
573
+         $smsapikey = $plsmsapicred[5];
574
+         $smsapisecret = $plsmsapicred[6];
575
+         $smsapideliveryrecurl = $plsmsapicred[8];
576
+         $addDisplName = $plsmsapicred[24];
577
+
578
+         // Get the Display Name of the current user
579
+         $crtuser = $this->userManager->get($this->userId);
580
+         $displayname = $crtuser->getDisplayName();
581
+
582
+         if ($addDisplName == 1) {
583
+             $sentsmstext = $displayname . ": " . $sentsmstext;
584
+         }
585
+
586
+         $microinterval = $waitinterval * 1000;
587
+
588
+         foreach ($receiversPhoneNbs as $keynex => $tonumber) {
589
+
590
+             usleep($microinterval);
591
+
592
+             $messagedatepl = date("Y-m-d H:i:s");
593
+
594
+             if ($ismms == 0) {
595
+
596
+                 $client = new RestClient($smsapikey, $smsapisecret);
597
+                 $response = $client->messages->create($fromsender,[$tonumber],$sentsmstext,["url" => $smsapideliveryrecurl]);
598
+                 $messagetextpl = $sentsmstext;
599
+	         $messageidinit = $response->getmessageUuid(0);
600
+                 $messageid = $messageidinit[0];
601
+
602
+                 if (property_exists($response, 'error')) { 
603
+                     $messagestatus = "Error: " . $response->error;
604
+                 } else { $messagestatus = 'The message has been accepted for delivery.'; }
605
+
606
+             } else {
607
+
608
+                 $mediaURLarr = [];
609
+                 $includedMediaFiles = '';
610
+
611
+                 for ($p = 0; $p < count($mmsfiles); $p++ ) {
612
+
613
+                      $userroot = $this->view->getRoot();
614
+                      $filetoshare = $userroot . "/SMS_Relentless/temp_files/".$mmsfiles[$p]."";
615
+
616
+                      $flsharetarget = $this->folder->newFile($filetoshare);
617
+
618
+	              $share = $this->shareManager->newShare();
619
+	              $share->setNode($flsharetarget);
620
+	              $share->setPermissions(Constants::PERMISSION_READ);
621
+	              $share->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK);
622
+	              $share->setSharedBy($this->userId);
623
+                      $expirydate = DateTime::createFromFormat('Y-m-d H:i:s', $messagedatepl);
624
+                      $expirydate->add(new \DateInterval('P1D'));
625
+                      $share->setExpirationDate($expirydate);
626
+                      $shared = $this->shareManager->createShare($share);
627
+                      $shareToken = $shared->getToken();
628
+
629
+                      $hostnm = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'];
630
+
631
+                      $mediaURLarr[] = $hostnm . "/s/" . $shareToken . "/download/" . $mmsfiles[$p];
632
+
633
+                      $includedMediaFiles .= "<div id='mmsTblUrl-" . mt_rand(1, 10000) . "' class='mmstblUrls' title='Download this file only if you trust the sender and the domain of the URL.'>" . $hostnm . "/s/" . $shareToken . "/download/" . $mmsfiles[$p] . "</div><br><br>";
634
+                 }
635
+
636
+		 $datatosendpl = ["src" => $fromsender, "dst" => $tonumber, "text" => $sentsmstext, "url" => $smsapideliveryrecurl, "type" => "mms", "media_urls" => $mediaURLarr];
637
+		 $postedparamspl = json_encode($datatosendpl);
638
+
639
+		 $chpl = curl_init();
640
+		 curl_setopt($chpl, CURLOPT_URL, 'https://'.$smsapikey.':'.$smsapisecret.'@api.plivo.com/v1/Account/'.$smsapikey.'/Message/');
641
+		 curl_setopt($chpl, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
642
+		 curl_setopt($chpl, CURLOPT_TIMEOUT, 300);
643
+		 curl_setopt($chpl, CURLOPT_RETURNTRANSFER, 1);
644
+		 curl_setopt($chpl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
645
+		 curl_setopt($chpl, CURLOPT_POST, 1);
646
+		 curl_setopt($chpl, CURLOPT_POSTFIELDS, $postedparamspl);
647
+		 $resultpl = curl_exec ($chpl);
648
+		 $statusCodepl = curl_getinfo($chpl, CURLINFO_HTTP_CODE);
649
+		 curl_close ($chpl);
650
+
651
+		 $decresultpl = json_decode($resultpl);
652
+
653
+                 if ($decresultpl) {
654
+                     if (property_exists($decresultpl, 'message_uuid')) {
655
+                         $messageidinit = $decresultpl->message_uuid;
656
+                         $messageid = $messageidinit[0];
657
+                     } else { $messageid = $this->createMessageId(); }
658
+                 } else { $messageid = $this->createMessageId(); }
659
+
660
+	         if (in_array($statusCodepl, [200, 201, 202, 203, 204, 205, 206])) {
661
+
662
+                     if (property_exists($decresultpl, 'error')) {
663
+                         $messagestatus = "Error: " . $decresultpl->error;
664
+                     } else { $messagestatus = 'The message has been accepted for delivery.'; }
665
+
666
+                 } else { $messagestatus = 'An error occurred while trying to send the message.'; }
667
+
668
+                 $messagetextpl = $sentsmstext . "<br><br><br>--- File(s) included in MMS ---<br><br>" . $includedMediaFiles;
669
+             }
670
+
671
+             if (preg_match('/[A-Za-z]+/', $fromsender)) {
672
+                 $messagefrom = "Plivo: " . $fromsender;
673
+             } else { $messagefrom = "Plivo: +" . $fromsender; }
674
+
675
+             $messageto = $tonumber;
676
+             $messagenetwork = '';
677
+             $messageprice = '';
678
+
679
+             $messagedelivery = '';
680
+
681
+             $sentmessagearr = [$messageid, $messagedatepl, $messagefrom, $messageto, $messagenetwork, $messageprice, $messagestatus, $messagedelivery, $messagetextpl];
682
+
683
+             $this->service->insertsentsms($this->userId, $displayname, $sentmessagearr);
684
+         }
685
+         return $displayname;
686
+    }
687
+
688
+
689
+    /**
690
+     * @NoAdminRequired
691
+     */
692
+    public function sendsmstwil($userId, $receiversPhoneNbs, $fromsender, $waitinterval, $sentsmstext, $ismms, $mmsfiles) {
693
+
694
+         $twsmsapicred = $this->service->getapicredentials($this->userId);
695
+
696
+         $sid = $twsmsapicred[15];
697
+         $token = $twsmsapicred[16];
698
+         $smsapirecurltw = $twsmsapicred[18];
699
+         $addDisplName = $twsmsapicred[24];
700
+
701
+         // Get the Display Name of the current user
702
+         $crtuser = $this->userManager->get($this->userId);
703
+         $displayname = $crtuser->getDisplayName();
704
+
705
+         if ($addDisplName == 1) {
706
+             $sentsmstext = $displayname . ": " . $sentsmstext;
707
+         }
708
+
709
+         $microinterval = $waitinterval * 1000;
710
+
711
+         foreach ($receiversPhoneNbs as $keytwil => $tonumbertw) {
712
+
713
+             usleep($microinterval);
714
+
715
+             $messagedatetw = date("Y-m-d H:i:s");
716
+
717
+             if ($ismms == 0) {
718
+
719
+                 $datatoposttw = [["To" => $tonumbertw, "From" => $fromsender, "Body" => $sentsmstext, "StatusCallback" => $smsapirecurltw]];
720
+                 $sentsmstextfintw = $sentsmstext;
721
+
722
+             } else {
723
+
724
+                 $mediaURLs = [];
725
+                 $includedMediaFiles = '';
726
+
727
+                 for ($p = 0; $p < count($mmsfiles); $p++ ) {
728
+
729
+                      $userroot = $this->view->getRoot();
730
+                      $filetoshare = $userroot . "/SMS_Relentless/temp_files/".$mmsfiles[$p]."";
731
+
732
+                      $flsharetarget = $this->folder->newFile($filetoshare);
733
+
734
+	              $share = $this->shareManager->newShare();
735
+	              $share->setNode($flsharetarget);
736
+	              $share->setPermissions(Constants::PERMISSION_READ);
737
+	              $share->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK);
738
+	              $share->setSharedBy($this->userId);
739
+                      $expirydate = DateTime::createFromFormat('Y-m-d H:i:s', $messagedatetw);
740
+                      $expirydate->add(new \DateInterval('P1D'));
741
+                      $share->setExpirationDate($expirydate);
742
+                      $shared = $this->shareManager->createShare($share);
743
+                      $shareToken = $shared->getToken();
744
+
745
+                      $hostnm = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'];
746
+
747
+                      $mediaURLs[] = $hostnm . "/s/" . $shareToken . "/download/" . $mmsfiles[$p];
748
+
749
+                      $includedMediaFiles .= "<div id='mmsTblUrl-" . mt_rand(1, 10000) . "' class='mmstblUrls' title='Download this file only if you trust the sender and the domain of the URL.'>" . $hostnm . "/s/" . $shareToken . "/download/" . $mmsfiles[$p] . "</div><br><br>";
750
+                 }
751
+
752
+                 $datatoposttw = [["To" => $tonumbertw, "From" => $fromsender, "Body" => $sentsmstext, "StatusCallback" => $smsapirecurltw]];
753
+
754
+                 for ($m = 0; $m < count($mediaURLs); $m++) {
755
+                      array_push($datatoposttw, ["MediaUrl" => $mediaURLs[$m]]);
756
+                 }
757
+
758
+                 $sentsmstextfintw = $sentsmstext . "<br><br><br>--- File(s) included in MMS ---<br><br>" . $includedMediaFiles;
759
+             }
760
+
761
+             $postedsendingfl = implode('&', array_map('http_build_query', $datatoposttw));
762
+
763
+	     $chtw = curl_init();
764
+	     curl_setopt($chtw, CURLOPT_URL, 'https://api.twilio.com/2010-04-01/Accounts/'.$sid.'/Messages.json');
765
+	     curl_setopt($chtw, CURLOPT_TIMEOUT, 300);
766
+	     curl_setopt($chtw, CURLOPT_RETURNTRANSFER, 1);
767
+	     curl_setopt($chtw, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
768
+             curl_setopt($chtw, CURLOPT_USERPWD, "$sid:$token");
769
+	     curl_setopt($chtw, CURLOPT_POST, 1);
770
+             curl_setopt($chtw, CURLOPT_POSTFIELDS, $postedsendingfl);
771
+
772
+	     $resulttw = curl_exec ($chtw);
773
+	     $statusCodetw = curl_getinfo($chtw, CURLINFO_HTTP_CODE);
774
+	     curl_close ($chtw);
775
+
776
+             $decresulttw = json_decode($resulttw);
777
+
778
+             if ($decresulttw) {
779
+                 if (property_exists($decresulttw, 'sid')) { $messageidtw = $decresulttw->sid; } else { $messageidtw = $this->createMessageId(); }
780
+             } else { $messageidtw = $this->createMessageId(); }
781
+
782
+	     if (in_array($statusCodetw, [200, 201, 202, 203, 204, 205, 206])) {
783
+                 $messagestatustw = 'The message has been accepted for delivery.';
784
+             } else {
785
+                 $messagestatustw = 'An error occurred while trying to send the message.';
786
+             }
787
+
788
+             if (preg_match('/[A-Za-z]+/', $fromsender)) {
789
+                 $messagefromtw = "Twilio: " . $fromsender;
790
+             } else { $messagefromtw = "Twilio: " . $fromsender; }
791
+
792
+             $messagenetworktw = '';
793
+             $messagepricetw = '';
794
+             $messagedeliverytw = '';
795
+
796
+             $sentmessagearr = [$messageidtw, $messagedatetw, $messagefromtw, $tonumbertw, $messagenetworktw, $messagepricetw, $messagestatustw, $messagedeliverytw, $sentsmstextfintw];
797
+
798
+             $this->service->insertsentsms($this->userId, $displayname, $sentmessagearr);
799
+         }
800
+         return $displayname;
801
+    }
802
+
803
+
804
+    /**
805
+     * @NoAdminRequired
806
+     */
807
+    public function sendsmsflow($userId, $receiversPhoneNbs, $fromsender, $waitinterval, $sentsmstext, $ismms, $mmsfiles) {
808
+
809
+         $flsmsapicred = $this->service->getapicredentials($this->userId);
810
+
811
+         $flowapikey = $flsmsapicred[20];
812
+         $flowapisecret = $flsmsapicred[21];
813
+         $flowdelrecurl = $flsmsapicred[23];
814
+         $addDisplName = $flsmsapicred[24];
815
+
816
+         // Get the Display Name of the current user
817
+         $crtuser = $this->userManager->get($this->userId);
818
+         $displayname = $crtuser->getDisplayName();
819
+
820
+         if ($addDisplName == 1) {
821
+             $sentsmstext = $displayname . ": " . $sentsmstext;
822
+         }
823
+
824
+         $sentsmstextproc = str_replace('"','\\"', $sentsmstext);
825
+
826
+         $microinterval = $waitinterval * 1000;
827
+
828
+         foreach ($receiversPhoneNbs as $keyflow => $tonumberfl) {
829
+
830
+             usleep($microinterval);
831
+
832
+             $messagedatefl = date("Y-m-d H:i:s");
833
+
834
+             if ($ismms == 0) {
835
+
836
+                 $messagetextfinfl = $sentsmstext;
837
+                 $postedparamsfl = json_encode(["to" => $tonumberfl, "from" => $fromsender, "body" => $sentsmstextproc, "dlr_callback" => $flowdelrecurl]);
838
+
839
+             } else {
840
+
841
+		 $mediaurlsarr = [];
842
+		 $includedMediaFiles = '';
843
+
844
+		 for ($p = 0; $p < count($mmsfiles); $p++ ) {
845
+
846
+		      $userroot = $this->view->getRoot();
847
+		      $filetoshare = $userroot . "/SMS_Relentless/temp_files/".$mmsfiles[$p]."";
848
+
849
+		      $flsharetarget = $this->folder->newFile($filetoshare);
850
+
851
+		      $share = $this->shareManager->newShare();
852
+		      $share->setNode($flsharetarget);
853
+		      $share->setPermissions(Constants::PERMISSION_READ);
854
+		      $share->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK);
855
+		      $share->setSharedBy($this->userId);
856
+                      $expirydate = DateTime::createFromFormat('Y-m-d H:i:s', $messagedatefl);
857
+                      $expirydate->add(new \DateInterval('P1D'));
858
+                      $share->setExpirationDate($expirydate);
859
+		      $shared = $this->shareManager->createShare($share);
860
+		      $shareToken = $shared->getToken();
861
+
862
+                      $hostnm = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'];
863
+
864
+		      $mediaurlsarr[] = $hostnm . "/s/" . $shareToken . "/download/" . $mmsfiles[$p];
865
+
866
+                      $includedMediaFiles .= "<div id='mmsTblUrl-" . mt_rand(1, 10000) . "' class='mmstblUrls' title='Download this file only if you trust the sender and the domain of the URL.'>" . $hostnm . "/s/" . $shareToken . "/download/" . $mmsfiles[$p] . "</div><br><br>";
867
+		 }
868
+
869
+                 $messagetextfinfl = $sentsmstext . "<br><br><br>--- File(s) included in MMS ---<br><br>" . $includedMediaFiles;
870
+
871
+                 $postedparamsfl = json_encode(["to" => $tonumberfl, "from" => $fromsender, "body" => $sentsmstextproc, "dlr_callback" => $flowdelrecurl, "media_urls" => $mediaurlsarr]);
872
+             }
873
+
874
+	     $chfl = curl_init();
875
+	     curl_setopt($chfl, CURLOPT_URL, 'https://'.$flowapikey.':'.$flowapisecret.'@api.flowroute.com/v2.1/messages');
876
+	     curl_setopt($chfl, CURLOPT_HTTPHEADER, array("Content-Type: application/vnd.api+json"));
877
+	     curl_setopt($chfl, CURLOPT_TIMEOUT, 300);
878
+	     curl_setopt($chfl, CURLOPT_RETURNTRANSFER, 1);
879
+	     curl_setopt($chfl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
880
+	     curl_setopt($chfl, CURLOPT_POST, 1);
881
+             curl_setopt($chfl, CURLOPT_POSTFIELDS, $postedparamsfl);
882
+	     $resultfl = curl_exec ($chfl);
883
+	     $statusCode = curl_getinfo($chfl, CURLINFO_HTTP_CODE);
884
+	     curl_close ($chfl);
885
+
886
+             $decresultfl = json_decode($resultfl);
887
+
888
+             if ($decresultfl) {
889
+                 if (property_exists($decresultfl, 'data')) { 
890
+                     $messageidfl = $decresultfl->data->id;
891
+                 } else { $messageidfl = $this->createMessageId(); }
892
+             } else { $messageidfl = $this->createMessageId(); }
893
+
894
+	     if (in_array($statusCode, [200, 201, 202, 203, 204, 205, 206])) {
895
+                 $messagestatusfl = 'The message has been accepted for delivery.'; 
896
+             } else { 
897
+                 $messagestatusfl = 'An error occurred while trying to send the message.'; 
898
+             }
899
+
900
+             if (preg_match('/[A-Za-z]+/', $fromsender)) {
901
+                 $messagefromfl = "Flowroute: " . $fromsender;
902
+             } else { $messagefromfl = "Flowroute: " . $fromsender; }
903
+
904
+             $messagetofl = $tonumberfl;
905
+             $messagenetworkfl = '';
906
+             $messagepricefl = '';
907
+             $messagedeliveryfl = '';
908
+
909
+             $sentmessagearr = [$messageidfl, $messagedatefl, $messagefromfl, $messagetofl, $messagenetworkfl, $messagepricefl, $messagestatusfl, $messagedeliveryfl, $messagetextfinfl];
910
+
911
+             $this->service->insertsentsms($this->userId, $displayname, $sentmessagearr);
912
+         }
913
+         return $displayname;
914
+    }
915
+
916
+
917
+    /**
918
+     * @NoAdminRequired
919
+     */
920
+    public function saveoldrecrows($userId, $oldrecRows) {
921
+
922
+           // Create the folder for removed messages if it doesn't exist
923
+           if ($this->folder->nodeExists('SMS_Relentless/removed_received_messages') == false) {
924
+               $this->folder->newFolder('SMS_Relentless/removed_received_messages');
925
+           }
926
+           $savecheck = 0;
927
+
928
+           if (count($oldrecRows) > 1) {
929
+               $msfileContent = implode("", $oldrecRows);
930
+
931
+               $delrowsdate = date("Y-m-d_H-i-s");
932
+               $msfileName = "Received_Messages_Deleted_On_" . $delrowsdate . ".csv";
933
+
934
+               $userroot = $this->view->getRoot();
935
+               $targetfile = $userroot . "/SMS_Relentless/removed_received_messages/" . $msfileName;
936
+
937
+               $target = $this->folder->newFile($targetfile);
938
+               $target->putContent($msfileContent);
939
+
940
+               if ($this->filesystem->file_get_contents($targetfile) != '') {
941
+                   $savecheck = 1;
942
+               }
943
+           }
944
+
945
+           return $savecheck;
946
+    }
947
+
948
+
949
+    /**
950
+     * @NoAdminRequired
951
+     */
952
+    public function saveoldsentrows($userId, $oldsentRows) {
953
+
954
+           // Create the folder for removed messages if it doesn't exist
955
+           if ($this->folder->nodeExists('SMS_Relentless/removed_sent_messages') == false) {
956
+               $this->folder->newFolder('SMS_Relentless/removed_sent_messages');
957
+           }
958
+           $savesentcheck = 0;
959
+
960
+           if (count($oldsentRows) > 1) {
961
+               $sntfileContent = implode("", $oldsentRows);
962
+
963
+               $delsentrowsdate = date("Y-m-d_H-i-s");
964
+               $sntfileName = "Sent_Messages_Deleted_On_" . $delsentrowsdate . ".csv";
965
+
966
+               $userroot = $this->view->getRoot();
967
+               $snttargetfile = $userroot . "/SMS_Relentless/removed_sent_messages/" . $sntfileName;
968
+
969
+               $snttarget = $this->folder->newFile($snttargetfile);
970
+               $snttarget->putContent($sntfileContent);
971
+
972
+               if ($this->filesystem->file_get_contents($snttargetfile) != '') {
973
+                   $savesentcheck = 1;
974
+               }
975
+           }
976
+
977
+           return $savesentcheck;
978
+    }
979
+
980
+
981
+    /**
982
+     * @NoAdminRequired
983
+     */
984
+    public function getreceivedtable($userId) {
985
+           return $this->service->getreceivedtable($this->userId);
986
+    }
987
+
988
+    /**
989
+     * @NoAdminRequired
990
+     */
991
+    public function getreceivedtablefordel($userId) {
992
+           return $this->service->getreceivedtablefordel($this->userId);
993
+    }
994
+
995
+    /**
996
+     * @NoAdminRequired
997
+     */
998
+    public function removerecrows($userId, $recmessagedbIDs) {
999
+
1000
+           // Get the Display Name of the current user
1001
+           $crtuserdel = $this->userManager->get($this->userId);
1002
+           $userDelDspName = $crtuserdel->getDisplayName();
1003
+
1004
+           return $this->service->removerecrows($this->userId, $userDelDspName, $recmessagedbIDs);
1005
+    }
1006
+
1007
+    /**
1008
+     * @NoAdminRequired
1009
+     */
1010
+    public function getsenttable($userId) {
1011
+           return $this->service->getsenttable($this->userId);
1012
+    }
1013
+
1014
+    /**
1015
+     * @NoAdminRequired
1016
+     */
1017
+    public function getsenttablefordel($userId) {
1018
+           return $this->service->getsenttablefordel($this->userId);
1019
+    }
1020
+
1021
+    /**
1022
+     * @NoAdminRequired
1023
+     */
1024
+    public function removesentrows($userId, $sentmessagedbIDs) {
1025
+
1026
+           // Get the Display Name of the current user
1027
+           $crtuserstdel = $this->userManager->get($this->userId);
1028
+           $userstDelDspName = $crtuserstdel->getDisplayName();
1029
+
1030
+           return $this->service->removesentrows($this->userId, $userstDelDspName, $sentmessagedbIDs);
1031
+    }
1032
+
1033
+    /**
1034
+     * @NoAdminRequired
1035
+     */
1036
+    public function getconversations($userId) {
1037
+           return $this->service->getconversations($this->userId);
1038
+    }
1039
+
1040
+    /**
1041
+     * @NoAdminRequired
1042
+     */
1043
+    public function archiveconv($userId, $conversationId) {
1044
+
1045
+           // Get the Display Name of the current user
1046
+           $crtusergt = $this->userManager->get($this->userId);
1047
+           $userDspNameArch = $crtusergt->getDisplayName();
1048
+
1049
+           return $this->service->archiveconv($this->userId, $userDspNameArch, $conversationId);
1050
+    }
1051
+
1052
+    /**
1053
+     * @NoAdminRequired
1054
+     */
1055
+    public function unarchiveconv($userId, $conversationId) {
1056
+
1057
+           // Get the Display Name of the current user
1058
+           $crtusergtun = $this->userManager->get($this->userId);
1059
+           $userDspNameUnarch = $crtusergtun->getDisplayName();
1060
+
1061
+           return $this->service->unarchiveconv($this->userId, $userDspNameUnarch, $conversationId);
1062
+    }
1063
+
1064
+    /**
1065
+     * @NoAdminRequired
1066
+     */
1067
+    public function saveconvdescription($userId, $convDescription, $convId) {
1068
+
1069
+           // Get the Display Name of the current user
1070
+           $crtuserdesc = $this->userManager->get($this->userId);
1071
+           $userDspNameDesc = $crtuserdesc->getDisplayName();
1072
+
1073
+           return $this->service->saveconvdescription($this->userId, $userDspNameDesc, $convDescription, $convId);
1074
+    }
1075
+
1076
+    /**
1077
+     * @NoAdminRequired
1078
+     */
1079
+    public function saveconvtag($userId, $convTag, $convId) {
1080
+
1081
+           // Get the Display Name of the current user
1082
+           $crtusertag = $this->userManager->get($this->userId);
1083
+           $userDspNameTag = $crtusertag->getDisplayName();
1084
+
1085
+           return $this->service->saveconvtag($this->userId, $userDspNameTag, $convTag, $convId);
1086
+    }
1087
+
1088
+    /**
1089
+     * @NoAdminRequired
1090
+     */
1091
+    public function saveconvflag($userId, $convFlag, $convId) {
1092
+
1093
+           // Get the Display Name of the current user
1094
+           $crtuserflag = $this->userManager->get($this->userId);
1095
+           $userDspNameFlag = $crtuserflag->getDisplayName();
1096
+
1097
+           return $this->service->saveconvflag($this->userId, $userDspNameFlag, $convFlag, $convId);
1098
+    }
1099
+
1100
+    /**
1101
+     * @NoAdminRequired
1102
+     */
1103
+    public function removeconvmsgs($userId, $conversationId) {
1104
+           return $this->service->removeconvmsgs($this->userId, $conversationId);
1105
+    }
1106
+
1107
+    /**
1108
+     * @NoAdminRequired
1109
+     */
1110
+    public function getgroupedtable($userId) {
1111
+           return $this->service->getgroupedtable($this->userId);
1112
+    }
1113
+
1114
+    /**
1115
+     * @NoAdminRequired
1116
+     */
1117
+    public function savedisplayname($userId, $authorDisplayname, $from) {
1118
+           return $this->service->savedisplayname($this->userId, $authorDisplayname, $from);
1119
+    }
1120
+
1121
+    /**
1122
+     * @NoAdminRequired
1123
+     */
1124
+    public function getmsgsperpgnewmsgarchnb($userId) {
1125
+           return $this->service->getmsgsperpgnewmsgarchnb($this->userId);
1126
+    }
1127
+
1128
+    /**
1129
+     * @NoAdminRequired
1130
+     */
1131
+    public function getnewmsgindicator($userId) {
1132
+           return $this->service->getnewmsgindicator($this->userId);
1133
+    }
1134
+
1135
+    /**
1136
+     * @NoAdminRequired
1137
+     */
1138
+    public function getdelrecsettings($userId) {
1139
+           return $this->service->getdelrecsettings($this->userId);
1140
+    }
1141
+
1142
+    public function updatenumberrestrictions($userId, $savedByDsplname, $phoneNumber, $groups, $users) {
1143
+           return $this->service->updatenumberrestrictions($this->userId, $savedByDsplname, $phoneNumber, $groups, $users);
1144
+    }
1145
+
1146
+    public function updatekeysallowedusers($userId, $groups, $users, $groupsdel, $usersdel, $provider) {
1147
+           return $this->service->updatekeysallowedusers($this->userId, $groups, $users, $groupsdel, $usersdel, $provider);
1148
+    }
1149
+
1150
+    public function removenumberrestrictions($userId, $phoneNumber) {
1151
+           return $this->service->removenumberrestrictions($this->userId, $phoneNumber);
1152
+    }
1153
+
1154
+    /**
1155
+     * @NoAdminRequired
1156
+     */
1157
+    public function updateautoreplies($userId, $savedByDsplname, $phoneNumber, $daysOfWeek, $dailyStart, $dailyEnd, $vacationStart, $vacationEnd, $messageText) {
1158
+           return $this->service->updateautoreplies($this->userId, $savedByDsplname, $phoneNumber, $daysOfWeek, $dailyStart, $dailyEnd, $vacationStart, $vacationEnd, $messageText);
1159
+    }
1160
+
1161
+    /**
1162
+     * @NoAdminRequired
1163
+     */
1164
+    public function removeautoreplies($userId, $phoneNumber) {
1165
+           return $this->service->removeautoreplies($this->userId, $phoneNumber);
1166
+    }
1167
+
1168
+    /**
1169
+     * @NoAdminRequired
1170
+     */
1171
+    public function getsettings($userId) {
1172
+           return $this->service->getsettings($this->userId);
1173
+    }
1174
+
1175
+    public function getadminsettings($userId) {
1176
+           return $this->service->getadminsettings($this->userId);
1177
+    }
1178
+
1179
+    /**
1180
+     * @NoAdminRequired
1181
+     */
1182
+    public function getautoreplyconf($userId) {
1183
+
1184
+           // Get the available phone numbers for the current user (the restricted phone numbers are excluded)
1185
+           $availphonenmbrs = $this->getsmsnumbers($this->userId);
1186
+
1187
+           // Get the display name of the current user
1188
+           $usrid = $this->userId;
1189
+           $getusrdnm = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `uid` = ? AND `name` = ?');
1190
+	   $getusrdnmres = $getusrdnm->execute([$usrid, 'displayname']);
1191
+	   $getusrdnmdata = $getusrdnmres->fetch();
1192
+	   $userDisplayNm = $getusrdnmdata['value'];
1193
+	   $getusrdnmres->closeCursor();
1194
+
1195
+           // Get the auto-replies for the available phone numbers
1196
+           $getautorpl = $this->connection->prepare('SELECT `saved_by_dsplname`, `phone_number`, `days_of_week`, `daily_start`, `daily_end`, `vacation_start`, `vacation_end`, 
1197
+                                                    `message_text` FROM `*PREFIX*sms_relent_autorply`');
1198
+	   $getautorplres = $getautorpl->execute();
1199
+           $autorplconf = [];
1200
+	   while ($acdatausrdnadm = $getautorplres->fetch()) {
1201
+                  $autorplconf[] = $acdatausrdnadm;
1202
+           }
1203
+	   $getautorplres->closeCursor();
1204
+
1205
+           if ($autorplconf) {
1206
+
1207
+               $autoreplyconf = [];
1208
+               foreach ($autorplconf as $arkey => $arvalue) {
1209
+                        if (in_array($arvalue['phone_number'], $availphonenmbrs)) {
1210
+                            $autoreplyconf[] = $arvalue;
1211
+                        }
1212
+               }
1213
+
1214
+           } else { $autoreplyconf = ''; }
1215
+
1216
+           $autoreplyfdb = ['userdisplayname' => $userDisplayNm, 'phonenumbers' => $availphonenmbrs, 'autoreplies' => $autoreplyconf];
1217
+
1218
+           return $autoreplyfdb;
1219
+    }
1220
+
1221
+    /**
1222
+     * @NoAdminRequired
1223
+     */
1224
+    public function getgroupedpernumber($userId, $phoneNumber) {
1225
+           return $this->service->getgroupedpernumber($this->userId, $phoneNumber);
1226
+    }
1227
+
1228
+    /**
1229
+     * @NoAdminRequired
1230
+     */
1231
+    public function getgroupedforreply($userId, $phoneNmbrFrom, $phoneNmbrTo) {
1232
+           return $this->service->getgroupedforreply($this->userId, $phoneNmbrFrom, $phoneNmbrTo);
1233
+    }
1234
+
1235
+    /**
1236
+     * @NoAdminRequired
1237
+     */
1238
+    public function updatesettings($userId, $telapiUrlRec, $telapiUrl, $nexapiUrlRec, $nexapiUrl, $twilapiUrlRec, $twilapiUrl, $flowapiUrlRec, $flowapiUrl, $messagesperpage, $getNotify, $notificationEmail, $getsmsinemail, $showDisplayNames, $addDisplayNames, $msgCheckInterval, $archivedConvNmbr) {
1239
+           return $this->service->updatesettings($this->userId, $telapiUrlRec, $telapiUrl, $nexapiUrlRec, $nexapiUrl, $twilapiUrlRec, $twilapiUrl, $flowapiUrlRec, $flowapiUrl, $messagesperpage, $getNotify, $notificationEmail, $getsmsinemail, $showDisplayNames, $addDisplayNames, $msgCheckInterval, $archivedConvNmbr);
1240
+    }
1241
+
1242
+    public function updateadminsettings($userId, $telapiKey, $telPubKey, $telapiUrlRec, $telapiUrl, $messagingProfileId, $nexapiKey, $nexapiSecret, $nexapiUrlRec, $nexapiUrl, $telSenderName, $nexSenderName, $twilapiKey, $twilapiSecret, $twilapiUrlRec, $twilapiUrl, $twilSenderName, $flowapiKey, $flowapiSecret, $flowapiUrlRec, $flowapiUrl, $showAllMessages) {
1243
+           return $this->service->updateadminsettings($this->userId, $telapiKey, $telPubKey, $telapiUrlRec, $telapiUrl, $messagingProfileId, $nexapiKey, $nexapiSecret, $nexapiUrlRec, $nexapiUrl, $telSenderName, $nexSenderName, $twilapiKey, $twilapiSecret, $twilapiUrlRec, $twilapiUrl, $twilSenderName, $flowapiKey, $flowapiSecret, $flowapiUrlRec, $flowapiUrl, $showAllMessages);
1244
+    }
1245
+
1246
+    public function updatepersadmnsettings($userId, $messagesperpage, $getNotify, $notificationEmail, $getsmsinemail, $showDisplayNames, $addDisplayNames, $msgCheckInterval, $archivedConvNmbr) {
1247
+           return $this->service->updatepersadmnsettings($this->userId, $messagesperpage, $getNotify, $notificationEmail, $getsmsinemail, $showDisplayNames, $addDisplayNames, $msgCheckInterval, $archivedConvNmbr);
1248
+    }
1249
+}
0 1250
new file mode 100644
... ...
@@ -0,0 +1,599 @@
1
+<?php
2
+/**
3
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
4
+ *
5
+ * @author Double Bastion LLC
6
+ *
7
+ * @license GNU AGPL version 3 or any later version
8
+ *
9
+ * This program is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
11
+ * License as published by the Free Software Foundation; either
12
+ * version 3 of the License, or any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
18
+ *
19
+ * You should have received a copy of the GNU Affero General Public
20
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
23
+
24
+declare(strict_types=1);
25
+
26
+namespace OCA\SMSRelentless\Migration;
27
+
28
+use Closure;
29
+use OCP\DB\Types;
30
+use OCP\DB\ISchemaWrapper;
31
+use OCP\IDBConnection;
32
+use OCP\Migration\IOutput;
33
+use OCP\Migration\SimpleMigrationStep;
34
+
35
+
36
+class Version135Date20240420221527 extends SimpleMigrationStep {
37
+
38
+        /** @var IDBConnection */
39
+        private $connection;
40
+
41
+        /**
42
+         * @param IDBConnection $connection
43
+         */
44
+        public function __construct(IDBConnection $connection) {
45
+                $this->connection = $connection;
46
+        }
47
+
48
+	/**
49
+	 * @param IOutput $output
50
+	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
51
+	 * @param array $options
52
+	 * @return null|ISchemaWrapper
53
+	 */
54
+	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
55
+		/** @var ISchemaWrapper $schema */
56
+		$schema = $schemaClosure();
57
+
58
+		if (!$schema->hasTable('sms_relent_settings')) {
59
+			$table = $schema->createTable('sms_relent_settings');
60
+			$table->addColumn('id', Types::BIGINT, [
61
+				'autoincrement' => true,
62
+				'notnull' => true,
63
+                                'length' => 11,
64
+                                'unsigned' => true,
65
+			]);
66
+			$table->addColumn('user_id', Types::STRING, [
67
+				'notnull' => true,
68
+				'length' => 128,
69
+			]);
70
+			$table->addColumn('telapi_key', Types::STRING, [
71
+				'notnull' => true,
72
+				'length' => 512,
73
+			]);
74
+			$table->addColumn('tel_pub_key', Types::STRING, [
75
+				'notnull' => true,
76
+				'length' => 512,
77
+			]);
78
+			$table->addColumn('telapi_url_rec', Types::STRING, [
79
+				'notnull' => true,
80
+				'length' => 512,
81
+			]);
82
+			$table->addColumn('telapi_url', Types::STRING, [
83
+				'notnull' => true,
84
+				'length' => 512,
85
+			]);
86
+			$table->addColumn('messaging_profile_id', Types::STRING, [
87
+				'notnull' => true,
88
+				'length' => 512,
89
+			]);
90
+			$table->addColumn('nexapi_key', Types::STRING, [
91
+				'notnull' => true,
92
+				'length' => 512,
93
+			]);
94
+			$table->addColumn('nexapi_secret', Types::STRING, [
95
+				'notnull' => true,
96
+				'length' => 512,
97
+			]);
98
+			$table->addColumn('nexapi_url_rec', Types::STRING, [
99
+				'notnull' => true,
100
+				'length' => 512,
101
+			]);
102
+			$table->addColumn('nexapi_url', Types::STRING, [
103
+				'notnull' => true,
104
+				'length' => 512,
105
+			]);
106
+			$table->addColumn('twilapi_key', Types::STRING, [
107
+				'notnull' => true,
108
+				'length' => 512,
109
+			]);
110
+			$table->addColumn('twilapi_secret', Types::STRING, [
111
+				'notnull' => true,
112
+				'length' => 512,
113
+			]);
114
+			$table->addColumn('twilapi_url_rec', Types::STRING, [
115
+				'notnull' => true,
116
+				'length' => 512,
117
+			]);
118
+			$table->addColumn('twilapi_url', Types::STRING, [
119
+				'notnull' => true,
120
+				'length' => 512,
121
+			]);
122
+			$table->addColumn('flowapi_key', Types::STRING, [
123
+				'notnull' => true,
124
+				'length' => 512,
125
+			]);
126
+			$table->addColumn('flowapi_secret', Types::STRING, [
127
+				'notnull' => true,
128
+				'length' => 512,
129
+			]);
130
+			$table->addColumn('flowapi_url_rec', Types::STRING, [
131
+				'notnull' => true,
132
+				'length' => 512,
133
+			]);
134
+			$table->addColumn('flowapi_url', Types::STRING, [
135
+				'notnull' => true,
136
+				'length' => 512,
137
+			]);
138
+			$table->addColumn('tel_sender_name', Types::STRING, [
139
+				'notnull' => false,
140
+				'length' => 48,
141
+				'default' => '',
142
+			]);
143
+			$table->addColumn('nex_sender_name', Types::STRING, [
144
+				'notnull' => false,
145
+				'length' => 48,
146
+				'default' => '',
147
+			]);
148
+			$table->addColumn('twil_sender_name', Types::STRING, [
149
+				'notnull' => false,
150
+				'length' => 48,
151
+				'default' => '',
152
+			]);
153
+			$table->addColumn('flow_sender_name', Types::STRING, [
154
+				'notnull' => false,
155
+				'length' => 48,
156
+				'default' => '',
157
+			]);
158
+			$table->addColumn('messagesperpage', Types::INTEGER, [
159
+				'notnull' => false,
160
+				'length' => 10,
161
+                                'unsigned' => true,
162
+			]);
163
+			$table->addColumn('get_notify', Types::SMALLINT, [
164
+				'notnull' => false,
165
+				'length' => 1,
166
+			]);
167
+			$table->addColumn('notification_email', Types::STRING, [
168
+				'notnull' => false,
169
+				'length' => 512,
170
+				'default' => '',
171
+			]);
172
+			$table->addColumn('getsmsinemail', Types::SMALLINT, [
173
+				'notnull' => false,
174
+				'length' => 1,
175
+			]);
176
+			$table->addColumn('show_all_messages', Types::SMALLINT, [
177
+				'notnull' => false,
178
+				'length' => 1,
179
+			]);
180
+			$table->addColumn('show_display_names', Types::SMALLINT, [
181
+				'notnull' => false,
182
+				'length' => 1,
183
+			]);
184
+			$table->addColumn('add_display_names', Types::SMALLINT, [
185
+				'notnull' => false,
186
+				'length' => 1,
187
+			]);
188
+			$table->addColumn('available_numbers', Types::TEXT, [
189
+				'notnull' => false,
190
+                                'default' => '',
191
+			]);
192
+			$table->addColumn('msg_check_interval', Types::INTEGER, [
193
+				'notnull' => false,
194
+				'length' => 10,
195
+                                'unsigned' => true,
196
+			]);
197
+			$table->addColumn('new_message_rcd', Types::SMALLINT, [
198
+				'notnull' => false,
199
+				'length' => 1,
200
+			]);
201
+			$table->addColumn('archived_conv_nmbr', Types::INTEGER, [
202
+				'notnull' => false,
203
+				'length' => 10,
204
+                                'unsigned' => true,
205
+			]);
206
+                        $table->setPrimaryKey(['id']);
207
+                        $table->addUniqueIndex(['id']);
208
+
209
+		}
210
+
211
+
212
+		if (!$schema->hasTable('sms_relent_received')) {
213
+			$table = $schema->createTable('sms_relent_received');
214
+			$table->addColumn('id', Types::BIGINT, [
215
+				'autoincrement' => true,
216
+				'notnull' => true,
217
+                                'length' => 11,
218
+                                'unsigned' => true,
219
+			]);
220
+			$table->addColumn('user_id', Types::STRING, [
221
+				'notnull' => true,
222
+				'length' => 64,
223
+			]);
224
+			$table->addColumn('message_id', Types::STRING, [
225
+				'notnull' => true,
226
+				'length' => 512,
227
+			]);
228
+			$table->addColumn('date', Types::DATETIME, [
229
+				'notnull' => true,
230
+			]);
231
+			$table->addColumn('from', Types::STRING, [
232
+				'notnull' => true,
233
+				'length' => 128,
234
+			]);
235
+			$table->addColumn('to', Types::STRING, [
236
+				'notnull' => true,
237
+				'length' => 128,
238
+			]);
239
+			$table->addColumn('message', Types::TEXT, [
240
+				'notnull' => false,
241
+				'default' => '',
242
+			]);
243
+			$table->addColumn('author_displayname', Types::STRING, [
244
+				'notnull' => true,
245
+				'length' => 255,
246
+			]);
247
+			$table->addColumn('internal_sender', Types::SMALLINT, [
248
+				'notnull' => false,
249
+				'length' => 1,
250
+			]);
251
+			$table->addColumn('conversation_id', Types::STRING, [
252
+				'notnull' => false,
253
+				'length' => 255,
254
+			]);
255
+                        $table->setPrimaryKey(['id']);
256
+                        $table->addUniqueIndex(['id']);
257
+
258
+		}
259
+
260
+
261
+		if (!$schema->hasTable('sms_relent_sent')) {
262
+			$table = $schema->createTable('sms_relent_sent');
263
+			$table->addColumn('id', Types::BIGINT, [
264
+				'autoincrement' => true,
265
+				'notnull' => true,
266
+                                'length' => 11,
267
+                                'unsigned' => true,
268
+			]);
269
+			$table->addColumn('user_id', Types::STRING, [
270
+				'notnull' => true,
271
+				'length' => 64,
272
+			]);
273
+			$table->addColumn('message_id', Types::STRING, [
274
+				'notnull' => true,
275
+				'length' => 512,
276
+			]);
277
+			$table->addColumn('date', Types::DATETIME, [
278
+				'notnull' => true,
279
+			]);
280
+			$table->addColumn('from', Types::STRING, [
281
+				'notnull' => true,
282
+				'length' => 128,
283
+			]);
284
+			$table->addColumn('to', Types::STRING, [
285
+				'notnull' => true,
286
+				'length' => 128,
287
+			]);
288
+			$table->addColumn('network ', Types::STRING, [
289
+				'notnull' => false,
290
+				'length' => 64,
291
+				'default' => '',
292
+			]);
293
+			$table->addColumn('price', Types::STRING, [
294
+				'notnull' => false,
295
+				'length' => 64,
296
+				'default' => '',
297
+			]);
298
+			$table->addColumn('status', Types::STRING, [
299
+				'notnull' => false,
300
+				'length' => 512,
301
+				'default' => '',
302
+			]);
303
+			$table->addColumn('deliveryreceipt', Types::STRING, [
304
+				'notnull' => false,
305
+				'length' => 64,
306
+				'default' => '',
307
+			]);
308
+			$table->addColumn('message', Types::TEXT, [
309
+				'notnull' => false,
310
+                                'default' => '',
311
+			]);
312
+			$table->addColumn('author_displayname', Types::STRING, [
313
+				'notnull' => true,
314
+				'length' => 255,
315
+			]);
316
+			$table->addColumn('conversation_id', Types::STRING, [
317
+				'notnull' => false,
318
+				'length' => 255,
319
+			]);
320
+                        $table->setPrimaryKey(['id']);
321
+                        $table->addUniqueIndex(['id']);
322
+
323
+		}
324
+
325
+
326
+		if (!$schema->hasTable('sms_relent_autorply')) {
327
+			$table = $schema->createTable('sms_relent_autorply');
328
+			$table->addColumn('id', Types::BIGINT, [
329
+				'autoincrement' => true,
330
+				'notnull' => true,
331
+                                'length' => 11,
332
+                                'unsigned' => true,
333
+			]);
334
+			$table->addColumn('user_id', Types::STRING, [
335
+				'notnull' => true,
336
+				'length' => 128,
337
+			]);
338
+			$table->addColumn('saved_by_dsplname', Types::STRING, [
339
+				'notnull' => true,
340
+				'length' => 255,
341
+			]);
342
+			$table->addColumn('phone_number', Types::STRING, [
343
+				'notnull' => true,
344
+				'length' => 128,
345
+			]);
346
+			$table->addColumn('days_of_week', Types::STRING, [
347
+				'notnull' => false,
348
+				'length' => 64,
349
+                                'default' => '',
350
+			]);
351
+			$table->addColumn('daily_start', Types::STRING, [
352
+				'notnull' => false,
353
+				'length' => 8,
354
+                                'default' => '',
355
+			]);
356
+			$table->addColumn('daily_end', Types::STRING, [
357
+				'notnull' => false,
358
+				'length' => 8,
359
+                                'default' => '',
360
+			]);
361
+			$table->addColumn('vacation_start', Types::DATETIME, [
362
+				'notnull' => false,
363
+			]);
364
+			$table->addColumn('vacation_end', Types::DATETIME, [
365
+				'notnull' => false,
366
+			]);
367
+			$table->addColumn('message_text', Types::TEXT, [
368
+				'notnull' => false,
369
+                                'default' => '',
370
+			]);
371
+                        $table->setPrimaryKey(['id']);
372
+                        $table->addUniqueIndex(['id']);
373
+		}
374
+
375
+
376
+		if (!$schema->hasTable('sms_relent_restrict')) {
377
+			$table = $schema->createTable('sms_relent_restrict');
378
+			$table->addColumn('id', Types::BIGINT, [
379
+				'autoincrement' => true,
380
+				'notnull' => true,
381
+                                'length' => 11,
382
+                                'unsigned' => true,
383
+			]);
384
+			$table->addColumn('user_id', Types::STRING, [
385
+				'notnull' => true,
386
+				'length' => 128,
387
+			]);
388
+			$table->addColumn('saved_by_dsplname', Types::STRING, [
389
+				'notnull' => true,
390
+				'length' => 255,
391
+			]);
392
+			$table->addColumn('phone_number', Types::STRING, [
393
+				'notnull' => true,
394
+				'length' => 128,
395
+			]);
396
+			$table->addColumn('groups', Types::STRING, [
397
+				'notnull' => true,
398
+				'length' => 2048,
399
+			]);
400
+			$table->addColumn('users', Types::STRING, [
401
+				'notnull' => true,
402
+				'length' => 2048,
403
+			]);
404
+                        $table->setPrimaryKey(['id']);
405
+                        $table->addUniqueIndex(['id']);
406
+		}
407
+
408
+
409
+		if (!$schema->hasTable('sms_relent_subac')) {
410
+			$table = $schema->createTable('sms_relent_subac');
411
+			$table->addColumn('id', Types::BIGINT, [
412
+				'autoincrement' => true,
413
+				'notnull' => true,
414
+                                'length' => 11,
415
+                                'unsigned' => true,
416
+			]);
417
+			$table->addColumn('user_id', Types::STRING, [
418
+				'notnull' => true,
419
+				'length' => 128,
420
+			]);
421
+			$table->addColumn('tnx_groups_allowed', Types::TEXT, [
422
+				'notnull' => false,
423
+                                'default' => '',
424
+			]);
425
+			$table->addColumn('tnx_users_allowed', Types::TEXT, [
426
+				'notnull' => false,
427
+                                'default' => '',
428
+			]);
429
+			$table->addColumn('plv_groups_allowed', Types::TEXT, [
430
+				'notnull' => false,
431
+                                'default' => '',
432
+			]);
433
+			$table->addColumn('plv_users_allowed', Types::TEXT, [
434
+				'notnull' => false,
435
+                                'default' => '',
436
+			]);
437
+			$table->addColumn('twl_groups_allowed', Types::TEXT, [
438
+				'notnull' => false,
439
+                                'default' => '',
440
+			]);
441
+			$table->addColumn('twl_users_allowed', Types::TEXT, [
442
+				'notnull' => false,
443
+                                'default' => '',
444
+			]);
445
+			$table->addColumn('flr_groups_allowed', Types::TEXT, [
446
+				'notnull' => false,
447
+                                'default' => '',
448
+			]);
449
+			$table->addColumn('flr_users_allowed', Types::TEXT, [
450
+				'notnull' => false,
451
+                                'default' => '',
452
+			]);
453
+                        $table->setPrimaryKey(['id']);
454
+                        $table->addUniqueIndex(['id']);
455
+
456
+		} else {
457
+
458
+                        $table = $schema->getTable('sms_relent_subac');
459
+
460
+			$table->addColumn('tnx_groups_del', Types::SMALLINT, [
461
+				'notnull' => false,
462
+				'length' => 1,
463
+			]);
464
+			$table->addColumn('tnx_users_del', Types::SMALLINT, [
465
+				'notnull' => false,
466
+				'length' => 1,
467
+			]);
468
+			$table->addColumn('plv_groups_del', Types::SMALLINT, [
469
+				'notnull' => false,
470
+				'length' => 1,
471
+			]);
472
+			$table->addColumn('plv_users_del', Types::SMALLINT, [
473
+				'notnull' => false,
474
+				'length' => 1,
475
+			]);
476
+			$table->addColumn('twl_groups_del', Types::SMALLINT, [
477
+				'notnull' => false,
478
+				'length' => 1,
479
+			]);
480
+			$table->addColumn('twl_users_del', Types::SMALLINT, [
481
+				'notnull' => false,
482
+				'length' => 1,
483
+			]);
484
+			$table->addColumn('flr_groups_del', Types::SMALLINT, [
485
+				'notnull' => false,
486
+				'length' => 1,
487
+			]);
488
+			$table->addColumn('flr_users_del', Types::SMALLINT, [
489
+				'notnull' => false,
490
+				'length' => 1,
491
+			]);
492
+                }
493
+
494
+
495
+		if (!$schema->hasTable('sms_relent_conv')) {
496
+			$table = $schema->createTable('sms_relent_conv');
497
+			$table->addColumn('id', Types::BIGINT, [
498
+				'autoincrement' => true,
499
+				'notnull' => true,
500
+                                'length' => 11,
501
+                                'unsigned' => true,
502
+			]);
503
+			$table->addColumn('conversation_id', Types::STRING, [
504
+				'notnull' => false,
505
+				'length' => 255,
506
+			]);
507
+			$table->addColumn('archived', Types::SMALLINT, [
508
+				'notnull' => false,
509
+				'length' => 1,
510
+			]);
511
+			$table->addColumn('last_archived', Types::DATETIME, [
512
+				'notnull' => false,
513
+			]);
514
+			$table->addColumn('last_unarchived', Types::DATETIME, [
515
+				'notnull' => false,
516
+			]);
517
+			$table->addColumn('archived_by', Types::STRING, [
518
+				'notnull' => false,
519
+				'length' => 128,
520
+			]);
521
+			$table->addColumn('unarchived_by', Types::STRING, [
522
+				'notnull' => false,
523
+				'length' => 128,
524
+			]);
525
+			$table->addColumn('last_msg_date', Types::DATETIME, [
526
+				'notnull' => true,
527
+			]);
528
+			$table->addColumn('last_msg_from', Types::STRING, [
529
+				'notnull' => true,
530
+				'length' => 128,
531
+			]);
532
+			$table->addColumn('last_msg_to', Types::STRING, [
533
+				'notnull' => true,
534
+				'length' => 128,
535
+			]);
536
+			$table->addColumn('last_message', Types::TEXT, [
537
+				'notnull' => false,
538
+				'default' => '',
539
+			]);
540
+			$table->addColumn('lastmsgdisplayname', Types::STRING, [
541
+				'notnull' => true,
542
+				'length' => 255,
543
+			]);
544
+			$table->addColumn('flagged', Types::SMALLINT, [
545
+				'notnull' => false,
546
+				'length' => 1,
547
+			]);
548
+			$table->addColumn('flagunflagby', Types::STRING, [
549
+				'notnull' => false,
550
+				'length' => 128,
551
+			]);
552
+			$table->addColumn('flagunflagdate', Types::DATETIME, [
553
+				'notnull' => false,
554
+			]);
555
+			$table->addColumn('tag', Types::STRING, [
556
+				'notnull' => false,
557
+				'length' => 100,
558
+			]);
559
+			$table->addColumn('taguntagby', Types::STRING, [
560
+				'notnull' => false,
561
+				'length' => 128,
562
+			]);
563
+			$table->addColumn('taguntagdate', Types::DATETIME, [
564
+				'notnull' => false,
565
+			]);
566
+			$table->addColumn('description', Types::TEXT, [
567
+				'notnull' => false,
568
+                                'default' => '',
569
+			]);
570
+			$table->addColumn('descriptionby', Types::STRING, [
571
+				'notnull' => false,
572
+				'length' => 128,
573
+			]);
574
+			$table->addColumn('descriptiondate', Types::DATETIME, [
575
+				'notnull' => false,
576
+			]);
577
+			$table->addColumn('lastmsgprovid', Types::STRING, [
578
+				'notnull' => false,
579
+				'length' => 512,
580
+                                'default' => '',
581
+			]);
582
+                        $table->setPrimaryKey(['id']);
583
+                        $table->addUniqueIndex(['id']);
584
+
585
+		} else {
586
+
587
+                        $table = $schema->getTable('sms_relent_conv');
588
+
589
+			$table->addColumn('lastmsgprovid', Types::STRING, [
590
+				'notnull' => false,
591
+				'length' => 512,
592
+                                'default' => '',
593
+			]);
594
+               }
595
+
596
+		return $schema;
597
+	}
598
+
599
+}
0 600
new file mode 100644
... ...
@@ -0,0 +1,5800 @@
1
+<?php
2
+/**
3
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
4
+ *
5
+ * @author Double Bastion LLC
6
+ *
7
+ * @license GNU AGPL version 3 or any later version
8
+ *
9
+ * This program is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
11
+ * License as published by the Free Software Foundation; either
12
+ * version 3 of the License, or any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
18
+ *
19
+ * You should have received a copy of the GNU Affero General Public
20
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
23
+
24
+declare(strict_types=1);
25
+
26
+namespace OCA\SMSRelentless\Service;
27
+
28
+use OCP\IDBConnection;
29
+use OCP\Security\ICrypto;
30
+use OCP\AppFramework\ApiController;
31
+use OCP\AppFramework\Controller;
32
+use OCP\IRequest;
33
+use OCP\IGroupManager;
34
+use \ReflectionClass;
35
+
36
+class SmsrelentlessService {
37
+
38
+     private $connection;
39
+     private $crypto;
40
+     private $groupManager;
41
+
42
+     public function __construct(IDBConnection $connection, ICrypto $crypto, IGroupManager $groupManager) {
43
+
44
+                $this->connection = $connection;
45
+                $this->crypto = $crypto;
46
+                $this->groupManager = $groupManager;
47
+     }
48
+
49
+
50
+     /**
51
+      * @NoAdminRequired
52
+      *
53
+      */
54
+     public function insertrecsms($userId, $recmessagearr) {
55
+
56
+            $authorDisplayNm = '';
57
+            $internalSender = 0;
58
+
59
+            // Search for the associated Display Name in the previous messages sent from the same phone number, in the 'sms_relent_sent' table
60
+            $recmsgfromprc = '%' . $recmessagearr[2];
61
+            $getdspnmst = $this->connection->prepare('SELECT `from`, `author_displayname` FROM `*PREFIX*sms_relent_sent` WHERE `from` LIKE ?');
62
+            $getdspnmstres = $getdspnmst->execute([$recmsgfromprc]);
63
+
64
+            $dispnamearr = [];
65
+            while ($dspnmstfetched = $getdspnmstres->fetch()) {
66
+                   $dispnamearr[] = $dspnmstfetched['author_displayname'];
67
+            }
68
+	    $getdspnmstres->closeCursor();
69
+
70
+            if ($dispnamearr) {
71
+                $descdspnmarr = array_reverse($dispnamearr);
72
+                $authorDisplayNm = $descdspnmarr[0];
73
+                $internalSender = 1;
74
+            } else { $authorDisplayNm = ''; $internalSender = 0; }
75
+
76
+
77
+            if (!$authorDisplayNm) {
78
+
79
+                // Search for the associated Display Name in the previous messages coming from the same phone number, in the 'sms_relent_received' table
80
+                $getdspnm = $this->connection->prepare('SELECT `from`, `author_displayname` FROM `*PREFIX*sms_relent_received` WHERE `from` = ?');
81
+                $getdspnmres = $getdspnm->execute([$recmessagearr[2]]);
82
+
83
+                $dspnmearr = [];
84
+                while ($dspnmfetched = $getdspnmres->fetch()) {
85
+                       if ($dspnmfetched['author_displayname']) {
86
+                           $dspnmearr[] = $dspnmfetched['author_displayname'];
87
+                       }
88
+                }
89
+	        $getdspnmres->closeCursor();
90
+
91
+                if ($dspnmearr) {
92
+                    $descdisplaynmarr = array_reverse($dspnmearr);
93
+                    $authorDisplayNm = $descdisplaynmarr[0];
94
+                    $internalSender = 0;
95
+                } else { $authorDisplayNm = ''; $internalSender = 0; }
96
+            }
97
+
98
+            // Search for the conversation ID in the 'sms_relent_conv' table
99
+            $convExists = 0;
100
+            $archivedConv = 0;
101
+            $tophnumberarr = explode(": ", $recmessagearr[3]);
102
+            $tophnumber = $tophnumberarr[1];
103
+            $getconvid = $this->connection->prepare('SELECT `conversation_id`, `archived`, `last_msg_from`, `last_msg_to` FROM `*PREFIX*sms_relent_conv` WHERE 
104
+                                                   (`last_msg_from` = ? AND `last_msg_to` = ?) OR (`last_msg_from` = ? AND `last_msg_to` = ?)');
105
+            $getconvres = $getconvid->execute([$recmessagearr[2], $tophnumber, $tophnumber, $recmessagearr[2]]);
106
+            $convfetched = $getconvres->fetch();
107
+            $getconvres->closeCursor();
108
+
109
+            if ($convfetched) {
110
+                $conversationId = $convfetched['conversation_id'];
111
+                $convExists = 1;
112
+                $archivedConv = $convfetched['archived'];
113
+            } else {
114
+                // Create a conversation ID
115
+	        $keypassin = substr(sha1((string) mt_rand()), 0, 32);
116
+	        $keysaltin = openssl_random_pseudo_bytes(24);
117
+	        $keyLengthin = 64;
118
+	        $iterationin = 50;
119
+	        $generated_keyin = openssl_pbkdf2($keypassin, $keysaltin, $keyLengthin, $iterationin, 'sha256');
120
+	        $conversationId = bin2hex($generated_keyin);
121
+            }
122
+
123
+
124
+            // Insert the received message in the 'sms_relent_received' table
125
+            $escapedmessagepre = $recmessagearr[4];
126
+            $escapedmessage = nl2br($escapedmessagepre);
127
+
128
+            $sql = $this->connection->prepare('
129
+				INSERT INTO `*PREFIX*sms_relent_received`
130
+					(`user_id`, `message_id`, `date`, `from`, `to`, `message`, `author_displayname`, `internal_sender`, `conversation_id`)
131
+				VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
132
+			  ');
133
+	    $sql->execute([$userId, $recmessagearr[0], $recmessagearr[1], $recmessagearr[2], $recmessagearr[3], $escapedmessage, $authorDisplayNm, $internalSender, $conversationId]);
134
+
135
+
136
+            // Update or insert data in the 'sms_relent_conv' table
137
+            $archivedornot = 0;
138
+            $lastUnarchived = date("Y-m-d H:i:s");
139
+            $lastMsgDate = $lastUnarchived;
140
+            $lastMsgFrom = $recmessagearr[2];
141
+            $lastMsgToArr = explode(": ", $recmessagearr[3]);
142
+            $lastMsgTo = $lastMsgToArr[1];
143
+
144
+            if ($convExists == 1) {
145
+
146
+                if ($archivedConv == 1) {
147
+
148
+	            $sqlupdatecv = $this->connection->prepare('
149
+			        UPDATE `*PREFIX*sms_relent_conv`
150
+			        SET `archived` = ?, `last_unarchived` = ?, `unarchived_by` = ?, `last_msg_date` = ?, `last_msg_from` = ?, `last_msg_to` = ?, `last_message` = ?, 
151
+                                `lastmsgdisplayname` = ?, `lastmsgprovid` = ?
152
+	                        WHERE `conversation_id` = ?');
153
+	            $updatecvRes = $sqlupdatecv->execute([$archivedornot, $lastUnarchived, $authorDisplayNm, $lastMsgDate, $lastMsgFrom, $lastMsgTo, $escapedmessage, $authorDisplayNm, 
154
+                                                          $recmessagearr[0], $conversationId]);
155
+	            $updatecvRes->closeCursor();
156
+
157
+                } else {
158
+
159
+	            $sqlupdatecv = $this->connection->prepare('
160
+			        UPDATE `*PREFIX*sms_relent_conv`
161
+			        SET `archived` = ?, `last_msg_date` = ?, `last_msg_from` = ?, `last_msg_to` = ?, `last_message` = ?, `lastmsgdisplayname` = ?, `lastmsgprovid` = ?
162
+	                        WHERE `conversation_id` = ?');
163
+	            $updatecvRes = $sqlupdatecv->execute([$archivedornot, $lastMsgDate, $lastMsgFrom, $lastMsgTo, $escapedmessage, $authorDisplayNm, $recmessagearr[0], $conversationId]);
164
+	            $updatecvRes->closeCursor();
165
+                }
166
+
167
+            } else {
168
+
169
+                    $sqlinscv = $this->connection->prepare('
170
+				INSERT INTO `*PREFIX*sms_relent_conv`
171
+					(`conversation_id`, `archived`, `last_msg_date`, `last_msg_from`, `last_msg_to`, `last_message`, `lastmsgdisplayname`, `lastmsgprovid`)
172
+				VALUES (?, ?, ?, ?, ?, ?, ?, ?)
173
+			        ');
174
+	            $sqlinscv->execute([$conversationId, $archivedornot, $lastMsgDate, $lastMsgFrom, $lastMsgTo, $escapedmessage, $authorDisplayNm, $recmessagearr[0]]);
175
+            }
176
+
177
+            // Save a 'new message received' indicator in the 'sms_relent_settings' table, for the (admin) user who received the message
178
+            $newMessageRcd = 1;
179
+	    $sqlupdatenm = $this->connection->prepare('
180
+			UPDATE `*PREFIX*sms_relent_settings`
181
+			SET `new_message_rcd` = ?
182
+	                WHERE `user_id` = ?');
183
+	    $updatenmRes = $sqlupdatenm->execute([$newMessageRcd, $userId]);
184
+	    $updatenmRes->closeCursor();
185
+
186
+
187
+            // Save a 'new message received' indicator in the 'sms_relent_settings' table, for the non-admin users with whom the admin receiving the message shared his API keys
188
+
189
+            // Get the groups and users that were allowed access to the API keys
190
+            $getgrps = $this->connection->prepare('SELECT `user_id`, `tnx_groups_allowed`, `tnx_users_allowed`, `plv_groups_allowed`, `plv_users_allowed`,
191
+                                                  `twl_groups_allowed`, `twl_users_allowed`, `flr_groups_allowed`, `flr_users_allowed` FROM `*PREFIX*sms_relent_subac`
192
+                                                   WHERE `user_id` = ?');
193
+            $getgrpsres = $getgrps->execute([$userId]);
194
+            $getgrpsusr = $getgrpsres->fetch();
195
+            $getgrpsres->closeCursor();
196
+
197
+            if ($getgrpsusr) {
198
+
199
+                if ($getgrpsusr['tnx_users_allowed']) { $tnxusers = explode("|", $getgrpsusr['tnx_users_allowed']); } else { $tnxusers = []; }
200
+                if ($getgrpsusr['plv_users_allowed']) { $plvusers = explode("|", $getgrpsusr['plv_users_allowed']); } else { $plvusers = []; }
201
+                if ($getgrpsusr['twl_users_allowed']) { $twlusers = explode("|", $getgrpsusr['twl_users_allowed']); } else { $twlusers = []; }
202
+                if ($getgrpsusr['flr_users_allowed']) { $flrusers = explode("|", $getgrpsusr['flr_users_allowed']); } else { $flrusers = []; }
203
+
204
+                $allwdusersarr = array_merge($tnxusers, $plvusers, $twlusers, $flrusers);
205
+                $allwdusersunq = array_filter(array_unique($allwdusersarr));
206
+
207
+                if ($getgrpsusr['tnx_groups_allowed']) { $tnxgroups = explode("|", $getgrpsusr['tnx_groups_allowed']); } else { $tnxgroups = []; }
208
+                if ($getgrpsusr['plv_groups_allowed']) { $plvgroups = explode("|", $getgrpsusr['plv_groups_allowed']); } else { $plvgroups = []; }
209
+                if ($getgrpsusr['twl_groups_allowed']) { $twlgroups = explode("|", $getgrpsusr['twl_groups_allowed']); } else { $twlgroups = []; }
210
+                if ($getgrpsusr['flr_groups_allowed']) { $flrgroups = explode("|", $getgrpsusr['flr_groups_allowed']); } else { $flrgroups = []; }
211
+
212
+                $allwdgroupsarr = array_merge($tnxgroups, $plvgroups, $twlgroups, $flrgroups);
213
+                $allwdgroupsunq = array_filter(array_unique($allwdgroupsarr));
214
+
215
+            } else {
216
+                $allwdusersunq = [];
217
+                $allwdgroupsunq = [];
218
+            }
219
+
220
+            // Get the username for each Display Name of the allowed users
221
+            $allwdusersfnl = [];
222
+            foreach ($allwdusersunq as $alwdusrkey => $alwdusrvalue) {
223
+
224
+                         $getacdatausrnm = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ? AND `value` = ?');
225
+		         $getacdatausrnmres = $getacdatausrnm->execute(['displayname', $alwdusrvalue]);
226
+		         $acdatausrname = $getacdatausrnmres->fetch();
227
+                         if ($acdatausrname) {
228
+                             $allwdusersfnl[] = $acdatausrname['uid'];
229
+                         }
230
+                         $getacdatausrnmres->closeCursor();
231
+            }
232
+
233
+            // Get the users from all the allowed groups
234
+            $allwdusersgrpmlt = [];
235
+            foreach ($allwdgroupsunq as $prgrpkey => $prgrpvalue) {
236
+
237
+                     // Get all the users that belong to the current group, if the current group is different from 'admin'
238
+                     if ($prgrpvalue != 'admin') {
239
+
240
+                         $getusringroup = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
241
+		         $getusringroupres = $getusringroup->execute([$prgrpvalue]);
242
+
243
+		         while ($getusrname = $getusringroupres->fetch()) {
244
+                                $allwdusersgrpmlt[] = $getusrname['uid'];
245
+                         }
246
+		         $getusringroupres->closeCursor();
247
+                     }
248
+            }
249
+            $allwdusersgrpfnl = array_unique($allwdusersgrpmlt);
250
+            
251
+            $allusr = array_merge($allwdusersfnl, $allwdusersgrpfnl);
252
+            $allusruniquest = array_unique($allusr);
253
+
254
+            foreach ($allusruniquest as $alwdk => $allwdusr) {
255
+		     $newMsgRcd = 1;
256
+		     $sqlupdatenmsc = $this->connection->prepare('
257
+				UPDATE `*PREFIX*sms_relent_settings`
258
+				SET `new_message_rcd` = ?
259
+			        WHERE `user_id` = ?');
260
+		     $updatenmResc = $sqlupdatenmsc->execute([$newMsgRcd, $allwdusr]);
261
+		     $updatenmResc->closeCursor();
262
+            }
263
+     }
264
+
265
+
266
+     /**
267
+      * @NoAdminRequired
268
+      *
269
+      */
270
+     public function insertsentsms($userId, $displayname, $sentmessagearr) {
271
+
272
+//            $msgsentfrompre = explode("+", $sentmessagearr[2]);
273
+//            $msgsentfrom = "+" . $msgsentfrompre[1];
274
+
275
+            // Search for the conversation ID in the 'sms_relent_conv' table
276
+            $convExistssc = 0;
277
+            $archivedConvsc = 0;
278
+            $fromphnumberarr = explode(": ", $sentmessagearr[2]);
279
+            $fromphnumber = $fromphnumberarr[1];
280
+            $getconvidsc = $this->connection->prepare('SELECT `conversation_id`, `archived`, `last_msg_from`, `last_msg_to` FROM `*PREFIX*sms_relent_conv` WHERE 
281
+                                                     (`last_msg_from` = ? AND `last_msg_to` = ?) OR (`last_msg_from` = ? AND `last_msg_to` = ?)');
282
+            $getconvressc = $getconvidsc->execute([$fromphnumber, $sentmessagearr[3], $sentmessagearr[3], $fromphnumber]);
283
+            $convfetchedsc = $getconvressc->fetch();
284
+            $getconvressc->closeCursor();
285
+
286
+            if ($convfetchedsc) {
287
+                $conversationIdsc = $convfetchedsc['conversation_id'];
288
+                $convExistssc = 1;
289
+                $archivedConvsc = $convfetchedsc['archived'];
290
+            } else {
291
+                // Create a conversation ID
292
+	        $keypassinsc = substr(sha1((string) mt_rand()), 0, 32);
293
+	        $keysaltinsc = openssl_random_pseudo_bytes(24);
294
+	        $keyLengthinsc = 64;
295
+	        $iterationinsc = 50;
296
+	        $generated_keyinsc = openssl_pbkdf2($keypassinsc, $keysaltinsc, $keyLengthinsc, $iterationinsc, 'sha256');
297
+	        $conversationIdsc = bin2hex($generated_keyinsc);
298
+            }
299
+
300
+            // Insert the sent message in the 'sms_relent_sent' table
301
+            $textwithnl = nl2br($sentmessagearr[8]);
302
+            $sql = $this->connection->prepare('
303
+				INSERT INTO `*PREFIX*sms_relent_sent`
304
+					(`user_id`, `message_id`, `date`, `from`, `to`, `network`, `price`, `status`, `deliveryreceipt`, `message`, `author_displayname`, `conversation_id`)
305
+				VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
306
+			  ');
307
+	    $sql->execute([$userId, $sentmessagearr[0], $sentmessagearr[1], $sentmessagearr[2], $sentmessagearr[3], $sentmessagearr[4], $sentmessagearr[5], $sentmessagearr[6], 
308
+                           $sentmessagearr[7], $textwithnl, $displayname, $conversationIdsc]);
309
+
310
+
311
+            // Update or insert data in the 'sms_relent_conv' table
312
+            $archivedornotsc = 0;
313
+            $lastUnarchivedsc = date("Y-m-d H:i:s");
314
+            $lastMsgDatesc = $lastUnarchivedsc;
315
+            $lastMsgFromArrsc = explode(": ", $sentmessagearr[2]);
316
+            $lastMsgFromsc = $lastMsgFromArrsc[1];
317
+            $lastMsgTosc = $sentmessagearr[3];
318
+
319
+            if ($convExistssc == 1) {
320
+
321
+                if ($archivedConvsc == 1) {
322
+
323
+	            $sqlupdatecvsc = $this->connection->prepare('
324
+			        UPDATE `*PREFIX*sms_relent_conv`
325
+			        SET `archived` = ?, `last_unarchived` = ?, `unarchived_by` = ?, `last_msg_date` = ?, `last_msg_from` = ?, `last_msg_to` = ?, `last_message` = ?, 
326
+                                `lastmsgdisplayname` = ?, `lastmsgprovid` = ?
327
+	                        WHERE `conversation_id` = ?');
328
+	            $updatecvRessc = $sqlupdatecvsc->execute([$archivedornotsc, $lastUnarchivedsc, $displayname, $lastMsgDatesc, $lastMsgFromsc, $lastMsgTosc, $textwithnl, 
329
+                                                              $displayname, $sentmessagearr[0], $conversationIdsc]);
330
+	            $updatecvRessc->closeCursor();
331
+
332
+                } else {
333
+
334
+	            $sqlupdatecvsc = $this->connection->prepare('
335
+			        UPDATE `*PREFIX*sms_relent_conv`
336
+			        SET `archived` = ?, `last_msg_date` = ?, `last_msg_from` = ?, `last_msg_to` = ?, `last_message` = ?, `lastmsgdisplayname` = ?, `lastmsgprovid` = ?
337
+	                        WHERE `conversation_id` = ?');
338
+	            $updatecvRessc = $sqlupdatecvsc->execute([$archivedornotsc, $lastMsgDatesc, $lastMsgFromsc, $lastMsgTosc, $textwithnl, $displayname, $sentmessagearr[0], 
339
+                                                              $conversationIdsc]);
340
+	            $updatecvRessc->closeCursor();
341
+                }
342
+
343
+            } else {
344
+
345
+                    $sqlinscvsc = $this->connection->prepare('
346
+				INSERT INTO `*PREFIX*sms_relent_conv`
347
+					(`conversation_id`, `archived`, `last_msg_date`, `last_msg_from`, `last_msg_to`, `last_message`, `lastmsgdisplayname`, `lastmsgprovid`)
348
+				VALUES (?, ?, ?, ?, ?, ?, ?, ?)
349
+			        ');
350
+	            $sqlinscvsc->execute([$conversationIdsc, $archivedornotsc, $lastMsgDatesc, $lastMsgFromsc, $lastMsgTosc, $textwithnl, $displayname, $sentmessagearr[0]]);
351
+            }
352
+     }
353
+
354
+
355
+     /**
356
+      * @NoAdminRequired
357
+      *
358
+      */
359
+     public function updatedeliverystatustel($ncuserfortelnyxdel, $messageid, $network, $messageprice, $messagestatus, $deliverystatus) {
360
+
361
+	    $sqlupdateds = $this->connection->prepare('
362
+			UPDATE `*PREFIX*sms_relent_sent`
363
+			SET `price` = ?, `status` = ?, `deliveryreceipt` = ?, `network` = ?
364
+                        WHERE `message_id` = ? AND `user_id` = ? ');
365
+	    $updateRes = $sqlupdateds->execute([$messageprice, $messagestatus, $deliverystatus, $network, $messageid, $ncuserfortelnyxdel]);
366
+	    $updateRes->closeCursor();
367
+     }
368
+
369
+
370
+     /**
371
+      * @NoAdminRequired
372
+      *
373
+      */
374
+     public function updatedeliverystatusnex($ncuserforplivodel, $messageid, $networkcode, $messageprice, $mStatus, $deliverystatus) {
375
+
376
+	    $sqlupdatedspl = $this->connection->prepare('
377
+			UPDATE `*PREFIX*sms_relent_sent`
378
+			SET `price` = ?, `deliveryreceipt` = ?, `status` = ?, `network` = ?
379
+                        WHERE `message_id` = ? AND `user_id` = ? ');
380
+	    $updateResdspl = $sqlupdatedspl->execute([$messageprice, $deliverystatus, $mStatus, $networkcode, $messageid, $ncuserforplivodel]);
381
+	    $updateResdspl->closeCursor();
382
+     }
383
+
384
+
385
+     /**
386
+      * @NoAdminRequired
387
+      *
388
+      */
389
+     public function updatedeliverystatustwil($ncuserfortwildel, $messageid, $networkcode, $messageprice, $mStatus, $deliverystatus) {
390
+
391
+	    $sqlupdatedstw = $this->connection->prepare('
392
+			UPDATE `*PREFIX*sms_relent_sent`
393
+			SET `price` = ?, `deliveryreceipt` = ?, `status` = ?, `network` = ?
394
+                        WHERE `message_id` = ? AND `user_id` = ? ');
395
+	    $updateResdstw = $sqlupdatedstw->execute([$messageprice, $deliverystatus, $mStatus, $networkcode, $messageid, $ncuserfortwildel]);
396
+	    $updateResdstw->closeCursor();
397
+     }
398
+
399
+
400
+     /**
401
+      * @NoAdminRequired
402
+      *
403
+      */
404
+     public function updatedeliverystatusflow($ncuserforflowdel, $messageid, $networkcode, $messageprice, $mStatus, $deliverystatus) {
405
+
406
+	    $sqlupdatedsfl = $this->connection->prepare('
407
+			UPDATE `*PREFIX*sms_relent_sent`
408
+			SET `price` = ?, `deliveryreceipt` = ?, `status` = ?, `network` = ?
409
+                        WHERE `message_id` = ? AND `user_id` = ? ');
410
+	    $updateResdsfl = $sqlupdatedsfl->execute([$messageprice, $deliverystatus, $mStatus, $networkcode, $messageid, $ncuserforflowdel]);
411
+	    $updateResdsfl->closeCursor();
412
+     }
413
+
414
+
415
+     /**
416
+      * @NoAdminRequired
417
+      */
418
+     public function getreceivedtable($userId) {
419
+
420
+        // Get the user's preferences from the settings
421
+        $getgamcheckrc = $this->connection->prepare('
422
+		       SELECT `user_id`, `show_all_messages`, `show_display_names`
423
+		       FROM  `*PREFIX*sms_relent_settings` WHERE `user_id` = ?');
424
+        $getgamcheckrcres = $getgamcheckrc->execute([$userId]);
425
+        $getcrgamsrcpref = $getgamcheckrcres->fetch();
426
+        $crgamsrcpref = $getcrgamsrcpref['show_all_messages'];
427
+        $crdnmsrcpref = $getcrgamsrcpref['show_display_names'];
428
+        $getgamcheckrcres->closeCursor();
429
+
430
+
431
+        // Collect the users with whom the current admin is sharing his API keys and whose messages he will be able to see
432
+        if ($crgamsrcpref == 1 && $this->groupManager->isAdmin($userId)) {
433
+
434
+            // Get the groups and users that were allowed access to the API keys
435
+            $getgrps = $this->connection->prepare('SELECT `user_id`, `tnx_groups_allowed`, `tnx_users_allowed`, `plv_groups_allowed`, `plv_users_allowed`,
436
+                                                  `twl_groups_allowed`, `twl_users_allowed`, `flr_groups_allowed`, `flr_users_allowed` FROM `*PREFIX*sms_relent_subac`
437
+                                                   WHERE `user_id` = ?');
438
+            $getgrpsres = $getgrps->execute([$userId]);
439
+            $getgrpsusr = $getgrpsres->fetch();
440
+            $getgrpsres->closeCursor();
441
+
442
+            if ($getgrpsusr) {
443
+
444
+                if ($getgrpsusr['tnx_users_allowed']) { $tnxusers = explode("|", $getgrpsusr['tnx_users_allowed']); } else { $tnxusers = []; }
445
+                if ($getgrpsusr['plv_users_allowed']) { $plvusers = explode("|", $getgrpsusr['plv_users_allowed']); } else { $plvusers = []; }
446
+                if ($getgrpsusr['twl_users_allowed']) { $twlusers = explode("|", $getgrpsusr['twl_users_allowed']); } else { $twlusers = []; }
447
+                if ($getgrpsusr['flr_users_allowed']) { $flrusers = explode("|", $getgrpsusr['flr_users_allowed']); } else { $flrusers = []; }
448
+
449
+                $allwdusersarr = array_merge($tnxusers, $plvusers, $twlusers, $flrusers);
450
+                $allwdusersunq = array_filter(array_unique($allwdusersarr));
451
+
452
+                if ($getgrpsusr['tnx_groups_allowed']) { $tnxgroups = explode("|", $getgrpsusr['tnx_groups_allowed']); } else { $tnxgroups = []; }
453
+                if ($getgrpsusr['plv_groups_allowed']) { $plvgroups = explode("|", $getgrpsusr['plv_groups_allowed']); } else { $plvgroups = []; }
454
+                if ($getgrpsusr['twl_groups_allowed']) { $twlgroups = explode("|", $getgrpsusr['twl_groups_allowed']); } else { $twlgroups = []; }
455
+                if ($getgrpsusr['flr_groups_allowed']) { $flrgroups = explode("|", $getgrpsusr['flr_groups_allowed']); } else { $flrgroups = []; }
456
+
457
+                $allwdgroupsarr = array_merge($tnxgroups, $plvgroups, $twlgroups, $flrgroups);
458
+                $allwdgroupsunq = array_filter(array_unique($allwdgroupsarr));
459
+
460
+            } else {
461
+                $allwdusersunq = [];
462
+                $allwdgroupsunq = [];
463
+            }
464
+
465
+            // Get the username for each Display Name of the allowed users
466
+            $allwdusersfnl = [];
467
+            foreach ($allwdusersunq as $alwdusrkey => $alwdusrvalue) {
468
+
469
+                         $getacdatausrnm = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ? AND `value` = ?');
470
+		         $getacdatausrnmres = $getacdatausrnm->execute(['displayname', $alwdusrvalue]);
471
+		         $acdatausrname = $getacdatausrnmres->fetch();
472
+                         if ($acdatausrname) {
473
+                             $allwdusersfnl[] = $acdatausrname['uid'];
474
+                         }
475
+                         $getacdatausrnmres->closeCursor();
476
+            }
477
+
478
+            // Get the users from all the allowed groups
479
+            $allwdusersgrpmlt = [];
480
+            foreach ($allwdgroupsunq as $prgrpkey => $prgrpvalue) {
481
+
482
+                     // Get all the users that belong to the current group, if the current group is different from 'admin'
483
+                     if ($prgrpvalue != 'admin') {
484
+                         $getusringroup = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
485
+		         $getusringroupres = $getusringroup->execute([$prgrpvalue]);
486
+
487
+		         while ($getusrname = $getusringroupres->fetch()) {
488
+
489
+                                $allwdusersgrpmlt[] = $getusrname['uid'];
490
+                         }
491
+		         $getusringroupres->closeCursor();
492
+                     }
493
+            }
494
+            $allwdusersgrpfnl = array_unique($allwdusersgrpmlt);
495
+            
496
+            $allusr = array_merge($allwdusersfnl, $allwdusersgrpfnl);
497
+            $allusruniquest = array_unique($allusr);
498
+
499
+            if ($allusruniquest) {
500
+                array_unshift($allusruniquest, $userId);
501
+                $allusruniquerc = $allusruniquest;
502
+            } else { $allusruniquerc = [$userId]; }
503
+
504
+            $procardatarcsec = "'" . implode("','", $allusruniquerc) . "'";
505
+
506
+        }
507
+
508
+        // If the user is an admin and he wants to see his messages and the messages of all the users with whom he shares his API keys
509
+        if ($crgamsrcpref == 1 && $this->groupManager->isAdmin($userId)) {
510
+
511
+            if ($crdnmsrcpref == 1) {
512
+
513
+                $rcresult = $this->connection->executeQuery("
514
+                                   SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `author_displayname`, `internal_sender`
515
+			           FROM `*PREFIX*sms_relent_received` 
516
+                                   WHERE `user_id` IN (" . $procardatarcsec . ")");
517
+
518
+            } else {
519
+
520
+                $rcresult = $this->connection->executeQuery("
521
+			SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `internal_sender`
522
+			FROM `*PREFIX*sms_relent_received` 
523
+                        WHERE `user_id` IN (" . $procardatarcsec . ")");
524
+            }
525
+
526
+        // If the user is an admin and he wants to see only his messages
527
+        } elseif ($crgamsrcpref == 0 && $this->groupManager->isAdmin($userId)) {
528
+
529
+            if ($crdnmsrcpref == 1) {
530
+	        $getrectable = $this->connection->prepare('
531
+			SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `author_displayname`, `internal_sender`
532
+			FROM `*PREFIX*sms_relent_received` 
533
+                        WHERE `user_id` = ?');
534
+	        $rcresult = $getrectable->execute([$userId]);
535
+            } else {
536
+	        $getrectable = $this->connection->prepare('
537
+			SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `internal_sender`
538
+			FROM `*PREFIX*sms_relent_received` 
539
+                        WHERE `user_id` = ?');
540
+	        $rcresult = $getrectable->execute([$userId]);
541
+            }
542
+
543
+        // If the user is not an admin 
544
+        } elseif (!$this->groupManager->isAdmin($userId)) {
545
+
546
+	    // Get the Display Name of the current user
547
+	    $getacdatadn = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `uid` = ? AND `name` = ?');
548
+	    $getacdatadnres = $getacdatadn->execute([$userId, 'displayname']);
549
+	    $acdatausrdnadm = $getacdatadnres->fetch();
550
+	    $cruserdname = $acdatausrdnadm['value'];
551
+	    $getacdatadnres->closeCursor();
552
+
553
+            // Get the groups to which the current user belongs
554
+            $getusrgrp = $this->connection->prepare('
555
+	          SELECT `gid`, `uid`
556
+	          FROM  `*PREFIX*group_user`
557
+                  WHERE `uid` = ?');
558
+            $getusrgrpres = $getusrgrp->execute([$userId]);
559
+
560
+            $usergrps = [];
561
+            while ($fetchedgrps = $getusrgrpres->fetch()) {
562
+                   $usergrps[] = $fetchedgrps['gid'];
563
+            }
564
+            $getusrgrpres->closeCursor();
565
+
566
+            // Get the restrictions from the 'sms_relent_restrict' table
567
+            $getrestr = $this->connection->prepare('
568
+		       SELECT `phone_number`, `groups`, `users`
569
+		       FROM  `*PREFIX*sms_relent_restrict`');
570
+            $getrestrres = $getrestr->execute();
571
+
572
+            $restrdata = [];
573
+            while ($restrfetched = $getrestrres->fetch()) {
574
+                   $restrdata[] = $restrfetched;
575
+            }
576
+            $getrestrres->closeCursor();
577
+
578
+            // Get the phone numbers that the user is allowed/not allowed to use
579
+            if ($restrdata) {
580
+
581
+                $restrPhoneNmbrs = [];
582
+                $allowedPhoneNmbrs = [];
583
+                foreach ($restrdata as $rskey => $rsvalue) {
584
+
585
+                         $chck = 0;
586
+                         $restrgrparr = explode("|", $rsvalue['groups']);
587
+                         foreach ($restrgrparr as $rkey => $rvalue) {
588
+                                  if ($rvalue) {
589
+                                      if (strpos(implode("|", $usergrps), $rvalue) !== false) { $chck++; }
590
+                                  }
591
+                         }
592
+                         if (strpos($rsvalue['users'], $cruserdname) !== false) { $chck++; }
593
+
594
+                         if ($chck == 0) {
595
+                             $restrPhoneNmbrs[] = $rsvalue['phone_number'];
596
+                         }
597
+                }
598
+
599
+		$allowedPhNmbrs = $this->getsmsnumbers($userId);
600
+
601
+		foreach ($allowedPhNmbrs as $apnkey => $apnvalue) {
602
+			 $crphnmbr = explode(": ", $apnvalue);
603
+			 if ($crphnmbr[0] == 'Tx') {
604
+			     $allowedPhoneNmbrs[] = 'Telnyx: ' . $crphnmbr[1];
605
+			 } elseif ($crphnmbr[0] == 'Pl') {
606
+			     $allowedPhoneNmbrs[] = 'Plivo: ' . $crphnmbr[1];
607
+			 } elseif ($crphnmbr[0] == 'Tw') {
608
+			     $allowedPhoneNmbrs[] = 'Twilio: ' . $crphnmbr[1];
609
+			 } elseif ($crphnmbr[0] == 'Fl') {
610
+			     $allowedPhoneNmbrs[] = 'Flowroute: ' . $crphnmbr[1];
611
+			 }
612
+		}
613
+
614
+                $procalwduid = $allowedPhoneNmbrs;
615
+                $procalwduidsec = "'" . implode("','", $procalwduid) . "'";
616
+
617
+                if ($crdnmsrcpref == 1) {
618
+
619
+                    if ($procalwduidsec != "''") {
620
+
621
+                        $rcresult = $this->connection->executeQuery("
622
+			                   SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `author_displayname`, `internal_sender`
623
+			                   FROM `*PREFIX*sms_relent_received`
624
+			                   WHERE `user_id` = '$userId' OR `to` IN (" . $procalwduidsec . ")");
625
+
626
+                    } else {
627
+
628
+	                $getrectable = $this->connection->prepare('
629
+			    SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `author_displayname`, `internal_sender`
630
+			    FROM `*PREFIX*sms_relent_received`
631
+			    WHERE `user_id` = ?');
632
+	                $rcresult = $getrectable->execute([$userId]);
633
+                    }
634
+
635
+                } else {
636
+
637
+                    if ($procalwduidsec) {
638
+
639
+                        $rcresult = $this->connection->executeQuery("
640
+			    SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `internal_sender`
641
+			    FROM `*PREFIX*sms_relent_received`
642
+			    WHERE `user_id` = '$userId' OR `to` IN (" . $procalwduidsec . ")");
643
+                    } else {
644
+	                $getrectable = $this->connection->prepare('
645
+			    SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `internal_sender`
646
+			    FROM `*PREFIX*sms_relent_received`
647
+			    WHERE `user_id` = ?');
648
+	                $rcresult = $getrectable->execute([$userId]);
649
+                    }
650
+                }
651
+
652
+            } else {
653
+
654
+		$allowedPhNmbrs = $this->getsmsnumbers($userId);
655
+
656
+		foreach ($allowedPhNmbrs as $apnkey => $apnvalue) {
657
+			 $crphnmbr = explode(": ", $apnvalue);
658
+			 if ($crphnmbr[0] == 'Tx') {
659
+			     $allowedPhoneNmbrs[] = 'Telnyx: ' . $crphnmbr[1];
660
+			 } elseif ($crphnmbr[0] == 'Pl') {
661
+			     $allowedPhoneNmbrs[] = 'Plivo: ' . $crphnmbr[1];
662
+			 } elseif ($crphnmbr[0] == 'Tw') {
663
+			     $allowedPhoneNmbrs[] = 'Twilio: ' . $crphnmbr[1];
664
+			 } elseif ($crphnmbr[0] == 'Fl') {
665
+			     $allowedPhoneNmbrs[] = 'Flowroute: ' . $crphnmbr[1];
666
+			 }
667
+		}
668
+
669
+                $procalwduid = $allowedPhoneNmbrs;
670
+                $procalwduidsec = "'" . implode("','", $procalwduid) . "'";
671
+
672
+                if ($crdnmsrcpref == 1) {
673
+
674
+                    if ($procalwduidsec != "''") {
675
+
676
+                        $rcresult = $this->connection->executeQuery("
677
+			                   SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `author_displayname`, `internal_sender`
678
+			                   FROM `*PREFIX*sms_relent_received`
679
+			                   WHERE `user_id` = '$userId' OR `to` IN (" . $procalwduidsec . ")");
680
+
681
+                    } else {
682
+
683
+	                $getrectable = $this->connection->prepare('
684
+			    SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `author_displayname`, `internal_sender`
685
+			    FROM `*PREFIX*sms_relent_received`
686
+			    WHERE `user_id` = ?');
687
+	                $rcresult = $getrectable->execute([$userId]);
688
+                    }
689
+
690
+                } else {
691
+
692
+                    if ($procalwduidsec) {
693
+
694
+                        $rcresult = $this->connection->executeQuery("
695
+			    SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `internal_sender`
696
+			    FROM `*PREFIX*sms_relent_received`
697
+			    WHERE `user_id` = '$userId' OR `to` IN (" . $procalwduidsec . ")");
698
+                    } else {
699
+	                $getrectable = $this->connection->prepare('
700
+			    SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `internal_sender`
701
+			    FROM `*PREFIX*sms_relent_received`
702
+			    WHERE `user_id` = ?');
703
+	                $rcresult = $getrectable->execute([$userId]);
704
+                    }
705
+                }
706
+            }
707
+        }
708
+
709
+        $recdatatable = [];
710
+        while ($rowfetched = $rcresult->fetch()) {
711
+               $recdatatable[] = $rowfetched;
712
+        }
713
+	$rcresult->closeCursor();
714
+
715
+        $recdatafromdb = $recdatatable;
716
+
717
+
718
+        if ($this->groupManager->isAdmin($userId)) {
719
+
720
+              $recdatafdb = ['datarows' => $recdatafromdb, 'showdispnm' => $crdnmsrcpref];
721
+              return $recdatafdb;
722
+
723
+        } else {
724
+
725
+            if ($restrdata) {
726
+
727
+                // Clean the 'not allowed' phone numbers from tags
728
+                $restrPhfin = [];
729
+                foreach ($restrPhoneNmbrs as $phkey => $phvalue) {
730
+
731
+                    $restrpharr = explode(": ", $phvalue);
732
+                    $restrPhfin[] = $restrpharr[1];
733
+                }
734
+
735
+                // Assemble the array of message rows that excludes the rows for the 'not allowed' phone numbers
736
+                foreach ($recdatafromdb as $mdkey => $mdvalue) {
737
+
738
+                    if (str_contains($mdvalue['to'], "+")) {
739
+                        $fromnmbrarr = explode("+", $mdvalue['to']);
740
+                        if (in_array("+" . $fromnmbrarr[1], $restrPhfin)) {
741
+                            unset($recdatafromdb[$mdkey]);
742
+                        }
743
+                    } else {
744
+                        $tonmbrarr = explode(": ", $mdvalue['to']);
745
+                        if (count($tonmbrarr) == 2) {
746
+                            $tonmbrtbcmprd = $tonmbrarr[1];
747
+                        } else {
748
+                            $tonmbrtbcmprd = $tonmbrarr[0];
749
+                        }
750
+                        if (in_array($tonmbrtbcmprd, $restrPhfin)) {
751
+                            unset($recdatafromdb[$mdkey]);
752
+                        }
753
+                    }
754
+                }
755
+
756
+                $recdatafdbproc = array_values($recdatafromdb);
757
+
758
+                $recdataproc = ['datarows' => $recdatafdbproc, 'showdispnm' => $crdnmsrcpref];
759
+                return $recdataproc;
760
+
761
+            } else {
762
+
763
+                $recdatafdb = ['datarows' => $recdatafromdb, 'showdispnm' => $crdnmsrcpref];
764
+                return $recdatafdb;
765
+            }
766
+        }
767
+     }
768
+
769
+
770
+     /**
771
+      * @NoAdminRequired
772
+      */
773
+     public function getreceivedtablefordel($userId) {
774
+
775
+        if ($this->groupManager->isAdmin($userId)) {
776
+
777
+            $getrecfordl = $this->connection->prepare('
778
+			SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `message`, `author_displayname`, `internal_sender`
779
+			FROM  `*PREFIX*sms_relent_received`
780
+			WHERE `user_id` = ?');
781
+	    $resultdl = $getrecfordl->execute([$userId]);
782
+
783
+            $recdatatable = [];
784
+            while ($rowfetched = $resultdl->fetch()) {
785
+                   $recdatatable[] = $rowfetched;
786
+            }
787
+            $resultdl->closeCursor();
788
+
789
+            $recdatafromdb = $recdatatable;
790
+
791
+            return $recdatafromdb;
792
+
793
+        } else { return "not permitted"; }
794
+     }
795
+
796
+
797
+     /**
798
+      * @NoAdminRequired
799
+      */
800
+     public function removeMsgFromConv($msgProvId) {
801
+
802
+             // Check if the message that will be deleted is the last message in a conversation
803
+             $chcklstmsg = $this->connection->prepare('SELECT `conversation_id`, `last_msg_date`, `last_msg_from`, `last_msg_to`, `last_message`, `lastmsgdisplayname`, 
804
+                                                      `lastmsgprovid` FROM `*PREFIX*sms_relent_conv` WHERE `lastmsgprovid` = ?');
805
+             $checklstmsgres = $chcklstmsg->execute([$msgProvId]);
806
+             $convlmsgfetched = $checklstmsgres->fetch();
807
+             $checklstmsgres->closeCursor();
808
+
809
+             if ($convlmsgfetched) {
810
+
811
+                 $conversationID = $convlmsgfetched['conversation_id'];
812
+                 $lastmsgFrom = $convlmsgfetched['last_msg_from'];
813
+                 $lastmsgFromLike = "%" . $convlmsgfetched['last_msg_from'];
814
+                 $lastmsgTo = $convlmsgfetched['last_msg_to'];
815
+                 $lastmsgToLike = "%" . $convlmsgfetched['last_msg_to'];
816
+
817
+                 // Check if the conversation contains other messages (in the 'sms_relent_received' table), apart from the last message that will be deleted
818
+	         $getcnvqr = $this->connection->prepare('SELECT `message_id`, `date`, `from`, `to`, `message`, `author_displayname` FROM `*PREFIX*sms_relent_received` WHERE 
819
+	                                               (`from` = ? AND `to` LIKE ?) OR (`from` = ? AND `to` LIKE ?)');
820
+	         $getcnvres = $getcnvqr->execute([$lastmsgFrom, $lastmsgToLike, $lastmsgTo, $lastmsgFromLike]);
821
+
822
+	         $msgexchrec = [];
823
+	         while ($rwsfetched = $getcnvres->fetch()) {
824
+	                $msgexchrec[] = $rwsfetched;
825
+	         }
826
+	         $getcnvres->closeCursor();
827
+
828
+                 // Check if the conversation contains other messages (in the 'sms_relent_sent' table), apart from the last message that will be deleted
829
+	         $getcnvqrst = $this->connection->prepare('SELECT `message_id`, `date`, `from`, `to`, `message`, `author_displayname` FROM `*PREFIX*sms_relent_sent` WHERE 
830
+	                                                 (`from` LIKE ? AND `to` = ?) OR (`from` LIKE ? AND `to` = ?)');
831
+	         $getcnvstres = $getcnvqrst->execute([$lastmsgFromLike, $lastmsgTo, $lastmsgToLike, $lastmsgFrom]);
832
+
833
+	         $msgexchsent = [];
834
+	         while ($rwsfetchedst = $getcnvstres->fetch()) {
835
+	                $msgexchsent[] = $rwsfetchedst;
836
+	         }
837
+	         $getcnvstres->closeCursor();
838
+
839
+                 $mergedrecsent = array_merge($msgexchrec, $msgexchsent);
840
+
841
+                 // Check if there are at least 2 messages exchanged between the two numbers
842
+                 if (count($mergedrecsent) > 1) {
843
+
844
+                     // Order all the messages exchanged between the two numbers
845
+                     usort($mergedrecsent, function($a, $b) { return strtotime($a["date"]) - strtotime($b["date"]); });
846
+
847
+                     // Get the last but one message
848
+                     $msgdatares = array_slice($mergedrecsent, -2, 1);
849
+                     $lastbutone = $msgdatares[0];
850
+
851
+                     // Replace the message that will be deleted with the last but one message in the same conversation
852
+                     if (str_contains($lastbutone['to'], ": ")) {
853
+                         $lastMsgToarr = explode(": ", $lastbutone['to']);
854
+                         $lastMsgTo = $lastMsgToarr[1];
855
+                     } else { $lastMsgTo = $lastbutone['to']; }
856
+
857
+                     if (str_contains($lastbutone['from'], ": ")) {
858
+                         $lastMsgFromarr = explode(": ", $lastbutone['from']);
859
+                         $lastMsgFrom = $lastMsgFromarr[1];
860
+                     } else { $lastMsgFrom = $lastbutone['from']; }
861
+
862
+                     $updatecnv = $this->connection->prepare('
863
+		             UPDATE `*PREFIX*sms_relent_conv`
864
+		             SET `last_msg_date` = ?, `last_msg_from` = ?, `last_msg_to` = ?, `last_message` = ?, `lastmsgdisplayname` = ?, `lastmsgprovid` = ?
865
+                             WHERE `conversation_id` = ?');
866
+                     $updatecnvres = $updatecnv->execute([$lastbutone['date'], $lastMsgFrom, $lastMsgTo, $lastbutone['message'], $lastbutone['author_displayname'], 
867
+                                                          $lastbutone['message_id'], $conversationID]);
868
+                     $updatecnvres->closeCursor();
869
+
870
+                 } else {
871
+
872
+                     // Since the last message in the conversation is the only message of the conversation and will be deleted, delete the conversation row from the conversations table
873
+		     $convmsgdel = $this->connection->prepare('
874
+				   DELETE FROM `*PREFIX*sms_relent_conv`
875
+				   WHERE `conversation_id` = ?');
876
+		     $convmsgdelres = $convmsgdel->execute([$conversationID]);
877
+		     $convmsgdelres->closeCursor();
878
+
879
+		     // Reindex the conversations table
880
+		     $sqlupdateconv = $this->connection->prepare('
881
+			           SET @resetconv = 0;
882
+				   UPDATE `*PREFIX*sms_relent_conv`
883
+				   SET `id` = @resetconv := @resetconv + 1;
884
+			           ALTER TABLE `*PREFIX*sms_relent_conv` auto_increment=1;');
885
+		     $updateconvRes = $sqlupdateconv->execute();
886
+		     $updateconvRes->closeCursor();
887
+                 }
888
+             }
889
+     }
890
+
891
+
892
+     /**
893
+      * @NoAdminRequired
894
+      */
895
+     public function removerecrows($userId, $userDelDspName, $recmessagedbIDs) {
896
+
897
+        if ($this->groupManager->isAdmin($userId)) {
898
+
899
+            /* The user who deletes the messages is an admin */
900
+
901
+            foreach ($recmessagedbIDs as $key => $rowtodelrw) {
902
+
903
+                     $rowtodelarr = explode("|", $rowtodelrw);
904
+                     $msgDbId = $rowtodelarr[0];
905
+                     $msgProvId = $rowtodelarr[1];
906
+
907
+                     // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
908
+                     $this->removeMsgFromConv($msgProvId);
909
+
910
+                     // Delete the message
911
+                     if ($msgProvId != "" && $msgProvId != "n/a") {
912
+		         $rdlquery = $this->connection->prepare('
913
+		                     DELETE FROM `*PREFIX*sms_relent_received`
914
+		                     WHERE `message_id` = ?');
915
+		         $delRes = $rdlquery->execute([$msgProvId]);
916
+		         $delRes->closeCursor();
917
+                     } else {
918
+		         $rdlquery = $this->connection->prepare('
919
+		                     DELETE FROM `*PREFIX*sms_relent_received`
920
+		                     WHERE `id` = ?');
921
+		         $delRes = $rdlquery->execute([$msgDbId]);
922
+		         $delRes->closeCursor();
923
+                     }
924
+            }
925
+
926
+            // Reindex the table of received messages
927
+	    $sqlupdate = $this->connection->prepare('
928
+                      SET @resetrec = 0;
929
+		      UPDATE `*PREFIX*sms_relent_received`
930
+		      SET `id` = @resetrec := @resetrec + 1;
931
+                      ALTER TABLE `*PREFIX*sms_relent_received` auto_increment=1;');
932
+	    $updateRes = $sqlupdate->execute();
933
+	    $updateRes->closeCursor();
934
+
935
+            return "success";
936
+
937
+        } else {
938
+
939
+            /* The user who deletes the messages is not an admin */
940
+
941
+            $permcheck = true;
942
+            $delcheck = 0;
943
+            foreach ($recmessagedbIDs as $key => $rowtodelrw) {
944
+
945
+                $rowtodelarr = explode("|", $rowtodelrw);
946
+                $msgDbId = $rowtodelarr[0];
947
+                $msgProvId = $rowtodelarr[1];
948
+
949
+                // Get the phone number on which the message was received, and the number's provider 
950
+                $getphprv = $this->connection->prepare('SELECT `id`, `to` FROM `*PREFIX*sms_relent_received` WHERE `id` = ?');
951
+		$getphprvres = $getphprv->execute([$msgDbId]);
952
+		$phnmbrprov = $getphprvres->fetch();
953
+                $getphprvres->closeCursor();
954
+
955
+                if ($phnmbrprov) {
956
+                    $retrphprovraw = $phnmbrprov['to'];
957
+                    $retrphprovarr = explode(": ", $retrphprovraw);
958
+                    $retrprovider = $retrphprovarr[0];
959
+                    $retrphnumber = "%" . $retrphprovarr[1] . "%";
960
+
961
+                    // Get the username of the admin who shared the retrieved phone number with the non-admin user
962
+                    $getadm = $this->connection->prepare('SELECT `user_id`, `available_numbers` FROM `*PREFIX*sms_relent_settings` WHERE `available_numbers` LIKE ?');
963
+		    $getadmres = $getadm->execute([$retrphnumber]);
964
+                    $admunameretr = [];
965
+		    while ($getadmuname = $getadmres->fetch()) {
966
+                           $admunameretr[] = $getadmuname['user_id'];
967
+                    }
968
+                    $getadmres->closeCursor();
969
+
970
+                    if ($admunameretr) {
971
+                        foreach ($admunameretr as $admkey => $admuname) {
972
+
973
+                                 // Check if the retrieved admin allowed the user to delete messages
974
+                                 $userDspNameder = "%" . $userDelDspName . "%";
975
+                                 $usrsgrpsdel = 1;
976
+
977
+                                 if ($retrprovider == "Telnyx") {
978
+
979
+                                     $checkperm = $this->connection->prepare('SELECT `user_id`, `tnx_users_allowed`, `tnx_users_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `tnx_users_allowed` LIKE ? AND `tnx_users_del` = ?');
980
+		                     $checkpermres = $checkperm->execute([$admuname, $userDspNameder, $usrsgrpsdel]);
981
+                                     $admallwddel = $checkpermres->fetch();
982
+                                     $checkpermres->closeCursor();
983
+
984
+                                     // If the user has been allowed to delete messages by Display Name, delete the current message
985
+                                     if ($admallwddel) {
986
+
987
+                                         // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
988
+                                         $this->removeMsgFromConv($msgProvId);
989
+
990
+                                         if ($msgProvId != "" && $msgProvId != "n/a") {
991
+				             $delquery = $this->connection->prepare('
992
+					          DELETE FROM `*PREFIX*sms_relent_received`
993
+					          WHERE `message_id` = ?');
994
+				             $qrdelResult = $delquery->execute([$msgProvId]);
995
+				             $qrdelResult->closeCursor();
996
+                                             $delcheck++;
997
+                                         } else {
998
+				             $delquery = $this->connection->prepare('
999
+					          DELETE FROM `*PREFIX*sms_relent_received`
1000
+					          WHERE `id` = ?');
1001
+				             $qrdelResult = $delquery->execute([$msgDbId]);
1002
+				             $qrdelResult->closeCursor();
1003
+                                             $delcheck++;
1004
+                                         }
1005
+
1006
+                                     } else {
1007
+                                         // Check if the user has been allowed to delete messages by group
1008
+                                         $checkpermgrp = $this->connection->prepare('SELECT `user_id`, `tnx_groups_allowed`, `tnx_groups_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `tnx_groups_del` = ?');
1009
+		                         $checkpermgrpres = $checkpermgrp->execute([$admuname, $usrsgrpsdel]);
1010
+                                         $admallwddelgrp = $checkpermgrpres->fetch();
1011
+                                         $checkpermgrpres->closeCursor();
1012
+                              
1013
+                                         if ($admallwddelgrp) {
1014
+					     // Get the groups to which the current user belongs
1015
+					     $getusrgrp = $this->connection->prepare('
1016
+						  SELECT `gid`, `uid`
1017
+						  FROM  `*PREFIX*group_user`
1018
+						  WHERE `uid` = ?');
1019
+					     $getusrgrpres = $getusrgrp->execute([$userId]);
1020
+
1021
+					     $usergrps = [];
1022
+					     while ($fetchedgrps = $getusrgrpres->fetch()) {
1023
+						    $usergrps[] = $fetchedgrps['gid'];
1024
+					     }
1025
+					     $getusrgrpres->closeCursor();
1026
+
1027
+                                             $groupsallowed = explode("|", $admallwddelgrp['tnx_groups_allowed']);
1028
+
1029
+                                             if ($usergrps && $groupsallowed) {
1030
+                                                 $countGrps = array_intersect($usergrps, $groupsallowed);
1031
+
1032
+                                                 // If the user has been allowed to delete messages by group, delete the current message
1033
+                                                 if (count($countGrps) > 0) {
1034
+
1035
+                                                     // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1036
+                                                     $this->removeMsgFromConv($msgProvId);
1037
+
1038
+		                                     if ($msgProvId != "" && $msgProvId != "n/a") {
1039
+						         $delquery = $this->connection->prepare('
1040
+							      DELETE FROM `*PREFIX*sms_relent_received`
1041
+							      WHERE `message_id` = ?');
1042
+						         $qrdelResult = $delquery->execute([$msgProvId]);
1043
+						         $qrdelResult->closeCursor();
1044
+		                                         $delcheck++;
1045
+		                                     } else {
1046
+						         $delquery = $this->connection->prepare('
1047
+							      DELETE FROM `*PREFIX*sms_relent_received`
1048
+							      WHERE `id` = ?');
1049
+						         $qrdelResult = $delquery->execute([$msgDbId]);
1050
+						         $qrdelResult->closeCursor();
1051
+		                                         $delcheck++;
1052
+		                                     }
1053
+
1054
+                                                 } else { $permcheck = false; }
1055
+                                             }
1056
+                                         }
1057
+                                     }
1058
+
1059
+                                 } elseif ($retrprovider == "Plivo") {
1060
+
1061
+                                     $checkperm = $this->connection->prepare('SELECT `user_id`, `plv_users_allowed`, `plv_users_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `plv_users_allowed` LIKE ? AND `plv_users_del` = ?');
1062
+		                     $checkpermres = $checkperm->execute([$admuname, $userDspNameder, $usrsgrpsdel]);
1063
+                                     $admallwddel = $checkpermres->fetch();
1064
+                                     $checkpermres->closeCursor();
1065
+
1066
+                                     // If the user has been allowed to delete messages by Display Name, delete the current message
1067
+                                     if ($admallwddel) {
1068
+
1069
+                                         // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1070
+                                         $this->removeMsgFromConv($msgProvId);
1071
+
1072
+                                         if ($msgProvId != "" && $msgProvId != "n/a") {
1073
+				             $delquery = $this->connection->prepare('
1074
+					          DELETE FROM `*PREFIX*sms_relent_received`
1075
+					          WHERE `message_id` = ?');
1076
+				             $qrdelResult = $delquery->execute([$msgProvId]);
1077
+				             $qrdelResult->closeCursor();
1078
+                                             $delcheck++;
1079
+                                         } else {
1080
+				             $delquery = $this->connection->prepare('
1081
+					          DELETE FROM `*PREFIX*sms_relent_received`
1082
+					          WHERE `id` = ?');
1083
+				             $qrdelResult = $delquery->execute([$msgDbId]);
1084
+				             $qrdelResult->closeCursor();
1085
+                                             $delcheck++;
1086
+                                         }
1087
+                                      
1088
+                                     } else {
1089
+                                         // Check if the user has been allowed to delete messages by group
1090
+                                         $checkpermgrp = $this->connection->prepare('SELECT `user_id`, `plv_groups_allowed`, `plv_groups_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `plv_groups_del` = ?');
1091
+		                         $checkpermgrpres = $checkpermgrp->execute([$admuname, $usrsgrpsdel]);
1092
+                                         $admallwddelgrp = $checkpermgrpres->fetch();
1093
+                                         $checkpermgrpres->closeCursor();
1094
+                              
1095
+                                         if ($admallwddelgrp) {
1096
+					     // Get the groups to which the current user belongs
1097
+					     $getusrgrp = $this->connection->prepare('
1098
+						  SELECT `gid`, `uid`
1099
+						  FROM  `*PREFIX*group_user`
1100
+						  WHERE `uid` = ?');
1101
+					     $getusrgrpres = $getusrgrp->execute([$userId]);
1102
+
1103
+					     $usergrps = [];
1104
+					     while ($fetchedgrps = $getusrgrpres->fetch()) {
1105
+						    $usergrps[] = $fetchedgrps['gid'];
1106
+					     }
1107
+					     $getusrgrpres->closeCursor();
1108
+
1109
+                                             $groupsallowed = explode("|", $admallwddelgrp['plv_groups_allowed']);
1110
+
1111
+                                             if ($usergrps && $groupsallowed) {
1112
+                                                 $countGrps = array_intersect($usergrps, $groupsallowed);
1113
+
1114
+                                                 // If the user has been allowed to delete messages by group, delete the current message
1115
+                                                 if (count($countGrps) > 0) {
1116
+
1117
+                                                     // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1118
+                                                     $this->removeMsgFromConv($msgProvId);
1119
+
1120
+				                     if ($msgProvId != "" && $msgProvId != "n/a") {
1121
+							 $delquery = $this->connection->prepare('
1122
+							      DELETE FROM `*PREFIX*sms_relent_received`
1123
+						              WHERE `message_id` = ?');
1124
+							 $qrdelResult = $delquery->execute([$msgProvId]);
1125
+							 $qrdelResult->closeCursor();
1126
+				                         $delcheck++;
1127
+				                     } else {
1128
+							 $delquery = $this->connection->prepare('
1129
+						              DELETE FROM `*PREFIX*sms_relent_received`
1130
+							      WHERE `id` = ?');
1131
+							 $qrdelResult = $delquery->execute([$msgDbId]);
1132
+							 $qrdelResult->closeCursor();
1133
+				                         $delcheck++;
1134
+				                     }
1135
+
1136
+                                                 } else { $permcheck = false; }
1137
+                                             }
1138
+                                         }
1139
+                                     }
1140
+
1141
+                                 } elseif ($retrprovider == "Twilio") {
1142
+
1143
+                                     $checkperm = $this->connection->prepare('SELECT `user_id`, `twl_users_allowed`, `twl_users_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `twl_users_allowed` LIKE ? AND `twl_users_del` = ?');
1144
+		                     $checkpermres = $checkperm->execute([$admuname, $userDspNameder, $usrsgrpsdel]);
1145
+                                     $admallwddel = $checkpermres->fetch();
1146
+                                     $checkpermres->closeCursor();
1147
+
1148
+                                     // If the user has been allowed to delete messages by Display Name, delete the current message
1149
+                                     if ($admallwddel) {
1150
+
1151
+                                         // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1152
+                                         $this->removeMsgFromConv($msgProvId);
1153
+
1154
+                                         if ($msgProvId != "" && $msgProvId != "n/a") {
1155
+				             $delquery = $this->connection->prepare('
1156
+					          DELETE FROM `*PREFIX*sms_relent_received`
1157
+					          WHERE `message_id` = ?');
1158
+				             $qrdelResult = $delquery->execute([$msgProvId]);
1159
+				             $qrdelResult->closeCursor();
1160
+                                             $delcheck++;
1161
+                                         } else {
1162
+				             $delquery = $this->connection->prepare('
1163
+					          DELETE FROM `*PREFIX*sms_relent_received`
1164
+					          WHERE `id` = ?');
1165
+				             $qrdelResult = $delquery->execute([$msgDbId]);
1166
+				             $qrdelResult->closeCursor();
1167
+                                             $delcheck++;
1168
+                                         }
1169
+
1170
+                                     } else {
1171
+                                         // Check if the user has been allowed to delete messages by group
1172
+                                         $checkpermgrp = $this->connection->prepare('SELECT `user_id`, `twl_groups_allowed`, `twl_groups_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `twl_groups_del` = ?');
1173
+		                         $checkpermgrpres = $checkpermgrp->execute([$admuname, $usrsgrpsdel]);
1174
+                                         $admallwddelgrp = $checkpermgrpres->fetch();
1175
+                                         $checkpermgrpres->closeCursor();
1176
+                              
1177
+                                         if ($admallwddelgrp) {
1178
+					     // Get the groups to which the current user belongs
1179
+					     $getusrgrp = $this->connection->prepare('
1180
+						  SELECT `gid`, `uid`
1181
+						  FROM  `*PREFIX*group_user`
1182
+						  WHERE `uid` = ?');
1183
+					     $getusrgrpres = $getusrgrp->execute([$userId]);
1184
+
1185
+					     $usergrps = [];
1186
+					     while ($fetchedgrps = $getusrgrpres->fetch()) {
1187
+						    $usergrps[] = $fetchedgrps['gid'];
1188
+					     }
1189
+					     $getusrgrpres->closeCursor();
1190
+
1191
+                                             $groupsallowed = explode("|", $admallwddelgrp['twl_groups_allowed']);
1192
+
1193
+                                             if ($usergrps && $groupsallowed) {
1194
+                                                 $countGrps = array_intersect($usergrps, $groupsallowed);
1195
+
1196
+                                                 // If the user has been allowed to delete messages by group, delete the current message
1197
+                                                 if (count($countGrps) > 0) {
1198
+
1199
+                                                     // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1200
+                                                     $this->removeMsgFromConv($msgProvId);
1201
+
1202
+				                     if ($msgProvId != "" && $msgProvId != "n/a") {
1203
+							 $delquery = $this->connection->prepare('
1204
+							      DELETE FROM `*PREFIX*sms_relent_received`
1205
+							      WHERE `message_id` = ?');
1206
+							 $qrdelResult = $delquery->execute([$msgProvId]);
1207
+							 $qrdelResult->closeCursor();
1208
+				                         $delcheck++;
1209
+				                     } else {
1210
+							 $delquery = $this->connection->prepare('
1211
+							      DELETE FROM `*PREFIX*sms_relent_received`
1212
+							      WHERE `id` = ?');
1213
+							 $qrdelResult = $delquery->execute([$msgDbId]);
1214
+							 $qrdelResult->closeCursor();
1215
+				                         $delcheck++;
1216
+				                     }
1217
+
1218
+                                                 } else { $permcheck = false; }
1219
+                                             }
1220
+                                         }
1221
+                                     }
1222
+
1223
+                                 } elseif ($retrprovider == "Flowroute") {
1224
+
1225
+                                     $checkperm = $this->connection->prepare('SELECT `user_id`, `flr_users_allowed`, `flr_users_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `flr_users_allowed` LIKE ? AND `flr_users_del` = ?');
1226
+		                     $checkpermres = $checkperm->execute([$admuname, $userDspNameder, $usrsgrpsdel]);
1227
+                                     $admallwddel = $checkpermres->fetch();
1228
+                                     $checkpermres->closeCursor();
1229
+
1230
+                                     // If the user has been allowed to delete messages by Display Name, delete the current message
1231
+                                     if ($admallwddel) {
1232
+
1233
+                                         // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1234
+                                         $this->removeMsgFromConv($msgProvId);
1235
+
1236
+                                         if ($msgProvId != "" && $msgProvId != "n/a") {
1237
+				             $delquery = $this->connection->prepare('
1238
+					          DELETE FROM `*PREFIX*sms_relent_received`
1239
+					          WHERE `message_id` = ?');
1240
+				             $qrdelResult = $delquery->execute([$msgProvId]);
1241
+				             $qrdelResult->closeCursor();
1242
+                                             $delcheck++;
1243
+                                         } else {
1244
+				             $delquery = $this->connection->prepare('
1245
+					          DELETE FROM `*PREFIX*sms_relent_received`
1246
+					          WHERE `id` = ?');
1247
+				             $qrdelResult = $delquery->execute([$msgDbId]);
1248
+				             $qrdelResult->closeCursor();
1249
+                                             $delcheck++;
1250
+                                         }
1251
+                                  
1252
+                                     } else {
1253
+                                         // Check if the user has been allowed to delete messages by group
1254
+                                         $checkpermgrp = $this->connection->prepare('SELECT `user_id`, `flr_groups_allowed`, `flr_groups_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `flr_groups_del` = ?');
1255
+		                         $checkpermgrpres = $checkpermgrp->execute([$admuname, $usrsgrpsdel]);
1256
+                                         $admallwddelgrp = $checkpermgrpres->fetch();
1257
+                                         $checkpermgrpres->closeCursor();
1258
+                              
1259
+                                         if ($admallwddelgrp) {
1260
+					     // Get the groups to which the current user belongs
1261
+					     $getusrgrp = $this->connection->prepare('
1262
+						  SELECT `gid`, `uid`
1263
+						  FROM  `*PREFIX*group_user`
1264
+						  WHERE `uid` = ?');
1265
+					     $getusrgrpres = $getusrgrp->execute([$userId]);
1266
+
1267
+					     $usergrps = [];
1268
+					     while ($fetchedgrps = $getusrgrpres->fetch()) {
1269
+						    $usergrps[] = $fetchedgrps['gid'];
1270
+					     }
1271
+					     $getusrgrpres->closeCursor();
1272
+
1273
+                                             $groupsallowed = explode("|", $admallwddelgrp['flr_groups_allowed']);
1274
+
1275
+                                             if ($usergrps && $groupsallowed) {
1276
+                                                 $countGrps = array_intersect($usergrps, $groupsallowed);
1277
+
1278
+                                                 // If the user has been allowed to delete messages by group, delete the current message
1279
+                                                 if (count($countGrps) > 0) {
1280
+
1281
+                                                     // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1282
+                                                     $this->removeMsgFromConv($msgProvId);
1283
+
1284
+				                     if ($msgProvId != "" && $msgProvId != "n/a") {
1285
+							 $delquery = $this->connection->prepare('
1286
+							      DELETE FROM `*PREFIX*sms_relent_received`
1287
+							      WHERE `message_id` = ?');
1288
+							 $qrdelResult = $delquery->execute([$msgProvId]);
1289
+							 $qrdelResult->closeCursor();
1290
+				                         $delcheck++;
1291
+				                     } else {
1292
+							 $delquery = $this->connection->prepare('
1293
+							      DELETE FROM `*PREFIX*sms_relent_received`
1294
+							      WHERE `id` = ?');
1295
+							 $qrdelResult = $delquery->execute([$msgDbId]);
1296
+							 $qrdelResult->closeCursor();
1297
+				                         $delcheck++;
1298
+				                     }
1299
+
1300
+                                                 } else { $permcheck = false; }
1301
+                                             }
1302
+                                         }
1303
+                                     }
1304
+                                 }
1305
+
1306
+                        }
1307
+                    }
1308
+                }
1309
+            }
1310
+
1311
+            if ($delcheck > 0) {
1312
+                // Reindex the table of received messages
1313
+	        $sqlupdate = $this->connection->prepare('
1314
+                      SET @resetrec = 0;
1315
+		      UPDATE `*PREFIX*sms_relent_received`
1316
+		      SET `id` = @resetrec := @resetrec + 1;
1317
+                      ALTER TABLE `*PREFIX*sms_relent_received` auto_increment=1;');
1318
+	        $updateRes = $sqlupdate->execute();
1319
+	        $updateRes->closeCursor();
1320
+            }
1321
+
1322
+            if ($permcheck) { return "success"; } else { return "not allowed"; }
1323
+        }
1324
+     }
1325
+
1326
+
1327
+     /**
1328
+      * @NoAdminRequired
1329
+      */
1330
+     public function getsenttable($userId) {
1331
+
1332
+        // Get the user's preferences from the settings
1333
+        $getgamcheck = $this->connection->prepare('
1334
+		       SELECT `user_id`, `show_all_messages`, `show_display_names`
1335
+		       FROM  `*PREFIX*sms_relent_settings` WHERE `user_id` = ?');
1336
+        $getgamcheckres = $getgamcheck->execute([$userId]);
1337
+        $getcrgamspref = $getgamcheckres->fetch();
1338
+        $crgamspref = $getcrgamspref['show_all_messages'];
1339
+        $crdnamespref = $getcrgamspref['show_display_names'];
1340
+        $getgamcheckres->closeCursor();
1341
+
1342
+
1343
+        // Collect the users with whom the current admin is sharing his API keys and whose messages he will be able to see
1344
+        if ($crgamspref == 1 && $this->groupManager->isAdmin($userId)) {
1345
+
1346
+            // Get the groups and users that were allowed access to the API keys
1347
+            $getgrps = $this->connection->prepare('SELECT `user_id`, `tnx_groups_allowed`, `tnx_users_allowed`, `plv_groups_allowed`, `plv_users_allowed`,
1348
+                                                  `twl_groups_allowed`, `twl_users_allowed`, `flr_groups_allowed`, `flr_users_allowed` FROM `*PREFIX*sms_relent_subac`
1349
+                                                   WHERE `user_id` = ?');
1350
+            $getgrpsres = $getgrps->execute([$userId]);
1351
+            $getgrpsusr = $getgrpsres->fetch();
1352
+            $getgrpsres->closeCursor();
1353
+
1354
+            if ($getgrpsusr) {
1355
+
1356
+                if ($getgrpsusr['tnx_users_allowed']) { $tnxusers = explode("|", $getgrpsusr['tnx_users_allowed']); } else { $tnxusers = []; }
1357
+                if ($getgrpsusr['plv_users_allowed']) { $plvusers = explode("|", $getgrpsusr['plv_users_allowed']); } else { $plvusers = []; }
1358
+                if ($getgrpsusr['twl_users_allowed']) { $twlusers = explode("|", $getgrpsusr['twl_users_allowed']); } else { $twlusers = []; }
1359
+                if ($getgrpsusr['flr_users_allowed']) { $flrusers = explode("|", $getgrpsusr['flr_users_allowed']); } else { $flrusers = []; }
1360
+
1361
+                $allwdusersarr = array_merge($tnxusers, $plvusers, $twlusers, $flrusers);
1362
+                $allwdusersunq = array_filter(array_unique($allwdusersarr));
1363
+
1364
+                if ($getgrpsusr['tnx_groups_allowed']) { $tnxgroups = explode("|", $getgrpsusr['tnx_groups_allowed']); } else { $tnxgroups = []; }
1365
+                if ($getgrpsusr['plv_groups_allowed']) { $plvgroups = explode("|", $getgrpsusr['plv_groups_allowed']); } else { $plvgroups = []; }
1366
+                if ($getgrpsusr['twl_groups_allowed']) { $twlgroups = explode("|", $getgrpsusr['twl_groups_allowed']); } else { $twlgroups = []; }
1367
+                if ($getgrpsusr['flr_groups_allowed']) { $flrgroups = explode("|", $getgrpsusr['flr_groups_allowed']); } else { $flrgroups = []; }
1368
+
1369
+                $allwdgroupsarr = array_merge($tnxgroups, $plvgroups, $twlgroups, $flrgroups);
1370
+                $allwdgroupsunq = array_filter(array_unique($allwdgroupsarr));
1371
+
1372
+            } else {
1373
+                $allwdusersunq = [];
1374
+                $allwdgroupsunq = [];
1375
+            }
1376
+
1377
+            // Get the username for each Display Name of the allowed users
1378
+            $allwdusersfnl = [];
1379
+            foreach ($allwdusersunq as $alwdusrkey => $alwdusrvalue) {
1380
+
1381
+                         $getacdatausrnm = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ? AND `value` = ?');
1382
+		         $getacdatausrnmres = $getacdatausrnm->execute(['displayname', $alwdusrvalue]);
1383
+		         $acdatausrname = $getacdatausrnmres->fetch();
1384
+                         if ($acdatausrname) {
1385
+                             $allwdusersfnl[] = $acdatausrname['uid'];
1386
+                         }
1387
+                         $getacdatausrnmres->closeCursor();
1388
+            }
1389
+
1390
+            // Get the users from all the allowed groups
1391
+            $allwdusersgrpmlt = [];
1392
+            foreach ($allwdgroupsunq as $prgrpkey => $prgrpvalue) {
1393
+
1394
+                     // Get all the users that belong to the current group, if the current group is different from 'admin'
1395
+                     if ($prgrpvalue != 'admin') {
1396
+                         $getusringroup = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
1397
+		         $getusringroupres = $getusringroup->execute([$prgrpvalue]);
1398
+
1399
+		         while ($getusrname = $getusringroupres->fetch()) {
1400
+
1401
+                                $allwdusersgrpmlt[] = $getusrname['uid'];
1402
+                         }
1403
+		         $getusringroupres->closeCursor();
1404
+                     }
1405
+            }
1406
+            $allwdusersgrpfnl = array_unique($allwdusersgrpmlt);
1407
+            
1408
+            $allusr = array_merge($allwdusersfnl, $allwdusersgrpfnl);
1409
+            $allusruniquest = array_unique($allusr);
1410
+
1411
+            if ($allusruniquest) {
1412
+                array_unshift($allusruniquest, $userId);
1413
+                $allusrunique = $allusruniquest;
1414
+            } else { $allusrunique = [$userId]; }
1415
+
1416
+            $allusruniquesec = "'" . implode("','", $allusrunique) . "'";
1417
+        }
1418
+
1419
+        // If the user is an admin and he wants to see his messages and the messages of all the users with whom he shares his API keys
1420
+        if ($crgamspref == 1 && $this->groupManager->isAdmin($userId)) {
1421
+
1422
+            if ($crdnamespref == 1) {
1423
+
1424
+                $resultsent = $this->connection->executeQuery("
1425
+                       SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `network`, `price`, `status`, `deliveryreceipt`, `message`, `author_displayname`
1426
+		       FROM  `*PREFIX*sms_relent_sent` 
1427
+                       WHERE `user_id` IN (" . $allusruniquesec . ")");
1428
+            } else {
1429
+
1430
+                $resultsent = $this->connection->executeQuery("
1431
+                       SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `network`, `price`, `status`, `deliveryreceipt`, `message`
1432
+		       FROM  `*PREFIX*sms_relent_sent`
1433
+                       WHERE `user_id` IN (" . $allusruniquesec . ")");
1434
+            }
1435
+
1436
+        // If the user is an admin and he wants to see only his messages
1437
+        } elseif ($crgamspref == 0 && $this->groupManager->isAdmin($userId)) {
1438
+
1439
+            if ($crdnamespref == 1) {
1440
+                $getsenttbl = $this->connection->prepare('
1441
+		       SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `network`, `price`, `status`, `deliveryreceipt`, `message`, `author_displayname`
1442
+		       FROM  `*PREFIX*sms_relent_sent` 
1443
+                       WHERE `user_id` = ?');
1444
+                $resultsent = $getsenttbl->execute([$userId]);
1445
+            } else {
1446
+                $getsenttbl = $this->connection->prepare('
1447
+		       SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `network`, `price`, `status`, `deliveryreceipt`, `message`
1448
+		       FROM  `*PREFIX*sms_relent_sent` 
1449
+                       WHERE `user_id` = ?');
1450
+                $resultsent = $getsenttbl->execute([$userId]);
1451
+            }
1452
+
1453
+        // If the user is not an admin 
1454
+        } elseif (!$this->groupManager->isAdmin($userId)) {
1455
+
1456
+	    // Get the Display Name of the current user
1457
+	    $getacdatadn = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `uid` = ? AND `name` = ?');
1458
+	    $getacdatadnres = $getacdatadn->execute([$userId, 'displayname']);
1459
+	    $acdatausrdnadm = $getacdatadnres->fetch();
1460
+	    $cruserdname = $acdatausrdnadm['value'];
1461
+	    $getacdatadnres->closeCursor();
1462
+
1463
+            // Get the groups to which the current user belongs
1464
+            $getusrgrp = $this->connection->prepare('
1465
+	          SELECT `gid`, `uid`
1466
+	          FROM  `*PREFIX*group_user`
1467
+                  WHERE `uid` = ?');
1468
+            $getusrgrpres = $getusrgrp->execute([$userId]);
1469
+
1470
+            $usergrps = [];
1471
+            while ($fetchedgrps = $getusrgrpres->fetch()) {
1472
+                   $usergrps[] = $fetchedgrps['gid'];
1473
+            }
1474
+            $getusrgrpres->closeCursor();
1475
+
1476
+            // Get the restrictions from the 'sms_relent_restrict' table
1477
+            $getrestr = $this->connection->prepare('
1478
+		       SELECT `phone_number`, `groups`, `users`
1479
+		       FROM  `*PREFIX*sms_relent_restrict`');
1480
+            $getrestrres = $getrestr->execute();
1481
+
1482
+            $restrdata = [];
1483
+            while ($restrfetched = $getrestrres->fetch()) {
1484
+                   $restrdata[] = $restrfetched;
1485
+            }
1486
+            $getrestrres->closeCursor();
1487
+
1488
+            // Get the phone numbers that the user is allowed/not allowed to use
1489
+            if ($restrdata) {
1490
+
1491
+                $restrPhoneNmbrs = [];
1492
+                $allowedPhoneNmbrs = [];
1493
+                foreach ($restrdata as $rskey => $rsvalue) {
1494
+
1495
+                         $chck = 0;
1496
+                         $restrgrparr = explode("|", $rsvalue['groups']);
1497
+                         foreach ($restrgrparr as $rkey => $rvalue) {
1498
+                                  if ($rvalue) {
1499
+                                      if (strpos(implode("|", $usergrps), $rvalue) !== false) { $chck++; }
1500
+                                  }
1501
+                         }
1502
+                         if (strpos($rsvalue['users'], $cruserdname) !== false) { $chck++; }
1503
+
1504
+                         if ($chck == 0) { 
1505
+                             $restrPhoneNmbrs[] = $rsvalue['phone_number']; 
1506
+                         }
1507
+                }
1508
+
1509
+		$allowedPhNmbrs = $this->getsmsnumbers($userId);
1510
+
1511
+		foreach ($allowedPhNmbrs as $apnkey => $apnvalue) {
1512
+			 $crphnmbr = explode(": ", $apnvalue);
1513
+			 if ($crphnmbr[0] == 'Tx') {
1514
+			     $allowedPhoneNmbrs[] = 'Telnyx: ' . $crphnmbr[1];
1515
+			 } elseif ($crphnmbr[0] == 'Pl') {
1516
+			     $allowedPhoneNmbrs[] = 'Plivo: ' . $crphnmbr[1];
1517
+			 } elseif ($crphnmbr[0] == 'Tw') {
1518
+			     $allowedPhoneNmbrs[] = 'Twilio: ' . $crphnmbr[1];
1519
+			 } elseif ($crphnmbr[0] == 'Fl') {
1520
+			     $allowedPhoneNmbrs[] = 'Flowroute: ' . $crphnmbr[1];
1521
+			 }
1522
+		}
1523
+
1524
+                $procalwduid = $allowedPhoneNmbrs;
1525
+                $procalwduidsec = "'" . implode("','", $procalwduid) . "'";
1526
+
1527
+                if ($crdnamespref == 1) {
1528
+                    if ($procalwduidsec != "''") {
1529
+
1530
+                        $resultsent = $this->connection->executeQuery("
1531
+		            SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `network`, `price`, `status`, `deliveryreceipt`, `message`, `author_displayname`
1532
+		            FROM `*PREFIX*sms_relent_sent`
1533
+			    WHERE `user_id` = '$userId' OR `from` IN (" . $procalwduidsec . ")");
1534
+                    } else {
1535
+	                $getsenttbl = $this->connection->prepare('
1536
+		            SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `network`, `price`, `status`, `deliveryreceipt`, `message`, `author_displayname`
1537
+		            FROM `*PREFIX*sms_relent_sent`
1538
+			    WHERE `user_id` = ?');
1539
+	                $resultsent = $getsenttbl->execute([$userId]);
1540
+                    }
1541
+                } else {
1542
+                    if ($procalwduidsec != "''") {
1543
+
1544
+                        $resultsent = $this->connection->executeQuery("
1545
+		            SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `network`, `price`, `status`, `deliveryreceipt`, `message`
1546
+		            FROM `*PREFIX*sms_relent_sent`
1547
+			    WHERE `user_id` = '$userId' OR `from` IN (" . $procalwduidsec . ")");
1548
+
1549
+                    } else {
1550
+	                $getsenttbl = $this->connection->prepare('
1551
+		            SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `network`, `price`, `status`, `deliveryreceipt`, `message`
1552
+		            FROM `*PREFIX*sms_relent_sent`
1553
+			    WHERE `user_id` = ?');
1554
+	                $resultsent = $getsenttbl->execute([$userId]);
1555
+                    }
1556
+                }
1557
+
1558
+            } else {
1559
+
1560
+                if ($crdnamespref == 1) {
1561
+                    $getsenttbl = $this->connection->prepare('
1562
+		       SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `network`, `price`, `status`, `deliveryreceipt`, `message`, `author_displayname`
1563
+		       FROM `*PREFIX*sms_relent_sent`
1564
+		       WHERE `user_id` = ?');
1565
+                    $resultsent = $getsenttbl->execute([$userId]);
1566
+                } else {
1567
+                    $getsenttbl = $this->connection->prepare('
1568
+		       SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `network`, `price`, `status`, `deliveryreceipt`, `message`
1569
+		       FROM `*PREFIX*sms_relent_sent`
1570
+		       WHERE `user_id` = ?');
1571
+                    $resultsent = $getsenttbl->execute([$userId]);
1572
+                }
1573
+            }
1574
+        }
1575
+
1576
+
1577
+        $sentdatatable = [];
1578
+        while ($rowfetched = $resultsent->fetch()){
1579
+               $sentdatatable[] = $rowfetched;
1580
+        }
1581
+        $resultsent->closeCursor();
1582
+
1583
+        $sentdatafromdb = $sentdatatable;
1584
+
1585
+
1586
+        if ($this->groupManager->isAdmin($userId)) {
1587
+
1588
+            $sentdatafdb = ['datarows' => $sentdatafromdb, 'showdispnm' => $crdnamespref];
1589
+            return $sentdatafdb;
1590
+
1591
+        } else {
1592
+
1593
+            if ($restrdata) {
1594
+
1595
+                // Clean the phone numbers from tags
1596
+                $restrPhfin = [];
1597
+                foreach ($restrPhoneNmbrs as $phkey => $phvalue) {
1598
+
1599
+                    $restrpharr = explode(": ", $phvalue);
1600
+                    $restrPhfin[] = $restrpharr[1];
1601
+                }
1602
+
1603
+                // Assemble the array of message rows that excludes the rows for the restricted phone numbers
1604
+                foreach ($sentdatafromdb as $smdkey => $smdvalue) {
1605
+
1606
+                    if (str_contains($smdvalue['from'], "+")) {
1607
+                        $fromnmbrarr = explode("+", $smdvalue['from']);
1608
+                        if (in_array("+" . $fromnmbrarr[1], $restrPhfin)) {
1609
+                            unset($sentdatafromdb[$smdkey]);
1610
+                        }
1611
+                    } else {
1612
+                        $frmnmbrarr = explode(": ", $smdvalue['from']);
1613
+                        if (count($frmnmbrarr) == 2) {
1614
+                            $nmbtbcmprd = $frmnmbrarr[1];
1615
+                        } else { 
1616
+                            $nmbtbcmprd = $frmnmbrarr[0];
1617
+                        }
1618
+
1619
+                        if (in_array($nmbtbcmprd, $restrPhfin)) {
1620
+                            unset($sentdatafromdb[$smdkey]);
1621
+                        }
1622
+                    }
1623
+                }
1624
+
1625
+                $sentdatadbproc = array_values($sentdatafromdb);
1626
+
1627
+                $sentdatafdb = ['datarows' => $sentdatadbproc, 'showdispnm' => $crdnamespref];
1628
+                return $sentdatafdb;
1629
+
1630
+            } else {
1631
+
1632
+                $sentdatafdb = ['datarows' => $sentdatafromdb, 'showdispnm' => $crdnamespref];
1633
+                return $sentdatafdb;
1634
+            }
1635
+        }
1636
+     }
1637
+
1638
+
1639
+     /**
1640
+      * @NoAdminRequired
1641
+      */
1642
+     public function getsenttablefordel($userId) {
1643
+
1644
+        if ($this->groupManager->isAdmin($userId)) {
1645
+
1646
+            $getsenttbldel = $this->connection->prepare('
1647
+		          SELECT `id`, `user_id`, `message_id`, `date`, `from`, `to`, `network`, `price`, `status`, `deliveryreceipt`, `message`, `author_displayname`
1648
+		          FROM  `*PREFIX*sms_relent_sent`
1649
+		          WHERE `user_id` = ?');
1650
+            $resultsentdl = $getsenttbldel->execute([$userId]);
1651
+
1652
+            $sentdatatable = [];
1653
+            while ($rowfetched = $resultsentdl->fetch()){
1654
+                   $sentdatatable[] = $rowfetched;
1655
+            }
1656
+            $resultsentdl->closeCursor();
1657
+
1658
+            $sentdatafromdb = $sentdatatable;
1659
+
1660
+            return $sentdatafromdb;
1661
+
1662
+        } else { return "not permitted"; }
1663
+     }
1664
+
1665
+
1666
+     /**
1667
+      * @NoAdminRequired
1668
+      */
1669
+     public function removesentrows($userId, $userstDelDspName, $sentmessagedbIDs) {
1670
+
1671
+        if ($this->groupManager->isAdmin($userId)) {
1672
+
1673
+            /* The user who deletes the messages is an admin */
1674
+
1675
+            foreach ($sentmessagedbIDs as $key => $sentrowtodel) {
1676
+
1677
+                     $rowtodelarr = explode("|", $sentrowtodel);
1678
+                     $msgDbId = $rowtodelarr[0];
1679
+                     $msgProvId = $rowtodelarr[1];
1680
+
1681
+                     // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1682
+                     $this->removeMsgFromConv($msgProvId);
1683
+
1684
+                     // Delete the message
1685
+                     if ($msgProvId != "" && $msgProvId != "n/a") {
1686
+		         $smdlquery = $this->connection->prepare('
1687
+		               DELETE FROM `*PREFIX*sms_relent_sent`
1688
+		               WHERE `message_id` = ?');
1689
+		         $delsmsgRes = $smdlquery->execute([$msgProvId]);
1690
+		         $delsmsgRes->closeCursor();
1691
+                     } else {
1692
+		         $smdlquery = $this->connection->prepare('
1693
+		               DELETE FROM `*PREFIX*sms_relent_sent`
1694
+		               WHERE `id` = ?');
1695
+		         $delsmsgRes = $smdlquery->execute([$msgDbId]);
1696
+		         $delsmsgRes->closeCursor();
1697
+                     }
1698
+            }
1699
+
1700
+            // Reindex the table of sent messages
1701
+	    $sqlupdatest = $this->connection->prepare('
1702
+                      SET @resetsent = 0;
1703
+		      UPDATE `*PREFIX*sms_relent_sent`
1704
+		      SET `id` = @resetsent := @resetsent + 1;
1705
+                      ALTER TABLE `*PREFIX*sms_relent_sent` auto_increment=1;');
1706
+	    $updatestRes = $sqlupdatest->execute();
1707
+	    $updatestRes->closeCursor();
1708
+
1709
+            return "success";
1710
+
1711
+        } else {
1712
+
1713
+            /* The user who deletes the messages is not an admin */
1714
+
1715
+            $permcheckst = true;
1716
+            $delstcheck = 0;
1717
+            foreach ($sentmessagedbIDs as $key => $sentrowtodel) {
1718
+
1719
+                $rowtodelarr = explode("|", $sentrowtodel);
1720
+                $msgDbId = $rowtodelarr[0];
1721
+                $msgProvId = $rowtodelarr[1];
1722
+
1723
+                // Get the phone number from which the message was sent, and the number's provider 
1724
+                $getphprv = $this->connection->prepare('SELECT `id`, `user_id`, `from` FROM `*PREFIX*sms_relent_sent` WHERE `id` = ?');
1725
+		$getphprvres = $getphprv->execute([$msgDbId]);
1726
+		$phnmbrprov = $getphprvres->fetch();
1727
+                $getphprvres->closeCursor();
1728
+
1729
+                if ($phnmbrprov) {
1730
+
1731
+                    $retrphprovraw = $phnmbrprov['from'];
1732
+                    $retrphprovarr = explode(": ", $retrphprovraw);
1733
+                    $retrprovider = $retrphprovarr[0];
1734
+                    $retrphnumber = "%" . $retrphprovarr[1] . "%";
1735
+
1736
+                    // Get the username of the admin who shared the retrieved phone number with the non-admin user
1737
+                    $getadm = $this->connection->prepare('SELECT `user_id`, `available_numbers` FROM `*PREFIX*sms_relent_settings` WHERE `available_numbers` LIKE ?');
1738
+		    $getadmres = $getadm->execute([$retrphnumber]);
1739
+                    $admunameretr = [];
1740
+		    while ($getadmuname = $getadmres->fetch()) {
1741
+                           $admunameretr[] = $getadmuname['user_id'];
1742
+                    }
1743
+                    $getadmres->closeCursor();
1744
+
1745
+                    if ($admunameretr) {
1746
+
1747
+                            foreach ($admunameretr as $admkey => $admuname) {
1748
+
1749
+                                 // Check if the retrieved admin allowed the user to delete messages
1750
+                                 $userDspNameder = "%" . $userstDelDspName . "%";
1751
+                                 $usrsgrpsdel = 1;
1752
+
1753
+                                 if ($retrprovider == "Telnyx") {
1754
+
1755
+                                     $checkperm = $this->connection->prepare('SELECT `user_id`, `tnx_users_allowed`, `tnx_users_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `tnx_users_allowed` LIKE ? AND `tnx_users_del` = ?');
1756
+		                     $checkpermres = $checkperm->execute([$admuname, $userDspNameder, $usrsgrpsdel]);
1757
+                                     $admallwddel = $checkpermres->fetch();
1758
+                                     $checkpermres->closeCursor();
1759
+
1760
+                                     // If the user has been allowed to delete messages by Display Name, delete the current message
1761
+                                     if ($admallwddel) {
1762
+
1763
+                                         // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1764
+                                         $this->removeMsgFromConv($msgProvId);
1765
+
1766
+				         if ($msgProvId != "" && $msgProvId != "n/a") {
1767
+					     $smdlquery = $this->connection->prepare('
1768
+					           DELETE FROM `*PREFIX*sms_relent_sent`
1769
+					           WHERE `message_id` = ?');
1770
+					     $delsmsgRes = $smdlquery->execute([$msgProvId]);
1771
+					     $delsmsgRes->closeCursor();
1772
+				             $delstcheck++;
1773
+				         } else {
1774
+					     $smdlquery = $this->connection->prepare('
1775
+					           DELETE FROM `*PREFIX*sms_relent_sent`
1776
+					           WHERE `id` = ?');
1777
+					     $delsmsgRes = $smdlquery->execute([$msgDbId]);
1778
+					     $delsmsgRes->closeCursor();
1779
+				             $delstcheck++;
1780
+				         }
1781
+                                      
1782
+                                     } else {
1783
+                                         // Check if the user has been allowed to delete messages by group
1784
+                                         $checkpermgrp = $this->connection->prepare('SELECT `user_id`, `tnx_groups_allowed`, `tnx_groups_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `tnx_groups_del` = ?');
1785
+		                         $checkpermgrpres = $checkpermgrp->execute([$admuname, $usrsgrpsdel]);
1786
+                                         $admallwddelgrp = $checkpermgrpres->fetch();
1787
+                                         $checkpermgrpres->closeCursor();
1788
+                              
1789
+                                         if ($admallwddelgrp) {
1790
+					     // Get the groups to which the current user belongs
1791
+					     $getusrgrp = $this->connection->prepare('
1792
+						  SELECT `gid`, `uid`
1793
+						  FROM  `*PREFIX*group_user`
1794
+						  WHERE `uid` = ?');
1795
+					     $getusrgrpres = $getusrgrp->execute([$userId]);
1796
+
1797
+					     $usergrps = [];
1798
+					     while ($fetchedgrps = $getusrgrpres->fetch()) {
1799
+						    $usergrps[] = $fetchedgrps['gid'];
1800
+					     }
1801
+					     $getusrgrpres->closeCursor();
1802
+
1803
+                                             $groupsallowed = explode("|", $admallwddelgrp['tnx_groups_allowed']);
1804
+
1805
+                                             if ($usergrps && $groupsallowed) {
1806
+                                                 $countGrps = array_intersect($usergrps, $groupsallowed);
1807
+
1808
+                                                 // If the user has been allowed to delete messages by group, delete the current message
1809
+                                                 if (count($countGrps) > 0) {
1810
+
1811
+                                                     // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1812
+                                                     $this->removeMsgFromConv($msgProvId);
1813
+
1814
+					             if ($msgProvId != "" && $msgProvId != "n/a") {
1815
+							 $smdlquery = $this->connection->prepare('
1816
+							       DELETE FROM `*PREFIX*sms_relent_sent`
1817
+							       WHERE `message_id` = ?');
1818
+							 $delsmsgRes = $smdlquery->execute([$msgProvId]);
1819
+							 $delsmsgRes->closeCursor();
1820
+							 $delstcheck++;
1821
+					             } else {
1822
+							 $smdlquery = $this->connection->prepare('
1823
+							       DELETE FROM `*PREFIX*sms_relent_sent`
1824
+							       WHERE `id` = ?');
1825
+							 $delsmsgRes = $smdlquery->execute([$msgDbId]);
1826
+							 $delsmsgRes->closeCursor();
1827
+							 $delstcheck++;
1828
+					             }
1829
+
1830
+                                                 } else { $permcheckst = false; }
1831
+                                             }
1832
+                                         }
1833
+                                     }
1834
+
1835
+                                 } elseif ($retrprovider == "Plivo") {
1836
+
1837
+                                     $checkperm = $this->connection->prepare('SELECT `user_id`, `plv_users_allowed`, `plv_users_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `plv_users_allowed` LIKE ? AND `plv_users_del` = ?');
1838
+		                     $checkpermres = $checkperm->execute([$admuname, $userDspNameder, $usrsgrpsdel]);
1839
+                                     $admallwddel = $checkpermres->fetch();
1840
+                                     $checkpermres->closeCursor();
1841
+
1842
+                                     // If the user has been allowed to delete messages by Display Name, delete the current message
1843
+                                     if ($admallwddel) {
1844
+
1845
+                                         // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1846
+                                         $this->removeMsgFromConv($msgProvId);
1847
+
1848
+				         if ($msgProvId != "" && $msgProvId != "n/a") {
1849
+					     $smdlquery = $this->connection->prepare('
1850
+					           DELETE FROM `*PREFIX*sms_relent_sent`
1851
+					           WHERE `message_id` = ?');
1852
+					     $delsmsgRes = $smdlquery->execute([$msgProvId]);
1853
+					     $delsmsgRes->closeCursor();
1854
+				             $delstcheck++;
1855
+				         } else {
1856
+					     $smdlquery = $this->connection->prepare('
1857
+					           DELETE FROM `*PREFIX*sms_relent_sent`
1858
+					           WHERE `id` = ?');
1859
+					     $delsmsgRes = $smdlquery->execute([$msgDbId]);
1860
+					     $delsmsgRes->closeCursor();
1861
+				             $delstcheck++;
1862
+				         }
1863
+                                    
1864
+                                     } else {
1865
+                                         // Check if the user has been allowed to delete messages by group
1866
+                                         $checkpermgrp = $this->connection->prepare('SELECT `user_id`, `plv_groups_allowed`, `plv_groups_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `plv_groups_del` = ?');
1867
+		                         $checkpermgrpres = $checkpermgrp->execute([$admuname, $usrsgrpsdel]);
1868
+                                         $admallwddelgrp = $checkpermgrpres->fetch();
1869
+                                         $checkpermgrpres->closeCursor();
1870
+                              
1871
+                                         if ($admallwddelgrp) {
1872
+					     // Get the groups to which the current user belongs
1873
+					     $getusrgrp = $this->connection->prepare('
1874
+						  SELECT `gid`, `uid`
1875
+						  FROM  `*PREFIX*group_user`
1876
+						  WHERE `uid` = ?');
1877
+					     $getusrgrpres = $getusrgrp->execute([$userId]);
1878
+
1879
+					     $usergrps = [];
1880
+					     while ($fetchedgrps = $getusrgrpres->fetch()) {
1881
+						    $usergrps[] = $fetchedgrps['gid'];
1882
+					     }
1883
+					     $getusrgrpres->closeCursor();
1884
+
1885
+                                             $groupsallowed = explode("|", $admallwddelgrp['plv_groups_allowed']);
1886
+
1887
+                                             if ($usergrps && $groupsallowed) {
1888
+                                                 $countGrps = array_intersect($usergrps, $groupsallowed);
1889
+
1890
+                                                 // If the user has been allowed to delete messages by group, delete the current message
1891
+                                                 if (count($countGrps) > 0) {
1892
+
1893
+                                                     // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1894
+                                                     $this->removeMsgFromConv($msgProvId);
1895
+
1896
+					             if ($msgProvId != "" && $msgProvId != "n/a") {
1897
+							 $smdlquery = $this->connection->prepare('
1898
+							       DELETE FROM `*PREFIX*sms_relent_sent`
1899
+							       WHERE `message_id` = ?');
1900
+							 $delsmsgRes = $smdlquery->execute([$msgProvId]);
1901
+							 $delsmsgRes->closeCursor();
1902
+							 $delstcheck++;
1903
+					             } else {
1904
+							 $smdlquery = $this->connection->prepare('
1905
+							       DELETE FROM `*PREFIX*sms_relent_sent`
1906
+							       WHERE `id` = ?');
1907
+							 $delsmsgRes = $smdlquery->execute([$msgDbId]);
1908
+							 $delsmsgRes->closeCursor();
1909
+							 $delstcheck++;
1910
+					             }
1911
+
1912
+                                                 } else { $permcheckst = false; }
1913
+                                             }
1914
+                                         }
1915
+                                     }
1916
+
1917
+                                 } elseif ($retrprovider == "Twilio") {
1918
+
1919
+                                     $checkperm = $this->connection->prepare('SELECT `user_id`, `twl_users_allowed`, `twl_users_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `twl_users_allowed` LIKE ? AND `twl_users_del` = ?');
1920
+		                     $checkpermres = $checkperm->execute([$admuname, $userDspNameder, $usrsgrpsdel]);
1921
+                                     $admallwddel = $checkpermres->fetch();
1922
+                                     $checkpermres->closeCursor();
1923
+
1924
+                                     // If the user has been allowed to delete messages by Display Name, delete the current message
1925
+                                     if ($admallwddel) {
1926
+
1927
+                                         // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1928
+                                         $this->removeMsgFromConv($msgProvId);
1929
+
1930
+				         if ($msgProvId != "" && $msgProvId != "n/a") {
1931
+					     $smdlquery = $this->connection->prepare('
1932
+					           DELETE FROM `*PREFIX*sms_relent_sent`
1933
+					           WHERE `message_id` = ?');
1934
+					     $delsmsgRes = $smdlquery->execute([$msgProvId]);
1935
+					     $delsmsgRes->closeCursor();
1936
+				             $delstcheck++;
1937
+				         } else {
1938
+					     $smdlquery = $this->connection->prepare('
1939
+					           DELETE FROM `*PREFIX*sms_relent_sent`
1940
+					           WHERE `id` = ?');
1941
+					     $delsmsgRes = $smdlquery->execute([$msgDbId]);
1942
+					     $delsmsgRes->closeCursor();
1943
+				             $delstcheck++;
1944
+				         }
1945
+                                       
1946
+                                     } else {
1947
+                                         // Check if the user has been allowed to delete messages by group
1948
+                                         $checkpermgrp = $this->connection->prepare('SELECT `user_id`, `twl_groups_allowed`, `twl_groups_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `twl_groups_del` = ?');
1949
+		                         $checkpermgrpres = $checkpermgrp->execute([$admuname, $usrsgrpsdel]);
1950
+                                         $admallwddelgrp = $checkpermgrpres->fetch();
1951
+                                         $checkpermgrpres->closeCursor();
1952
+                              
1953
+                                         if ($admallwddelgrp) {
1954
+					     // Get the groups to which the current user belongs
1955
+					     $getusrgrp = $this->connection->prepare('
1956
+						  SELECT `gid`, `uid`
1957
+						  FROM  `*PREFIX*group_user`
1958
+						  WHERE `uid` = ?');
1959
+					     $getusrgrpres = $getusrgrp->execute([$userId]);
1960
+
1961
+					     $usergrps = [];
1962
+					     while ($fetchedgrps = $getusrgrpres->fetch()) {
1963
+						    $usergrps[] = $fetchedgrps['gid'];
1964
+					     }
1965
+					     $getusrgrpres->closeCursor();
1966
+
1967
+                                             $groupsallowed = explode("|", $admallwddelgrp['twl_groups_allowed']);
1968
+
1969
+                                             if ($usergrps && $groupsallowed) {
1970
+                                                 $countGrps = array_intersect($usergrps, $groupsallowed);
1971
+
1972
+                                                 // If the user has been allowed to delete messages by group, delete the current message
1973
+                                                 if (count($countGrps) > 0) {
1974
+
1975
+                                                     // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
1976
+                                                     $this->removeMsgFromConv($msgProvId);
1977
+
1978
+					             if ($msgProvId != "" && $msgProvId != "n/a") {
1979
+							 $smdlquery = $this->connection->prepare('
1980
+							       DELETE FROM `*PREFIX*sms_relent_sent`
1981
+							       WHERE `message_id` = ?');
1982
+							 $delsmsgRes = $smdlquery->execute([$msgProvId]);
1983
+							 $delsmsgRes->closeCursor();
1984
+							 $delstcheck++;
1985
+					             } else {
1986
+							 $smdlquery = $this->connection->prepare('
1987
+							       DELETE FROM `*PREFIX*sms_relent_sent`
1988
+							       WHERE `id` = ?');
1989
+							 $delsmsgRes = $smdlquery->execute([$msgDbId]);
1990
+							 $delsmsgRes->closeCursor();
1991
+							 $delstcheck++;
1992
+					             }
1993
+
1994
+                                                 } else { $permcheckst = false; }
1995
+                                             }
1996
+                                         }
1997
+                                     }
1998
+
1999
+                                 } elseif ($retrprovider == "Flowroute") {
2000
+
2001
+                                     $checkperm = $this->connection->prepare('SELECT `user_id`, `flr_users_allowed`, `flr_users_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `flr_users_allowed` LIKE ? AND `flr_users_del` = ?');
2002
+		                     $checkpermres = $checkperm->execute([$admuname, $userDspNameder, $usrsgrpsdel]);
2003
+                                     $admallwddel = $checkpermres->fetch();
2004
+                                     $checkpermres->closeCursor();
2005
+
2006
+                                     // If the user has been allowed to delete messages by Display Name, delete the current message
2007
+                                     if ($admallwddel) {
2008
+
2009
+                                         // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
2010
+                                         $this->removeMsgFromConv($msgProvId);
2011
+
2012
+				         if ($msgProvId != "" && $msgProvId != "n/a") {
2013
+					     $smdlquery = $this->connection->prepare('
2014
+					           DELETE FROM `*PREFIX*sms_relent_sent`
2015
+					           WHERE `message_id` = ?');
2016
+					     $delsmsgRes = $smdlquery->execute([$msgProvId]);
2017
+					     $delsmsgRes->closeCursor();
2018
+				             $delstcheck++;
2019
+				         } else {
2020
+					     $smdlquery = $this->connection->prepare('
2021
+					           DELETE FROM `*PREFIX*sms_relent_sent`
2022
+					           WHERE `id` = ?');
2023
+					     $delsmsgRes = $smdlquery->execute([$msgDbId]);
2024
+					     $delsmsgRes->closeCursor();
2025
+				             $delstcheck++;
2026
+				         }
2027
+                                       
2028
+                                     } else {
2029
+                                         // Check if the user has been allowed to delete messages by group
2030
+                                         $checkpermgrp = $this->connection->prepare('SELECT `user_id`, `flr_groups_allowed`, `flr_groups_del` FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ? AND `flr_groups_del` = ?');
2031
+		                         $checkpermgrpres = $checkpermgrp->execute([$admuname, $usrsgrpsdel]);
2032
+                                         $admallwddelgrp = $checkpermgrpres->fetch();
2033
+                                         $checkpermgrpres->closeCursor();
2034
+                              
2035
+                                         if ($admallwddelgrp) {
2036
+					     // Get the groups to which the current user belongs
2037
+					     $getusrgrp = $this->connection->prepare('
2038
+						  SELECT `gid`, `uid`
2039
+						  FROM  `*PREFIX*group_user`
2040
+						  WHERE `uid` = ?');
2041
+					     $getusrgrpres = $getusrgrp->execute([$userId]);
2042
+
2043
+					     $usergrps = [];
2044
+					     while ($fetchedgrps = $getusrgrpres->fetch()) {
2045
+						    $usergrps[] = $fetchedgrps['gid'];
2046
+					     }
2047
+					     $getusrgrpres->closeCursor();
2048
+
2049
+                                             $groupsallowed = explode("|", $admallwddelgrp['flr_groups_allowed']);
2050
+
2051
+                                             if ($usergrps && $groupsallowed) {
2052
+                                                 $countGrps = array_intersect($usergrps, $groupsallowed);
2053
+
2054
+                                                 // If the user has been allowed to delete messages by group, delete the current message
2055
+                                                 if (count($countGrps) > 0) {
2056
+
2057
+                                                     // If it's the case, replace the message that will be deleted, in the conversations table, or remove the conversation's row from the conversations table
2058
+                                                     $this->removeMsgFromConv($msgProvId);
2059
+
2060
+					             if ($msgProvId != "" && $msgProvId != "n/a") {
2061
+							 $smdlquery = $this->connection->prepare('
2062
+							       DELETE FROM `*PREFIX*sms_relent_sent`
2063
+							       WHERE `message_id` = ?');
2064
+							 $delsmsgRes = $smdlquery->execute([$msgProvId]);
2065
+							 $delsmsgRes->closeCursor();
2066
+							 $delstcheck++;
2067
+					             } else {
2068
+							 $smdlquery = $this->connection->prepare('
2069
+							       DELETE FROM `*PREFIX*sms_relent_sent`
2070
+							       WHERE `id` = ?');
2071
+							 $delsmsgRes = $smdlquery->execute([$msgDbId]);
2072
+							 $delsmsgRes->closeCursor();
2073
+							 $delstcheck++;
2074
+					             }
2075
+
2076
+                                                 } else { $permcheckst = false; }
2077
+                                             }
2078
+                                         }
2079
+                                     }
2080
+                                 }
2081
+                            }
2082
+
2083
+                    }
2084
+                }
2085
+            }
2086
+
2087
+            if ($delstcheck > 0) {
2088
+
2089
+                // Reindex the table of sent messages
2090
+	        $sqlupdatest = $this->connection->prepare('
2091
+                      SET @resetsent = 0;
2092
+		      UPDATE `*PREFIX*sms_relent_sent`
2093
+		      SET `id` = @resetsent := @resetsent + 1;
2094
+                      ALTER TABLE `*PREFIX*sms_relent_sent` auto_increment=1;');
2095
+	        $updatestRes = $sqlupdatest->execute();
2096
+	        $updatestRes->closeCursor();
2097
+            }
2098
+
2099
+            if ($permcheckst) { return "success"; } else { return "not allowed"; }
2100
+        }
2101
+     }
2102
+
2103
+
2104
+     /**
2105
+      * @NoAdminRequired
2106
+      */
2107
+     public function getconversations($userId) {
2108
+
2109
+        // Get the phone numbers that the current user has access to
2110
+        $getnumberscv = $this->connection->prepare('SELECT `user_id`, `available_numbers` FROM `*PREFIX*sms_relent_settings` WHERE `user_id` = ?');
2111
+	$getcrtusrnocv = $getnumberscv->execute([$userId]);
2112
+        $getusrnmbrscv = $getcrtusrnocv->fetch();
2113
+        $getcrtusrnocv->closeCursor();
2114
+
2115
+        if ($getusrnmbrscv['available_numbers']) {
2116
+
2117
+            $retrievednmbrArr = explode("|", $getusrnmbrscv['available_numbers']);
2118
+            $retrievednmbrpr = array_filter($retrievednmbrArr);
2119
+            $retrievednmbrsfin = [];
2120
+
2121
+            foreach ($retrievednmbrpr as $convKey => $convValue) {
2122
+                     $retrnmbrex = explode(": ", $convValue);
2123
+                     $retrievednmbrsfin[] = $retrnmbrex[1]; 
2124
+            }
2125
+            $retrievednmbrsimp = "'" . implode("','", $retrievednmbrsfin) . "'";
2126
+
2127
+            // Get the conversation data from the 'sms_relent_conv' table
2128
+            $getconvdata = $this->connection->executeQuery("SELECT `conversation_id`, `archived`, `last_archived`, `last_unarchived`, `archived_by`, `unarchived_by`, `last_msg_date`, 
2129
+                                                           `last_msg_from`, `last_msg_to`, `last_message`, `lastmsgdisplayname`, `flagged`, `flagunflagby`, `flagunflagdate`, `tag`,
2130
+                                                           `taguntagby`, `taguntagdate`, `description`, `descriptionby`, `descriptiondate` FROM `*PREFIX*sms_relent_conv` WHERE 
2131
+                                                           `last_msg_from` IN (" . $retrievednmbrsimp . ") OR `last_msg_to` IN (" . $retrievednmbrsimp . ")");
2132
+
2133
+            $convdatafdb = [];
2134
+            while ($convdatafetched = $getconvdata->fetch()) {
2135
+                   $convdatafdb[] = $convdatafetched;
2136
+            }   
2137
+            $getconvdata->closeCursor();
2138
+
2139
+        } else { $convdatafdb = []; }
2140
+
2141
+        return $convdatafdb;
2142
+     }
2143
+
2144
+
2145
+     /**
2146
+      * @NoAdminRequired
2147
+      */
2148
+     public function archiveconv($userId, $userDspNameArch, $conversationId) {
2149
+
2150
+        $archivedyn = 1;
2151
+        $dateArchived = date("Y-m-d H:i:s");
2152
+        $sqlarchive = $this->connection->prepare('
2153
+		        UPDATE `*PREFIX*sms_relent_conv`
2154
+		        SET `archived` = ?, `last_archived` = ?, `archived_by` = ?
2155
+                        WHERE `conversation_id` = ?');
2156
+        $archiveRes = $sqlarchive->execute([$archivedyn, $dateArchived, $userDspNameArch, $conversationId]);
2157
+        $archiveRes->closeCursor();
2158
+        if ($archiveRes) { return "success"; } else { return "error"; }
2159
+     }
2160
+
2161
+
2162
+     /**
2163
+      * @NoAdminRequired
2164
+      */
2165
+     public function unarchiveconv($userId, $userDspNameUnarch, $conversationIdUn) {
2166
+
2167
+        $archivedynun = 0;
2168
+        $dateUnarchived = date("Y-m-d H:i:s");
2169
+        $sqlarchiveun = $this->connection->prepare('
2170
+		        UPDATE `*PREFIX*sms_relent_conv`
2171
+		        SET `archived` = ?, `last_unarchived` = ?, `unarchived_by` = ?
2172
+                        WHERE `conversation_id` = ?');
2173
+        $archiveResun = $sqlarchiveun->execute([$archivedynun, $dateUnarchived, $userDspNameUnarch, $conversationIdUn]);
2174
+        $archiveResun->closeCursor();
2175
+        if ($archiveResun) { return "success"; } else { return "error"; }
2176
+     }
2177
+
2178
+
2179
+     /**
2180
+      * @NoAdminRequired
2181
+      */
2182
+     public function saveconvdescription($userId, $userDspNameDesc, $convDescription, $convId) {
2183
+
2184
+            $dateDescSaved = date("Y-m-d H:i:s");
2185
+	    $updatedesc = $this->connection->prepare('
2186
+			UPDATE `*PREFIX*sms_relent_conv`
2187
+			SET `description` = ?, `descriptionby` = ?, `descriptiondate` = ?
2188
+                        WHERE `conversation_id` = ?');
2189
+	    $updatedescres = $updatedesc->execute([$convDescription, $userDspNameDesc, $dateDescSaved, $convId]);
2190
+
2191
+            if ($updatedescres) {
2192
+                return $respupdesc = "The conversation description has been saved successfully.";
2193
+            } else {
2194
+                return $respupdesc = "Error while trying to save the conversation description to the database.";
2195
+            }
2196
+	    $updatedescres->closeCursor();
2197
+     }
2198
+
2199
+
2200
+     /**
2201
+      * @NoAdminRequired
2202
+      */
2203
+     public function saveconvtag($userId, $userDspNameTag, $convTag, $convId) {
2204
+
2205
+            $dateTagSaved = date("Y-m-d H:i:s");
2206
+	    $updatetag = $this->connection->prepare('
2207
+			UPDATE `*PREFIX*sms_relent_conv`
2208
+			SET `tag` = ?, `taguntagby` = ?, `taguntagdate` = ?
2209
+                        WHERE `conversation_id` = ?');
2210
+	    $updatetagres = $updatetag->execute([$convTag, $userDspNameTag, $dateTagSaved, $convId]);
2211
+
2212
+            if ($updatetagres) {
2213
+                return $respuptag = "The conversation tag has been saved successfully.";
2214
+            } else {
2215
+                return $respuptag = "Error while trying to save the conversation tag to the database.";
2216
+            }
2217
+	    $updatetagres->closeCursor();
2218
+     }
2219
+
2220
+
2221
+     /**
2222
+      * @NoAdminRequired
2223
+      */
2224
+     public function saveconvflag($userId, $userDspNameFlag, $convFlag, $convId) {
2225
+
2226
+            $dateFlagSaved = date("Y-m-d H:i:s");
2227
+	    $updateflag = $this->connection->prepare('
2228
+			UPDATE `*PREFIX*sms_relent_conv`
2229
+			SET `flagged` = ?, `flagunflagby` = ?, `flagunflagdate` = ?
2230
+                        WHERE `conversation_id` = ?');
2231
+	    $updateflagres = $updateflag->execute([$convFlag, $userDspNameFlag, $dateFlagSaved, $convId]);
2232
+
2233
+            if ($updateflagres) {
2234
+                return $respupflag = "success";
2235
+            } else {
2236
+                return $respupflag = "failure";
2237
+            }
2238
+	    $updateflagres->closeCursor();
2239
+     }
2240
+
2241
+
2242
+     /**
2243
+      * @NoAdminRequired
2244
+      */
2245
+     public function removeconvmsgs($userId, $conversationId) {
2246
+
2247
+        if ($this->groupManager->isAdmin($userId)) {
2248
+
2249
+            // Delete all the messages included in the conversation with the given conversation ID, from the 'sms_relent_received' table
2250
+            $convmsgdelrec = $this->connection->prepare('
2251
+		           DELETE FROM `*PREFIX*sms_relent_received`
2252
+		           WHERE `conversation_id` = ?');
2253
+            $convmsgdelrecres = $convmsgdelrec->execute([$conversationId]);
2254
+	    $convmsgdelrecres->closeCursor();
2255
+
2256
+	    $sqlupdaterec = $this->connection->prepare('
2257
+                           SET @resetrec = 0;
2258
+		           UPDATE `*PREFIX*sms_relent_received`
2259
+		           SET `id` = @resetrec := @resetrec + 1;
2260
+                           ALTER TABLE `*PREFIX*sms_relent_received` auto_increment=1;');
2261
+	    $updaterecRes = $sqlupdaterec->execute();
2262
+	    $updaterecRes->closeCursor();
2263
+
2264
+            // Delete all the messages included in the conversation with the given conversation ID, from the 'sms_relent_sent' table
2265
+            $convmsgdelsent = $this->connection->prepare('
2266
+		           DELETE FROM `*PREFIX*sms_relent_sent`
2267
+		           WHERE `conversation_id` = ?');
2268
+            $convmsgdelsentres = $convmsgdelsent->execute([$conversationId]);
2269
+	    $convmsgdelsentres->closeCursor();
2270
+
2271
+	    $sqlupdatesent = $this->connection->prepare('
2272
+                           SET @resetsent = 0;
2273
+		           UPDATE `*PREFIX*sms_relent_sent`
2274
+		           SET `id` = @resetsent := @resetsent + 1;
2275
+                           ALTER TABLE `*PREFIX*sms_relent_sent` auto_increment=1;');
2276
+	    $updatesentRes = $sqlupdatesent->execute();
2277
+	    $updatesentRes->closeCursor();
2278
+
2279
+            // Delete the row with the given conversation ID from the 'sms_relent_conv' table
2280
+            $convmsgdel = $this->connection->prepare('
2281
+		           DELETE FROM `*PREFIX*sms_relent_conv`
2282
+		           WHERE `conversation_id` = ?');
2283
+            $convmsgdelres = $convmsgdel->execute([$conversationId]);
2284
+	    $convmsgdelres->closeCursor();
2285
+
2286
+            // Reindex the conversations table
2287
+	    $sqlupdateconv = $this->connection->prepare('
2288
+                           SET @resetconv = 0;
2289
+		           UPDATE `*PREFIX*sms_relent_conv`
2290
+		           SET `id` = @resetconv := @resetconv + 1;
2291
+                           ALTER TABLE `*PREFIX*sms_relent_conv` auto_increment=1;');
2292
+	    $updateconvRes = $sqlupdateconv->execute();
2293
+	    $updateconvRes->closeCursor();
2294
+
2295
+            return "success";
2296
+
2297
+        } else { return "not allowed"; }
2298
+     }
2299
+
2300
+
2301
+     /**
2302
+      * @NoAdminRequired
2303
+      */
2304
+     public function getgroupedtable($userId) {
2305
+
2306
+
2307
+        // Get the user's preferences from the settings
2308
+        $getpref = $this->connection->prepare('
2309
+		       SELECT `user_id`, `show_all_messages`
2310
+		       FROM  `*PREFIX*sms_relent_settings` WHERE `user_id` = ?');
2311
+        $getprefres = $getpref->execute([$userId]);
2312
+        $getprefresdata = $getprefres->fetch();
2313
+        $crsampref = $getprefresdata['show_all_messages'];
2314
+        $getprefres->closeCursor();
2315
+
2316
+
2317
+        // Collect the users with whom the current admin is sharing his API keys and whose messages he will be able to see
2318
+        if ($crsampref == 1 && $this->groupManager->isAdmin($userId)) {
2319
+
2320
+            // Get the groups and users that were allowed access to the API keys
2321
+            $getgrps = $this->connection->prepare('SELECT `user_id`, `tnx_groups_allowed`, `tnx_users_allowed`, `plv_groups_allowed`, `plv_users_allowed`,
2322
+                                                  `twl_groups_allowed`, `twl_users_allowed`, `flr_groups_allowed`, `flr_users_allowed` FROM `*PREFIX*sms_relent_subac`
2323
+                                                   WHERE `user_id` = ?');
2324
+            $getgrpsres = $getgrps->execute([$userId]);
2325
+            $getgrpsusr = $getgrpsres->fetch();
2326
+            $getgrpsres->closeCursor();
2327
+
2328
+            if ($getgrpsusr) {
2329
+
2330
+                if ($getgrpsusr['tnx_users_allowed']) { $tnxusers = explode("|", $getgrpsusr['tnx_users_allowed']); } else { $tnxusers = []; }
2331
+                if ($getgrpsusr['plv_users_allowed']) { $plvusers = explode("|", $getgrpsusr['plv_users_allowed']); } else { $plvusers = []; }
2332
+                if ($getgrpsusr['twl_users_allowed']) { $twlusers = explode("|", $getgrpsusr['twl_users_allowed']); } else { $twlusers = []; }
2333
+                if ($getgrpsusr['flr_users_allowed']) { $flrusers = explode("|", $getgrpsusr['flr_users_allowed']); } else { $flrusers = []; }
2334
+
2335
+                $allwdusersarr = array_merge($tnxusers, $plvusers, $twlusers, $flrusers);
2336
+                $allwdusersunq = array_filter(array_unique($allwdusersarr));
2337
+
2338
+                if ($getgrpsusr['tnx_groups_allowed']) { $tnxgroups = explode("|", $getgrpsusr['tnx_groups_allowed']); } else { $tnxgroups = []; }
2339
+                if ($getgrpsusr['plv_groups_allowed']) { $plvgroups = explode("|", $getgrpsusr['plv_groups_allowed']); } else { $plvgroups = []; }
2340
+                if ($getgrpsusr['twl_groups_allowed']) { $twlgroups = explode("|", $getgrpsusr['twl_groups_allowed']); } else { $twlgroups = []; }
2341
+                if ($getgrpsusr['flr_groups_allowed']) { $flrgroups = explode("|", $getgrpsusr['flr_groups_allowed']); } else { $flrgroups = []; }
2342
+
2343
+                $allwdgroupsarr = array_merge($tnxgroups, $plvgroups, $twlgroups, $flrgroups);
2344
+                $allwdgroupsunq = array_filter(array_unique($allwdgroupsarr));
2345
+
2346
+            } else {
2347
+                $allwdusersunq = [];
2348
+                $allwdgroupsunq = [];
2349
+            }
2350
+
2351
+            // Get the username for each Display Name of the allowed users
2352
+            $allwdusersfnl = [];
2353
+            foreach ($allwdusersunq as $alwdusrkey => $alwdusrvalue) {
2354
+
2355
+                         $getacdatausrnm = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ? AND `value` = ?');
2356
+		         $getacdatausrnmres = $getacdatausrnm->execute(['displayname', $alwdusrvalue]);
2357
+		         $acdatausrname = $getacdatausrnmres->fetch();
2358
+                         if ($acdatausrname) {
2359
+                             $allwdusersfnl[] = $acdatausrname['uid'];
2360
+                         }
2361
+                         $getacdatausrnmres->closeCursor();
2362
+            }
2363
+
2364
+            // Get the users from all the allowed groups
2365
+            $allwdusersgrpmlt = [];
2366
+            foreach ($allwdgroupsunq as $prgrpkey => $prgrpvalue) {
2367
+
2368
+                     // Get all the users that belong to the current group, if the current group is different from 'admin'
2369
+                     if ($prgrpvalue != 'admin') {
2370
+                         $getusringroup = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
2371
+		         $getusringroupres = $getusringroup->execute([$prgrpvalue]);
2372
+
2373
+		         while ($getusrname = $getusringroupres->fetch()) {
2374
+
2375
+                                $allwdusersgrpmlt[] = $getusrname['uid'];
2376
+                         }
2377
+		         $getusringroupres->closeCursor();
2378
+                     }
2379
+            }
2380
+            $allwdusersgrpfnl = array_unique($allwdusersgrpmlt);
2381
+            
2382
+            $allusr = array_merge($allwdusersfnl, $allwdusersgrpfnl);
2383
+            $allusruniquest = array_unique($allusr);
2384
+
2385
+            if ($allusruniquest) {
2386
+                array_unshift($allusruniquest, $userId);
2387
+                $allusruniquegr = $allusruniquest;
2388
+            } else { $allusruniquegr = [$userId]; }
2389
+
2390
+            $allusruniquegrsec = "'" . implode("','", $allusruniquegr) . "'";
2391
+        }
2392
+
2393
+        // Get received messages
2394
+
2395
+        // If the user is an admin and he wants to see his messages and the messages of all the users with whom he shares his API keys
2396
+        if ($crsampref == 1 && $this->groupManager->isAdmin($userId)) {
2397
+
2398
+            $getrecmsgsres = $this->connection->executeQuery("
2399
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
2400
+			FROM `*PREFIX*sms_relent_received` WHERE `user_id` IN (" . $allusruniquegrsec . ")");
2401
+
2402
+        // If the user is an admin and he wants to see only his messages
2403
+        } elseif ($crsampref == 0 && $this->groupManager->isAdmin($userId)) {
2404
+
2405
+            $getrecmsgs = $this->connection->prepare('
2406
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
2407
+			FROM `*PREFIX*sms_relent_received` WHERE `user_id` = ?');
2408
+	    $getrecmsgsres = $getrecmsgs->execute([$userId]);
2409
+
2410
+        // If the user is not an admin 
2411
+        } elseif (!$this->groupManager->isAdmin($userId)) {
2412
+
2413
+	    // Get the Display Name of the current user
2414
+	    $getacdatadn = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `uid` = ? AND `name` = ?');
2415
+	    $getacdatadnres = $getacdatadn->execute([$userId, 'displayname']);
2416
+	    $acdatausrdnadm = $getacdatadnres->fetch();
2417
+	    $cruserdname = $acdatausrdnadm['value'];
2418
+	    $getacdatadnres->closeCursor();
2419
+
2420
+            // Get the groups to which the current user belongs
2421
+            $getusrgrp = $this->connection->prepare('
2422
+	          SELECT `gid`, `uid`
2423
+	          FROM  `*PREFIX*group_user`
2424
+                  WHERE `uid` = ?');
2425
+            $getusrgrpres = $getusrgrp->execute([$userId]);
2426
+
2427
+            $usergrps = [];
2428
+            while ($fetchedgrps = $getusrgrpres->fetch()) {
2429
+                   $usergrps[] = $fetchedgrps['gid'];
2430
+            }
2431
+            $getusrgrpres->closeCursor();
2432
+
2433
+            // Get the restrictions from the 'sms_relent_restrict' table
2434
+            $getrestr = $this->connection->prepare('
2435
+		        SELECT `phone_number`, `groups`, `users`
2436
+		        FROM  `*PREFIX*sms_relent_restrict`');
2437
+            $getrestrres = $getrestr->execute();
2438
+
2439
+            $restrdata = [];
2440
+            while ($restrfetched = $getrestrres->fetch()) {
2441
+                   $restrdata[] = $restrfetched;
2442
+            }
2443
+            $getrestrres->closeCursor();
2444
+
2445
+            // Get the phone numbers that the user is allowed/not allowed to use
2446
+            if ($restrdata) {
2447
+
2448
+                $restrPhoneNmbrs = [];
2449
+                $allowedPhoneNmbrs = [];
2450
+                foreach ($restrdata as $rskey => $rsvalue) {
2451
+
2452
+                         $chck = 0;
2453
+                         $restrgrparr = explode("|", $rsvalue['groups']);
2454
+                         foreach ($restrgrparr as $rkey => $rvalue) {
2455
+                                  if ($rvalue) {
2456
+                                      if (strpos(implode("|", $usergrps), $rvalue) !== false) { $chck++; }
2457
+                                  }
2458
+                         }
2459
+                         if (strpos($rsvalue['users'], $cruserdname) !== false) { $chck++; }
2460
+
2461
+                         if ($chck == 0) { 
2462
+                             $restrPhoneNmbrs[] = $rsvalue['phone_number']; 
2463
+                         }
2464
+                }
2465
+
2466
+		$allowedPhNmbrs = $this->getsmsnumbers($userId);
2467
+
2468
+		foreach ($allowedPhNmbrs as $apnkey => $apnvalue) {
2469
+			 $crphnmbr = explode(": ", $apnvalue);
2470
+			 if ($crphnmbr[0] == 'Tx') {
2471
+			     $allowedPhoneNmbrs[] = 'Telnyx: ' . $crphnmbr[1];
2472
+			 } elseif ($crphnmbr[0] == 'Pl') {
2473
+			     $allowedPhoneNmbrs[] = 'Plivo: ' . $crphnmbr[1];
2474
+			 } elseif ($crphnmbr[0] == 'Tw') {
2475
+			     $allowedPhoneNmbrs[] = 'Twilio: ' . $crphnmbr[1];
2476
+			 } elseif ($crphnmbr[0] == 'Fl') {
2477
+			     $allowedPhoneNmbrs[] = 'Flowroute: ' . $crphnmbr[1];
2478
+			 }
2479
+		}
2480
+
2481
+                $procalwduid = $allowedPhoneNmbrs;
2482
+                $procalwduidsec = "'" . implode("','", $procalwduid) . "'";
2483
+
2484
+                if ($procalwduidsec != "''") {
2485
+
2486
+                    $getrecmsgsres = $this->connection->executeQuery("
2487
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
2488
+			FROM `*PREFIX*sms_relent_received`
2489
+			WHERE `user_id` = '$userId' OR `to` IN (" . $procalwduidsec . ")");
2490
+
2491
+                } else {
2492
+	            $getrectable = $this->connection->prepare('
2493
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
2494
+			FROM `*PREFIX*sms_relent_received`
2495
+			WHERE `user_id` = ?');
2496
+	            $getrecmsgsres = $getrectable->execute([$userId]);
2497
+                }
2498
+
2499
+            } else {
2500
+
2501
+		$allowedPhNmbrs = $this->getsmsnumbers($userId);
2502
+
2503
+		foreach ($allowedPhNmbrs as $apnkey => $apnvalue) {
2504
+			 $crphnmbr = explode(": ", $apnvalue);
2505
+			 if ($crphnmbr[0] == 'Tx') {
2506
+			     $allowedPhoneNmbrs[] = 'Telnyx: ' . $crphnmbr[1];
2507
+			 } elseif ($crphnmbr[0] == 'Pl') {
2508
+			     $allowedPhoneNmbrs[] = 'Plivo: ' . $crphnmbr[1];
2509
+			 } elseif ($crphnmbr[0] == 'Tw') {
2510
+			     $allowedPhoneNmbrs[] = 'Twilio: ' . $crphnmbr[1];
2511
+			 } elseif ($crphnmbr[0] == 'Fl') {
2512
+			     $allowedPhoneNmbrs[] = 'Flowroute: ' . $crphnmbr[1];
2513
+			 }
2514
+		}
2515
+
2516
+                $procalwduid = $allowedPhoneNmbrs;
2517
+                $procalwduidsec = "'" . implode("','", $procalwduid) . "'";
2518
+
2519
+                if ($procalwduidsec != "''") {
2520
+
2521
+                    $getrecmsgsres = $this->connection->executeQuery("
2522
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
2523
+			FROM `*PREFIX*sms_relent_received`
2524
+			WHERE `user_id` = '$userId' OR `to` IN (" . $procalwduidsec . ")");
2525
+
2526
+                } else {
2527
+	            $getrectable = $this->connection->prepare('
2528
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
2529
+			FROM `*PREFIX*sms_relent_received`
2530
+			WHERE `user_id` = ?');
2531
+	            $getrecmsgsres = $getrectable->execute([$userId]);
2532
+                }
2533
+            }
2534
+        }
2535
+
2536
+        $recmsgs = [];
2537
+        while ($rcrowsfetch = $getrecmsgsres->fetch()) {
2538
+               $rcrowsfetch['deliveryreceipt'] = '';
2539
+               $rcrowsfetch['table'] = 'received';
2540
+               $recmsgs[] = $rcrowsfetch;
2541
+        }
2542
+	$getrecmsgsres->closeCursor();
2543
+
2544
+
2545
+        // Get sent messages
2546
+
2547
+        // If the user is an admin and he wants to see his messages and the messages of all the users with whom he shares his API keys
2548
+        if ($crsampref == 1 && $this->groupManager->isAdmin($userId)) {
2549
+
2550
+            $getsentmsgsres = $this->connection->executeQuery("
2551
+		       SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
2552
+		       FROM  `*PREFIX*sms_relent_sent` 
2553
+                       WHERE `user_id` IN (" . $allusruniquegrsec . ")");
2554
+
2555
+        // If the user is an admin and he wants to see only his messages
2556
+        } elseif ($crsampref == 0 && $this->groupManager->isAdmin($userId)) {
2557
+
2558
+            $getsentmsgs = $this->connection->prepare('
2559
+		       SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
2560
+		       FROM  `*PREFIX*sms_relent_sent`
2561
+		       WHERE `user_id` = ?');
2562
+            $getsentmsgsres = $getsentmsgs->execute([$userId]);
2563
+
2564
+        // If the user is not an admin 
2565
+        } elseif (!$this->groupManager->isAdmin($userId)) {
2566
+
2567
+            if ($restrdata) {
2568
+                if ($procalwduidsec != "''") {
2569
+
2570
+	            $getsentmsgsres = $this->connection->executeQuery("
2571
+		        SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
2572
+		        FROM  `*PREFIX*sms_relent_sent`
2573
+			WHERE `user_id` = '$userId' OR `from` IN (" . $procalwduidsec . ")");
2574
+
2575
+                } else {
2576
+                    $getsentmsgs = $this->connection->prepare('
2577
+		        SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
2578
+		        FROM  `*PREFIX*sms_relent_sent`
2579
+			WHERE `user_id` = ?');
2580
+	            $getsentmsgsres = $getsentmsgs->execute([$userId]);
2581
+                }
2582
+
2583
+            } else {
2584
+
2585
+                $getsentmsgs = $this->connection->prepare('
2586
+		       SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
2587
+		       FROM  `*PREFIX*sms_relent_sent`
2588
+		       WHERE `user_id` = ?');
2589
+                $getsentmsgsres = $getsentmsgs->execute([$userId]);
2590
+            }
2591
+        }
2592
+
2593
+
2594
+        $sentmsgs = [];
2595
+        while ($rowfetchedsmsg = $getsentmsgsres->fetch()) {
2596
+               $rowfetchedsmsg['table'] = 'sent';
2597
+               $sentmsgs[] = $rowfetchedsmsg;
2598
+        }
2599
+        $getsentmsgsres->closeCursor();
2600
+
2601
+        $groupedfromdb = array_merge($recmsgs, $sentmsgs);
2602
+
2603
+        if ($this->groupManager->isAdmin($userId)) {
2604
+
2605
+            return $groupedfromdb;
2606
+
2607
+        } else {
2608
+
2609
+            if ($restrdata) {
2610
+
2611
+                // Clean the phone numbers from tags
2612
+                $restrPhfin = [];
2613
+                foreach ($restrPhoneNmbrs as $phkey => $phvalue) {
2614
+
2615
+                    $restrpharr = explode(": ", $phvalue);
2616
+                    $restrPhfin[] = $restrpharr[1];
2617
+                }
2618
+
2619
+                // Assemble the array of message rows that excludes the rows for the restricted phone numbers
2620
+                foreach ($groupedfromdb as $gmdkey => $gmdvalue) {
2621
+
2622
+                         if ($gmdvalue['table'] == 'sent') {
2623
+
2624
+                             if (str_contains($gmdvalue['from'], "+")) {
2625
+                                 $fromnmbrarr = explode("+", $gmdvalue['from']);
2626
+                                 if (in_array("+" . $fromnmbrarr[1], $restrPhfin)) {
2627
+                                     unset($groupedfromdb[$gmdkey]);
2628
+                                 }
2629
+                             } else {
2630
+                                 $frmnmbrarr = explode(": ", $gmdvalue['from']);
2631
+                                 if (count($frmnmbrarr) == 2) {
2632
+                                     $nmbtbcmprd = $frmnmbrarr[1];
2633
+                                 } else { 
2634
+                                     $nmbtbcmprd = $frmnmbrarr[0];
2635
+                                 }
2636
+                                 if (in_array($nmbtbcmprd, $restrPhfin)) {
2637
+                                     unset($groupedfromdb[$gmdkey]);
2638
+                                 }
2639
+                             }
2640
+
2641
+                         } elseif ($gmdvalue['table'] == 'received') {
2642
+
2643
+                             if (str_contains($gmdvalue['to'], "+")) {
2644
+                                 $fromnmbrarr = explode("+", $gmdvalue['to']);
2645
+                                 if (in_array("+" . $fromnmbrarr[1], $restrPhfin)) {
2646
+                                     unset($groupedfromdb[$gmdkey]);
2647
+                                 }
2648
+                             } else {
2649
+                                 $tonmbrarr = explode(": ", $gmdvalue['to']);
2650
+                                 if (count($tonmbrarr) == 2) {
2651
+                                     $tonmbrtbcmprd = $tonmbrarr[1];
2652
+                                 } else {
2653
+                                     $tonmbrtbcmprd = $tonmbrarr[0];
2654
+                                 }
2655
+                                 if (in_array($tonmbrtbcmprd, $restrPhfin)) {
2656
+                                     unset($groupedfromdb[$gmdkey]);
2657
+                                 }
2658
+                             }
2659
+                         }
2660
+
2661
+                }
2662
+
2663
+                $groupedfdbproc = array_values($groupedfromdb);
2664
+
2665
+                return $groupedfdbproc;
2666
+
2667
+            } else { return $groupedfromdb; }
2668
+        }
2669
+     }
2670
+
2671
+
2672
+     /**
2673
+      * @NoAdminRequired
2674
+      */
2675
+     public function getgroupedpernumber($userId, $phoneNumber) {
2676
+
2677
+        $phoneNumberpr = "%" . $phoneNumber;
2678
+
2679
+        // Get the user's preferences from the settings
2680
+        $getpref = $this->connection->prepare('
2681
+		       SELECT `user_id`, `show_all_messages`
2682
+		       FROM  `*PREFIX*sms_relent_settings` WHERE `user_id` = ?');
2683
+        $getprefres = $getpref->execute([$userId]);
2684
+        $getprefresdata = $getprefres->fetch();
2685
+        $crsampref = $getprefresdata['show_all_messages'];
2686
+        $getprefres->closeCursor();
2687
+
2688
+
2689
+        // Collect the users with whom the current admin is sharing his API keys and whose messages he will be able to see
2690
+        if ($crsampref == 1 && $this->groupManager->isAdmin($userId)) {
2691
+
2692
+            // Get the groups and users that were allowed access to the API keys
2693
+            $getgrps = $this->connection->prepare('SELECT `user_id`, `tnx_groups_allowed`, `tnx_users_allowed`, `plv_groups_allowed`, `plv_users_allowed`,
2694
+                                                  `twl_groups_allowed`, `twl_users_allowed`, `flr_groups_allowed`, `flr_users_allowed` FROM `*PREFIX*sms_relent_subac`
2695
+                                                   WHERE `user_id` = ?');
2696
+            $getgrpsres = $getgrps->execute([$userId]);
2697
+            $getgrpsusr = $getgrpsres->fetch();
2698
+            $getgrpsres->closeCursor();
2699
+
2700
+            if ($getgrpsusr) {
2701
+
2702
+                if ($getgrpsusr['tnx_users_allowed']) { $tnxusers = explode("|", $getgrpsusr['tnx_users_allowed']); } else { $tnxusers = []; }
2703
+                if ($getgrpsusr['plv_users_allowed']) { $plvusers = explode("|", $getgrpsusr['plv_users_allowed']); } else { $plvusers = []; }
2704
+                if ($getgrpsusr['twl_users_allowed']) { $twlusers = explode("|", $getgrpsusr['twl_users_allowed']); } else { $twlusers = []; }
2705
+                if ($getgrpsusr['flr_users_allowed']) { $flrusers = explode("|", $getgrpsusr['flr_users_allowed']); } else { $flrusers = []; }
2706
+
2707
+                $allwdusersarr = array_merge($tnxusers, $plvusers, $twlusers, $flrusers);
2708
+                $allwdusersunq = array_filter(array_unique($allwdusersarr));
2709
+
2710
+                if ($getgrpsusr['tnx_groups_allowed']) { $tnxgroups = explode("|", $getgrpsusr['tnx_groups_allowed']); } else { $tnxgroups = []; }
2711
+                if ($getgrpsusr['plv_groups_allowed']) { $plvgroups = explode("|", $getgrpsusr['plv_groups_allowed']); } else { $plvgroups = []; }
2712
+                if ($getgrpsusr['twl_groups_allowed']) { $twlgroups = explode("|", $getgrpsusr['twl_groups_allowed']); } else { $twlgroups = []; }
2713
+                if ($getgrpsusr['flr_groups_allowed']) { $flrgroups = explode("|", $getgrpsusr['flr_groups_allowed']); } else { $flrgroups = []; }
2714
+
2715
+                $allwdgroupsarr = array_merge($tnxgroups, $plvgroups, $twlgroups, $flrgroups);
2716
+                $allwdgroupsunq = array_filter(array_unique($allwdgroupsarr));
2717
+
2718
+            } else {
2719
+                $allwdusersunq = [];
2720
+                $allwdgroupsunq = [];
2721
+            }
2722
+
2723
+            // Get the username for each Display Name of the allowed users
2724
+            $allwdusersfnl = [];
2725
+            foreach ($allwdusersunq as $alwdusrkey => $alwdusrvalue) {
2726
+
2727
+                         $getacdatausrnm = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ? AND `value` = ?');
2728
+		         $getacdatausrnmres = $getacdatausrnm->execute(['displayname', $alwdusrvalue]);
2729
+		         $acdatausrname = $getacdatausrnmres->fetch();
2730
+                         if ($acdatausrname) {
2731
+                             $allwdusersfnl[] = $acdatausrname['uid'];
2732
+                         }
2733
+                         $getacdatausrnmres->closeCursor();
2734
+            }
2735
+
2736
+            // Get the users from all the allowed groups
2737
+            $allwdusersgrpmlt = [];
2738
+            foreach ($allwdgroupsunq as $prgrpkey => $prgrpvalue) {
2739
+
2740
+                     // Get all the users that belong to the current group, if the current group is different from 'admin'
2741
+                     if ($prgrpvalue != 'admin') {
2742
+                         $getusringroup = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
2743
+		         $getusringroupres = $getusringroup->execute([$prgrpvalue]);
2744
+
2745
+		         while ($getusrname = $getusringroupres->fetch()) {
2746
+
2747
+                                $allwdusersgrpmlt[] = $getusrname['uid'];
2748
+                         }
2749
+		         $getusringroupres->closeCursor();
2750
+                     }
2751
+            }
2752
+            $allwdusersgrpfnl = array_unique($allwdusersgrpmlt);
2753
+            
2754
+            $allusr = array_merge($allwdusersfnl, $allwdusersgrpfnl);
2755
+            $allusruniquest = array_unique($allusr);
2756
+
2757
+            if ($allusruniquest) {
2758
+                array_unshift($allusruniquest, $userId);
2759
+                $allusruniquepn = $allusruniquest;
2760
+            } else { $allusruniquepn = [$userId]; }
2761
+
2762
+            $allusruniquepnst = $allusruniquepn;
2763
+
2764
+            $procardatapn = "'" . implode("','", $allusruniquepn) . "'";
2765
+
2766
+            array_unshift($allusruniquepn, $phoneNumber, $phoneNumberpr);
2767
+            $allusruniquead = $allusruniquepn;
2768
+
2769
+            array_unshift($allusruniquepnst, $phoneNumberpr, $phoneNumber);
2770
+            $allusruniqueadst = $allusruniquepnst;
2771
+        }
2772
+
2773
+
2774
+        // Get received messages
2775
+
2776
+        // If the user is an admin and he wants to see his messages and the messages of all the users with whom he shares his API keys
2777
+        if ($crsampref == 1 && $this->groupManager->isAdmin($userId)) {
2778
+
2779
+	    $getrecmsgsres = $this->connection->executeQuery("
2780
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
2781
+			FROM `*PREFIX*sms_relent_received` 
2782
+                        WHERE (`from` = '$phoneNumber' OR `to` LIKE '$phoneNumberpr') AND `user_id` IN (" . $procardatapn . ")");
2783
+
2784
+        // If the user is an admin and he wants to see only his messages
2785
+        } elseif ($crsampref == 0 && $this->groupManager->isAdmin($userId)) {
2786
+
2787
+            $getrecmsgs = $this->connection->prepare('
2788
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
2789
+			FROM `*PREFIX*sms_relent_received` 
2790
+                        WHERE `user_id` = ? AND (`from` = ? OR `to` LIKE ?)');
2791
+	    $getrecmsgsres = $getrecmsgs->execute([$userId, $phoneNumber, $phoneNumberpr]);
2792
+
2793
+        // If the user is not an admin 
2794
+        } elseif (!$this->groupManager->isAdmin($userId)) {
2795
+
2796
+	    // Get the Display Name of the current user
2797
+	    $getacdatadn = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `uid` = ? AND `name` = ?');
2798
+	    $getacdatadnres = $getacdatadn->execute([$userId, 'displayname']);
2799
+	    $acdatausrdnadm = $getacdatadnres->fetch();
2800
+	    $cruserdname = $acdatausrdnadm['value'];
2801
+	    $getacdatadnres->closeCursor();
2802
+
2803
+            // Get the groups to which the current user belongs
2804
+            $getusrgrp = $this->connection->prepare('
2805
+	          SELECT `gid`, `uid`
2806
+	          FROM  `*PREFIX*group_user`
2807
+                  WHERE `uid` = ?');
2808
+            $getusrgrpres = $getusrgrp->execute([$userId]);
2809
+
2810
+            $usergrps = [];
2811
+            while ($fetchedgrps = $getusrgrpres->fetch()) {
2812
+                   $usergrps[] = $fetchedgrps['gid'];
2813
+            }
2814
+            $getusrgrpres->closeCursor();
2815
+
2816
+            // Get the restrictions from the 'sms_relent_restrict' table
2817
+            $getrestr = $this->connection->prepare('
2818
+		       SELECT `phone_number`, `groups`, `users`
2819
+		       FROM  `*PREFIX*sms_relent_restrict`');
2820
+            $getrestrres = $getrestr->execute();
2821
+
2822
+            $restrdata = [];
2823
+            while ($restrfetched = $getrestrres->fetch()) {
2824
+                   $restrdata[] = $restrfetched;
2825
+            }
2826
+            $getrestrres->closeCursor();
2827
+
2828
+            // Get the phone numbers that the user is allowed/not allowed to use
2829
+            if ($restrdata) {
2830
+
2831
+                $restrPhoneNmbrs = [];
2832
+                $allowedPhoneNmbrs = [];
2833
+                foreach ($restrdata as $rskey => $rsvalue) {
2834
+
2835
+                         $chck = 0;
2836
+                         $restrgrparr = explode("|", $rsvalue['groups']);
2837
+                         foreach ($restrgrparr as $rkey => $rvalue) {
2838
+                                  if ($rvalue) {
2839
+                                      if (strpos(implode("|", $usergrps), $rvalue) !== false) { $chck++; }
2840
+                                  }
2841
+                         }
2842
+                         if (strpos($rsvalue['users'], $cruserdname) !== false) { $chck++; }
2843
+
2844
+                         if ($chck == 0) { 
2845
+                             $restrPhoneNmbrs[] = $rsvalue['phone_number']; 
2846
+                         }
2847
+                }
2848
+
2849
+		$allowedPhNmbrs = $this->getsmsnumbers($userId);
2850
+
2851
+		foreach ($allowedPhNmbrs as $apnkey => $apnvalue) {
2852
+			 $crphnmbr = explode(": ", $apnvalue);
2853
+			 if ($crphnmbr[0] == 'Tx') {
2854
+			     $allowedPhoneNmbrs[] = 'Telnyx: ' . $crphnmbr[1];
2855
+			 } elseif ($crphnmbr[0] == 'Pl') {
2856
+			     $allowedPhoneNmbrs[] = 'Plivo: ' . $crphnmbr[1];
2857
+			 } elseif ($crphnmbr[0] == 'Tw') {
2858
+			     $allowedPhoneNmbrs[] = 'Twilio: ' . $crphnmbr[1];
2859
+			 } elseif ($crphnmbr[0] == 'Fl') {
2860
+			     $allowedPhoneNmbrs[] = 'Flowroute: ' . $crphnmbr[1];
2861
+			 }
2862
+		}
2863
+
2864
+                $allowedPhoneNmbrscp = $allowedPhoneNmbrs;
2865
+
2866
+                $procalwdphnmbrs = "'" . implode("','", $allowedPhoneNmbrs) . "'";
2867
+
2868
+                if ($procalwdphnmbrs != "''") {
2869
+
2870
+	            $getrecmsgsres = $this->connection->executeQuery("
2871
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
2872
+			FROM `*PREFIX*sms_relent_received`
2873
+			WHERE (`user_id` = '$userId' OR `to` IN (" . $procalwdphnmbrs . ")) AND (`from` = '$phoneNumber' OR `to` LIKE '$phoneNumberpr')");
2874
+
2875
+                } else {
2876
+	            $getrecmsgs = $this->connection->prepare('
2877
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
2878
+			FROM `*PREFIX*sms_relent_received`
2879
+			WHERE `user_id` = ? AND (`from` = ? OR `to` LIKE ?)');
2880
+	            $getrecmsgsres = $getrecmsgs->execute([$userId, $phoneNumber, $phoneNumberpr]);
2881
+                }
2882
+
2883
+            } else {
2884
+
2885
+		$allowedPhNmbrs = $this->getsmsnumbers($userId);
2886
+
2887
+		foreach ($allowedPhNmbrs as $apnkey => $apnvalue) {
2888
+			 $crphnmbr = explode(": ", $apnvalue);
2889
+			 if ($crphnmbr[0] == 'Tx') {
2890
+			     $allowedPhoneNmbrs[] = 'Telnyx: ' . $crphnmbr[1];
2891
+			 } elseif ($crphnmbr[0] == 'Pl') {
2892
+			     $allowedPhoneNmbrs[] = 'Plivo: ' . $crphnmbr[1];
2893
+			 } elseif ($crphnmbr[0] == 'Tw') {
2894
+			     $allowedPhoneNmbrs[] = 'Twilio: ' . $crphnmbr[1];
2895
+			 } elseif ($crphnmbr[0] == 'Fl') {
2896
+			     $allowedPhoneNmbrs[] = 'Flowroute: ' . $crphnmbr[1];
2897
+			 }
2898
+		}
2899
+
2900
+                $allowedPhoneNmbrscp = $allowedPhoneNmbrs;
2901
+
2902
+                $procalwdphnmbrs = "'" . implode("','", $allowedPhoneNmbrs) . "'";
2903
+
2904
+                if ($procalwdphnmbrs != "''") {
2905
+
2906
+	            $getrecmsgsres = $this->connection->executeQuery("
2907
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
2908
+			FROM `*PREFIX*sms_relent_received`
2909
+			WHERE (`user_id` = '$userId' OR `to` IN (" . $procalwdphnmbrs . ")) AND (`from` = '$phoneNumber' OR `to` LIKE '$phoneNumberpr')");
2910
+
2911
+                } else {
2912
+	            $getrecmsgs = $this->connection->prepare('
2913
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
2914
+			FROM `*PREFIX*sms_relent_received`
2915
+			WHERE `user_id` = ? AND (`from` = ? OR `to` LIKE ?)');
2916
+	            $getrecmsgsres = $getrecmsgs->execute([$userId, $phoneNumber, $phoneNumberpr]);
2917
+                }
2918
+            }
2919
+        }
2920
+
2921
+
2922
+        $recmsgs = [];
2923
+        while ($rcrowsfetch = $getrecmsgsres->fetch()) {
2924
+               $rcrowsfetch['deliveryreceipt'] = '';
2925
+               $rcrowsfetch['table'] = 'received';
2926
+               $recmsgs[] = $rcrowsfetch;
2927
+        }
2928
+	$getrecmsgsres->closeCursor();
2929
+
2930
+
2931
+        // Get sent messages
2932
+
2933
+        // If the user is an admin and he wants to see his messages and the messages of all the users with whom he shares his API keys
2934
+        if ($crsampref == 1 && $this->groupManager->isAdmin($userId)) {
2935
+
2936
+            $getsentmsgsres = $this->connection->executeQuery("
2937
+		       SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
2938
+		       FROM  `*PREFIX*sms_relent_sent` 
2939
+                       WHERE (`from` LIKE '$phoneNumberpr' OR `to` = '$phoneNumber') AND `user_id` IN (" . $procardatapn . ")");
2940
+
2941
+        // If the user is an admin and he wants to see only his messages
2942
+        } elseif ($crsampref == 0 && $this->groupManager->isAdmin($userId)) {
2943
+
2944
+            $getsentmsgs = $this->connection->prepare('
2945
+		       SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
2946
+		       FROM  `*PREFIX*sms_relent_sent`
2947
+		       WHERE `user_id` = ? AND (`from` LIKE ? OR `to` = ?)');
2948
+            $getsentmsgsres = $getsentmsgs->execute([$userId, $phoneNumberpr, $phoneNumber]);
2949
+
2950
+
2951
+        // If the user is not an admin 
2952
+        } elseif (!$this->groupManager->isAdmin($userId)) {
2953
+
2954
+            if ($restrdata) {
2955
+                if ($procalwdphnmbrs != "''") {
2956
+
2957
+                    $getsentmsgsres = $this->connection->executeQuery("
2958
+		        SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
2959
+		        FROM  `*PREFIX*sms_relent_sent`
2960
+			WHERE (`user_id` = '$userId' OR `from` IN (" . $procalwdphnmbrs . ")) AND (`from` LIKE '$phoneNumberpr' OR `to` = '$phoneNumber')");
2961
+
2962
+                } else {
2963
+                    $getsentmsgs = $this->connection->prepare('
2964
+		        SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
2965
+		        FROM  `*PREFIX*sms_relent_sent`
2966
+			WHERE `user_id` = ? AND (`from` LIKE ? OR `to` = ?)');
2967
+	            $getsentmsgsres = $getsentmsgs->execute([$userId, $phoneNumberpr, $phoneNumber]);
2968
+                }
2969
+
2970
+            } else {
2971
+
2972
+                $getsentmsgs = $this->connection->prepare('
2973
+		       SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
2974
+		       FROM  `*PREFIX*sms_relent_sent`
2975
+		       WHERE `user_id` = ? AND (`from` LIKE ? OR `to` = ?)');
2976
+                $getsentmsgsres = $getsentmsgs->execute([$userId, $phoneNumberpr, $phoneNumber]);
2977
+            }
2978
+        }
2979
+
2980
+        $sentmsgs = [];
2981
+        while ($rowfetchedsmsg = $getsentmsgsres->fetch()) {
2982
+               $rowfetchedsmsg['table'] = 'sent';
2983
+               $sentmsgs[] = $rowfetchedsmsg;
2984
+        }
2985
+        $getsentmsgsres->closeCursor();
2986
+
2987
+        $groupedpernb = array_merge($recmsgs, $sentmsgs);
2988
+
2989
+        if ($this->groupManager->isAdmin($userId)) {
2990
+
2991
+            return $groupedpernb;
2992
+
2993
+        } else {
2994
+
2995
+            if ($restrdata) {
2996
+
2997
+                // Clean the phone numbers from tags
2998
+                $restrPhfin = [];
2999
+                foreach ($restrPhoneNmbrs as $phkey => $phvalue) {
3000
+
3001
+                    $restrpharr = explode(": ", $phvalue);
3002
+                    $restrPhfin[] = $restrpharr[1];
3003
+                }
3004
+
3005
+                // Assemble the array of message rows that excludes the rows for the restricted phone numbers
3006
+                foreach ($groupedpernb as $gmdkey => $gmdvalue) {
3007
+
3008
+                         if ($gmdvalue['table'] == 'sent') {
3009
+
3010
+                             if (str_contains($gmdvalue['from'], "+")) {
3011
+                                 $fromnmbrarr = explode("+", $gmdvalue['from']);
3012
+                                 if (in_array("+" . $fromnmbrarr[1], $restrPhfin)) {
3013
+                                     unset($groupedpernb[$gmdkey]);
3014
+                                 }
3015
+                             } else {
3016
+                                 $frmnmbrarr = explode(": ", $gmdvalue['from']);
3017
+                                 if (count($frmnmbrarr) == 2) {
3018
+                                     $nmbtbcmprd = $frmnmbrarr[1];
3019
+                                 } else { 
3020
+                                     $nmbtbcmprd = $frmnmbrarr[0];
3021
+                                 }
3022
+                                 if (in_array($nmbtbcmprd, $restrPhfin)) {
3023
+                                     unset($groupedpernb[$gmdkey]);
3024
+                                 }
3025
+                             }
3026
+
3027
+                         } elseif ($gmdvalue['table'] == 'received') {
3028
+
3029
+                             if (str_contains($gmdvalue['to'], "+")) {
3030
+                                 $fromnmbrarr = explode("+", $gmdvalue['to']);
3031
+                                 if (in_array("+" . $fromnmbrarr[1], $restrPhfin)) {
3032
+                                     unset($groupedpernb[$gmdkey]);
3033
+                                 }
3034
+                             } else {
3035
+                                 $tonmbrarr = explode(": ", $gmdvalue['to']);
3036
+                                 if (count($tonmbrarr) == 2) {
3037
+                                     $tonmbrtbcmprd = $tonmbrarr[1];
3038
+                                 } else {
3039
+                                     $tonmbrtbcmprd = $tonmbrarr[0];
3040
+                                 }
3041
+                                 if (in_array($tonmbrtbcmprd, $restrPhfin)) {
3042
+                                     unset($groupedpernb[$gmdkey]);
3043
+                                 }
3044
+                             }
3045
+                         }
3046
+
3047
+                }
3048
+
3049
+                $groupedpernbprc = array_values($groupedpernb);
3050
+
3051
+                return $groupedpernbprc;
3052
+
3053
+            } else { return $groupedpernb; }
3054
+        }
3055
+     }
3056
+
3057
+
3058
+     /**
3059
+      * @NoAdminRequired
3060
+      */
3061
+     public function getgroupedforreply($userId, $phoneNmbrFrom, $phoneNmbrTo) {
3062
+
3063
+        $phoneNmbrFrompr = "%" . $phoneNmbrFrom;
3064
+        $phoneNmbrTopr = "%" . $phoneNmbrTo;
3065
+
3066
+        // Get the user's preferences from the settings
3067
+        $getpref = $this->connection->prepare('
3068
+		       SELECT `user_id`, `show_all_messages`
3069
+		       FROM  `*PREFIX*sms_relent_settings` WHERE `user_id` = ?');
3070
+        $getprefres = $getpref->execute([$userId]);
3071
+        $getprefresdata = $getprefres->fetch();
3072
+        $crsampref = $getprefresdata['show_all_messages'];
3073
+        $getprefres->closeCursor();
3074
+
3075
+
3076
+        // Collect the users with whom the current admin is sharing his API keys and whose messages he will be able to see
3077
+        if ($crsampref == 1 && $this->groupManager->isAdmin($userId)) {
3078
+
3079
+            // Get the groups and users that were allowed access to the API keys
3080
+            $getgrps = $this->connection->prepare('SELECT `user_id`, `tnx_groups_allowed`, `tnx_users_allowed`, `plv_groups_allowed`, `plv_users_allowed`,
3081
+                                                  `twl_groups_allowed`, `twl_users_allowed`, `flr_groups_allowed`, `flr_users_allowed` FROM `*PREFIX*sms_relent_subac`
3082
+                                                   WHERE `user_id` = ?');
3083
+            $getgrpsres = $getgrps->execute([$userId]);
3084
+            $getgrpsusr = $getgrpsres->fetch();
3085
+            $getgrpsres->closeCursor();
3086
+
3087
+            if ($getgrpsusr) {
3088
+
3089
+                if ($getgrpsusr['tnx_users_allowed']) { $tnxusers = explode("|", $getgrpsusr['tnx_users_allowed']); } else { $tnxusers = []; }
3090
+                if ($getgrpsusr['plv_users_allowed']) { $plvusers = explode("|", $getgrpsusr['plv_users_allowed']); } else { $plvusers = []; }
3091
+                if ($getgrpsusr['twl_users_allowed']) { $twlusers = explode("|", $getgrpsusr['twl_users_allowed']); } else { $twlusers = []; }
3092
+                if ($getgrpsusr['flr_users_allowed']) { $flrusers = explode("|", $getgrpsusr['flr_users_allowed']); } else { $flrusers = []; }
3093
+
3094
+                $allwdusersarr = array_merge($tnxusers, $plvusers, $twlusers, $flrusers);
3095
+                $allwdusersunq = array_filter(array_unique($allwdusersarr));
3096
+
3097
+                if ($getgrpsusr['tnx_groups_allowed']) { $tnxgroups = explode("|", $getgrpsusr['tnx_groups_allowed']); } else { $tnxgroups = []; }
3098
+                if ($getgrpsusr['plv_groups_allowed']) { $plvgroups = explode("|", $getgrpsusr['plv_groups_allowed']); } else { $plvgroups = []; }
3099
+                if ($getgrpsusr['twl_groups_allowed']) { $twlgroups = explode("|", $getgrpsusr['twl_groups_allowed']); } else { $twlgroups = []; }
3100
+                if ($getgrpsusr['flr_groups_allowed']) { $flrgroups = explode("|", $getgrpsusr['flr_groups_allowed']); } else { $flrgroups = []; }
3101
+
3102
+                $allwdgroupsarr = array_merge($tnxgroups, $plvgroups, $twlgroups, $flrgroups);
3103
+                $allwdgroupsunq = array_filter(array_unique($allwdgroupsarr));
3104
+
3105
+            } else {
3106
+                $allwdusersunq = [];
3107
+                $allwdgroupsunq = [];
3108
+            }
3109
+
3110
+            // Get the username for each Display Name of the allowed users
3111
+            $allwdusersfnl = [];
3112
+            foreach ($allwdusersunq as $alwdusrkey => $alwdusrvalue) {
3113
+
3114
+                         $getacdatausrnm = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ? AND `value` = ?');
3115
+		         $getacdatausrnmres = $getacdatausrnm->execute(['displayname', $alwdusrvalue]);
3116
+		         $acdatausrname = $getacdatausrnmres->fetch();
3117
+                         if ($acdatausrname) {
3118
+                             $allwdusersfnl[] = $acdatausrname['uid'];
3119
+                         }
3120
+                         $getacdatausrnmres->closeCursor();
3121
+            }
3122
+
3123
+            // Get the users from all the allowed groups
3124
+            $allwdusersgrpmlt = [];
3125
+            foreach ($allwdgroupsunq as $prgrpkey => $prgrpvalue) {
3126
+
3127
+                     // Get all the users that belong to the current group, if the current group is different from 'admin'
3128
+                     if ($prgrpvalue != 'admin') {
3129
+                         $getusringroup = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
3130
+		         $getusringroupres = $getusringroup->execute([$prgrpvalue]);
3131
+
3132
+		         while ($getusrname = $getusringroupres->fetch()) {
3133
+
3134
+                                $allwdusersgrpmlt[] = $getusrname['uid'];
3135
+                         }
3136
+		         $getusringroupres->closeCursor();
3137
+                     }
3138
+            }
3139
+            $allwdusersgrpfnl = array_unique($allwdusersgrpmlt);
3140
+            
3141
+            $allusr = array_merge($allwdusersfnl, $allwdusersgrpfnl);
3142
+            $allusruniquest = array_unique($allusr);
3143
+
3144
+            if ($allusruniquest) {
3145
+                array_unshift($allusruniquest, $userId);
3146
+                $allusruniquerp = $allusruniquest;
3147
+            } else { $allusruniquerp = [$userId]; }
3148
+
3149
+            $allusruniquerpst = $allusruniquerp;
3150
+
3151
+            $procardatarp = "'" . implode("','", $allusruniquerp) . "'";
3152
+        }
3153
+
3154
+
3155
+        // Get received messages
3156
+
3157
+        // If the user is an admin and he wants to see his messages and the messages of all the users with whom he shares his API keys
3158
+        if ($crsampref == 1 && $this->groupManager->isAdmin($userId)) {
3159
+
3160
+            $getrecmsgsres = $this->connection->executeQuery("
3161
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
3162
+			FROM `*PREFIX*sms_relent_received` 
3163
+                        WHERE ((`from` = '$phoneNmbrFrom' AND `to` LIKE '$phoneNmbrTopr') OR (`from` = '$phoneNmbrTo' AND `to` LIKE '$phoneNmbrFrompr')) AND 
3164
+                        `user_id` IN (" . $procardatarp . ")");
3165
+
3166
+        // If the user is an admin and he wants to see only his messages
3167
+        } elseif ($crsampref == 0 && $this->groupManager->isAdmin($userId)) {
3168
+
3169
+            $getrecmsgs = $this->connection->prepare('
3170
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
3171
+			FROM  `*PREFIX*sms_relent_received`
3172
+			WHERE `user_id` = ? AND ((`from` = ? AND `to` LIKE ?) OR (`from` = ? AND `to` LIKE ?))');
3173
+	    $getrecmsgsres = $getrecmsgs->execute([$userId, $phoneNmbrFrom, $phoneNmbrTopr, $phoneNmbrTo, $phoneNmbrFrompr]);
3174
+
3175
+        // If the user is not an admin 
3176
+        } elseif (!$this->groupManager->isAdmin($userId)) {
3177
+
3178
+	    // Get the Display Name of the current user
3179
+	    $getacdatadn = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `uid` = ? AND `name` = ?');
3180
+	    $getacdatadnres = $getacdatadn->execute([$userId, 'displayname']);
3181
+	    $acdatausrdnadm = $getacdatadnres->fetch();
3182
+	    $cruserdname = $acdatausrdnadm['value'];
3183
+	    $getacdatadnres->closeCursor();
3184
+
3185
+            // Get the groups to which the current user belongs
3186
+            $getusrgrp = $this->connection->prepare('
3187
+	          SELECT `gid`, `uid`
3188
+	          FROM  `*PREFIX*group_user`
3189
+                  WHERE `uid` = ?');
3190
+            $getusrgrpres = $getusrgrp->execute([$userId]);
3191
+
3192
+            $usergrps = [];
3193
+            while ($fetchedgrps = $getusrgrpres->fetch()) {
3194
+                   $usergrps[] = $fetchedgrps['gid'];
3195
+            }
3196
+            $getusrgrpres->closeCursor();
3197
+
3198
+            // Get the restrictions from the 'sms_relent_restrict' table
3199
+            $getrestr = $this->connection->prepare('
3200
+		       SELECT `phone_number`, `groups`, `users`
3201
+		       FROM  `*PREFIX*sms_relent_restrict`');
3202
+            $getrestrres = $getrestr->execute();
3203
+
3204
+            $restrdata = [];
3205
+            while ($restrfetched = $getrestrres->fetch()) {
3206
+                   $restrdata[] = $restrfetched;
3207
+            }
3208
+            $getrestrres->closeCursor();
3209
+
3210
+            // Get the phone numbers that the user is allowed/not allowed to use
3211
+            if ($restrdata) {
3212
+
3213
+                $restrPhoneNmbrs = [];
3214
+                $allowedPhoneNmbrs = [];
3215
+                foreach ($restrdata as $rskey => $rsvalue) {
3216
+
3217
+                         $chck = 0;
3218
+                         $restrgrparr = explode("|", $rsvalue['groups']);
3219
+                         foreach ($restrgrparr as $rkey => $rvalue) {
3220
+                                  if ($rvalue) {
3221
+                                      if (strpos(implode("|", $usergrps), $rvalue) !== false) { $chck++; }
3222
+                                  }
3223
+                         }
3224
+                         if (strpos($rsvalue['users'], $cruserdname) !== false) { $chck++; }
3225
+
3226
+                         if ($chck == 0) { 
3227
+                             $restrPhoneNmbrs[] = $rsvalue['phone_number']; 
3228
+                         }
3229
+                }
3230
+
3231
+		$allowedPhNmbrs = $this->getsmsnumbers($userId);
3232
+
3233
+		foreach ($allowedPhNmbrs as $apnkey => $apnvalue) {
3234
+			 $crphnmbr = explode(": ", $apnvalue);
3235
+			 if ($crphnmbr[0] == 'Tx') {
3236
+			     $allowedPhoneNmbrs[] = 'Telnyx: ' . $crphnmbr[1];
3237
+			 } elseif ($crphnmbr[0] == 'Pl') {
3238
+			     $allowedPhoneNmbrs[] = 'Plivo: ' . $crphnmbr[1];
3239
+			 } elseif ($crphnmbr[0] == 'Tw') {
3240
+			     $allowedPhoneNmbrs[] = 'Twilio: ' . $crphnmbr[1];
3241
+			 } elseif ($crphnmbr[0] == 'Fl') {
3242
+			     $allowedPhoneNmbrs[] = 'Flowroute: ' . $crphnmbr[1];
3243
+			 }
3244
+		}
3245
+
3246
+                $allowedPhoneNmbrscpr = $allowedPhoneNmbrs;
3247
+
3248
+                $procalwdphnmbrs = "'" . implode("','", $allowedPhoneNmbrs) . "'";
3249
+
3250
+                if ($procalwdphnmbrs != "''") {
3251
+
3252
+                    $getrecmsgsres = $this->connection->executeQuery("
3253
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
3254
+			FROM `*PREFIX*sms_relent_received`
3255
+			WHERE (`user_id` = '$userId' OR `to` IN (" . $procalwdphnmbrs . ")) AND ((`from` = '$phoneNmbrFrom' AND `to` LIKE '$phoneNmbrTopr') OR (`from` = '$phoneNmbrTo' 
3256
+                                AND `to` LIKE '$phoneNmbrFrompr'))");
3257
+
3258
+                } else {
3259
+	            $getrecmsgs = $this->connection->prepare('
3260
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
3261
+			FROM `*PREFIX*sms_relent_received`
3262
+			WHERE `user_id` = ? AND ((`from` = ? AND `to` LIKE ?) OR (`from` = ? AND `to` LIKE ?))');
3263
+	            $getrecmsgsres = $getrecmsgs->execute([$userId, $phoneNmbrFrom, $phoneNmbrTopr, $phoneNmbrTo, $phoneNmbrFrompr]);
3264
+                }
3265
+
3266
+            } else {
3267
+
3268
+		$allowedPhNmbrs = $this->getsmsnumbers($userId);
3269
+
3270
+		foreach ($allowedPhNmbrs as $apnkey => $apnvalue) {
3271
+			 $crphnmbr = explode(": ", $apnvalue);
3272
+			 if ($crphnmbr[0] == 'Tx') {
3273
+			     $allowedPhoneNmbrs[] = 'Telnyx: ' . $crphnmbr[1];
3274
+			 } elseif ($crphnmbr[0] == 'Pl') {
3275
+			     $allowedPhoneNmbrs[] = 'Plivo: ' . $crphnmbr[1];
3276
+			 } elseif ($crphnmbr[0] == 'Tw') {
3277
+			     $allowedPhoneNmbrs[] = 'Twilio: ' . $crphnmbr[1];
3278
+			 } elseif ($crphnmbr[0] == 'Fl') {
3279
+			     $allowedPhoneNmbrs[] = 'Flowroute: ' . $crphnmbr[1];
3280
+			 }
3281
+		}
3282
+
3283
+                $allowedPhoneNmbrscpr = $allowedPhoneNmbrs;
3284
+
3285
+                $procalwdphnmbrs = "'" . implode("','", $allowedPhoneNmbrs) . "'";
3286
+
3287
+                if ($procalwdphnmbrs != "''") {
3288
+
3289
+                    $getrecmsgsres = $this->connection->executeQuery("
3290
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
3291
+			FROM `*PREFIX*sms_relent_received`
3292
+			WHERE (`user_id` = '$userId' OR `to` IN (" . $procalwdphnmbrs . ")) AND ((`from` = '$phoneNmbrFrom' AND `to` LIKE '$phoneNmbrTopr') OR (`from` = '$phoneNmbrTo' 
3293
+                                AND `to` LIKE '$phoneNmbrFrompr'))");
3294
+
3295
+                } else {
3296
+	            $getrecmsgs = $this->connection->prepare('
3297
+			SELECT `id`, `user_id`, `date`, `from`, `to`, `message`, `author_displayname`
3298
+			FROM `*PREFIX*sms_relent_received`
3299
+			WHERE `user_id` = ? AND ((`from` = ? AND `to` LIKE ?) OR (`from` = ? AND `to` LIKE ?))');
3300
+	            $getrecmsgsres = $getrecmsgs->execute([$userId, $phoneNmbrFrom, $phoneNmbrTopr, $phoneNmbrTo, $phoneNmbrFrompr]);
3301
+                }
3302
+            }
3303
+        }
3304
+
3305
+        $recmsgs = [];
3306
+        while ($rcrowsfetch = $getrecmsgsres->fetch()) {
3307
+               $rcrowsfetch['deliveryreceipt'] = '';
3308
+               $rcrowsfetch['table'] = 'received';
3309
+               $recmsgs[] = $rcrowsfetch;
3310
+        }
3311
+	$getrecmsgsres->closeCursor();
3312
+
3313
+
3314
+        // Get sent messages
3315
+
3316
+        // If the user is an admin and he wants to see his messages and the messages of all the users with whom he shares his API keys
3317
+        if ($crsampref == 1 && $this->groupManager->isAdmin($userId)) {
3318
+
3319
+            $getsentmsgsres = $this->connection->executeQuery("
3320
+		       SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
3321
+		       FROM  `*PREFIX*sms_relent_sent` 
3322
+                       WHERE ((`from` LIKE '$phoneNmbrFrompr' AND `to` = '$phoneNmbrTo') OR (`from` LIKE '$phoneNmbrTopr' AND `to` = '$phoneNmbrFrom')) AND `user_id` IN 
3323
+                       (" . $procardatarp . ")");
3324
+
3325
+        // If the user is an admin and he wants to see only his messages
3326
+        } elseif ($crsampref == 0 && $this->groupManager->isAdmin($userId)) {
3327
+
3328
+            $getsentmsgs = $this->connection->prepare('
3329
+		       SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
3330
+		       FROM `*PREFIX*sms_relent_sent`
3331
+		       WHERE `user_id` = ? AND ((`from` LIKE ? AND `to` = ?) OR (`from` LIKE ? AND `to` = ?))');
3332
+            $getsentmsgsres = $getsentmsgs->execute([$userId, $phoneNmbrFrompr, $phoneNmbrTo, $phoneNmbrTopr, $phoneNmbrFrom]);
3333
+
3334
+        // If the user is not an admin
3335
+        } elseif (!$this->groupManager->isAdmin($userId)) {
3336
+
3337
+            if ($restrdata) {
3338
+                if ($procalwdphnmbrs != "''") {
3339
+
3340
+	            $getsentmsgsres = $this->connection->executeQuery("
3341
+		       SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
3342
+		       FROM `*PREFIX*sms_relent_sent`
3343
+		       WHERE (`user_id` = '$userId' OR `from` IN (" . $procalwdphnmbrs . ")) AND ((`from` LIKE '$phoneNmbrFrompr' AND `to` = '$phoneNmbrTo') OR 
3344
+                       (`from` LIKE '$phoneNmbrTopr' AND `to` = '$phoneNmbrFrom'))");
3345
+
3346
+                } else {
3347
+                    $getsentmsgs = $this->connection->prepare('
3348
+		       SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
3349
+		       FROM `*PREFIX*sms_relent_sent`
3350
+		       WHERE `user_id` = ? AND ((`from` LIKE ? AND `to` = ?) OR (`from` LIKE ? AND `to` = ?))');
3351
+	            $getsentmsgsres = $getsentmsgs->execute([$userId, $phoneNmbrFrompr, $phoneNmbrTo, $phoneNmbrTopr, $phoneNmbrFrom]);
3352
+                }
3353
+
3354
+            } else {
3355
+
3356
+                $getsentmsgs = $this->connection->prepare('
3357
+		       SELECT `id`, `user_id`, `date`, `from`, `to`,`message`, `author_displayname`, `deliveryreceipt`
3358
+		       FROM `*PREFIX*sms_relent_sent`
3359
+		       WHERE `user_id` = ? AND ((`from` LIKE ? AND `to` = ?) OR (`from` LIKE ? AND `to` = ?))');
3360
+                $getsentmsgsres = $getsentmsgs->execute([$userId, $phoneNmbrFrompr, $phoneNmbrTo, $phoneNmbrTopr, $phoneNmbrFrom]);
3361
+            }
3362
+        }
3363
+
3364
+        $sentmsgs = [];
3365
+        while ($rowfetchedsmsg = $getsentmsgsres->fetch()) {
3366
+               $rowfetchedsmsg['table'] = 'sent';
3367
+               $sentmsgs[] = $rowfetchedsmsg;
3368
+        }
3369
+        $getsentmsgsres->closeCursor();
3370
+
3371
+        $groupedpernb = array_merge($recmsgs, $sentmsgs);
3372
+
3373
+        if ($this->groupManager->isAdmin($userId)) {
3374
+
3375
+            return $groupedpernb;
3376
+
3377
+        } else {
3378
+
3379
+            if ($restrdata) {
3380
+
3381
+                // Clean the phone numbers from tags
3382
+                $restrPhfin = [];
3383
+                foreach ($restrPhoneNmbrs as $phkey => $phvalue) {
3384
+
3385
+                    $restrpharr = explode(": ", $phvalue);
3386
+                    $restrPhfin[] = $restrpharr[1];
3387
+                }
3388
+
3389
+                // Assemble the array of message rows that excludes the rows for the restricted phone numbers
3390
+                foreach ($groupedpernb as $gmdkey => $gmdvalue) {
3391
+
3392
+                         if ($gmdvalue['table'] == 'sent') {
3393
+
3394
+                             if (str_contains($gmdvalue['from'], "+")) {
3395
+                                 $fromnmbrarr = explode("+", $gmdvalue['from']);
3396
+                                 if (in_array("+" . $fromnmbrarr[1], $restrPhfin)) {
3397
+                                     unset($groupedpernb[$gmdkey]);
3398
+                                 }
3399
+                             } else {
3400
+                                 $frmnmbrarr = explode(": ", $gmdvalue['from']);
3401
+                                 if (count($frmnmbrarr) == 2) {
3402
+                                     $nmbtbcmprd = $frmnmbrarr[1];
3403
+                                 } else { 
3404
+                                     $nmbtbcmprd = $frmnmbrarr[0];
3405
+                                 }
3406
+                                 if (in_array($nmbtbcmprd, $restrPhfin)) {
3407
+                                     unset($groupedpernb[$gmdkey]);
3408
+                                 }
3409
+                             }
3410
+
3411
+                         } elseif ($gmdvalue['table'] == 'received') {
3412
+
3413
+                             if (str_contains($gmdvalue['to'], "+")) {
3414
+                                 $fromnmbrarr = explode("+", $gmdvalue['to']);
3415
+                                 if (in_array("+" . $fromnmbrarr[1], $restrPhfin)) {
3416
+                                     unset($groupedpernb[$gmdkey]);
3417
+                                 }
3418
+                             } else {
3419
+                                 $tonmbrarr = explode(": ", $gmdvalue['to']);
3420
+                                 if (count($tonmbrarr) == 2) {
3421
+                                     $tonmbrtbcmprd = $tonmbrarr[1];
3422
+                                 } else {
3423
+                                     $tonmbrtbcmprd = $tonmbrarr[0];
3424
+                                 }
3425
+                                 if (in_array($tonmbrtbcmprd, $restrPhfin)) {
3426
+                                     unset($groupedpernb[$gmdkey]);
3427
+                                 }
3428
+                             }
3429
+                         }
3430
+
3431
+                }
3432
+
3433
+                $groupedperconv = array_values($groupedpernb);
3434
+
3435
+                return $groupedperconv;
3436
+
3437
+            } else { return $groupedpernb; }
3438
+        }
3439
+     }
3440
+
3441
+
3442
+
3443
+     /**
3444
+      * @NoAdminRequired
3445
+      */
3446
+     public function savedisplayname($userId, $authorDisplayname, $from) {
3447
+
3448
+        if ($this->groupManager->isAdmin($userId)) {
3449
+
3450
+	    $updatedispnm = $this->connection->prepare('
3451
+			UPDATE `*PREFIX*sms_relent_received`
3452
+			SET `author_displayname` = ?
3453
+                        WHERE `from` = ?');
3454
+	    $updatedispnmres = $updatedispnm->execute([$authorDisplayname, $from]);
3455
+
3456
+	    $updatedispnmcv = $this->connection->prepare('
3457
+			UPDATE `*PREFIX*sms_relent_conv`
3458
+			SET `lastmsgdisplayname` = ?
3459
+                        WHERE `last_msg_from` = ?');
3460
+	    $updatedispnmrescv = $updatedispnmcv->execute([$authorDisplayname, $from]);
3461
+
3462
+            if ($updatedispnmres && $updatedispnmrescv) {
3463
+                return $respupdname = "The new Display Name has been saved. If on the Settings page, the option 'Add the display name of the message author, before each message' is checked, when you refresh the page you will see the new Display Name before the messages.";
3464
+            } else {
3465
+                return $respupdname = "Error while trying to save the new Display Name to the database.";
3466
+            }
3467
+	    $updatedispnmres->closeCursor();
3468
+
3469
+        } else { return $respupdname = "Only admins can save Display Names for phone numbers that are not associated with Nextcloud users."; }
3470
+     }
3471
+
3472
+     /**
3473
+      * @NoAdminRequired
3474
+      */
3475
+     public function getmsgsperpgnewmsgarchnb($userId) {
3476
+
3477
+        $sqlmpp = $this->connection->prepare('
3478
+	       SELECT `user_id`, `messagesperpage`, `msg_check_interval`, `archived_conv_nmbr`
3479
+               FROM `*PREFIX*sms_relent_settings`
3480
+               WHERE `user_id` = ?');
3481
+	$result = $sqlmpp->execute([$userId]);
3482
+        $mesppdata = $result->fetch();
3483
+        $result->closeCursor();
3484
+        if ($mesppdata) {
3485
+            $mesperpagedb = ['msgsperpage' => $mesppdata['messagesperpage'], 'newmsgcheck' => $mesppdata['msg_check_interval'], 'archconvnb' => $mesppdata['archived_conv_nmbr'] ];
3486
+            return $mesperpagedb;
3487
+        }
3488
+     }
3489
+
3490
+     /**
3491
+      * @NoAdminRequired
3492
+      */
3493
+     public function getnewmsgindicator($userId) {
3494
+
3495
+        $sqlnmsg = $this->connection->prepare('
3496
+	       SELECT `user_id`, `new_message_rcd` 
3497
+               FROM `*PREFIX*sms_relent_settings`
3498
+               WHERE `user_id` = ?');
3499
+	$resultnmsg = $sqlnmsg->execute([$userId]);
3500
+        $nmsgdata = $resultnmsg->fetch();
3501
+        $resultnmsg->closeCursor();
3502
+
3503
+        if ($nmsgdata) {
3504
+            $newmsgdb = $nmsgdata['new_message_rcd'];
3505
+
3506
+            if ($newmsgdb == 1) {
3507
+                // Change the 'new message received' indicator to 0 in the 'sms_relent_settings' table, for the current user
3508
+                $newMsgRcd = 0;
3509
+	        $sqlupdnmsc = $this->connection->prepare('
3510
+			UPDATE `*PREFIX*sms_relent_settings`
3511
+			SET `new_message_rcd` = ?
3512
+	                WHERE `user_id` = ?');
3513
+	        $updatenmRcd = $sqlupdnmsc->execute([$newMsgRcd, $userId]);
3514
+	        $updatenmRcd->closeCursor();
3515
+            }
3516
+
3517
+            return $newmsgdb;
3518
+        }
3519
+     }
3520
+
3521
+     /**
3522
+      * @NoAdminRequired
3523
+      */
3524
+     public function getsettings($userId) {
3525
+
3526
+        $getsettings = $this->connection->prepare('
3527
+                    SELECT `id`, `user_id`, `telapi_url_rec`, `telapi_url`, `nexapi_url_rec`, `nexapi_url`, `twilapi_url_rec`, `twilapi_url`, `flowapi_url_rec`, `flowapi_url`, 
3528
+                           `messagesperpage`, `get_notify`, `notification_email`, `getsmsinemail`, `show_display_names`, `add_display_names`, `msg_check_interval`, `archived_conv_nmbr`                           
3529
+		    FROM  `*PREFIX*sms_relent_settings`
3530
+		    WHERE `user_id` = ?');
3531
+        $resultsettings = $getsettings->execute([$userId]);
3532
+
3533
+        $settingsfromdb = $resultsettings->fetch();
3534
+
3535
+        $resultsettings->closeCursor();
3536
+
3537
+        if ($settingsfromdb) {
3538
+
3539
+            if ($this->groupManager->isAdmin($userId)) { $adminreguser = 'admin'; } else { $adminreguser = 'reguser'; }
3540
+            $settingsfromdb['adminornot'] = $adminreguser;
3541
+
3542
+            return $settingsfromdb;
3543
+        }
3544
+
3545
+     }
3546
+
3547
+
3548
+     public function updatenumberrestrictions($userId, $savedByDsplname, $phoneNumber, $groups, $users) {
3549
+
3550
+        if ($this->groupManager->isAdmin($userId)) {
3551
+
3552
+            $groupsproc = implode("|", $groups);
3553
+            $usersproc = implode("|", $users);
3554
+
3555
+            // Get the restrictions for the current number from the 'sms_relent_restrict' table
3556
+            $getrestr = $this->connection->prepare('SELECT `user_id`, `saved_by_dsplname`, `phone_number`, `groups`, `users` FROM `*PREFIX*sms_relent_restrict` WHERE
3557
+                                                   `phone_number` = ?');
3558
+            $getrestrresult = $getrestr->execute([$phoneNumber]);
3559
+            $crntrestr = $getrestrresult->fetch();
3560
+            $getrestrresult->closeCursor();
3561
+
3562
+            if ($getrestrresult && !$crntrestr) {
3563
+
3564
+	        $insertphrestr = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_restrict` (`user_id`, `saved_by_dsplname`, `phone_number`, `groups`, `users`) VALUES
3565
+                                                             (?, ?, ?, ?, ?)');
3566
+	        if ($insertphrestr->execute([$userId, $savedByDsplname, $phoneNumber, $groupsproc, $usersproc])) { $messagetosend = 'success'; } else { $messagetosend = 'failure'; }  
3567
+         
3568
+            } elseif ($getrestrresult && $crntrestr) {
3569
+
3570
+	        $updatephrestr = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_restrict` SET `user_id` = ?, `saved_by_dsplname` = ?, `groups` = ?, `users` = ? WHERE 
3571
+                                                            `phone_number` = ?');
3572
+	        if ($admupdatephonerestr = $updatephrestr->execute([$userId, $savedByDsplname, $groupsproc, $usersproc, $phoneNumber])) { 
3573
+                    $messagetosend = 'success';
3574
+                } else { 
3575
+                    $messagetosend = 'failure'; 
3576
+                }
3577
+
3578
+	        $admupdatephonerestr->closeCursor();
3579
+            }
3580
+            return $messagetosend;
3581
+        }
3582
+     }
3583
+
3584
+
3585
+     private function updateusercredentials($userId, $usersarr, $provider, $telapiKey, $telpubKey, $telmsgprofid, $telsendername, $plivoapikey, $plivoapisecret, $plivosendernm, 
3586
+                                            $twilapikey, $twilapisecret, $twilsendernm, $flowapikey, $flowapisecret) {
3587
+
3588
+        $msgtosend = 'success';
3589
+
3590
+        foreach ($usersarr as $usrkey => $usrvalue) {
3591
+
3592
+            $getusrset = $this->connection->prepare('SELECT `user_id` FROM `*PREFIX*sms_relent_settings` WHERE `user_id` = ?');
3593
+	    $getusrsetres = $getusrset->execute([$usrvalue]);
3594
+	    $getcrunmdata = $getusrsetres->fetch();
3595
+	    $getusrsetres->closeCursor();
3596
+
3597
+            if ($getcrunmdata) {
3598
+
3599
+                if ($provider == "tnx") {
3600
+
3601
+                    $upusrset = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `telapi_key` = ?, `tel_pub_key` = ?, `messaging_profile_id` = ?,
3602
+                                                           `tel_sender_name` = ? WHERE `user_id` = ?');
3603
+                    if ($upusrsetres = $upusrset->execute([$telapiKey, $telpubKey, $telmsgprofid, $telsendername, $usrvalue])) {
3604
+                        $msgtosend = 'success';
3605
+                    } else { $msgtosend = 'failure'; }
3606
+                    $upusrsetres->closeCursor();
3607
+
3608
+                } elseif ($provider == "plv") {
3609
+
3610
+                    $upusrset = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `nexapi_key` = ?, `nexapi_secret` = ?, `nex_sender_name` = ?
3611
+                                                            WHERE `user_id` = ?');
3612
+                    if ($upusrsetres = $upusrset->execute([$plivoapikey, $plivoapisecret, $plivosendernm, $usrvalue])) {
3613
+                        $msgtosend = 'success';
3614
+                    } else { $msgtosend = 'failure'; }
3615
+                    $upusrsetres->closeCursor();
3616
+
3617
+                } elseif ($provider == "twl") {
3618
+
3619
+                    $upusrset = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `twilapi_key` = ?, `twilapi_secret` = ?, `twil_sender_name` = ?
3620
+                                                            WHERE `user_id` = ?');
3621
+                    if ($upusrsetres = $upusrset->execute([$twilapikey, $twilapisecret, $twilsendernm, $usrvalue])) {
3622
+                        $msgtosend = 'success';
3623
+                    } else { $msgtosend = 'failure'; }
3624
+                    $upusrsetres->closeCursor();
3625
+
3626
+                } elseif ($provider == "flr") {
3627
+
3628
+                    $upusrset = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `flowapi_key` = ?, `flowapi_secret` = ? WHERE `user_id` = ?');
3629
+                    if ($upusrsetres = $upusrset->execute([$flowapikey, $flowapisecret, $usrvalue])) {
3630
+                        $msgtosend = 'success';
3631
+                    } else { $msgtosend = 'failure'; }
3632
+                    $upusrsetres->closeCursor();
3633
+                }
3634
+
3635
+            } else {
3636
+
3637
+                $emptfld = "";
3638
+
3639
+                if ($provider == "tnx") {
3640
+
3641
+                    $upusrset = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_settings` (`user_id`, `telapi_key`, `tel_pub_key`, `telapi_url_rec`, `telapi_url`,
3642
+                                                           `messaging_profile_id`, `nexapi_key`, `nexapi_secret`, `nexapi_url_rec`, `nexapi_url`, `twilapi_key`, `twilapi_secret`,
3643
+                                                           `twilapi_url_rec`, `twilapi_url`, `flowapi_key`, `flowapi_secret`, `flowapi_url_rec`, `flowapi_url`, `tel_sender_name`) 
3644
+                                                            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
3645
+                    if ($upusrsetres = $upusrset->execute([$usrvalue, $telapiKey, $telpubKey, $emptfld, $emptfld, $telmsgprofid, $emptfld, $emptfld, $emptfld, $emptfld, $emptfld, 
3646
+                                                           $emptfld, $emptfld, $emptfld, $emptfld, $emptfld, $emptfld, $emptfld, $telsendername])) {
3647
+                        $msgtosend = 'success';
3648
+                    } else { $msgtosend = 'failure'; }
3649
+                    $upusrsetres->closeCursor();
3650
+
3651
+                } elseif ($provider == "plv") {
3652
+
3653
+                    $upusrset = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_settings` (`user_id`, `telapi_key`, `tel_pub_key`, `telapi_url_rec`, `telapi_url`,
3654
+                                                           `messaging_profile_id`, `nexapi_key`, `nexapi_secret`, `nexapi_url_rec`, `nexapi_url`, `twilapi_key`, `twilapi_secret`,
3655
+                                                           `twilapi_url_rec`, `twilapi_url`, `flowapi_key`, `flowapi_secret`, `flowapi_url_rec`, `flowapi_url`, `nex_sender_name`)
3656
+                                                            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
3657
+                    if ($upusrsetres = $upusrset->execute([$usrvalue, $telapiKey, $telpubKey, $emptfld, $emptfld, $telmsgprofid, $plivoapikey, $plivoapisecret, $emptfld, $emptfld, 
3658
+                                                           $emptfld, $emptfld, $emptfld, $emptfld, $emptfld, $emptfld, $emptfld, $emptfld, $plivosendernm])) {
3659
+                        $msgtosend = 'success';
3660
+                    } else { $msgtosend = 'failure'; }
3661
+                    $upusrsetres->closeCursor();
3662
+
3663
+                } elseif ($provider == "twl") {
3664
+
3665
+                    $upusrset = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_settings` (`user_id`, `telapi_key`, `tel_pub_key`, `telapi_url_rec`, `telapi_url`,
3666
+                                                           `messaging_profile_id`, `nexapi_key`, `nexapi_secret`, `nexapi_url_rec`, `nexapi_url`, `twilapi_key`, `twilapi_secret`,
3667
+                                                           `twilapi_url_rec`, `twilapi_url`, `flowapi_key`, `flowapi_secret`, `flowapi_url_rec`, `flowapi_url`, `twil_sender_name`)
3668
+                                                            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
3669
+                    if ($upusrsetres = $upusrset->execute([$usrvalue, $telapiKey, $telpubKey, $emptfld, $emptfld, $telmsgprofid, $plivoapikey, $plivoapisecret, $emptfld, $emptfld, 
3670
+                                                           $twilapikey, $twilapisecret, $emptfld, $emptfld, $emptfld, $emptfld, $emptfld, $emptfld, $twilsendernm])) {
3671
+                        $msgtosend = 'success';
3672
+                    } else { $msgtosend = 'failure'; }
3673
+                    $upusrsetres->closeCursor();
3674
+
3675
+                } elseif ($provider == "flr") {
3676
+
3677
+                    $upusrset = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_settings` (`user_id`, `telapi_key`, `tel_pub_key`, `telapi_url_rec`, `telapi_url`,
3678
+                                                           `messaging_profile_id`, `nexapi_key`, `nexapi_secret`, `nexapi_url_rec`, `nexapi_url`, `twilapi_key`, `twilapi_secret`,
3679
+                                                           `twilapi_url_rec`, `twilapi_url`, `flowapi_key`, `flowapi_secret`, `flowapi_url_rec`, `flowapi_url`)
3680
+                                                            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
3681
+                    if ($upusrsetres = $upusrset->execute([$usrvalue, $telapiKey, $telpubKey, $emptfld, $emptfld, $telmsgprofid, $plivoapikey, $plivoapisecret, $emptfld, $emptfld, 
3682
+                                                           $twilapikey, $twilapisecret, $emptfld, $emptfld, $flowapikey, $flowapisecret, $emptfld, $emptfld])) {
3683
+                        $msgtosend = 'success';
3684
+                    } else { $msgtosend = 'failure'; }
3685
+                    $upusrsetres->closeCursor();
3686
+                }
3687
+
3688
+            }                 
3689
+        }
3690
+
3691
+        return $msgtosend;
3692
+     }
3693
+
3694
+
3695
+     private function removeusercredentials($userId, $usersarr, $provider, $telapiKey, $telpubKey, $telmsgprofid, $telsendername, $plivoapikey, $plivoapisecret, $plivosendernm, 
3696
+                                            $twilapikey, $twilapisecret, $twilsendernm, $flowapikey, $flowapisecret) {
3697
+
3698
+        $msgtosend = 'success';
3699
+
3700
+        foreach ($usersarr as $usrkey => $usrvalue) {
3701
+
3702
+                $emptyfld = "";
3703
+
3704
+                if ($provider == "tnx") {
3705
+
3706
+                    $upusrset = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `telapi_key` = ?, `tel_pub_key` = ?, `messaging_profile_id` = ?,
3707
+                                                           `tel_sender_name` = ? WHERE `user_id` = ?');
3708
+                    if ($upusrsetres = $upusrset->execute([$emptyfld, $emptyfld, $emptyfld, $emptyfld, $usrvalue])) {
3709
+                        $msgtosend = 'success';
3710
+                    } else { $msgtosend = 'failure'; }
3711
+                    $upusrsetres->closeCursor();
3712
+
3713
+                } elseif ($provider == "plv") {
3714
+
3715
+                    $upusrset = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `nexapi_key` = ?, `nexapi_secret` = ?, `nex_sender_name` = ?
3716
+                                                            WHERE `user_id` = ?');
3717
+                    if ($upusrsetres = $upusrset->execute([$emptyfld, $emptyfld, $emptyfld, $usrvalue])) {
3718
+                        $msgtosend = 'success';
3719
+                    } else { $msgtosend = 'failure'; }
3720
+                    $upusrsetres->closeCursor();
3721
+
3722
+                } elseif ($provider == "twl") {
3723
+
3724
+                    $upusrset = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `twilapi_key` = ?, `twilapi_secret` = ?, `twil_sender_name` = ?
3725
+                                                            WHERE `user_id` = ?');
3726
+                    if ($upusrsetres = $upusrset->execute([$emptyfld, $emptyfld, $emptyfld, $usrvalue])) {
3727
+                        $msgtosend = 'success';
3728
+                    } else { $msgtosend = 'failure'; }
3729
+                    $upusrsetres->closeCursor();
3730
+
3731
+                } elseif ($provider == "flr") {
3732
+
3733
+                    $upusrset = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `flowapi_key` = ?, `flowapi_secret` = ? WHERE `user_id` = ?');
3734
+                    if ($upusrsetres = $upusrset->execute([$emptyfld, $emptyfld, $usrvalue])) {
3735
+                        $msgtosend = 'success';
3736
+                    } else { $msgtosend = 'failure'; }
3737
+                    $upusrsetres->closeCursor();
3738
+                }
3739
+        }
3740
+
3741
+        return $msgtosend;
3742
+     }
3743
+
3744
+
3745
+     public function updatekeysallowedusers($userId, $groups, $users, $groupsdel, $usersdel, $provider) {
3746
+
3747
+       if ($this->groupManager->isAdmin($userId)) {
3748
+
3749
+          $msgtosend = 'success';
3750
+
3751
+          // Get the users that belong to the 'admin' group
3752
+          $getadmn = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
3753
+          $getadmnres = $getadmn->execute(['admin']);
3754
+
3755
+          $usersadmin = [];
3756
+          while ($getadmnusrs = $getadmnres->fetch()) {
3757
+                 $usersadmin[] = $getadmnusrs['uid'];
3758
+          }
3759
+          $getadmnres->closeCursor();
3760
+          
3761
+          // Get the API keys and alphanumeric sender IDs for the current admin, from the 'sms_relent_settings' table
3762
+          $getadmset = $this->connection->prepare('SELECT `user_id`, `telapi_key`, `tel_pub_key`, `messaging_profile_id`, `tel_sender_name`, `nexapi_key`, `nexapi_secret`,
3763
+                                                  `nex_sender_name`, `twilapi_key`, `twilapi_secret`, `twil_sender_name`, `flowapi_key`, `flowapi_secret` 
3764
+                                                   FROM `*PREFIX*sms_relent_settings` WHERE `user_id` = ?');
3765
+	  $getadmsetres = $getadmset->execute([$userId]);
3766
+	  $getcradmdata = $getadmsetres->fetch();
3767
+          $telapiKey = $getcradmdata['telapi_key'];
3768
+          $telpubKey = $getcradmdata['tel_pub_key'];
3769
+          $telmsgprofid = $getcradmdata['messaging_profile_id'];
3770
+          $telsendername = $getcradmdata['tel_sender_name'];
3771
+          $plivoapikey = $getcradmdata['nexapi_key'];
3772
+          $plivoapisecret = $getcradmdata['nexapi_secret'];
3773
+          $plivosendernm = $getcradmdata['nex_sender_name'];
3774
+          $twilapikey = $getcradmdata['twilapi_key'];
3775
+          $twilapisecret = $getcradmdata['twilapi_secret'];
3776
+          $twilsendernm = $getcradmdata['twil_sender_name'];
3777
+          $flowapikey = $getcradmdata['flowapi_key'];
3778
+          $flowapisecret = $getcradmdata['flowapi_secret'];
3779
+	  $getadmsetres->closeCursor();
3780
+
3781
+          if ($getcradmdata) {
3782
+
3783
+            if ($provider == "tnx") {
3784
+
3785
+                $getalwd = $this->connection->prepare('SELECT `user_id`, `tnx_groups_allowed`, `tnx_users_allowed` FROM `*PREFIX*sms_relent_subac`');
3786
+                $getalwdres = $getalwd->execute();
3787
+
3788
+                $upchck = 0;
3789
+                $seldataarr = [];
3790
+                $groupsPerProvider = '';
3791
+                $usersPerProvider = '';
3792
+                while ($crntrestr = $getalwdres->fetch()) {
3793
+                       if ($crntrestr['user_id'] != $userId) {
3794
+                           $seldataarr[] = ['userid' => $crntrestr['user_id'], 'groupsallowed' => $crntrestr['tnx_groups_allowed'], 'usersallowed' => $crntrestr['tnx_users_allowed']];
3795
+                       } else {
3796
+                           $upchck++;
3797
+                           $groupsPerProvider = $crntrestr['tnx_groups_allowed'];
3798
+                           $usersPerProvider = $crntrestr['tnx_users_allowed'];
3799
+                       }
3800
+                }
3801
+                $getalwdres->closeCursor();
3802
+
3803
+
3804
+            } elseif ($provider == "plv") {
3805
+
3806
+                $getalwd = $this->connection->prepare('SELECT `user_id`, `plv_groups_allowed`, `plv_users_allowed` FROM `*PREFIX*sms_relent_subac`');
3807
+                $getalwdres = $getalwd->execute();
3808
+
3809
+                $upchck = 0;
3810
+                $seldataarr = [];
3811
+                $groupsPerProvider = '';
3812
+                $usersPerProvider = '';
3813
+                while ($crntrestr = $getalwdres->fetch()) {
3814
+                       if ($crntrestr['user_id'] != $userId) {
3815
+                           $seldataarr[] = ['userid' => $crntrestr['user_id'], 'groupsallowed' => $crntrestr['plv_groups_allowed'], 'usersallowed' => $crntrestr['plv_users_allowed']];
3816
+                       } else {
3817
+                           $upchck++;
3818
+                           $groupsPerProvider = $crntrestr['plv_groups_allowed'];
3819
+                           $usersPerProvider = $crntrestr['plv_users_allowed'];
3820
+                       }
3821
+                }
3822
+                $getalwdres->closeCursor();
3823
+
3824
+            } elseif ($provider == "twl") {
3825
+
3826
+                $getalwd = $this->connection->prepare('SELECT `user_id`, `twl_groups_allowed`, `twl_users_allowed` FROM `*PREFIX*sms_relent_subac`');
3827
+                $getalwdres = $getalwd->execute();
3828
+
3829
+                $upchck = 0;
3830
+                $seldataarr = [];
3831
+                $groupsPerProvider = '';
3832
+                $usersPerProvider = '';
3833
+                while ($crntrestr = $getalwdres->fetch()) {
3834
+                       if ($crntrestr['user_id'] != $userId) {
3835
+                           $seldataarr[] = ['userid' => $crntrestr['user_id'], 'groupsallowed' => $crntrestr['twl_groups_allowed'], 'usersallowed' => $crntrestr['twl_users_allowed']];
3836
+                       } else {
3837
+                           $upchck++;
3838
+                           $groupsPerProvider = $crntrestr['twl_groups_allowed'];
3839
+                           $usersPerProvider = $crntrestr['twl_users_allowed'];
3840
+                       }
3841
+                }
3842
+                $getalwdres->closeCursor();
3843
+
3844
+            } elseif ($provider == "flr") {
3845
+
3846
+                $getalwd = $this->connection->prepare('SELECT `user_id`, `flr_groups_allowed`, `flr_users_allowed` FROM `*PREFIX*sms_relent_subac`');
3847
+                $getalwdres = $getalwd->execute();
3848
+
3849
+                $upchck = 0;
3850
+                $seldataarr = [];
3851
+                $groupsPerProvider = '';
3852
+                $usersPerProvider = '';
3853
+                while ($crntrestr = $getalwdres->fetch()) {
3854
+                       if ($crntrestr['user_id'] != $userId) {
3855
+                           $seldataarr[] = ['userid' => $crntrestr['user_id'], 'groupsallowed' => $crntrestr['flr_groups_allowed'], 'usersallowed' => $crntrestr['flr_users_allowed']];
3856
+                       } else {
3857
+                           $upchck++;
3858
+                           $groupsPerProvider = $crntrestr['flr_groups_allowed'];
3859
+                           $usersPerProvider = $crntrestr['flr_users_allowed'];
3860
+                       }
3861
+                }
3862
+                $getalwdres->closeCursor();
3863
+
3864
+            }
3865
+
3866
+
3867
+            if ($seldataarr) {
3868
+
3869
+                // Check if any of the current users are among the already saved ones (for the same provider)
3870
+                $usrchck = 0;
3871
+                $usrmsgarr = [];
3872
+                foreach ($users as $ukey => $uvalue) {
3873
+                         if ($uvalue != '') {
3874
+                             for ($j = 0; $j < count($seldataarr); $j++) {
3875
+                                  if (str_contains($seldataarr[$j]['usersallowed'], $uvalue)) {
3876
+                                      $usrchck++;
3877
+                                      $usrmsgarr[] = "The admin " . $seldataarr[$j]['userid'] . " has already allowed the user " . $uvalue . " to access his API keys for this provider.";
3878
+                                  }
3879
+                             }
3880
+                         }
3881
+                }
3882
+
3883
+                // Check if any of the current groups are among the already saved ones (for the same provider)
3884
+                $grchck = 0;
3885
+                $grmsgarr = [];
3886
+                foreach ($groups as $gkey => $gvalue) {
3887
+                         if ($gvalue != '') {
3888
+                             for ($k = 0; $k < count($seldataarr); $k++) {
3889
+                                  if (str_contains($seldataarr[$k]['groupsallowed'], $gvalue)) {
3890
+                                      $grchck++;
3891
+                                      $grmsgarr[] = "The admin " . $seldataarr[$k]['userid'] . " has already allowed the group " . $gvalue . " to access his API keys for this provider.";
3892
+                                  }
3893
+                             }
3894
+                         }
3895
+                }
3896
+
3897
+                if ($usrchck == 0 && $grchck == 0) {
3898
+
3899
+
3900
+                    // Remove the previously saved API keys for each user in the specified groups, for the current provider
3901
+                    if ($groupsPerProvider != '') {
3902
+
3903
+                        $groupsPerProvarr = explode("|", $groupsPerProvider);
3904
+                        foreach ($groupsPerProvarr as $prgrkey => $prgrvalue) {
3905
+
3906
+                                 if ($prgrvalue != "admin" && $prgrvalue != '') {
3907
+
3908
+                                     // Get all the users that belong to the group
3909
+	                             $getusringrp = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
3910
+			             $getusringrpres = $getusringrp->execute([$prgrvalue]);
3911
+
3912
+                                     $usersingroup = [];
3913
+			             while ($getusrnm = $getusringrpres->fetch()) {
3914
+                                            if ($getusrnm['uid'] != $userId) {
3915
+
3916
+		                                // Ensure the current user is not an admin
3917
+                                                if (!in_array($getusrnm['uid'], $usersadmin)) {
3918
+                                                     $usersingroup[] = $getusrnm['uid'];
3919
+                                                }
3920
+                                            }
3921
+                                     }
3922
+			             $getusringrpres->closeCursor();
3923
+
3924
+                                     if ($usersingroup) {
3925
+                                         $msgtosend = $this->removeusercredentials($userId, $usersingroup, $provider, $telapiKey, $telpubKey, $telmsgprofid, $telsendername, $plivoapikey, 
3926
+                                                             $plivoapisecret, $plivosendernm, $twilapikey, $twilapisecret, $twilsendernm, $flowapikey, $flowapisecret);
3927
+                                     }
3928
+                                 }
3929
+
3930
+                        }
3931
+                    }
3932
+
3933
+
3934
+                    // Remove the previously saved API keys for each user, for the current provider
3935
+                    if ($usersPerProvider != '') {
3936
+
3937
+                        $usersPerProvarr = explode("|", $usersPerProvider);
3938
+                        if ($usersPerProvarr) {
3939
+
3940
+                            $ctusernamearrpr = [];
3941
+                            foreach ($usersPerProvarr as $usrKeypr => $usrValuepr) {
3942
+
3943
+		                 // Get the username for this Display Name
3944
+		                 $getacdataunmpr = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ? AND `value` = ?');
3945
+		                 $getacdataunmprres = $getacdataunmpr->execute(['displayname', $usrValuepr]);
3946
+		                 $acdatausrnamepr = $getacdataunmprres->fetch();
3947
+                                 if ($acdatausrnamepr['uid'] != $userId) {
3948
+
3949
+		                     // Ensure the current user is not an admin
3950
+                                     if (!in_array($acdatausrnamepr['uid'], $usersadmin)) {
3951
+                                          $ctusernamearrpr[] = $acdatausrnamepr['uid'];
3952
+                                     }
3953
+
3954
+                                 }
3955
+		                 $getacdataunmprres->closeCursor();
3956
+                            }
3957
+
3958
+                            $msgtosend = $this->removeusercredentials($userId, $ctusernamearrpr, $provider, $telapiKey, $telpubKey, $telmsgprofid, $telsendername, $plivoapikey,
3959
+                                                                      $plivoapisecret, $plivosendernm, $twilapikey, $twilapisecret, $twilsendernm, $flowapikey, $flowapisecret);
3960
+                        }
3961
+                    }
3962
+
3963
+
3964
+                    // Insert the provider's API keys for the allowed users
3965
+                    if ($users) {
3966
+
3967
+                        $ctusernamearruid = [];
3968
+                        $ctusernamearr = [];
3969
+                        foreach ($users as $usrKey => $usrValue) {
3970
+                             if ($usrValue != '') {
3971
+		                 // Get the username for this Display Name
3972
+		                 $getacdataunm = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ? AND `value` = ?');
3973
+		                 $getacdataunmres = $getacdataunm->execute(['displayname', $usrValue]);
3974
+		                 $acdatausrname = $getacdataunmres->fetch();
3975
+                                 if ($acdatausrname['uid'] != $userId) {
3976
+
3977
+		                     // Ensure the current user is not an admin
3978
+                                     if (!in_array($acdatausrname['uid'], $usersadmin)) {
3979
+                                         $ctusernamearruid[] = $acdatausrname['uid'];
3980
+                                         $ctusernamearr[] = $usrValue;
3981
+                                     }
3982
+
3983
+                                 }
3984
+		                 $getacdataunmres->closeCursor();
3985
+                             }
3986
+                        }
3987
+
3988
+
3989
+                        // Insert/update the allowed users in the 'sms_relent_subac' table
3990
+                        $usersalwdrs = implode("|", $ctusernamearr);
3991
+
3992
+                        if ($upchck == 0) {
3993
+
3994
+		            if ($provider == "tnx") {
3995
+
3996
+	                        $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `tnx_users_allowed`, `tnx_users_del`) VALUES (?, ?, ?)');
3997
+	                        if ($datalwdres = $insertalwd->execute([$userId, $usersalwdrs, $usersdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
3998
+                                $upchck++;
3999
+
4000
+		            } elseif ($provider == "plv") {
4001
+
4002
+	                        $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `plv_users_allowed`, `plv_users_del`) VALUES (?, ?, ?)');
4003
+	                        if ($datalwdres = $insertalwd->execute([$userId, $usersalwdrs, $usersdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; } 
4004
+                                $upchck++;
4005
+
4006
+		            } elseif ($provider == "twl") {
4007
+
4008
+	                        $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `twl_users_allowed`, `twl_users_del`) VALUES (?, ?, ?)');
4009
+	                        if ($datalwdres = $insertalwd->execute([$userId, $usersalwdrs, $usersdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; } 
4010
+                                $upchck++;
4011
+
4012
+		            } elseif ($provider == "flr") {
4013
+
4014
+	                        $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `flr_users_allowed`, `flr_users_del`) VALUES (?, ?, ?)');
4015
+	                        if ($datalwdres = $insertalwd->execute([$userId, $usersalwdrs, $usersdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4016
+                                $upchck++;
4017
+		            }
4018
+
4019
+                        } else {
4020
+
4021
+		            if ($provider == "tnx") {
4022
+
4023
+	                        $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `tnx_users_allowed` = ?, `tnx_users_del` = ? WHERE `user_id` = ?');
4024
+	                        if ($datalwdres = $updatealwd->execute([$usersalwdrs, $usersdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4025
+
4026
+		            } elseif ($provider == "plv") {
4027
+
4028
+	                        $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `plv_users_allowed` = ?, `plv_users_del` = ? WHERE `user_id` = ?');
4029
+	                        if ($datalwdres = $updatealwd->execute([$usersalwdrs, $usersdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4030
+
4031
+		            } elseif ($provider == "twl") {
4032
+
4033
+	                        $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `twl_users_allowed` = ?, `twl_users_del` = ? WHERE `user_id` = ?');
4034
+	                        if ($datalwdres = $updatealwd->execute([$usersalwdrs, $usersdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4035
+
4036
+		            } elseif ($provider == "flr") {
4037
+
4038
+	                        $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `flr_users_allowed` = ?, `flr_users_del` = ? WHERE `user_id` = ?');
4039
+	                        if ($datalwdres = $updatealwd->execute([$usersalwdrs, $usersdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4040
+		            }
4041
+                        }
4042
+
4043
+                        $datalwdres->closeCursor();
4044
+
4045
+
4046
+                        // Insert/update the credentials in the 'sms_relent_settings' table, for each allowed user
4047
+                        $msgtosend = $this->updateusercredentials($userId, $ctusernamearruid, $provider, $telapiKey, $telpubKey, $telmsgprofid, $telsendername, $plivoapikey, 
4048
+                                                                  $plivoapisecret, $plivosendernm, $twilapikey, $twilapisecret, $twilsendernm, $flowapikey, $flowapisecret);
4049
+                    }
4050
+
4051
+                    // Insert the provider's API keys for the allowed groups
4052
+                    if ($groups) {
4053
+
4054
+                        $allwdgrps = [];
4055
+                        foreach ($groups as $groupkey => $groupvalue) {
4056
+
4057
+                                 if ($groupvalue != "admin" && $groupvalue != '') {
4058
+
4059
+                                     $allwdgrps[] = $groupvalue;
4060
+
4061
+                                     // Get all the users that belong to the group
4062
+			             $getacdusr = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
4063
+			             $getacdusrres = $getacdusr->execute([$groupvalue]);
4064
+
4065
+                                     $usersingrp = [];
4066
+			             while ($getacdusrnm = $getacdusrres->fetch()) {
4067
+                                            if ($getacdusrnm['uid'] != $userId) {
4068
+
4069
+		                                // Ensure the current user is not an admin
4070
+                                                if (!in_array($getacdusrnm['uid'], $usersadmin)) {
4071
+                                                     $usersingrp[] = $getacdusrnm['uid'];
4072
+                                                }
4073
+                                            }
4074
+                                     }
4075
+			             $getacdusrres->closeCursor();
4076
+
4077
+                                     // Insert the provider's API keys for each user of the allowed groups
4078
+                                     if ($usersingrp) {
4079
+                                         $msgtosend = $this->updateusercredentials($userId, $usersingrp, $provider, $telapiKey, $telpubKey, $telmsgprofid, $telsendername, $plivoapikey, 
4080
+                                                             $plivoapisecret, $plivosendernm, $twilapikey, $twilapisecret, $twilsendernm, $flowapikey, $flowapisecret);
4081
+                                     }
4082
+                                 }
4083
+
4084
+
4085
+		                // Insert/update the allowed groups in the 'sms_relent_subac' table
4086
+		                $groupsalwdrs = implode("|", $allwdgrps);
4087
+
4088
+		                if ($upchck == 0) {
4089
+
4090
+				    if ($provider == "tnx") {
4091
+
4092
+			                $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `tnx_groups_allowed`, `tnx_groups_del`) VALUES (?, ?, ?)');
4093
+			                if ($datalwdres = $insertalwd->execute([$userId, $groupsalwdrs, $groupsdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4094
+                                        $upchck++;
4095
+
4096
+				    } elseif ($provider == "plv") {
4097
+
4098
+			                $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `plv_groups_allowed`, `plv_groups_del`) VALUES (?, ?, ?)');
4099
+			                if ($datalwdres = $insertalwd->execute([$userId, $groupsalwdrs, $groupsdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4100
+                                        $upchck++;
4101
+
4102
+				    } elseif ($provider == "twl") {
4103
+
4104
+			                $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `twl_groups_allowed`, `twl_groups_del`) VALUES (?, ?, ?)');
4105
+			                if ($datalwdres = $insertalwd->execute([$userId, $groupsalwdrs, $groupsdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4106
+                                        $upchck++;
4107
+
4108
+				    } elseif ($provider == "flr") {
4109
+
4110
+			                $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `flr_groups_allowed`, `flr_groups_del`) VALUES (?, ?, ?)');
4111
+			                if ($datalwdres = $insertalwd->execute([$userId, $groupsalwdrs, $groupsdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4112
+                                        $upchck++;
4113
+				    }
4114
+
4115
+		                } else {
4116
+
4117
+				    if ($provider == "tnx") {
4118
+
4119
+			                $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `tnx_groups_allowed` = ?, `tnx_groups_del` = ? WHERE `user_id` = ?');
4120
+			                if ($datalwdres = $updatealwd->execute([$groupsalwdrs, $groupsdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4121
+
4122
+				    } elseif ($provider == "plv") {
4123
+
4124
+			                $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `plv_groups_allowed` = ?, `plv_groups_del` = ? WHERE `user_id` = ?');
4125
+			                if ($datalwdres = $updatealwd->execute([$groupsalwdrs, $groupsdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4126
+
4127
+				    } elseif ($provider == "twl") {
4128
+
4129
+			                $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `twl_groups_allowed` = ?, `twl_groups_del` = ? WHERE `user_id` = ?');
4130
+			                if ($datalwdres = $updatealwd->execute([$groupsalwdrs, $groupsdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4131
+
4132
+				    } elseif ($provider == "flr") {
4133
+
4134
+			                $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `flr_groups_allowed` = ?, `flr_groups_del` = ? WHERE `user_id` = ?');
4135
+			                if ($datalwdres = $updatealwd->execute([$groupsalwdrs, $groupsdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4136
+				    }
4137
+		                }
4138
+
4139
+		                $datalwdres->closeCursor();
4140
+                        }
4141
+
4142
+                    }
4143
+
4144
+                } else {
4145
+
4146
+                        if ($grmsgarr) {
4147
+                            $grppart = implode(" ", $grmsgarr) . " A group cannot be allowed access to 2 different sets of API keys for the same SMS provider.";
4148
+                        } else { $grppart = ''; }
4149
+
4150
+                        if ($usrmsgarr) {
4151
+                            $usrpart = implode(" ", $usrmsgarr) . " A user cannot be allowed access to 2 different sets of API keys for the same SMS provider.";
4152
+                        } else { $usrpart = ''; }
4153
+
4154
+                    $msgtosend = $grppart . $usrpart;
4155
+                }
4156
+
4157
+
4158
+            } else {
4159
+
4160
+                if ($upchck == 0) {
4161
+
4162
+                    // Insert the provider's API keys for the allowed users
4163
+                    if ($users) {
4164
+
4165
+                        $ctusernamearruid = [];
4166
+                        $ctusernamearr = [];
4167
+                        foreach ($users as $usrKey => $usrValue) {
4168
+                             if ($usrValue != '') {
4169
+		                 // Get the username for this Display Name
4170
+		                 $getacdataunm = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ? AND `value` = ?');
4171
+		                 $getacdataunmres = $getacdataunm->execute(['displayname', $usrValue]);
4172
+		                 $acdatausrname = $getacdataunmres->fetch();
4173
+                                 if ($acdatausrname['uid'] != $userId) {
4174
+
4175
+		                     // Ensure the current user is not an admin
4176
+                                     if (!in_array($acdatausrname['uid'], $usersadmin)) {
4177
+                                         $ctusernamearruid[] = $acdatausrname['uid'];
4178
+                                         $ctusernamearr[] = $usrValue;
4179
+                                     }
4180
+
4181
+                                 }
4182
+		                 $getacdataunmres->closeCursor();
4183
+                             }
4184
+                        }
4185
+
4186
+
4187
+                        // Insert the allowed users into the 'sms_relent_subac' table
4188
+                        $usersalwdrs = implode("|", $ctusernamearr);
4189
+
4190
+		        if ($provider == "tnx") {
4191
+
4192
+	                    $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `tnx_users_allowed`, `tnx_users_del`) VALUES (?, ?, ?)');
4193
+	                    if ($datalwdres = $insertalwd->execute([$userId, $usersalwdrs, $usersdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; } 
4194
+                            $upchck++;
4195
+
4196
+		        } elseif ($provider == "plv") {
4197
+
4198
+	                    $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `plv_users_allowed`, `plv_users_del`) VALUES (?, ?, ?)');
4199
+	                    if ($datalwdres = $insertalwd->execute([$userId, $usersalwdrs, $usersdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4200
+                            $upchck++;
4201
+
4202
+		        } elseif ($provider == "twl") {
4203
+
4204
+	                    $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `twl_users_allowed`, `twl_users_del`) VALUES (?, ?, ?)');
4205
+	                    if ($datalwdres = $insertalwd->execute([$userId, $usersalwdrs, $usersdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4206
+                            $upchck++;
4207
+
4208
+		        } elseif ($provider == "flr") {
4209
+
4210
+	                    $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `flr_users_allowed`, `flr_users_del`) VALUES (?, ?, ?)');
4211
+	                    if ($datalwdres = $insertalwd->execute([$userId, $usersalwdrs, $usersdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4212
+                            $upchck++;
4213
+		        }
4214
+
4215
+                        $datalwdres->closeCursor();
4216
+
4217
+
4218
+                        // Insert/update the credentials in the 'sms_relent_settings' table, for each allowed user
4219
+                        $msgtosend = $this->updateusercredentials($userId, $ctusernamearruid, $provider, $telapiKey, $telpubKey, $telmsgprofid, $telsendername, $plivoapikey, 
4220
+                                                                  $plivoapisecret, $plivosendernm, $twilapikey, $twilapisecret, $twilsendernm, $flowapikey, $flowapisecret);
4221
+                    }
4222
+
4223
+                    // Insert the provider's API keys for the allowed groups
4224
+                    if ($groups) {
4225
+
4226
+                        $allwdgrps = [];
4227
+                        foreach ($groups as $groupkey => $groupvalue) {
4228
+
4229
+                                 if ($groupvalue != "admin" && $groupvalue != '') {
4230
+
4231
+                                     $allwdgrps[] = $groupvalue;
4232
+
4233
+                                     // Get all the users that belong to the group
4234
+			             $getacdusr = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
4235
+			             $getacdusrres = $getacdusr->execute([$groupvalue]);
4236
+
4237
+                                     $usersingrp = [];
4238
+			             while ($getacdusrnm = $getacdusrres->fetch()) {
4239
+                                            if ($getacdusrnm['uid'] != $userId) {
4240
+
4241
+		                                // Ensure the current user is not an admin
4242
+                                                if (!in_array($getacdusrnm['uid'], $usersadmin)) {
4243
+                                                     $usersingrp[] = $getacdusrnm['uid'];
4244
+                                                }
4245
+                                            }
4246
+                                     }
4247
+			             $getacdusrres->closeCursor();
4248
+
4249
+                                     // Insert the provider's API keys for each user of the allowed groups
4250
+                                     if ($usersingrp) {
4251
+                                         $msgtosend = $this->updateusercredentials($userId, $usersingrp, $provider, $telapiKey, $telpubKey, $telmsgprofid, $telsendername, $plivoapikey, 
4252
+                                                             $plivoapisecret, $plivosendernm, $twilapikey, $twilapisecret, $twilsendernm, $flowapikey, $flowapisecret);
4253
+                                     }
4254
+                                 }
4255
+
4256
+
4257
+		                // Insert the allowed groups into the 'sms_relent_subac' table
4258
+		                $groupsalwdrs = implode("|", $allwdgrps);
4259
+
4260
+                                if ($upchck == 0) {
4261
+
4262
+				    if ($provider == "tnx") {
4263
+
4264
+			                $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `tnx_groups_allowed`, `tnx_groups_del`) VALUES (?, ?, ?)');
4265
+			                if ($datalwdres = $insertalwd->execute([$userId, $groupsalwdrs, $groupsdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; } 
4266
+
4267
+				    } elseif ($provider == "plv") {
4268
+
4269
+			                $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `plv_groups_allowed`, `plv_groups_del`) VALUES (?, ?, ?)');
4270
+			                if ($datalwdres = $insertalwd->execute([$userId, $groupsalwdrs, $groupsdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; } 
4271
+
4272
+				    } elseif ($provider == "twl") {
4273
+
4274
+			                $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `twl_groups_allowed`, `twl_groups_del`) VALUES (?, ?, ?)');
4275
+			                if ($datalwdres = $insertalwd->execute([$userId, $groupsalwdrs, $groupsdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; } 
4276
+
4277
+				    } elseif ($provider == "flr") {
4278
+
4279
+			                $insertalwd = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_subac` (`user_id`, `flr_groups_allowed`, `flr_groups_del`) VALUES (?, ?, ?)');
4280
+			                if ($datalwdres = $insertalwd->execute([$userId, $groupsalwdrs, $groupsdel])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; } 
4281
+				    }
4282
+
4283
+                                } else {
4284
+
4285
+				    if ($provider == "tnx") {
4286
+
4287
+			                $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `tnx_groups_allowed` = ?, `tnx_groups_del` = ? WHERE `user_id` = ?');
4288
+			                if ($datalwdres = $updatealwd->execute([$groupsalwdrs, $groupsdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4289
+
4290
+				    } elseif ($provider == "plv") {
4291
+
4292
+			                $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `plv_groups_allowed` = ?, `plv_groups_del` = ? WHERE `user_id` = ?');
4293
+			                if ($datalwdres = $updatealwd->execute([$groupsalwdrs, $groupsdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4294
+
4295
+				    } elseif ($provider == "twl") {
4296
+
4297
+			                $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `twl_groups_allowed` = ?, `twl_groups_del` = ? WHERE `user_id` = ?');
4298
+			                if ($datalwdres = $updatealwd->execute([$groupsalwdrs, $groupsdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4299
+
4300
+				    } elseif ($provider == "flr") {
4301
+
4302
+			                $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `flr_groups_allowed` = ?, `flr_groups_del` = ? WHERE `user_id` = ?');
4303
+			                if ($datalwdres = $updatealwd->execute([$groupsalwdrs, $groupsdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4304
+				    }
4305
+
4306
+                                }
4307
+
4308
+		                $datalwdres->closeCursor();
4309
+                        }
4310
+
4311
+                    }
4312
+
4313
+                } else {
4314
+
4315
+                    // Remove the previously saved API keys for each user in the specified groups, for the current provider
4316
+                    if ($groupsPerProvider != '') {
4317
+
4318
+                        $groupsPerProvarr = explode("|", $groupsPerProvider);
4319
+                        foreach ($groupsPerProvarr as $prgrkey => $prgrvalue) {
4320
+
4321
+                                 if ($prgrvalue != "admin" && $prgrvalue != '') {
4322
+
4323
+                                     // Get all the users that belong to the group
4324
+	                             $getusringrp = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
4325
+			             $getusringrpres = $getusringrp->execute([$prgrvalue]);
4326
+
4327
+                                     $usersingroup = [];
4328
+			             while ($getusrnm = $getusringrpres->fetch()) {
4329
+                                            if ($getusrnm['uid'] != $userId) {
4330
+
4331
+		                                // Ensure the current user is not an admin
4332
+                                                if (!in_array($getusrnm['uid'], $usersadmin)) {
4333
+                                                     $usersingroup[] = $getusrnm['uid'];
4334
+                                                }
4335
+                                            }
4336
+                                     }
4337
+			             $getusringrpres->closeCursor();
4338
+
4339
+                                     if ($usersingroup) {
4340
+                                         $msgtosend = $this->removeusercredentials($userId, $usersingroup, $provider, $telapiKey, $telpubKey, $telmsgprofid, $telsendername, $plivoapikey, 
4341
+                                                             $plivoapisecret, $plivosendernm, $twilapikey, $twilapisecret, $twilsendernm, $flowapikey, $flowapisecret);
4342
+                                     }
4343
+                                 }
4344
+
4345
+                        }
4346
+                    }
4347
+
4348
+
4349
+                    // Remove the previously saved API keys for each user, for the current provider
4350
+                    if ($usersPerProvider != '') {
4351
+
4352
+                        $usersPerProvarr = explode("|", $usersPerProvider);
4353
+                        if ($usersPerProvarr) {
4354
+
4355
+                            $ctusernamearrpr = [];
4356
+                            foreach ($usersPerProvarr as $usrKeypr => $usrValuepr) {
4357
+
4358
+		                 // Get the username for this Display Name
4359
+		                 $getacdataunmpr = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ? AND `value` = ?');
4360
+		                 $getacdataunmprres = $getacdataunmpr->execute(['displayname', $usrValuepr]);
4361
+		                 $acdatausrnamepr = $getacdataunmprres->fetch();
4362
+                                 if ($acdatausrnamepr['uid'] != $userId) {
4363
+
4364
+		                     // Ensure the current user is not an admin
4365
+                                     if (!in_array($acdatausrnamepr['uid'], $usersadmin)) {
4366
+                                          $ctusernamearrpr[] = $acdatausrnamepr['uid'];
4367
+                                     }
4368
+
4369
+                                 }
4370
+		                 $getacdataunmprres->closeCursor();
4371
+                            }
4372
+
4373
+                            $msgtosend = $this->removeusercredentials($userId, $ctusernamearrpr, $provider, $telapiKey, $telpubKey, $telmsgprofid, $telsendername, $plivoapikey,
4374
+                                                                      $plivoapisecret, $plivosendernm, $twilapikey, $twilapisecret, $twilsendernm, $flowapikey, $flowapisecret);
4375
+                        }
4376
+                    }
4377
+
4378
+
4379
+
4380
+                    // Insert the provider's API keys for the allowed users
4381
+                    if ($users) {
4382
+
4383
+                        $ctusernamearruid = [];
4384
+                        $ctusernamearr = [];
4385
+                        foreach ($users as $usrKey => $usrValue) {
4386
+                             if ($usrValue != '') {
4387
+		                 // Get the username for this Display Name
4388
+		                 $getacdataunm = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ? AND `value` = ?');
4389
+		                 $getacdataunmres = $getacdataunm->execute(['displayname', $usrValue]);
4390
+		                 $acdatausrname = $getacdataunmres->fetch();
4391
+                                 if ($acdatausrname['uid'] != $userId) {
4392
+
4393
+		                     // Ensure the current user is not an admin
4394
+                                     if (!in_array($acdatausrname['uid'], $usersadmin)) {
4395
+                                         $ctusernamearruid[] = $acdatausrname['uid'];
4396
+                                         $ctusernamearr[] = $usrValue;
4397
+
4398
+                                     }
4399
+
4400
+                                 }
4401
+		                 $getacdataunmres->closeCursor();
4402
+                             }
4403
+                        }
4404
+
4405
+
4406
+                        // Update the allowed users in the 'sms_relent_subac' table
4407
+                        $usersalwdrs = implode("|", $ctusernamearr);
4408
+
4409
+		        if ($provider == "tnx") {
4410
+
4411
+	                    $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `tnx_users_allowed` = ?, `tnx_users_del` = ? WHERE `user_id` = ?');
4412
+	                    if ($datalwdres = $updatealwd->execute([$usersalwdrs, $usersdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4413
+
4414
+		        } elseif ($provider == "plv") {
4415
+
4416
+	                    $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `plv_users_allowed` = ?, `plv_users_del` = ? WHERE `user_id` = ?');
4417
+	                    if ($datalwdres = $updatealwd->execute([$usersalwdrs, $usersdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4418
+
4419
+		        } elseif ($provider == "twl") {
4420
+
4421
+	                    $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `twl_users_allowed` = ?, `twl_users_del` = ? WHERE `user_id` = ?');
4422
+	                    if ($datalwdres = $updatealwd->execute([$usersalwdrs, $usersdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4423
+
4424
+		        } elseif ($provider == "flr") {
4425
+
4426
+	                    $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `flr_users_allowed` = ?, `flr_users_del` = ? WHERE `user_id` = ?');
4427
+	                    if ($datalwdres = $updatealwd->execute([$usersalwdrs, $usersdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4428
+		        }
4429
+
4430
+                        $datalwdres->closeCursor();
4431
+
4432
+
4433
+                        // Insert/update the credentials in the 'sms_relent_settings' table, for each allowed user
4434
+                        $msgtosend = $this->updateusercredentials($userId, $ctusernamearruid, $provider, $telapiKey, $telpubKey, $telmsgprofid, $telsendername, $plivoapikey, 
4435
+                                                                  $plivoapisecret, $plivosendernm, $twilapikey, $twilapisecret, $twilsendernm, $flowapikey, $flowapisecret);
4436
+                    }
4437
+
4438
+                    // Insert the provider's API keys for the allowed groups
4439
+                    if ($groups) {
4440
+
4441
+                        $allwdgrps = [];
4442
+                        foreach ($groups as $groupkey => $groupvalue) {
4443
+
4444
+                                 if ($groupvalue != "admin" && $groupvalue != '') {
4445
+
4446
+                                     $allwdgrps[] = $groupvalue;
4447
+
4448
+                                     // Get all the users that belong to the group
4449
+			             $getacdusr = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
4450
+			             $getacdusrres = $getacdusr->execute([$groupvalue]);
4451
+
4452
+                                     $usersingrp = [];
4453
+			             while ($getacdusrnm = $getacdusrres->fetch()) {
4454
+                                            if ($getacdusrnm['uid'] != $userId) {
4455
+
4456
+		                                // Ensure the current user is not an admin
4457
+                                                if (!in_array($getacdusrnm['uid'], $usersadmin)) {
4458
+                                                     $usersingrp[] = $getacdusrnm['uid'];
4459
+                                                }
4460
+                                            }
4461
+                                     }
4462
+			             $getacdusrres->closeCursor();
4463
+
4464
+                                     // Insert the provider's API keys for each user of the allowed groups
4465
+                                     if ($usersingrp) {
4466
+                                         $msgtosend = $this->updateusercredentials($userId, $usersingrp, $provider, $telapiKey, $telpubKey, $telmsgprofid, $telsendername, $plivoapikey, 
4467
+                                                             $plivoapisecret, $plivosendernm, $twilapikey, $twilapisecret, $twilsendernm, $flowapikey, $flowapisecret);
4468
+                                     }
4469
+                                 }
4470
+
4471
+
4472
+		                 // Update the allowed groups in the 'sms_relent_subac' table
4473
+		                 $groupsalwdrs = implode("|", $allwdgrps);
4474
+
4475
+				 if ($provider == "tnx") {
4476
+
4477
+			             $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `tnx_groups_allowed` = ?, `tnx_groups_del` = ? WHERE `user_id` = ?');
4478
+			             if ($datalwdres = $updatealwd->execute([$groupsalwdrs, $groupsdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4479
+
4480
+				 } elseif ($provider == "plv") {
4481
+
4482
+			             $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `plv_groups_allowed` = ?, `plv_groups_del` = ? WHERE `user_id` = ?');
4483
+			             if ($datalwdres = $updatealwd->execute([$groupsalwdrs, $groupsdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4484
+
4485
+				 } elseif ($provider == "twl") {
4486
+
4487
+			             $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `twl_groups_allowed` = ?, `twl_groups_del` = ? WHERE `user_id` = ?');
4488
+			             if ($datalwdres = $updatealwd->execute([$groupsalwdrs, $groupsdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4489
+
4490
+				 } elseif ($provider == "flr") {
4491
+
4492
+			             $updatealwd = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_subac` SET `flr_groups_allowed` = ?, `flr_groups_del` = ? WHERE `user_id` = ?');
4493
+			             if ($datalwdres = $updatealwd->execute([$groupsalwdrs, $groupsdel, $userId])) { $msgtosend = 'success'; } else { $msgtosend = 'failure'; }
4494
+				 }
4495
+
4496
+		                 $datalwdres->closeCursor();
4497
+                        }
4498
+
4499
+                    }
4500
+
4501
+                }
4502
+
4503
+            }
4504
+
4505
+          } else { $msgtosend = "You have to save your credentials first, by clicking the 'Save' button at the bottom of this page, and then share your API keys with other users."; }
4506
+
4507
+          return $msgtosend;
4508
+       }
4509
+     }
4510
+
4511
+
4512
+     public function removenumberrestrictions($userId, $phoneNumber) {
4513
+
4514
+        if ($this->groupManager->isAdmin($userId)) {
4515
+
4516
+                // Remove the restrictions for the given phone number
4517
+		$delrstr = $this->connection->prepare('
4518
+		       DELETE FROM `*PREFIX*sms_relent_restrict`
4519
+		       WHERE `phone_number` = ?');
4520
+                if ($delrstrres = $delrstr->execute([$phoneNumber])) { $delresult = "success"; } else { $delresult = "failure"; }
4521
+		$delrstrres->closeCursor();
4522
+
4523
+	        $updateind = $this->connection->prepare('
4524
+                       SET @resetrec = 0;
4525
+		       UPDATE `*PREFIX*sms_relent_restrict`
4526
+		       SET `id` = @resetrec := @resetrec + 1;
4527
+                       ALTER TABLE `*PREFIX*sms_relent_restrict` auto_increment=1;');
4528
+	        $updateindres = $updateind->execute();
4529
+	        $updateindres->closeCursor();
4530
+
4531
+                return $delresult;
4532
+        }
4533
+     }
4534
+
4535
+
4536
+    /**
4537
+     * @NoAdminRequired
4538
+     */
4539
+    public function updateautoreplies($userId, $savedByDsplname, $phoneNumber, $daysOfWeek, $dailyStart, $dailyEnd, $vacationStart, $vacationEnd, $messageText) {
4540
+
4541
+        // Get the auto-reply for the current number from the 'sms_relent_autorply' table
4542
+        $getarpl = $this->connection->prepare('SELECT `user_id`, `saved_by_dsplname`, `phone_number`, `days_of_week`, `daily_start`, `daily_end`, `vacation_start`,
4543
+                                              `vacation_end`, `message_text` FROM `*PREFIX*sms_relent_autorply` WHERE `phone_number` = ?');
4544
+        $getarplresult = $getarpl->execute([$phoneNumber]);
4545
+        $crntarpl = $getarplresult->fetch();
4546
+        $getarplresult->closeCursor();
4547
+
4548
+        if ($getarplresult && !$crntarpl) {
4549
+
4550
+	    $insertpharpl = $this->connection->prepare('INSERT INTO `*PREFIX*sms_relent_autorply` (`user_id`, `saved_by_dsplname`, `phone_number`, `days_of_week`, 
4551
+                                                       `daily_start`, `daily_end`, `vacation_start`, `vacation_end`, `message_text`) VALUES
4552
+                                                        (?, ?, ?, ?, ?, ?, ?, ?, ?)');
4553
+	    if ($insertpharpl->execute([$userId, $savedByDsplname, $phoneNumber, $daysOfWeek, $dailyStart, $dailyEnd, $vacationStart, $vacationEnd, $messageText])) { 
4554
+                $messagetosend = 'success'; 
4555
+            } else { 
4556
+                $messagetosend = 'failure'; 
4557
+            }
4558
+         
4559
+        } elseif ($getarplresult && $crntarpl) {
4560
+
4561
+            if ($this->groupManager->isAdmin($userId)) {
4562
+
4563
+                $updatepharpl = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_autorply` SET `user_id` = ?, `saved_by_dsplname` = ?, `days_of_week` = ?, `daily_start` = ?,
4564
+                                                           `daily_end` = ?, `vacation_start` = ?, `vacation_end` = ?, `message_text` = ?  WHERE `phone_number` = ?');
4565
+	        if ($updatephnmbrarpl = $updatepharpl->execute([$userId, $savedByDsplname, $daysOfWeek, $dailyStart, $dailyEnd, $vacationStart, $vacationEnd, $messageText,
4566
+                                                                $phoneNumber])) { 
4567
+                    $messagetosend = 'success';
4568
+                } else { 
4569
+                    $messagetosend = 'failure'; 
4570
+                }
4571
+	        $updatephnmbrarpl->closeCursor();
4572
+
4573
+            } else {
4574
+
4575
+                // Check if the current user is the author of the existing version of the auto-reply
4576
+                if ($userId == $crntarpl['user_id']) {
4577
+
4578
+                    $updatepharpl = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_autorply` SET `user_id` = ?, `saved_by_dsplname` = ?, `days_of_week` = ?, `daily_start` = ?,
4579
+                                                               `daily_end` = ?, `vacation_start` = ?, `vacation_end` = ?, `message_text` = ?  WHERE `phone_number` = ?');
4580
+	            if ($updatephnmbrarpl = $updatepharpl->execute([$userId, $savedByDsplname, $daysOfWeek, $dailyStart, $dailyEnd, $vacationStart, $vacationEnd, $messageText,
4581
+                                                                    $phoneNumber])) { 
4582
+                        $messagetosend = 'success';
4583
+                    } else { 
4584
+                        $messagetosend = 'failure'; 
4585
+                    }
4586
+	            $updatephnmbrarpl->closeCursor();
4587
+
4588
+                } else { $messagetosend = 'not allowed'; }
4589
+            }
4590
+        }
4591
+
4592
+        return $messagetosend;
4593
+    }
4594
+
4595
+
4596
+    /**
4597
+     * @NoAdminRequired
4598
+     */
4599
+    public function removeautoreplies($userId, $phoneNumber) {
4600
+
4601
+        if ($this->groupManager->isAdmin($userId)) {
4602
+
4603
+                // Remove the auto-reply for the given phone number
4604
+		$delarpl = $this->connection->prepare('
4605
+		       DELETE FROM `*PREFIX*sms_relent_autorply`
4606
+		       WHERE `phone_number` = ?');
4607
+                if ($delarplres = $delarpl->execute([$phoneNumber])) { $delarplresult = "success"; } else { $delarplresult = "failure"; }
4608
+		$delarplres->closeCursor();
4609
+
4610
+	        $updateindarpl = $this->connection->prepare('
4611
+                       SET @resetarpl = 0;
4612
+		       UPDATE `*PREFIX*sms_relent_autorply`
4613
+		       SET `id` = @resetarpl := @resetarpl + 1;
4614
+                       ALTER TABLE `*PREFIX*sms_relent_autorply` auto_increment=1;');
4615
+	        $updateindarplres = $updateindarpl->execute();
4616
+	        $updateindarplres->closeCursor();
4617
+
4618
+                return $delarplresult;
4619
+
4620
+        } else {
4621
+                // Get the author of the auto-reply for the given phone number
4622
+		$getarplusr = $this->connection->prepare('SELECT `user_id`, `phone_number` FROM `*PREFIX*sms_relent_autorply` WHERE `phone_number` = ?');
4623
+		$getarplusrres = $getarplusr->execute([$phoneNumber]);
4624
+		$crntarpldata = $getarplusrres->fetch();
4625
+                $crntarpluser = $crntarpldata['user_id'];
4626
+		$getarplusrres->closeCursor();
4627
+
4628
+                // If the author of the auto-reply is the current user, allow the removal
4629
+                if ($crntarpluser == $userId) {
4630
+
4631
+                    // Remove the auto-reply for the given phone number
4632
+		    $delarpl = $this->connection->prepare('
4633
+		           DELETE FROM `*PREFIX*sms_relent_autorply`
4634
+		           WHERE `phone_number` = ?');
4635
+                    if ($delarplres = $delarpl->execute([$phoneNumber])) { $delarplresult = "success"; } else { $delarplresult = "failure"; }
4636
+		    $delarplres->closeCursor();
4637
+
4638
+	            $updateindarpl = $this->connection->prepare('
4639
+                           SET @resetarpl = 0;
4640
+		           UPDATE `*PREFIX*sms_relent_autorply`
4641
+		           SET `id` = @resetarpl := @resetarpl + 1;
4642
+                           ALTER TABLE `*PREFIX*sms_relent_autorply` auto_increment=1;');
4643
+	            $updateindarplres = $updateindarpl->execute();
4644
+	            $updateindarplres->closeCursor();
4645
+
4646
+                    return $delarplresult;
4647
+
4648
+                } else { 
4649
+                    return $delarplresult = 'not allowed';
4650
+                }
4651
+        }
4652
+    }
4653
+
4654
+
4655
+    public function getadminsettings($userId) {
4656
+
4657
+        if ($this->groupManager->isAdmin($userId)) {
4658
+
4659
+
4660
+	    $getsettings = $this->connection->prepare('
4661
+                            SELECT `id`, `user_id`, `telapi_key`, `tel_pub_key`, `telapi_url_rec`, `telapi_url`, `messaging_profile_id`, `nexapi_key`, `nexapi_secret`, `nexapi_url_rec`,
4662
+                                   `nexapi_url`, `twilapi_key`, `twilapi_secret`, `twilapi_url_rec`, `twilapi_url`, `flowapi_key`, `flowapi_secret`, `flowapi_url_rec`, `flowapi_url`, 
4663
+                                   `tel_sender_name`, `nex_sender_name`, `twil_sender_name`, `flow_sender_name`, `messagesperpage`, `get_notify`, `notification_email`, `getsmsinemail`, 
4664
+                                   `show_all_messages`
4665
+			    FROM  `*PREFIX*sms_relent_settings`
4666
+			    WHERE `user_id` = ?');
4667
+
4668
+	    $resultsettings = $getsettings->execute([$userId]);
4669
+
4670
+            $settingsadm = $resultsettings->fetch();
4671
+
4672
+	    $resultsettings->closeCursor();
4673
+
4674
+	    if ($settingsadm) {
4675
+
4676
+		    if ($settingsadm['telapi_key'] != '') {
4677
+
4678
+		        // Send a placeholder to the browser, instead of the real API key
4679
+		        $settingsadm['telapi_key'] = "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20";
4680
+		    }
4681
+		    if ($settingsadm['tel_pub_key'] != '') {
4682
+		        $settingsadm['tel_pub_key'] = "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20";
4683
+		    }
4684
+		    if ($settingsadm['messaging_profile_id'] != '') {
4685
+		        $settingsadm['messaging_profile_id'] = "%20%20%20%20%20%20%20%20%20%20%20%20";
4686
+		    }
4687
+		    if ($settingsadm['nexapi_key'] != '') {
4688
+		        $settingsadm['nexapi_key'] = "%20%20%20%20%20%20%20%20%20";
4689
+		    }
4690
+		    if ($settingsadm['nexapi_secret'] != '') {
4691
+		        $settingsadm['nexapi_secret'] = "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20";
4692
+		    }
4693
+		    if ($settingsadm['twilapi_key'] != '') {
4694
+		        $settingsadm['twilapi_key'] = "%20%20%20%20%20%20%20%20%20";
4695
+		    }
4696
+		    if ($settingsadm['twilapi_secret'] != '') {
4697
+		        $settingsadm['twilapi_secret'] = "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20";
4698
+		    }
4699
+		    if ($settingsadm['flowapi_key'] != '') {
4700
+		        $settingsadm['flowapi_key'] = "%20%20%20%20%20%20%20%20%20";
4701
+		    }
4702
+		    if ($settingsadm['flowapi_secret'] != '') {
4703
+		        $settingsadm['flowapi_secret'] = "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20";
4704
+		    }
4705
+
4706
+
4707
+		    // Get the Display Name of the current admin
4708
+		    $getacdatadn = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `uid` = ? AND `name` = ?');
4709
+		    $getacdatadnres = $getacdatadn->execute([$userId, 'displayname']);
4710
+		    $acdatausrdnadm = $getacdatadnres->fetch();
4711
+		    $cruserdname = $acdatausrdnadm['value'];
4712
+		    $getacdatadnres->closeCursor();
4713
+
4714
+		    // Get all the restrictions on phone numbers
4715
+		    $getrestr = $this->connection->prepare('SELECT `saved_by_dsplname`, `phone_number`, `groups`, `users` FROM `*PREFIX*sms_relent_restrict`');
4716
+		    $getrestres = $getrestr->execute();
4717
+
4718
+		    $restrictedArr = [];
4719
+		    while ($restrfetched = $getrestres->fetch()) {
4720
+		           $restrictedArr[] = $restrfetched;
4721
+		    }
4722
+		    $getrestres->closeCursor();
4723
+
4724
+		    if ($restrictedArr) { $restrictedUsers = $restrictedArr; } else { $restrictedUsers = ''; }
4725
+
4726
+
4727
+		    // Get the name of all the groups
4728
+		    $getgroups = $this->connection->prepare('SELECT `gid`, `displayname` FROM `*PREFIX*groups`');
4729
+		    $getgroupsres = $getgroups->execute();
4730
+
4731
+		    $groupsArr = [];
4732
+                    $allgroupswadmarr = [];
4733
+		    while ($groupsfetched = $getgroupsres->fetch()) {
4734
+
4735
+		           $groupsArr[] = $groupsfetched['gid'];
4736
+                           if ($groupsfetched['gid'] != 'admin') { $allgroupswadmarr[] = $groupsfetched['gid']; }
4737
+		    }
4738
+		    $getgroupsres->closeCursor();
4739
+
4740
+		    if ($groupsArr) { $allgroups = $groupsArr; } else { $allgroups = ''; }
4741
+                    if ($allgroupswadmarr) { $allgroupswadm = $allgroupswadmarr; } else { $allgroupswadm = ''; }
4742
+
4743
+		    // Get the users that belong to the 'admin' group
4744
+		    $getadmnsc = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
4745
+		    $getadmnscres = $getadmnsc->execute(['admin']);
4746
+
4747
+		    $usersadminsc = [];
4748
+		    while ($getadmnusrsc = $getadmnscres->fetch()) {
4749
+		           $usersadminsc[] = $getadmnusrsc['uid'];
4750
+		    }
4751
+		    $getadmnscres->closeCursor();
4752
+
4753
+
4754
+		    // Get the display name of all the users
4755
+		    $getusers = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ?');
4756
+		    $getusersres = $getusers->execute(['displayname']);
4757
+
4758
+		    $usersArr = [];
4759
+                    $alluserswadmarr = [];
4760
+		    while ($usersfetched = $getusersres->fetch()) {
4761
+
4762
+		           $usersArr[] = $usersfetched['value'];
4763
+                           if (!in_array($usersfetched['uid'], $usersadminsc)) { $alluserswadmarr[] = $usersfetched['value']; }
4764
+		    }
4765
+		    $getusersres->closeCursor();
4766
+
4767
+		    if ($usersArr) { $allusers = $usersArr; } else { $allusers = ''; }
4768
+                    if ($alluserswadmarr) { $alluserswadm = $alluserswadmarr; } else { $alluserswadm = ''; }
4769
+
4770
+                    // Get the groups and users that are allowed to use the API Keys, for each provider
4771
+                    $getalwdall = $this->connection->prepare('SELECT `user_id`, `tnx_groups_allowed`, `tnx_users_allowed`, `plv_groups_allowed`, `plv_users_allowed`,
4772
+                                                             `twl_groups_allowed`, `twl_users_allowed`, `flr_groups_allowed`, `flr_users_allowed`, `tnx_groups_del`, `tnx_users_del`,
4773
+                                                             `plv_groups_del`, `plv_users_del`, `twl_groups_del`, `twl_users_del`, `flr_groups_del`, `flr_users_del` 
4774
+                                                              FROM `*PREFIX*sms_relent_subac` WHERE `user_id` = ?');
4775
+                    $getalwdallres = $getalwdall->execute([$userId]);
4776
+                    $crtdtrow = $getalwdallres->fetch();
4777
+                    if ($crtdtrow) {
4778
+                        $allowedgrps = ['tnx_groups_allowed' => $crtdtrow['tnx_groups_allowed'], 'tnx_users_allowed' => $crtdtrow['tnx_users_allowed'], 
4779
+                                        'plv_groups_allowed' => $crtdtrow['plv_groups_allowed'], 'plv_users_allowed' => $crtdtrow['plv_users_allowed'],
4780
+                                        'twl_groups_allowed' => $crtdtrow['twl_groups_allowed'], 'twl_users_allowed' => $crtdtrow['twl_users_allowed'],
4781
+                                        'flr_groups_allowed' => $crtdtrow['flr_groups_allowed'], 'flr_users_allowed' => $crtdtrow['flr_users_allowed'],
4782
+                                        'tnx_groups_del' => $crtdtrow['tnx_groups_del'], 'tnx_users_del' => $crtdtrow['tnx_users_del'],
4783
+                                        'plv_groups_del' => $crtdtrow['plv_groups_del'], 'plv_users_del' => $crtdtrow['plv_users_del'],
4784
+                                        'twl_groups_del' => $crtdtrow['twl_groups_del'], 'twl_users_del' => $crtdtrow['twl_users_del'],
4785
+                                        'flr_groups_del' => $crtdtrow['flr_groups_del'], 'flr_users_del' => $crtdtrow['flr_users_del']];
4786
+                        $getalwdallres->closeCursor();
4787
+                    } else { $allowedgrps = []; }
4788
+
4789
+                    $settingsadm['admdisplayname'] = $cruserdname;
4790
+                    $settingsadm['restrictions'] = $restrictedUsers;
4791
+                    $settingsadm['allgroups'] = $allgroups;
4792
+                    $settingsadm['allusers'] = $allusers;
4793
+                    $settingsadm['allgroupswadm'] = $allgroupswadm;
4794
+                    $settingsadm['alluserswadm'] = $alluserswadm;  
4795
+                    $settingsadm['allowedkeysuse'] = $allowedgrps;
4796
+
4797
+		    return $settingsadm;
4798
+	    }
4799
+        }
4800
+     }
4801
+
4802
+
4803
+     /**
4804
+      * @NoAdminRequired
4805
+      *
4806
+      */
4807
+     public function updatesettings($userId, $telapiUrlRec, $telapiUrl, $nexapiUrlRec, $nexapiUrl, $twilapiUrlRec, $twilapiUrl, $flowapiUrlRec, $flowapiUrl, $messagesperpage, 
4808
+                                    $getNotify, $notificationEmail, $getsmsinemail, $showDisplayNames, $addDisplayNames, $msgCheckInterval, $archivedConvNmbr) {
4809
+        $upsettings = $this->connection->prepare('
4810
+                        SELECT `id`, `user_id`, `telapi_key`, `tel_pub_key`, `telapi_url_rec`, `telapi_url`, `messaging_profile_id`, `nexapi_key`, `nexapi_secret`, `nexapi_url_rec`,
4811
+                           `nexapi_url`, `twilapi_key`, `twilapi_secret`, `twilapi_url_rec`, `twilapi_url`, `flowapi_key`, `flowapi_secret`, `flowapi_url_rec`, `flowapi_url`, 
4812
+                           `tel_sender_name`, `nex_sender_name`, `twil_sender_name`, `flow_sender_name`, `messagesperpage`, `get_notify`, `notification_email`, `getsmsinemail`, 
4813
+                           `show_all_messages`, `show_display_names`, `add_display_names`, `available_numbers`, `msg_check_interval`, `new_message_rcd`, `archived_conv_nmbr`
4814
+		        FROM  `*PREFIX*sms_relent_settings`
4815
+		        WHERE `user_id` = ?');
4816
+
4817
+        $resultstng = $upsettings->execute([$userId]);
4818
+
4819
+        $rowup = $resultstng->fetch();
4820
+
4821
+        $resultstng->closeCursor();
4822
+
4823
+        if ($resultstng && !$rowup) {
4824
+
4825
+	    $sql = $this->connection->prepare('
4826
+				INSERT INTO `*PREFIX*sms_relent_settings`
4827
+					(`user_id`, `telapi_url_rec`, `telapi_url`, `nexapi_url_rec`, `nexapi_url`, `twilapi_url_rec`, `twilapi_url`, `flowapi_url_rec`, `flowapi_url`, 
4828
+                                         `messagesperpage`, `get_notify`, `notification_email`, `getsmsinemail`, `show_display_names`, `add_display_names`, `msg_check_interval`, 
4829
+                                         `archived_conv_nmbr`)
4830
+				VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
4831
+			');
4832
+	    $sql->execute([$userId, $telapiUrlRec, $telapiUrl, $nexapiUrlRec, $nexapiUrl, $twilapiUrlRec, $twilapiUrl, $flowapiUrlRec, $flowapiUrl, $messagesperpage, $getNotify, 
4833
+                           $notificationEmail, $getsmsinemail, $showDisplayNames, $addDisplayNames, $msgCheckInterval, $archivedConvNmbr]);
4834
+
4835
+        } elseif ($resultstng && $rowup) {
4836
+
4837
+	    $sqlupdatedb = $this->connection->prepare('
4838
+			UPDATE `*PREFIX*sms_relent_settings`
4839
+			SET `telapi_url_rec` = ?, `telapi_url` = ?, `nexapi_url_rec` = ?, `nexapi_url` = ?, `twilapi_url_rec` = ?, `twilapi_url` = ?, `flowapi_url_rec` = ?, 
4840
+                            `flowapi_url` = ?, `messagesperpage` = ?, `get_notify` = ?, `notification_email` = ?, `getsmsinemail` = ?, `show_display_names` = ?, `add_display_names` = ?,
4841
+                            `msg_check_interval` = ?, `archived_conv_nmbr` = ?
4842
+	                WHERE `user_id` = ?');
4843
+	    $updateRes = $sqlupdatedb->execute([$telapiUrlRec, $telapiUrl, $nexapiUrlRec, $nexapiUrl, $twilapiUrlRec, $twilapiUrl, $flowapiUrlRec, $flowapiUrl, $messagesperpage, 
4844
+                                                $getNotify, $notificationEmail, $getsmsinemail, $showDisplayNames, $addDisplayNames, $msgCheckInterval, $archivedConvNmbr, $userId]);
4845
+	    $updateRes->closeCursor();
4846
+
4847
+	}
4848
+     }
4849
+
4850
+
4851
+     public function updateadminsettings($userId, $telapiKey, $telPubKey, $telapiUrlRec, $telapiUrl, $messagingProfileId, $nexapiKey, $nexapiSecret, $nexapiUrlRec, $nexapiUrl,
4852
+                                         $telSenderName, $nexSenderName, $twilapiKey, $twilapiSecret, $twilapiUrlRec, $twilapiUrl, $twilSenderName, $flowapiKey, $flowapiSecret, 
4853
+                                         $flowapiUrlRec, $flowapiUrl, $showAllMessages) {
4854
+
4855
+        if ($this->groupManager->isAdmin($userId)) {
4856
+
4857
+            $upsettings = $this->connection->prepare('
4858
+                        SELECT `id`, `user_id`, `telapi_key`, `tel_pub_key`, `telapi_url_rec`, `telapi_url`, `messaging_profile_id`, `nexapi_key`, `nexapi_secret`, `nexapi_url_rec`,
4859
+                           `nexapi_url`, `twilapi_key`, `twilapi_secret`, `twilapi_url_rec`, `twilapi_url`, `flowapi_key`, `flowapi_secret`, `flowapi_url_rec`, `flowapi_url`, 
4860
+                           `tel_sender_name`, `nex_sender_name`, `twil_sender_name`, `flow_sender_name`, `messagesperpage`, `get_notify`, `notification_email`, `getsmsinemail`, 
4861
+                           `show_all_messages`, `show_display_names`, `add_display_names`
4862
+		        FROM  `*PREFIX*sms_relent_settings`
4863
+		        WHERE `user_id` = ?');
4864
+
4865
+            $resultstng = $upsettings->execute([$userId]);
4866
+
4867
+            $rowup = $resultstng->fetch();
4868
+
4869
+            $resultstng->closeCursor();
4870
+
4871
+            if ($resultstng && !$rowup) {
4872
+
4873
+	        if ($telapiKey != '') {
4874
+	            $telapikeystrenc = $this->crypto->encrypt($telapiKey);             
4875
+	        } else { $telapikeystrenc = ''; }
4876
+
4877
+	        if ($telPubKey != '') {
4878
+	            $telpubkeystrenc =  $this->crypto->encrypt($telPubKey);             
4879
+	        } else { $telpubkeystrenc = ''; }
4880
+
4881
+	        if ($messagingProfileId != '') {
4882
+	            $messagingprofenc = $this->crypto->encrypt($messagingProfileId);             
4883
+	        } else { $messagingprofenc = ''; }
4884
+
4885
+	        if ($nexapiKey != '') {
4886
+	            $nexapikeystrenc = $this->crypto->encrypt($nexapiKey);             
4887
+	        } else { $nexapikeystrenc = ''; }
4888
+
4889
+	        if ($nexapiSecret != '') {
4890
+	            $nexapisecretstrenc = $this->crypto->encrypt($nexapiSecret);             
4891
+	        } else { $nexapisecretstrenc = ''; }
4892
+
4893
+	        if ($twilapiKey != '') {
4894
+	            $twilapikeystrenc = $this->crypto->encrypt($twilapiKey);             
4895
+	        } else { $twilapikeystrenc = ''; }
4896
+
4897
+	        if ($twilapiSecret != '') {
4898
+	            $twilapisecretstrenc = $this->crypto->encrypt($twilapiSecret);             
4899
+	        } else { $twilapisecretstrenc = ''; }
4900
+
4901
+	        if ($flowapiKey != '') {
4902
+	            $flowapikeystrenc = $this->crypto->encrypt($flowapiKey);             
4903
+	        } else { $flowapikeystrenc = ''; }
4904
+
4905
+	        if ($flowapiSecret != '') {
4906
+	            $flowapisecretstrenc = $this->crypto->encrypt($flowapiSecret);             
4907
+	        } else { $flowapisecretstrenc = ''; }
4908
+
4909
+
4910
+	        $sql = $this->connection->prepare('
4911
+				INSERT INTO `*PREFIX*sms_relent_settings`
4912
+					(`user_id`, `telapi_key`, `tel_pub_key`, `telapi_url_rec`, `telapi_url`, `messaging_profile_id`, `nexapi_key`, `nexapi_secret`, `nexapi_url_rec`, 
4913
+	                                 `nexapi_url`, `tel_sender_name`, `nex_sender_name`, `twilapi_key`, `twilapi_secret`, `twilapi_url_rec`, `twilapi_url`, `twil_sender_name`, 
4914
+                                         `flowapi_key`, `flowapi_secret`, `flowapi_url_rec`, `flowapi_url`, `show_all_messages`)
4915
+				VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
4916
+			');
4917
+	        $sql->execute([$userId, $telapikeystrenc, $telpubkeystrenc, $telapiUrlRec, $telapiUrl, $messagingprofenc, $nexapikeystrenc, $nexapisecretstrenc, $nexapiUrlRec, 
4918
+                               $nexapiUrl, $telSenderName, $nexSenderName, $twilapikeystrenc, $twilapisecretstrenc, $twilapiUrlRec, $twilapiUrl, $twilSenderName, $flowapikeystrenc, 
4919
+                               $flowapisecretstrenc, $flowapiUrlRec, $flowapiUrl, $showAllMessages]);
4920
+
4921
+            } elseif ($resultstng && $rowup) {
4922
+
4923
+	        // Check if the value of the field is the placeholder or an empty string
4924
+	        if ($telapiKey != '' && $telapiKey != "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20") {
4925
+	            $telapikeystrenc = $this->crypto->encrypt($telapiKey);                
4926
+	        } elseif ($telapiKey == "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20") {
4927
+	            $telapikeystrenc = $rowup['telapi_key'];
4928
+	        } elseif ($telapiKey == '') {
4929
+	            $telapikeystrenc = '';
4930
+	        }
4931
+
4932
+	        if ($telPubKey != '' && $telPubKey != "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20") {
4933
+	            $telpubkeystrenc = $this->crypto->encrypt($telPubKey);                
4934
+	        } elseif ($telPubKey == "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20") {
4935
+	            $telpubkeystrenc = $rowup['tel_pub_key'];
4936
+	        } elseif ($telPubKey == '') {
4937
+	            $telpubkeystrenc = '';
4938
+	        }
4939
+
4940
+	        if ($messagingProfileId != '' && $messagingProfileId != "%20%20%20%20%20%20%20%20%20%20%20%20") {
4941
+	            $messagingprofenc = $this->crypto->encrypt($messagingProfileId);                
4942
+	        } elseif ($messagingProfileId == "%20%20%20%20%20%20%20%20%20%20%20%20") {
4943
+	            $messagingprofenc = $rowup['messaging_profile_id'];
4944
+	        } elseif ($messagingProfileId == '') {
4945
+	            $messagingprofenc = '';
4946
+	        }
4947
+
4948
+	        if ($nexapiKey != '' && $nexapiKey != "%20%20%20%20%20%20%20%20%20") {
4949
+	            $nexapikeystrenc = $this->crypto->encrypt($nexapiKey);                
4950
+	        } elseif ($nexapiKey == "%20%20%20%20%20%20%20%20%20") {
4951
+	            $nexapikeystrenc = $rowup['nexapi_key'];
4952
+	        } elseif ($nexapiKey == '') {
4953
+	            $nexapikeystrenc = '';
4954
+	        }
4955
+
4956
+	        if ($twilapiKey != '' && $twilapiKey != "%20%20%20%20%20%20%20%20%20") {
4957
+	            $twilapikeystrenc = $this->crypto->encrypt($twilapiKey);                
4958
+	        } elseif ($twilapiKey == "%20%20%20%20%20%20%20%20%20") {
4959
+	            $twilapikeystrenc = $rowup['twilapi_key'];
4960
+	        } elseif ($twilapiKey == '') {
4961
+	            $twilapikeystrenc = '';
4962
+	        }
4963
+
4964
+	        if ($flowapiKey != '' && $flowapiKey != "%20%20%20%20%20%20%20%20%20") {
4965
+	            $flowapikeystrenc = $this->crypto->encrypt($flowapiKey);                
4966
+	        } elseif ($flowapiKey == "%20%20%20%20%20%20%20%20%20") {
4967
+	            $flowapikeystrenc = $rowup['flowapi_key'];
4968
+	        } elseif ($flowapiKey == '') {
4969
+	            $flowapikeystrenc = '';
4970
+	        }
4971
+
4972
+	        if ($nexapiSecret != '' && $nexapiSecret != "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20") {
4973
+	            $nexapisecretstrenc = $this->crypto->encrypt($nexapiSecret);                
4974
+	        } elseif ($nexapiSecret == "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20") {
4975
+	            $nexapisecretstrenc = $rowup['nexapi_secret'];
4976
+	        } elseif ($nexapiSecret == '') {
4977
+	            $nexapisecretstrenc = '';
4978
+	        }
4979
+
4980
+	        if ($twilapiSecret != '' && $twilapiSecret != "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20") {
4981
+	            $twilapisecretstrenc = $this->crypto->encrypt($twilapiSecret);                
4982
+	        } elseif ($twilapiSecret == "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20") {
4983
+	            $twilapisecretstrenc = $rowup['twilapi_secret'];
4984
+	        } elseif ($twilapiSecret == '') {
4985
+	            $twilapisecretstrenc = '';
4986
+	        }
4987
+
4988
+	        if ($flowapiSecret != '' && $flowapiSecret != "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20") {
4989
+	            $flowapisecretstrenc = $this->crypto->encrypt($flowapiSecret);                
4990
+	        } elseif ($flowapiSecret == "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20") {
4991
+	            $flowapisecretstrenc = $rowup['flowapi_secret'];
4992
+	        } elseif ($flowapiSecret == '') {
4993
+	            $flowapisecretstrenc = '';
4994
+	        }
4995
+
4996
+	        $sqlupdatedb = $this->connection->prepare('
4997
+			UPDATE `*PREFIX*sms_relent_settings`
4998
+			SET `telapi_key` = ?, `tel_pub_key` = ?, `telapi_url_rec` = ?, `telapi_url` = ?, `messaging_profile_id` = ?, `nexapi_key` = ?, `nexapi_secret` = ?,
4999
+	                    `nexapi_url_rec` = ?, `nexapi_url` = ?, `tel_sender_name` = ?, `nex_sender_name` = ?, `twilapi_key` = ?, `twilapi_secret` = ?, `twilapi_url_rec` = ?, `twilapi_url` = ?, `twil_sender_name` = ?, `flowapi_key` = ?, 
5000
+	                    `flowapi_secret` = ?, `flowapi_url_rec` = ?, `flowapi_url` = ?, `show_all_messages` = ?
5001
+	                WHERE `user_id` = ?');
5002
+	        $updateRes = $sqlupdatedb->execute([$telapikeystrenc, $telpubkeystrenc, $telapiUrlRec, $telapiUrl, $messagingprofenc, $nexapikeystrenc, $nexapisecretstrenc, 
5003
+                                                    $nexapiUrlRec, $nexapiUrl, $telSenderName, $nexSenderName, $twilapikeystrenc, $twilapisecretstrenc, $twilapiUrlRec, $twilapiUrl, 
5004
+                                                    $twilSenderName, $flowapikeystrenc, $flowapisecretstrenc, $flowapiUrlRec, $flowapiUrl, $showAllMessages, $userId]);
5005
+	        $updateRes->closeCursor();
5006
+
5007
+	    }
5008
+        }
5009
+     }
5010
+
5011
+
5012
+     public function updatepersadmnsettings($userId, $messagesperpage, $getNotify, $notificationEmail, $getsmsinemail, $showDisplayNames, $addDisplayNames, $msgCheckInterval, 
5013
+                                            $archivedConvNmbr) {
5014
+
5015
+        if ($this->groupManager->isAdmin($userId)) {
5016
+
5017
+            $upsettings = $this->connection->prepare('
5018
+                        SELECT `id`, `user_id`, `telapi_key`, `tel_pub_key`, `telapi_url_rec`, `telapi_url`, `messaging_profile_id`, `nexapi_key`, `nexapi_secret`, `nexapi_url_rec`,
5019
+                           `nexapi_url`, `twilapi_key`, `twilapi_secret`, `twilapi_url_rec`, `twilapi_url`, `flowapi_key`, `flowapi_secret`, `flowapi_url_rec`, `flowapi_url`, 
5020
+                           `tel_sender_name`, `nex_sender_name`, `twil_sender_name`, `flow_sender_name`, `messagesperpage`, `get_notify`, `notification_email`, `getsmsinemail`, 
5021
+                           `show_all_messages`, `show_display_names`, `add_display_names`, `available_numbers`, `msg_check_interval`, `new_message_rcd`, `archived_conv_nmbr`
5022
+		        FROM  `*PREFIX*sms_relent_settings`
5023
+		        WHERE `user_id` = ?');
5024
+
5025
+            $resultstng = $upsettings->execute([$userId]);
5026
+
5027
+            $rowup = $resultstng->fetch();
5028
+
5029
+            $resultstng->closeCursor();
5030
+
5031
+            if ($resultstng && !$rowup) {
5032
+
5033
+	        $sql = $this->connection->prepare('
5034
+				INSERT INTO `*PREFIX*sms_relent_settings` (`user_id`, `messagesperpage`, `get_notify`, `notification_email`, `getsmsinemail`, `show_display_names`,
5035
+                                `add_display_names`, `msg_check_interval`, `archived_conv_nmbr`)
5036
+				VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)');
5037
+	        $sql->execute([$userId, $messagesperpage, $getNotify, $notificationEmail, $getsmsinemail, $showDisplayNames, $addDisplayNames, $msgCheckInterval, $archivedConvNmbr]);
5038
+
5039
+            } elseif ($resultstng && $rowup) {
5040
+
5041
+	        $sqlupdatedb = $this->connection->prepare('
5042
+			UPDATE `*PREFIX*sms_relent_settings`
5043
+			SET `messagesperpage` = ?, `get_notify` = ?, `notification_email` = ?, `getsmsinemail` = ?, `show_display_names` = ?, `add_display_names` = ?, 
5044
+                            `msg_check_interval` = ?, `archived_conv_nmbr` = ?
5045
+	                WHERE `user_id` = ?');
5046
+	        $updateRes = $sqlupdatedb->execute([$messagesperpage, $getNotify, $notificationEmail, $getsmsinemail, $showDisplayNames, $addDisplayNames, $msgCheckInterval, $archivedConvNmbr, $userId]);
5047
+	        $updateRes->closeCursor();
5048
+            }
5049
+        }
5050
+     }
5051
+
5052
+
5053
+     /**
5054
+      * @NoAdminRequired
5055
+      */
5056
+     public function getapicredentials($userId) {
5057
+
5058
+        $sqlcr = $this->connection->prepare('
5059
+              SELECT `id`, `user_id`, `telapi_key`, `tel_pub_key`, `telapi_url_rec`, `telapi_url`, `messaging_profile_id`, `nexapi_key`, `nexapi_secret`, `nexapi_url_rec`, `nexapi_url`,
5060
+                     `tel_sender_name`, `nex_sender_name`, `messagesperpage`, `get_notify`, `notification_email`, `getsmsinemail`, `twilapi_key`, `twilapi_secret`, `twilapi_url_rec`, 
5061
+                     `twilapi_url`, `twil_sender_name`, `flowapi_key`, `flowapi_secret`, `flowapi_url_rec`, `flowapi_url`, `add_display_names` FROM `*PREFIX*sms_relent_settings`
5062
+	      WHERE `user_id` = ?');
5063
+	$resultcr = $sqlcr->execute([$userId]);
5064
+        $settingsfrdb = $resultcr->fetch();
5065
+        $resultcr->closeCursor();
5066
+
5067
+        if (($settingsfrdb['telapi_key'] != '') && ($settingsfrdb['telapi_key'] != 'undefined') && ($settingsfrdb['telapi_key'] != null)) { 
5068
+             $telapikeystrdec = $this->crypto->decrypt($settingsfrdb['telapi_key']); 
5069
+        } else { $telapikeystrdec = ''; }
5070
+
5071
+        if (($settingsfrdb['tel_pub_key'] != '') && ($settingsfrdb['tel_pub_key'] != 'undefined') && ($settingsfrdb['tel_pub_key'] != null)) {
5072
+             $telpubkeystrdec = $this->crypto->decrypt($settingsfrdb['tel_pub_key']); 
5073
+        } else { $telpubkeystrdec = ''; }
5074
+
5075
+        $telapiurlrec = $settingsfrdb['telapi_url_rec'];
5076
+        $telapiurlstr = $settingsfrdb['telapi_url'];
5077
+
5078
+        if (($settingsfrdb['messaging_profile_id'] != '') && ($settingsfrdb['messaging_profile_id'] != 'undefined') && ($settingsfrdb['messaging_profile_id'] != null)) {
5079
+             $messagingprofid = $this->crypto->decrypt($settingsfrdb['messaging_profile_id']); 
5080
+        } else { $messagingprofid = ''; }
5081
+
5082
+        if (($settingsfrdb['nexapi_key'] != '') && ($settingsfrdb['nexapi_key'] != 'undefined') && ($settingsfrdb['nexapi_key'] != null)) { 
5083
+             $nexapikeystr = $this->crypto->decrypt($settingsfrdb['nexapi_key']); 
5084
+        } else { $nexapikeystr = ''; }
5085
+
5086
+        if (($settingsfrdb['nexapi_secret'] != '') && ($settingsfrdb['nexapi_secret'] != 'undefined') && ($settingsfrdb['nexapi_secret'] != null)) { 
5087
+             $nexapisecretstr = $this->crypto->decrypt($settingsfrdb['nexapi_secret']); 
5088
+        } else { $nexapisecretstr = ''; }
5089
+
5090
+        if (($settingsfrdb['twilapi_key'] != '') && ($settingsfrdb['twilapi_key'] != 'undefined') && ($settingsfrdb['twilapi_key'] != null)) { 
5091
+             $twilapikeystr = $this->crypto->decrypt($settingsfrdb['twilapi_key']); 
5092
+        } else { $twilapikeystr = ''; }
5093
+
5094
+        if (($settingsfrdb['twilapi_secret'] != '') && ($settingsfrdb['twilapi_secret'] != 'undefined') && ($settingsfrdb['twilapi_secret'] != null)) { 
5095
+             $twilapisecretstr = $this->crypto->decrypt($settingsfrdb['twilapi_secret']); 
5096
+        } else { $twilapisecretstr = ''; }
5097
+
5098
+        if (($settingsfrdb['flowapi_key'] != '') && ($settingsfrdb['flowapi_key'] != 'undefined') && ($settingsfrdb['flowapi_key'] != null)) { 
5099
+             $flowapikeystr = $this->crypto->decrypt($settingsfrdb['flowapi_key']); 
5100
+        } else { $flowapikeystr = ''; }
5101
+
5102
+        if (($settingsfrdb['flowapi_secret'] != '') && ($settingsfrdb['flowapi_secret'] != 'undefined') && ($settingsfrdb['flowapi_secret'] != null)) { 
5103
+             $flowapisecretstr = $this->crypto->decrypt($settingsfrdb['flowapi_secret']); 
5104
+        } else { $flowapisecretstr = ''; }
5105
+
5106
+        $nexapiurlrecsms = $settingsfrdb['nexapi_url_rec'];
5107
+        $nexapiurldelrcpt = $settingsfrdb['nexapi_url'];
5108
+        $twilapiurlrecsms = $settingsfrdb['twilapi_url_rec'];
5109
+        $twilapiurldelrcpt = $settingsfrdb['twilapi_url'];
5110
+        $flowapiurlrecsms = $settingsfrdb['flowapi_url_rec'];
5111
+        $flowapiurldelrcpt = $settingsfrdb['flowapi_url'];
5112
+        $gettelsendername = $settingsfrdb['tel_sender_name'];
5113
+        $getnexsendername = $settingsfrdb['nex_sender_name'];
5114
+        $gettwilsendername = $settingsfrdb['twil_sender_name'];
5115
+        $getmessagesperpage = $settingsfrdb['messagesperpage'];
5116
+        $getnotification = $settingsfrdb['get_notify'];
5117
+        $notifyemail = $settingsfrdb['notification_email'];
5118
+        $includesmsinemail = $settingsfrdb['getsmsinemail'];
5119
+        $includeDisplNames = $settingsfrdb['add_display_names'];
5120
+
5121
+        return [$telapikeystrdec, $telpubkeystrdec, $telapiurlrec, $telapiurlstr, $messagingprofid, $nexapikeystr, $nexapisecretstr, $nexapiurlrecsms, $nexapiurldelrcpt,
5122
+                $gettelsendername, $getnexsendername, $getmessagesperpage, $getnotification, $notifyemail, $includesmsinemail, $twilapikeystr, $twilapisecretstr, $twilapiurlrecsms, 
5123
+                $twilapiurldelrcpt, $gettwilsendername, $flowapikeystr, $flowapisecretstr, $flowapiurlrecsms, $flowapiurldelrcpt, $includeDisplNames];
5124
+     }
5125
+
5126
+     /**
5127
+      * @NoAdminRequired
5128
+      */
5129
+     public function getuserbytelrecwhurl($recsmswebhookurl) {
5130
+
5131
+        $sqlrec = $this->connection->prepare('SELECT `user_id`, `telapi_url_rec` FROM `*PREFIX*sms_relent_settings` WHERE `telapi_url_rec` = ?');
5132
+	$result = $sqlrec->execute([$recsmswebhookurl]);
5133
+        $datafromdb = $result->fetch();
5134
+        $result->closeCursor();
5135
+        $ncusertelrec = $datafromdb['user_id'];
5136
+
5137
+        return $ncusertelrec;
5138
+     }
5139
+
5140
+     /**
5141
+      * @NoAdminRequired
5142
+      */
5143
+     public function getuserbyteldelrwhurl($delsmswebhookurl) {
5144
+
5145
+        $sqldel = $this->connection->prepare('SELECT `user_id`, `telapi_url` FROM `*PREFIX*sms_relent_settings` WHERE `telapi_url` = ?');
5146
+	$ressqldel = $sqldel->execute([$delsmswebhookurl]);
5147
+        $datafromdbdel = $ressqldel->fetch();
5148
+        $ressqldel->closeCursor();
5149
+        $ncuserteldel = $datafromdbdel['user_id'];
5150
+
5151
+        return $ncuserteldel;
5152
+     }
5153
+
5154
+     /**
5155
+      * @NoAdminRequired
5156
+      */
5157
+     public function getuserbyplivorecwhurl($plivorecurl) {
5158
+
5159
+        $sqlrecpl = $this->connection->prepare('SELECT `user_id`, `nexapi_url_rec` FROM `*PREFIX*sms_relent_settings` WHERE `nexapi_url_rec` = ?');
5160
+	$plresrecsql = $sqlrecpl->execute([$plivorecurl]);
5161
+        $pldatafromdb = $plresrecsql->fetch();
5162
+        $plresrecsql->closeCursor();
5163
+        $ncuserplrec = $pldatafromdb['user_id'];
5164
+
5165
+        return $ncuserplrec;
5166
+     }
5167
+
5168
+     /**
5169
+      * @NoAdminRequired
5170
+      */
5171
+     public function getuserbyplivodelrwhurl($plivodrurl) {
5172
+
5173
+        $sqldrpl = $this->connection->prepare('SELECT `user_id`, `nexapi_url` FROM `*PREFIX*sms_relent_settings` WHERE `nexapi_url` = ?');
5174
+	$ressqldelrec = $sqldrpl->execute([$plivodrurl]);
5175
+        $datafromdbdr = $ressqldelrec->fetch();
5176
+        $ressqldelrec->closeCursor();
5177
+        $ncuserplivodel = $datafromdbdr['user_id'];
5178
+
5179
+        return $ncuserplivodel;
5180
+     }
5181
+
5182
+     /**
5183
+      * @NoAdminRequired
5184
+      */
5185
+     public function getuserbytwilrecwhurl($twilrecurl) {
5186
+
5187
+        $sqlrectw = $this->connection->prepare('SELECT `user_id`, `twilapi_url_rec` FROM `*PREFIX*sms_relent_settings` WHERE `twilapi_url_rec` = ?');
5188
+	$twresrecsql = $sqlrectw->execute([$twilrecurl]);
5189
+        $twdatafromdb = $twresrecsql->fetch();
5190
+        $twresrecsql->closeCursor();
5191
+        $ncusertwrec = $twdatafromdb['user_id'];
5192
+
5193
+        return $ncusertwrec;
5194
+     }
5195
+
5196
+     /**
5197
+      * @NoAdminRequired
5198
+      */
5199
+     public function getuserbytwildelrwhurl($twildrurl) {
5200
+
5201
+        $sqldrtw = $this->connection->prepare('SELECT `user_id`, `twilapi_url` FROM `*PREFIX*sms_relent_settings` WHERE `twilapi_url` = ?');
5202
+	$ressqldelrectw = $sqldrtw->execute([$twildrurl]);
5203
+        $datafromdbdrtw = $ressqldelrectw->fetch();
5204
+        $ressqldelrectw->closeCursor();
5205
+        $ncusertwildel = $datafromdbdrtw['user_id'];
5206
+
5207
+        return $ncusertwildel;
5208
+     }
5209
+
5210
+     /**
5211
+      * @NoAdminRequired
5212
+      */
5213
+     public function getuserbyflowrecwhurl($flowrecurl) {
5214
+
5215
+        $sqlrecfl = $this->connection->prepare('SELECT `user_id`, `flowapi_url_rec` FROM `*PREFIX*sms_relent_settings` WHERE `flowapi_url_rec` = ?');
5216
+	$flresrecsql = $sqlrecfl->execute([$flowrecurl]);
5217
+        $fldatafromdb = $flresrecsql->fetch();
5218
+        $flresrecsql->closeCursor();
5219
+        $ncuserflrec = $fldatafromdb['user_id'];
5220
+
5221
+        return $ncuserflrec;
5222
+     }
5223
+
5224
+     /**
5225
+      * @NoAdminRequired
5226
+      */
5227
+     public function getuserbyflowdelrwhurl($flowdrurl) {
5228
+
5229
+        $sqldrfl = $this->connection->prepare('SELECT `user_id`, `flowapi_url` FROM `*PREFIX*sms_relent_settings` WHERE `flowapi_url` = ?');
5230
+	$ressqldelrecfl = $sqldrfl->execute([$flowdrurl]);
5231
+        $datafromdbdrfl = $ressqldelrecfl->fetch();
5232
+        $ressqldelrecfl->closeCursor();
5233
+        $ncuserflowdel = $datafromdbdrfl['user_id'];
5234
+
5235
+        return $ncuserflowdel;
5236
+     }
5237
+
5238
+
5239
+    /**
5240
+     * @NoAdminRequired
5241
+     */
5242
+    public function object_to_array($obj) {
5243
+        if (is_object($obj)) $obj = (array)$this->dismount($obj);
5244
+        if (is_array($obj)) {
5245
+           $new = array();
5246
+           foreach($obj as $key => $val) {
5247
+               $new[$key] = $this->object_to_array($val);
5248
+           }
5249
+        }
5250
+        else $new = $obj;
5251
+        return $new;
5252
+    }
5253
+
5254
+
5255
+    /**
5256
+     * @NoAdminRequired
5257
+     */
5258
+    public function dismount($object) {
5259
+        $reflectionClass = new ReflectionClass(get_class($object));
5260
+        $array = array();
5261
+        foreach ($reflectionClass->getProperties() as $property) {
5262
+           $property->setAccessible(true);
5263
+           $array[$property->getName()] = $property->getValue($object);
5264
+           $property->setAccessible(false);
5265
+        }
5266
+        return $array;
5267
+    }
5268
+
5269
+
5270
+    /**
5271
+     * @NoAdminRequired
5272
+     */
5273
+    public function getallowedusers($userId) {
5274
+
5275
+        // Collect the users with whom the current admin is sharing his API keys and whose messages he will be able to see
5276
+        if ($this->groupManager->isAdmin($userId)) {
5277
+
5278
+            // Get the groups and users that were allowed access to the API keys
5279
+            $getgrps = $this->connection->prepare('SELECT `user_id`, `tnx_groups_allowed`, `tnx_users_allowed`, `plv_groups_allowed`, `plv_users_allowed`,
5280
+                                                  `twl_groups_allowed`, `twl_users_allowed`, `flr_groups_allowed`, `flr_users_allowed` FROM `*PREFIX*sms_relent_subac`
5281
+                                                   WHERE `user_id` = ?');
5282
+            $getgrpsres = $getgrps->execute([$userId]);
5283
+            $getgrpsusr = $getgrpsres->fetch();
5284
+            $getgrpsres->closeCursor();
5285
+
5286
+            if ($getgrpsusr) {
5287
+
5288
+                if ($getgrpsusr['tnx_users_allowed']) { $tnxusers = explode("|", $getgrpsusr['tnx_users_allowed']); } else { $tnxusers = []; }
5289
+                if ($getgrpsusr['plv_users_allowed']) { $plvusers = explode("|", $getgrpsusr['plv_users_allowed']); } else { $plvusers = []; }
5290
+                if ($getgrpsusr['twl_users_allowed']) { $twlusers = explode("|", $getgrpsusr['twl_users_allowed']); } else { $twlusers = []; }
5291
+                if ($getgrpsusr['flr_users_allowed']) { $flrusers = explode("|", $getgrpsusr['flr_users_allowed']); } else { $flrusers = []; }
5292
+
5293
+                $allwdusersarr = array_merge($tnxusers, $plvusers, $twlusers, $flrusers);
5294
+                $allwdusersunq = array_filter(array_unique($allwdusersarr));
5295
+
5296
+                if ($getgrpsusr['tnx_groups_allowed']) { $tnxgroups = explode("|", $getgrpsusr['tnx_groups_allowed']); } else { $tnxgroups = []; }
5297
+                if ($getgrpsusr['plv_groups_allowed']) { $plvgroups = explode("|", $getgrpsusr['plv_groups_allowed']); } else { $plvgroups = []; }
5298
+                if ($getgrpsusr['twl_groups_allowed']) { $twlgroups = explode("|", $getgrpsusr['twl_groups_allowed']); } else { $twlgroups = []; }
5299
+                if ($getgrpsusr['flr_groups_allowed']) { $flrgroups = explode("|", $getgrpsusr['flr_groups_allowed']); } else { $flrgroups = []; }
5300
+
5301
+                $allwdgroupsarr = array_merge($tnxgroups, $plvgroups, $twlgroups, $flrgroups);
5302
+                $allwdgroupsunq = array_filter(array_unique($allwdgroupsarr));
5303
+
5304
+            } else {
5305
+                $allwdusersunq = [];
5306
+                $allwdgroupsunq = [];
5307
+            }
5308
+
5309
+            // Get the username for each Display Name of the allowed users
5310
+            $allwdusersfnl = [];
5311
+            foreach ($allwdusersunq as $alwdusrkey => $alwdusrvalue) {
5312
+
5313
+                         $getacdatausrnm = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `name` = ? AND `value` = ?');
5314
+		         $getacdatausrnmres = $getacdatausrnm->execute(['displayname', $alwdusrvalue]);
5315
+		         $acdatausrname = $getacdatausrnmres->fetch();
5316
+                         if ($acdatausrname) {
5317
+                             $allwdusersfnl[] = $acdatausrname['uid'];
5318
+                         }
5319
+                         $getacdatausrnmres->closeCursor();
5320
+            }
5321
+
5322
+            // Get the users from all the allowed groups
5323
+            $allwdusersgrpmlt = [];
5324
+            foreach ($allwdgroupsunq as $prgrpkey => $prgrpvalue) {
5325
+
5326
+                     // Get all the users that belong to the current group, if the current group is different from 'admin'
5327
+                     if ($prgrpvalue != 'admin') {
5328
+                         $getusringroup = $this->connection->prepare('SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?');
5329
+		         $getusringroupres = $getusringroup->execute([$prgrpvalue]);
5330
+
5331
+		         while ($getusrname = $getusringroupres->fetch()) {
5332
+
5333
+                                $allwdusersgrpmlt[] = $getusrname['uid'];
5334
+                         }
5335
+		         $getusringroupres->closeCursor();
5336
+                     }
5337
+            }
5338
+            $allwdusersgrpfnl = array_unique($allwdusersgrpmlt);
5339
+            
5340
+            $allusr = array_merge($allwdusersfnl, $allwdusersgrpfnl);
5341
+            $allusruniquest = array_unique($allusr);
5342
+
5343
+            if ($allusruniquest) {
5344
+                array_unshift($allusruniquest, $userId);
5345
+                $allusruniquerc = $allusruniquest;
5346
+            } else { $allusruniquerc = [$userId]; }
5347
+
5348
+            return $allusruniquerc;
5349
+
5350
+        } else { return [$userId]; }
5351
+    }
5352
+
5353
+
5354
+    /**
5355
+     * @NoAdminRequired
5356
+     */
5357
+    public function getsmsnumbers($userId) {
5358
+
5359
+        // Check if there are any saved phone numbers for the current user
5360
+        $getnumbers = $this->connection->prepare('SELECT `user_id`, `available_numbers` FROM `*PREFIX*sms_relent_settings` WHERE `user_id` = ?');
5361
+	$getcrtusrno = $getnumbers->execute([$userId]);
5362
+        $getusrnmbrs = $getcrtusrno->fetch();
5363
+        $getcrtusrno->closeCursor();
5364
+
5365
+        if ($getusrnmbrs['available_numbers']) {
5366
+
5367
+            $retrievednmbrs = $getusrnmbrs['available_numbers'];
5368
+            $getnmbrsarr = explode("|", $retrievednmbrs);
5369
+            $numbersforuser = array_filter($getnmbrsarr);
5370
+            return $numbersforuser;
5371
+
5372
+        // Get the available phone numbers for the current user from the SMS providers
5373
+        } else {
5374
+
5375
+            $smsapicred = $this->getapicredentials($userId);
5376
+
5377
+            $telnyxkey = $smsapicred[0];
5378
+
5379
+            $nexapikey = $smsapicred[5];
5380
+            $nexapisecret = $smsapicred[6];
5381
+
5382
+            $twilapikey = $smsapicred[15];
5383
+            $twilapisecret = $smsapicred[16];
5384
+
5385
+            $flowapikey = $smsapicred[20];
5386
+            $flowapisecret = $smsapicred[21];
5387
+
5388
+            $telsendernameinit = $smsapicred[9];
5389
+            $nexsendernameinit = $smsapicred[10];
5390
+            $twilsendernameinit = $smsapicred[19];
5391
+
5392
+            if ($telsendernameinit) {
5393
+                $telsendername = "Tx: " . $telsendernameinit;
5394
+                $telsenderarr = [0 => $telsendername];
5395
+            } else { $telsenderarr = []; }
5396
+
5397
+            if ($nexsendernameinit) {
5398
+                $nexsendername = "Pl: " . $nexsendernameinit;
5399
+                $nexsenderarr = [0 => $nexsendername];
5400
+            } else { $nexsenderarr = []; }
5401
+
5402
+            if ($twilsendernameinit) {
5403
+                $twilsendername = "Tw: " . $twilsendernameinit;
5404
+                $twilsenderarr = [0 => $twilsendername];
5405
+            } else { $twilsenderarr = []; }
5406
+
5407
+            // Get Telnyx phone numbers
5408
+            if ($telnyxkey != '') {
5409
+
5410
+               \Telnyx\Telnyx::setApiKey($telnyxkey);
5411
+               $telnumbers = \Telnyx\MessagingPhoneNumber::All();
5412
+
5413
+               $telnumbersarr = $this->object_to_array($telnumbers);
5414
+               $telnmbrs = [];
5415
+
5416
+               foreach ($telnumbersarr['_originalValues'] as $nmbkey => $nmbvalue) {
5417
+                   if (is_int($nmbkey)) {
5418
+                       foreach ($nmbvalue as $nkey => $nvalue) {
5419
+                           if ($nkey == 'phone_number' && $nvalue) {
5420
+                               $telnmbrs[] = "Tx: " . $nvalue;
5421
+                           }
5422
+                       }
5423
+                   }
5424
+               }
5425
+
5426
+            } else { $telnmbrs = []; }
5427
+
5428
+            // Get Plivo phone numbers
5429
+            if ($nexapikey != '' && $nexapisecret != '') {
5430
+
5431
+               $getacdata = "https://".$nexapikey.":".$nexapisecret."@api.plivo.com/v1/Account/".$nexapikey."/Number/";
5432
+               $acdata = file_get_contents($getacdata);
5433
+               $datainit = json_decode($acdata, true);
5434
+
5435
+               $findata = $this->object_to_array($datainit);
5436
+
5437
+               $nexcurrentnmbrs = [];
5438
+
5439
+               foreach ($findata['objects'] as $smskey => $smsvalue) {
5440
+                       if (is_array($smsvalue)) {
5441
+                             foreach ($smsvalue as $smskey2 => $smsvalue2) {
5442
+                                   if ($smskey2 == 'number' && $smsvalue2) {
5443
+                                       $nexcurrentnmbrs[] = "Pl: +" . $smsvalue2;
5444
+                                   }
5445
+                             }
5446
+                       }
5447
+               }
5448
+
5449
+            } else { $nexcurrentnmbrs = []; }
5450
+
5451
+            // Get Twilio phone numbers
5452
+            if ($twilapikey != '' && $twilapisecret != '') {
5453
+
5454
+                $twilnumbers = json_decode(file_get_contents("https://".$twilapikey.":".$twilapisecret."@api.twilio.com/2010-04-01/Accounts/".$twilapikey."/IncomingPhoneNumbers.json"), true);
5455
+                $twilactivenmbrs = $twilnumbers['incoming_phone_numbers'];
5456
+
5457
+                $twilcurrentnmbrs = [];
5458
+                foreach ($twilactivenmbrs as $twnbkey => $twnbvalue) {
5459
+                     if (is_array($twnbvalue)) {
5460
+                         foreach ($twnbvalue as $twfkey => $twfvalue) {
5461
+                              if ($twfkey == 'phone_number' && $twfvalue) {
5462
+                                  $twilcurrentnmbrs[] = "Tw: " . $twfvalue;
5463
+                              }
5464
+                         }
5465
+                     }
5466
+                }
5467
+
5468
+            } else { $twilcurrentnmbrs = []; }
5469
+
5470
+            // Get Flowroute phone numbers
5471
+            if ($flowapikey != '' && $flowapisecret != '') {
5472
+
5473
+                $flnbrsresult = json_decode(file_get_contents("https://".$flowapikey.":".$flowapisecret."@api.flowroute.com/v2/numbers"));
5474
+                $flnbrsarr = $flnbrsresult->data;
5475
+                $flowcurrentnmbrs = [];
5476
+                foreach ($flnbrsarr as $flkey => $flitem) {
5477
+                         if ($flitem->id) {
5478
+                             $flowcurrentnmbrs[] = "Fl: +" . $flitem->id;
5479
+                         }
5480
+                }
5481
+
5482
+            } else { $flowcurrentnmbrs = []; }
5483
+
5484
+            $currentnmbrs = array_merge($telnmbrs, $nexcurrentnmbrs, $twilcurrentnmbrs, $flowcurrentnmbrs, $telsenderarr, $nexsenderarr, $twilsenderarr);
5485
+
5486
+            if ($this->groupManager->isAdmin($userId)) {
5487
+
5488
+                // Save the available phone numbers for the current user
5489
+                $availablenmbrs = implode("|", $currentnmbrs);
5490
+                $savephno = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `available_numbers` = ? WHERE `user_id` = ?');
5491
+                $upusrphnmbrs = $savephno->execute([$availablenmbrs, $userId]);
5492
+	        $upusrphnmbrs->closeCursor();
5493
+
5494
+                return $currentnmbrs;
5495
+
5496
+            } else {
5497
+
5498
+                // Get the restrictions from the 'sms_relent_restrict' table
5499
+                $getrestr = $this->connection->prepare('
5500
+		            SELECT `phone_number`, `groups`, `users` FROM `*PREFIX*sms_relent_restrict`');
5501
+                $getrestrres = $getrestr->execute();
5502
+
5503
+                $restrdata = [];
5504
+                while ($restrfetched = $getrestrres->fetch()) {
5505
+                       $restrdata[] = $restrfetched;
5506
+                }
5507
+                $getrestrres->closeCursor();
5508
+
5509
+                if ($restrdata) {
5510
+
5511
+                    // Get the groups to which the current user belongs
5512
+                    $getusrgrp = $this->connection->prepare('
5513
+		                 SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `uid` = ?');
5514
+                    $getusrgrpres = $getusrgrp->execute([$userId]);
5515
+
5516
+                    $usergrps = [];
5517
+                    while ($fetchedgrps = $getusrgrpres->fetch()) {
5518
+                           $usergrps[] = $fetchedgrps['gid'];
5519
+                    }
5520
+                    $getusrgrpres->closeCursor();
5521
+                    $ctusergroups = implode("|", $usergrps);
5522
+
5523
+		    // Get the Display Name of the current user
5524
+		    $getacdatadn = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `uid` = ? AND `name` = ?');
5525
+		    $getacdatadnres = $getacdatadn->execute([$userId, 'displayname']);
5526
+		    $acdatausrdnadm = $getacdatadnres->fetch();
5527
+		    $cruserdname = $acdatausrdnadm['value'];
5528
+		    $getacdatadnres->closeCursor();
5529
+
5530
+                    // Get the phone numbers that are not allowed for the current user
5531
+                    $restrPhoneNb = [];
5532
+                    foreach ($restrdata as $rskey => $rsvalue) {
5533
+
5534
+                        $chck = 0;
5535
+                        if ($rsvalue['groups']) {
5536
+                            $restrgrparr = explode("|", $rsvalue['groups']);
5537
+
5538
+                            foreach ($restrgrparr as $grkey => $grvalue) {
5539
+                                     if (str_contains($ctusergroups, $grvalue)) { $chck++; }
5540
+                            }
5541
+                        }
5542
+
5543
+                        if ($rsvalue['users']) {
5544
+                            $usrnmstr = $rsvalue['users'];
5545
+                            if (str_contains($usrnmstr, $cruserdname)) { $chck++; }
5546
+                        }
5547
+
5548
+                        if ($chck == 0) { $restrPhoneNb[] = $rsvalue['phone_number']; }
5549
+                    }
5550
+
5551
+                    $restrPhoneNmbrs = array_unique($restrPhoneNb);
5552
+
5553
+                    // Assemble the array of phone numbers that the current user is allowed to use
5554
+                    for ($k = 0; $k < count($currentnmbrs); $k++) {
5555
+
5556
+                        if (in_array($currentnmbrs[$k], $restrPhoneNmbrs)) {
5557
+                            unset($currentnmbrs[$k]);
5558
+                        }
5559
+                    }
5560
+
5561
+                    $currentnmbrsrstr = array_values($currentnmbrs);
5562
+
5563
+                    // Save the available phone numbers for the current user
5564
+                    $availablenmbrs = implode("|", $currentnmbrsrstr);
5565
+                    $savephno = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `available_numbers` = ? WHERE `user_id` = ?');
5566
+                    $upusrphnmbrs = $savephno->execute([$availablenmbrs, $userId]);
5567
+	            $upusrphnmbrs->closeCursor();
5568
+
5569
+                    return $currentnmbrsrstr;
5570
+
5571
+                } else {
5572
+
5573
+                    // Save the available phone numbers for the current user
5574
+                    $availablenmbrs = implode("|", $currentnmbrs);
5575
+                    $savephno = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `available_numbers` = ? WHERE `user_id` = ?');
5576
+                    $upusrphnmbrs = $savephno->execute([$availablenmbrs, $userId]);
5577
+	            $upusrphnmbrs->closeCursor();
5578
+
5579
+                    return $currentnmbrs; 
5580
+                }
5581
+            }
5582
+        }
5583
+    }
5584
+
5585
+
5586
+    /**
5587
+     * @NoAdminRequired
5588
+     */
5589
+    public function refreshavailablenumbers($userId) {
5590
+
5591
+        $smsapicred = $this->getapicredentials($userId);
5592
+
5593
+        $telnyxkey = $smsapicred[0];
5594
+
5595
+        $nexapikey = $smsapicred[5];
5596
+        $nexapisecret = $smsapicred[6];
5597
+
5598
+        $twilapikey = $smsapicred[15];
5599
+        $twilapisecret = $smsapicred[16];
5600
+
5601
+        $flowapikey = $smsapicred[20];
5602
+        $flowapisecret = $smsapicred[21];
5603
+
5604
+        $telsendernameinit = $smsapicred[9];
5605
+        $nexsendernameinit = $smsapicred[10];
5606
+        $twilsendernameinit = $smsapicred[19];
5607
+
5608
+        if ($telsendernameinit) {
5609
+            $telsendername = "Tx: " . $telsendernameinit;
5610
+            $telsenderarr = [0 => $telsendername];
5611
+        } else { $telsenderarr = []; }
5612
+
5613
+        if ($nexsendernameinit) {
5614
+            $nexsendername = "Pl: " . $nexsendernameinit;
5615
+            $nexsenderarr = [0 => $nexsendername];
5616
+        } else { $nexsenderarr = []; }
5617
+
5618
+        if ($twilsendernameinit) {
5619
+            $twilsendername = "Tw: " . $twilsendernameinit;
5620
+            $twilsenderarr = [0 => $twilsendername];
5621
+        } else { $twilsenderarr = []; }
5622
+
5623
+        // Get Telnyx phone numbers
5624
+        if ($telnyxkey != '') {
5625
+
5626
+           \Telnyx\Telnyx::setApiKey($telnyxkey);
5627
+           $telnumbers = \Telnyx\MessagingPhoneNumber::All();
5628
+
5629
+           $telnumbersarr = $this->object_to_array($telnumbers);
5630
+           $telnmbrs = [];
5631
+
5632
+           foreach ($telnumbersarr['_originalValues'] as $nmbkey => $nmbvalue) {
5633
+              if (is_int($nmbkey)) {
5634
+                 foreach ($nmbvalue as $nkey => $nvalue) {
5635
+                    if ($nkey == 'phone_number' && $nvalue) {
5636
+                       $telnmbrs[] = "Tx: " . $nvalue;
5637
+                    }
5638
+                 }
5639
+              }
5640
+           }
5641
+
5642
+        } else { $telnmbrs = []; }
5643
+
5644
+        // Get Plivo phone numbers
5645
+        if ($nexapikey != '' && $nexapisecret != '') {
5646
+
5647
+           $getacdata = "https://".$nexapikey.":".$nexapisecret."@api.plivo.com/v1/Account/".$nexapikey."/Number/";
5648
+           $acdata = file_get_contents($getacdata);
5649
+           $datainit = json_decode($acdata, true);
5650
+
5651
+           $findata = $this->object_to_array($datainit);
5652
+
5653
+           $nexcurrentnmbrs = [];
5654
+
5655
+           foreach ($findata['objects'] as $smskey => $smsvalue) {
5656
+                   if (is_array($smsvalue)) {
5657
+                         foreach ($smsvalue as $smskey2 => $smsvalue2) {
5658
+                               if ($smskey2 == 'number' && $smsvalue2) {
5659
+                                   $nexcurrentnmbrs[] = "Pl: +" . $smsvalue2;
5660
+                               }
5661
+                         }
5662
+                   }
5663
+           }
5664
+
5665
+        } else { $nexcurrentnmbrs = []; }
5666
+
5667
+        // Get Twilio phone numbers
5668
+        if ($twilapikey != '' && $twilapisecret != '') {
5669
+
5670
+            $twilnumbers = json_decode(file_get_contents("https://".$twilapikey.":".$twilapisecret."@api.twilio.com/2010-04-01/Accounts/".$twilapikey."/IncomingPhoneNumbers.json"), true);
5671
+            $twilactivenmbrs = $twilnumbers['incoming_phone_numbers'];
5672
+
5673
+            $twilcurrentnmbrs = [];
5674
+            foreach ($twilactivenmbrs as $twnbkey => $twnbvalue) {
5675
+                 if (is_array($twnbvalue)) {
5676
+                     foreach ($twnbvalue as $twfkey => $twfvalue) {
5677
+                          if ($twfkey == 'phone_number' && $twfvalue) {
5678
+                              $twilcurrentnmbrs[] = "Tw: " . $twfvalue;
5679
+                          }
5680
+                     }
5681
+                 }
5682
+            }
5683
+
5684
+        } else { $twilcurrentnmbrs = []; }
5685
+
5686
+        // Get Flowroute phone numbers
5687
+        if ($flowapikey != '' && $flowapisecret != '') {
5688
+
5689
+            $flnbrsresult = json_decode(file_get_contents("https://".$flowapikey.":".$flowapisecret."@api.flowroute.com/v2/numbers"));
5690
+            $flnbrsarr = $flnbrsresult->data;
5691
+            $flowcurrentnmbrs = [];
5692
+            foreach ($flnbrsarr as $flkey => $flitem) {
5693
+                     if ($flitem->id) {
5694
+                         $flowcurrentnmbrs[] = "Fl: +" . $flitem->id;
5695
+                     }
5696
+            }
5697
+
5698
+        } else { $flowcurrentnmbrs = []; }
5699
+
5700
+        $currentnmbrs = array_merge($telnmbrs, $nexcurrentnmbrs, $twilcurrentnmbrs, $flowcurrentnmbrs, $telsenderarr, $nexsenderarr, $twilsenderarr);
5701
+
5702
+
5703
+        if ($this->groupManager->isAdmin($userId)) {
5704
+
5705
+            // Save the available phone numbers for the current user
5706
+            $availablenmbrs = implode("|", $currentnmbrs);
5707
+            $savephno = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `available_numbers` = ? WHERE `user_id` = ?');
5708
+            $upusrphnmbrs = $savephno->execute([$availablenmbrs, $userId]);
5709
+	    $upusrphnmbrs->closeCursor();
5710
+
5711
+            return $currentnmbrs;
5712
+
5713
+        } else {
5714
+
5715
+            // Get the restrictions from the 'sms_relent_restrict' table
5716
+            $getrestr = $this->connection->prepare('
5717
+		       SELECT `phone_number`, `groups`, `users` FROM `*PREFIX*sms_relent_restrict`');
5718
+            $getrestrres = $getrestr->execute();
5719
+
5720
+            $restrdata = [];
5721
+            while ($restrfetched = $getrestrres->fetch()) {
5722
+                   $restrdata[] = $restrfetched;
5723
+            }
5724
+            $getrestrres->closeCursor();
5725
+
5726
+            if ($restrdata) {
5727
+
5728
+                // Get the groups to which the current user belongs
5729
+                $getusrgrp = $this->connection->prepare('
5730
+		       SELECT `gid`, `uid` FROM `*PREFIX*group_user` WHERE `uid` = ?');
5731
+                $getusrgrpres = $getusrgrp->execute([$userId]);
5732
+
5733
+                $usergrps = [];
5734
+                while ($fetchedgrps = $getusrgrpres->fetch()) {
5735
+                       $usergrps[] = $fetchedgrps['gid'];
5736
+                }
5737
+                $getusrgrpres->closeCursor();
5738
+                $ctusergroups = implode("|", $usergrps);
5739
+
5740
+		// Get the Display Name of the current user
5741
+		$getacdatadn = $this->connection->prepare('SELECT `uid`, `name`, `value` FROM `*PREFIX*accounts_data` WHERE `uid` = ? AND `name` = ?');
5742
+		$getacdatadnres = $getacdatadn->execute([$userId, 'displayname']);
5743
+		$acdatausrdnadm = $getacdatadnres->fetch();
5744
+		$cruserdname = $acdatausrdnadm['value'];
5745
+		$getacdatadnres->closeCursor();
5746
+
5747
+                // Get the phone numbers that are not allowed for the current user
5748
+                $restrPhoneNb = [];
5749
+                foreach ($restrdata as $rskey => $rsvalue) {
5750
+
5751
+                        $chck = 0;
5752
+                        if ($rsvalue['groups']) {
5753
+                            $restrgrparr = explode("|", $rsvalue['groups']);
5754
+
5755
+                            foreach ($restrgrparr as $grkey => $grvalue) {
5756
+                                     if (str_contains($ctusergroups, $grvalue)) { $chck++; }
5757
+                            }
5758
+                        }
5759
+
5760
+                        if ($rsvalue['users']) {
5761
+                            $usrnmstr = $rsvalue['users'];
5762
+                            if (str_contains($usrnmstr, $cruserdname)) { $chck++; }
5763
+                        }
5764
+
5765
+                        if ($chck == 0) { $restrPhoneNb[] = $rsvalue['phone_number']; }
5766
+                }
5767
+
5768
+                $restrPhoneNmbrs = array_unique($restrPhoneNb);
5769
+
5770
+                // Assemble the array of phone numbers that the current user is allowed to use
5771
+                for ($k = 0; $k < count($currentnmbrs); $k++) {
5772
+
5773
+                    if (in_array($currentnmbrs[$k], $restrPhoneNmbrs)) {
5774
+                        unset($currentnmbrs[$k]);
5775
+                    }
5776
+                }
5777
+
5778
+                $currentnmbrsrstr = array_values($currentnmbrs);
5779
+
5780
+                // Save the available phone numbers for the current user
5781
+                $availablenmbrs = implode("|", $currentnmbrsrstr);
5782
+                $savephno = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `available_numbers` = ? WHERE `user_id` = ?');
5783
+                $upusrphnmbrs = $savephno->execute([$availablenmbrs, $userId]);
5784
+	        $upusrphnmbrs->closeCursor();
5785
+
5786
+                return $currentnmbrsrstr;
5787
+
5788
+            } else {
5789
+
5790
+                // Save the available phone numbers for the current user
5791
+                $availablenmbrs = implode("|", $currentnmbrs);
5792
+                $savephno = $this->connection->prepare('UPDATE `*PREFIX*sms_relent_settings` SET `available_numbers` = ? WHERE `user_id` = ?');
5793
+                $upusrphnmbrs = $savephno->execute([$availablenmbrs, $userId]);
5794
+	        $upusrphnmbrs->closeCursor();
5795
+
5796
+                return $currentnmbrs; 
5797
+            }
5798
+        }
5799
+    }
5800
+}
0 5801
new file mode 100644
... ...
@@ -0,0 +1,327 @@
1
+<?php
2
+/**
3
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
4
+ *
5
+ * @author Double Bastion LLC
6
+ *
7
+ * @license GNU AGPL version 3 or any later version
8
+ *
9
+ * This program is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
11
+ * License as published by the Free Software Foundation; either
12
+ * version 3 of the License, or any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
18
+ *
19
+ * You should have received a copy of the GNU Affero General Public
20
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
23
+
24
+declare(strict_types=1);
25
+
26
+script('sms_relentless', 'adminsettings');
27
+style('sms_relentless', 'style');
28
+
29
+?>
30
+
31
+<div id="sms_relentless_adm">
32
+
33
+        <div class="section">
34
+           <h2><?php p($l->t('SMS Relentless'));?></h2>
35
+           <p id="settings-dscr"><h3><?php p($l->t('Enter your credentials and options in the fields from below. As SMS service provider you can use Telnyx, Plivo, Twilio or 
36
+               Flowroute, or all of them:')); ?></h3></p><br>
37
+           <div class="sms_followupsection">
38
+
39
+                <form id="admin_conf" action="#" >
40
+
41
+                   <div class="providerSettings">
42
+                   <p class="providerName">Telnyx Settings</p>
43
+                   <p><label for="telapi_key" class="setlabeltext"><b>Telnyx API Secret Key</b> (Log in to Telnyx, then, on the 'Home' page, in the 'API Keys' section from the upper 
44
+                          right corner, click on 'Manage Keys'. If you already have an API key, just copy it by clicking the 'Copy to clipboard' icon. Otherwise, to create an API key, 
45
+                          click the 'Create API Key' button, on the pop up message click 'Create', then enter it in the field from below.):</label></p>
46
+                   <input type="password" class="smsr_textbox" id="telapi_key" name="telapi_key" autocomplete="false"
47
+                          placeholder="e.g. d6f172ce92e4f2 ..." /><br>
48
+
49
+                   <p><label for="tel_pub_key" class="setlabeltext"><b>Telnyx Account Public Key</b> (While logged in to Telnyx, on the 'Home' page, in the 'API Keys' section from the 
50
+                          upper right corner, click on 'Manage Keys', then click on 'Public Key' on the upper bar, then copy the key from the 'Key' field and enter it in the field from 
51
+                          below.):</label></p>
52
+                   <input type="password" class="smsr_textbox" id="tel_pub_key" name="tel_pub_key" autocomplete="false"
53
+                          placeholder="e.g. KLCnMsTSp8utW3RRHx0FiXxbf5BxK2Y5q8mMTCn0jgv=" /><br>
54
+
55
+                   <p><label for="messaging_profile_id" class="setlabeltext"><b>Messaging Profile ID</b> (While logged in to Telnyx, click on 'Messaging', then on 'Programmable 
56
+                       Messaging' on the left panel, click on the name of the messaging profile that you want to use, then under 'Profile ID' you will find the messaging profile ID. 
57
+                       Copy it and enter it in the field from below.):
58
+                   </label></p>
59
+                   <input type="password" class="smsr_textbox" id="messaging_profile_id" name="messaging_profile_id" autocomplete="false"
60
+                          placeholder="e.g. 9d4f47b6-26c9-d25c-c2f5 ..." /><br>
61
+
62
+                   <p><label for="telapi_url_rec" class="setlabeltext"><b>Telnyx webhook URL for incoming SMS/MMS</b> (You have to first generate and then copy this URL into your Telnyx
63
+                       account, so that Telnyx knows where to deliver the SMS/MMS messages received by your Telnyx phone number(s). First generate the URL by pressing the button from
64
+                       below, copy it, then, in your Telnyx account click on 'Messaging' then on 'Programmable Messaging' on the left panel, click on the name of the messaging profile 
65
+                       that you associated with your phone number(s), then, under 'Inbound Settings', enter the webhook URL generated here in the field 'Send a webhook to this URL' and 
66
+                       click the 'Save' button. Don't forget to also click the 'Save' button at the bottom of this page after entering all the credentials, to save all the settings to 
67
+                       the database.)</label></p>
68
+                   <input type="button" id="generate_tel_rcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for incoming SMS/MMS')) ?>" />
69
+                   <input type="text" class="smsr_textboxspec" id="telapi_url_rec" name="telapi_url_rec" autocomplete="false" />
70
+                   <span id="copyToClipboardtel" class="icon icon-clippy" title="Copy to clipboard"></span><br><br>
71
+
72
+                   <p><label for="telapi_url" class="setlabeltext"><b>Telnyx webhook URL for delivery receipts</b> (This URL will be included by SMS Relentless in message sending 
73
+                       requests, so that Telnyx will know where to send the delivery receipts. Just generate it by pressing the button from below.
74
+                       You don't have to enter this URL into your Telnyx account. Don't forget to click the 'Save' button at the bottom of this page after entering all the credentials, 
75
+                       to save all the settings to the database.)</label></p>
76
+                   <input type="button" id="generate_tel_delrcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for delivery receipts')) ?>" />
77
+                   <input type="text" id="telapi_url" name="telapi_url" autocomplete="false" /><br><br>
78
+
79
+                   <p><label for="tel_sender_name" class="setlabeltext"><b>Telnyx alphanumeric Sender ID</b> (If you intend to use an alphanumeric Sender ID, enter an alphanumeric 
80
+                          sequence of up to 11 characters in the range of a-z, A-Z, 0-9 and space. In certain countries there are regulations that accept only shorter alphanumeric 
81
+                          Sender IDs, such as up to 6 characters. You cannot send SMS/MMS messages with alphanumeric Sender IDs to USA or Canada. There are even 
82
+                          <a href="https://support.plivo.com/hc/en-us/articles/360041448032" style="color:#1b60ba" target="_blank" rel="noreferrer noopener">countries</a> that require
83
+                          preregistration of alphanumeric Sender IDs. Before sending SMS/MMS messages to a country, it's recommended to read the
84
+                          <a href="https://support.twilio.com/hc/en-us/articles/223133767-International-support-for-Alphanumeric-Sender-ID" style="color:#1b60ba" target="_blank"
85
+                          rel="noreferrer noopener">country specific features and restrictions.</a> Some carriers won't accept messages with an alphanumeric Sender ID): </label></p>
86
+                   <input type="text" class="smsr_textbox" id="tel_sender_name" name="tel_sender_name" autocomplete="false"
87
+                          placeholder="e.g. Smart Inc" /><br><br>
88
+
89
+                   <p><label for="tnxKeysAccessTbl" class="setlabeltext"><b>Allow the following groups and non-admin users to send and receive messages using the Telnyx API Secret Key, 
90
+                          Public Key, messaging profile ID and alphanumeric Sender ID mentioned above (to be able to use them properly, the users with whom these credentials are shared 
91
+                          will have to access their app Settings page, generate the two webhook URLs for Telnyx by clicking the corresponding 'Generate new webhook URL ...' buttons, and
92
+                          then click the 'Save' button at the bottom of that page):</b></label></p><br>
93
+
94
+                   <table id="tnxKeysAccessTbl">
95
+
96
+                      <tr><th style="padding-bottom:3px">Groups Allowed</th><th style="max-width: 40px !important"></th><th style="padding-bottom:3px">Users Allowed</th><th style="max-width: 40px !important"></th><th></th></tr>
97
+                      <tr><td><div id="alwdakeyGrps-tnx" class="alwdKeysGroups"></div></td><td><div id="showakeyGrps-tnx" class="showAllGroupsak">
98
+                      <img class="srGroupImg" style="cursor:pointer" title="Show all groups"></div></td><td><div id="alwdakeyUsrs-tnx" class="alwdKeysUsers"></div>
99
+                      </td><td><div id="showakeyUsrs-tnx" class="showAllUsersak"><img class="srUserImg" style="cursor:pointer" title="Show all users"></div></td>
100
+                      <td><input type="submit" id="alwdrstsave-tnx" class="savealwdKeys" value="Edit" title="Edit Row" /></td></tr>
101
+
102
+                      <tr><td class="topLeftCorner"><div class="alwdDelGroups"><input type="checkbox" id="alwDelGrps-tnx" class="alwDelCkbx" autocomplete="false" />
103
+                      <label for="alwDelGrps-tnx">Allow the users in these groups to delete the messages sent from or received on the numbers shared with them.
104
+                      </label></div></td><td></td>
105
+                      <td class="topLeftCorner"><div class="alwdDelUsrs"><input type="checkbox" id="alwDelUsrs-tnx" class="alwDelCkbx" autocomplete="false" />
106
+                      <label for="alwDelUsrs-tnx">Allow these users to delete the messages sent from or received on the numbers shared with them.</label>
107
+                      </div></td><td></td><td></td></tr>
108
+
109
+                   </table><br>
110
+
111
+                   </div><br><br><br>
112
+
113
+                   <div class="providerSettings">
114
+                   <p class="providerName">Plivo Settings</p>
115
+                   <p><label for="nexapi_key" class="setlabeltext"><b>Plivo Auth ID</b> (Log in to Plivo. On the first page, which is the Overview page, under Account, copy the 'Auth ID'
116
+                          and enter it in the field from below.):</label></p>
117
+                   <input type="password" class="smsr_textbox" id="nexapi_key" name="nexapi_key" autocomplete="false"
118
+                          placeholder="e.g. r5g974cb92e4t1 ...'" /><br>
119
+
120
+                   <p><label for="nexapi_secret" class="setlabeltext"><b>Plivo Auth Token</b> (While logged in to Plivo, on the Overview page, under Account, copy the 'Auth Token' and
121
+                          enter it in the field from below.):</label></p>
122
+                   <input type="password" class="smsr_textbox" id="nexapi_secret" name="nexapi_secret" autocomplete="false"
123
+                          placeholder="e.g. k6f489d8awn4p9 ..." /><br>
124
+
125
+                   <p><label for="nexapi_url_rec" class="setlabeltext"><b>Plivo webhook URL for incoming SMS/MMS</b> (You have to first generate and then copy this URL into your Plivo
126
+                       account, so that Plivo knows where to deliver the SMS/MMS messages received by your Plivo phone number(s). First generate the URL by pressing the button from
127
+                       below, copy it, then, in your Plivo account click on 'Messaging' on the left vertical bar, click on 'Applications', then, under 'Application name' click on
128
+                       'Inbound SMS Messages', next, under 'Message', enter the webhook URL generated here in the field 'Message URL' and select 'POST' next to it, then click the
129
+                       'Update Application' button. Don't forget to also click the 'Save' button at the bottom of this page after entering all the credentials, to save all the settings 
130
+                       to the database.)</label></p>
131
+                   <input type="button" id="generate_nex_rcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for incoming SMS/MMS')) ?>" />
132
+                   <input type="text" class="smsr_textboxspec" id="nexapi_url_rec" name="nexapi_url_rec" autocomplete="false" />
133
+                   <span id="copyToClipboardnex" class="icon icon-clippy" title="Copy to clipboard"></span><br><br>
134
+
135
+                   <p><label for="nexapi_url" class="setlabeltext"><b>Plivo webhook URL for delivery receipts</b> (This URL will be included by SMS Relentless in message sending 
136
+                       requests, so that Plivo will know where to send the delivery receipts. Just generate it by pressing the button from below.
137
+                       You don't have to enter this URL into your Plivo account. Don't forget to click the 'Save' button at the bottom of this page after entering all the credentials, 
138
+                       to save all the settings to the database.)</label></p>
139
+                   <input type="button" id="generate_nex_delrcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for delivery receipts')) ?>" />
140
+                   <input type="text" id="nexapi_url" name="nexapi_url" autocomplete="false" /><br><br>
141
+
142
+                   <p><label for="nex_sender_name" class="setlabeltext"><b>Plivo alphanumeric Sender ID:</b> (If you intend to use an alphanumeric Sender ID, enter an alphanumeric 
143
+                          sequence of up to 11 characters in the range of a-z, A-Z, 0-9 and space. In certain countries there are regulations that accept only shorter alphanumeric 
144
+                          Sender IDs, such as up to 6 characters. You cannot send SMS/MMS messages with alphanumeric Sender IDs to USA or Canada. There are even 
145
+                          <a href="https://support.plivo.com/hc/en-us/articles/360041448032" style="color:#1b60ba" target="_blank" rel="noreferrer noopener">countries</a> that require
146
+                          preregistration of alphanumeric Sender IDs. Before sending SMS/MMS messages to a country, it's recommended to read the
147
+                          <a href="https://support.twilio.com/hc/en-us/articles/223133767-International-support-for-Alphanumeric-Sender-ID" style="color:#1b60ba" target="_blank"
148
+                          rel="noreferrer noopener">country specific features and restrictions.</a> Some carriers won't accept messages with an alphanumeric Sender ID): </label></p>
149
+                   <input type="text" class="smsr_textbox" id="nex_sender_name" name="nex_sender_name" autocomplete="false"
150
+                          placeholder="e.g. Global Inc" /><br><br>
151
+
152
+                   <p><label for="plvKeysAccessTbl" class="setlabeltext"><b>Allow the following groups and non-admin users to send and receive messages using the Plivo Auth ID, Auth 
153
+                          Token and alphanumeric Sender ID mentioned above (to be able to use them properly, the users with whom these credentials are shared will have to access their 
154
+                          app Settings page, generate the two webhook URLs for Plivo by clicking the corresponding 'Generate new webhook URL ...' buttons, and then click the 'Save' 
155
+                          button at the bottom of that page):</b></label></p><br>
156
+
157
+                   <table id="plvKeysAccessTbl">
158
+
159
+                      <tr><th style="padding-bottom:3px">Groups Allowed</th><th style="max-width: 40px !important"></th><th style="padding-bottom:3px">Users Allowed</th><th style="max-width: 40px !important"></th></th><th></tr>
160
+                      <tr><td><div id="alwdakeyGrps-plv" class="alwdKeysGroups"></div></td><td><div id="showakeyGrps-plv" class="showAllGroupsak">
161
+                      <img class="srGroupImg" style="cursor:pointer" title="Show all groups"></div></td><td><div id="alwdakeyUsrs-plv" class="alwdKeysUsers"></div>
162
+                      </td><td><div id="showakeyUsrs-plv" class="showAllUsersak"><img class="srUserImg" style="cursor:pointer" title="Show all users"></div></td>
163
+                      <td><input type="submit" id="alwdrstsave-plv" class="savealwdKeys" value="Edit" title="Edit Row" /></td></tr>
164
+
165
+                      <tr><td class="topLeftCorner"><div class="alwdDelGroups"><input type="checkbox" id="alwDelGrps-plv" class="alwDelCkbx" autocomplete="false" />
166
+                      <label for="alwDelGrps-plv">Allow the users in these groups to delete the messages sent from or received on the numbers shared with them.
167
+                      </label></div></td><td></td>
168
+                      <td class="topLeftCorner"><div class="alwdDelUsrs"><input type="checkbox" id="alwDelUsrs-plv" class="alwDelCkbx" autocomplete="false" />
169
+                      <label for="alwDelUsrs-plv">Allow these users to delete the messages sent from or received on the numbers shared with them.</label>
170
+                      </div></td><td></td><td></td></tr>
171
+
172
+                   </table><br>
173
+
174
+                   </div><br><br><br>
175
+
176
+                   <div class="providerSettings">
177
+                   <p class="providerName">Twilio Settings</p>
178
+                   <p><label for="twilapi_key" class="setlabeltext"><b>Twilio Account SID</b> (Log in to Twilio. On the first page, under Account Info, copy the 'Account SID'
179
+                          and enter it in the field from below.):</label></p>
180
+                   <input type="password" class="smsr_textbox" id="twilapi_key" name="twilapi_key" autocomplete="false"
181
+                          placeholder="e.g. r5g974cb92e4t1 ..." /><br>
182
+
183
+                   <p><label for="twilapi_secret" class="setlabeltext"><b>Twilio Auth Token</b> (While logged in to Twilio, on the first page, under Account Info, copy the 'Auth Token'
184
+                          and enter it in the field from below.):</label></p>
185
+                   <input type="password" class="smsr_textbox" id="twilapi_secret" name="twilapi_secret" autocomplete="false"
186
+                          placeholder="e.g. k6f489d8awn4p9 ..." /><br>
187
+
188
+                   <p><label for="twilapi_url_rec" class="setlabeltext"><b>Twilio webhook URL for incoming SMS/MMS</b> (You have to first generate and then copy this URL into your 
189
+                       Twilio account, so that Twilio knows where to deliver the SMS/MMS messages received by your Twilio phone number(s). First generate the URL by pressing the button 
190
+                       from below, copy it, then, in your Twilio account click on 'Phone Numbers' on the left panel > 'Manage' > 'Active numbers', click on the phone number you want to 
191
+                       use for SMS/MMS, scroll down to the 'Messaging' section, then under 'A MESSAGE COMES IN' select 'Webhook', then paste in the webhook URL that you have just 
192
+                       generated and select 'HTTP POST' as the request type. Enter the same data under 'PRIMARY HANDLER FAILS', then click the 'Save' button. If you have multiple 
193
+                       SMS/MMS enabled phone numbers, do the same for each number. Don't forget to also click the 'Save' button at the bottom of this page after entering all the 
194
+                       credentials, to save all the settings to the database.)</label></p>
195
+                   <input type="button" id="generate_twil_rcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for incoming SMS/MMS')) ?>" />
196
+                   <input type="text" class="smsr_textboxspec" id="twilapi_url_rec" name="twilapi_url_rec" autocomplete="false" />
197
+                   <span id="copyToClipboardtwil" class="icon icon-clippy" title="Copy to clipboard"></span><br><br>
198
+
199
+                   <p><label for="twilapi_url" class="setlabeltext"><b>Twilio webhook URL for delivery receipts</b> (This URL will be included by SMS Relentless in message sending 
200
+                       requests, so that Twilio will know where to send the delivery receipts. Just generate it by pressing the button from below.
201
+                       You don't have to enter this URL into your Twilio account. Don't forget to click the 'Save' button at the bottom of this page after entering all the credentials, 
202
+                       to save all the settings to the database.)</label></p>
203
+                   <input type="button" id="generate_twil_delrcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for delivery receipts')) ?>" />
204
+                   <input type="text" id="twilapi_url" name="twilapi_url" autocomplete="false" /><br><br>
205
+
206
+                   <p><label for="twil_sender_name" class="setlabeltext"><b>Twilio alphanumeric Sender ID:</b> (If you intend to use an alphanumeric Sender ID, enter an alphanumeric 
207
+                          sequence of up to 11 characters in the range of a-z, A-Z, 0-9 and space. In certain countries there are regulations that accept only shorter alphanumeric 
208
+                          Sender IDs, such as up to 6 characters. You cannot send SMS/MMS messages with alphanumeric Sender IDs to USA or Canada. There are even 
209
+                          <a href="https://support.plivo.com/hc/en-us/articles/360041448032" style="color:#1b60ba" target="_blank" rel="noreferrer noopener">countries</a> that require
210
+                          preregistration of alphanumeric Sender IDs. Before sending SMS/MMS messages to a country, it's recommended to read the
211
+                          <a href="https://support.twilio.com/hc/en-us/articles/223133767-International-support-for-Alphanumeric-Sender-ID" style="color:#1b60ba" target="_blank"
212
+                          rel="noreferrer noopener">country specific features and restrictions.</a> Some carriers won't accept messages with an alphanumeric Sender ID): </label></p>
213
+                   <input type="text" class="smsr_textbox" id="twil_sender_name" name="twil_sender_name" autocomplete="false"
214
+                          placeholder="e.g. Global Inc" /><br><br>
215
+
216
+                   <p><label for="twlKeysAccessTbl" class="setlabeltext"><b>Allow the following groups and non-admin users to send and receive messages using the Twilio Account SID, 
217
+                          Auth Token and alphanumeric Sender ID mentioned above (to be able to use them properly, the users with whom these credentials are shared will have to access 
218
+                          their app Settings page, generate the two webhook URLs for Twilio by clicking the corresponding 'Generate new webhook URL ...' buttons, and then click the 
219
+                          'Save' button at the bottom of that page):</b></label></p><br>
220
+
221
+                   <table id="twlKeysAccessTbl">
222
+
223
+                      <tr><th style="padding-bottom:3px">Groups Allowed</th><th style="max-width: 40px !important"></th><th style="padding-bottom:3px">Users Allowed</th><th style="max-width: 40px !important"></th></th><th></tr>
224
+                      <tr><td><div id="alwdakeyGrps-twl" class="alwdKeysGroups"></div></td><td><div id="showakeyGrps-twl" class="showAllGroupsak">
225
+                      <img class="srGroupImg" style="cursor:pointer" title="Show all groups"></div></td>
226
+                      <td><div id="alwdakeyUsrs-twl" class="alwdKeysUsers"></div></td><td><div id="showakeyUsrs-twl" class="showAllUsersak">
227
+                      <img class="srUserImg" style="cursor:pointer" title="Show all users"></div></td>
228
+                      <td><input type="submit" id="alwdrstsave-twl" class="savealwdKeys" value="Edit" title="Edit Row" /></td></tr>
229
+
230
+                      <tr><td class="topLeftCorner"><div class="alwdDelGroups"><input type="checkbox" id="alwDelGrps-twl" class="alwDelCkbx" autocomplete="false" />
231
+                      <label for="alwDelGrps-twl">Allow the users in these groups to delete the messages sent from or received on the numbers shared with them.
232
+                      </label></div></td><td></td>
233
+                      <td class="topLeftCorner"><div class="alwdDelUsrs"><input type="checkbox" id="alwDelUsrs-twl" class="alwDelCkbx" autocomplete="false" />
234
+                      <label for="alwDelUsrs-twl">Allow these users to delete the messages sent from or received on the numbers shared with them.</label>
235
+                      </div></td><td></td><td></td></tr>
236
+
237
+                   </table><br>
238
+
239
+                   </div><br><br><br>
240
+
241
+                   <div class="providerSettings">
242
+                   <p class="providerName">Flowroute Settings</p>
243
+                   <p><label for="flowapi_key" class="setlabeltext"><b>Flowroute Access Key</b> (Log in to Flowroute. On the left panel, click on 'Preferences', then on the 'API Control'
244
+                          tab. Scroll down to the 'API Keys' section. If you already have a pair of keys listed in that section, just copy the Access Key to the field from below. If you
245
+                          haven't created any keys yet, to create a key pair, under 'Add new API Key', in the 'Name' field, enter a name for the new key pair. In the 'Description' field 
246
+                          enter a short description, then click 'Add new'. A new pair of keys will be created and you will be prompted to copy the Secret Key. After you copy the Secret 
247
+                          Key to a safe location, copy the Access Key that has just been created to the field from below.):</label></p>
248
+                   <input type="password" class="smsr_textbox" id="flowapi_key" name="flowapi_key" autocomplete="false"
249
+                          placeholder="e.g. r5g974cb92e4t1 ..." /><br>
250
+
251
+                   <p><label for="flowapi_secret" class="setlabeltext"><b>Flowroute Secret Key</b> (Enter the Secret Key created earlier and copied to a safe place, in the field from 
252
+                          below.):</label></p>
253
+                   <input type="password" class="smsr_textbox" id="flowapi_secret" name="flowapi_secret" autocomplete="false"
254
+                          placeholder="e.g. k6f489d8awn4p9 ..." /><br>
255
+
256
+                   <p><label for="flowapi_url_rec" class="setlabeltext"><b>Flowroute webhook URL for incoming SMS/MMS</b> (You have to first generate and then copy this URL into your 
257
+                          Flowroute account, so that Flowroute knows where to deliver the SMS/MMS messages received by your Flowroute phone number(s). First generate the URL by pressing 
258
+                          the button from below, copy it, then, in your Flowroute account click on 'Preferences' on the left panel, then click on the 'API Control tab', turn on the 'SMS' 
259
+                          switch and in the field that shows up enter the URL that you have just generated. Click 'Save URL'. If you have an MMS enabled phone number, turn on the 'MMS' 
260
+                          switch, enter the same URL in the URL field and save it. Also, under 'SMS Webhook Version' choose 'v2.1'. Don't forget to also click the 'Save' button at the 
261
+                          bottom of this page after entering all the credentials, to save all the settings to the database.)</label></p>
262
+                   <input type="button" id="generate_flow_rcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for incoming SMS/MMS')) ?>" />
263
+                   <input type="text" class="smsr_textboxspec" id="flowapi_url_rec" name="flowapi_url_rec" autocomplete="false" />
264
+                   <span id="copyToClipboardflow" class="icon icon-clippy" title="Copy to clipboard"></span><br><br>
265
+
266
+                   <p><label for="flowapi_url" class="setlabeltext"><b>Flowroute webhook URL for delivery receipts</b> (This URL will be included by SMS Relentless in message sending 
267
+                          requests, so that Flowroute will know where to send the delivery receipts. Just generate it by pressing the button from below. You don't have to enter this URL 
268
+                          into your Flowroute account. Don't forget to click the 'Save' button at the bottom of this page after entering all the credentials, to save all the settings 
269
+                          to the database.)</label></p>
270
+                   <input type="button" id="generate_flow_delrcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for delivery receipts')) ?>" />
271
+                   <input type="text" id="flowapi_url" name="flowapi_url" autocomplete="false" /><br><br>
272
+                   <span style='color:#272727'>Flowroute only supports sending/receiving SMS/MMS messages within USA and Canada and it doesn't support Alphanumeric Sender IDs.</span><br><br>
273
+
274
+                   <p><label for="flrKeysAccessTbl" class="setlabeltext"><b>Allow the following groups and non-admin users to send and receive messages using the Flowroute Access Key 
275
+                          and Secret Key mentioned above (to be able to use them properly, the users with whom these credentials are shared will have to access their app Settings page, 
276
+                          generate the two webhook URLs for Flowroute by clicking the corresponding 'Generate new webhook URL ...' buttons, and then click the 'Save' button at the 
277
+                          bottom of that page):</b></label></p><br>
278
+
279
+                   <table id="flrKeysAccessTbl">
280
+
281
+                      <tr><th style="padding-bottom:3px">Groups Allowed</th><th style="max-width: 40px !important"></th><th style="padding-bottom:3px">Users Allowed</th><th style="max-width: 40px !important"></th></th><th></tr>
282
+                      <tr><td><div id="alwdakeyGrps-flr" class="alwdKeysGroups"></div></td><td><div id="showakeyGrps-flr" class="showAllGroupsak">
283
+                      <img class="srGroupImg" style="cursor:pointer" title="Show all groups"></div></td><td>
284
+                      <div id="alwdakeyUsrs-flr" class="alwdKeysUsers"></div></td><td><div id="showakeyUsrs-flr" class="showAllUsersak">
285
+                      <img class="srUserImg" style="cursor:pointer" title="Show all users"></div></td>
286
+                      <td><input type="submit" id="alwdrstsave-flr" class="savealwdKeys" value="Edit" title="Edit Row" /></td></tr>
287
+
288
+                      <tr><td class="topLeftCorner"><div class="alwdDelGroups"><input type="checkbox" id="alwDelGrps-flr" class="alwDelCkbx" autocomplete="false" />
289
+                      <label for="alwDelGrps-flr">Allow the users in these groups to delete the messages sent from or received on the numbers shared with them.
290
+                      </label></div></td><td></td>
291
+                      <td class="topLeftCorner"><div class="alwdDelUsrs"><input type="checkbox" id="alwDelUsrs-flr" class="alwDelCkbx" autocomplete="false" />
292
+                      <label for="alwDelUsrs-flr">Allow these users to delete the messages sent from or received on the numbers shared with them.</label>
293
+                      </div></td><td></td><td></td></tr>
294
+
295
+                   </table><br>
296
+
297
+                   </div><br><br><br>
298
+
299
+
300
+                   <p><label for="showallmessages" class="setlabeltext"><b>In my message tables, list not only my messages but also the messages of all the Nextcloud users 
301
+                   with whom I share the access keys mentioned above:</b></label></p>
302
+                   <input type="checkbox" class="sms_rel_checkbox" id="showallmessages" name="showallmessages" autocomplete="false" /><br>
303
+
304
+                   <p><div class="setlabeltext"><b>Restrict access to the following phone numbers:</b><div class="tooltiprestrict">
305
+                        <div id="inforestrict">i</div><div class="restricttooltext">After you allow non-admin users to use your API keys for a provider, to send and
306
+                        receive messages, they will be able to see and use all the phone numbers associated with those API keys. However, if you restrict shared phone 
307
+                        numbers to specific non-admin users, they will be able to see and use only those numbers and won't be able to see and use the other numbers 
308
+                        associated with those shared API keys.</div></div></p><br>
309
+
310
+                   <table id="phoneNmbrRestr">
311
+
312
+                        <tr><th>Restriction Author</th><th id="phoneNumberTh">Phone Number</th><th>Groups Allowed</th><th style="max-width: 40px !important"></th><th>Users Allowed</th>
313
+                        <th style="max-width: 40px !important"></th><th></th><th></th></tr>
314
+
315
+                   </table><br>
316
+
317
+                   <input type="hidden" id="user_id" name="user_id" />
318
+
319
+                   <input id="save_admin_settings" type="submit" value="<?php p($l->t('Save')) ?>" />
320
+
321
+                   <span id="smsr_save_msg"></span>
322
+
323
+               </form>
324
+           </div>
325
+        </div>
326
+</div>
327
+