Passed
Push — master ( a2c24b...6427d5 )
by Nikolay
12:54 queued 08:08
created
src/AdminCabinet/Controllers/CallQueuesController.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -93,9 +93,9 @@
 block discarded – undo
93 93
 
94 94
         $form                        = new CallQueueEditForm(
95 95
             $queue, [
96
-                      'extensions' => $extensionList,
97
-                      'soundfiles' => $soundfilesList,
98
-                  ]
96
+                        'extensions' => $extensionList,
97
+                        'soundfiles' => $soundfilesList,
98
+                    ]
99 99
         );
100 100
         $this->view->form            = $form;
101 101
         $this->view->extensionsTable = $queueMembersList;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         $extensionList    = [];
39 39
         if ($queue === null) {
40 40
             $queue                              = new CallQueues();
41
-            $queue->uniqid                      = Extensions::TYPE_QUEUE . strtoupper('-' . md5($queue->id . time()));
41
+            $queue->uniqid                      = Extensions::TYPE_QUEUE.strtoupper('-'.md5($queue->id.time()));
42 42
             $queue->caller_hear                 = 'moh';
43 43
             $queue->seconds_to_ring_each_member = 20;
44 44
             $queue->seconds_for_wrapup          = 15;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                     'queue' => $queue->uniqid,
56 56
                 ],
57 57
             ];
58
-            $members    = CallQueueMembers::find($parameters);
58
+            $members = CallQueueMembers::find($parameters);
59 59
             foreach ($members as $member) {
60 60
                 $queueMembersList[] = [
61 61
                     'id'       => $member->id,
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             $soundfilesList[$soundFile->id] = $soundFile->name;
92 92
         }
93 93
 
94
-        $form                        = new CallQueueEditForm(
94
+        $form = new CallQueueEditForm(
95 95
             $queue, [
96 96
                       'extensions' => $extensionList,
97 97
                       'soundfiles' => $soundfilesList,
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function saveAction(): void
111 111
     {
112
-        if ( ! $this->request->isPost()) {
112
+        if (!$this->request->isPost()) {
113 113
             return;
114 114
         }
115 115
         $this->db->begin();
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         }
131 131
 
132 132
         // Заполним параметры внутреннего номера
133
-        if ( ! $this->updateExtension($extension, $data)) {
133
+        if (!$this->updateExtension($extension, $data)) {
134 134
             $this->view->success = false;
135 135
             $this->db->rollback();
136 136
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         }
139 139
 
140 140
         // Заполним параметры пользователя
141
-        if ( ! $this->updateQueue($queue, $data)) {
141
+        if (!$this->updateQueue($queue, $data)) {
142 142
             $this->view->success = false;
143 143
             $this->db->rollback();
144 144
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         }
147 147
 
148 148
         // Заполним параметры участников очереди
149
-        if ( ! $this->updateQueueMembers($data)) {
149
+        if (!$this->updateQueueMembers($data)) {
150 150
             $this->view->success = false;
151 151
             $this->db->rollback();
152 152
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
                 case "periodic_announce_sound_id":
215 215
                 case "redirect_to_extension_if_repeat_exceeded":
216 216
                 case "redirect_to_extension_if_empty":
217
-                    if ( ! array_key_exists($name, $data) || empty($data[$name])) {
217
+                    if (!array_key_exists($name, $data) || empty($data[$name])) {
218 218
                         $queue->$name = null;
219 219
                         continue 2;
220 220
                     }
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                     break;
224 224
                 case "timeout_to_redirect_to_extension":
225 225
                 case "number_unanswered_calls_to_redirect":
226
-                    if ( ! array_key_exists($name, $data)) {
226
+                    if (!array_key_exists($name, $data)) {
227 227
                         continue 2;
228 228
                     }
229 229
                     if (empty($data[$name])) {
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
                     }
234 234
                     break;
235 235
                 case "timeout_extension":
236
-                    if ( ! array_key_exists($name, $data)
236
+                    if (!array_key_exists($name, $data)
237 237
                         || empty($data[$name])
238 238
                         || (array_key_exists('timeout_to_redirect_to_extension', $data)
239 239
                             && intval($data['timeout_to_redirect_to_extension']) === 0)) {
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
                     break;
246 246
                 case "redirect_to_extension_if_unanswered":
247
-                    if ( ! array_key_exists($name, $data)
247
+                    if (!array_key_exists($name, $data)
248 248
                         || empty($data[$name])
249 249
                         || (array_key_exists('number_unanswered_calls_to_redirect', $data)
250 250
                             && intval($data['number_unanswered_calls_to_redirect']) === 0)) {
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
                     break;
257 257
                 default:
258
-                    if ( ! array_key_exists($name, $data)) {
258
+                    if (!array_key_exists($name, $data)) {
259 259
                         continue 2;
260 260
                     }
261 261
                     $queue->$name = $data[$name];
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
         // Обновим настройки у существующих членов очереди
286 286
         $membersTable = json_decode($data['members']);
287 287
         foreach ($membersTable as $member) {
288
-            $parameters   = [
288
+            $parameters = [
289 289
                 'conditions' => 'extension = :number: AND queue=:uniqid:',
290 290
                 'bind'       => [
291 291
                     'number' => $member->number,
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
         $this->db->begin();
361 361
         $extension = $queue->Extensions;
362
-        if ( ! $extension->delete()) {
362
+        if (!$extension->delete()) {
363 363
             $errors = $extension->getMessages();
364 364
         }
365 365
         if ($errors) {
Please login to merge, or discard this patch.
src/AdminCabinet/Controllers/ProvidersController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $provider = Providers::findFirstByUniqid($uniqid);
51 51
 
52 52
         if ($provider === null) {
53
-            $uniqid                     = strtoupper('SIP-' . time());
53
+            $uniqid                     = strtoupper('SIP-'.time());
54 54
             $provider                   = new Providers();
55 55
             $provider->type             = 'SIP';
56 56
             $provider->uniqid           = $uniqid;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $provider = Providers::findFirstByUniqid($uniqid);
79 79
 
80 80
         if ($provider === null) {
81
-            $uniqid                  = strtoupper('IAX-' . time());
81
+            $uniqid                  = strtoupper('IAX-'.time());
82 82
             $provider                = new Providers();
83 83
             $provider->type          = 'IAX';
84 84
             $provider->uniqid        = $uniqid;
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
      */
164 164
     public function saveAction(string $type): void
165 165
     {
166
-        if ( ! $this->request->isPost()) {
166
+        if (!$this->request->isPost()) {
167 167
             $this->forward('network/index');
168 168
         }
169 169
         $this->db->begin();
170 170
         $data = $this->request->getPost();
171 171
 
172 172
         // Заполним параметры провайдера и его SIP IAX записей
173
-        if ( ! $this->saveProvider($data, $type)) {
173
+        if (!$this->saveProvider($data, $type)) {
174 174
             $this->view->success = false;
175 175
             $this->db->rollback();
176 176
 
@@ -291,14 +291,14 @@  discard block
 block discarded – undo
291 291
         $errors = false;
292 292
         if ($provider->Iax) {
293 293
             $iax = $provider->Iax;
294
-            if ( ! $iax->delete()) {
294
+            if (!$iax->delete()) {
295 295
                 $errors = $iax->getMessages();
296 296
             }
297 297
         }
298 298
 
299 299
         if ($errors === false && $provider->Sip) {
300 300
             $sip = $provider->Sip;
301
-            if ( ! $sip->delete()) {
301
+            if (!$sip->delete()) {
302 302
                 $errors = $sip->getMessages();
303 303
             }
304 304
         }
Please login to merge, or discard this patch.
src/AdminCabinet/Controllers/DialplanApplicationsController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $app = DialplanApplications::findFirstByUniqid($uniqid);
38 38
         if ($app === null) {
39 39
             $app            = new DialplanApplications();
40
-            $app->uniqid    = strtoupper('DIALPLAN-APP-' . md5($app->id . time()));
40
+            $app->uniqid    = strtoupper('DIALPLAN-APP-'.md5($app->id.time()));
41 41
             $app->type      = 'php';
42 42
             $app->extension = Extensions::getNextFreeApplicationNumber();
43 43
         }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function saveAction(): void
57 57
     {
58
-        if ( ! $this->request->isPost()) {
58
+        if (!$this->request->isPost()) {
59 59
             return;
60 60
         }
61 61
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         }
79 79
 
80 80
         // Заполним параметры внутреннего номера
81
-        if ( ! $this->updateExtension($extension, $data)) {
81
+        if (!$this->updateExtension($extension, $data)) {
82 82
             $this->view->success = false;
83 83
             $this->db->rollback();
84 84
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         }
87 87
 
88 88
         // Заполним параметры пользователя
89
-        if ( ! $this->updateDialplanApplication($appRecord, $data)) {
89
+        if (!$this->updateDialplanApplication($appRecord, $data)) {
90 90
             $this->view->success = false;
91 91
             $this->db->rollback();
92 92
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         $this->db->begin();
182 182
         $errors = false;
183 183
         $extension = $appRecord->Extensions;
184
-        if ( ! $extension->delete()) {
184
+        if (!$extension->delete()) {
185 185
             $errors = $extension->getMessages();
186 186
         }
187 187
 
Please login to merge, or discard this patch.
src/PBXCoreREST/Lib/AdvicesProcessor.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                 }
91 91
             }
92 92
             $newResult = $this->$currentAdvice();
93
-            if ( ! empty($newResult)) {
93
+            if (!empty($newResult)) {
94 94
                 $arrMessages[] = $newResult;
95 95
             }
96 96
             $managedCache->set(
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $result       = [];
109 109
         foreach ($arrMessages as $message) {
110 110
             foreach ($message as $key => $value) {
111
-                if ( ! empty($value)) {
111
+                if (!empty($value)) {
112 112
                     $result[$key][] = $value;
113 113
                 }
114 114
             }
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
     {
247 247
         $messages = [];
248 248
         $licKey   = PbxSettings::getValueByKey('PBXLicense');
249
-        $language   = PbxSettings::getValueByKey('WebAdminLanguage');
249
+        $language = PbxSettings::getValueByKey('WebAdminLanguage');
250 250
 
251
-        if ( ! empty($licKey)) {
251
+        if (!empty($licKey)) {
252 252
             $checkBaseFeature = $this->license->featureAvailable(33);
253 253
             if ($checkBaseFeature['success'] === false) {
254 254
                 if ($language === 'ru') {
Please login to merge, or discard this patch.
src/PBXCoreREST/Controllers/Modules/ModulesControllerBase.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,18 +47,18 @@
 block discarded – undo
47 47
         $request            = json_encode([
48 48
             'data'           => $_REQUEST,
49 49
             'module'         => $moduleName,
50
-            'input'          => $input,     // Параметры запроса.
50
+            'input'          => $input, // Параметры запроса.
51 51
             'action'         => $actionName,
52 52
             'REQUEST_METHOD' => $_SERVER['REQUEST_METHOD'],
53 53
             'processor'      => 'modules',
54 54
         ]);
55 55
 
56
-        $response   = $this->di->getShared('beanstalkConnection')->request($request, 100, 0);
56
+        $response = $this->di->getShared('beanstalkConnection')->request($request, 100, 0);
57 57
         if ($response !== false) {
58 58
             $response = json_decode($response, true);
59 59
             if (isset($response['fpassthru'])) {
60 60
                 $fp = fopen($response['filename'], "rb");
61
-                if ($fp!==false) {
61
+                if ($fp !== false) {
62 62
                     $size = filesize($response['filename']);
63 63
                     $name = basename($response['filename']);
64 64
                     $this->response->setHeader('Content-Description', "config file");
Please login to merge, or discard this patch.
src/AdminCabinet/Controllers/OutboundRoutesController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
                     'trimfrombegin'    => $rule->trimfrombegin,
52 52
                     'prepend'          => $rule->prepend,
53 53
                     'note'             => $rule->note,
54
-                    'rulename'         => '<i class="icon attention"></i> ' . $rule->getRepresent(),
54
+                    'rulename'         => '<i class="icon attention"></i> '.$rule->getRepresent(),
55 55
                     'disabled'         => false,
56 56
                 ];
57 57
             }
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
             switch ($name) {
106 106
                 case 'restnumbers':
107 107
                 {
108
-                    if ( ! array_key_exists($name, $data)) {
108
+                    if (!array_key_exists($name, $data)) {
109 109
                         continue 2;
110 110
                     }
111 111
                     $rule->$name = $data[$name] === '' ? '-1' : $data[$name];
112 112
                     break;
113 113
                 }
114 114
                 default:
115
-                    if ( ! array_key_exists($name, $data)) {
115
+                    if (!array_key_exists($name, $data)) {
116 116
                         continue 2;
117 117
                     }
118 118
                     $rule->$name = $data[$name];
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $this->view->disable();
165 165
         $result = false;
166 166
 
167
-        if ( ! $this->request->isPost()) {
167
+        if (!$this->request->isPost()) {
168 168
             return;
169 169
         }
170 170
         $data = $this->request->getPost();
Please login to merge, or discard this patch.
src/PBXCoreREST/Lib/LicenseManagementProcessor.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
                     $this->license->changeLicenseKey($data['licKey']);
117 117
                     $this->license->addTrial('11'); // MikoPBX forever license
118 118
                     $res->success = true;
119
-                } elseif ( ! empty($licenseInfo) && strpos($licenseInfo, '2026') !== false) {
119
+                } elseif (!empty($licenseInfo) && strpos($licenseInfo, '2026') !== false) {
120 120
                     $res->success    = false;
121 121
                     $res->messages[] = $this->translation->_('lic_FailedCheckLicense2026');
122
-                } elseif ( ! empty($licenseInfo)) {
122
+                } elseif (!empty($licenseInfo)) {
123 123
                     $res->messages[] = $licenseInfo;
124 124
                     $res->success    = false;
125 125
                 } else {
@@ -127,20 +127,20 @@  discard block
 block discarded – undo
127 127
                     $res->success    = false;
128 128
                 }
129 129
             }
130
-            if ( ! empty($data['coupon'])) {
130
+            if (!empty($data['coupon'])) {
131 131
                 $result = $this->license->activateCoupon($data['coupon']);
132 132
                 if ($result === true) {
133 133
                     $res->messages[] = $this->translation->_('lic_SuccessfulCouponActivated');
134 134
                     $res->success    = true;
135 135
                 } else {
136
-                    $res->messages[] = $this->license->translateLicenseErrorMessage((string)$result);
136
+                    $res->messages[] = $this->license->translateLicenseErrorMessage((string) $result);
137 137
                     $res->success    = false;
138 138
                 }
139 139
             }
140 140
         } else { // Only add trial for license key
141 141
             $newLicenseKey = $this->license->getTrialLicense($data);
142 142
             if (strlen($newLicenseKey) === 28
143
-                && Text::startsWith((string)$newLicenseKey, 'MIKO-')) {
143
+                && Text::startsWith((string) $newLicenseKey, 'MIKO-')) {
144 144
                 $mikoPBXConfig->setGeneralSettings('PBXLicense', $newLicenseKey);
145 145
                 $this->license->changeLicenseKey($newLicenseKey);
146 146
                 $res->success    = true;
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
         $licFeatureId = $data['licFeatureId'];
213 213
         $licProductId = $data['licProductId'];
214 214
 
215
-        if ( ! isset($licFeatureId, $licProductId)) {
216
-            $res->messages[]='The feature id or product id is empty.';
215
+        if (!isset($licFeatureId, $licProductId)) {
216
+            $res->messages[] = 'The feature id or product id is empty.';
217 217
             return $res;
218 218
         }
219 219
         $res->success = true;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     {
244 244
         $res = new PBXApiResult();
245 245
         $res->processor = __METHOD__;
246
-        $res->success= true;
246
+        $res->success = true;
247 247
 
248 248
         // License Key
249 249
         $licenseKey = PbxSettings::getValueByKey('PBXLicense');
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
         $dataMetrics = [];
252 252
 
253 253
         // PBXVersion
254
-        $dataMetrics['PBXname'] = 'MikoPBX@' . PbxSettings::getValueByKey('PBXVersion');
254
+        $dataMetrics['PBXname'] = 'MikoPBX@'.PbxSettings::getValueByKey('PBXVersion');
255 255
 
256 256
         // SIP Extensions count
257
-        $extensions                   = Extensions::find('type="'.Extensions::TYPE_SIP.'"');
257
+        $extensions = Extensions::find('type="'.Extensions::TYPE_SIP.'"');
258 258
         $dataMetrics['CountSipExtensions'] = $extensions->count();
259 259
 
260 260
         // Interface language
Please login to merge, or discard this patch.
src/Core/Asterisk/Configs/CelConf.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@
 block discarded – undo
19 19
 
20 20
     protected function generateConfigProtected(): void
21 21
     {
22
-        $conf = "[general]\n" .
23
-            "enable=yes\n" .
24
-            "events=CHAN_START,CHAN_END,ANSWER\n" .
25
-            "dateformat = %F %T\n\n" .
26
-            "[manager]\n" .
22
+        $conf = "[general]\n".
23
+            "enable=yes\n".
24
+            "events=CHAN_START,CHAN_END,ANSWER\n".
25
+            "dateformat = %F %T\n\n".
26
+            "[manager]\n".
27 27
             "enabled = yes\n\n";
28
-        Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/cel.conf', $conf);
28
+        Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/cel.conf', $conf);
29 29
     }
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
src/Core/System/Configs/Fail2BanConf.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $fail2ban = new self();
46 46
         if ($fail2ban->fail2ban_enable
47
-            && ! $fail2ban->fail2banIsRunning()) {
47
+            && !$fail2ban->fail2banIsRunning()) {
48 48
             $fail2ban->fail2banStart();
49 49
         }
50 50
     }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $create_link = false;
139 139
 
140 140
         // Символическая ссылка на базу данных.
141
-        if (file_exists($res_file)){
141
+        if (file_exists($res_file)) {
142 142
             if (filetype($res_file) !== 'link') {
143 143
                 unlink($res_file);
144 144
                 $create_link = true;
@@ -191,59 +191,59 @@  discard block
 block discarded – undo
191 191
         }
192 192
         $this->generateJails();
193 193
 
194
-        $jails        = [
194
+        $jails = [
195 195
             'dropbear'    => 'iptables-allports[name=SSH, protocol=all]',
196 196
             'mikopbx-www' => 'iptables-allports[name=HTTP, protocol=all]',
197 197
         ];
198 198
         $modulesJails = $this->generateModulesJailsLocal();
199 199
         $jails        = array_merge($jails, $modulesJails);
200
-        $config       = "[DEFAULT]\n" .
200
+        $config       = "[DEFAULT]\n".
201 201
             "ignoreip = 127.0.0.1 {$user_whitelist}\n\n";
202 202
 
203 203
         $syslog_file = SyslogConf::getSyslogFile();
204 204
 
205 205
         foreach ($jails as $jail => $action) {
206
-            $config .= "[{$jail}]\n" .
207
-                "enabled = true\n" .
208
-                "backend = process\n" .
209
-                "logpath = {$syslog_file}\n" .
206
+            $config .= "[{$jail}]\n".
207
+                "enabled = true\n".
208
+                "backend = process\n".
209
+                "logpath = {$syslog_file}\n".
210 210
                 // "logprocess = logread -f\n".
211
-                "maxretry = {$max_retry}\n" .
212
-                "findtime = {$find_time}\n" .
213
-                "bantime = {$ban_time}\n" .
214
-                "logencoding = utf-8\n" .
211
+                "maxretry = {$max_retry}\n".
212
+                "findtime = {$find_time}\n".
213
+                "bantime = {$ban_time}\n".
214
+                "logencoding = utf-8\n".
215 215
                 "action = {$action}\n\n";
216 216
         }
217 217
 
218
-        $log_dir = System::getLogDir() . '/asterisk/';
219
-        $config  .= "[asterisk_security_log]\n" .
220
-            "enabled = true\n" .
221
-            "filter = asterisk\n" .
222
-            "action = iptables-allports[name=ASTERISK, protocol=all]\n" .
223
-            "logencoding = utf-8\n" .
224
-            "maxretry = {$max_retry}\n" .
225
-            "findtime = {$find_time}\n" .
226
-            "bantime = {$ban_time}\n" .
218
+        $log_dir = System::getLogDir().'/asterisk/';
219
+        $config .= "[asterisk_security_log]\n".
220
+            "enabled = true\n".
221
+            "filter = asterisk\n".
222
+            "action = iptables-allports[name=ASTERISK, protocol=all]\n".
223
+            "logencoding = utf-8\n".
224
+            "maxretry = {$max_retry}\n".
225
+            "findtime = {$find_time}\n".
226
+            "bantime = {$ban_time}\n".
227 227
             "logpath = {$log_dir}security_log\n\n";
228 228
 
229
-        $config .= "[asterisk_error]\n" .
230
-            "enabled = true\n" .
231
-            "filter = asterisk\n" .
232
-            "action = iptables-allports[name=ASTERISK_ERROR, protocol=all]\n" .
233
-            "maxretry = {$max_retry}\n" .
234
-            "findtime = {$find_time}\n" .
235
-            "bantime = {$ban_time}\n" .
236
-            "logencoding = utf-8\n" .
229
+        $config .= "[asterisk_error]\n".
230
+            "enabled = true\n".
231
+            "filter = asterisk\n".
232
+            "action = iptables-allports[name=ASTERISK_ERROR, protocol=all]\n".
233
+            "maxretry = {$max_retry}\n".
234
+            "findtime = {$find_time}\n".
235
+            "bantime = {$ban_time}\n".
236
+            "logencoding = utf-8\n".
237 237
             "logpath = {$log_dir}error\n\n";
238 238
 
239
-        $config .= "[asterisk_public]\n" .
240
-            "enabled = true\n" .
241
-            "filter = asterisk\n" .
242
-            "action = iptables-allports[name=ASTERISK_PUBLIC, protocol=all]\n" .
243
-            "maxretry = {$max_retry}\n" .
244
-            "findtime = {$find_time}\n" .
245
-            "bantime = {$ban_time}\n" .
246
-            "logencoding = utf-8\n" .
239
+        $config .= "[asterisk_public]\n".
240
+            "enabled = true\n".
241
+            "filter = asterisk\n".
242
+            "action = iptables-allports[name=ASTERISK_PUBLIC, protocol=all]\n".
243
+            "maxretry = {$max_retry}\n".
244
+            "findtime = {$find_time}\n".
245
+            "bantime = {$ban_time}\n".
246
+            "logencoding = utf-8\n".
247 247
             "logpath = {$log_dir}messages\n\n";
248 248
 
249 249
         Util::fileWriteContent('/etc/fail2ban/jail.local', $config);
@@ -256,23 +256,23 @@  discard block
 block discarded – undo
256 256
     {
257 257
         $filterPath = self::FILTER_PATH;
258 258
 
259
-        $conf = "[INCLUDES]\n" .
260
-            "before = common.conf\n" .
261
-            "[Definition]\n" .
262
-            "_daemon = [\S\W\s]+web_auth\n" .
263
-            'failregex = ^%(__prefix_line)sFrom:\s<HOST>\sUserAgent:(\S|\s)*Wrong password$' . "\n" .
264
-            '            ^(\S|\s)*nginx:\s+\d+/\d+/\d+\s+(\S|\s)*status\s+403(\S|\s)*client:\s+<HOST>(\S|\s)*' . "\n" .
259
+        $conf = "[INCLUDES]\n".
260
+            "before = common.conf\n".
261
+            "[Definition]\n".
262
+            "_daemon = [\S\W\s]+web_auth\n".
263
+            'failregex = ^%(__prefix_line)sFrom:\s<HOST>\sUserAgent:(\S|\s)*Wrong password$'."\n".
264
+            '            ^(\S|\s)*nginx:\s+\d+/\d+/\d+\s+(\S|\s)*status\s+403(\S|\s)*client:\s+<HOST>(\S|\s)*'."\n".
265 265
             "ignoreregex =\n";
266 266
         file_put_contents("{$filterPath}/mikopbx-www.conf", $conf);
267 267
 
268
-        $conf = "[INCLUDES]\n" .
269
-            "before = common.conf\n" .
270
-            "[Definition]\n" .
271
-            "_daemon = (authpriv.warn )?dropbear\n" .
272
-            'prefregex = ^%(__prefix_line)s<F-CONTENT>(?:[Ll]ogin|[Bb]ad|[Ee]xit).+</F-CONTENT>$' . "\n" .
273
-            'failregex = ^[Ll]ogin attempt for nonexistent user (\'.*\' )?from <HOST>:\d+$' . "\n" .
274
-            '            ^[Bb]ad (PAM )?password attempt for .+ from <HOST>(:\d+)?$' . "\n" .
275
-            '            ^[Ee]xit before auth \(user \'.+\', \d+ fails\): Max auth tries reached - user \'.+\' from <HOST>:\d+\s*$' . "\n" .
268
+        $conf = "[INCLUDES]\n".
269
+            "before = common.conf\n".
270
+            "[Definition]\n".
271
+            "_daemon = (authpriv.warn )?dropbear\n".
272
+            'prefregex = ^%(__prefix_line)s<F-CONTENT>(?:[Ll]ogin|[Bb]ad|[Ee]xit).+</F-CONTENT>$'."\n".
273
+            'failregex = ^[Ll]ogin attempt for nonexistent user (\'.*\' )?from <HOST>:\d+$'."\n".
274
+            '            ^[Bb]ad (PAM )?password attempt for .+ from <HOST>(:\d+)?$'."\n".
275
+            '            ^[Ee]xit before auth \(user \'.+\', \d+ fails\): Max auth tries reached - user \'.+\' from <HOST>:\d+\s*$'."\n".
276 276
             "ignoreregex =\n";
277 277
         file_put_contents("{$filterPath}/dropbear.conf", $conf);
278 278
 
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
         foreach ($additionalModules as $appClass) {
292 292
             if (method_exists($appClass, 'generateFail2BanJails')) {
293 293
                 $content = $appClass->generateFail2BanJails();
294
-                if ( ! empty($content)) {
294
+                if (!empty($content)) {
295 295
                     $moduleUniqueId = $appClass->moduleUniqueId;
296
-                    $fileName = Text::uncamelize($moduleUniqueId,'_').'.conf';
296
+                    $fileName = Text::uncamelize($moduleUniqueId, '_').'.conf';
297 297
                     file_put_contents("{$filterPath}/{$fileName}", $content);
298 298
                 }
299 299
             }
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
         foreach ($additionalModules as $appClass) {
313 313
             if (method_exists($appClass, 'generateFail2BanJails')) {
314 314
                 $content = $appClass->generateFail2BanJails();
315
-                if ( ! empty($content)) {
316
-                    $moduleUniqueId                    = $appClass->moduleUniqueId;
317
-                    $fileName = Text::uncamelize($moduleUniqueId,'_');
315
+                if (!empty($content)) {
316
+                    $moduleUniqueId = $appClass->moduleUniqueId;
317
+                    $fileName = Text::uncamelize($moduleUniqueId, '_');
318 318
                     $jails[$fileName] = "iptables-allports[name={$moduleUniqueId}, protocol=all]";
319 319
                 }
320 320
             }
Please login to merge, or discard this patch.