Skip to content

Commit

Permalink
Use composer for third party libs
Browse files Browse the repository at this point in the history
  • Loading branch information
joszz committed Jun 17, 2021
1 parent 18529f6 commit 05ab800
Show file tree
Hide file tree
Showing 43 changed files with 312 additions and 36,277 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -54,6 +54,7 @@ SyncToy_*.dat
*.v12.suo
generate-doc.*
.vs/
app/vendor/
app/config/config.ini
logs/
phalcon-stubs/
Expand Down
19 changes: 13 additions & 6 deletions app/FrontController.php
Expand Up @@ -7,8 +7,6 @@
use Chell\Controllers\ErrorController;
use Chell\Exceptions\ChellException;
use Chell\Messages\TranslatorWrapper;
use Chell\Models\Settings;
use Chell\Models\SettingsCategory;
use Chell\Models\SettingsContainer;
use Chell\Plugins\SecurityPlugin;

Expand Down Expand Up @@ -108,6 +106,9 @@ function dump($dump)
$this->setTranslator();
}

/**
* Initializes PHP exception handler to Chell's custom handler.
*/
private function setExceptionHandler()
{
set_exception_handler([&$this, 'ExceptionHandler']);
Expand All @@ -130,6 +131,9 @@ public function ExceptionHandler(Throwable $exception)
new ErrorController(new ChellException($exception));
}

/**
* Sets Phalcon's dispatcher and a beforeExecuteRoute to setup the SecurityPlugin, which enforces logins.
*/
private function setDispatcher()
{
$this->di->set('dispatcher', function () {
Expand All @@ -144,6 +148,9 @@ private function setDispatcher()
});
}

/**
* Sets up Phalcon's crypt, whith the in settings defined crypt key. Used for encrypting/decrypting password for example.
*/
private function setCrypt()
{
$settings = $this->settings;
Expand Down Expand Up @@ -180,10 +187,10 @@ private function registerNamespaces()
'Chell\Models' => APP_PATH . 'app/models/',
'Chell\Models\Kodi' => APP_PATH . 'app/models/kodi/',
'Chell\Plugins' => APP_PATH . 'app/plugins/',
'Duo' => APP_PATH . 'app/vendor/duo/',
'Davidearl\WebAuthn' => APP_PATH . 'app/vendor/WebAuthn/',
'CBOR' => APP_PATH . 'app/vendor/CBOR/',
'phpseclib' => APP_PATH . 'app/vendor/phpseclib/'
'Duo' => APP_PATH . 'app/vendor/duosecurity/duo_php/src/',
'Davidearl\WebAuthn' => APP_PATH . 'app/vendor/davidearl/webauthn/WebAuthn',
'CBOR' => APP_PATH . 'app/vendor/2tvenom/cborencode/src',
'phpseclib' => APP_PATH . 'app/vendor/phpseclib/phpseclib/phpseclib/'
])->register();
}

Expand Down
7 changes: 7 additions & 0 deletions app/composer.json
@@ -0,0 +1,7 @@
{
"require": {
"2tvenom/cborencode": "^1.0",
"davidearl/webauthn": "dev-master",
"duosecurity/duo_php": "^1.0"
}
}
260 changes: 260 additions & 0 deletions app/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion app/controllers/DatabaseStatsController.php
Expand Up @@ -5,12 +5,15 @@
use Chell\Models\DatabaseStats;

/**
* The controller responsible for all MySQL related actions.
* The controller responsible for all database statistic related actions.
*
* @package Controllers
*/
class DatabaseStatsController extends BaseController
{
/**
* Sends the database stats as JSON to be consumed by AJAX in the frontend.
*/
public function indexAction()
{
$this->view->disable();
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/DevicesController.php
Expand Up @@ -11,6 +11,9 @@
*/
class DevicesController extends BaseController
{
/**
* Initializes the controller, disabling the view for all actions/
*/
public function initialize()
{
parent::initialize();
Expand Down
2 changes: 1 addition & 1 deletion app/models/BaseModel.php
Expand Up @@ -17,7 +17,7 @@ class BaseModel extends Model
protected Url $url;

/**
* Sets the database relations
* Initializes the model, getting settings and creating a new Url object.
*/
public function initialize()
{
Expand Down
8 changes: 6 additions & 2 deletions app/models/DatabaseStats.php
Expand Up @@ -2,16 +2,20 @@

namespace Chell\Models;

use DateTime;
use PDO;

/**
* The model responsible for all actions related to MySQL.
* The model responsible for all actions related to database statistics.
*
* @package Models
*/
class DatabaseStats extends BaseModel
{
/**
* Retrieves the database statistics as an array, where key is the statistic name, and the value is the value of the statistic.
*
* @return string[] The database statistics as an array.
*/
public function getStats() : array
{
$stats = $this->di->get('db')->getInternalHandler()->getAttribute(PDO::ATTR_SERVER_INFO);
Expand Down
2 changes: 2 additions & 0 deletions app/models/PHPSysInfo.php
Expand Up @@ -2,6 +2,8 @@

namespace Chell\Models;

use Phalcon\Http\Request;

/**
* The model responsible for all actions related to PHPSysinfo.
*
Expand Down

0 comments on commit 05ab800

Please sign in to comment.