Browse code

added appinfo/info.xml appinfo/signature.json appinfo/routes.php CHANGELOG.txt README.md css/style.css js/settings.js js/sendsms.js js/adminsettings.js js/showsmstables.js templates/settings/admin.php templates/settings/personal.php templates/navigation/index.php lib/Controller/SmsrelentlessController.php lib/Service/SmsrelentlessService.php l10n/en_GB.js l10n/en_GB.json l10n/en_US.js l10n/en_US.json lib/Migration/Version133Date20240215094712.php

DoubleBastionAdmin authored on 14/02/2024 22:47:20
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,461 @@
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 Version133Date20240215094712 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->setPrimaryKey(['id']);
202
+                        $table->addUniqueIndex(['id']);
203
+
204
+		} else {
205
+
206
+                        $table = $schema->getTable('sms_relent_settings');
207
+
208
+			$table->addColumn('available_numbers', Types::TEXT, [
209
+				'notnull' => false,
210
+                                'default' => '',
211
+			]);
212
+			$table->addColumn('msg_check_interval', Types::INTEGER, [
213
+				'notnull' => false,
214
+				'length' => 10,
215
+                                'unsigned' => true,
216
+			]);
217
+			$table->addColumn('new_message_rcd', Types::SMALLINT, [
218
+				'notnull' => false,
219
+				'length' => 1,
220
+			]);
221
+                }
222
+
223
+
224
+		if (!$schema->hasTable('sms_relent_received')) {
225
+			$table = $schema->createTable('sms_relent_received');
226
+			$table->addColumn('id', Types::BIGINT, [
227
+				'autoincrement' => true,
228
+				'notnull' => true,
229
+                                'length' => 11,
230
+                                'unsigned' => true,
231
+			]);
232
+			$table->addColumn('user_id', Types::STRING, [
233
+				'notnull' => true,
234
+				'length' => 64,
235
+			]);
236
+			$table->addColumn('message_id', Types::STRING, [
237
+				'notnull' => true,
238
+				'length' => 512,
239
+			]);
240
+			$table->addColumn('date', Types::DATETIME, [
241
+				'notnull' => true,
242
+			]);
243
+			$table->addColumn('from', Types::STRING, [
244
+				'notnull' => true,
245
+				'length' => 128,
246
+			]);
247
+			$table->addColumn('to', Types::STRING, [
248
+				'notnull' => true,
249
+				'length' => 128,
250
+			]);
251
+			$table->addColumn('message', Types::TEXT, [
252
+				'notnull' => false,
253
+				'default' => '',
254
+			]);
255
+			$table->addColumn('author_displayname', Types::STRING, [
256
+				'notnull' => true,
257
+				'length' => 255,
258
+			]);
259
+			$table->addColumn('internal_sender', Types::SMALLINT, [
260
+				'notnull' => false,
261
+				'length' => 1,
262
+			]);
263
+                        $table->setPrimaryKey(['id']);
264
+                        $table->addUniqueIndex(['id']);
265
+		}
266
+
267
+
268
+		if (!$schema->hasTable('sms_relent_sent')) {
269
+			$table = $schema->createTable('sms_relent_sent');
270
+			$table->addColumn('id', Types::BIGINT, [
271
+				'autoincrement' => true,
272
+				'notnull' => true,
273
+                                'length' => 11,
274
+                                'unsigned' => true,
275
+			]);
276
+			$table->addColumn('user_id', Types::STRING, [
277
+				'notnull' => true,
278
+				'length' => 64,
279
+			]);
280
+			$table->addColumn('message_id', Types::STRING, [
281
+				'notnull' => true,
282
+				'length' => 512,
283
+			]);
284
+			$table->addColumn('date', Types::DATETIME, [
285
+				'notnull' => true,
286
+			]);
287
+			$table->addColumn('from', Types::STRING, [
288
+				'notnull' => true,
289
+				'length' => 128,
290
+			]);
291
+			$table->addColumn('to', Types::STRING, [
292
+				'notnull' => true,
293
+				'length' => 128,
294
+			]);
295
+			$table->addColumn('network ', Types::STRING, [
296
+				'notnull' => false,
297
+				'length' => 64,
298
+				'default' => '',
299
+			]);
300
+			$table->addColumn('price', Types::STRING, [
301
+				'notnull' => false,
302
+				'length' => 64,
303
+				'default' => '',
304
+			]);
305
+			$table->addColumn('status', Types::STRING, [
306
+				'notnull' => false,
307
+				'length' => 512,
308
+				'default' => '',
309
+			]);
310
+			$table->addColumn('deliveryreceipt', Types::STRING, [
311
+				'notnull' => false,
312
+				'length' => 64,
313
+				'default' => '',
314
+			]);
315
+			$table->addColumn('message', Types::TEXT, [
316
+				'notnull' => false,
317
+                                'default' => '',
318
+			]);
319
+			$table->addColumn('author_displayname', Types::STRING, [
320
+				'notnull' => true,
321
+				'length' => 255,
322
+			]);
323
+                        $table->setPrimaryKey(['id']);
324
+                        $table->addUniqueIndex(['id']);
325
+		}
326
+
327
+
328
+		if (!$schema->hasTable('sms_relent_autorply')) {
329
+			$table = $schema->createTable('sms_relent_autorply');
330
+			$table->addColumn('id', Types::BIGINT, [
331
+				'autoincrement' => true,
332
+				'notnull' => true,
333
+                                'length' => 11,
334
+                                'unsigned' => true,
335
+			]);
336
+			$table->addColumn('user_id', Types::STRING, [
337
+				'notnull' => true,
338
+				'length' => 128,
339
+			]);
340
+			$table->addColumn('saved_by_dsplname', Types::STRING, [
341
+				'notnull' => true,
342
+				'length' => 255,
343
+			]);
344
+			$table->addColumn('phone_number', Types::STRING, [
345
+				'notnull' => true,
346
+				'length' => 128,
347
+			]);
348
+			$table->addColumn('days_of_week', Types::STRING, [
349
+				'notnull' => false,
350
+				'length' => 64,
351
+                                'default' => '',
352
+			]);
353
+			$table->addColumn('daily_start', Types::STRING, [
354
+				'notnull' => false,
355
+				'length' => 8,
356
+                                'default' => '',
357
+			]);
358
+			$table->addColumn('daily_end', Types::STRING, [
359
+				'notnull' => false,
360
+				'length' => 8,
361
+                                'default' => '',
362
+			]);
363
+			$table->addColumn('vacation_start', Types::DATETIME, [
364
+				'notnull' => false,
365
+			]);
366
+			$table->addColumn('vacation_end', Types::DATETIME, [
367
+				'notnull' => false,
368
+			]);
369
+			$table->addColumn('message_text', Types::TEXT, [
370
+				'notnull' => false,
371
+                                'default' => '',
372
+			]);
373
+                        $table->setPrimaryKey(['id']);
374
+                        $table->addUniqueIndex(['id']);
375
+		}
376
+
377
+
378
+		if (!$schema->hasTable('sms_relent_restrict')) {
379
+			$table = $schema->createTable('sms_relent_restrict');
380
+			$table->addColumn('id', Types::BIGINT, [
381
+				'autoincrement' => true,
382
+				'notnull' => true,
383
+                                'length' => 11,
384
+                                'unsigned' => true,
385
+			]);
386
+			$table->addColumn('user_id', Types::STRING, [
387
+				'notnull' => true,
388
+				'length' => 128,
389
+			]);
390
+			$table->addColumn('saved_by_dsplname', Types::STRING, [
391
+				'notnull' => true,
392
+				'length' => 255,
393
+			]);
394
+			$table->addColumn('phone_number', Types::STRING, [
395
+				'notnull' => true,
396
+				'length' => 128,
397
+			]);
398
+			$table->addColumn('groups', Types::STRING, [
399
+				'notnull' => true,
400
+				'length' => 2048,
401
+			]);
402
+			$table->addColumn('users', Types::STRING, [
403
+				'notnull' => true,
404
+				'length' => 2048,
405
+			]);
406
+                        $table->setPrimaryKey(['id']);
407
+                        $table->addUniqueIndex(['id']);
408
+		}
409
+
410
+		if (!$schema->hasTable('sms_relent_subac')) {
411
+			$table = $schema->createTable('sms_relent_subac');
412
+			$table->addColumn('id', Types::BIGINT, [
413
+				'autoincrement' => true,
414
+				'notnull' => true,
415
+                                'length' => 11,
416
+                                'unsigned' => true,
417
+			]);
418
+			$table->addColumn('user_id', Types::STRING, [
419
+				'notnull' => true,
420
+				'length' => 128,
421
+			]);
422
+			$table->addColumn('tnx_groups_allowed', Types::TEXT, [
423
+				'notnull' => false,
424
+                                'default' => '',
425
+			]);
426
+			$table->addColumn('tnx_users_allowed', Types::TEXT, [
427
+				'notnull' => false,
428
+                                'default' => '',
429
+			]);
430
+			$table->addColumn('plv_groups_allowed', Types::TEXT, [
431
+				'notnull' => false,
432
+                                'default' => '',
433
+			]);
434
+			$table->addColumn('plv_users_allowed', Types::TEXT, [
435
+				'notnull' => false,
436
+                                'default' => '',
437
+			]);
438
+			$table->addColumn('twl_groups_allowed', Types::TEXT, [
439
+				'notnull' => false,
440
+                                'default' => '',
441
+			]);
442
+			$table->addColumn('twl_users_allowed', Types::TEXT, [
443
+				'notnull' => false,
444
+                                'default' => '',
445
+			]);
446
+			$table->addColumn('flr_groups_allowed', Types::TEXT, [
447
+				'notnull' => false,
448
+                                'default' => '',
449
+			]);
450
+			$table->addColumn('flr_users_allowed', Types::TEXT, [
451
+				'notnull' => false,
452
+                                'default' => '',
453
+			]);
454
+                        $table->setPrimaryKey(['id']);
455
+                        $table->addUniqueIndex(['id']);
456
+		}
457
+
458
+		return $schema;
459
+	}
460
+
461
+}