Add all code files from IDE

This commit is contained in:
Miguel Nogueira 2018-06-07 10:56:13 +00:00
commit 06fc7e5360
28 changed files with 4956 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
vendor/*

30
README.md Normal file
View File

@ -0,0 +1,30 @@
,-----.,--. ,--. ,---. ,--.,------. ,------.
' .--./| | ,---. ,--.,--. ,-| || o \ | || .-. \ | .---'
| | | || .-. || || |' .-. |`..' | | || | \ :| `--,
' '--'\| |' '-' '' '' '\ `-' | .' / | || '--' /| `---.
`-----'`--' `---' `----' `---' `--' `--'`-------' `------'
-----------------------------------------------------------------
Hi there! Welcome to Cloud9 IDE!
To get you started, we have created a small hello world application.
1) Open the hello-world.php file
2) Follow the run instructions in the file's comments
3) If you want to look at the Apache logs, check out ~/lib/apache2/log
And that's all there is to it! Just have fun. Go ahead and edit the code,
or add new files. It's all up to you!
Happy coding!
The Cloud9 IDE team
## Support & Documentation
Visit http://docs.c9.io for support, or to learn more about using Cloud9 IDE.
To watch some training videos, visit http://www.youtube.com/user/c9ide

22
composer.json Normal file
View File

@ -0,0 +1,22 @@
{
"require": {
"slim/slim": "^3.9",
"hnhdigital-os/php-virtualmin-api": "^1.0",
"curl/curl": "^1.9",
"pimple/pimple": "^3.2",
"cilex/cilex": "^2.0",
"paragonie/easydb": "^2.6",
"twig/twig": "^2.4",
"byjg/mailwrapper": "2.0.*",
"analog/analog": "^1.0",
"yadakhov/json": "^2.0",
"ircmaxell/random-lib": "^1.2"
},
"autoload": {
"classmap": ["source/"]
}
}

2065
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

11
hello-world.php Normal file
View File

@ -0,0 +1,11 @@
<html><body>
<?php
// A simple web site in Cloud9 that runs through Apache
// Press the 'Run' button on the top to start the web server,
// then click the URL that is emitted to the Output tab of the console
echo 'Hello world from Cloud9!';
?>
</body>
</html>

1662
php.ini Normal file

File diff suppressed because it is too large Load Diff

229
php_errors.log Normal file
View File

@ -0,0 +1,229 @@
[12-Apr-2018 09:01:21 UTC] PHP Warning: require(source/boot.php): failed to open stream: No such file or directory in /home/ubuntu/workspace/testing/index.php on line 3
[12-Apr-2018 09:01:21 UTC] PHP Stack trace:
[12-Apr-2018 09:01:21 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:01:21 UTC] PHP Fatal error: require(): Failed opening required 'source/boot.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/ubuntu/workspace/testing/index.php on line 3
[12-Apr-2018 09:01:21 UTC] PHP Stack trace:
[12-Apr-2018 09:01:21 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:01:51 UTC] PHP Fatal error: Class 'Encryption' not found in /home/ubuntu/workspace/testing/index.php on line 6
[12-Apr-2018 09:01:51 UTC] PHP Stack trace:
[12-Apr-2018 09:01:51 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:11:50 UTC] PHP Warning: include(/source/config.php): failed to open stream: No such file or directory in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:11:50 UTC] PHP Stack trace:
[12-Apr-2018 09:11:50 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:11:50 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:11:50 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:11:50 UTC] PHP 4. Encryption::loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:11:50 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:11:50 UTC] PHP Warning: include(): Failed opening '/source/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:11:50 UTC] PHP Stack trace:
[12-Apr-2018 09:11:50 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:11:50 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:11:50 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:11:50 UTC] PHP 4. Encryption::loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:11:50 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:11:50 UTC] PHP Fatal error: Using $this when not in object context in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php on line 23
[12-Apr-2018 09:11:50 UTC] PHP Stack trace:
[12-Apr-2018 09:11:50 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:11:50 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:11:50 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:11:50 UTC] PHP 4. Encryption::loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:13:01 UTC] PHP Warning: include(/spacejewel-ipn-communicator/source/config.php): failed to open stream: No such file or directory in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:13:01 UTC] PHP Stack trace:
[12-Apr-2018 09:13:01 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:13:01 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:13:01 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:13:01 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:13:01 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:13:01 UTC] PHP Warning: include(): Failed opening '/spacejewel-ipn-communicator/source/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:13:01 UTC] PHP Stack trace:
[12-Apr-2018 09:13:01 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:13:01 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:13:01 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:13:01 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:13:01 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:13:01 UTC] PHP Fatal error: Class 'gnupg' not found in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php on line 24
[12-Apr-2018 09:13:01 UTC] PHP Stack trace:
[12-Apr-2018 09:13:01 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:13:01 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:13:01 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:13:01 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:13:05 UTC] PHP Warning: include(/spacejewel-ipn-communicator/source/config.php): failed to open stream: No such file or directory in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:13:05 UTC] PHP Stack trace:
[12-Apr-2018 09:13:05 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:13:05 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:13:05 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:13:05 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:13:05 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:13:05 UTC] PHP Warning: include(): Failed opening '/spacejewel-ipn-communicator/source/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:13:05 UTC] PHP Stack trace:
[12-Apr-2018 09:13:05 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:13:05 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:13:05 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:13:05 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:13:05 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:13:05 UTC] PHP Fatal error: Class 'gnupg' not found in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php on line 24
[12-Apr-2018 09:13:05 UTC] PHP Stack trace:
[12-Apr-2018 09:13:05 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:13:05 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:13:05 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:13:05 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:20:48 UTC] PHP Warning: include(/spacejewel-ipn-communicator/source/config.php): failed to open stream: No such file or directory in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:20:48 UTC] PHP Stack trace:
[12-Apr-2018 09:20:48 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:20:48 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:20:48 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:20:48 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:20:48 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:20:48 UTC] PHP Warning: include(): Failed opening '/spacejewel-ipn-communicator/source/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:20:48 UTC] PHP Stack trace:
[12-Apr-2018 09:20:48 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:20:48 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:20:48 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:20:48 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:20:48 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:20:49 UTC] PHP Fatal error: Using $this when not in object context in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 22
[12-Apr-2018 09:20:49 UTC] PHP Stack trace:
[12-Apr-2018 09:20:49 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:20:49 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:20:49 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:20:49 UTC] PHP 4. Config::getConfig() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:33
[12-Apr-2018 09:32:35 UTC] PHP Warning: include(/spacejewel-ipn-communicator/source/config.php): failed to open stream: No such file or directory in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:32:35 UTC] PHP Stack trace:
[12-Apr-2018 09:32:35 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:32:35 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:32:35 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:32:35 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:32:35 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:32:35 UTC] PHP Warning: include(): Failed opening '/spacejewel-ipn-communicator/source/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:32:35 UTC] PHP Stack trace:
[12-Apr-2018 09:32:35 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:32:35 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:32:35 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:32:35 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:32:35 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:32:35 UTC] PHP Fatal error: Using $this when not in object context in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 22
[12-Apr-2018 09:32:35 UTC] PHP Stack trace:
[12-Apr-2018 09:32:35 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:32:35 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:32:35 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:32:35 UTC] PHP 4. Config::getConfig() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:33
[12-Apr-2018 09:37:22 UTC] PHP Warning: include(/home/ubuntu/workspace/spacejewel-ipn-communicator/source/config.php): failed to open stream: No such file or directory in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:37:22 UTC] PHP Stack trace:
[12-Apr-2018 09:37:22 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:37:22 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:37:22 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:37:22 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:37:22 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:37:22 UTC] PHP Warning: include(): Failed opening '/home/ubuntu/workspace/spacejewel-ipn-communicator/source/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:37:22 UTC] PHP Stack trace:
[12-Apr-2018 09:37:22 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:37:22 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:37:22 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:37:22 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:37:22 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:37:23 UTC] PHP Warning: gnupg::import() expects exactly 1 parameter, 2 given in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php on line 33
[12-Apr-2018 09:37:23 UTC] PHP Stack trace:
[12-Apr-2018 09:37:23 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:37:23 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:37:23 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:37:23 UTC] PHP 4. gnupg->import() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:33
[12-Apr-2018 09:37:23 UTC] PHP Warning: gnupg::import() expects exactly 1 parameter, 2 given in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php on line 34
[12-Apr-2018 09:37:23 UTC] PHP Stack trace:
[12-Apr-2018 09:37:23 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:37:23 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:37:23 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:37:23 UTC] PHP 4. gnupg->import() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:34
[12-Apr-2018 09:38:08 UTC] PHP Warning: include(/home/ubuntu/workspace/spacejewel-ipn-communicator/source/config.php): failed to open stream: No such file or directory in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:38:08 UTC] PHP Stack trace:
[12-Apr-2018 09:38:08 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:38:08 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:38:08 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:38:08 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:38:08 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:38:08 UTC] PHP Warning: include(): Failed opening '/home/ubuntu/workspace/spacejewel-ipn-communicator/source/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:38:08 UTC] PHP Stack trace:
[12-Apr-2018 09:38:08 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:38:08 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:38:08 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:38:08 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:38:08 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:38:09 UTC] PHP Warning: gnupg::import() expects exactly 1 parameter, 2 given in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php on line 33
[12-Apr-2018 09:38:09 UTC] PHP Stack trace:
[12-Apr-2018 09:38:09 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:38:09 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:38:09 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:38:09 UTC] PHP 4. gnupg->import() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:33
[12-Apr-2018 09:38:09 UTC] PHP Warning: gnupg::import() expects exactly 1 parameter, 2 given in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php on line 34
[12-Apr-2018 09:38:09 UTC] PHP Stack trace:
[12-Apr-2018 09:38:09 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:38:09 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:38:09 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:38:09 UTC] PHP 4. gnupg->import() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:34
[12-Apr-2018 09:40:27 UTC] PHP Warning: include(/home/ubuntu/workspace/spacejewel-ipn-communicator/source/config.php): failed to open stream: No such file or directory in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:40:27 UTC] PHP Stack trace:
[12-Apr-2018 09:40:27 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:40:27 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:40:27 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:40:27 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:40:27 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 09:40:27 UTC] PHP Warning: include(): Failed opening '/home/ubuntu/workspace/spacejewel-ipn-communicator/source/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 09:40:27 UTC] PHP Stack trace:
[12-Apr-2018 09:40:27 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 09:40:27 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 09:40:27 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 09:40:27 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 09:40:27 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 12:12:04 UTC] PHP Warning: include(/home/ubuntu/workspace/spacejewel-ipn-communicator/source/config.php): failed to open stream: No such file or directory in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 12:12:04 UTC] PHP Stack trace:
[12-Apr-2018 12:12:04 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 12:12:04 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 12:12:04 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 12:12:04 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 12:12:04 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 12:12:04 UTC] PHP Warning: include(): Failed opening '/home/ubuntu/workspace/spacejewel-ipn-communicator/source/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/ubuntu/workspace/source/helpers/ConfigHelper/class.Config.php on line 13
[12-Apr-2018 12:12:04 UTC] PHP Stack trace:
[12-Apr-2018 12:12:04 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 12:12:04 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 12:12:04 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 12:12:04 UTC] PHP 4. Encryption->loadPGP() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:31
[12-Apr-2018 12:12:04 UTC] PHP 5. Config->__construct() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:23
[12-Apr-2018 12:14:49 UTC] PHP Fatal error: Call to a member function getConfig() on a non-object in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php on line 31
[12-Apr-2018 12:14:49 UTC] PHP Stack trace:
[12-Apr-2018 12:14:49 UTC] PHP 1. {main}() /home/ubuntu/workspace/testing/index.php:0
[12-Apr-2018 12:14:49 UTC] PHP 2. Encryption->init() /home/ubuntu/workspace/testing/index.php:8
[12-Apr-2018 12:14:49 UTC] PHP 3. Encryption->loadKeys() /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:18
[12-Apr-2018 12:29:30 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/gnupg.so' - /usr/lib/php/20151012/gnupg.so: cannot open shared object file: No such file or directory in Unknown on line 0
[12-Apr-2018 12:29:47 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/gnupg.so' - /usr/lib/php/20151012/gnupg.so: cannot open shared object file: No such file or directory in Unknown on line 0
[12-Apr-2018 12:29:47 UTC] PHP Parse error: syntax error, unexpected 'new' (T_NEW) in /usr/share/php/PEAR/Frontend.php on line 91
[12-Apr-2018 12:30:16 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/gnupg.so' - /usr/lib/php/20151012/gnupg.so: cannot open shared object file: No such file or directory in Unknown on line 0
[12-Apr-2018 12:30:17 UTC] PHP Parse error: syntax error, unexpected 'new' (T_NEW) in /usr/share/php/PEAR/Frontend.php on line 91
[12-Apr-2018 12:30:22 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/gnupg.so' - /usr/lib/php/20151012/gnupg.so: cannot open shared object file: No such file or directory in Unknown on line 0
[12-Apr-2018 12:30:22 UTC] PHP Parse error: syntax error, unexpected 'new' (T_NEW) in /usr/share/php/PEAR/Frontend.php on line 91
[12-Apr-2018 12:31:03 UTC] PHP Fatal error: Uncaught Error: Class 'gnupg' not found in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:24
Stack trace:
#0 /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php(32): Encryption->loadPGP()
#1 /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php(18): Encryption->loadKeys()
#2 /home/ubuntu/workspace/testing/index.php(8): Encryption->init()
#3 {main}
thrown in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php on line 24
[12-Apr-2018 12:31:34 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/gnupg.so' - /usr/lib/php/20151012/gnupg.so: cannot open shared object file: No such file or directory in Unknown on line 0
[12-Apr-2018 12:32:59 UTC] PHP Fatal error: Uncaught Error: Class 'gnupg' not found in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:24
Stack trace:
#0 /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php(32): Encryption->loadPGP()
#1 /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php(18): Encryption->loadKeys()
#2 /home/ubuntu/workspace/testing/index.php(8): Encryption->init()
#3 {main}
thrown in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php on line 24
[12-Apr-2018 12:34:57 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/gnupg.so' - /usr/lib/php/20151012/gnupg.so: cannot open shared object file: No such file or directory in Unknown on line 0
[12-Apr-2018 12:35:19 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/gnupg.so' - /usr/lib/php/20151012/gnupg.so: cannot open shared object file: No such file or directory in Unknown on line 0
[12-Apr-2018 12:37:45 UTC] PHP Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0
[12-Apr-2018 12:41:11 UTC] PHP Fatal error: Uncaught Error: Class 'gnupg' not found in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php:24
Stack trace:
#0 /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php(32): Encryption->loadPGP()
#1 /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php(18): Encryption->loadKeys()
#2 /home/ubuntu/workspace/testing/index.php(8): Encryption->init()
#3 {main}
thrown in /home/ubuntu/workspace/source/helpers/EncryptionHelper/class.Encryption.php on line 24
[12-Apr-2018 12:48:43 UTC] PHP Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0
[12-Apr-2018 12:48:45 UTC] PHP Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0
[12-Apr-2018 12:48:51 UTC] PHP Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0

3
phpinfo.php Normal file
View File

@ -0,0 +1,3 @@
<?php
phpinfo();

6
public/index.php Normal file
View File

@ -0,0 +1,6 @@
<?php
$App = new \Slim\App();
$App->post("/api/paddle/{authkey}/hook");

10
source/boot.php Normal file
View File

@ -0,0 +1,10 @@
<?php
$ROOT = $_SERVER['DOCUMENT_ROOT'];
error_reporting(E_ALL);
ini_set('display_errors', 1);
require $ROOT . "/vendor/autoload.php";
// Other load tasks here

50
source/config.php Normal file
View File

@ -0,0 +1,50 @@
<?php
// Keep things simple for simplicity's sake. We can't waste too much time.
// Wrap this around an helper class
return [
"mainconfig" =>
[
"appname" => "SG-Gateway",
"appversion" => "alpha 1.0",
"operationmode" => "development"
],
"core" =>
[
"database" =>
[
"username" => "",
"password" => "password",
"hostname" => "hostname",
"port" => "port",
"dbname" => "db"
],
"virtualmin" =>
[
"vmin-url" => "",
"password" => "",
"username" => ""
],
"templates" =>
[
"templateDirectory" => $_SERVER['DOCUMENT_ROOT'] . '/source/emailTemplates'
],
"mailer" =>
[
"username" => "0bffccb77f9228",
"password" => "bbd994d1500dab",
"hostname" => " smtp.mailtrap.io",
"port" => 2525
]
]
];

View File

@ -0,0 +1,103 @@
<?php
class Application
{
private $database = [];
private $db;
public function __construct()
{
$config = new Config();
$this->database['username'] = $config['core']['database']['username'];
$this->database['password'] = $config['core']['database']['password'];
$this->database['hostname'] = $config['core']['database']['hostname'];
$this->database['dbname'] = $config['core']['database']['dbname'];
$this->db = instDB();
}
protected function instDB()
{
return \ParagonIE\EasyDB\Factory::create(
'mysql:host=' . $this->database['hostname'] . ';dbname=' . $this->database['dbname'],
$this->database['username'],
$this->database['password']
);
}
//
public function Exists($Table, $IDRowColumnName, $SearchValue)
{
$exists = $db->cell(
"SELECT count(ID) FROM $Table WHERE $IDRowColumnName = ?",
$SearhValue
);
// Query might not return what we're looking for, an integer. Use vardump if otherwise.
return ($exists == 1) ? true : false;
}
public function adminExists($AdminID)
{
$this->Exists("Administrators", "ID", $ID);
}
public function addAdministrator($Username, $Name, $Email, $Password, $KeyID)
{
$this->db->insert('Administrators', [
'AdministratorName' => $Name,
'AdministratorUsername' => $Username,
'AdministratorEmail' => $Email,
'AdministratorPassword' => $Password
]);
}
public function listAdminsByName($AdminUsername)
{
$Admin = $this->db->row(
"SELECT * FROM Administrators WHERE Username = ?",
$Username
);
}
public function addKey($AdminID, $Keyname)
{
$key = password_hash(openssl_random_pseudo_bytes(32), PASSWORD_BCYPT);
$this->db->insert('APIKeys', [
'AdminID' => $AdminID,
'Keyname' => $Keyname,
'Keytext' => $key
]);
return $key;
}
public function ApiKeyExists($AdminID)
{
$this->Exists("APIKeys", "AdminID", $AdminID);
}
public function ApiKeyToAdminId($Key)
{
$apiKey = $this->db->row(
"SELECT * FROM APIKeys WHERE Keytext = ?",
$Key
);
// Expecting an array. Var dump if else
if ($apiKey == null && !is_array($apiKey))
{
throw new LogicException("Illegal data from DB: ApiKeyToAdminId");
}
}
}

View File

@ -0,0 +1,56 @@
<?php
// Because the key is hashed in the database for security, we can't verify it directly.
// Without hashing, verifaction could've been done in one step, but GDPR makes this an obligation.
/*
So this is like an application behind a password wall. Usually, keys aren't hashed and
verified directly using only it's text.
Due to GDPR, we are forced to obscure sensitive data like the user's APIKey.
*/
class ApplicationAPI extends Application
{
private $gDatabase;
private $AdminID;
public function __construct($AdminID)
{
$this->AdminID = $AdminID;
$this->gDatabase = parent::instDB();
if (!$this->ApiKeyExists($AdminID))
{
throw new LogicException("This administrator doesn't have an API key.");
}
}
private function getKeyRecord()
{
$AdminID = $this->AdminID;
$record = $this->gDatabase->row(
"SELECT * FROM APIKeys WHERE AdminID = ?",
$AdminID
);
return $record;
}
public function keysMatch($givenKey)
{
return (password_verify($givenKey, $this->getKeyRecord()['Keytext'])) ? true : false;
}
}

View File

@ -0,0 +1,97 @@
<?php
class Customer extends Application
{
private $Virtualmin;
public function __construct()
{
parent::_construct();
$this->Virtualmin = new VirtualminHandler();
}
// By default, this function sets the customer as inactive (e.g. newly created, awating payment)
// Returns the customer's hosting password
public function newCustomer($Domain, $Name, $Email, $CheckoutID, $SubscriptionStatus, $Package, $PaddleSubscriptionID, $SystemStatus, $GDPRConsent, $hasVirtualServer = false, $attachedVServerID = null)
{
$passwordFactory = new RandomLib\Factory();
$pGen = $passwordFactory->getLowStrengthGenerator();
$this->db->insert('Customers', [
'CustomerName' => $Name,
'CustomerEmail' => $Email,
'CustomerCheckoutID' => $CheckoutID,
'Package' => $Package,
'SubscriptionStatus' => $SubscriptionStatus,
'PaddleSubscriptionID' => $PaddleSubscriptionID,
'SystemStatus' => $SystemStatus,
'GDPRConsent' => $GDPRConsent,
'hasVirtualServer' => $hasVirtualServer,
'attachedVServerID' => $attachedVServerID,
'PAC' => $pGen->generate(4)
]);
$cPassword = $pGen->generate(16);
$this->Virtualmin->CreateVirtualServer($Domain, $cPassword);
return $cPassword;
}
public function updateCustomerInformation($CustomerID, $UpdateField, $NewValue)
{
$db->update('Customers', [
$UpdateField => $NewValue
], [
'ID' => $CustomerID
]);
}
public function eraseCustomer($CustomerID)
{
// Virtualmin: Delete virutal server attached to customer
$db->delete('Customers', [
'ID' => $CustomerID
]);
}
public function listCustomersByEmail($CEmail)
{
$Customer = $this->db->row(
"SELECT * FROM Customers WHERE CustomerEmail = ?",
$CEmail
);
return $Customer
}
public function translateEmailToID($Email)
{
$Customer = $this->listCustomersByEmail($Email);
return $Customer['ID'];
}
public function customerExists($CustomerEmail)
{
return $this->Exists("Customers", "CustomerEmail", $CustomerEmail);
}
public function getCustomerGDPRConsent($CustomerEmail)
{
$Customer = $this->listCustomersByEmail($CustomerEmail);
// assume this returns an array. do var_dump($Customer) if not
return $Customer['GDPRConsent'];
}
public function populate
}

View File

@ -0,0 +1,30 @@
<?php
class Auth
{
public $AdminID;
private $ApiTools;
public function __construct($AdminID)
{
$this->ApiTools = new ApplicationAPI($AdminID);
$this->AdminID = $AdminID;
}
public function Auth($key)
{
if ($this->ApiTools->keysMatch($key))
{
return true;
}
else
{
throw new Exception("FATAL: Invalid API key");
}
}
}

View File

@ -0,0 +1,85 @@
<?php // THIS CLASS ENFORCES GDPR COMPLIANCE. USING A WORKAROUND FOR THIS CONSTITUTES A VIOLATION OF THE SPACEJEWEL TERMS OF SERVICE.
// This mailer won't let you mail anyone unless they are registered as a customer to prevent GDPR violation.
// Additionally, it doesn't let you send anything else other than mandatory email (like service downtime notifications) unless
// they explicitly provided GDPR consent
class Emailer
{
private $Customer;
private $CustomerEmail;
private $CustomerID;
private $Envelope;
private $Mailer;
// Initialize mailer for this customer ID
public function __construct($CustomerEmail)
{
$this->Customer = new Customer();
// WARNIMG: Function might return wrong data, use var_dump to inspect
$CID = $this->Customer->translateEmailToID($CustomerEmail);
$this->CustomerId = $CID;
// We might want to use $CID in this method, so shortening isn't feasible here
if(!$this->Customer->customerExists($CustomerEmail))
{
// Customer doesn't exist, fail here
throw new Exception("Fatal error! Sending an email to an unregistered person is not allowed (GDPR Error Code: #1). A customer can be registered by purchasing a subscription");
}
$this->prepareMailerEnvelope();
}
private function prepareMailerEnvelope()
{
$config = new Config();
$username = $Config['mailer']['username'];
$password = $Config['mailer']['password'];
$hostname = $Config['mailer']['hostname'];
$port = $Config['mailer']['port'];
$connStr = 'tls://' . $username . ":" . $password . "@" . $hostname . ":" . $port;
$this->Envelope = new ByJG\Mail\Envelope();
\ByJG\Mail\MailerFactory::registerMailer('smtp', \ByJG\Mail\Wrapper\PHPMailerWrapper::class);
$this->Mailer = \ByJG\Mail\MailerFactory::create($connStr);
$this->Mailer->setFrom("noreply@spacejewel.ga", "Spacejewel Billing System");
$this->Mailer->addTo($this->CustomerEmail);
}
public function addSubject($subject)
{
$this->Mailer->setSubject($subject);
}
public function setBody($body)
{
$this->Mailer->setBody($body);
}
public function sendEnvelope()
{
$Mailer->send($this->Envelope);
}
}

View File

@ -0,0 +1,55 @@
<?php
// The hookmanager is the web-exposed class that allows you to manage a user within the billing system.
// This system takes care of CRUD operations on customers. It doesn't keep track of order but it does suspend
// you if you don't pay.
class Hookmanager
{
public function EventSubscriptionCreated()
{
}
public function EventSubscriptionUpdated()
{
// Update user information if necessary
}
public function EventSubscriptionCancelled()
{
// Suspend user's domain name as stated on DB
// Delete after 30 days
}
public function EventSubscriptionPaymentSuccess()
{
// Renew user's subscription within billing system
// Install hosting account if this is the user's first time and send out instructions email
}
// TODO: Lenient business logic
public function EventSubscriptionPaymentFailed()
{
// Add payment strike to user account
// After three strikes, warn user that the system has waived further attempts. Suspend their account
// Give user an ultimatum: Pay or remain suspended
// If user fails to pay during the next 7 days, permanently suspend their account (Reject further payments. Remove user from paddle first)
// If payment is successful afterwards, remove all payment strikes (Success logic should execute automatically)
}
public function EventSubscriptionPaymentRefunded()
{
// Ban customer from billing system
// Delete all customer data
}
}

View File

@ -0,0 +1,64 @@
<?php
/*
*
* This class is part of the Application core logic, since it handles customer packages.
*
*/
class Package extends Application
{
const PACKAGE_STARTER = "P_STARTER";
const PACKAGE_SMALLCOMPANY = "P_SCOMPANY";
const PACKAGE_PROFESSIONAL = "P_PROFESSIONAL";
const PACKAGE_ENTERPRISE = "P_ENTERPRISE";
const PACKAGE_UNLIMITED = "P_UNLIMITED";
private $allowedPackages =
[
"P_STARTER",
"P_SMALLCOMPANY",
"P_PROFESSIONAL",
"P_ENTERPRISE",
"P_UNLIMITED"
];
private $AdminID;
public function __construct()
{
$this->AdminID = $AdminID;
}
public function getDefaultOptionsArray()
{
return
[
"desc" => "Created by Spacejewel Billing System",
"dir",
"unix",
"webmin",
"web",
"dns",
"mail",
"ssl",
"spam",
"virus"
"limits-from-plan"
];
}
}

View File

@ -0,0 +1,44 @@
<?php
class EmailRenderer
{
private $templateDir;
public $twig;
public $tmeplateList = [
"accountBillingInformation",
"accountCancellationNotice",
"accountInformationUpdated",
"accountInstallation",
"accountRefunded",
"accounSubscriptionPaymentFailed"
];
public function __construct()
{
$config = new Config();
$loader = new Twig_Loader_Filesystem($config['templates']['templatesDirectory']);
$this->twig = new Twig_Environment($loader);
}
public function renderTemplate($Tmpl, Array $Data)
{
// $Data is an associative array of data
if(!in_array($this->templateList, $Tmpl))
{
throw new Exception("WARNING: Selected template not available");
}
else
{
return $this->twig->render($Tmpl, $Data);
}
}
}

View File

@ -0,0 +1,113 @@
<?php
use \HnhDigital\Virtualmin as Virtualmin;
// This class serves as a mini wrapper to HnhDigital's wrapper class.
// It takes the methods it needs and proxies them for applicational use.
class VirtualminHandler
{
private $virtualmin;
public function __construct()
{
$Config = new Config();
$url = $Config['vmin-url'];
$username = $Config['username'];
$password = $Config['password'];
$this->virtualmin = new Virtualmin\VirtualServersClient($url, $username, $password);
}
// Creates a domain with the specified password. The username will be the domain with the .tld removed.
// The features array will be populated when the method is exposed with the correct package name provided.
public function CreateVirtualServer($DomainName, $Password, Array $Features = [])
{
return $this->virtualmin->create($DomainName, $Password, $Features);
}
public function DeleteVirtualServer($DomainName)
{
return $this->virtualmin->delete($DomainName);
}
// NOTICE! This deletes all domain names linked to a user account. This action is IRREVERSIBLE!
public function DeleteAllFromUser($User)
{
return $this->virtualmin->deleteByUser($User);
}
public function SuspendVirtualServer($DomainName, $SuspensionReason)
{
// TODO: Flag account as inactive within system's database (At Hookmanager class)
return $this->virtualmin->suspend($DomainName, $SuspensionReason);
}
public function DisableFeature($DomainName, $FeatureName)
{
return $this->virtualmin->disableFeatureByDomain($DomainName, $FeatureName);
}
// Deattaches all features from all domains by this user
public function DisableFeaturesByUser($Username, $Features)
{
return $this->virtualmin->disableFeatureByUser($Username, $Feature);
}
public function DisableFeatureFromAllDomains($FeatureName)
{
return $this->virtualmin->disableFeatureAllDomains($Feature);
}
public function EnableFeatureByDomain($Domain, $Feature)
{
return $this->virtualmin->enableFeatureByDomain($Domain, $Feature);
}
public function enableFeatureByUser($User, $Feature)
{
return $this->virtualmin->enableFeatureByUser($User, $Feature);
}
public function enableFeatureAllDomains($Feature)
{
return $this->virtualmin->enableFeatureAllDomains($Feature);
}
// SPECIAL: GDPR READINESS
// This
public function modifyDomain($Domain, Array $ModifiableOptions)
{
$optionsArr =
[
"domain" => $Domain
]
return $this->virtualmin->modifyDomain(array_merge($optionsArr, $ModifiableOptions));
}
}

View File

@ -0,0 +1,34 @@
<html>
<head>
<meta charset="utf-8">
<title>Spacejewel Hosting - Hosting Account Installation</title>
</head>
<body>
</pre>
Hello {{ Name }},
As per your subscription at Spacejewel Hosting, here are some critial pieces of information you might need:
Your subscription ID: {{ SubscriptionID }}
Price per month: {{ MonthlyPrice }}
Status: {{ SubscriptionStatus }}
Personal Access Code (PAC): {{ PAC }}
Manage your subscription: {{ SubscriptionManageLink }}
You will need your subscription ID and your personal access code to access the subscription mangement system.
Warm regards,
Spacejewel Billing System
</pre>
</body>
</html>

View File

@ -0,0 +1,36 @@
<html>
<head>
<title>Spacejewel Hosting - Account Cancellation</title>
</head>
<body>
Hello there {{ Name }},
Unfortunately, we have received a request to cancel your account.
You will not be billed anymore after the end of this billing period, at which your account will be permanently
suspended.
It is worth noting that all of your website data will be deleted after thirty days.
NOTE: Your account may also have been suspended due to lack of payment during three consecutive days. Other suspension
reasons include requesting a chargeback from your bank (All chargebacks are treated as fraudulent and reported to the authorities).
You can reactivate your account in this case my messaging support.
Your subscription ID: {{ SubscriptionID }}
We hope to see you again! Your GDPR consent has also been removed.
Kind regards,
Spacejewel Billing System
</body>
</html>

View File

@ -0,0 +1,25 @@
<html>
<head>
<title>Spacejewel Hosting - Account Information Updated</title>
</head>
<body>
<pre>
Hello there {{ Name }},
We have received a request to update your customer information present in our database.
The information you updated previously has been refreshed on all our services.
Regards,
Spacejewel Billing System
</pre>
</body>
</html>

View File

@ -0,0 +1,39 @@
<html>
<head>
<meta charset="utf-8">
<title>Spacejewel Hosting - Hosting Account Installation</title>
</head>
<body>
<p>Well hello there, {{ Name }}! It seems you have purchased a Spacejewel Hosting subscription ({{ PackageName }}). Thank you!</p>
<pre>
You can now login to your Hosting control panel (Virtualmin) with the following credentials.
Username: {{ Username }}
Password: {{ Password }}
Login link: {{ Loginlink }}
Webmail link: {{ WebmailLink }}
Please note that you will be forced to change your password when you first login. This is for security purposes,
since sending passwords over email isn't a very good idea.
Please note that our system (webmin@spacejewel.ga) will send you an email shortly about your new account, so don't worry about it.
Welcome on board by the way! If you have any questions, don't hesitate to contact support, either by mailing the friendly folks over at
support@spacejewel.ga or using the nifty chat balloon at our website.
P.S. Our billing system will send you an email again about your subscription information, so that you can cancel anytime you wish or consult information.
Warm regards,
Spacejewel Billing System
</pre>
</body>
</html>

View File

@ -0,0 +1,30 @@
<html>
<head>
<title>Spacejewel Hosting - Refund Request</title>
</head>
<body>
Hello there {{ Name }},
Unfortunately, we have received a request to issue a refund.
Please note that refund requests are manually verified by Spacejewel staff and approved accordingly.
This may take up to 24 hours to complete.
If your refund is approved, it may take 48 hours for the funds to be credited into your Paypal account
or three to four business day in the case you used a credit card.
Usually, all refunds are approved but this is not always the case.
Kind regards,
Spacejewel Billing System
</body>
</html>

View File

@ -0,0 +1,28 @@
<html>
<head>
<title>Spacejewel Hosting - Subscription Renewel Failed</title>
</head>
<body>
<pre>
Hello there {{ Name }},
We have attempted to charge your credit card in order to regularize your subscription ID {{ SubscriptionID }}.
The credit card was declined (Or the Paypal account did not have enough funds).
Please be advised that after three failed attempts over three days will result in account suspension.
Regards,
Spacejewel Billing System
</pre>
</body>
</html>

View File

@ -0,0 +1,25 @@
<?php
class Config
{
public $config;
// Load configuration and upload it to the main class elements
public function __construct()
{
$ROOT = $_SERVER['DOCUMENT_ROOT'];
$config = $ROOT . "/source/config.php";
$c = include($config);
$this->config = $c;
}
public function getConfig()
{
return $this->config;
}
}

3
testing/index.php Normal file
View File

@ -0,0 +1,3 @@
<?php
require $_SERVER['DOCUMENT_ROOT'] . '/source/boot.php';