@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | return [ |
3 | 3 | /** |
4 | - * Copyright © MIKO LLC - All Rights Reserved |
|
5 | - * Unauthorized copying of this file, via any medium is strictly prohibited |
|
6 | - * Proprietary and confidential |
|
7 | - * Written by Alexey Portnov, 8 2020 |
|
8 | - */ |
|
4 | + * Copyright © MIKO LLC - All Rights Reserved |
|
5 | + * Unauthorized copying of this file, via any medium is strictly prohibited |
|
6 | + * Proprietary and confidential |
|
7 | + * Written by Alexey Portnov, 8 2020 |
|
8 | + */ |
|
9 | 9 | 'January' => 'January', |
10 | 10 | 'February' => 'February', |
11 | 11 | 'March' => 'March', |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $conf .= $this->generateGeneral(); |
31 | 31 | $conf .= $this->generateProviders(); |
32 | 32 | |
33 | - Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/iax.conf', $conf); |
|
34 | - file_put_contents($this->config->path('asterisk.astetcdir') . '/iaxprov.conf', "[default]\ncodec=alaw\n"); |
|
33 | + Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/iax.conf', $conf); |
|
34 | + file_put_contents($this->config->path('asterisk.astetcdir').'/iaxprov.conf', "[default]\ncodec=alaw\n"); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | private function getProviders(): array |
42 | 42 | { |
43 | - $data_providers =[]; |
|
43 | + $data_providers = []; |
|
44 | 44 | // Получим настройки всех аккаунтов. |
45 | - $arrIaxProviders = Iax::find("disabled IS NULL OR disabled = '0'"); |
|
45 | + $arrIaxProviders = Iax::find("disabled IS NULL OR disabled = '0'"); |
|
46 | 46 | foreach ($arrIaxProviders as $peer) { |
47 | 47 | /** @var \MikoPBX\Common\Models\Iax $peer */ |
48 | 48 | $arr_data = $peer->toArray(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'conditions'=>'disabled="0"', |
57 | 57 | 'order' => 'type, priority', |
58 | 58 | ]; |
59 | - $codecs = Codecs::find($filter); |
|
59 | + $codecs = Codecs::find($filter); |
|
60 | 60 | foreach ($codecs as $ob_codec) { |
61 | 61 | $arr_data['codecs'][] = $ob_codec->name; |
62 | 62 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | private function generateGeneral(): string |
93 | 93 | { |
94 | 94 | $iax_port = (trim($this->generalSettings['IAXPort']) !== '') ? $this->generalSettings['IAXPort'] : '4569'; |
95 | - $conf = '[general]' . "\n"; |
|
95 | + $conf = '[general]'."\n"; |
|
96 | 96 | // $conf .= "context=public-direct-dial \n"; |
97 | 97 | $conf .= "bindport={$iax_port}\n"; |
98 | 98 | $conf .= "bindaddr=0.0.0.0\n"; |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | $secret = (trim($provider['secret']) == '') ? '' : ":{$provider['secret']}"; |
153 | 153 | $host = $provider['host']; |
154 | 154 | // $port = (trim($provider['port']) =='')?'':":{$provider['port']}"; |
155 | - $port = ''; |
|
155 | + $port = ''; |
|
156 | 156 | $reg_strings .= "register => {$user}{$secret}@{$host}{$port} \n"; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - return $reg_strings . "\n" . $prov_config; |
|
160 | + return $reg_strings."\n".$prov_config; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | } |
@@ -91,10 +91,10 @@ |
||
91 | 91 | |
92 | 92 | $codecs = json_decode($data['codecs'], true); |
93 | 93 | foreach ($codecs as $codec){ |
94 | - $record = Codecs::findFirstById($codec['codecId']); |
|
95 | - $record->priority = $codec['priority']; |
|
96 | - $record->disabled = $codec['disabled']===true?'1':'0'; |
|
97 | - $record->update(); |
|
94 | + $record = Codecs::findFirstById($codec['codecId']); |
|
95 | + $record->priority = $codec['priority']; |
|
96 | + $record->disabled = $codec['disabled']===true?'1':'0'; |
|
97 | + $record->update(); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $this->flash->success($this->translation->_('ms_SuccessfulSaved')); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function saveAction(): void |
41 | 41 | { |
42 | - if ( ! $this->request->isPost()) { |
|
42 | + if (!$this->request->isPost()) { |
|
43 | 43 | return; |
44 | 44 | } |
45 | 45 | $data = $this->request->getPost(); |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | $codecs = json_decode($data['codecs'], true); |
93 | - foreach ($codecs as $codec){ |
|
93 | + foreach ($codecs as $codec) { |
|
94 | 94 | $record = Codecs::findFirstById($codec['codecId']); |
95 | 95 | $record->priority = $codec['priority']; |
96 | - $record->disabled = $codec['disabled']===true?'1':'0'; |
|
96 | + $record->disabled = $codec['disabled'] === true ? '1' : '0'; |
|
97 | 97 | $record->update(); |
98 | 98 | } |
99 | 99 |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | if ($this->request->isAjax()) { |
37 | 37 | if ($controller !== 'SESSION') { |
38 | 38 | $sessionRo = $this->di->getShared('sessionRO'); |
39 | - if ( ! is_array($sessionRo) |
|
40 | - || ! array_key_exists('auth', $sessionRo) |
|
39 | + if (!is_array($sessionRo) |
|
40 | + || !array_key_exists('auth', $sessionRo) |
|
41 | 41 | ) { |
42 | 42 | $this->response->setStatusCode(403, 'Forbidden') |
43 | 43 | ->sendHeaders(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | } else { // не AJAX запрос |
51 | 51 | $auth = $this->session->get('auth'); |
52 | - if ( ! $auth && $controller !== 'SESSION') { |
|
52 | + if (!$auth && $controller !== 'SESSION') { |
|
53 | 53 | $dispatcher->forward( |
54 | 54 | [ |
55 | 55 | 'controller' => 'session', |
@@ -52,7 +52,8 @@ discard block |
||
52 | 52 | { |
53 | 53 | $arrWorkers = $this->prepareWorkersList(); |
54 | 54 | ReactKernel::start( |
55 | - function () use ($arrWorkers) { |
|
55 | + function () use ($arrWorkers) |
|
56 | + { |
|
56 | 57 | // Parallel execution https://github.com/recoilphp/recoil |
57 | 58 | foreach ($arrWorkers as $workersWithCurrentType) { |
58 | 59 | foreach ($workersWithCurrentType as $worker) { |
@@ -132,7 +133,8 @@ discard block |
||
132 | 133 | PBX::waitFullyBooted(); |
133 | 134 | $arrWorkers = $this->prepareWorkersList(); |
134 | 135 | ReactKernel::start( |
135 | - function () use ($arrWorkers) { |
|
136 | + function () use ($arrWorkers) |
|
137 | + { |
|
136 | 138 | // Parallel execution https://github.com/recoilphp/recoil |
137 | 139 | foreach ($arrWorkers as $workerType => $workersWithCurrentType) { |
138 | 140 | foreach ($workersWithCurrentType as $worker) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $arrWorkers = $this->prepareWorkersList(); |
44 | 44 | ReactKernel::start( |
45 | - function () use ($arrWorkers) { |
|
45 | + function() use ($arrWorkers) { |
|
46 | 46 | // Parallel execution https://github.com/recoilphp/recoil |
47 | 47 | foreach ($arrWorkers as $workersWithCurrentType) { |
48 | 48 | foreach ($workersWithCurrentType as $worker) { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | private function prepareWorkersList(): array |
63 | 63 | { |
64 | - $arrWorkers = [ |
|
64 | + $arrWorkers = [ |
|
65 | 65 | self::CHECK_BY_AMI => |
66 | 66 | [ |
67 | 67 | WorkerAmiListener::class, |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | PBX::waitFullyBooted(); |
124 | 124 | $arrWorkers = $this->prepareWorkersList(); |
125 | 125 | ReactKernel::start( |
126 | - function () use ($arrWorkers) { |
|
126 | + function() use ($arrWorkers) { |
|
127 | 127 | // Parallel execution https://github.com/recoilphp/recoil |
128 | 128 | foreach ($arrWorkers as $workerType => $workersWithCurrentType) { |
129 | 129 | foreach ($workersWithCurrentType as $worker) { |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | } catch (\Error $e) { |
175 | 175 | global $errorLogger; |
176 | 176 | $errorLogger->captureException($e); |
177 | - Util::sysLogMsg($workerClassName . '_EXCEPTION', $e->getMessage()); |
|
177 | + Util::sysLogMsg($workerClassName.'_EXCEPTION', $e->getMessage()); |
|
178 | 178 | } catch (DeadlineSoonException $e) { |
179 | - Util::sysLogMsg($workerClassName . '_EXCEPTION', $e->getMessage()); |
|
179 | + Util::sysLogMsg($workerClassName.'_EXCEPTION', $e->getMessage()); |
|
180 | 180 | } |
181 | 181 | yield; |
182 | 182 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | } catch (\Error $e) { |
250 | 250 | global $errorLogger; |
251 | 251 | $errorLogger->captureException($e); |
252 | - Util::sysLogMsg($workerClassName . '_EXCEPTION', $e->getMessage()); |
|
252 | + Util::sysLogMsg($workerClassName.'_EXCEPTION', $e->getMessage()); |
|
253 | 253 | } |
254 | 254 | yield; |
255 | 255 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | if (false === $result) { |
164 | 164 | Util::processPHPWorker($workerClassName); |
165 | - Util::sysLogMsg(__CLASS__, "Service {$workerClassName} started."); |
|
165 | + Util::sysLogMsg(__CLASS__, "service {$workerClassName} started."); |
|
166 | 166 | } |
167 | 167 | $time_elapsed_secs = microtime(true) - $start; |
168 | 168 | if ($time_elapsed_secs > 10) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | if ($res_ping === false && $level < 10) { |
234 | 234 | Util::processPHPWorker($workerClassName); |
235 | - Util::sysLogMsg(__CLASS__, "Service {$workerClassName} started."); |
|
235 | + Util::sysLogMsg(__CLASS__, "service {$workerClassName} started."); |
|
236 | 236 | // Wait 1 second while service will be ready to listen requests |
237 | 237 | sleep(1); |
238 | 238 |
@@ -19,8 +19,8 @@ |
||
19 | 19 | { |
20 | 20 | $managedCache = $this->di->get('managedCache'); |
21 | 21 | $lastLicenseCheck = $managedCache->get('lastLicenseCheck'); |
22 | - if ($lastLicenseCheck===null){ |
|
23 | - $lic = $this->di->getShared('license'); |
|
22 | + if ($lastLicenseCheck === null) { |
|
23 | + $lic = $this->di->getShared('license'); |
|
24 | 24 | $lic->checkPBX(); |
25 | 25 | $lic->checkModules(); |
26 | 26 | $managedCache->set('lastLicenseCheck', time(), 3600); |
@@ -65,18 +65,18 @@ |
||
65 | 65 | */ |
66 | 66 | public function thisIsModuleNoAuthRequest(Micro $api): bool |
67 | 67 | { |
68 | - $pattern = $api->request->getURI(true); |
|
68 | + $pattern = $api->request->getURI(true); |
|
69 | 69 | $additionalModules = $api->getService('pbxConfModules'); |
70 | 70 | foreach ($additionalModules as $appClass) { |
71 | 71 | /** @var \MikoPBX\Modules\Config\ConfigClass; $appClass */ |
72 | 72 | $additionalRoutes = $appClass->getPBXCoreRESTAdditionalRoutes(); |
73 | - if(!is_array($additionalRoutes)){ |
|
73 | + if (!is_array($additionalRoutes)) { |
|
74 | 74 | continue; |
75 | 75 | } |
76 | - foreach ($additionalRoutes as $additionalRoute){ |
|
77 | - $noAuth = $additionalRoute[5]??false; |
|
78 | - if ($noAuth===true |
|
79 | - && stripos($pattern, $additionalRoute[2])!==0){ |
|
76 | + foreach ($additionalRoutes as $additionalRoute) { |
|
77 | + $noAuth = $additionalRoute[5] ?? false; |
|
78 | + if ($noAuth === true |
|
79 | + && stripos($pattern, $additionalRoute[2]) !== 0) { |
|
80 | 80 | return true; // Allow request without authentication |
81 | 81 | } |
82 | 82 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | use ReflectionClass as ReflectionClassAlias; |
16 | 16 | |
17 | 17 | abstract class ConfigClass extends Injectable implements SystemConfigInterface, AsteriskConfigInterface, |
18 | - RestAPIConfigInterface |
|
18 | + RestAPIConfigInterface |
|
19 | 19 | { |
20 | 20 | |
21 | 21 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | if (count($partsOfNameSpace) === 3 && $partsOfNameSpace[0] === 'Modules') { |
85 | 85 | $modulesDir = $this->config->path('core.modulesDir'); |
86 | 86 | $this->moduleUniqueId = $partsOfNameSpace[1]; |
87 | - $this->moduleDir = $modulesDir . '/' . $this->moduleUniqueId; |
|
87 | + $this->moduleDir = $modulesDir.'/'.$this->moduleUniqueId; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $this->messages = []; |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | if (empty($addition)) { |
118 | 118 | return $result; |
119 | 119 | } |
120 | - if ( ! empty($this->moduleUniqueId) && ConfigClass::ID_CONFIG_CLASS !== $this->moduleUniqueId) { |
|
121 | - $result = PHP_EOL . '; ***** BEGIN BY ' . $this->moduleUniqueId . PHP_EOL; |
|
120 | + if (!empty($this->moduleUniqueId) && ConfigClass::ID_CONFIG_CLASS !== $this->moduleUniqueId) { |
|
121 | + $result = PHP_EOL.'; ***** BEGIN BY '.$this->moduleUniqueId.PHP_EOL; |
|
122 | 122 | $result .= $addition; |
123 | 123 | if (substr($addition, -1) !== "\t") { |
124 | 124 | $result .= "\t"; |
125 | 125 | } |
126 | - $result .= PHP_EOL . '; ***** END BY ' . $this->moduleUniqueId . PHP_EOL; |
|
126 | + $result .= PHP_EOL.'; ***** END BY '.$this->moduleUniqueId.PHP_EOL; |
|
127 | 127 | } else { |
128 | 128 | $result .= $addition; |
129 | 129 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | protected function echoGenerateConfig(): void |
139 | 139 | { |
140 | - if ($this->booting === true && ! empty($this->description)) { |
|
140 | + if ($this->booting === true && !empty($this->description)) { |
|
141 | 141 | echo " |- generate config {$this->description}... "; |
142 | 142 | } |
143 | 143 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected function echoDone(): void |
156 | 156 | { |
157 | - if ($this->booting === true && ! empty($this->description)) { |
|
157 | + if ($this->booting === true && !empty($this->description)) { |
|
158 | 158 | echo "\033[32;1mdone\033[0m \n"; |
159 | 159 | } |
160 | 160 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | /** |
59 | 59 | * @Column(type="string", nullable=true) {'plaintext'|'php'} |
60 | 60 | */ |
61 | - public ?string $type='plaintext'; |
|
61 | + public ?string $type = 'plaintext'; |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @Column(type="string", nullable=true) |