Browse code

added README.md CHANGELOG.txt appinfo/info.xml appinfo/signature.json css/style.css js/sendfax.js templates/navigation/index.php lib/Controller/AuthorApiController.php lib/Controller/PaxfaxController.php

DoubleBastionAdmin authored on 03/09/2022 21:02:20
Showing 9 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,31 @@
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-11 ==
12
+* Respect custom 'datadirectory'.
13
+* Fixed received/sent faxes list not shown in the right hand pane when clicking the 'Received Faxes/Sent Faxes' button, while using Apache as a web server.
14
+* Fixed error when uploading pdf files, while using Apache as a web server.
15
+
16
+== 1.0.3 - 2022-4-14 ==
17
+* Changed the way the app gets the timezone.
18
+
19
+== 1.0.4 - 2022-4-29 ==
20
+* Specified how usernames containing an @ can be included in the callback URL, on the Settings page.
21
+* Adjusted pdf files paths, so that uploaded pdf files can be previewed when Nextcloud is served on a subdomain or on a subdirectory, by Nginx or by Apache. 
22
+
23
+== 1.0.5 - 2022-5-10 ==
24
+* Changed syntax of SQL queries and of encryption function.
25
+* Modified file paths to match changes in Nextcloud 24.
26
+* Text change on Settings page.
27
+
28
+== 1.0.6 - 2022-9-3 ==
29
+* Solved issue with viewing images picked from Nextcloud.
30
+* Small text changes on navigation pane.
31
+* Minor CSS modifications.
0 32
\ No newline at end of file
1 33
new file mode 100644
... ...
@@ -0,0 +1,134 @@
1
+<span style="display:block;height:15px!important"></span>
2
+<p align="center"><img src="https://git.doublebastion.com/pax-fax/raw/develop/img/pax_fax_logo.png" alt="Pax Fax" width="146px" height="140px"/></p>
3
+
4
+<span style="display:block;height:20px!important"></span>
5
+
6
+**Pax Fax is a Nextcloud application that allows sending and receiving faxes in Nextcloud.**
7
+
8
+A phaxio.com account and a real fax number acquired from Phaxio are needed.
9
+
10
+<span style="display:block;height:20px!important"></span>
11
+
12
+## Main Features
13
+<span style="display:block;height:10px!important"></span>
14
+
15
+* 🚀 Multiple documents can be sent in one fax call (up to 20 separate files with a cumulative size of up to 20 MB).
16
+
17
+* 📠 A fax can be sent to multiple fax numbers at once (up to 15 different fax numbers).
18
+
19
+* 📄 Users can send as fax any document in any of the following formats: pdf, doc, docx, odt, jpeg/jpg, png, tiff/tif, txt, html.
20
+
21
+* 📰 All incoming faxes are received as pdf documents and stored in a Nextcloud folder.
22
+
23
+* 📧 Users receive notifications and (optionally) emails when new faxes arrive.
24
+
25
+* 🔍 All the sent and received faxes are stored in specific Nextcloud folders, so that they can be searched by caller/callee phone number or date.
26
+
27
+* 💻 When they want to send a fax, users can upload files from their computer or choose them directly from Nextcloud.
28
+
29
+* 🔏 Incoming fax requests are checked for authenticity and integrity by verifying Phaxio's signature.
30
+
31
+* 💵 Current Phaxio balance can be always checked by pressing a button on the left panel.
32
+
33
+* 💰 The only ongoing cost is $2 per month for a fax number located in USA or Canada, in a city chosen by the user. No contracts.
34
+
35
+* 💸 Straightforward pricing: $0.07 per sent/received page for faxes to/from USA and Canada and $0.1 per sent/received page for faxes to/from other countries.
36
+
37
+<span style="display:block;height:10px!important"></span>
38
+
39
+Double Bastion is not affiliated with Phaxio.
40
+
41
+### Donations
42
+
43
+* 🎁 [Donate](https://www.doublebastion.com/donations/)
44
+
45
+<span style="display:block;height:20px!important"></span>
46
+
47
+Send uploaded file as fax
48
+<span style="display:block;height:10px!important"></span>
49
+![Image of Pax Fax Interface](https://git.doublebastion.com/pax-fax/raw/develop/img/pax_fax_send_uploaded_file_as_fax.png)
50
+<span style="display:block;height:40px!important"></span>
51
+Preview received fax
52
+<span style="display:block;height:10px!important"></span>
53
+![Image of Pax Fax Interface](https://git.doublebastion.com/pax-fax/raw/develop/img/pax_fax_received_fax.png)
54
+<span style="display:block;height:40px!important"></span>
55
+Choose file from Nextcloud
56
+<span style="display:block;height:10px!important"></span>
57
+![Image of Pax Fax Interface](https://git.doublebastion.com/pax-fax/raw/develop/img/pax_fax_choose_file_from_nextcloud.png)
58
+<span style="display:block;height:40px!important"></span>
59
+Choose multiple files from local computer and Nextcloud
60
+<span style="display:block;height:10px!important"></span>
61
+![Image of Pax Fax Interface](https://git.doublebastion.com/pax-fax/raw/develop/img/pax_fax_files_from_pc_and_nextcloud.png)
62
+<span style="display:block;height:40px!important"></span>
63
+View list of received faxes
64
+<span style="display:block;height:10px!important"></span>
65
+![Image of Pax Fax Interface](https://git.doublebastion.com/pax-fax/raw/develop/img/pax_fax_received_faxes.png)
66
+<span style="display:block;height:40px!important"></span>
67
+View list of sent faxes
68
+<span style="display:block;height:10px!important"></span>
69
+![Image of Pax Fax Interface](https://git.doublebastion.com/pax-fax/raw/develop/img/pax_fax_sent_faxes.png)
70
+<span style="display:block;height:40px!important"></span>
71
+
72
+## Browsers
73
+<span style="display:block;height:10px!important"></span>
74
+
75
+Pax Fax works with all the major browsers.
76
+
77
+<span style="display:block;height:20px!important"></span>
78
+
79
+## Programming Languages
80
+<span style="display:block;height:10px!important"></span>
81
+
82
+Pax Fax only uses PHP, SQL, jQuery, CSS and HTML. This means it's robust, efficient, light-weight and easy to maintain and debug.
83
+
84
+<span style="display:block;height:20px!important"></span>
85
+
86
+## Minimum Requirements
87
+<span style="display:block;height:10px!important"></span>
88
+
89
+- **Nextcloud 22+** has to be installed and properly configured, preferably by following the <a href="https://www.doublebastion.com/install-nextcloud/" rel="noreferrer noopener" target="_blank">Install Nextcloud</a> chapter in our guide.
90
+
91
+- **A phaxio.com account and a fax number** attached to it.
92
+
93
+- The **libcurl** PHP library has to be installed on the server.
94
+
95
+To enable email notifications for every received fax, the "sendmail" utility ("/usr/sbin/sendmail" on Debian Linux), has to be present on the server. "sendmail" is a binary which gets 
96
+installed when Postfix is installed. Also, the web server user (www-data) has to be allowed to send emails from command line (by specifying "authorized\_submit\_users = www-data" in 
97
+"/etc/postfix/main.cf" for Postfix on Debian).
98
+
99
+<span style="display:block;height:20px!important"></span>
100
+
101
+## Installation
102
+<span style="display:block;height:10px!important"></span>
103
+
104
+<a href="https://www.doublebastion.com/install-nextcloud/#install-pax-fax" rel="noreferrer noopener" target="_blank">This chapter</a> of our Complete Guide to a Complete Linux Server 
105
+presents in detail how to install and use this application.
106
+
107
+Pax Fax is a component of RED Scarf Suite. It can be installed and used alone, but if you want to install <a href="https://www.doublebastion.com/red-scarf-suite-components/" rel="noreferrer noopener" target="_blank">all 
108
+the components</a> of RED Scarf Suite, you can follow our <a href="https://www.doublebastion.com/free-server/complete-guide-to-a-complete-linux-server/" rel="noreferrer noopener" target="_blank">complete guide</a>.
109
+
110
+<span style="display:block;height:20px!important"></span>
111
+
112
+## Contribute
113
+<span style="display:block;height:10px!important"></span>
114
+
115
+This is the official git repository of Pax Fax. The <a href="https://github.com/DoubleBastionAdmin/pax-fax" rel="noreferrer noopener" target="_blank">GitHub Pax Fax
116
+repository</a> is just a pointer to this repository. We don’t use GitHub for developing Pax Fax because GitHub is owned by one of the companies that proved their disrespect for
117
+digital freedom over the years and because centralized services create autonomy and privacy issues, in spite of all the benefits.
118
+
119
+If you want to contribute code to this project, please submit <a href="https://git.doublebastion.com/pax-fax/pullrequests/contrib" rel="noreferrer noopener" target="_blank">this form</a>, 
120
+mentioning your intended changes. We'll send you the credentials needed to push code to the "contrib" branch of this repository. After we review the changes we can include them in the 
121
+project.
122
+
123
+Please post any bugs that are not security related, or feature requests, on the <a href="https://git.doublebastion.com/pax-fax/issues/develop" rel="noreferrer noopener" target="_blank">
124
+issue tracker</a>. If you notice bugs related to security, don’t post them on the issue tracker; instead, send them to manager [at] doublebastion [dot] com .
125
+
126
+<span style="display:block;height:20px!important"></span>
127
+
128
+## License
129
+<span style="display:block;height:10px!important"></span>
130
+
131
+Pax Fax as a whole is licensed under the GNU Affero General Public License Version 3. If you use Pax Fax or distribute it in modified or unmodified form, you will need to comply with 
132
+the terms of the GNU Affero General Public License Version 3.
133
+
134
+Pax Fax includes libraries licensed under different free software licenses. These libraries contain their respective original copyright notices.
0 135
new file mode 100644
... ...
@@ -0,0 +1,80 @@
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>pax_fax</id>
5
+    <name>Pax Fax</name>
6
+    <summary>A fax sending application</summary>
7
+    <description><![CDATA[
8
+This application allows sending and receiving faxes in Nextcloud. A phaxio.com account and a real fax number acquired from Phaxio are needed. The 
9
+quality and prices of Phaxio's services are the only reason for using them as a FoIP (fax over IP) provider. The 'libcurl' PHP library has to be present on the server. 
10
+Detailed and complete instructions on how to use this application can be found on the 'Admin documentation' page.
11
+          
12
+Main features:
13
+
14
+* 🚀 Multiple documents can be sent in one fax call (up to 20 separate files with a cumulative size of up to 20 MB).
15
+
16
+* 📠 A fax can be sent to multiple fax numbers at once (up to 15 different fax numbers).
17
+
18
+* 📄 Users can send as fax any document in any of the following formats: pdf, doc, docx, odt, jpg, png, tif, tiff, txt, html.
19
+
20
+* 📰 All incoming faxes are received as pdf documents and stored in a Nextcloud folder.
21
+
22
+* 📧 Users receive notifications and (optionally) emails when new faxes arrive.
23
+
24
+* 🔍 All the sent and received faxes are stored in specific Nextcloud folders, so that they can be searched by caller/callee phone number or date.
25
+
26
+* 💻 When they want to send a fax, users can upload files from their computer or choose them directly from Nextcloud.
27
+
28
+* 🔏 Incoming fax requests are checked for authenticity and integrity by verifying Phaxio's signature.
29
+
30
+* 💵 Current Phaxio balance can be always checked by pressing a button on the left panel.
31
+
32
+* 💰 The only ongoing cost is $2 per month for a fax number located in USA or Canada, in a city chosen by the user. No contracts.
33
+
34
+* 💸 Straightforward pricing: $0.07 per sent/received page for faxes to/from USA and Canada and $0.1 per sent/received page for faxes to/from other countries.
35
+
36
+We have no affiliation with Phaxio.
37
+
38
+### Documentation
39
+
40
+* [Admin documentation](https://www.doublebastion.com/install-nextcloud/#install-pax-fax)
41
+
42
+### Donations
43
+
44
+* 🎁 [Donate](https://www.doublebastion.com/donations/)
45
+
46
+    ]]></description>
47
+    <version>1.0.6</version>
48
+    <licence>AGPL</licence>
49
+    <author homepage="https://www.doublebastion.com">Double Bastion LLC</author>
50
+    <namespace>PaxFax</namespace>
51
+	<documentation>
52
+		<admin>https://www.doublebastion.com/install-nextcloud/#install-pax-fax</admin>
53
+	</documentation>
54
+    <category>office</category>
55
+    <category>organization</category>
56
+
57
+    <website>https://www.doublebastion.com/pax-fax/</website>
58
+    <bugs>https://git.doublebastion.com/pax-fax/issues/develop</bugs>
59
+    <repository>https://git.doublebastion.com/pax-fax/develop/</repository>
60
+
61
+    <screenshot>https://git.doublebastion.com/pax-fax/raw/develop/img/pax_fax_screenshot.png</screenshot>
62
+
63
+    <dependencies>
64
+            <nextcloud min-version="24" max-version="24" />
65
+    </dependencies>
66
+
67
+    <navigations>
68
+        <navigation>
69
+            <name>Pax Fax</name>
70
+            <route>pax_fax.page.index</route>
71
+            <order>103</order>
72
+            <icon>../img/pax_fax.svg</icon>
73
+        </navigation>
74
+    </navigations>
75
+
76
+    <settings>
77
+            <personal>OCA\PaxFax\Settings\Personal</personal>
78
+            <personal-section>OCA\PaxFax\Settings\PersonalSection</personal-section>
79
+    </settings>
80
+</info>
0 81
new file mode 100644
... ...
@@ -0,0 +1,109 @@
1
+{
2
+    "hashes": {
3
+        "CHANGELOG.txt": "c47eb1f032a004c797bdd921cf751993d906054caf94ef057fe86d4d0c9fe0ca21b5bc2c64b80235110f32040cacb8c8e2c896688cacb06271ce1448251bab0d",
4
+        "COPYING.txt": "a0a86214ea153fb07ff35ceec0848dd1703eae22de036a825efc8394e50f65e3044832f3b49cf7e45a39edc470bdf738abc36a3a78ca7df3a6e73c14eaef94a8",
5
+        "Contributors.txt": "cfa8c396be1caa7455a98b96694d56ddee6f2dbb7ac0b3bde33cec5a0393552026c9c6b10b4febcbc87ccb43a0f26faa0e38342e74113a8a4d76c16e0ccf3f42",
6
+        "Phaxio\/composer.json": "15a73bed2e5760f4c4dd1fd60abf746cbd245830ba502884261e9a0b6202844a8a37936e60a2761c6cd94a3054ebdf0c791fb866e191797a9f08227c125f5e4c",
7
+        "Phaxio\/composer.lock": "a6366b124ebbd604e11245e4e01f2f3a6d2bb63bccb861bf2e275f7be7d84d3380447cd9b84afd9dd5da0258cdaa01cdbde0f67ca27f2494d60b9304b092d2f9",
8
+        "Phaxio\/vendor\/autoload.php": "4eeb7a390556c23bed27d39fa0e9921347ccd07a8116f373f1d9ec45e6be608ba526392b6392722fd0aca67b14c8365f45773c50d983218df51f2b221d225761",
9
+        "Phaxio\/vendor\/composer\/ClassLoader.php": "2b6fa585122ace1ba816410acbd8372cb75329917aae6363dbad48e396cca581452616e1386a2e445a8fbb0e461b988279103f4f89adf704bce7726f761abf0e",
10
+        "Phaxio\/vendor\/composer\/InstalledVersions.php": "d7273807c70dea77e8708d58a8368ac9e1cd03a952f5cca0202d469a76d13ae84e17152a52b17768e16f54b18a84963959031c32485166a46b425bb4852b8a2a",
11
+        "Phaxio\/vendor\/composer\/LICENSE": "f3bb64009f41a425df5a9bbab53490f0eb9b74fa8d6aaa2f57efb928edc4ffff330260666edeaa04a91fed708c3663371cf01b284f3a08d6698aaef7a23f355a",
12
+        "Phaxio\/vendor\/composer\/autoload_classmap.php": "38cb0fcac43c6563d0320769be34f7020cecc2d172100930fb5f77043fafae1e1d7467bf681996316e41bb5e5d71a159a02f2b88fa5e067a1fa7883f1f734c79",
13
+        "Phaxio\/vendor\/composer\/autoload_namespaces.php": "e94d2ac452dac5c0a46d259cb9c142ce02d424db8ecd680e16eb604636cbe7b1cff5ce75406b8c99d762952343abfde8a29c3611994c77fb15ad3c9a4d3737f8",
14
+        "Phaxio\/vendor\/composer\/autoload_psr4.php": "1d78c03bc79c82476a9b806cba84ce9067f3dd1a2565f5616f6bcdb0c2eae4ccee33e7267f78a636c9e02904253c024cef43ec01d789918294586d2a1b4654fb",
15
+        "Phaxio\/vendor\/composer\/autoload_real.php": "8e0c72be16830e95bdac7c33043d1ad5144a294dbc28d078563274f379d81e957b2edc400382abd517adc74c0d295ecb606701e4240f55a7303686f424f5432c",
16
+        "Phaxio\/vendor\/composer\/autoload_static.php": "c1abaf9518c87901439bbdba91b10c144ab4fa5263fa35bafba3d56143febc7d045fb281f8fea746e82279c74fe4b22e323a6857cd9fc1ec688e70212546845a",
17
+        "Phaxio\/vendor\/composer\/installed.json": "4cb36f28c497f8d506b8570c0894262a37e98c4327737ed67a963b1ecfa561625a10bf7322e9b0fab7e2401182cc6864e529458ac5d421d8658610479c73cb5e",
18
+        "Phaxio\/vendor\/composer\/installed.php": "2dc2f106f98921818677d17f135455d02ad3946f06dbf85cbecbbef387adbc0d4ffaa53b0fa18697130c53977cccb5a745e69ba3e539fc2ace74997430283a7d",
19
+        "Phaxio\/vendor\/composer\/platform_check.php": "03262b35b0226cd690c4e88d4ac19edfa911b51cd3b49589f6a7d19100a566ee3848d5afedafc68f4dbdf0c1580e98be4bb929195e9e23906fc14d542dc921a1",
20
+        "Phaxio\/vendor\/phaxio\/phaxio\/.gitignore": "60a8620eb13765d26fd63c93217dac4f207ad5b8ee0f5506923f05b72190de5b962dfc76895e968887efe8a17dcd334287bbf0848cc8ba6be0309d6393874fc7",
21
+        "Phaxio\/vendor\/phaxio\/phaxio\/CHANGELOG": "2eff47994cc1ef1ff374ab0e6d63c6504518b2731149c200ed7aa0aa5ea13fef070a7408741426c1c384a298061bc4c53c3dd91ef8eb6c5e4f62894aee1a3206",
22
+        "Phaxio\/vendor\/phaxio\/phaxio\/LICENSE": "a2a7604f0909b0e4b282508198c8e525d239a18995574b54569abd07ba784e872af3757b2a0802e1a8430fcbfe8260eee8f508f3821f29b0fe95ccc7e44874a2",
23
+        "Phaxio\/vendor\/phaxio\/phaxio\/composer.json": "37a15063347f6997ccebacc48942110158f8fd682ac5eb5c58465e3562a9cad346228dec018841d28be3d6afd282f5dce978a22d778f77b75dda05e1cf6a4213",
24
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/autoload.php": "fccd9008107c490da7808c70d27ea04f13ee3de4bde8291a69c3283ebf7b5efc0d0a440aaad0d68ebeadfe37241f924040c977dd0bc93a16b894638211bad1dd",
25
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/cancelFax.php": "590564fdaaef85e7b72b49c31ddc0a5cd9ae70a5c452f1ce4b08f56bec1e19ae9f8c826fe179dd0c68127f96333ddab1faa3d652879e35d27ac5e4b422586c07",
26
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/createPhaxCode.php": "8fd8fe39a97abc99afae8edc9363319bee3ef07841b91f0bc6f738d283a24b2e8e56f109ecd0b4d567e5da694abd4deae14008c1d247dd8690de7ad54e48238e",
27
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/deleteFax.php": "0f14c0147950102848ed065c3ca3f12bb56fad382a35e42f77f0acf67ed491050054bbc43f3ee49a96895d3081156ddbdc7640f3f7d9a0fc7848d13bf4921107",
28
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/downloadFaxDocument.php": "ee26536919405a2e5f4303c69cbaaa66d08eb946143f17dabc8636881b88cb08abdb56812d826424e756efa247dc1c6aeb585ad9f7bfaa21547d0827f4d2e934",
29
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/downloadFaxThumbnail.php": "b581ab76492911decadad4357e6d1cba800394dea1dd0be3ebe925b43b41efc0005ec66707f52ec8a21bcba46f9be0626ff8d08e2686da35e690ebd13302b4db",
30
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/files\/content.pdf": "515cdf6ba8271b7a17bd44e9458e28aa288cd9aee64db2daf721568d0eab1249d47243bfa6b2cf39563e848afa1f246453288682d16ddfd4a0a89c981424dbdc",
31
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/files\/coverPage.html": "8c14d034bd830269ab9df374f6bff8261b4641d121e4c5806c0e923f744e5b0eab82504924e474f04b9218b166edddb5ad1dc42524c64a018e21e9c968f8160a",
32
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/listFaxes.php": "4bd4e16ae654cd39df0f7b405537af034a48c4acee9107dec5fc7f5bb982c2b9cfd6ea030912f0190132664c80fad629bfebb1229d7650200d0ca096a5aabdfe",
33
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/phaxio_config.php.temp": "1efc886fce5ea24e9a650a35c497d45b8bae47bc035c6ce4f58aa2abd78ba46585c0401d8e4cc34614d3521b234d12d539536bc9bfe78a9e980f97f92ff898f9",
34
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/sendContentUrls.php": "f65f864142f8f856d504ddc89f37a570cb3f229563fdeb2a7a56d628c7f4d316c930cd0e4f944cea3c73c0349aba51340f9cf02a174fcdcb7dcf4823ecd4d3c7",
35
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/sendFiles.php": "ae986282c3c75b8e0162bbe95bd08100ce4ec10af67cd536b763e674d9c21a8168948a5f2b1fc3efeb9fd9d9daf46645ffbf179e1e3166ff0060c4ee39edd593",
36
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/sendFilesWithBatching.php": "5e4915fe1fb7fb1c916c776a962aff398ea8c0d3bb753fb0b6edd00ceea8374c8cdc6a528c1e36ee61368d072f8ef549c2ffc62ccff6057088b768d764fe5984",
37
+        "Phaxio\/vendor\/phaxio\/phaxio\/examples\/sendText.php": "914a594bdd09c08727c9f155945060212f6c03ecf920a9ffe3eeed9ed5ff35547e541a3bd18b242ef47ae356f2c1e55f74b8d790ca077950a07881ae926fa46e",
38
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio.php": "e13f967f4b54f99de59d91fe0dbcf8c653a388825fa1f84f76b391a839941586d38d215f63005fe4307a2a3658afaece45088c002de83f962bb1d936476e9b13",
39
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/AbstractResource.php": "48f68360a03312162d9aae7195345ba848216700f9a7d89f08d681d500d27af715af7d569aaab23b2426867519244d2cbec50fa3db7c8eee897bfd9e43aa30a8",
40
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/AbstractResourceCollection.php": "0365a3e8c6194b51633199d9123aa0789e2279f5b29455c1ae5feb0c01a7731d053ef5252d91f6aa62ac1a4726fa3b906ffffabf9e715f30f9aaa34780367aaa",
41
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/AbstractResources.php": "b22c82110e2f60cdf92c7546f1ec8e8039cb9f4b92298087290c9113698166e9ef7d25b9a2645809e0f2aceb3994e45f4c8904b1a2ca03cf00c05be8504df6bd",
42
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Account.php": "aea5b414544a9c3c7797146c15c4f419d732225de824113ece7a089f26bbc99426f11e980fa7214e4a3065b8efcd1e32ac1d29ea82ebb1eff445e9d27ff6aac0",
43
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Account\/Status.php": "678e00b88f00ce03ce1cdfacd7ff23608baa09f5298bdda06f834d73257b89ba60ced77df88c2604fcc828b5432f2bb7c13e0d5418674b76a5152a59138d8e35",
44
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error.php": "db0e1a32af83054c31662c26b30bef0ce125d0269a3b762ee231af524df152698814fd479db55833f5a7e580a83f6e823130b4b4e81e6635cbcfca796c8154c1",
45
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error\/APIConnectionException.php": "39411737aa1d7c4e8ac656908db977500fb3a5bc9a429e5367341525d010bb48c2785ec9eec0b7d84a244d21182cf0e0f635125a7aef96006a2222cb066ac353",
46
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error\/AuthenticationException.php": "50dc9337d0e0339547d74d49fb608cb9434ec645b16a283f2feef6959de9ebcd0bd0134c113188c8ee4fb06e21a981ed4274670eb0adc51634b1de8c4f3be8ad",
47
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error\/GeneralException.php": "d6d1d96f8ef2d89eff98814befa51b3f0f5a24a44611414c9bbeaf3046633f8a3b752d33b002738ddd5bbde167a1478f897a127e8ec90e710446ca53bf6a2af0",
48
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error\/InvalidRequestException.php": "64988a6943b848b3f74614c27a16c109af76e4cca9df497ee7066b4ccac0719e2665460337b1e03dcc9ebc7d469f0f670c45b680bdf327c8a3ffaecf4e872846",
49
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error\/NotFoundException.php": "cdbe663b94bd2fdef124570af93509a8080312b0ba13e8ac1664744d40a19c9701c35813da6b10f619c6ccd449ba863c012ef2613b24993e59ecb460dd901cf7",
50
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Error\/RateLimitException.php": "583aebaa33f59f697795034ea4053919e7203218a6984516ad8ffca8a5eb85a7804a30414b33595016b48ca6b83b1926f5b3eefb4bf8bca5fd88ecf173f0e0d1",
51
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Fax.php": "754cc2e5f039acfd3e6ee98311fb12519d83079bb8acfb21338a0ea175df1b53ae863a709c14e43ae1ef39eddc51bfcaaa577eb284d33da787e511c3abb56df0",
52
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Fax\/File.php": "650cf3c1e6aabd535c13c09de0525d73e695f813f0c267008b7722e7a594b5a25f2156bcf6d9fc0828dc0869fa250c138f55256d8aee6a10d83569f33228ed5e",
53
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/FaxCollection.php": "cd04652b9ff7b19af3d53436ca45cb82db41b611df18473b52cc6eb6f5051ad8db34fe751cec891ab315032f6dd109fff6c430baef95aba11cfae10fc073d2ce",
54
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/Faxes.php": "2e1c9c7c78e80fd6efbd49820002c423560bc2fc32d15799b70e26b754a9e659ef61aa707846724c999e1f98ac82366cf57ea49b0ea101a6d825b5bcc80ca278",
55
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/OperationResult.php": "3e85b6a921303cd1e03bc67a79203446e59f76714eed5b468ced130a33fe4e37d6198ef07059fc1f1b8784115ff2084d67e0c3a44b2d7c9433158873c67d7cd9",
56
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxCode.php": "3999628fee6f6f8488e49b8a03a587186a78c20f0ea1a07a5f60455de9dcc8fee644aab86b1942dfeef3b5510de3fa6c71bdf8ee4f2724ddd60309bc09e07fc6",
57
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxCodes.php": "b4d3e68f7c69646cc7e740496173504c8d5ba5956ca43e556c4da1b472500c2937f8ae81fdf8598a7c96899f8e9e9570236cf290547b3a604b0873495a39c4af",
58
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic.php": "9dcb4a790708f552289c28e12de86a5be8af96c1383e079ca626aaba2dc0ae0ac1930c2cc32547d328c69867476746caa7a0c1e9af4b162cee8ea98637720749",
59
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic\/AreaCode.php": "e40391514dc3ac86040436625c8cc977177269d878f97f1f7a26f441b75899fc0ac5f124e82563be63998b5009261287a709630bd5feb7f58d1ca0aff4e799c8",
60
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic\/AreaCodeCollection.php": "36ef6b3a17eaf0bbb45cafd7bc63a387b028c55759e9650c597ed9ad4d98a6788a5c4f2c59055dacaa7ba5cd958f1d8e0811b53962c3b9ad51e96b26ca85e418",
61
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic\/AreaCodes.php": "59b42f33330ad1856d9ecc01588abdcf34080e770f32134cbbf207144d10e1b65c1182df7e39c11f6ba9381fe845715eefd6891cbe29ffc06a8ce2e4e20a3987",
62
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic\/Countries.php": "c3214a5af911c09a2be6de5446c02c6b262082a0cfca057e9a135dbd29631f00a75bfea3bb9181bea1dbe45a7238afd05510275822857031726002ba7d9f2118",
63
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic\/Country.php": "df81c4fd6eaf3d3fd82b090e481cef2c19e34cf532c16753ec909b36c38ac2e87efda4133d8322a512cd0a31d53421fdd2009e6f04be0119a31a90c30c690db5",
64
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhaxioPublic\/CountryCollection.php": "5457c89d54da2c2f6ff8ae907e8c7e21e7fa8197e05c6209d7924e2ac02e422002c6d92e434b45cefe79630532d2c80f1ddd7f4508c0867db637288bc32833c6",
65
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhoneNumber.php": "e8d578db0d72ff22b472c2ecbd58f6b90c06a581392dcb0281b8116dfda57d7fe43d33a212b79d6185276b69ec6c3dadc231603eedb62ded7bd695177baa7b50",
66
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhoneNumberCollection.php": "17e29c72a0a23bf39ab4aca4e77836f78a1a9b570cbece8837e479e2039f8bbf433fe9137c7f9f39e0de930f8eea3eccaf202e6e60cda6ca8fab25e5738af264",
67
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/PhoneNumbers.php": "0a196164d5abb4598c5f3e4eaf092e999aa2e6d097fa4d93c284757ce5c616d949f07e5a6e9a93f632f838551c5979d6517802243014131f2a6bd20bd64c0246",
68
+        "Phaxio\/vendor\/phaxio\/phaxio\/lib\/Phaxio\/StringUpload.php": "a8e15f97d3562d17375989d34ee31569ae2b7a684632bf64f209e61cac7198ec91cc6668e7be51e1d3cf6110a66e881b20e47d6eac0dd2dc6ba8404f04cd0423",
69
+        "README.md": "d65d22c5c28f57774c55cbded7c0f6d1915cd0c0330f9dbf61ca29cf6769b97c72dd21cb398b3a5dcdfd304c8770de5377348f6b53a07f175d0ab470eb76693a",
70
+        "appinfo\/info.xml": "a6f4e6b9985c9e6257a7048f5947e1e1c70713fd2c0cabd9afc3accf9b198e5888ff77bf1d35190cabdd9b67b7b6897e33060f986d845c9d1daaf886df44b156",
71
+        "appinfo\/routes.php": "5c13e06285f7bdea64204c7603ea997220a6bacfef64e74bb676546e7fba262f4a47792c270de13b1fcb454e1759c824517f8af6107af8b877e0a81cf4a250c4",
72
+        "css\/style.css": "d1126779cd22600824cb172d8ea7952071e54c3e600ff697943e99756d394cd560a9e22efc69c03ceecc008cfef924860d67d9ba176a9f5259654abaf5132884",
73
+        "img\/nextcloud_logo.svg": "4e0d3f0c371d668d83d443e5b1f69f0eedcc759092601d8fe8710dd97b16fd53aa3f9667bba7f305dc3aacfbc14e29b09b78da8b7bf6f41dcb83f5b16473991e",
74
+        "img\/nextcloud_logo_bright.svg": "aeab941556e29f9537508171583bb3309372866122c150c887c21d6a567c5aa06d2653db67c7151b064d4e2fa25f1fc63df21c786ede02ca5f40f12e5c1bad26",
75
+        "img\/pax_fax.svg": "db540b202b0b9e49e0ed2453d99eb23b8eb37c293fcf52de280844e3d3c224ed067cc7bd80db755d851a78fca13fd2721e7bf16727f755de17442fd894b75791",
76
+        "img\/pax_fax_choose_file_from_nextcloud.png": "92d30d5c20d0f03acd9430f4e2c1a3694e346941dc9ec1400fb8a2697b750ddc611d226a55c31d5d3001c1bce2199edfcd823cc2634bb6d050ad0ce4fadaf993",
77
+        "img\/pax_fax_dark.svg": "1cd5df59a2886ada493eedba1ec62dcef815210416cdc1a6bb35aaa3fcaee59f5cd5a756e082557ba95eddd5abcba37236b5fc815cfffd9dea2843614071a673",
78
+        "img\/pax_fax_files_from_pc_and_nextcloud.png": "610c382b47f8ca41898098642538c1ede712a0462442a0eb937110b81befe71833de0a4e74c7f6e798888b51a9b7718108b910c145b7d4bc8096145f835ac556",
79
+        "img\/pax_fax_grey.svg": "fc36143f41b406b237a36e98b5834320bfff94c992a5633508834a8f2db79f679e5b83573d727774f7db6ac5c2eb01fb09b3d42ff1c16fb891f75e9d8a890c17",
80
+        "img\/pax_fax_logo.png": "3c901669e9f2e76f7bb3f2479209f0ff51c24c940d1d5ec163a375464b696c61872bc482dd523560919179cc0af3825d254dd89506220317c9930030896790df",
81
+        "img\/pax_fax_received_fax.png": "42c31af0849badf3d5451ada2d9db869031a48df473a7f4a0c07c1a31bc6c46ad7952612145d4d6037955b015eb90fe8a4115f506fee5d69f3ec46a956333080",
82
+        "img\/pax_fax_received_faxes.png": "ae747393bbbce84696c45aad0d30eb50903dd455f4cb7ba128fd8c5f22aa8d099b2fcc32a2ce58d34ca8bafa5ddd3824e94df68464b36c3d4b6ce56fa85915fe",
83
+        "img\/pax_fax_screenshot.png": "799b5e05469cab56f30cc58f1dc290cc6293fe2e79fef89566cf6feba0418068908d421d5b59eb33570fed2f40bee792fe86a3821e5121b2b204b2daeca516f6",
84
+        "img\/pax_fax_send_uploaded_file_as_fax.png": "536cd0913447bd152049e9cc7793b0674353f2e8b9bd8ae2b5eb7080d24484c4a4aae48f8a8b1ac0a271ed7ff6da2fa19547259a7d5090dbb32febb873ca136c",
85
+        "img\/pax_fax_sent_faxes.png": "d2630afa4992268e9891c66805fb44b21a3c7fbe431f7cc4582ae28b0355821696e8e50304b0165b5208b05a0b7c460f8d2d572d98ec53c3bd99ba08feb17a4e",
86
+        "img\/refresh_logo.svg": "a95a19645bbde5e2146a3ec669950bc6029bfc6104886552eaeb4746733657ecbe4f9199e676ee2e9852ef0c5adb612d93e300e3fa9713fc611e1f8e7c1d5183",
87
+        "js\/sendfax.js": "0c4f2cb18cf05252c7f8f631729565817fb5ab2e68f133202a81dc46ec6920d1ac9425f9e565ff4b3415afb4f9c50ecafe2411b5e7a3b7af2bb75ba72a84324d",
88
+        "js\/settings.js": "2cd438a40f2388d58b1a4577830906928ba03f08cce2196d4e26f603bd42ad1d0f4fc66607e1b0d279ebea0483a4bb1f8a912c1b7e7b7c3113c0f364ed749e43",
89
+        "js\/tiff.min.js": "c35f67b587aab62db7a3de662779a7b3264d70f5f856142cae88eadd1b477e474977f2b8c5ab31c16be002cb7ca9b52282e6de533b6fd79a02e6d33815919cb4",
90
+        "js\/webodf.min.js": "655acab6a9773314aa741a7477121885c593bf3ecf2bc67adf8f870c81d0604ebf5fc558dc2a6072da0a70397c0d995ce15c5969b2190bcd2b687693772a3281",
91
+        "l10n\/en_GB.js": "91aa74b34d75a800f0ea59635affc02e6efa8e71ed36fa7aaa3fce4046909c669dc8f34740c991469e50bae8b9dff1c5c7bf38d519475de21f197044c6a69b06",
92
+        "l10n\/en_GB.json": "04c7aea39bdbff91d74c0a9b1e788c066c833c6a7fe6c8b770121ded1b20faf47a80312500d103078a10839f72419d8aac78aee91e1734085bb3049365cdadd1",
93
+        "lib\/AppConfig.php": "c8acb61a0d2a4411a468578e4d10dbf1491c259fdfc6f40bfb29b5fae9b2d9dfb3564c72b9c679b5427f37dd51932d17ce6924c4e49daf58c390b6d2076c15b3",
94
+        "lib\/AppInfo\/Application.php": "d4dd88c84a7e53ca402beb53a7794182f04aff7e98a075ebd413369991f8699ec957f356b9f5c319e5bf6e19765bc175f985df0e376e3103ef88b516caf383ff",
95
+        "lib\/Controller\/AuthorApiController.php": "d99516665a701cb3d2a76fe37d2012f66c628f3ada353dbc204ff0545b1f749ece5766b1b1eddaa8ee6b4b73cf1613d150b801352e9cce96ba09b79021e061ca",
96
+        "lib\/Controller\/PageController.php": "c2abb6d62f7118e4c4ff73252c3ac4290e46e252a65248dae12c5a721a1aadeda189835d8efb9c8da7b22b3d8221e928a640bd93e4c5408a2db453517b78cb0d",
97
+        "lib\/Controller\/PaxfaxController.php": "55cd5b1e488f518a83ea9c87da7cc2e1d961fbaff9a44a23373c633c2638ac0974dfd26345f268d0e00fb8cf7bb093102f554eaef931cfff005613dae0c77a3c",
98
+        "lib\/Migration\/Version100Date20211106170854.php": "3e5872cc17d64b5b9889ba1fcaef6fe8e3baab8535915773257014534cb1c3844d8f13b368a8f6d76bc6474d3f03d9d9eae6f8745edd2675117c2e374c7d8f80",
99
+        "lib\/Service\/PaxfaxService.php": "1ea830c0a25c092a08021418fa57a7f1aacef7ca367dbe89bf4c123748c07c77ebe0575357ff1f22cc483760d44aae512b307788143980d9af5b4216145e8d0f",
100
+        "lib\/Settings\/Personal.php": "d86bea5200c519db9f6da9c616bcfe7602ec58cd8736ffbd3bec8f213b6bf824b54970a6edfeff2e93daa83835cac1b0dd348253f8ee3e40ef0962e7acead6ed",
101
+        "lib\/Settings\/PersonalSection.php": "f928a8b1df3bd8b482cab7a61cd32cb039ec6b8744f1902bc741c0ca85d0c3473d939df0a1fc91c2bead6b94546a10fa59136e491b142680814bd99ffb05d12b",
102
+        "templates\/content\/index.php": "7f88b793a60d7e3baeb18a22e8f6f6980fe981952871fb4efc1f9d56b4b2fcfc4ac5ef32e03ff227b0c6229cfcfa3a42a12d48c6871d5400a8b4fd68e3d18615",
103
+        "templates\/index.php": "ea041904c7847c95b9e75d60e0328b51a5eb55bd2c45352127d5490f8ee04af5af9b740cd8b71009841c53c1a1ac8de44be01f4744d7273b688d11fa5dd56498",
104
+        "templates\/navigation\/index.php": "4c2380162aafa36016d3f53eaeb569d401ee6aa0eb983509168a0c359f7dbbea225fdf1cb7daa1b24f13041b77527e9a16f4927fe1dc9cb2f4547ead07895565",
105
+        "templates\/settings.php": "d34b9778ddfbfc8b17fc9fab720779ac3e9f6e6b6f342e43e8101dff488aa74905cdfeaffbd183db3272f7d540197c04c282885432dbf7198dde89d5fb9ffbf0"
106
+    },
107
+    "signature": "BkUmwxiK2mCssPIG26XhOmcwogJFc5Ux5zMvA+hKzNOf5\/V9ivnQRa2RzcheZ2FA61\/ybt2MAwi6KIsqB4CH2yQHaqYPxfJb5cfwWdVxFWM0Eq\/vonWMmmYQ5kwtMADaRR1zxYhwWU4leqZCO4aIES5ON+bIb7GBHg7lMErRSRtrlVY4SmDsOdqZDdd91zP9rAQMM8Ji1EfNRZ\/HCULXETnY7h5TVTMI32Ubc1JnVVKNX3AfR0bCvDYl+tNhG6b7sG6aBuymOAbAi1gesEAUadBPOVeKDtQ7nO5MTEdU08asAyvhNQ0sNuNofV+BSi6PPMLNH0SsLGWGnpqKsSEkwODlyfZmXpSOrb+MpwxgQ0Ot5eFzWkkEF61IERugWjDQhXyNS86sq8Qz9BktZlWcdb\/ID49m\/pBvsgOY2lOe+nuzWtJUd2\/GB2ENipZnb1+qnktvVf31DpIBsOpZ\/ADGmIdll3pm8Fag0vIte2VjrytdHZ5sf78WnmspOa6BIVB1tRGEUHsTg1yQAsLZCI3uU7epy7eUo9mm1t5TyPZy31zxAq6GUA8swR4A42sH4wHj53Tm9jiyMGdPwWgevtFaLTsoDo1UnTkIp2q\/gADxRatlVG9g6jhmuY6X+JMm50lS2Movut9pQ+G3hNJNxOWqFy0IRitGlPQbnStZP69yJpA=",
108
+    "certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEAjCCAuoCAhG6MA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMjIwMjI1MTU0NTUwWhcNMzIwNjAyMTU0NTUwWjASMRAwDgYD\r\nVQQDDAdwYXhfZmF4MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsa4b\r\nARkaBatWm4JNKsst3BNjt1X4Clo0Vynelj+VfcMK9G2dB02HGZiQhBfi5cvLMDD4\r\nJEw9jPPf+pxxBY87gwloEQxRW4WmI3LLCPNVSF7GfvONwdjsoJebCPnH6AYHbUlG\r\nQ8\/6wlgCiCklMiCWW0pGFQaDis+4KIkmoFS4elRxOzb+oLCsJRHmLIcV1ZipRanE\r\nP5Y1u953glpjMChZEW6\/p4AEB4xi6b+GaQ+8cBZ5+7WvT54l5iKHY6Tl6fwOuBjl\r\nCc+8FC+hIKk7bTSXfbuwpgzZ7RNgH0BYD\/aryxK\/MHAqeGQKM\/pwvH9SN8LMLZVg\r\nXG+25FiBPuiST\/3l42sY1HD+Gh1KIw83zWD\/kVsU8tKIf0t0uS3ntwx3xjH0ojo9\r\n85Pu4XexopIPi4YxNFtphd\/+cJegbSLKa1LL2CqhnPSXHD8GYjZ16qdy6AxEyEki\r\nOQssSlTOsQ2RmvRqDPwqrbIZrVeiN3Mt4qEontOzci4ggjhBWqhjkcRId4XlGveu\r\nAbWP9O8aXzrElLLeSuDzl6uAcrtwgFvYjoxbRH66hcwv\/+RBOK58CI\/0ShGJZyVh\r\n\/9oDKwyYfHT1OTbRKlvm+TfV6Vmbuol0xFinUv4GoykBO67JJcERTSTGGDqMP2OL\r\n97lkR1b7sy9WKrWw1iljbwyzEEASKKleJtp8HC0CAwEAATANBgkqhkiG9w0BAQsF\r\nAAOCAQEAK+uuoq2F0N4nYdHpRRi5pP8hu540jEpHsLB8o\/3GT++Tdj9jeMdfDWos\r\nskB2e+Vi3OgiCWq51gQ9pq0YSQLZJzXBtX9Zd7gvnmIWJZqjbEkMsky+zMM2mweA\r\nl4+coZvXuqxNN6aY+oAKuf66ZWviUld1WEOz0+2vLrhs9qDCYFKDl7vXol6hz4gf\r\nX5d5crNAu1QboE8FEMxqfDrAMeJzL6SAG4UUaF9duB\/6xUm9d7vBKDCPMzZAV\/ob\r\n+8wxt7K4VoOuCo1KEpp\/+ZRrEr5ZbGGsNw41jrtfBsrMtbbIoRtyIh9Xfme2KzYM\r\ncm9HZiMNDokH8MlzOPOGwkP31w4FHQ==\r\n-----END CERTIFICATE-----"
109
+}
0 110
\ No newline at end of file
1 111
new file mode 100644
... ...
@@ -0,0 +1,684 @@
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
+#pax_fax_vbar {
24
+  padding: 18px;
25
+  font-family: Calibri, Frutiger, "Myriad Pro", Myriad, sans-serif;
26
+  color: #6d6c6c;
27
+}
28
+
29
+#currentbaldiv {
30
+  display: block;
31
+  position: relative;
32
+  font-size: 17px;
33
+  font-weight: bold;
34
+  padding: 5px 0px 2px 14px;
35
+  margin: 0px 0px 8px 0px;
36
+  color: #FFFFFF;
37
+  background: #3f9dd1;
38
+  border-radius: 20px;
39
+}
40
+
41
+#currentbalance {
42
+  display: inline;
43
+  position: relative;
44
+  padding-left: 10px;
45
+}
46
+
47
+.providername {
48
+  color: #FFFFFF;
49
+}
50
+
51
+.providername:hover {
52
+  color: #003b94;
53
+}
54
+
55
+#faxnumbersdiv {
56
+  display: block;
57
+  position: relative;
58
+  font-size: 17px;
59
+  font-weight: bold;
60
+  height: 30px;
61
+  margin: 0px 0px 20px 0px;
62
+  background: #3f9dd1;
63
+  border-radius: 20px;
64
+}
65
+
66
+#currentfaxnmbrs {
67
+  display: inline-block;
68
+  position: absolute;
69
+  height: 22px !important;
70
+  width: 54%;
71
+  font-size: 14px;
72
+  color: #353535;
73
+  padding: 0px 0px 0px 5px;
74
+  margin: 0.5px 0px 0px 4px;
75
+  -moz-box-sizing: border-box;
76
+  -webkit-box-sizing: border-box;
77
+  box-sizing: border-box;
78
+  background: #fcfcfc;
79
+  border-radius: 20px;
80
+}
81
+
82
+.pflabels {
83
+  font-size: 15px;
84
+  font-weight: bold;
85
+}
86
+
87
+.pfheader {
88
+  display: block;
89
+  position: relative;
90
+  margin: 0px 0px 7px 0px;
91
+  font-size: 17px;
92
+  font-weight: bold;
93
+}
94
+
95
+.faxnbformat {
96
+  display: block;
97
+  position: relative;
98
+  margin: 0px 0px 4px 0px;
99
+  font-size: 17px;
100
+  font-weight: bold;
101
+
102
+}
103
+
104
+.pax_fax_box {
105
+  display: block;
106
+  box-sizing: content-box;
107
+  margin: 8px 0px !important;
108
+  width: 70%;
109
+}
110
+.indtext {
111
+  display: inline-block;
112
+  padding-left: 10px;
113
+}
114
+
115
+#settings-dscr {
116
+  padding-top: 3px;
117
+}
118
+
119
+#pf_upload_msg, #pf_choose_msg, #pf_submit_msg {
120
+  display: block;
121
+  margin: 8px 0px 8px 0px;
122
+  text-align: center;
123
+  font-size: 15px;
124
+  font-weight: bold;
125
+  color: #181918;
126
+  background-color: #a5e5b3;
127
+  border-radius: 3px;
128
+}
129
+
130
+#paxfax_save_msg {
131
+  display: inline;
132
+  color: #181918;
133
+  background-color: #a5e5b3;
134
+  font-weight: bold;
135
+  max-width: 70px;
136
+  text-align: center;
137
+  margin-top: 7px;
138
+}
139
+
140
+#pf_submit_msg {
141
+  margin: 8px 0px 8px 0px;
142
+  padding-left: 5px;
143
+  padding-right: 5px;
144
+}
145
+
146
+#pickedfilename {
147
+  font-size: 13px;
148
+}
149
+
150
+#faxtodiv {
151
+  display: block;
152
+  position: relative;
153
+}
154
+
155
+#faxto {
156
+  display: block;
157
+  width: 97%;
158
+  max-height: 22px;
159
+  margin: 3px 0px 20px 0px;
160
+  padding: 1px 13px 0px 13px;
161
+  color: #565656;
162
+  font-size: 15px;
163
+  font-weight: bold;
164
+  border-radius: 20px;
165
+}
166
+
167
+.up-bttn-wrapper {
168
+  display: block;
169
+  position: relative;
170
+  overflow: hidden;
171
+  padding-top: 20px;
172
+  padding-bottom: 30px;
173
+}
174
+
175
+#submitfax {
176
+  display: block;
177
+  color: white;
178
+  font-weight: bold;
179
+  font-size: 15px;
180
+  background: #3f9dd1;
181
+  padding: 6px 16px 6px 16px;
182
+}
183
+
184
+#submitfax:active {
185
+  background: #00a2f9;
186
+}
187
+
188
+.uploadfiledv {
189
+  position: relative;
190
+  display: inline-block;
191
+  margin: 4px 0px 22px 0px;
192
+}
193
+
194
+#app-content {
195
+  display: block;
196
+  position: absolute;
197
+  width: 100%;
198
+  height: 100%;
199
+}
200
+
201
+#faxfoldersview {
202
+  display: inline-block;
203
+  position: relative;
204
+  width: 100%;
205
+  height: 100%;
206
+  margin-top: -50px;
207
+  background-color: #f4f9ff;
208
+}
209
+
210
+#viewerContainer {
211
+  display: block;
212
+  position: relative;
213
+  width: 100%;
214
+  height: 100%;
215
+}
216
+
217
+#viewer {
218
+  display: block;
219
+  position: relative;
220
+  min-width: 100%;
221
+  min-height: 100%;
222
+}
223
+
224
+#faxdocpreview {
225
+  display: inline-block;
226
+  position: relative;
227
+  width: 100%;
228
+  height: 100%;
229
+  background-color: #f4f9ff;
230
+}
231
+
232
+#docPreviewFaxImg {
233
+  display: block;
234
+  position: relative;
235
+  background-image: url('../img/pax_fax_grey.svg');
236
+  background-repeat: no-repeat;
237
+  background-position: center center;
238
+  width: 100%;
239
+  height: 100%;
240
+}
241
+
242
+#outerContainer {
243
+  display: block;
244
+  position: relative;
245
+  width: 100%;
246
+  height: 100%;
247
+}
248
+
249
+#mainContainer {
250
+  display: block;
251
+  position: relative;
252
+  width: 100%;
253
+  height: 100%;
254
+}
255
+
256
+#app-content #app-content-wrapper {
257
+  display: block;
258
+  position: absolute;
259
+  margin: 0;
260
+  align-items: stretch;
261
+  height: 100%;
262
+  width: 99%;
263
+}
264
+
265
+#content {
266
+  width: 81%;
267
+  display: flex;
268
+}
269
+
270
+#uploadedjpg, #uploadedpng {
271
+  width: auto !important;
272
+  height: auto !important;
273
+}
274
+
275
+.cllridcls {
276
+  position: relative;
277
+  display: inline;
278
+  font-size: 17px;
279
+  color: #000000;
280
+  z-index: 3;
281
+}
282
+
283
+.fortooltipinit {
284
+  position: relative;
285
+  display: inline-block;
286
+  float: right;
287
+  font-size: 15px;
288
+  color: #000000;
289
+  z-index: 3;
290
+}
291
+
292
+.fortooltipinit #infosetid {
293
+  display: block;
294
+  position: relative;
295
+  margin: 4px 9px 0px 0px;
296
+  color: #000000;
297
+  font-size: 21px;
298
+  font-weight: bold;
299
+  font-family: Times New Roman;
300
+  font-style: italic;
301
+}
302
+
303
+.fortooltip {
304
+  position: relative;
305
+  display: inline-block;
306
+  font-size: 15px;
307
+  color: #000000;
308
+  z-index: 2;
309
+}
310
+
311
+.fortooltip #infonumber {
312
+  color: #000000;
313
+  font-size: 21px;
314
+  font-weight: bold;
315
+  font-family: Times New Roman;
316
+  font-style: italic;
317
+  padding: 0px 0px 3px 3px;
318
+}
319
+
320
+.fortooltipsec {
321
+  position: relative;
322
+  display: inline-block;
323
+  font-size: 15px;
324
+  color: #000000;
325
+  padding: 0px 0px 4px 0px;
326
+  z-index: 1;
327
+}
328
+
329
+.fortooltipsec #infoformat {
330
+  color: #000000;
331
+  font-size: 21px;
332
+  font-weight: bold;
333
+  font-family: Times New Roman;
334
+  font-style: italic;
335
+  padding: 0px 0px 3px 3px;
336
+}
337
+
338
+.fortooltipinit .calleridtooltip {
339
+  display: block;
340
+  position: absolute;
341
+  visibility: hidden;
342
+  width: 264px;
343
+  background-color: #f4f4f4;
344
+  font-size: 15px;
345
+  font-weight: bold;
346
+  color: #595959;
347
+  text-align: left;
348
+  border-radius: 1px;
349
+  padding: 5px 5px 5px 8px;
350
+  margin: 0px 0px 0px -214px;
351
+  -webkit-box-shadow: 7px 9px 8px 0px rgba(212,212,212,1);
352
+  -moz-box-shadow: 7px 9px 8px 0px rgba(212,212,212,1);
353
+  box-shadow: 7px 9px 8px 0px rgba(212,212,212,1);
354
+}
355
+
356
+.fortooltipinit:hover .calleridtooltip {
357
+  visibility: visible;
358
+}
359
+
360
+.fortooltip .fortooltiptext {
361
+  display: block;
362
+  position: absolute;
363
+  visibility: hidden;
364
+  width: 256px;
365
+  background-color: #f4f4f4;
366
+  font-size: 15px;
367
+  font-weight: bold;
368
+  color: #595959;
369
+  text-align: left;
370
+  border-radius: 1px;
371
+  padding: 5px 5px 13px 5px;
372
+  margin-top: -4px;
373
+  -webkit-box-shadow: 7px 9px 8px 0px rgba(212,212,212,1);
374
+  -moz-box-shadow: 7px 9px 8px 0px rgba(212,212,212,1);
375
+  box-shadow: 7px 9px 8px 0px rgba(212,212,212,1);
376
+}
377
+
378
+.fortooltip:hover .fortooltiptext {
379
+  visibility: visible;
380
+}
381
+
382
+.fortooltipsec .fortooltiptextsec {
383
+  display: block;
384
+  position: absolute;
385
+  visibility: hidden;
386
+  width: 256px;
387
+  background-color: #f4f4f4;
388
+  font-size: 15px;
389
+  font-weight: bold;
390
+  color: #595959;
391
+  text-align: left;
392
+  border-radius: 1px;
393
+  padding: 5px;
394
+  margin-top: -4px;
395
+  -webkit-box-shadow: 7px 9px 8px 0px rgba(212,212,212,1);
396
+  -moz-box-shadow: 7px 9px 8px 0px rgba(212,212,212,1);
397
+  box-shadow: 7px 9px 8px 0px rgba(212,212,212,1);
398
+}
399
+
400
+.fortooltipsec:hover .fortooltiptextsec {
401
+  visibility: visible;
402
+}
403
+
404
+.fileupload {
405
+  display: none;
406
+}
407
+
408
+div > label {
409
+  position: relative;
410
+}
411
+
412
+.uploadflbt {
413
+  width: 411px;
414
+}
415
+
416
+label span {
417
+  display: inline-block;
418
+  min-width: 110px;
419
+  padding: 0px 0px 8px 0px;
420
+}
421
+
422
+.uploadflbt .icon-upload {
423
+  display: inline;
424
+}
425
+
426
+.pfprompt {
427
+  font-size: 17px;
428
+  font-weight: bold;
429
+  color: #6d6c6c;
430
+}
431
+
432
+.fileuploadstl,.filesfromnc {
433
+  display: block;
434
+  font-size: 17px;
435
+  font-weight: bold;
436
+  color: #000000;
437
+}
438
+
439
+#filestotsize {
440
+  display: none;
441
+  position: relative;
442
+  height:auto;
443
+  margin: 0px 0px 16px 0px;
444
+  color: #18bf6e;
445
+  font-size: 15px;
446
+  font-weight: bold;
447
+}
448
+
449
+#filessizetext {
450
+  display: inline;
451
+  position: relative;
452
+  padding-left: 10px;
453
+}
454
+
455
+#fileuploadednm .indivflcls {
456
+  display: inline-block;
457
+  position: relative;
458
+  height:auto;
459
+  max-width: 90%;
460
+  overflow: visible;
461
+  white-space: normal;
462
+  word-break: break-all;
463
+  text-overflow: ellipsis;
464
+  font-size: 17px;
465
+  color: #0e6ba0;
466
+}
467
+
468
+.indivflcls:hover {
469
+  cursor: pointer;
470
+  text-decoration: underline;
471
+}
472
+
473
+.indupfldl {
474
+  position: relative;
475
+  display: inline-block;
476
+  float: right;
477
+  cursor: pointer;
478
+  width: 20px;
479
+  color: #0e6ba0;
480
+  text-align: center;
481
+  font-size: 17px;
482
+}
483
+
484
+#fileuploadednm .indupfldl:hover {
485
+  background-color: #e8f6ff;
486
+  cursor: pointer;
487
+}
488
+
489
+#filespickednc .indivflpckd {
490
+  display: inline-block;
491
+  position: relative;
492
+  height:auto;
493
+  max-width: 90%;
494
+  overflow: visible;
495
+  white-space: normal;
496
+  word-break: break-all;
497
+  text-overflow: ellipsis;
498
+  color: #0e6ba0;
499
+}
500
+
501
+.indivflpckd:hover {
502
+  cursor: pointer;
503
+  text-decoration: underline;
504
+}
505
+
506
+.indpckfldl {
507
+  position: relative;
508
+  display: inline-block;
509
+  float: right;
510
+  cursor: pointer;
511
+  width: 20px;
512
+  color: #0e6ba0;
513
+  text-align: center;
514
+}
515
+
516
+#filespickednc .indpckfldl:hover {
517
+  background-color: #e8f6ff;
518
+  cursor: pointer;
519
+}
520
+
521
+select, button, .button, input:not([type="range"]), textarea, div[contenteditable="true"], .pager li a {
522
+  margin: 0px 0px 0px 0px;
523
+ }
524
+
525
+#dirbuttons {
526
+  margin-top: 28px;
527
+}
528
+
529
+button, .button, input[type="button"], input[type="submit"], input[type="reset"] {
530
+  padding: 6px 20px;
531
+  width: auto;
532
+  min-height: 22px;
533
+  cursor: pointer;
534
+  box-sizing: border-box;
535
+  background-color: var(--color-background-dark);
536
+}
537
+
538
+select {
539
+  width: 130px;
540
+  min-height: 28px;
541
+  box-sizing: border-box;
542
+  padding-right: 0px !important;
543
+}
544
+
545
+#uploadfileforfax {
546
+  margin-left: 19px;
547
+}
548
+
549
+#pickFromNext, #uploadFile {
550
+  display: inline-block;
551
+  position: relative;
552
+  font-size: 17px;
553
+  font-weight: bold;
554
+  color: #6d6c6c;
555
+}
556
+
557
+#choosefilen {
558
+  display: inline;
559
+  position: relative;
560
+  margin: 0px 0px 20px 16px;
561
+  padding-top: 15px;
562
+  background-image: url('../img/nextcloud_logo.svg');
563
+  background-repeat: no-repeat;
564
+  background-size: 110% 125%;
565
+  background-position: center center;
566
+  min-width: 66px;
567
+  min-height: 30px;
568
+  cursor:pointer;
569
+}
570
+
571
+#choosefilen:active {
572
+  background-image: url('../img/nextcloud_logo_bright.svg');
573
+  background-repeat: no-repeat;
574
+  background-size: 110% 125%;
575
+  background-position: center center;
576
+  min-width: 66px;
577
+  min-height: 30px;
578
+}
579
+
580
+#checkbalance {
581
+  display: inline;
582
+  position: relative;
583
+  padding-left: 0px;
584
+  margin-top: -1px;
585
+  margin-right: 4px;
586
+  float: right;
587
+  background-image: url('../img/refresh_logo.svg');
588
+  background-repeat: no-repeat;
589
+  background-size: 110% 110%;
590
+  background-position: center center;
591
+  min-width: 24px;
592
+  min-height: 24px;
593
+  cursor: pointer;
594
+  background-color: #FFFFFF;
595
+}
596
+
597
+#selectcalleridbttn {
598
+  display: inline;
599
+  position: relative;
600
+  padding-left: 0px;
601
+  margin-top: 2.6px;
602
+  margin-right: 4px;
603
+  float: right;
604
+  background-image: url('../img/refresh_logo.svg');
605
+  background-repeat: no-repeat;
606
+  background-size: 110% 110%;
607
+  background-position: center center;
608
+  min-width: 24px;
609
+  min-height: 24px;
610
+  cursor: pointer;
611
+  background-color: #FFFFFF;
612
+}
613
+
614
+#faxnumbersdiv #pickid {
615
+  display: inline-block;
616
+  position: relative;
617
+  font-size: 17px;
618
+  font-weight: bold;
619
+  margin: 4px 3px 4px 13px;
620
+  color: #FFFFFF;
621
+}
622
+
623
+#get_notification {
624
+  display: block;
625
+  margin-bottom: 8px;
626
+}
627
+
628
+#get_notification:hover {
629
+  cursor: pointer;
630
+}
631
+
632
+.pax_fax_boxspec {
633
+  display: inline-block;
634
+  box-sizing: content-box;
635
+  margin: 8px 0px !important;
636
+  width: 70%;
637
+  font-size: 14px !important;
638
+}
639
+
640
+.setlabeltext {
641
+  font-size: 15px;
642
+}
643
+
644
+#countryCallCode {
645
+  color: #1b60ba;
646
+}
647
+
648
+#countryCallCode:hover {
649
+  color: #0D3B78;
650
+}
651
+
652
+.openfaxfolder {
653
+  display: block;
654
+  position: relative;
655
+  margin: 10px 0px 10px 0px !important;
656
+  padding: 7px 0px 7px 0px;
657
+  width: 100% !important;
658
+  color: #FFFFFF !important;
659
+  font-size: 15px !important;
660
+  background-color: #CB99C5 !important;
661
+}
662
+
663
+.openfaxfolder:hover {
664
+  border: 2px;
665
+  background-color: #c18bba !important;
666
+}
667
+
668
+.openfaxfolder:active {
669
+  background-color: #b777af !important;
670
+  border: 2px;
671
+  color: #FFFFFF !important;
672
+  border-color: #b777af;
673
+}
674
+
675
+.openfaxfolder:focus {
676
+  background-color: #a3669b !important;
677
+  border: 2px;
678
+  border-color: #a3669b;
679
+}
680
+
681
+.indgenflcls, .indgenpckfls {
682
+  display: block;
683
+  margin: 0px 6px 14px 6px;
684
+}
0 685
\ No newline at end of file
1 686
new file mode 100644
... ...
@@ -0,0 +1,831 @@
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 readtxtfile = [];
27
+  var readhtmlfile = [];
28
+  var readjpg = [];
29
+  var readpng = [];
30
+
31
+  // Adjust the path, so that the uploaded pdf files can be previewed while Nextcloud is served on a subdomain or on a subdirectory, by Nginx or by Apache
32
+  var locHref = window.location.href;
33
+  var pathSplit = locHref.split('/');
34
+  var firstPathEl = '';
35
+  if (pathSplit.length == 7) { firstPathEl = '/' + pathSplit[3]; }
36
+
37
+  // Check the available balance
38
+  $("#checkbalance").on("click", function(event) {
39
+
40
+     $('#checkbalance').addClass('icon-loading');
41
+
42
+     var getbalanceUrl = OC.generateUrl("/apps/pax_fax/user/getbalance");
43
+
44
+     $.ajax({
45
+          url: getbalanceUrl + '/' + userid,
46
+          type: "POST",
47
+          data: {userid: userid},
48
+          cache: false,
49
+          processData: false,
50
+          contentType: false,
51
+          success: function(phaxiobalance) {
52
+                 var balanceindlrs = phaxiobalance / 100;
53
+                 var balanceproc = "$ " + balanceindlrs.toFixed(2);
54
+                 $('#currentbalance').text(balanceproc);
55
+
56
+                 $('#checkbalance').removeClass('icon-loading');
57
+          }
58
+     });
59
+  });
60
+
61
+  // Select the Caller ID
62
+  $("#selectcalleridbttn").on("click", function(event) {
63
+
64
+     $('#selectcalleridbttn').addClass('icon-loading');
65
+
66
+     var getfaxnumbersUrl = OC.generateUrl("/apps/pax_fax/user/getfaxnumbers");
67
+     var selectednmbr = null;
68
+
69
+     $.ajax({
70
+          url: getfaxnumbersUrl + '/' + userid,
71
+          type: "POST",
72
+          data: {userid: userid},
73
+          cache: false,
74
+          processData: false,
75
+          contentType: false,
76
+          success: function(phaxionmbrs) {
77
+
78
+                    $('#currentfaxnmbrs').empty();
79
+                    $('#currentfaxnmbrs').append("<option value='' selected='selected' disabled class='optselectfxnb'>Choose an ID</option>");
80
+                    $('#currentfaxnmbrs').append("<option value='' class='optselectfxnb'></option>");
81
+
82
+                    $.each(phaxionmbrs, function(key, indfxnmb) {
83
+                           $('#currentfaxnmbrs').append("<option value='"+indfxnmb+"' class='optselectfxnb'>"+indfxnmb+"</option>");
84
+                    });
85
+
86
+                    $('#selectcalleridbttn').removeClass('icon-loading');
87
+
88
+          }
89
+     });
90
+  });
91
+
92
+  // Clean the Pax_Fax/temp_files directory
93
+  var cleanflUrl = OC.generateUrl("/apps/pax_fax/user/cleantempdir");
94
+
95
+  $.ajax({
96
+          url: cleanflUrl + '/' + userid,
97
+          type: "POST",
98
+          data: {userid: userid},
99
+          cache: false,
100
+          processData: false,
101
+          contentType: false
102
+  });
103
+
104
+  var n = 1;
105
+  var uploadedtofax = [];
106
+
107
+  // Upload files to be faxed
108
+  $("#uploadfileforfax").change(function(e){
109
+
110
+     OC.msg.startAction("#pf_upload_msg", t("pax_fax", "Uploading ..."));
111
+     $('#faxdocpreview').addClass('icon-loading');
112
+     $('#filestotsize').show();
113
+
114
+     var userid = "<?php p($userId); ?>";
115
+     var baseUrl = OC.generateUrl("/apps/pax_fax/user/uploadfile");
116
+
117
+     var formData = new FormData();
118
+     formData.append('uploadfileforfax', $('#uploadfileforfax')[0].files[0]);
119
+
120
+     var currentflsize = $('#uploadfileforfax')[0].files[0].size;
121
+
122
+     var fileup = $('#uploadfileforfax').val();
123
+     var fileuptrim = fileup.split('\\').pop();
124
+
125
+     if ($.inArray(fileuptrim, uploadedtofax) != -1) {
126
+         var duplicatescheck = 1;
127
+     } else var duplicatescheck = 0;
128
+
129
+     var extension = fileup.replace(/^.*\./, '');
130
+
131
+     if (extension == fileup) {
132
+         extension = "";
133
+     } else {
134
+         extension = extension.toLowerCase();
135
+     }
136
+
137
+     var validExtensions = ["pdf", "doc", "docx", "tif", "tiff", "jpg", "jpeg", "odt", "txt", "html", "png"];
138
+
139
+     if ($.inArray(extension, validExtensions) != -1) {
140
+
141
+       if (duplicatescheck == 0) {
142
+
143
+         if (currentflsize < 20971520) {
144
+
145
+            if (n < 21) {
146
+
147
+               uploadedtofax.push(fileuptrim);
148
+
149
+               $.ajax({
150
+                 url: baseUrl + '/' + userid,
151
+                 type: "POST",
152
+                 data: formData,
153
+                 cache: false,
154
+                 processData: false,
155
+                 contentType: false,
156
+                 success: function(totalflsize) {
157
+
158
+                   $('#filessizetext').text(totalflsize);
159
+
160
+                   // Check if the total file size is over 20 MB
161
+                   var rectotfilesz = parseFloat(totalflsize.replace(" MB", ""));
162
+
163
+                   if (rectotfilesz > 20.00) {
164
+                       $('#filestotsize').css('color', '#ba3555');
165
+                       alert("Error ! You can't send files having a total size of more than 20 MB in one fax call ! Please consider removing files so that the total files size would drop to or below 20 MB");
166
+                       $('#submitfax').attr("disabled", true);
167
+                   } else {
168
+                       $('#submitfax').attr("disabled", false);
169
+                       $('#filestotsize').css('color', '#1eb16a');
170
+                     }
171
+
172
+
173
+                   $('#fileuploadednm').append("<div class='indgenflcls'><div id='"+n+"indfilediv' class='indivflcls'>" + n + ") " + fileuptrim + "</div><div class='indupfldl'>X</div></div>");
174
+                   n++;
175
+
176
+                   // Preview the file when you click on its name
177
+                   $("div:visible[id*='indfilediv']").each(function() {
178
+                        $(this).on("click", function(eventclck) {
179
+                           var faxfilenameinit = $(this).text();
180
+                           var faxfilenamesec = faxfilenameinit.substring(faxfilenameinit.indexOf(" ") + 1);
181
+                           var faxfilename = faxfilenamesec.replace("X","");
182
+                           var baseUrl = firstPathEl+"/remote.php/webdav/Pax_Fax/temp_files/"+faxfilename;
183
+                           var extenlst = faxfilename.replace(/^.*\./, '');
184
+
185
+                           if (extenlst == faxfilename) {
186
+                               extenlst = "";
187
+                           } else {
188
+                               extenlst = extenlst.toLowerCase();
189
+                           }
190
+
191
+                           if (extenlst == 'pdf') {
192
+                                  var viewerclick = OC.generateUrl('/apps/files_pdfviewer/?file={file}', {file: baseUrl});
193
+                                  var $iframe = $('<iframe id="docclickview" style="width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:1041;" src="' + viewerclick + '" sandbox="allow-scripts allow-same-origin allow-popups allow-modals"></iframe>');
194
+                                  $("#faxdocpreview").empty();
195
+                                  $("#faxdocpreview").append($iframe);
196
+                           } else if (extenlst == 'txt') {
197
+                                  $("#faxdocpreview").empty();
198
+                                  $("#faxdocpreview").append(readtxtfile[faxfilename]);
199
+                           } else if (extenlst == 'html') {
200
+                                  $("#faxdocpreview").empty();
201
+                                  $("#faxdocpreview").append(readhtmlfile[faxfilename]);
202
+                           } else if (extenlst == 'jpg' || extenlst == 'jpeg') {
203
+                                  $("#faxdocpreview").empty();
204
+                                  $("#faxdocpreview").append('<img style="width:100%;height:100%" id="uploadedjpg" src="#" />');
205
+                                  $("#uploadedjpg").attr('src', readjpg[faxfilename]);
206
+                           } else if (extenlst == 'png') {
207
+                                  $("#faxdocpreview").empty();
208
+                                  $("#faxdocpreview").append('<img style="width:100%;height:100%" id="uploadedpng" src="#" />');
209
+                                  $("#uploadedpng").attr('src', readpng[faxfilename]);
210
+                           } else if (extenlst == 'odt') {
211
+                                  $("#faxdocpreview").empty();
212
+                                  function odfInit() {
213
+                                     var odfelement = document.getElementById("faxdocpreview");
214
+                                     odfcanvas = new odf.OdfCanvas(odfelement);
215
+                                     odfcanvas.load(baseUrl);
216
+                                  }
217
+                                  window.setTimeout(odfInit, 0);
218
+                           } else if (extenlst == 'tif' || extenlst == 'tiff') {
219
+                                  var tiffile = '/remote.php/webdav/Pax_Fax/temp_files/'+faxfilename;
220
+                                  var xhr = new XMLHttpRequest();
221
+                                  xhr.responseType = 'arraybuffer';
222
+                                  xhr.open('GET', tiffile);
223
+                                  xhr.onload = function (evnt) {
224
+                                      var tiff = new Tiff({buffer: xhr.response});
225
+                                      var tifcanvas = tiff.toCanvas();
226
+                                      $("#faxdocpreview").empty();
227
+                                      $("#faxdocpreview").append(tifcanvas);
228
+                                  };
229
+                                  xhr.send();
230
+                           }
231
+
232
+                           $("#faxdocpreview").show();
233
+                           $("#faxfoldersview").hide();
234
+                        });
235
+                   });
236
+
237
+                   // Remove uploaded files
238
+                   $('[class*="indupfldl"]').last().click(function() {
239
+
240
+                           var userid = "<?php p($userId); ?>";
241
+                           var baseUrl = OC.generateUrl("/apps/pax_fax/user/removeupfile");
242
+
243
+                           var removedfilenameinit = $(this).closest('[class*="indgenflcls"]').find('[class*="indivflcls"]').text();
244
+
245
+                           var removedfilesplit = removedfilenameinit.split(") ");
246
+                           var removedflnb = parseInt(removedfilesplit[0]);
247
+
248
+                           $(this).closest('[class*="indgenflcls"]').find('[class*="indivflcls"]').hide();
249
+                           $(this).hide();
250
+
251
+                           var removedfilename = removedfilenameinit.substring(removedfilenameinit.indexOf(" ") + 1);
252
+
253
+                           uploadedtofax = $.grep(uploadedtofax, function(value) {
254
+                                           return value != removedfilename;
255
+                           });
256
+
257
+                           $.ajax({
258
+                                   url: baseUrl + '/' + userid,
259
+                                   type: "POST",
260
+                                   data: {removedfilename: removedfilename},
261
+                                   success: function(totalflsize) {
262
+
263
+                                      $('#filessizetext').text(totalflsize);
264
+
265
+                                      // Check file size
266
+                                      var rectotfilesz = parseFloat(totalflsize.replace(" MB", ""));
267
+
268
+                                      if (rectotfilesz > 20.00) {
269
+                                          $('#filestotsize').css('color', '#ba3555');
270
+                                             alert("Error ! You can't send files having a total size of more than 20 MB in one fax call ! Please consider removing files so that the total files size would drop to or below 20 MB");
271
+                                          $('#submitfax').attr("disabled", true);
272
+                                      } else {
273
+                                          $('#submitfax').attr("disabled", false);
274
+                                          $('#filestotsize').css('color', '#1eb16a');
275
+                                        }
276
+
277
+                                      // Rewrite order numbers for files that follow
278
+                                      --n;
279
+                                      $("div:visible[id*='indfilediv']").each(function() {
280
+
281
+                                          var getdivtext =  $(this).text();
282
+                                          var splitdivtext = getdivtext.split(") ");
283
+                                          var currentnbvalue = parseInt(splitdivtext[0]);
284
+                                          var newnbvalue = currentnbvalue - 1;
285
+
286
+                                          if (currentnbvalue > removedflnb) {
287
+                                              var replacedstr = newnbvalue + ") " + splitdivtext[1];
288
+                                              $(this).text(replacedstr);
289
+                                          }
290
+                                      });
291
+
292
+                                      $("div:visible[id*='indflpicked']").each(function() {
293
+
294
+                                          var getdivtext =  $(this).text();
295
+                                          var splitdivtext = getdivtext.split(") ");
296
+                                          var currentnbvalue = parseInt(splitdivtext[0]);
297
+                                          var newnbvalue = currentnbvalue - 1;
298
+
299
+                                          if (currentnbvalue > removedflnb) {
300
+                                              var replacedstr = newnbvalue + ") " + splitdivtext[1];
301
+                                              $(this).text(replacedstr);
302
+                                          }
303
+                                      });
304
+
305
+                                   },
306
+                                   error: function() {
307
+                                          alert('Error !');
308
+                                   }
309
+                           });
310
+
311
+                           $('#faxdocpreview').removeClass('icon-loading');
312
+                           $("#faxdocpreview").empty();
313
+                   });
314
+
315
+                   // Preview the uploaded file
316
+                   var faxfilename = e.target.files[0].name;
317
+                   var baseUrl = firstPathEl+"/remote.php/webdav/Pax_Fax/temp_files/"+faxfilename;
318
+
319
+                   if (extension == 'pdf') {
320
+                              var viewer = OC.generateUrl('/apps/files_pdfviewer/?file={file}', {file: baseUrl});
321
+                              var $iframe = $('<iframe id="docviewer" style="width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:1041;" src="' + viewer + '" sandbox="allow-scripts allow-same-origin allow-popups allow-modals"></iframe>');
322
+                              $("#faxdocpreview").empty();
323
+                              $("#faxdocpreview").append($iframe);
324
+                   } else if (extension == 'txt') {
325
+                              var reader = new FileReader();
326
+                              reader.readAsText(e.target.files[0]);
327
+                              reader.onload = function(e) {
328
+                                  readtxtfile[faxfilename] = e.target.result.replace(/(?:\r\n|\r|\n)/g, '<br>');
329
+                                  $("#faxdocpreview").empty();
330
+                                  $("#faxdocpreview").append(readtxtfile[faxfilename]);
331
+                              };
332
+                   } else if (extension == 'html') {
333
+                              var reader = new FileReader();
334
+                              reader.readAsText(e.target.files[0]);
335
+                              reader.onload = function(e) {
336
+                                  readhtmlfile[faxfilename] = e.target.result.replace(/(?:\r\n|\r|\n)/g, '<br>');
337
+                                  $("#faxdocpreview").empty();
338
+                                  $("#faxdocpreview").append(readhtmlfile[faxfilename]);
339
+                              };
340
+                   } else if (extension == 'jpg' || extension == 'jpeg') {
341
+                              $("#faxdocpreview").empty();
342
+                              $("#faxdocpreview").append('<img style="width:100%;height:100%" id="uploadedjpg" src="#" />');
343
+
344
+                              var reader = new FileReader();
345
+                              reader.onload = function (e) {
346
+                                  readjpg[faxfilename] = e.target.result;
347
+                                  $("#uploadedjpg").attr('src', readjpg[faxfilename]);
348
+                              }
349
+                              reader.readAsDataURL(e.target.files[0]);
350
+                   } else if (extension == 'png') {
351
+                              $("#faxdocpreview").empty();
352
+                              $("#faxdocpreview").append('<img style="width:100%;height:100%" id="uploadedpng" src="#" />');
353
+
354
+                              var reader = new FileReader();
355
+                              reader.onload = function (e) {
356
+                                  readpng[faxfilename] = e.target.result;
357
+                                  $("#uploadedpng").attr('src', readpng[faxfilename]);
358
+                              }
359
+                              reader.readAsDataURL(e.target.files[0]);
360
+                   } else if (extension == 'odt') {
361
+                              $("#faxdocpreview").empty();
362
+                              function odfInit() {
363
+                                 var odfelement = document.getElementById("faxdocpreview");
364
+                                 odfcanvas = new odf.OdfCanvas(odfelement);
365
+                                 odfcanvas.load(baseUrl);
366
+                              }
367
+                              window.setTimeout(odfInit, 0);
368
+                   } else if (extension == 'tif' || extension == 'tiff') {
369
+                              var tiffile = '/remote.php/webdav/Pax_Fax/temp_files/'+faxfilename;
370
+                              var xhr = new XMLHttpRequest();
371
+                              xhr.responseType = 'arraybuffer';
372
+                              xhr.open('GET', tiffile);
373
+                              xhr.onload = function (e) {
374
+                                  var tiff = new Tiff({buffer: xhr.response});
375
+                                  var tifcanvas = tiff.toCanvas();
376
+                                  $("#faxdocpreview").empty();
377
+                                  $("#faxdocpreview").append(tifcanvas);
378
+                              };
379
+                              xhr.send();
380
+                   }
381
+
382
+                   $("#faxdocpreview").show();
383
+                   $('#pf_upload_msg').hide();
384
+                   $('#faxdocpreview').removeClass('icon-loading');
385
+                   $("#faxfoldersview").hide();
386
+                 },
387
+                 error: function(data){
388
+                     alert('Error!');
389
+                 }
390
+               });
391
+
392
+            } else {
393
+                  alert("Error ! You can't send as fax more than 20 files in one fax call !");
394
+                  $('#pf_upload_msg').hide();
395
+                  $('#faxdocpreview').removeClass('icon-loading');
396
+              }
397
+         } else {
398
+              alert("Error ! You can't send files having a total size of more than 20 MB in one fax call !");
399
+              $('#pf_upload_msg').hide();
400
+              $('#faxdocpreview').removeClass('icon-loading');
401
+           }
402
+       } else {
403
+            alert("Error ! There is already a file named '"+fileuptrim+"' in the 'Pax_Fax/temp_files' folder !");
404
+            $('#pf_upload_msg').hide();
405
+            $('#faxdocpreview').removeClass('icon-loading');
406
+         }
407
+
408
+     } else {
409
+          alert('The file type is not supported ! Supported formats are: pdf, doc, docx, tiff/tif, jpeg/jpg, odt, txt, html, png.');
410
+          $('#pf_upload_msg').hide();
411
+          $('#faxdocpreview').removeClass('icon-loading');
412
+       }
413
+  });
414
+
415
+
416
+  // Pick file to fax, from Nextcloud
417
+  var faxfilename = null;
418
+
419
+  $("#choosefilen").on("click", function(evn) {
420
+
421
+                OC.dialogs.filepicker(
422
+                        t('settings', "Select a file to send as fax."),
423
+                        function (path) {
424
+
425
+                              OC.msg.startAction("#pf_choose_msg", t("pax_fax", "Please wait ..."));
426
+                              $('#faxdocpreview').addClass('icon-loading');
427
+                              $('#filestotsize').show();
428
+
429
+                              var userid = "<?php p($userId); ?>";
430
+                              var baseUrl = OC.generateUrl("/apps/pax_fax/user/pickfile");
431
+
432
+                              faxfilename = path.split('/').pop();
433
+
434
+                              if ($.inArray(faxfilename, uploadedtofax) != -1) {
435
+                                  var duplicatescheck = 1;
436
+                              } else var duplicatescheck = 0;
437
+
438
+                              var extension = faxfilename.replace(/^.*\./, '');
439
+
440
+                              if (extension == faxfilename) {
441
+                                  extension = "";
442
+                              } else {
443
+                                  extension = extension.toLowerCase();
444
+                              }
445
+
446
+                              var validExtensions = ["pdf", "doc", "docx", "tif", "tiff", "jpg", "jpeg", "odt", "txt", "html", "png"];
447
+
448
+                              if ($.inArray(extension, validExtensions) != -1) {
449
+
450
+                                 if (duplicatescheck == 0) {
451
+
452
+                                    if (n < 21) {
453
+
454
+                                       uploadedtofax.push(faxfilename);
455
+
456
+                                       $.ajax({
457
+                                          url: baseUrl + '/' + userid,
458
+                                          type: "POST",
459
+                                          data: {path: path},
460
+                                          success: function(totalflsize) {
461
+
462
+                                                $('#filessizetext').text(totalflsize);
463
+
464
+                                                // Check if the total file size is over 20 MB
465
+                                                var rectotfilesz = parseFloat(totalflsize.replace(" MB", ""));
466
+
467
+                                                if (rectotfilesz > 20.00) {
468
+                                                    $('#filestotsize').css('color', '#ba3555');
469
+                                                    alert("Error ! You can't send files having a total size of more than 20 MB in one fax call ! Please consider removing files so that the total files size would drop to or below 20 MB");
470
+                                                    $('#submitfax').attr("disabled", true);
471
+                                                } else {
472
+                                                    $('#submitfax').attr("disabled", false);
473
+                                                    $('#filestotsize').css('color', '#1eb16a');
474
+                                                }
475
+
476
+                                                $('#filespickednc').append("<div class='indgenpckfls'><div id='"+n+"indflpicked' class='indivflpckd'>" + n + ") " + faxfilename + "</div><div class='indpckfldl'>X</div></div>");
477
+                                                n++;
478
+
479
+                                                // Preview each file when you click on its name
480
+                                                $("div:visible[id*='indflpicked']").each(function() {
481
+                                                   $(this).on("click", function(event) {
482
+                                                      var faxfilenameinit = $(this).text();
483
+                                                      var faxfilenamesec = faxfilenameinit.substring(faxfilenameinit.indexOf(" ") + 1);
484
+                                                      var faxfilenamesp = faxfilenamesec.replace("X","");
485
+                                                      var baseUrl = firstPathEl+"/remote.php/webdav/Pax_Fax/temp_files/"+faxfilenamesp;
486
+                                                      var extenlst = faxfilenamesp.replace(/^.*\./, '');
487
+
488
+                                                      if (extenlst == faxfilenamesp) {
489
+                                                           extenlst = "";
490
+                                                      } else {
491
+                                                           extenlst = extenlst.toLowerCase();
492
+                                                      }
493
+
494
+                                                      if (extenlst == 'pdf') {
495
+                                                           var viewerclick = OC.generateUrl('/apps/files_pdfviewer/?file={file}', {file: baseUrl});
496
+                                                           var $iframe = $('<iframe id="docclickview" style="width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:1041;" src="' + viewerclick + '" sandbox="allow-scripts allow-same-origin allow-popups allow-modals"></iframe>');
497
+                                                           $("#faxdocpreview").empty();
498
+                                                           $("#faxdocpreview").append($iframe);
499
+                                                      } else if (extenlst == 'txt') {
500
+                                                              $("#faxdocpreview").empty();
501
+                                                              $("#faxdocpreview").append(readtxtfile[faxfilenamesp]);
502
+                                                      } else if (extenlst == 'html') {
503
+                                                              $("#faxdocpreview").empty();
504
+                                                              $("#faxdocpreview").append(readhtmlfile[faxfilenamesp]);
505
+                                                      } else if (extenlst == 'jpg' || extenlst == 'jpeg') {
506
+                                                              $("#faxdocpreview").empty();
507
+                                                              $("#faxdocpreview").append('<img style="width:auto;height:auto" id="uploadedjpg" src="'+ baseUrl +'" />');
508
+//                                                              $("#uploadedjpg").attr('src', readjpg[faxfilenamesp]);
509
+                                                      } else if (extenlst == 'png') {
510
+                                                              $("#faxdocpreview").empty();
511
+                                                              $("#faxdocpreview").append('<img style="width:auto;height:auto" id="uploadedpng" src="'+ baseUrl +'" />');
512
+//                                                              $("#uploadedpng").attr('src', readpng[faxfilenamesp]);
513
+                                                      } else if (extenlst == 'odt') {
514
+                                                              $("#faxdocpreview").empty();
515
+                                                              function odfInit() {
516
+                                                                 var odfelement = document.getElementById("faxdocpreview");
517
+                                                                 odfcanvas = new odf.OdfCanvas(odfelement);
518
+                                                                 odfcanvas.load(baseUrl);
519
+                                                              }
520
+                                                              window.setTimeout(odfInit, 0);
521
+                                                      } else if (extenlst == 'tif' || extenlst == 'tiff') {
522
+                                                              var tiffile = '/remote.php/webdav/Pax_Fax/temp_files/'+faxfilenamesp;
523
+                                                              var xhr = new XMLHttpRequest();
524
+                                                              xhr.responseType = 'arraybuffer';
525
+                                                              xhr.open('GET', tiffile);
526
+                                                              xhr.onload = function (evnt) {
527
+                                                                  var tiff = new Tiff({buffer: xhr.response});
528
+                                                                  var tifcanvas = tiff.toCanvas();
529
+                                                                  $("#faxdocpreview").empty();
530
+                                                                  $("#faxdocpreview").append(tifcanvas);
531
+                                                              };
532
+                                                              xhr.send();
533
+                                                      }
534
+
535
+                                                      $("#faxdocpreview").show();
536
+                                                      $("#faxfoldersview").hide();
537
+                                                   });
538
+                                                });
539
+
540
+                                                // Remove picked files
541
+                                                $('[class*="indpckfldl"]').last().click(function() {
542
+                                                    var userid = "<?php p($userId); ?>";
543
+                                                    var baseUrl = OC.generateUrl("/apps/pax_fax/user/removeupfile");
544
+
545
+                                                    var removedfilenameinit = $(this).closest('[class*="indgenpckfls"]').find('[class*="indivflpckd"]').text();
546
+
547
+                                                    var removedfilesplit = removedfilenameinit.split(") ");
548
+                                                    var removedflnb = parseInt(removedfilesplit[0]);
549
+
550
+                                                    $(this).closest('[class*="indgenpckfls"]').find('[class*="indivflpckd"]').hide();
551
+                                                    $(this).hide();
552
+                                                    var removedfilename = removedfilenameinit.substring(removedfilenameinit.indexOf(" ") + 1);
553
+
554
+                                                    uploadedtofax = $.grep(uploadedtofax, function(value) {
555
+                                                             return value != removedfilename;
556
+                                                    });
557
+
558
+                                                    $.ajax({
559
+                                                        url: baseUrl + '/' + userid,
560
+                                                        type: "POST",
561
+                                                        data: {removedfilename: removedfilename},
562
+                                                        success: function(totalflsize) {
563
+
564
+                                                             $('#filessizetext').text(totalflsize);
565
+
566
+                                                             // Check file size
567
+                                                             var rectotfilesz = parseFloat(totalflsize.replace(" MB", ""));
568
+
569
+                                                             if (rectotfilesz > 20.00) {
570
+                                                                 $('#filestotsize').css('color', '#ba3555');
571
+                                                                 alert("Error ! You can't send files having a total size of more than 20 MB in one fax call ! Please consider removing files so that the total files size would drop at or below 20 MB");
572
+                                                                 $('#submitfax').attr("disabled", true);
573
+                                                             } else {
574
+                                                                 $('#submitfax').attr("disabled", false);
575
+                                                                 $('#filestotsize').css('color', '#1eb16a');
576
+                                                               }
577
+
578
+                                                             // Rewrite order numbers for files that follow
579
+                                                             --n;
580
+                                                             $("div:visible[id*='indflpicked']").each(function() {
581
+
582
+                                                                  var getdivtext =  $(this).text();
583
+                                                                  var splitdivtext = getdivtext.split(") ");
584
+                                                                  var currentnbvalue = parseInt(splitdivtext[0]);
585
+                                                                  var newnbvalue = currentnbvalue - 1;
586
+
587
+                                                                  if (currentnbvalue > removedflnb) {
588
+                                                                      var replacedstr = newnbvalue + ") " + splitdivtext[1];
589
+                                                                      $(this).text(replacedstr);
590
+                                                                  }
591
+                                                             });
592
+                                                        },
593
+                                                        error: function() {
594
+                                                             alert('Error !');
595
+                                                        }
596
+                                                    });
597
+
598
+                                                    $('#faxdocpreview').removeClass('icon-loading');
599
+                                                    $("#faxdocpreview").empty();
600
+                                                });
601
+
602
+
603
+		                                // Preview the picked file
604
+		                                var flUrl = firstPathEl+"/remote.php/webdav/Pax_Fax/temp_files/"+faxfilename;
605
+		                                var pickUrl = OC.generateUrl("/apps/pax_fax/user/getpickedfile");
606
+
607
+		                                if (extension == 'pdf') {
608
+		                                    var viewer = OC.generateUrl('/apps/files_pdfviewer/?file={file}', {file: flUrl});
609
+		                                    var $iframe = $('<iframe id="docviewer" style="width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:1041;" src="' + viewer + '" sandbox="allow-scripts allow-same-origin allow-popups allow-modals"></iframe>');
610
+		                                    $("#faxdocpreview").empty();
611
+		                                    $("#faxdocpreview").append($iframe);
612
+		                                } else if (extension == 'txt') {
613
+						           $.get(flUrl, function(textdata) {
614
+		                                             readtxtfile[faxfilename] = textdata.replace(/(?:\r\n|\r|\n)/g, '<br>');
615
+		                                             $("#faxdocpreview").empty();
616
+		                                             $("#faxdocpreview").append(readtxtfile[faxfilename]);
617
+							   });
618
+		                                } else if (extension == 'html') {
619
+							   $.get(flUrl, function(htmldata) {
620
+		                                             readhtmlfile[faxfilename] = htmldata.replace(/(?:\r\n|\r|\n)/g, '<br>');
621
+		                                             $("#faxdocpreview").empty();
622
+		                                             $("#faxdocpreview").append(readhtmlfile[faxfilename]);
623
+							   });
624
+		                                } else if (extension == 'jpg' || extension == 'jpeg') {
625
+		                                           $("#faxdocpreview").empty();
626
+		                                           $("#faxdocpreview").append('<img style="width:auto;height:auto" id="uploadedjpg" src="'+ flUrl +'" />');
627
+		                                } else if (extension == 'png') {
628
+		                                           $("#faxdocpreview").empty();
629
+		                                           $("#faxdocpreview").append('<img style="width:auto;height:auto" id="uploadedpng" src="'+ flUrl +'" />');
630
+                                                           $("#uploadedpng").attr('src', readpng[faxfilename]);
631
+		                                } else if (extension == 'odt') {
632
+		                                       $("#faxdocpreview").empty();
633
+		                                       function odfInit() {
634
+		                                           var odfelement = document.getElementById("faxdocpreview");
635
+		                                           odfcanvas = new odf.OdfCanvas(odfelement);
636
+		                                           odfcanvas.load(flUrl);
637
+		                                       }
638
+		                                       window.setTimeout(odfInit, 0);
639
+
640
+		                                } else if (extension == 'tif' || extension == 'tiff') {
641
+		                                       var tiffile = '/remote.php/webdav/Pax_Fax/temp_files/'+faxfilename;
642
+		                                       var xhr = new XMLHttpRequest();
643
+		                                       xhr.responseType = 'arraybuffer';
644
+		                                       xhr.open('GET', tiffile);
645
+		                                       xhr.onload = function (event) {
646
+		                                           var tiff = new Tiff({buffer: xhr.response});
647
+		                                           var tifcanvas = tiff.toCanvas();
648
+		                                           $("#faxdocpreview").empty();
649
+		                                           $("#faxdocpreview").append(tifcanvas);
650
+		                                       };
651
+		                                       xhr.send();
652
+		                                }
653
+
654
+		                                $("#faxdocpreview").show();
655
+
656
+		                                $('#pf_choose_msg').hide();
657
+		                                $('#faxdocpreview').removeClass('icon-loading');
658
+		                                $("#faxfoldersview").hide();
659
+
660
+                                          },
661
+
662
+                                          error: function(data){
663
+                                             alert('Error!');
664
+                                          }
665
+
666
+                                       });
667
+
668
+                                    } else {
669
+                                        alert("Error ! You can't fax more than 20 files in one fax call !");
670
+                                        $('#pf_choose_msg').hide();
671
+                                        $('#faxdocpreview').removeClass('icon-loading');
672
+                                      }
673
+                                 } else {
674
+                                      alert("Error ! There is already a file named '"+faxfilename+"' in the 'Pax_Fax/temp_files' folder !");
675
+                                      $('#pf_choose_msg').hide();
676
+                                      $('#faxdocpreview').removeClass('icon-loading');
677
+                                   }
678
+
679
+                              } else {
680
+                                   alert('The file type is not supported ! Supported formats are: pdf, doc, docx, tiff/tif, jpeg/jpg, odt, txt, html, png.');
681
+                                   $('#pf_choose_msg').hide();
682
+                                   $('#faxdocpreview').removeClass('icon-loading');
683
+                                }
684
+
685
+                        }
686
+                );
687
+  });
688
+
689
+
690
+  // Submit the fax
691
+  $("#submitfax").on("click", function(event){
692
+
693
+     var selectedcid = $('#currentfaxnmbrs :selected').text();
694
+
695
+     var toNumberinit = $('#faxto').val();
696
+     var toNumbersec = toNumberinit.replace(/[^0-9,]/g, "");
697
+     var toNumber = toNumbersec.split(",");
698
+
699
+     for(var v = 0; v < toNumber.length; v++) {
700
+         toNumber[v] = "+" + toNumber[v];
701
+     }
702
+
703
+     OC.msg.startAction("#pf_submit_msg", t("pax_fax", "Sending fax ... Please wait !"));
704
+     $('#faxdocpreview').addClass('icon-loading');
705
+
706
+     var userid = "<?php p($userId); ?>";
707
+     var baseUrl = OC.generateUrl("/apps/pax_fax/user/sendfax");
708
+
709
+     var toNumberwc = toNumberinit.replace(/[^0-9]/g, "");
710
+
711
+         if (uploadedtofax.length != 0) {
712
+
713
+           if (toNumberwc != '') {
714
+
715
+             $.ajax({
716
+                url: baseUrl + '/' + userid,
717
+                type: "POST",
718
+                data: {uploadedtofax: uploadedtofax,
719
+                       selectedcid: selectedcid,
720
+                       toNumber: toNumber
721
+                      },
722
+                success: function(phaxioresult) {
723
+
724
+                   if (phaxioresult.success == true) {
725
+                       alert("The fax has been sent successfully ! You can see the sent fax by clicking on the 'Sent Faxes' button.");
726
+                   } else {
727
+                       alert("Error ! The fax couldn't be sent because of the following error: "+phaxioresult.errortype+" You can see the failed fax by clicking on the 'Failed Sent Faxes' button.");
728
+                   }
729
+
730
+                   $("div:visible[id*='indfilediv']").hide();
731
+                   $("div:visible[id*='indflpicked']").hide();
732
+                   $('[class*="indupfldl"]').hide();
733
+                   $('[class*="indpckfldl"]').hide();
734
+
735
+                   $('#faxdocpreview').hide();
736
+
737
+                   $('#filestotsize').hide();
738
+                   $('#submitfax').attr("disabled", true);
739
+                   $("#receivedfaxdir").attr("disabled", true);
740
+                   $("#sentfaxdir").attr("disabled", true);
741
+                   $("#receivedfaileddir").attr("disabled", true);
742
+                   $("#sentfaileddir").attr("disabled", true);
743
+
744
+                   location.reload(true);
745
+
746
+                },
747
+
748
+                error: function(phaxioresult) {
749
+
750
+                   alert('Error ! Please check your settings !');
751
+
752
+                   $("div:visible[id*='indfilediv']").hide();
753
+                   $("div:visible[id*='indflpicked']").hide();
754
+                   $('[class*="indupfldl"]').hide();
755
+                   $('[class*="indpckfldl"]').hide();
756
+
757
+                   $('#pf_submit_msg').hide();
758
+                   $('#filestotsize').hide();
759
+                   $('#faxdocpreview').hide();
760
+                   $('#submitfax').attr("disabled", true);
761
+
762
+
763
+                   $("#receivedfaxdir").attr("disabled", true);
764
+                   $("#sentfaxdir").attr("disabled", true);
765
+                   $("#receivedfaileddir").attr("disabled", true);
766
+                   $("#sentfaileddir").attr("disabled", true);
767
+
768
+                          location.reload(true);
769
+                }
770
+             });
771
+           } else {
772
+              $('#pf_submit_msg').hide();
773
+              $('#faxdocpreview').removeClass('icon-loading');
774
+              alert("Please enter the fax number of the recipient !");
775
+             }
776
+         } else {
777
+              $('#pf_submit_msg').hide();
778
+              $('#faxdocpreview').removeClass('icon-loading');
779
+              alert("Please upload a file or pick a file from Nextcloud to send as fax !");
780
+           }
781
+  });
782
+
783
+  $("#receivedfaxdir").on("click", function(event){
784
+     $("#faxdocpreview").hide();
785
+     $("#faxfoldersview").show();
786
+     $("#faxfoldersview").addClass("icon-loading");
787
+     $("#faxfoldersview :last-child").remove();
788
+     var fxreceived = OC.generateUrl("/apps/files/?dir=/Pax_Fax/faxes_received");
789
+     $("#faxfoldersview").append("<iframe id='embeddedView' src='" + fxreceived + "' width='100%' height='100%'></iframe>");
790
+     setTimeout(function() { $("#faxfoldersview").removeClass("icon-loading"); }, 1000);
791
+  });
792
+
793
+  $("#sentfaxdir").on("click", function(event){
794
+     $("#faxdocpreview").hide();
795
+     $("#faxfoldersview").show();
796
+     $("#faxfoldersview").addClass("icon-loading");
797
+     $("#faxfoldersview :last-child").remove();
798
+     var fxsent = OC.generateUrl("/apps/files/?dir=/Pax_Fax/faxes_sent");
799
+     $("#faxfoldersview").append("<iframe id='embeddedView' src='" + fxsent + "' width='100%' height='100%'></iframe>");
800
+     setTimeout(function() { $("#faxfoldersview").removeClass("icon-loading"); }, 1000);
801
+  });
802
+
803
+  $("#receivedfaileddir").on("click", function(event){
804
+     $("#faxdocpreview").hide();
805
+     $("#faxfoldersview").show();
806
+     $("#faxfoldersview").addClass("icon-loading");
807
+     $("#faxfoldersview :last-child").remove();
808
+     var fxrecfailed = OC.generateUrl("/apps/files/?dir=/Pax_Fax/faxes_received_failed");
809
+     $("#faxfoldersview").append("<iframe id='embeddedView' src='" + fxrecfailed + "' width='100%' height='100%'></iframe>");
810
+     setTimeout(function() { $("#faxfoldersview").removeClass("icon-loading"); }, 1000);
811
+  });
812
+
813
+  $("#sentfaileddir").on("click", function(event){
814
+     $("#faxdocpreview").hide();
815
+     $("#faxfoldersview").show();
816
+     $("#faxfoldersview").addClass("icon-loading");
817
+     $("#faxfoldersview :last-child").remove();
818
+     var fxsentfailed = OC.generateUrl("/apps/files/?dir=/Pax_Fax/faxes_received_failed");
819
+     $("#faxfoldersview").append("<iframe id='embeddedView' src='" + fxsentfailed + "' width='100%' height='100%'></iframe>");
820
+     setTimeout(function() { $("#faxfoldersview").removeClass("icon-loading"); }, 1000);
821
+  });
822
+
823
+  $(".indivflpckd").click(function(event){
824
+     $("#faxfoldersview").hide();
825
+  });
826
+
827
+  $(".indivflcls").on("click", function(event){
828
+     $("#faxfoldersview").hide();
829
+  });
830
+
831
+});
0 832
new file mode 100644
... ...
@@ -0,0 +1,295 @@
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\PaxFax\Controller;
27
+
28
+use OCP\AppFramework\ApiController;
29
+use OCP\IRequest;
30
+use OCP\AppFramework\Http\DataResponse;
31
+use OCP\AppFramework\OCSController;
32
+use OCP\IUserSession;
33
+use OCP\AppFramework\Controller;
34
+use OCP\Files\IAppData;
35
+use OCA\PaxFax\Service\PaxfaxService;
36
+use OCP\AppFramework\App;
37
+use OCP\Files\NotPermittedException;
38
+use OCP\Files\Folder;
39
+use OC\Files\Filesystem;
40
+use OC\Files\View;
41
+use \ReflectionClass;
42
+use OCP\Notification;
43
+use OCP\Notification\INotification;
44
+use OCP\Notification\IManager;
45
+use OCP\Notification\IAction;
46
+use \DateTime;
47
+
48
+use Phaxio;
49
+use Phaxio\OperationResult;
50
+use Phaxio\Error\AuthenticationException;
51
+use Phaxio\Error\NotFoundException;
52
+use Phaxio\Error\InvalidRequestException;
53
+use Phaxio\Error\RateLimitException;
54
+use Phaxio\Error\APIConnectionException;
55
+use Phaxio\Error\GeneralException;
56
+
57
+
58
+class AuthorApiController extends ApiController {
59
+
60
+    private $service;
61
+    private $userId;
62
+    private $folder;
63
+    private $filesystem;
64
+    private $view;
65
+    private $userSession;
66
+
67
+    public function __construct($appName, IRequest $request, IUserSession $userSession, PaxfaxService $service, Folder $folder, Filesystem $filesystem, $userId, View $view) {
68
+        parent::__construct(
69
+                $appName,
70
+                $request,
71
+                'PUT, POST, GET, DELETE, PATCH',
72
+                'Authorization, Content-Type, Accept',
73
+                1728000);
74
+
75
+        $this->service = $service;
76
+        $this->userId = $userId;
77
+        $this->folder = $folder;
78
+        $this->filesystem = $filesystem;
79
+        $this->view = $view;
80
+        $this->userSession = $userSession;
81
+    }
82
+
83
+    /**
84
+     * @NoAdminRequired
85
+     */
86
+    public function object_to_array($obj) {
87
+        if(is_object($obj)) $obj = (array)$this->dismount($obj);
88
+        if(is_array($obj)) {
89
+           $new = array();
90
+           foreach($obj as $key => $val) {
91
+               $new[$key] = $this->object_to_array($val);
92
+           }
93
+        }
94
+        else $new = $obj;
95
+        return $new;
96
+    }
97
+
98
+    /**
99
+     * @NoAdminRequired
100
+     */
101
+    public function dismount($object) {
102
+        $reflectionClass = new ReflectionClass(get_class($object));
103
+        $array = array();
104
+        foreach ($reflectionClass->getProperties() as $property) {
105
+           $property->setAccessible(true);
106
+           $array[$property->getName()] = $property->getValue($object);
107
+           $property->setAccessible(false);
108
+        }
109
+        return $array;
110
+    }
111
+
112
+    /**
113
+     * @NoAdminRequired
114
+     */
115
+    public function isValidCallbackRequest($token, $url = null, $postParameters = null, $uploadedFiles = null, $signature = null) {
116
+
117
+	if (!$url) {
118
+	    $url = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
119
+	}
120
+
121
+	if (!$postParameters) {
122
+	    $postParameters = $_REQUEST;
123
+	}
124
+
125
+	if (!$uploadedFiles) {
126
+	    $uploadedFiles = $_FILES;
127
+	}
128
+
129
+	if (!$signature) {
130
+	    $signature = $_SERVER['HTTP_X_PHAXIO_SIGNATURE'];
131
+	}
132
+
133
+	// Sort the array by keys
134
+	ksort($postParameters);
135
+
136
+	// Append the data array to the url string, with no delimiters
137
+	foreach ($postParameters as $key => $value) {
138
+		 $url .= $key . $value;
139
+	}
140
+
141
+	foreach ($uploadedFiles as $key => $value) {
142
+		 $url .= $key . sha1_file($value['tmp_name']);
143
+	}
144
+
145
+	$hmac = hash_hmac("sha1", $url, $token);
146
+	return $signature == $hmac;
147
+    }
148
+
149
+    /**
150
+     * @NoAdminRequired
151
+     * @NoCSRFRequired
152
+     */
153
+    public function receivefaxphaxio() {
154
+
155
+       $phaxiosignature = $_SERVER['HTTP_X_PHAXIO_SIGNATURE'];
156
+
157
+       $thisapicred = $this->service->getapicredentials($this->userId);
158
+       $phaxiowhtoken = $thisapicred[2];
159
+       $phaxiorecURL = $thisapicred[3];
160
+
161
+       // Verify Phaxio's signature
162
+       $signverify = $this->isValidCallbackRequest($phaxiowhtoken, $phaxiorecURL, null, null, $phaxiosignature);
163
+
164
+       if ($signverify) {
165
+
166
+           $fileContent = file_get_contents($_FILES['file']['tmp_name']);
167
+           $fileNameinit = $_FILES['file']['name'];
168
+
169
+           $fldate = date("Y-m-d_H-i-s_").gettimeofday()["usec"];
170
+
171
+           $gmtind = "UTC " . date('P');
172
+           $flmsdateinit = date("Y-m-d  H:i:s");
173
+           $flmsdate = $flmsdateinit . " " . $gmtind;
174
+
175
+           $fileNamesec = array_reverse(explode(".", $fileNameinit));
176
+           $filenameext = $fileNamesec[0];
177
+           array_shift($fileNamesec);
178
+
179
+           $fileName = implode("", $fileNamesec);
180
+
181
+           $faxid = str_replace("Fax-", "", $fileName);
182
+
183
+           $apiMode = 'live';
184
+
185
+           $apiKeys[$apiMode] = $thisapicred[0];
186
+           $apiSecrets[$apiMode] = $thisapicred[1];
187
+
188
+           $apiHost = 'https://api.phaxio.com/v2.1/';
189
+
190
+           $phaxio = new Phaxio($apiKeys[$apiMode], $apiSecrets[$apiMode], $apiHost);
191
+
192
+
193
+           try {
194
+                      $phaxioresultreq = $phaxio->doRequest("GET", 'faxes/' . $faxid);
195
+
196
+                      $fromnmbrtoarr = $this->object_to_array($phaxioresultreq);
197
+
198
+                      $phaxiofromraw = $fromnmbrtoarr['data']['from_number'];
199
+                      $phaxiotoraw  = $fromnmbrtoarr['data']['to_number'];
200
+                      $phaxiofromnumber = str_replace("+", "", $phaxiofromraw);
201
+                      $phaxiotonumber = str_replace("+", "", $phaxiotoraw);
202
+                      $errortype = 'there are no errors';
203
+
204
+           } catch (InvalidRequestException $e) {
205
+                      $phaxiofromnumber = 'null';
206
+                      $errortype = 'invalid request error';
207
+           } catch (AuthenticationException $e) {
208
+                      $phaxiofromnumber = 'null';
209
+                      $errortype = 'authentication error';
210
+           } catch (APIConnectionException $e) {
211
+                      $phaxiofromnumber = 'null';
212
+                      $errortype = 'API connection error';
213
+           } catch (RateLimitException $e) {
214
+                      $phaxiofromnumber = 'null';
215
+                      $errortype = 'rate limit error';
216
+           } catch (NotFoundException $e) {
217
+                      $phaxiofromnumber = 'null';
218
+                      $errortype = 'not found error';
219
+           } catch (GeneralException $e) {
220
+                      $phaxiofromnumber = 'null';
221
+                      $errortype = 'undefined error';
222
+           }
223
+
224
+           if ($this->folder->nodeExists('Pax_Fax/faxes_received') == false) {
225
+               $this->folder->newFolder('Pax_Fax/faxes_received');
226
+           }
227
+
228
+           if ($this->folder->nodeExists('Pax_Fax/faxes_received_failed') == false) {
229
+               $this->folder->newFolder('Pax_Fax/faxes_received_failed');
230
+           }
231
+
232
+           $targetfile = "/Pax_Fax/faxes_received/" . $fileName . "_" . $phaxiofromnumber . "_" . $phaxiotonumber  . "_" . $fldate . "." . $filenameext;
233
+
234
+           $target = $this->folder->newFile($targetfile);
235
+
236
+           $target->putContent($fileContent);
237
+
238
+           // Move failed received faxes to the 'faxes_received_failed' folder
239
+           if ($filenameext == '') {
240
+
241
+               $newtargetfl =  "/Pax_Fax/faxes_received_failed/" . $fileName . "_" . $phaxiofromnumber . "_" . $phaxiotonumber . "_" . $fldate . "." . $filenameext;
242
+               $targetact = $this->folder->newFile($newtargetfl);
243
+
244
+               $targetact->putContent($fileContent);
245
+
246
+               $failedfl = "/Pax_Fax/faxes_received/" . $fileName . "_" . $phaxiofromnumber . "_" . $phaxiotonumber . "_" . $fldate . "." . $filenameext;
247
+               $removefailed = $this->filesystem->unlink($failedfl);
248
+           }
249
+
250
+           // Send notifications
251
+           $nameofhost = exec("hostname");
252
+           $getnextnotify = $thisapicred[4];
253
+           $useremailaddr = $thisapicred[5];
254
+
255
+           if ($filenameext != '') {
256
+               $targetflname = $targetfile;
257
+               $targettrim = "/Pax_Fax/faxes_received/";
258
+               $validfaxparam = "fax";
259
+               $setsubject = "New fax received";
260
+           } else {
261
+               $targetflname = $newtargetfl;
262
+               $targettrim = "/Pax_Fax/faxes_received_failed/";
263
+               $validfaxparam = "failed fax";
264
+               $setsubject = "New failed fax received";
265
+           }
266
+
267
+           if ($useremailaddr != '') {
268
+
269
+               $subject = $setsubject;
270
+               $message = "Hello! <br><br> You have received a new ".$validfaxparam." on ".$flmsdate." .<br> The new ".$validfaxparam." file is '".$targetflname."' . <br><br>____________<br><br> Yours, <br> Pax Fax <br> A fax application for Nextcloud <br> Host: '".$nameofhost."' <br>";
271
+
272
+               $messagefin = chunk_split(base64_encode($message));
273
+
274
+               $headers = "MIME-Version: 1.0" . "\r\n";
275
+               $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
276
+               $headers .= "Content-Transfer-Encoding: base64" . "\r\n";
277
+
278
+               // Set the email sender
279
+               $headers .= "From: " . $useremailaddr . "\r\n";
280
+               $headers .= "Reply-To: " . $useremailaddr . "\r\n";
281
+
282
+               mail($useremailaddr, $subject, $messagefin, $headers);
283
+           }
284
+
285
+           if ($getnextnotify != 0 ) {
286
+
287
+               $notify = exec("php ./occ notification:generate ".$this->userId." 'Pax Fax has received a new fax !' -l 'The new fax can be found in the \"".$targettrim."\" folder.'");
288
+          }
289
+
290
+       } else { return "access denied"; }
291
+
292
+    }
293
+
294
+}
295
+
0 296
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\PaxFax\Controller;
27
+
28
+use OCP\IRequest;
29
+use OCP\AppFramework\Controller;
30
+use OCA\PaxFax\Service\PaxfaxService;
31
+use OCP\AppFramework\App;
32
+use OCP\Files\NotPermittedException;
33
+use OCP\Files\Folder;
34
+use OCP\IConfig;
35
+use OC\Files\Filesystem;
36
+use OC\Files\View;
37
+use \ReflectionClass;
38
+use \FilesystemIterator;
39
+
40
+use Phaxio;
41
+use Phaxio\OperationResult;
42
+use Phaxio\Error\AuthenticationException;
43
+use Phaxio\Error\NotFoundException;
44
+use Phaxio\Error\InvalidRequestException;
45
+use Phaxio\Error\RateLimitException;
46
+use Phaxio\Error\APIConnectionException;
47
+use Phaxio\Error\GeneralException;
48
+
49
+
50
+class PaxfaxController extends Controller {
51
+
52
+    private $service;
53
+    private $config;
54
+    private $userId;
55
+    private $folder;
56
+    private $filesystem;
57
+    private $view;
58
+
59
+    public function __construct($appName, IRequest $request, PaxfaxService $service, IConfig $config, $userId, Folder $folder, Filesystem $filesystem, View $view) {
60
+
61
+           parent::__construct($appName, $request);
62
+
63
+           $this->service = $service;
64
+           $this->config = $config;
65
+           $this->userId = $userId;
66
+           $this->folder = $folder;
67
+           $this->filesystem = $filesystem;
68
+           $this->view = $view;
69
+    }
70
+
71
+    /**
72
+     * @NoAdminRequired
73
+     */
74
+    public function cleantempdir($userId) {
75
+
76
+           // If the 'temp_files' folder doesn't exist create it
77
+           if ($this->folder->nodeExists('Pax_Fax/temp_files') == false) {
78
+               $this->folder->newFolder('Pax_Fax/temp_files');
79
+           }
80
+
81
+           $datadir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/';
82
+           $targetdir = $datadir . $this->userId . "/files/Pax_Fax/temp_files";
83
+           $fileSystemIterator = new FilesystemIterator($targetdir);
84
+
85
+           $dirfiles = [];
86
+           foreach ($fileSystemIterator as $fileInfo){
87
+                    $dirfiles[] = $fileInfo->getFilename();
88
+           }
89
+
90
+           foreach ($dirfiles as $key => $indfile) {
91
+                    $thisuserroot = $this->view->getRoot();
92
+                    $tempfile = $thisuserroot . "/Pax_Fax/temp_files/" . $indfile;
93
+                    $removetmpfile = $this->filesystem->unlink($tempfile);
94
+           }
95
+    }
96
+
97
+
98
+    /**
99
+     * @NoAdminRequired
100
+     */
101
+    public function object_to_array($obj) {
102
+
103
+           if(is_object($obj)) $obj = (array)$this->dismount($obj);
104
+           if(is_array($obj)) {
105
+              $new = array();
106
+              foreach($obj as $key => $val) {
107
+                      $new[$key] = $this->object_to_array($val);
108
+              }
109
+           }
110
+           else $new = $obj;
111
+           return $new;
112
+    }
113
+
114
+
115
+    /**
116
+     * @NoAdminRequired
117
+     */
118
+    public function dismount($object) {
119
+           $reflectionClass = new ReflectionClass(get_class($object));
120
+           $array = array();
121
+           foreach ($reflectionClass->getProperties() as $property) {
122
+                    $property->setAccessible(true);
123
+                    $array[$property->getName()] = $property->getValue($object);
124
+                    $property->setAccessible(false);
125
+           }
126
+           return $array;
127
+    }
128
+
129
+
130
+    /**
131
+     * @NoAdminRequired
132
+     */
133
+    public function getbalance($userId) {
134
+
135
+           $apiMode = 'live';
136
+           $thisapicred = $this->service->getapicredentials($this->userId);
137
+
138
+           $apiKeys[$apiMode] = $thisapicred[0];
139
+           $apiSecrets[$apiMode] = $thisapicred[1];
140
+
141
+           $apiHost = 'https://api.phaxio.com/v2.1/';
142
+
143
+           $phaxio = new Phaxio($apiKeys[$apiMode], $apiSecrets[$apiMode], $apiHost);
144
+
145
+           try {
146
+                    // Get Phaxio account balance
147
+                    $phaxioresulttert = $phaxio->doRequest("GET", 'account/status');
148
+
149
+                    $balancetoarr = $this->object_to_array($phaxioresulttert);
150
+
151
+                    $phaxiobalance = $balancetoarr['data']['balance'];
152
+
153
+           } catch (InvalidRequestException $e) {
154
+                    $phaxiobalance = 'unknown';
155
+                    $phaxiosuccess = 'false';
156
+                    $errortype = 'invalid request error';
157
+           } catch (AuthenticationException $e) {
158
+                    $phaxiobalance = 'unknown';
159
+                    $phaxiosuccess = 'false';
160
+                    $errortype = 'authentication error';
161
+           } catch (APIConnectionException $e) {
162
+                    $phaxiobalance = 'unknown';
163
+                    $phaxiosuccess = 'false';
164
+                    $errortype = 'API connection error';
165
+           } catch (RateLimitException $e) {
166
+                    $phaxiobalance = 'unknown';
167
+                    $phaxiosuccess = 'false';
168
+                    $errortype = 'rate limit error';
169
+           } catch (NotFoundException $e) {
170
+                    $phaxiobalance = 'unknown';
171
+                    $phaxiosuccess = 'false';
172
+                    $errortype = 'not found error';
173
+           } catch (GeneralException $e) {
174
+                    $phaxiobalance = 'unknown';
175
+                    $phaxiosuccess = 'false';
176
+                    $errortype = 'undefined error';
177
+           }
178
+
179
+           return $phaxiobalance;
180
+
181
+    }
182
+
183
+
184
+    /**
185
+     * @NoAdminRequired
186
+     */
187
+    public function getfaxnumbers($userId) {
188
+
189
+           $apiMode = 'live';
190
+           $thisapicred = $this->service->getapicredentials($this->userId);
191
+
192
+           $apiKeys[$apiMode] = $thisapicred[0];
193
+           $apiSecrets[$apiMode] = $thisapicred[1];
194
+
195
+           $apiHost = 'https://api.phaxio.com/v2.1/';
196
+
197
+           $phaxio = new Phaxio($apiKeys[$apiMode], $apiSecrets[$apiMode], $apiHost);
198
+
199
+           try {
200
+                    // Get all Phaxio fax numbers
201
+                    $phaxioresultfour = $phaxio->doRequest("GET", 'phone_numbers');
202
+
203
+                    $phaxionbstoarr = $this->object_to_array($phaxioresultfour);
204
+
205
+                    $phaxioarr = [];
206
+
207
+                    foreach ($phaxionbstoarr['data'] as $phkey => $phvalue) {
208
+                           if (is_array($phvalue)) {
209
+                                 foreach ($phvalue as $phkey2 => $phvalue2) {
210
+                                       if ($phkey2 == 'phone_number') {
211
+                                           $phaxioarr[] = $phvalue2;
212
+                                       }
213
+                                 }
214
+                           }
215
+                    }
216
+
217
+                    $phaxionmbrs = $phaxioarr;
218
+
219
+           } catch (InvalidRequestException $e) {
220
+                    $phaxiobalance = 'unknown';
221
+                    $phaxiosuccess = 'false';
222
+                    $errortype = 'invalid request error';
223
+           } catch (AuthenticationException $e) {
224
+                    $phaxiobalance = 'unknown';
225
+                    $phaxiosuccess = 'false';
226
+                    $errortype = 'authentication error';
227
+           } catch (APIConnectionException $e) {
228
+                    $phaxiobalance = 'unknown';
229
+                    $phaxiosuccess = 'false';
230
+                    $errortype = 'API connection error';
231
+           } catch (RateLimitException $e) {
232
+                    $phaxiobalance = 'unknown';
233
+                    $phaxiosuccess = 'false';
234
+                    $errortype = 'rate limit error';
235
+           } catch (NotFoundException $e) {
236
+                    $phaxiobalance = 'unknown';
237
+                    $phaxiosuccess = 'false';
238
+                    $errortype = 'not found error';
239
+           } catch (GeneralException $e) {
240
+                    $phaxiobalance = 'unknown';
241
+                    $phaxiosuccess = 'false';
242
+                    $errortype = 'undefined error';
243
+           }
244
+
245
+           return $phaxionmbrs;
246
+    }
247
+
248
+    /**
249
+     * @NoAdminRequired
250
+     */
251
+    protected function getFileID() {
252
+		if ($this->createdFile) {
253
+			return $this->createdFile;
254
+		}
255
+
256
+		$qb = $this->connection->getQueryBuilder();
257
+
258
+		// We create a new file entry and delete it after the test again
259
+		$fileName = $this->getUniqueID('TestRepairCleanTags', 12);
260
+		$qb->insert('filecache')
261
+			->values([
262
+				'path' => $qb->createNamedParameter($fileName),
263
+				'path_hash' => $qb->createNamedParameter(md5($fileName)),
264
+			])
265
+			->execute();
266
+		$fileName = $this->getUniqueID('TestRepairCleanTags', 12);
267
+		$qb->insert('filecache')
268
+			->values([
269
+				'path' => $qb->createNamedParameter($fileName),
270
+				'path_hash' => $qb->createNamedParameter(md5($fileName)),
271
+			])
272
+			->execute();
273
+
274
+		$this->createdFile = (int) $this->getLastInsertID('filecache', 'fileid');
275
+		return $this->createdFile;
276
+    }
277
+
278
+    /**
279
+     * @NoAdminRequired
280
+     */
281
+    public function uploadfile($uploadfileforfax) {
282
+
283
+           $fileContent = file_get_contents($_FILES['uploadfileforfax']['tmp_name']);
284
+           $fileName = $_FILES['uploadfileforfax']['name'];
285
+           $fileSizeinit = $_FILES['uploadfileforfax']['size'];
286
+           $fileSize = $fileSizeinit / 1048576;
287
+
288
+           if ($this->folder->nodeExists('Pax_Fax/faxes_sent') == false) {
289
+               $this->folder->newFolder('Pax_Fax/faxes_sent');
290
+           }
291
+           if ($this->folder->nodeExists('Pax_Fax/faxes_received') == false) {
292
+               $this->folder->newFolder('Pax_Fax/faxes_received');
293
+           }
294
+           if ($this->folder->nodeExists('Pax_Fax/faxes_sent_failed') == false) {
295
+               $this->folder->newFolder('Pax_Fax/faxes_sent_failed');
296
+           }
297
+           if ($this->folder->nodeExists('Pax_Fax/faxes_received_failed') == false) {
298
+               $this->folder->newFolder('Pax_Fax/faxes_received_failed');
299
+           }
300
+           if ($this->folder->nodeExists('Pax_Fax/temp_files') == false) {
301
+               $this->folder->newFolder('Pax_Fax/temp_files');
302
+           }
303
+
304
+           $userroot = $this->view->getRoot();
305
+           $targetfile = $userroot . "/Pax_Fax/temp_files/" . $fileName;
306
+
307
+           $target = $this->folder->newFile($targetfile);
308
+           $target->putContent($fileContent);
309
+
310
+           // Get the cumulative files size of the uploaded files
311
+           $datadir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/';
312
+           $targetdir = $datadir . $this->userId . "/files/Pax_Fax/temp_files";
313
+
314
+           $fileSystemIterator = new FilesystemIterator($targetdir);
315
+
316
+           $dirfiles = [];
317
+           foreach ($fileSystemIterator as $fileInfo){
318
+                    $dirfiles[] = $fileInfo->getFilename();
319
+           }
320
+
321
+           $totalflsizeinit = 0;
322
+           foreach ($dirfiles as $key => $indfile) {
323
+                    $fileSizeinit = $this->filesystem->filesize($userroot . "/Pax_Fax/temp_files/" . $indfile);
324
+                    $mbSize = $fileSizeinit / 1048576;
325
+                    $totalflsizeinit += $mbSize;
326
+           }
327
+
328
+           $totalflsize = number_format($totalflsizeinit, 2) . ' MB';
329
+
330
+           return $totalflsize;
331
+    }
332
+
333
+    /**
334
+     * @NoAdminRequired
335
+     */
336
+    public function pickfile($path) {
337
+
338
+           if ($this->folder->nodeExists('Pax_Fax/faxes_sent') == false) {
339
+               $this->folder->newFolder('Pax_Fax/faxes_sent');
340
+           }
341
+           if ($this->folder->nodeExists('Pax_Fax/faxes_received') == false) {
342
+               $this->folder->newFolder('Pax_Fax/faxes_received');
343
+           }
344
+           if ($this->folder->nodeExists('Pax_Fax/faxes_sent_failed') == false) {
345
+               $this->folder->newFolder('Pax_Fax/faxes_sent_failed');
346
+           }
347
+           if ($this->folder->nodeExists('Pax_Fax/faxes_received_failed') == false) {
348
+               $this->folder->newFolder('Pax_Fax/faxes_received_failed');
349
+           }
350
+           if ($this->folder->nodeExists('Pax_Fax/temp_files') == false) {
351
+               $this->folder->newFolder('Pax_Fax/temp_files');
352
+           }
353
+
354
+           $datadir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/';
355
+
356
+           $fltgt = $datadir . $this->userId . "/files" . $path;
357
+
358
+           $fileContent = file_get_contents($fltgt);
359
+
360
+           $patharr = explode("/", $path);
361
+
362
+           $revarr = array_reverse($patharr);
363
+
364
+           $relflpath = "/Pax_Fax/temp_files/" . $revarr[0]; 
365
+
366
+           $target = $this->folder->newFile($relflpath);
367
+
368
+           $target->putContent($fileContent);
369
+
370
+           $targetdir = $datadir . $this->userId . "/files/Pax_Fax/temp_files";
371
+
372
+           $fileSystemIterator = new FilesystemIterator($targetdir);
373
+
374
+           $dirfiles = [];
375
+           foreach ($fileSystemIterator as $fileInfo) {
376
+                    $dirfiles[] = $fileInfo->getFilename();
377
+           }
378
+
379
+           $totalflsizeinit = 0;
380
+
381
+           foreach ($dirfiles as $key => $indfile) {
382
+
383
+                    $fileSizeinit = $this->filesystem->filesize("/Pax_Fax/temp_files/" . $indfile);
384
+                    $mbSize = $fileSizeinit / 1048576;
385
+                    $totalflsizeinit += $mbSize;
386
+           }
387
+
388
+           $totalflsize = number_format($totalflsizeinit, 2) . ' MB';
389
+
390
+           return $totalflsize;
391
+    }
392
+
393
+    /**
394
+     * @NoAdminRequired
395
+     */
396
+    public function removeupfile($removedfilename) {
397
+
398
+           $tmpfl = "/" . $this->userId . "/files/Pax_Fax/temp_files/" . $removedfilename;
399
+
400
+           $removefile = $this->view->unlink($tmpfl);
401
+
402
+           // Get the cumulative files size of the uploaded files
403
+           $datadir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/';
404
+           $targetdir = $datadir . $this->userId . "/files/Pax_Fax/temp_files";
405
+           $fileSystemIterator = new FilesystemIterator($targetdir);
406
+
407
+           $dirfiles = [];
408
+           foreach ($fileSystemIterator as $fileInfo){
409
+                    $dirfiles[] = $fileInfo->getFilename();
410
+           }
411
+
412
+           $totalflsizeinit = 0;
413
+
414
+           foreach ($dirfiles as $key => $indfile) {
415
+                    $fileSizeinit = $this->filesystem->filesize("/Pax_Fax/temp_files/" . $indfile);
416
+                    $mbSize = $fileSizeinit / 1048576;
417
+                    $totalflsizeinit += $mbSize;
418
+           }
419
+
420
+           $totalflsize = number_format($totalflsizeinit, 2) . ' MB';
421
+
422
+           return $totalflsize;
423
+    }
424
+
425
+    /**
426
+     * @NoAdminRequired
427
+     */
428
+    public function getpickedfile($pickedfilename) {
429
+
430
+           $thisuserroot = $this->view->getRoot();
431
+
432
+           $temppickedfile = $thisuserroot . "/Pax_Fax/temp_files/" . $pickedfilename;
433
+           $getfilecontent = $this->filesystem->file_get_contents($temppickedfile);
434
+
435
+           $namesplit = explode(".", $pickedfilename);
436
+           $extension = end($namesplit);
437
+
438
+           if ($extension == "txt" || $extension == "html") {
439
+               $getpickedfile = $getfilecontent;
440
+           } elseif ($extension == "jpg") {
441
+               $getpickedfile = 'data:image/jpeg;base64,' . base64_encode($getfilecontent);
442
+           } elseif ($extension == "png") {
443
+               $getpickedfile = 'data:image/png;base64,' . base64_encode($getfilecontent);
444
+           } else { $getpickedfile = ""; }
445
+
446
+           return $getpickedfile;
447
+    }
448
+
449
+    /**
450
+     * @NoAdminRequired
451
+     */
452
+    public function sendfax($userId, $uploadedtofax, $selectedcid, $toNumber) {
453
+
454
+           $tonumbertr = str_replace("+", "", $toNumber[0]);
455
+           $fldate = date("Y-m-d_H-i-s_").gettimeofday()["usec"];
456
+
457
+           $fromnumberdigits = str_replace("+", "", $selectedcid);
458
+           if ($selectedcid != '' && $selectedcid != 'click refresh button') { $fromnumber = $fromnumberdigits; } else { $fromnumber = 'nocallerid'; }
459
+
460
+           $countfaxfiles = count($uploadedtofax);
461
+
462
+           $openedfiles = [];
463
+
464
+           foreach ($uploadedtofax as $key => $flname) {
465
+
466
+                    if ($key == 0) { $firstflname = $flname; }
467
+
468
+                    $fileNamesec = array_reverse(explode(".", $flname));
469
+                    $filenameext = $fileNamesec[0];
470
+                    array_shift($fileNamesec);
471
+
472
+                    $fileName = implode("", $fileNamesec);
473
+
474
+                    if ($countfaxfiles == 1) {
475
+                        $targetfile = "/Pax_Fax/faxes_sent/" . $fileName . "_" . $fromnumber . "_"  . $tonumbertr . "_" . $fldate . "." . $filenameext;
476
+                    } else {
477
+                         if ($this->folder->nodeExists("Pax_Fax/faxes_sent/" . $firstflname . "_et_al_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate) == false) {
478
+                             $this->folder->newFolder("Pax_Fax/faxes_sent/" . $firstflname . "_et_al_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate);
479
+                         }
480
+
481
+                         $targetfile = "/Pax_Fax/faxes_sent/" . $firstflname . "_et_al_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate . "/" . $fileName . "_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate . "." . $filenameext;
482
+                    }
483
+
484
+                    $datadir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/';
485
+                    $fltgt = $datadir . $this->userId . "/files/Pax_Fax/temp_files/" . $flname;
486
+                    $fileContent = file_get_contents($fltgt);
487
+
488
+                    $target = $this->folder->newFile($targetfile);
489
+                    $target->putContent($fileContent);
490
+
491
+                    $removetmpfile = $this->filesystem->unlink($fltgt);
492
+
493
+                    if ($countfaxfiles == 1) {
494
+                        $openedfiles[] = fopen($datadir . $this->userId . "/files/Pax_Fax/faxes_sent/" . $fileName . "_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate . "." . $filenameext, "r");
495
+                    } else {
496
+                        $openedfiles[] = fopen($datadir . $this->userId . "/files/Pax_Fax/faxes_sent/" . $firstflname . "_et_al_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate . "/" . $fileName . "_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate . "." . $filenameext, "r");
497
+                    }
498
+           }
499
+
500
+           $params = array(
501
+                           'to' => $toNumber,
502
+                           'file' => $openedfiles,
503
+                           'caller_id' => $selectedcid
504
+                     );
505
+
506
+           $apiMode = 'live';
507
+
508
+           $thisapicred = $this->service->getapicredentials($this->userId);
509
+
510
+           $apiKeys[$apiMode] = $thisapicred[0];
511
+           $apiSecrets[$apiMode] = $thisapicred[1];
512
+
513
+           $apiHost = 'https://api.phaxio.com/v2.1/';
514
+
515
+           $phaxio = new Phaxio($apiKeys[$apiMode], $apiSecrets[$apiMode], $apiHost);
516
+
517
+           try {
518
+                    $phaxioresultinit = $phaxio->sendFax($params);
519
+
520
+                    $phaxioresultsec = $phaxio->doRequest("GET", 'faxes/' . urlencode((string)$phaxioresultinit['id']));
521
+
522
+                    $statustoarr = $this->object_to_array($phaxioresultsec);
523
+
524
+                    $phaxiosuccess = $statustoarr['success'];
525
+
526
+                    $errortype = 'there are no errors';
527
+
528
+           } catch (InvalidRequestException $e) {
529
+                    $phaxiosuccess = 'false';
530
+                    $errortype = 'invalid request error';
531
+           } catch (AuthenticationException $e) {
532
+                    $phaxiosuccess = 'false';
533
+                    $errortype = 'authentication error';
534
+           } catch (APIConnectionException $e) {
535
+                    $phaxiosuccess = 'false';
536
+                    $errortype = 'API connection error';
537
+           } catch (RateLimitException $e) {
538
+                    $phaxiosuccess = 'false';
539
+                    $errortype = 'rate limit error';
540
+           } catch (NotFoundException $e) {
541
+                    $phaxiosuccess = 'false';
542
+                    $errortype = 'not found error';
543
+           } catch (GeneralException $e) {
544
+                    $phaxiosuccess = 'false';
545
+                    $errortype = 'undefined error';
546
+           }
547
+
548
+           $phaxioresult = ['success' => $phaxiosuccess, 'errortype' => $errortype];
549
+
550
+           if ($phaxiosuccess != 'true') {
551
+
552
+                    foreach ($uploadedtofax as $key => $flname) {
553
+
554
+                        $fileNamesec = array_reverse(explode(".", $flname));
555
+                        $filenameext = $fileNamesec[0];
556
+                        array_shift($fileNamesec);
557
+
558
+                        $fileName = implode("", $fileNamesec);
559
+
560
+                        if ($countfaxfiles == 1) {
561
+                            $failedfl = "/Pax_Fax/faxes_sent/" . $fileName . "_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate . "." . $filenameext;
562
+                            $newtargetfl =  "/Pax_Fax/faxes_sent_failed/" . $fileName . "_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate . "." . $filenameext;
563
+                        } else {
564
+
565
+                            $failedfl = "/Pax_Fax/faxes_sent/" . $firstflname . "_et_al_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate . "/" . $fileName . "_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate . "." . $filenameext;
566
+                            $this->folder->newFolder("Pax_Fax/faxes_sent_failed/" . $firstflname . "_et_al_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate);
567
+                            $newtargetfl = "/Pax_Fax/faxes_sent_failed/" . $firstflname . "_et_al_" . $fromnumber . "_" . $tonumbertr . "_" . $fldate . "/" . $fileName . "_" . $tonumbertr . "_" . $fldate . "." . $filenameext;
568
+                        }
569
+
570
+                        $fileContent = $this->filesystem->file_get_contents($failedfl);
571
+
572
+                        $targetact = $this->folder->newFile($newtargetfl);
573
+                        $targetact->putContent($fileContent);
574
+
575
+                        $removefailed = $this->filesystem->unlink($failedfl);
576
+                    }
577
+
578
+           }
579
+
580
+           return $phaxioresult;
581
+    }
582
+
583
+
584
+    /**
585
+     * @NoAdminRequired
586
+     */
587
+    public function getsettings($userId) {
588
+           return $this->service->getsettings($this->userId);
589
+    }
590
+
591
+
592
+    /**
593
+     * @NoAdminRequired
594
+     */
595
+    public function updatesettings($userId, $apiKey, $apiSecret, $webhookToken, $receiveUrl, $getNotification, $notificationEmail) {
596
+           return $this->service->updatesettings($this->userId, $apiKey, $apiSecret, $webhookToken, $receiveUrl, $getNotification, $notificationEmail);
597
+    }
598
+
599
+}
0 600
new file mode 100644
... ...
@@ -0,0 +1,116 @@
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('pax_fax', 'sendfax');
27
+style('pax_fax', 'style');
28
+
29
+?>
30
+
31
+<div id="pax_fax_vbar">
32
+
33
+    <div id="currentbaldiv"><a class="providername" href="https://console.phaxio.com/sf_guard_users/sign_in" target="_blank" rel="noreferrer noopener">Phaxio</a> balance:
34
+            <div id="currentbalance"></div>
35
+            <button id="checkbalance" title="Refresh to see the current balance."></button>
36
+    </div>
37
+
38
+    <div id="faxnumbersdiv" class="cllridcls">
39
+            <div id="pickid">Set ID:</div>
40
+            <select id="currentfaxnmbrs" class="optselectfxnb">
41
+               <option value="" selected="selected" disabled hidden class="optselectfxnb">click refresh button</option>
42
+            </select>
43
+            <button id="selectcalleridbttn" title="Refresh the list of Sender IDs."></button>
44
+            <div class="fortooltipinit">
45
+                 <div id="infosetid">i</div>
46
+                 <span class="calleridtooltip">The Caller ID is the 'From' number that the receiver sees on the fax that you send. You can leave it blank or you can set as
47
+                       Caller ID one of your Phaxio fax numbers (first refresh the list, then select from the drop-down)
48
+                 </span>
49
+            </div>
50
+    </div>
51
+
52
+    <div  class="pfheader">
53
+            Enter the recipient's number as:
54
+    </div>
55
+    <div class="faxnbformat">
56
+            <a id="countryCallCode" href="https://en.wikipedia.org/wiki/List_of_country_calling_codes#Alphabetical_listing_by_country_or_region"
57
+               target="_blank" rel="noreferrer noopener">CountryCallingCode</a><font style="color:#aa2e4b">FaxNumber</font>
58
+    </div>
59
+    <div class="fortooltip">
60
+         <div id="infonumber">i</div>
61
+         <span class="fortooltiptext">
62
+            For example, to send a fax to the German fax number 1212121212, enter 491212121212, where 49 is the country calling code of Germany. (For US the calling
63
+            code is 1, for UK 44, for France 33, etc.) The <a href="https://en.wikipedia.org/wiki/List_of_country_calling_codes#Alphabetical_listing_by_country_or_region"
64
+            target="_blank" rel="noreferrer noopener" style="color:#1b60ba">country calling code</a> must be always included, even if the fax is sent locally. 
65
+            You don't need to add the '+' sign or '00' in front of the number, because the '+' sign will be added automatically. If you want to send the same fax simultaneously 
66
+            to multiple numbers, add them one after the other separated by a comma like this: 497777777777,442222222222 You can send a fax to up to 15 numbers at once.
67
+         </span>
68
+    </div>
69
+
70
+    <div id="faxtodiv">
71
+         <input type="text" id="faxto" name="faxto" />
72
+    </div>
73
+
74
+    <div class="pfheader">Choose the document(s) that you want to send as fax:</div>
75
+    <div class="fortooltipsec">
76
+          <div id="infoformat">i</div>
77
+          <span class="fortooltiptextsec">
78
+              Supported formats are: pdf, odt, jpeg/jpg, png, txt, tiff/tif, html, doc, docx. You can send up to 20 files with a cumulative size of up to 20 MB and up to 200 pages, in one fax call. (docx and doc files can be sent as fax but cannot be previewed in the adjoining preview pane; docx and doc files should be previewed outside Pax Fax before sending them.)
79
+          </span>
80
+    </div>
81
+
82
+    <div id="filestotsize">Total files size:<div id="filessizetext"></div></div>
83
+
84
+    <div id="fileuploadednm" class="fileuploadstl"></div>
85
+    <div class="uploadfiledv">
86
+          <form class="uploadflbt"  enctype="multipart/form-data" >
87
+                <div id="uploadFile">Upload a file</div>
88
+                <input id="uploadfileforfax" class="fileupload" name="uploadedtofax[]" type="file" multiple />
89
+                <label for="uploadfileforfax" class="button icon-upload svg" id="uploadfileforfax" </label>
90
+          </form>
91
+    </div>
92
+
93
+    <div id="pf_upload_msg"></div>
94
+
95
+    <div id="filespickednc" class="filesfromnc"></div>
96
+  
97
+    <div id="pickFromNext">Pick from Nextcloud</div>
98
+
99
+    <button id="choosefilen"></button>
100
+
101
+    <div id="pf_choose_msg"></div>
102
+
103
+    <p class="pickedflnm"></p>
104
+
105
+    <input type="submit" id="submitfax" value="Send Fax" />
106
+
107
+    <div id="pf_submit_msg"></div>
108
+
109
+    <div id="dirbuttons">
110
+       <button id="receivedfaxdir" class="openfaxfolder">Received Faxes</button>
111
+       <button id="sentfaxdir" class="openfaxfolder">Sent Faxes</button>
112
+       <button id="receivedfaileddir" class="openfaxfolder">Failed Received Faxes</button>
113
+       <button id="sentfaileddir" class="openfaxfolder">Failed Sent Faxes</button>
114
+    </div>
115
+
116
+</div>