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
|
|
|
|
20
|
|
|
namespace MikoPBX\Core\Workers\Libs\WorkerPrepareAdvices; |
21
|
|
|
|
22
|
|
|
use MikoPBX\Common\Models\NetworkFilters; |
23
|
|
|
use MikoPBX\Common\Models\PbxSettings; |
24
|
|
|
use Phalcon\Di\Injectable; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Class CheckFirewalls |
28
|
|
|
* This class is responsible for checking firewall status on backend. |
29
|
|
|
* |
30
|
|
|
* @package MikoPBX\Core\Workers\Libs\WorkerPrepareAdvices |
31
|
|
|
*/ |
32
|
|
|
class CheckFirewalls extends Injectable |
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* Check the firewall status. |
36
|
|
|
* |
37
|
|
|
* @return array An array containing warning messages. |
38
|
|
|
* |
39
|
|
|
*/ |
40
|
|
|
public function process(): array |
41
|
|
|
{ |
42
|
|
|
$messages = []; |
43
|
|
|
if (PbxSettings::getValueByKey('PBXFirewallEnabled') === '0' |
44
|
|
|
|| NetworkFilters::count() === 0 |
45
|
|
|
) { |
46
|
|
|
$messages['warning'][] = [ |
47
|
|
|
'messageTpl'=>'adv_FirewallDisabled', |
48
|
|
|
'messageParams'=>[ |
49
|
|
|
'url'=>$this->url->get('firewall/index/') |
50
|
|
|
] |
51
|
|
|
]; |
52
|
|
|
} |
53
|
|
|
return $messages; |
54
|
|
|
} |
55
|
|
|
} |