Passed
Push — develop ( 751171...058086 )
by Nikolay
05:21
created
src/Modules/PbxExtensionState.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
         $this->moduleUniqueID = $moduleUniqueID;
41 41
         $this->modulesRoot    = $this->di->getShared('config')->path('core.modulesDir');
42 42
         $moduleJson           = "{$this->modulesRoot}/{$this->moduleUniqueID}/module.json";
43
-        if ( ! file_exists($moduleJson)) {
44
-            $this->messages[] = 'module.json not found for module ' . $this->moduleUniqueID;
43
+        if (!file_exists($moduleJson)) {
44
+            $this->messages[] = 'module.json not found for module '.$this->moduleUniqueID;
45 45
 
46 46
             return;
47 47
         }
48 48
         $jsonString            = file_get_contents($moduleJson);
49 49
         $jsonModuleDescription = json_decode($jsonString, true);
50
-        if ( ! is_array($jsonModuleDescription)) {
51
-            $this->messages[] = 'module.json parsing error ' . $this->moduleUniqueID;
50
+        if (!is_array($jsonModuleDescription)) {
51
+            $this->messages[] = 'module.json parsing error '.$this->moduleUniqueID;
52 52
 
53 53
             return;
54 54
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             && method_exists($this->configClass, 'onBeforeModuleEnable')
101 101
             && $this->configClass->onBeforeModuleEnable() === false) {
102 102
             $messages = $this->configClass->getMessages();
103
-            if ( ! empty($messages)) {
103
+            if (!empty($messages)) {
104 104
                 $this->messages = $messages;
105 105
             } else {
106 106
                 $this->messages[] = 'Error on the Module enable function at onBeforeModuleEnable';
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             $moduleModelClass = "\\Modules\\{$this->moduleUniqueID}\\Models\\{$className}";
120 120
 
121 121
             if (
122
-                ! class_exists($moduleModelClass)
122
+                !class_exists($moduleModelClass)
123 123
                 || count(get_class_vars($moduleModelClass)) === 0) {
124 124
                 continue;
125 125
             }
@@ -155,20 +155,20 @@  discard block
 block discarded – undo
155 155
                                     'modulename' => $record->getRepresent(true),
156 156
                                 ]
157 157
                             );
158
-                            $error            = true;
158
+                            $error = true;
159 159
                         }
160 160
                     }
161 161
                 }
162 162
             }
163 163
         }
164
-        if ( ! $error) {
164
+        if (!$error) {
165 165
             $this->messages = [];
166 166
         }
167 167
         $this->db->rollback(true); // Откатываем временную транзакцию
168 168
 
169
-        if ( ! $error) {
169
+        if (!$error) {
170 170
             // Если ошибок нет, включаем Firewall и модуль
171
-            if ( ! $this->enableFirewallSettings()) {
171
+            if (!$this->enableFirewallSettings()) {
172 172
                 $this->messages[] = 'Error on enable firewall settings';
173 173
 
174 174
                 return false;
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
             $this->refreshFail2BanRules($this->configClass, true);
194 194
         }
195 195
 
196
-        return ! $error;
196
+        return !$error;
197 197
     }
198 198
 
199 199
     /**
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                 if (array_key_exists($network->id, $previousRules)) {
243 243
                     $newRule->action = $previousRules[$network->id];
244 244
                 }
245
-                if ( ! $newRule->save()) {
245
+                if (!$newRule->save()) {
246 246
                     $this->messages[] = $newRule->getMessages();
247 247
                 }
248 248
             }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
     {
273 273
         if ($configClass !== null
274 274
             && method_exists($configClass, 'createNginxLocations')
275
-            && ! empty($configClass->createNginxLocations())) {
275
+            && !empty($configClass->createNginxLocations())) {
276 276
             if ($enableAction === false) {
277 277
                 $locationsPath = $this->di->getShared('config')->path('core.nginxLocationsPath');
278 278
                 $confFileName  = "{$locationsPath}/{$configClass->moduleUniqueId}.conf";
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     {
298 298
         if ($configClass !== null
299 299
             && method_exists($configClass, 'generateFail2BanJails')
300
-            && ! empty($configClass->generateFail2BanJails())) {
300
+            && !empty($configClass->generateFail2BanJails())) {
301 301
             if ($enableAction === false) {
302 302
                 $filterPath   = Firewall::fail2banGetFilterPath();
303 303
                 $confFileName = "{$filterPath}/{$configClass->moduleUniqueId}.conf";
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
             && method_exists($this->configClass, 'onBeforeModuleDisable')
324 324
             && $this->configClass->onBeforeModuleDisable() === false) {
325 325
             $messages = $this->configClass->getMessages();
326
-            if ( ! empty($messages)) {
326
+            if (!empty($messages)) {
327 327
                 $this->messages = $messages;
328 328
             } else {
329 329
                 $this->messages[] = 'Error on the Module enable function at onBeforeModuleDisable';
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
             $moduleModelClass = "\\Modules\\{$this->moduleUniqueID}\\Models\\{$className}";
344 344
 
345 345
             if (
346
-                ! class_exists($moduleModelClass)
346
+                !class_exists($moduleModelClass)
347 347
                 || count(get_class_vars($moduleModelClass)) === 0) {
348 348
                 continue;
349 349
             }
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
                 try {
362 362
                     $records = $moduleModelClass::find();
363 363
                     foreach ($records as $record) {
364
-                        if ( ! $record->beforeDelete()) {
364
+                        if (!$record->beforeDelete()) {
365 365
                             $messages[] = $record->getMessages();
366 366
                             $error      = true;
367 367
                         }
@@ -371,15 +371,15 @@  discard block
 block discarded – undo
371 371
                 }
372 372
             }
373 373
         }
374
-        if ( ! $error) {
374
+        if (!$error) {
375 375
             $this->messages = [];
376 376
         }
377 377
         $this->db->rollback(true); // Откатываем временную транзакцию
378 378
 
379 379
 
380
-        if ( ! $error) {
380
+        if (!$error) {
381 381
             // Если ошибок нет, выключаем Firewall и модуль
382
-            if ( ! $this->disableFirewallSettings()) {
382
+            if (!$this->disableFirewallSettings()) {
383 383
                 $this->messages[] = 'Error on disable firewall settings';
384 384
 
385 385
                 return false;
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
         }
404 404
 
405 405
         // Kill module workers
406
-        if ( ! $error
406
+        if (!$error
407 407
             && $this->configClass !== null
408 408
             && method_exists($this->configClass, 'getModuleWorkers')) {
409 409
             $workersToKill = $this->configClass->getModuleWorkers();
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
             }
413 413
         }
414 414
 
415
-        return ! $error;
415
+        return !$error;
416 416
     }
417 417
 
418 418
     /**
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
             $savedState[$detailRule->networkfilterid] = $detailRule->action;
440 440
         }
441 441
         $this->db->begin(true);
442
-        if ( ! $currentRules->delete()) {
442
+        if (!$currentRules->delete()) {
443 443
             $this->messages[] = $currentRules->getMessages();
444 444
 
445 445
             return false;
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
             $previousRuleSettings->key = "{$this->moduleUniqueID}FirewallSettings";
452 452
         }
453 453
         $previousRuleSettings->value = json_encode($savedState);
454
-        if ( ! $previousRuleSettings->save()) {
454
+        if (!$previousRuleSettings->save()) {
455 455
             $this->messages[] = $previousRuleSettings->getMessages();
456 456
         }
457 457
         if (count($errors) > 0) {
Please login to merge, or discard this patch.
src/Core/Workers/WorkerLogRotate.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     public function start($params): void
27 27
     {
28 28
         $lastLogRotateTime = $this->di->getRegistry()->lastLogRotateTime;
29
-        if ($lastLogRotateTime === null || time() - $lastLogRotateTime > 3600){
29
+        if ($lastLogRotateTime === null || time() - $lastLogRotateTime > 3600) {
30 30
             //System Logs
31 31
             NatsConf::logRotate();
32 32
             PHPConf::rotateLog();
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function logRotate(string $moduleUniqid): void
51 51
     {
52
-        $logPath        = System::getLogDir() . '/' . $moduleUniqid . '/';
53
-        if ( ! file_exists($logPath)) {
52
+        $logPath = System::getLogDir().'/'.$moduleUniqid.'/';
53
+        if (!file_exists($logPath)) {
54 54
             return;
55 55
         }
56 56
 
57
-        $results         = glob($logPath . '*.log', GLOB_NOSORT);
57
+        $results         = glob($logPath.'*.log', GLOB_NOSORT);
58 58
         $textConfig = '';
59 59
         foreach ($results as $file) {
60
-            $textConfig .= $file . ' {
60
+            $textConfig .= $file.' {
61 61
     start 0
62 62
     rotate 9
63 63
     size 10M
Please login to merge, or discard this patch.
src/Core/System/SystemLoader.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     public function startSystem(): bool
28 28
     {
29 29
         $this->di->getShared('registry')->booting = true;
30
-        $storage                          = new Storage();
30
+        $storage = new Storage();
31 31
         Util::echoWithSyslog(' - Mount storage disk... ');
32 32
         $storage->saveFstab();
33 33
         $storage->configure();
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
         $syslogConf->reStart();
39 39
         Util::echoGreenDone();
40 40
 
41
-        Util::echoWithSyslog(' - Update database ... '. PHP_EOL);
41
+        Util::echoWithSyslog(' - Update database ... '.PHP_EOL);
42 42
         $dbUpdater = new UpdateDatabase();
43 43
         $dbUpdater->updateDatabaseStructure();
44 44
 
45
-        Util::echoWithSyslog(' - Update configs and applications ... '. PHP_EOL);
45
+        Util::echoWithSyslog(' - Update configs and applications ... '.PHP_EOL);
46 46
         $confUpdate = new UpdateSystemConfig();
47 47
         $confUpdate->updateConfigs();
48 48
 
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
         Util::echoGreenDone();
120 120
 
121 121
         Util::echoWithSyslog(' - Configuring Asterisk...'.PHP_EOL);
122
-        $pbx                              = new PBX();
122
+        $pbx = new PBX();
123 123
         $pbx->configure();
124 124
 
125 125
         Util::echoWithSyslog(' - Start Asterisk... ');
126 126
         $pbx->start();
127
-        $system                           = new System();
127
+        $system = new System();
128 128
         $system->onAfterPbxStarted();
129 129
         Util::echoGreenDone();
130 130
 
Please login to merge, or discard this patch.
src/Core/System/Configs/NginxConf.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             $systemCtrlPath = Util::which('systemctl');
40 40
             Util::mwExec("{$systemCtrlPath} restart nginx.service");
41 41
         } else {
42
-            $NginxPath  = Util::which('nginx');
42
+            $NginxPath = Util::which('nginx');
43 43
             Util::killByName('nginx');
44 44
             Util::mwExec($NginxPath);
45 45
         }
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 
77 77
         $RedirectToHttps = $this->mikoPBXConfig->getGeneralSettings('RedirectToHttps');
78 78
         if ($RedirectToHttps === '1' && $not_ssl === false) {
79
-            $conf_data = 'if ( $remote_addr != "127.0.0.1" ) {' . PHP_EOL
80
-                . '        ' . 'return 301 https://$host:' . $WEBHTTPSPort . '$request_uri;' . PHP_EOL
81
-                . '       }' . PHP_EOL;
79
+            $conf_data = 'if ( $remote_addr != "127.0.0.1" ) {'.PHP_EOL
80
+                . '        '.'return 301 https://$host:'.$WEBHTTPSPort.'$request_uri;'.PHP_EOL
81
+                . '       }'.PHP_EOL;
82 82
             $config    = str_replace('include mikopbx/locations/*.conf;', $conf_data, $config);
83 83
         }
84 84
         file_put_contents($httpConfigFile, $config);
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
         $WEBHTTPSPrivateKey = $this->mikoPBXConfig->getGeneralSettings('WEBHTTPSPrivateKey');
89 89
         if (
90 90
             $not_ssl === false
91
-            && ! empty($WEBHTTPSPublicKey)
92
-            && ! empty($WEBHTTPSPrivateKey)
91
+            && !empty($WEBHTTPSPublicKey)
92
+            && !empty($WEBHTTPSPrivateKey)
93 93
         ) {
94 94
             $public_filename  = '/etc/ssl/certs/nginx.crt';
95 95
             $private_filename = '/etc/ssl/private/nginx.key';
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         foreach ($additionalModules as $appClass) {
121 121
             if (method_exists($appClass, 'createNginxLocations')) {
122 122
                 $locationContent = $appClass->createNginxLocations();
123
-                if ( ! empty($locationContent)) {
123
+                if (!empty($locationContent)) {
124 124
                     $confFileName = "{$locationsPath}/{$appClass->moduleUniqueId}.conf";
125 125
                     file_put_contents($confFileName, $locationContent);
126 126
                     $out = [];
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                     $res = implode($out);
129 129
                     if (false !== strpos($res, 'test failed')) {
130 130
                         Util::mwExec("{$rmPath} {$confFileName}");
131
-                        Util::sysLogMsg('nginx', 'Failed test config file for module' . $appClass->moduleUniqueId);
131
+                        Util::sysLogMsg('nginx', 'Failed test config file for module'.$appClass->moduleUniqueId);
132 132
                     }
133 133
                 }
134 134
             }
Please login to merge, or discard this patch.
src/Core/System/Configs/PHPConf.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $src_log_file = '/var/log/php_error.log';
28 28
         $dst_log_file = self::getLogFile();
29
-        if ( ! file_exists($src_log_file)) {
29
+        if (!file_exists($src_log_file)) {
30 30
             file_put_contents($src_log_file, '');
31 31
         }
32 32
         $options = file_exists($dst_log_file) ? '>' : '';
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public static function getLogFile(): string
44 44
     {
45
-        $logdir = System::getLogDir() . '/php';
45
+        $logdir = System::getLogDir().'/php';
46 46
         Util::mwMkdir($logdir);
47 47
         return "$logdir/error.log";
48 48
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         $max_size    = 2;
58 58
         $f_name      = self::getLogFile();
59
-        $text_config = $f_name . " {
59
+        $text_config = $f_name." {
60 60
     nocreate
61 61
     nocopytruncate
62 62
     delaycompress
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
     endscript
71 71
 }";
72 72
         // TODO::Доделать рестарт PHP-FPM после обновление лога
73
-        $di     = Di::getDefault();
74
-        if ($di !== null){
73
+        $di = Di::getDefault();
74
+        if ($di !== null) {
75 75
             $varEtcPath = $di->getConfig()->path('core.varEtcPath');
76 76
         } else {
77 77
             $varEtcPath = '/var/etc';
78 78
         }
79
-        $path_conf   = $varEtcPath . '/php_logrotate_' . basename($f_name) . '.conf';
79
+        $path_conf = $varEtcPath.'/php_logrotate_'.basename($f_name).'.conf';
80 80
         file_put_contents($path_conf, $text_config);
81 81
         $mb10 = $max_size * 1024 * 1024;
82 82
 
Please login to merge, or discard this patch.
src/Core/System/Firewall.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 file_put_contents('/etc/iptables/iptables.mikopbx', implode("\n", $arr_command));
89 89
                 file_put_contents(
90 90
                     '/etc/iptables/iptables.mikopbx',
91
-                    "\n" . implode("\n", $arr_commands_custom),
91
+                    "\n".implode("\n", $arr_commands_custom),
92 92
                     FILE_APPEND
93 93
                 );
94 94
                 $systemctlPath = Util::which('systemctl');
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $data_port = '';
210 210
         if (trim($dport) !== '') {
211
-            $data_port = '--dport ' . $dport;
211
+            $data_port = '--dport '.$dport;
212 212
         }
213 213
         $other_data = trim($other_data);
214 214
 
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
                 continue;
243 243
             }
244 244
             $other_data = "-p {$rule->protocol}";
245
-            $other_data .= ($network_filter === null) ? '' : ' -s ' . $network_filter->permit;
245
+            $other_data .= ($network_filter === null) ? '' : ' -s '.$network_filter->permit;
246 246
             if ($rule->protocol === 'icmp') {
247
-                $port       = '';
247
+                $port = '';
248 248
                 $other_data .= ' --icmp-type echo-request';
249 249
             }
250 250
 
@@ -286,58 +286,58 @@  discard block
 block discarded – undo
286 286
             $ban_time  = '43200';
287 287
         }
288 288
         $this->generateJails();
289
-        $jails  = [
289
+        $jails = [
290 290
             'dropbear'    => 'iptables-allports[name=SSH, protocol=all]',
291 291
             'mikoajam'    => 'iptables-allports[name=MIKOAJAM, protocol=all]',
292 292
             'mikopbx-www' => 'iptables-allports[name=HTTP, protocol=all]',
293 293
         ];
294
-        $config = "[DEFAULT]\n" .
294
+        $config = "[DEFAULT]\n".
295 295
             "ignoreip = 127.0.0.1 {$user_whitelist}\n\n";
296 296
 
297 297
         $syslog_file = SyslogConf::getSyslogFile();
298 298
 
299 299
         foreach ($jails as $jail => $action) {
300
-            $config .= "[{$jail}]\n" .
301
-                "enabled = true\n" .
302
-                "backend = process\n" .
303
-                "logpath = {$syslog_file}\n" .
300
+            $config .= "[{$jail}]\n".
301
+                "enabled = true\n".
302
+                "backend = process\n".
303
+                "logpath = {$syslog_file}\n".
304 304
                 // "logprocess = logread -f\n".
305
-                "maxretry = {$max_retry}\n" .
306
-                "findtime = {$find_time}\n" .
307
-                "bantime = {$ban_time}\n" .
308
-                "logencoding = utf-8\n" .
305
+                "maxretry = {$max_retry}\n".
306
+                "findtime = {$find_time}\n".
307
+                "bantime = {$ban_time}\n".
308
+                "logencoding = utf-8\n".
309 309
                 "action = {$action}\n\n";
310 310
         }
311 311
 
312
-        $log_dir = System::getLogDir() . '/asterisk/';
313
-        $config  .= "[asterisk_security_log]\n" .
314
-            "enabled = true\n" .
315
-            "filter = asterisk\n" .
316
-            "action = iptables-allports[name=ASTERISK, protocol=all]\n" .
317
-            "logencoding = utf-8\n" .
318
-            "maxretry = {$max_retry}\n" .
319
-            "findtime = {$find_time}\n" .
320
-            "bantime = {$ban_time}\n" .
312
+        $log_dir = System::getLogDir().'/asterisk/';
313
+        $config .= "[asterisk_security_log]\n".
314
+            "enabled = true\n".
315
+            "filter = asterisk\n".
316
+            "action = iptables-allports[name=ASTERISK, protocol=all]\n".
317
+            "logencoding = utf-8\n".
318
+            "maxretry = {$max_retry}\n".
319
+            "findtime = {$find_time}\n".
320
+            "bantime = {$ban_time}\n".
321 321
             "logpath = {$log_dir}security_log\n\n";
322 322
 
323
-        $config .= "[asterisk_error]\n" .
324
-            "enabled = true\n" .
325
-            "filter = asterisk\n" .
326
-            "action = iptables-allports[name=ASTERISK_ERROR, protocol=all]\n" .
327
-            "maxretry = {$max_retry}\n" .
328
-            "findtime = {$find_time}\n" .
329
-            "bantime = {$ban_time}\n" .
330
-            "logencoding = utf-8\n" .
323
+        $config .= "[asterisk_error]\n".
324
+            "enabled = true\n".
325
+            "filter = asterisk\n".
326
+            "action = iptables-allports[name=ASTERISK_ERROR, protocol=all]\n".
327
+            "maxretry = {$max_retry}\n".
328
+            "findtime = {$find_time}\n".
329
+            "bantime = {$ban_time}\n".
330
+            "logencoding = utf-8\n".
331 331
             "logpath = {$log_dir}error\n\n";
332 332
 
333
-        $config .= "[asterisk_public]\n" .
334
-            "enabled = true\n" .
335
-            "filter = asterisk\n" .
336
-            "action = iptables-allports[name=ASTERISK_PUBLIC, protocol=all]\n" .
337
-            "maxretry = {$max_retry}\n" .
338
-            "findtime = {$find_time}\n" .
339
-            "bantime = {$ban_time}\n" .
340
-            "logencoding = utf-8\n" .
333
+        $config .= "[asterisk_public]\n".
334
+            "enabled = true\n".
335
+            "filter = asterisk\n".
336
+            "action = iptables-allports[name=ASTERISK_PUBLIC, protocol=all]\n".
337
+            "maxretry = {$max_retry}\n".
338
+            "findtime = {$find_time}\n".
339
+            "bantime = {$ban_time}\n".
340
+            "logencoding = utf-8\n".
341 341
             "logpath = {$log_dir}messages\n\n";
342 342
 
343 343
         Util::fileWriteContent('/etc/fail2ban/jail.local', $config);
@@ -350,23 +350,23 @@  discard block
 block discarded – undo
350 350
     {
351 351
         $filterPath = self::fail2banGetFilterPath();
352 352
 
353
-        $conf = "[INCLUDES]\n" .
354
-            "before = common.conf\n" .
355
-            "[Definition]\n" .
356
-            "_daemon = [\S\W\s]+web_auth\n" .
357
-            'failregex = ^%(__prefix_line)sFrom:\s<HOST>\sUserAgent:(\S|\s)*Wrong password$' . "\n" .
358
-            '            ^(\S|\s)*nginx:\s+\d+/\d+/\d+\s+(\S|\s)*status\s+403(\S|\s)*client:\s+<HOST>(\S|\s)*' . "\n" .
353
+        $conf = "[INCLUDES]\n".
354
+            "before = common.conf\n".
355
+            "[Definition]\n".
356
+            "_daemon = [\S\W\s]+web_auth\n".
357
+            'failregex = ^%(__prefix_line)sFrom:\s<HOST>\sUserAgent:(\S|\s)*Wrong password$'."\n".
358
+            '            ^(\S|\s)*nginx:\s+\d+/\d+/\d+\s+(\S|\s)*status\s+403(\S|\s)*client:\s+<HOST>(\S|\s)*'."\n".
359 359
             "ignoreregex =\n";
360 360
         file_put_contents("{$filterPath}/mikopbx-www.conf", $conf);
361 361
 
362
-        $conf = "[INCLUDES]\n" .
363
-            "before = common.conf\n" .
364
-            "[Definition]\n" .
365
-            "_daemon = (authpriv.warn )?dropbear\n" .
366
-            'prefregex = ^%(__prefix_line)s<F-CONTENT>(?:[Ll]ogin|[Bb]ad|[Ee]xit).+</F-CONTENT>$' . "\n" .
367
-            'failregex = ^[Ll]ogin attempt for nonexistent user (\'.*\' )?from <HOST>:\d+$' . "\n" .
368
-            '            ^[Bb]ad (PAM )?password attempt for .+ from <HOST>(:\d+)?$' . "\n" .
369
-            '            ^[Ee]xit before auth \(user \'.+\', \d+ fails\): Max auth tries reached - user \'.+\' from <HOST>:\d+\s*$' . "\n" .
362
+        $conf = "[INCLUDES]\n".
363
+            "before = common.conf\n".
364
+            "[Definition]\n".
365
+            "_daemon = (authpriv.warn )?dropbear\n".
366
+            'prefregex = ^%(__prefix_line)s<F-CONTENT>(?:[Ll]ogin|[Bb]ad|[Ee]xit).+</F-CONTENT>$'."\n".
367
+            'failregex = ^[Ll]ogin attempt for nonexistent user (\'.*\' )?from <HOST>:\d+$'."\n".
368
+            '            ^[Bb]ad (PAM )?password attempt for .+ from <HOST>(:\d+)?$'."\n".
369
+            '            ^[Ee]xit before auth \(user \'.+\', \d+ fails\): Max auth tries reached - user \'.+\' from <HOST>:\d+\s*$'."\n".
370 370
             "ignoreregex =\n";
371 371
         file_put_contents("{$filterPath}/dropbear.conf", $conf);
372 372
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         foreach ($additionalModules as $appClass) {
376 376
             if (method_exists($appClass, 'generateFail2BanJails')) {
377 377
                 $content = $appClass->generateFail2BanJails();
378
-                if ( ! empty($content)) {
378
+                if (!empty($content)) {
379 379
                     $moduleUniqueId = $appClass->moduleUniqueId;
380 380
                     file_put_contents("{$filterPath}/{$moduleUniqueId}.conf", $content);
381 381
                 }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         if (false === self::tableBanExists($db)) {
419 419
             return;
420 420
         }
421
-        $q = 'DELETE' . ' from bans WHERE (timeofban+' . $ban_time . ')<' . time();
421
+        $q = 'DELETE'.' from bans WHERE (timeofban+'.$ban_time.')<'.time();
422 422
         $db->query($q);
423 423
     }
424 424
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
      */
432 432
     public static function tableBanExists($db): bool
433 433
     {
434
-        $q_check      = 'SELECT' . ' name FROM sqlite_master WHERE type = "table" AND name="bans"';
434
+        $q_check      = 'SELECT'.' name FROM sqlite_master WHERE type = "table" AND name="bans"';
435 435
         $result_check = $db->query($q_check);
436 436
 
437 437
         return (false !== $result_check && $result_check->fetchArray(SQLITE3_ASSOC) !== false);
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
     {
445 445
         $firewall = new Firewall();
446 446
         if ($firewall->fail2ban_enable
447
-            && ! $firewall->fail2banIsRunning()) {
447
+            && !$firewall->fail2banIsRunning()) {
448 448
             self::fail2banStart();
449 449
         }
450 450
     }
Please login to merge, or discard this patch.
src/Core/System/PBX.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             return;
90 90
         }
91 91
         $max_size    = 2;
92
-        $log_dir     = System::getLogDir() . '/asterisk/';
92
+        $log_dir     = System::getLogDir().'/asterisk/';
93 93
         $text_config = "{$log_dir}{$f_name} {
94 94
     nocreate
95 95
     nocopytruncate
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     endscript
106 106
 }";
107 107
         $varEtcPath  = $di->getShared('config')->path('core.varEtcPath');
108
-        $path_conf   = $varEtcPath . '/asterisk_logrotate_' . $f_name . '.conf';
108
+        $path_conf   = $varEtcPath.'/asterisk_logrotate_'.$f_name.'.conf';
109 109
         file_put_contents($path_conf, $text_config);
110 110
         $mb10 = $max_size * 1024 * 1024;
111 111
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
     public static function checkCodec($name, $desc, $type): void
203 203
     {
204
-        $codec = Codecs::findFirst('name="' . $name . '"');
204
+        $codec = Codecs::findFirst('name="'.$name.'"');
205 205
         if ($codec === null) {
206 206
             /** @var \MikoPBX\Common\Models\Codecs $codec_g722 */
207 207
             $codec              = new Codecs();
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      */
218 218
     public static function sipReload():void
219 219
     {
220
-        $di     = Di::getDefault();
220
+        $di = Di::getDefault();
221 221
         if ($di === null) {
222 222
             return;
223 223
         }
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
         }
241 241
         $old_hash   = '';
242 242
         $varEtcPath = $di->getShared('config')->path('core.varEtcPath');
243
-        if (file_exists($varEtcPath . '/topology_hash')) {
244
-            $old_hash = file_get_contents($varEtcPath . '/topology_hash');
243
+        if (file_exists($varEtcPath.'/topology_hash')) {
244
+            $old_hash = file_get_contents($varEtcPath.'/topology_hash');
245 245
         }
246
-        $now_hadh = md5($topology . $exthostname . $extipaddr);
246
+        $now_hadh = md5($topology.$exthostname.$extipaddr);
247 247
 
248 248
         $sip = new SIPConf();
249 249
         $sip->generateConfig();
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      */
268 268
     public static function iaxReload(): void
269 269
     {
270
-        $iax    = new IAXConf();
270
+        $iax = new IAXConf();
271 271
         $iax->generateConfig();
272 272
         $asteriskPath = Util::which('asterisk');
273 273
         Util::mwExec("{$asteriskPath} -rx 'iax2 reload'");
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
             'result' => 'ERROR',
319 319
         ];
320 320
 
321
-        if ( ! $this->di->getShared('registry')->booting) {
321
+        if (!$this->di->getShared('registry')->booting) {
322 322
             $this->stop();
323 323
         }
324 324
         /**
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         // Создание базы данных истории звонков.
335 335
         /** @var \Phalcon\Db\Adapter\Pdo\Sqlite $connection */
336 336
         $connection = $this->di->get('dbCDR');
337
-        if ( ! $connection->tableExists('cdr')) {
337
+        if (!$connection->tableExists('cdr')) {
338 338
             RegisterDIServices::recreateDBConnections();
339 339
         } else {
340 340
             CdrDb::checkDb();
Please login to merge, or discard this patch.
src/Core/System/System.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public function timezoneConfigure(): void
185 185
     {
186
-        $timezone = $this->mikoPBXConfig->getGeneralSettings('PBXTimezone');;
186
+        $timezone = $this->mikoPBXConfig->getGeneralSettings('PBXTimezone'); ;
187 187
         if (file_exists('/etc/TZ')) {
188 188
             unlink("/etc/TZ");
189 189
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         }
193 193
         if ($timezone) {
194 194
             $zone_file = "/usr/share/zoneinfo/{$timezone}";
195
-            if ( ! file_exists($zone_file)) {
195
+            if (!file_exists($zone_file)) {
196 196
                 return;
197 197
             }
198 198
             $cpPath = Util::which('cp');
Please login to merge, or discard this patch.