|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* MikoPBX - free phone system for small business |
|
4
|
|
|
* Copyright © 2017-2023 Alexey Portnov and Nikolay Beketov |
|
5
|
|
|
* |
|
6
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
7
|
|
|
* it under the terms of the GNU General Public License as published by |
|
8
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
|
9
|
|
|
* (at your option) any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* This program is distributed in the hope that it will be useful, |
|
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14
|
|
|
* GNU General Public License for more details. |
|
15
|
|
|
* |
|
16
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
|
17
|
|
|
* If not, see <https://www.gnu.org/licenses/>. |
|
18
|
|
|
*/ |
|
19
|
|
|
namespace MikoPBX\AdminCabinet; |
|
20
|
|
|
|
|
21
|
|
|
use MikoPBX\Common\Config\RegisterDIServices as RegisterCommonDIServices; |
|
22
|
|
|
use MikoPBX\Common\Handlers\CriticalErrorsHandler; |
|
23
|
|
|
use MikoPBX\Modules\PbxExtensionUtils; |
|
24
|
|
|
use Phalcon\Mvc\Application as BaseApplication; |
|
25
|
|
|
|
|
26
|
|
|
class Application extends BaseApplication |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* Register the services here to make them general or register in the ModuleDefinition to make them module-specific |
|
30
|
|
|
*/ |
|
31
|
|
|
protected function registerServices() |
|
32
|
|
|
{ |
|
33
|
|
|
|
|
34
|
|
|
$di = new \Phalcon\Di\FactoryDefault(); |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Auto-loader configuration |
|
38
|
|
|
*/ |
|
39
|
|
|
require_once __DIR__ . '/../../src/Common/Config/ClassLoader.php'; |
|
40
|
|
|
|
|
41
|
|
|
RegisterCommonDIServices::init($di); |
|
42
|
|
|
|
|
43
|
|
|
$this->setDI($di); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function main() |
|
47
|
|
|
{ |
|
48
|
|
|
$this->registerServices(); |
|
49
|
|
|
|
|
50
|
|
|
// Register the default modules |
|
51
|
|
|
$this->registerModules([ |
|
52
|
|
|
'admin-cabinet' => [ |
|
53
|
|
|
"className" => "MikoPBX\AdminCabinet\Module", |
|
54
|
|
|
"path" => __DIR__ . '/../../src/AdminCabinet/Module.php', |
|
55
|
|
|
], |
|
56
|
|
|
]); |
|
57
|
|
|
$this->setDefaultModule('admin-cabinet'); |
|
58
|
|
|
|
|
59
|
|
|
// Register additional app modules from external enabled modules |
|
60
|
|
|
PbxExtensionUtils::registerEnabledModulesInApp($this); |
|
61
|
|
|
|
|
62
|
|
|
try { |
|
63
|
|
|
echo $this->handle($_SERVER['REQUEST_URI'])->getContent(); |
|
64
|
|
|
} catch (\Throwable $e) { |
|
65
|
|
|
CriticalErrorsHandler::handleException($e); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
$application = new Application(); |
|
71
|
|
|
$application->main(); |
|
72
|
|
|
|