Passed
Pull Request — master (#23)
by Nikolay
09:42 queued 03:08
created
src/Core/Workers/WorkerBase.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
     {
106 106
         $pingTube = $this->makePingTubeName(static::class);
107 107
         if ($pingTube === $parameters['UserEvent']) {
108
-            $this->am->UserEvent("{$pingTube}Pong", []);
108
+            $this->am->UserEvent("{$pingTube}pong", []);
109 109
 
110 110
             return true;
111 111
         }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             file_put_contents($this->getPidFile(), $activeProcesses);
48 48
         } else {
49 49
             $pidFilesDir = dirname($this->getPidFile());
50
-            $pidFile     = $pidFilesDir . '/' . pathinfo($this->getPidFile(), PATHINFO_BASENAME);
50
+            $pidFile     = $pidFilesDir.'/'.pathinfo($this->getPidFile(), PATHINFO_BASENAME);
51 51
             // Delete old PID files
52 52
             $rm = Util::which('rm');
53 53
             Processes::mwExec("{$rm} -rf {$pidFile}*");
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public function pingCallBack(BeanstalkClient $message): void
87 87
     {
88
-        $message->reply(json_encode($message->getBody() . ':pong'));
88
+        $message->reply(json_encode($message->getBody().':pong'));
89 89
     }
90 90
 
91 91
     /**
Please login to merge, or discard this patch.
src/AdminCabinet/Controllers/NetworkController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $internetInterface = LanInterfaces::findFirstByInternet('1');
38 38
         if ($internetInterface === null) {
39 39
             $internetInterface = new LanInterfaces();
40
-            $internetInterface->id     = 1;
40
+            $internetInterface->id = 1;
41 41
         }
42 42
 
43 43
         // We will find additional interfaces which we can delete
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function saveAction(): void
62 62
     {
63
-        if ( ! $this->request->isPost()) {
63
+        if (!$this->request->isPost()) {
64 64
             return;
65 65
         }
66 66
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
                 case 'extipaddr':
126 126
                     if ($itIsInternetInterfce) {
127 127
                         if (array_key_exists($name, $data)) {
128
-                            $eth->$name = ($data['usenat'] === 'on') ? $data[$name] : $data['ipaddr_' . $eth->id];
128
+                            $eth->$name = ($data['usenat'] === 'on') ? $data[$name] : $data['ipaddr_'.$eth->id];
129 129
                         } else {
130
-                            $eth->$name = $data['ipaddr_' . $eth->id];
130
+                            $eth->$name = $data['ipaddr_'.$eth->id];
131 131
                         }
132 132
                     } else {
133 133
                         $eth->$name = '';
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
                     }
147 147
                     break;
148 148
                 case 'dhcp':
149
-                    if (array_key_exists($name . '_' . $eth->id, $data)) {
150
-                        $eth->$name = ($data['dhcp_' . $eth->id]) === 'on' ? '1' : '0';
149
+                    if (array_key_exists($name.'_'.$eth->id, $data)) {
150
+                        $eth->$name = ($data['dhcp_'.$eth->id]) === 'on' ? '1' : '0';
151 151
                     }
152 152
                     break;
153 153
                 case 'internet':
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
                 case 'ipaddr':
157 157
                 case 'subnet':
158 158
                     $eth->$name = '';
159
-                    if (array_key_exists($name . '_' . $eth->id, $data)) {
160
-                        $eth->$name = ($data['dhcp_' . $eth->id]) === 'on' ? '' : $data[$name . '_' . $eth->id];
159
+                    if (array_key_exists($name.'_'.$eth->id, $data)) {
160
+                        $eth->$name = ($data['dhcp_'.$eth->id]) === 'on' ? '' : $data[$name.'_'.$eth->id];
161 161
                     }
162 162
                     break;
163 163
                 case 'interface':
164 164
                     if ($eth->id === 0) {
165
-                        $eth->$name = LanInterfaces::findFirstById($data[$name . '_' . $eth->id])->interface;
165
+                        $eth->$name = LanInterfaces::findFirstById($data[$name.'_'.$eth->id])->interface;
166 166
                     }
167 167
                     break;
168 168
                 case 'domain':
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
                     }
178 178
                     break;
179 179
                 default:
180
-                    if (array_key_exists($name . '_' . $eth->id, $data)) {
181
-                        $eth->$name = $data[$name . '_' . $eth->id];
180
+                    if (array_key_exists($name.'_'.$eth->id, $data)) {
181
+                        $eth->$name = $data[$name.'_'.$eth->id];
182 182
                     }
183 183
             }
184 184
         }
Please login to merge, or discard this patch.
src/PBXCoreREST/Workers/WorkerDownloader.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
         ini_set('memory_limit', '300M');
42 42
 
43 43
         $temp_dir            = dirname($this->settings['res_file']);
44
-        $this->progress_file = $temp_dir . '/progress';
45
-        $this->error_file    = $temp_dir . '/error';
44
+        $this->progress_file = $temp_dir.'/progress';
45
+        $this->error_file    = $temp_dir.'/error';
46 46
 
47 47
         $result = $this->getFile();
48 48
         $result = $result && $this->checkFile();
49
-        if ( ! $result) {
49
+        if (!$result) {
50 50
             Util::sysLogMsg(__CLASS__, 'Download error...');
51 51
         }
52 52
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         if (file_exists($this->settings['res_file'])) {
63 63
             unlink($this->settings['res_file']);
64 64
         }
65
-        if (isset($this->settings['size'])){
65
+        if (isset($this->settings['size'])) {
66 66
             $this->file_size = $this->settings['size'];
67 67
         } else {
68 68
             $this->file_size = $this->remoteFileSize($this->settings['url']);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
         $fp = fopen($this->settings['res_file'], 'w');
74 74
         $ch = curl_init();
75
-        if ( ! is_resource($ch)) {
75
+        if (!is_resource($ch)) {
76 76
             return false;
77 77
         }
78 78
         curl_setopt($ch, CURLOPT_FILE, $fp);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function checkFile(): bool
124 124
     {
125
-        if ( ! file_exists($this->settings['res_file'])) {
125
+        if (!file_exists($this->settings['res_file'])) {
126 126
             file_put_contents($this->error_file, 'File did not upload', FILE_APPEND);
127 127
 
128 128
             return false;
Please login to merge, or discard this patch.
src/PBXCoreREST/Workers/WorkerMergeUploadedFile.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         } else {
42 42
             Util::sysLogMsg(
43 43
                 'UploadFile',
44
-                "File {$settings['fullUploadedFileName']} size {$resultFileSize} does not equal {$settings['resumableTotalSize']}"
44
+                "file {$settings['fullUploadedFileName']} size {$resultFileSize} does not equal {$settings['resumableTotalSize']}"
45 45
             );
46 46
         }
47 47
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
     public function start($argv): void
22 22
     {
23 23
         $settings_file = trim($argv[1]);
24
-        if ( ! file_exists($settings_file)) {
24
+        if (!file_exists($settings_file)) {
25 25
             Util::sysLogMsg(__CLASS__, 'File with settings not found');
26 26
 
27 27
             return;
28 28
         }
29 29
         $settings = json_decode(file_get_contents($settings_file), true);
30
-        $progress_file = $settings['tempDir'] . '/merging_progress';
30
+        $progress_file = $settings['tempDir'].'/merging_progress';
31 31
         $this->mergeFilesInDirectory(
32 32
             $settings['tempDir'],
33 33
             $settings['resumableFilename'],
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
         // Check filesize is equal uploaded size
40 40
         $resultFileSize = filesize($settings['fullUploadedFileName']);
41
-        if ((int)$settings['resumableTotalSize'] === $resultFileSize) {
41
+        if ((int) $settings['resumableTotalSize'] === $resultFileSize) {
42 42
             file_put_contents($progress_file, '100');
43 43
         } else {
44 44
             Util::sysLogMsg(
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
         // Delete uploaded file after 10 minutes
51 51
         Processes::mwExecBg(
52
-            '/sbin/shell_functions.sh killprocesses ' . $settings['tempDir'] . ' -TERM 0;rm -rf ' . $settings['tempDir'],
52
+            '/sbin/shell_functions.sh killprocesses '.$settings['tempDir'].' -TERM 0;rm -rf '.$settings['tempDir'],
53 53
             '/dev/null',
54 54
             600
55 55
         );
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         // Restore original file from chunks
76 76
         if (($fp = fopen($result_file, 'w')) !== false) {
77 77
             for ($i = 1; $i <= $total_files; $i++) {
78
-                $tmp_file = $tempDir . '/' . $fileName . '.part' . $i;
78
+                $tmp_file = $tempDir.'/'.$fileName.'.part'.$i;
79 79
                 fwrite($fp, file_get_contents($tmp_file));
80 80
                 unlink($tmp_file);
81 81
                 $currentProgress = round($i / $total_files * 100);
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
             }
85 85
             fclose($fp);
86 86
         } else {
87
-            Util::sysLogMsg('UploadFile', 'cannot create the destination file - ' . $result_file);
87
+            Util::sysLogMsg('UploadFile', 'cannot create the destination file - '.$result_file);
88 88
 
89 89
             return;
90 90
         }
91
-        Util::sysLogMsg('UploadFile', 'destination file - ' . $result_file);
91
+        Util::sysLogMsg('UploadFile', 'destination file - '.$result_file);
92 92
     }
93 93
 }
94 94
 
Please login to merge, or discard this patch.
src/Modules/Setup/PbxExtensionSetupBase.php 2 patches
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -377,13 +377,13 @@  discard block
 block discarded – undo
377 377
         $module = PbxExtensionModules::findFirstByUniqid($this->moduleUniqueID);
378 378
         if ( ! $module) {
379 379
             $module           = new PbxExtensionModules();
380
-            $module->name     = $this->locString("Breadcrumb{$this->moduleUniqueID}");
380
+            $module->name     = $this->locString("breadcrumb{$this->moduleUniqueID}");
381 381
             $module->disabled = '1';
382 382
         }
383 383
         $module->uniqid        = $this->moduleUniqueID;
384 384
         $module->developer     = $this->developer;
385 385
         $module->version       = $this->version;
386
-        $module->description   = $this->locString("SubHeader{$this->moduleUniqueID}");
386
+        $module->description   = $this->locString("subheader{$this->moduleUniqueID}");
387 387
         $module->support_email = $this->support_email;
388 388
 
389 389
         return $module->save();
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
      */
470 470
     public function addToSidebar(): bool
471 471
     {
472
-        $menuSettingsKey           = "AdditionalMenuItem{$this->moduleUniqueID}";
472
+        $menuSettingsKey           = "additionalmenuitem{$this->moduleUniqueID}";
473 473
         $unCamelizedControllerName = Text::uncamelize($this->moduleUniqueID, '-');
474 474
         $menuSettings              = PbxSettings::findFirstByKey($menuSettingsKey);
475 475
         if ($menuSettings === null) {
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
             'href'          => "/admin-cabinet/{$unCamelizedControllerName}",
482 482
             'group'         => 'modules',
483 483
             'iconClass'     => 'puzzle',
484
-            'caption'       => "Breadcrumb{$this->moduleUniqueID}",
484
+            'caption'       => "breadcrumb{$this->moduleUniqueID}",
485 485
             'showAtSidebar' => true,
486 486
         ];
487 487
         $menuSettings->value = json_encode($value);
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
         $this->messages = [];
117 117
         $this->db      = $this->getDI()->getShared('db');
118 118
         $this->config  = $this->getDI()->getShared('config');
119
-        $this->license =  $this->getDI()->getShared('license');
120
-        $this->moduleDir = $this->config->path('core.modulesDir') . '/' . $this->moduleUniqueID;
119
+        $this->license = $this->getDI()->getShared('license');
120
+        $this->moduleDir = $this->config->path('core.modulesDir').'/'.$this->moduleUniqueID;
121 121
         $settings_file = "{$this->moduleDir}/module.json";
122 122
         if (file_exists($settings_file)) {
123 123
             $module_settings = json_decode(file_get_contents($settings_file), true);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             }
142 142
         }
143 143
 
144
-        $this->messages  = [];
144
+        $this->messages = [];
145 145
 
146 146
 
147 147
     }
@@ -156,21 +156,21 @@  discard block
 block discarded – undo
156 156
     {
157 157
         $result = true;
158 158
         try {
159
-            if ( ! $this->activateLicense()) {
159
+            if (!$this->activateLicense()) {
160 160
                 $this->messages[] = 'License activate error';
161 161
                 $result           = false;
162 162
             }
163
-            if ( ! $this->installFiles()) {
163
+            if (!$this->installFiles()) {
164 164
                 $this->messages[] = ' installFiles error';
165 165
                 $result           = false;
166 166
             }
167
-            if ( ! $this->installDB()) {
167
+            if (!$this->installDB()) {
168 168
                 $this->messages[] = ' installDB error';
169 169
                 $result           = false;
170 170
             }
171 171
             $this->fixFilesRights();
172 172
         } catch (Throwable $exception) {
173
-            $result         = false;
173
+            $result = false;
174 174
             $this->messages[] = $exception->getMessage();
175 175
         }
176 176
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         PbxExtensionUtils::createAgiBinSymlinks($this->moduleUniqueID);
202 202
 
203 203
         // Restore database settings
204
-        $modulesDir          = $this->config->path('core.modulesDir');
204
+        $modulesDir = $this->config->path('core.modulesDir');
205 205
         $backupPath = "{$modulesDir}/Backup/{$this->moduleUniqueID}";
206 206
         if (is_dir($backupPath)) {
207 207
             $cpPath = Util::which('cp');
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
             "{$this->moduleDir}/bin"
225 225
         ];
226 226
         foreach ($dirs as $dir) {
227
-            if(file_exists($dir) && is_dir($dir)){
227
+            if (file_exists($dir) && is_dir($dir)) {
228 228
                 // Add executable right to module's binary
229 229
                 Util::addExecutableRights($dir);
230 230
             }
@@ -259,16 +259,16 @@  discard block
 block discarded – undo
259 259
     {
260 260
         $result = true;
261 261
         try {
262
-            if ( ! $this->unInstallDB($keepSettings)) {
262
+            if (!$this->unInstallDB($keepSettings)) {
263 263
                 $this->messages[] = ' unInstallDB error';
264 264
                 $result           = false;
265 265
             }
266
-            if ($result && ! $this->unInstallFiles($keepSettings)) {
266
+            if ($result && !$this->unInstallFiles($keepSettings)) {
267 267
                 $this->messages[] = ' unInstallFiles error';
268 268
                 $result           = false;
269 269
             }
270 270
         } catch (Throwable $exception) {
271
-            $result         = false;
271
+            $result = false;
272 272
             $this->messages[] = $exception->getMessage();
273 273
         }
274 274
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
     {
317 317
         $cpPath = Util::which('cp');
318 318
         $rmPath = Util::which('rm');
319
-        $modulesDir          = $this->config->path('core.modulesDir');
319
+        $modulesDir = $this->config->path('core.modulesDir');
320 320
         $backupPath = "{$modulesDir}/Backup/{$this->moduleUniqueID}";
321 321
         Processes::mwExec("{$rmPath} -rf {$backupPath}");
322 322
         if ($keepSettings) {
@@ -329,21 +329,21 @@  discard block
 block discarded – undo
329 329
         // IMG
330 330
         $imgCacheDir = appPath('sites/admin-cabinet/assets/img/cache');
331 331
         $moduleImageCacheDir = "{$imgCacheDir}/{$this->moduleUniqueID}";
332
-        if (file_exists($moduleImageCacheDir)){
332
+        if (file_exists($moduleImageCacheDir)) {
333 333
             unlink($moduleImageCacheDir);
334 334
         }
335 335
 
336 336
         // CSS
337 337
         $cssCacheDir = appPath('sites/admin-cabinet/assets/css/cache');
338 338
         $moduleCSSCacheDir = "{$cssCacheDir}/{$this->moduleUniqueID}";
339
-        if (file_exists($moduleCSSCacheDir)){
339
+        if (file_exists($moduleCSSCacheDir)) {
340 340
             unlink($moduleCSSCacheDir);
341 341
         }
342 342
 
343 343
         // JS
344 344
         $jsCacheDir = appPath('sites/admin-cabinet/assets/js/cache');
345 345
         $moduleJSCacheDir = "{$jsCacheDir}/{$this->moduleUniqueID}";
346
-        if (file_exists($moduleJSCacheDir)){
346
+        if (file_exists($moduleJSCacheDir)) {
347 347
             unlink($moduleJSCacheDir);
348 348
         }
349 349
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         }
378 378
 
379 379
         $module = PbxExtensionModules::findFirstByUniqid($this->moduleUniqueID);
380
-        if ( ! $module) {
380
+        if (!$module) {
381 381
             $module           = new PbxExtensionModules();
382 382
             $module->name     = $this->locString("Breadcrumb{$this->moduleUniqueID}");
383 383
             $module->disabled = '1';
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
         $language             = substr(PbxSettings::getValueByKey('WebAdminLanguage'), 0, 2);
404 404
         $translates           = [];
405 405
         $extensionsTranslates = [[]];
406
-        $results              = glob($this->moduleDir . '/{Messages}/en.php', GLOB_BRACE);
406
+        $results              = glob($this->moduleDir.'/{Messages}/en.php', GLOB_BRACE);
407 407
         foreach ($results as $path) {
408 408
             $langArr = require $path;
409 409
             if (is_array($langArr)) {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
         }
416 416
         if ($language !== 'en') {
417 417
             $additionalTranslates = [[]];
418
-            $results              = glob($this->moduleDir . "/{Messages}/{$language}.php", GLOB_BRACE);
418
+            $results              = glob($this->moduleDir."/{Messages}/{$language}.php", GLOB_BRACE);
419 419
             foreach ($results as $path) {
420 420
                 $langArr = require $path;
421 421
                 if (is_array($langArr)) {
@@ -446,13 +446,13 @@  discard block
 block discarded – undo
446 446
         // Add new connection for this module after add new Models folder
447 447
         RegisterDIServices::recreateModulesDBConnections();
448 448
 
449
-        $results = glob($this->moduleDir . '/Models/*.php', GLOB_NOSORT);
449
+        $results = glob($this->moduleDir.'/Models/*.php', GLOB_NOSORT);
450 450
         $dbUpgrade = new UpdateDatabase();
451 451
         foreach ($results as $file) {
452 452
             $className        = pathinfo($file)['filename'];
453 453
             $moduleModelClass = "\\Modules\\{$this->moduleUniqueID}\\Models\\{$className}";
454 454
             $upgradeResult = $dbUpgrade->createUpdateDbTableByAnnotations($moduleModelClass);
455
-            if (!$upgradeResult){
455
+            if (!$upgradeResult) {
456 456
                 return false;
457 457
             }
458 458
 
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
             $menuSettings      = new PbxSettings();
479 479
             $menuSettings->key = $menuSettingsKey;
480 480
         }
481
-        $value               = [
481
+        $value = [
482 482
             'uniqid'        => $this->moduleUniqueID,
483 483
             'href'          => "/admin-cabinet/{$unCamelizedControllerName}",
484 484
             'group'         => 'modules',
Please login to merge, or discard this patch.
src/PBXCoreREST/Lib/FirewallManagementProcessor.php 4 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
         if(!file_exists($path_db)){
137 137
             // Таблица не существует. Бана нет.
138 138
             $res->success    = false;
139
-            $res->messages[] = "DB {$path_db} not found";
139
+            $res->messages[] = "db {$path_db} not found";
140 140
             return $res;
141 141
         }
142 142
         $db      = new SQLite3($path_db);
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -80,22 +80,22 @@
 block discarded – undo
80 80
         return $res;
81 81
     }
82 82
 
83
-     public static function getDbConnection(){
84
-         if(!file_exists(Fail2BanConf::FAIL2BAN_DB_PATH)){
85
-             return null;
86
-         }
87
-         try {
88
-             $db      = new SQLite3(Fail2BanConf::FAIL2BAN_DB_PATH);
89
-         }catch (Throwable $e){
90
-             return null;
91
-         }
92
-         $db->busyTimeout(5000);
93
-         $fail2ban = new Fail2BanConf();
94
-         if (false === $fail2ban->tableBanExists($db)) {
95
-             return null;
96
-         }
83
+        public static function getDbConnection(){
84
+            if(!file_exists(Fail2BanConf::FAIL2BAN_DB_PATH)){
85
+                return null;
86
+            }
87
+            try {
88
+                $db      = new SQLite3(Fail2BanConf::FAIL2BAN_DB_PATH);
89
+            }catch (Throwable $e){
90
+                return null;
91
+            }
92
+            $db->busyTimeout(5000);
93
+            $fail2ban = new Fail2BanConf();
94
+            if (false === $fail2ban->tableBanExists($db)) {
95
+                return null;
96
+            }
97 97
 
98
-         return $db;
98
+            return $db;
99 99
     }
100 100
 
101 101
     /**
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,13 +80,14 @@
 block discarded – undo
80 80
         return $res;
81 81
     }
82 82
 
83
-     public static function getDbConnection(){
83
+     public static function getDbConnection()
84
+     {
84 85
          if(!file_exists(Fail2BanConf::FAIL2BAN_DB_PATH)){
85 86
              return null;
86 87
          }
87 88
          try {
88 89
              $db      = new SQLite3(Fail2BanConf::FAIL2BAN_DB_PATH);
89
-         }catch (Throwable $e){
90
+         } catch (Throwable $e){
90 91
              return null;
91 92
          }
92 93
          $db->busyTimeout(5000);
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public static function fail2banUnbanAll(string $ip): PBXApiResult
32 32
     {
33
-        $ip     = trim($ip);
33
+        $ip = trim($ip);
34 34
         $res = new PBXApiResult();
35 35
         $res->processor = __METHOD__;
36 36
         $res->success = true;
37
-        if ( ! Verify::isIpAddress($ip)) {
37
+        if (!Verify::isIpAddress($ip)) {
38 38
             $res->success = false;
39
-            $res->messages[]="Not valid ip '{$ip}'.";
39
+            $res->messages[] = "Not valid ip '{$ip}'.";
40 40
         }
41
-        $fail2ban        = new Fail2BanConf();
41
+        $fail2ban = new Fail2BanConf();
42 42
         if ($fail2ban->fail2ban_enable) {
43 43
             $fail2ban = Util::which('fail2ban-client');
44
-            $res->success  = (Processes::mwExec("{$fail2ban} unban {$ip}") === 0);
44
+            $res->success = (Processes::mwExec("{$fail2ban} unban {$ip}") === 0);
45 45
         } else {
46 46
             $res = self::fail2banUnbanDb($ip);
47 47
         }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $res->processor = __METHOD__;
63 63
 
64 64
         $db = self::getDbConnection();
65
-        if(!$db){
65
+        if (!$db) {
66 66
             // Таблица не существует. Бана нет.
67 67
             $res->success    = false;
68 68
             $res->messages[] = 'DB '.Fail2BanConf::FAIL2BAN_DB_PATH.' not found';
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
         return $res;
82 82
     }
83 83
 
84
-     public static function getDbConnection(){
85
-         if(!file_exists(Fail2BanConf::FAIL2BAN_DB_PATH)){
84
+     public static function getDbConnection() {
85
+         if (!file_exists(Fail2BanConf::FAIL2BAN_DB_PATH)) {
86 86
              return null;
87 87
          }
88 88
          try {
89
-             $db      = new SQLite3(Fail2BanConf::FAIL2BAN_DB_PATH);
90
-         }catch (Throwable $e){
89
+             $db = new SQLite3(Fail2BanConf::FAIL2BAN_DB_PATH);
90
+         } catch (Throwable $e) {
91 91
              return null;
92 92
          }
93 93
          $db->busyTimeout(5000);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             $ban_time = '43800';
113 113
         }
114 114
         // Добавленн фильтр по времени бана. возвращаем только адреса, которые еще НЕ разбанены.
115
-        $q = 'SELECT' . ' DISTINCT jail,ip,MAX(timeofban) AS timeofban, MAX(timeofban+' . $ban_time . ') AS timeunban FROM bans where (timeofban+' . $ban_time . ')>' . time();
115
+        $q = 'SELECT'.' DISTINCT jail,ip,MAX(timeofban) AS timeofban, MAX(timeofban+'.$ban_time.') AS timeunban FROM bans where (timeofban+'.$ban_time.')>'.time();
116 116
         if ($ip !== null) {
117 117
             $q .= " AND ip='{$ip}'";
118 118
         }
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 
136 136
         $jail_q  = ($jail === '') ? '' : "AND jail = '{$jail}'";
137 137
         $path_db = Fail2BanConf::FAIL2BAN_DB_PATH;
138
-        if(!file_exists($path_db)){
138
+        if (!file_exists($path_db)) {
139 139
             // Таблица не существует. Бана нет.
140 140
             $res->success    = false;
141 141
             $res->messages[] = "DB {$path_db} not found";
142 142
             return $res;
143 143
         }
144
-        $db      = new SQLite3($path_db);
144
+        $db = new SQLite3($path_db);
145 145
         $db->busyTimeout(3000);
146 146
         $fail2ban = new Fail2BanConf();
147 147
         if (false === $fail2ban->tableBanExists($db)) {
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             $res->success = true;
150 150
             return $res;
151 151
         }
152
-        $q = 'DELETE' . " FROM bans WHERE ip = '{$ip}' {$jail_q}";
152
+        $q = 'DELETE'." FROM bans WHERE ip = '{$ip}' {$jail_q}";
153 153
         $db->query($q);
154 154
 
155 155
         $err = $db->lastErrorMsg();
Please login to merge, or discard this patch.
src/Core/Workers/WorkerCdr.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -241,7 +241,8 @@
 block discarded – undo
241 241
 
242 242
     /**
243 243
      */
244
-    private function getCheckResult(){
244
+    private function getCheckResult()
245
+    {
245 246
         $result_data = $this->client_queue->getBody();
246 247
         // Получаем результат.
247 248
         $result = json_decode($result_data, true);
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             ]
90 90
         ];
91 91
 
92
-        $results   = Users::find($parameters);
92
+        $results = Users::find($parameters);
93 93
         foreach ($results as $record) {
94 94
             if (empty($record->email)) {
95 95
                 continue;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      */
159 159
     private function getActiveIdChannels(): array
160 160
     {
161
-        $am           = Util::getAstManager('off');
161
+        $am = Util::getAstManager('off');
162 162
         return $am->GetChannels(true);
163 163
     }
164 164
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             $this->no_answered_calls[$row['linkedid']]['NOANSWER'] = false;
174 174
             return;
175 175
         }
176
-        if ( ! array_key_exists($row['dst_num'], $this->internal_numbers)) {
176
+        if (!array_key_exists($row['dst_num'], $this->internal_numbers)) {
177 177
             // dst_num - не является номером сотрудника. Это исходящий.
178 178
             return;
179 179
         }
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
             if (!empty($row['recordingfile'])) {
239 239
                 // Удаляем файлы
240 240
                 $p_info = pathinfo($row['recordingfile']);
241
-                $fileName = $p_info['dirname'] . '/' . $p_info['filename'];
242
-                $file_list = [$fileName . '.mp3', $fileName . '.wav', $fileName . '_in.wav', $fileName . '_out.wav',];
241
+                $fileName = $p_info['dirname'].'/'.$p_info['filename'];
242
+                $file_list = [$fileName.'.mp3', $fileName.'.wav', $fileName.'_in.wav', $fileName.'_out.wav', ];
243 243
                 foreach ($file_list as $file) {
244 244
                     if (!file_exists($file) || is_dir($file)) {
245 245
                         continue;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
     /**
263 263
      */
264
-    private function getCheckResult(){
264
+    private function getCheckResult() {
265 265
         $result_data = $this->client_queue->getBody();
266 266
         // Получаем результат.
267 267
         $result = json_decode($result_data, true);
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             }
273 273
             $result = $file_data;
274 274
         }
275
-        if ( ! is_array($result) && ! is_object($result)) {
275
+        if (!is_array($result) && !is_object($result)) {
276 276
             $result = [];
277 277
         }
278 278
         return $result;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
                 Processes::mwExec("rm -rf {$row['recordingfile']}");
298 298
             }
299 299
         } elseif (!empty($row['recordingfile']) &&
300
-            !file_exists(Util::trimExtensionForFile($row['recordingfile']) . '.wav') &&
300
+            !file_exists(Util::trimExtensionForFile($row['recordingfile']).'.wav') &&
301 301
             !file_exists($row['recordingfile'])) {
302 302
             /** @var CallDetailRecordsTmp $rec_data */
303 303
             $rec_data = CallDetailRecordsTmp::findFirst("linkedid='{$row['linkedid']}' AND dst_chan='{$row['dst_chan']}'");
Please login to merge, or discard this patch.
src/Core/Asterisk/Configs/FeaturesConf.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
 
20 20
     protected function generateConfigProtected(): void
21 21
     {
22
-        $conf             = "[general]\n" .
23
-            "featuredigittimeout = {$this->generalSettings['PBXFeatureDigitTimeout']}\n" .
24
-            "atxfernoanswertimeout = {$this->generalSettings['PBXFeatureAtxferNoAnswerTimeout']}\n" .
25
-            "transferdigittimeout = {$this->generalSettings['PBXFeatureTransferDigitTimeout']}\n" .
26
-            "pickupexten = {$this->generalSettings['PBXFeaturePickupExten']}\n" .
27
-            "atxferabort = *0\n" .
28
-            "\n" .
29
-            "[featuremap]\n" .
30
-            "atxfer => {$this->generalSettings['PBXFeatureAttendedTransfer']}\n" .
31
-            "disconnect = *0\n" .
22
+        $conf = "[general]\n".
23
+            "featuredigittimeout = {$this->generalSettings['PBXFeatureDigitTimeout']}\n".
24
+            "atxfernoanswertimeout = {$this->generalSettings['PBXFeatureAtxferNoAnswerTimeout']}\n".
25
+            "transferdigittimeout = {$this->generalSettings['PBXFeatureTransferDigitTimeout']}\n".
26
+            "pickupexten = {$this->generalSettings['PBXFeaturePickupExten']}\n".
27
+            "atxferabort = *0\n".
28
+            "\n".
29
+            "[featuremap]\n".
30
+            "atxfer => {$this->generalSettings['PBXFeatureAttendedTransfer']}\n".
31
+            "disconnect = *0\n".
32 32
             "blindxfer => {$this->generalSettings['PBXFeatureBlindTransfer']}\n";
33 33
 
34 34
         $additionalModules = $this->di->getShared('pbxConfModules');
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             $conf .= $appClass->getFeatureMap();
37 37
         }
38 38
 
39
-        Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/features.conf', $conf);
39
+        Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/features.conf', $conf);
40 40
     }
41 41
 
42 42
     // Секция global для extensions.conf.
Please login to merge, or discard this patch.
src/Modules/PbxExtensionUtils.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         $moduleAgiBinDir = "{$moduleDir}/agi-bin";
116 116
         $files           = glob("$moduleAgiBinDir/*.{php}", GLOB_BRACE);
117 117
         foreach ($files as $file) {
118
-            $newFilename = $agiBinDir . '/' . basename($file);
118
+            $newFilename = $agiBinDir.'/'.basename($file);
119 119
             Util::createUpdateSymlink($file, $newFilename);
120 120
         }
121 121
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             $needDisable = false;
137 137
             $moduleDir   = PbxExtensionUtils::getModuleDir($module['uniqid']);
138 138
             $moduleJson  = "{$moduleDir}/module.json";
139
-            if ( ! file_exists($moduleJson)) {
139
+            if (!file_exists($moduleJson)) {
140 140
                 $needDisable = true;
141 141
             }
142 142
             $jsonString            = file_get_contents($moduleJson);
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
                 } catch (Throwable $exception) {
153 153
                     Util::sysLogMsg(__CLASS__, "Can not disable module {$module['uniqid']} Message: {$exception}");
154 154
                 } finally {
155
-                    $currentModule           = PbxExtensionModules::findFirstByUniqid($module['uniqid']);
156
-                    if ($currentModule->disabled==='0'){
155
+                    $currentModule = PbxExtensionModules::findFirstByUniqid($module['uniqid']);
156
+                    if ($currentModule->disabled === '0') {
157 157
                         $currentModule->disabled = '1';
158 158
                         $currentModule->update();
159 159
                     }
Please login to merge, or discard this patch.