Skip to content

Commit 05ab800

Browse files
committed
Use composer for third party libs
1 parent 18529f6 commit 05ab800

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+312
-36277
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ SyncToy_*.dat
5454
*.v12.suo
5555
generate-doc.*
5656
.vs/
57+
app/vendor/
5758
app/config/config.ini
5859
logs/
5960
phalcon-stubs/

app/FrontController.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
use Chell\Controllers\ErrorController;
88
use Chell\Exceptions\ChellException;
99
use Chell\Messages\TranslatorWrapper;
10-
use Chell\Models\Settings;
11-
use Chell\Models\SettingsCategory;
1210
use Chell\Models\SettingsContainer;
1311
use Chell\Plugins\SecurityPlugin;
1412

@@ -108,6 +106,9 @@ function dump($dump)
108106
$this->setTranslator();
109107
}
110108

109+
/**
110+
* Initializes PHP exception handler to Chell's custom handler.
111+
*/
111112
private function setExceptionHandler()
112113
{
113114
set_exception_handler([&$this, 'ExceptionHandler']);
@@ -130,6 +131,9 @@ public function ExceptionHandler(Throwable $exception)
130131
new ErrorController(new ChellException($exception));
131132
}
132133

134+
/**
135+
* Sets Phalcon's dispatcher and a beforeExecuteRoute to setup the SecurityPlugin, which enforces logins.
136+
*/
133137
private function setDispatcher()
134138
{
135139
$this->di->set('dispatcher', function () {
@@ -144,6 +148,9 @@ private function setDispatcher()
144148
});
145149
}
146150

151+
/**
152+
* Sets up Phalcon's crypt, whith the in settings defined crypt key. Used for encrypting/decrypting password for example.
153+
*/
147154
private function setCrypt()
148155
{
149156
$settings = $this->settings;
@@ -180,10 +187,10 @@ private function registerNamespaces()
180187
'Chell\Models' => APP_PATH . 'app/models/',
181188
'Chell\Models\Kodi' => APP_PATH . 'app/models/kodi/',
182189
'Chell\Plugins' => APP_PATH . 'app/plugins/',
183-
'Duo' => APP_PATH . 'app/vendor/duo/',
184-
'Davidearl\WebAuthn' => APP_PATH . 'app/vendor/WebAuthn/',
185-
'CBOR' => APP_PATH . 'app/vendor/CBOR/',
186-
'phpseclib' => APP_PATH . 'app/vendor/phpseclib/'
190+
'Duo' => APP_PATH . 'app/vendor/duosecurity/duo_php/src/',
191+
'Davidearl\WebAuthn' => APP_PATH . 'app/vendor/davidearl/webauthn/WebAuthn',
192+
'CBOR' => APP_PATH . 'app/vendor/2tvenom/cborencode/src',
193+
'phpseclib' => APP_PATH . 'app/vendor/phpseclib/phpseclib/phpseclib/'
187194
])->register();
188195
}
189196

app/composer.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"require": {
3+
"2tvenom/cborencode": "^1.0",
4+
"davidearl/webauthn": "dev-master",
5+
"duosecurity/duo_php": "^1.0"
6+
}
7+
}

app/composer.lock

Lines changed: 260 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controllers/DatabaseStatsController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
use Chell\Models\DatabaseStats;
66

77
/**
8-
* The controller responsible for all MySQL related actions.
8+
* The controller responsible for all database statistic related actions.
99
*
1010
* @package Controllers
1111
*/
1212
class DatabaseStatsController extends BaseController
1313
{
14+
/**
15+
* Sends the database stats as JSON to be consumed by AJAX in the frontend.
16+
*/
1417
public function indexAction()
1518
{
1619
$this->view->disable();

app/controllers/DevicesController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/
1212
class DevicesController extends BaseController
1313
{
14+
/**
15+
* Initializes the controller, disabling the view for all actions/
16+
*/
1417
public function initialize()
1518
{
1619
parent::initialize();

app/models/BaseModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class BaseModel extends Model
1717
protected Url $url;
1818

1919
/**
20-
* Sets the database relations
20+
* Initializes the model, getting settings and creating a new Url object.
2121
*/
2222
public function initialize()
2323
{

app/models/DatabaseStats.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@
22

33
namespace Chell\Models;
44

5-
use DateTime;
65
use PDO;
76

87
/**
9-
* The model responsible for all actions related to MySQL.
8+
* The model responsible for all actions related to database statistics.
109
*
1110
* @package Models
1211
*/
1312
class DatabaseStats extends BaseModel
1413
{
14+
/**
15+
* Retrieves the database statistics as an array, where key is the statistic name, and the value is the value of the statistic.
16+
*
17+
* @return string[] The database statistics as an array.
18+
*/
1519
public function getStats() : array
1620
{
1721
$stats = $this->di->get('db')->getInternalHandler()->getAttribute(PDO::ATTR_SERVER_INFO);

app/models/PHPSysInfo.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Chell\Models;
44

5+
use Phalcon\Http\Request;
6+
57
/**
68
* The model responsible for all actions related to PHPSysinfo.
79
*

0 commit comments

Comments
 (0)