@@ -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, 7 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, 7 2020 |
|
8 | + */ |
|
9 | 9 | 'BreadcrumbAsteriskManagersmodify' => 'Configurazione dell\'account', |
10 | 10 | 'or_PatternToMatch' => 'La regola funzionerà se', |
11 | 11 | 'or_NumberBeginsWithTheDigits' => 'Il numero inizia con', |
@@ -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, 7 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, 7 2020 |
|
8 | + */ |
|
9 | 9 | 'November' => '11月', |
10 | 10 | 'December' => '12月', |
11 | 11 | 'Jan' => 'Jan', |
@@ -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, 7 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, 7 2020 |
|
8 | + */ |
|
9 | 9 | 'mm_SSHConsole' => 'Consola SSH', |
10 | 10 | 'ex_Email' => 'Correo electrónico', |
11 | 11 | 'bt_ToolTipEdit' => 'Editar', |
@@ -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, 7 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, 7 2020 |
|
8 | + */ |
|
9 | 9 | 'January' => 'Januar', |
10 | 10 | 'February' => 'Februar', |
11 | 11 | 'March' => 'März', |
@@ -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, 7 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, 7 2020 |
|
8 | + */ |
|
9 | 9 | 'Oct' => 'oktober', |
10 | 10 | 'Nov' => 'november', |
11 | 11 | 'Dec' => 'december', |
@@ -20,19 +20,19 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class BaseController extends Controller |
22 | 22 | { |
23 | - public function sendRequestToBackendWorker($processor, $actionName, $payload = null, $modulename=''): void |
|
23 | + public function sendRequestToBackendWorker($processor, $actionName, $payload = null, $modulename = ''): void |
|
24 | 24 | { |
25 | 25 | $requestMessage = [ |
26 | 26 | 'processor' => $processor, |
27 | 27 | 'data' => $payload, |
28 | 28 | 'action' => $actionName |
29 | 29 | ]; |
30 | - if ($processor==='modules'){ |
|
30 | + if ($processor === 'modules') { |
|
31 | 31 | $requestMessage['module'] = $modulename; |
32 | 32 | } |
33 | 33 | try { |
34 | 34 | $message = json_encode($requestMessage, JSON_THROW_ON_ERROR); |
35 | - $response = $this->di->getShared('beanstalkConnection')->request($message, 10, 0); |
|
35 | + $response = $this->di->getShared('beanstalkConnection')->request($message, 10, 0); |
|
36 | 36 | if ($response !== false) { |
37 | 37 | $response = json_decode($response, true, 512, JSON_THROW_ON_ERROR); |
38 | 38 | $this->response->setPayloadSuccess($response); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $this |
56 | 56 | ->response |
57 | - ->setPayloadError($this->response->getHttpCodeDescription($code) . ' ' . $description) |
|
57 | + ->setPayloadError($this->response->getHttpCodeDescription($code).' '.$description) |
|
58 | 58 | ->setStatusCode($code); |
59 | 59 | } |
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | file_put_contents('/etc/iptables/iptables.mikopbx', implode("\n", $arr_command)); |
86 | 86 | file_put_contents( |
87 | 87 | '/etc/iptables/iptables.mikopbx', |
88 | - "\n" . implode("\n", $arr_commands_custom), |
|
88 | + "\n".implode("\n", $arr_commands_custom), |
|
89 | 89 | FILE_APPEND |
90 | 90 | ); |
91 | 91 | file_put_contents( |
92 | 92 | '/etc/iptables/iptables.mikopbx', |
93 | - "\n" . $dropCommand, |
|
93 | + "\n".$dropCommand, |
|
94 | 94 | FILE_APPEND |
95 | 95 | ); |
96 | 96 | $systemctlPath = Util::which('systemctl'); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | $data_port = ''; |
137 | 137 | if (trim($dport) !== '') { |
138 | - $data_port = '--dport ' . $dport; |
|
138 | + $data_port = '--dport '.$dport; |
|
139 | 139 | } |
140 | 140 | $other_data = trim($other_data); |
141 | 141 | |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | continue; |
169 | 169 | } |
170 | 170 | $other_data = "-p {$rule->protocol}"; |
171 | - $other_data .= ($network_filter === null) ? '' : ' -s ' . $network_filter->permit; |
|
171 | + $other_data .= ($network_filter === null) ? '' : ' -s '.$network_filter->permit; |
|
172 | 172 | if ($rule->protocol === 'icmp') { |
173 | - $port = ''; |
|
173 | + $port = ''; |
|
174 | 174 | $other_data .= ' --icmp-type echo-request'; |
175 | 175 | } |
176 | 176 |
@@ -166,7 +166,7 @@ |
||
166 | 166 | } elseif ( |
167 | 167 | 'event' === $type |
168 | 168 | && $parameters['Event'] === 'UserEvent' |
169 | - && "{$pingTube}Pong" === $parameters['UserEvent']) { |
|
169 | + && "{$pingTube}pong" === $parameters['UserEvent']) { |
|
170 | 170 | // Ответ получен. |
171 | 171 | $result = true; |
172 | 172 | break; |
@@ -338,7 +338,8 @@ discard block |
||
338 | 338 | * Читает данные из сокета. Если возникает ошибка возвращает ее. |
339 | 339 | * @return array |
340 | 340 | */ |
341 | - private function getDataFromSocket() { |
|
341 | + private function getDataFromSocket() |
|
342 | + { |
|
342 | 343 | $response = []; |
343 | 344 | if(!is_resource($this->socket)){ |
344 | 345 | $response['error'] = 'Socket not init.'; |
@@ -349,11 +350,11 @@ discard block |
||
349 | 350 | if($resultFgets !== false){ |
350 | 351 | $buffer = trim($resultFgets); |
351 | 352 | $response['data'] = $buffer; |
352 | - }else{ |
|
353 | + } else{ |
|
353 | 354 | $response['error'] = 'Read data error.'; |
354 | 355 | } |
355 | 356 | |
356 | - }catch (\Exception $e){ |
|
357 | + } catch (\Exception $e){ |
|
357 | 358 | $response['error'] = $e->getMessage(); |
358 | 359 | } |
359 | 360 | |
@@ -364,7 +365,8 @@ discard block |
||
364 | 365 | * Читает данные из сокета |
365 | 366 | * @return string |
366 | 367 | */ |
367 | - private function getStringDataFromSocket() { |
|
368 | + private function getStringDataFromSocket() |
|
369 | + { |
|
368 | 370 | $response = $this->getDataFromSocket(); |
369 | 371 | return $response['data'] ?? ''; |
370 | 372 | } |
@@ -384,7 +386,7 @@ discard block |
||
384 | 386 | if($resultWrite === false){ |
385 | 387 | $result = false; |
386 | 388 | } |
387 | - }catch (\Exception $e){ |
|
389 | + } catch (\Exception $e){ |
|
388 | 390 | $result = false; |
389 | 391 | } |
390 | 392 | return $result; |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | public function __construct($config = null, $optconfig = []) |
89 | 89 | { |
90 | 90 | // load config |
91 | - if ( !is_null($config) && file_exists($config)) { |
|
91 | + if (!is_null($config) && file_exists($config)) { |
|
92 | 92 | $arrData = parse_ini_file($config, true); |
93 | - $this->config = ($arrData === false)?[]:$arrData; |
|
93 | + $this->config = ($arrData === false) ? [] : $arrData; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | // If optconfig is specified, stuff vals and vars into 'asmanager' config array. |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // add default values to config for uninitialized values |
102 | - if ( ! isset($this->config['asmanager']['server'])) { |
|
102 | + if (!isset($this->config['asmanager']['server'])) { |
|
103 | 103 | $this->config['asmanager']['server'] = 'localhost'; |
104 | 104 | } |
105 | - if ( ! isset($this->config['asmanager']['port'])) { |
|
105 | + if (!isset($this->config['asmanager']['port'])) { |
|
106 | 106 | $this->config['asmanager']['port'] = 5038; |
107 | 107 | } |
108 | - if ( ! isset($this->config['asmanager']['username'])) { |
|
108 | + if (!isset($this->config['asmanager']['username'])) { |
|
109 | 109 | $this->config['asmanager']['username'] = 'phpagi'; |
110 | 110 | } |
111 | - if ( ! isset($this->config['asmanager']['secret'])) { |
|
111 | + if (!isset($this->config['asmanager']['secret'])) { |
|
112 | 112 | $this->config['asmanager']['secret'] = 'phpagi'; |
113 | 113 | } |
114 | 114 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $req .= "$var: $val\r\n"; |
136 | 136 | } |
137 | 137 | $req .= "\r\n"; |
138 | - if ( ! is_resource($this->socket)) { |
|
138 | + if (!is_resource($this->socket)) { |
|
139 | 139 | return []; |
140 | 140 | } |
141 | 141 | $this->sendDataToSocket($req); |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | do { |
150 | 150 | $type = ''; |
151 | 151 | $parameters = []; |
152 | - if ( ! is_resource($this->socket)) { |
|
152 | + if (!is_resource($this->socket)) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | $buffer = $this->getStringDataFromSocket(); |
156 | 156 | while (!empty($buffer)) { |
157 | 157 | $a = strpos($buffer, ':'); |
158 | 158 | if ($a) { |
159 | - if ( ! count($parameters)) { |
|
159 | + if (!count($parameters)) { |
|
160 | 160 | $type = strtolower(substr($buffer, 0, $a)); |
161 | 161 | } |
162 | 162 | $parameters[substr($buffer, 0, $a)] = substr($buffer, $a + 2); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | // Таймаут ожидания. |
180 | 180 | break; |
181 | 181 | } |
182 | - } while ( ! $timeout); |
|
182 | + } while (!$timeout); |
|
183 | 183 | |
184 | 184 | return $result; |
185 | 185 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function sendRequestTimeout($action, $parameters = []) |
196 | 196 | { |
197 | - if ( ! is_resource($this->socket) && !$this->connectDefault()) { |
|
197 | + if (!is_resource($this->socket) && !$this->connectDefault()) { |
|
198 | 198 | return []; |
199 | 199 | } |
200 | 200 | // Прописываем обязательные поля. |
@@ -207,15 +207,15 @@ discard block |
||
207 | 207 | $req .= "\r\n"; |
208 | 208 | |
209 | 209 | $result = $this->sendDataToSocket($req); |
210 | - if(!$result) { |
|
210 | + if (!$result) { |
|
211 | 211 | usleep(500000); |
212 | - if($this->connectDefault()){ |
|
212 | + if ($this->connectDefault()) { |
|
213 | 213 | $result = $this->sendDataToSocket($req); |
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | 217 | $response = []; |
218 | - if($result){ |
|
218 | + if ($result) { |
|
219 | 219 | $response = $this->waitResponse(true); |
220 | 220 | } |
221 | 221 | return $response; |
@@ -244,23 +244,23 @@ discard block |
||
244 | 244 | $parameters = []; |
245 | 245 | $response = []; |
246 | 246 | |
247 | - if(!$this->waitResponseGetInitialData($response)) { |
|
247 | + if (!$this->waitResponseGetInitialData($response)) { |
|
248 | 248 | return $parameters; |
249 | 249 | } |
250 | - $buffer = $response['data']??''; |
|
250 | + $buffer = $response['data'] ?? ''; |
|
251 | 251 | while ($buffer !== '') { |
252 | 252 | $a = strpos($buffer, ':'); |
253 | 253 | if ($a) { |
254 | 254 | $event_text = substr($buffer, $a + 2); |
255 | 255 | $this->waitResponseGetEventType($parameters, $buffer, $a, $type); |
256 | - $this->waitResponseReadFollowsPart($event_text,$parameters); |
|
256 | + $this->waitResponseReadFollowsPart($event_text, $parameters); |
|
257 | 257 | $this->waitResponseReadCompletePart($event_text, $parameters); |
258 | 258 | $parameters[substr($buffer, 0, $a)] = $event_text; |
259 | 259 | } |
260 | 260 | $buffer = $this->getStringDataFromSocket(); |
261 | 261 | } |
262 | 262 | $this->waitResponseProcessResponse($type, $timeout, $allow_timeout, $parameters); |
263 | - } while ($type !== 'response' && ! $timeout); |
|
263 | + } while ($type !== 'response' && !$timeout); |
|
264 | 264 | |
265 | 265 | return $parameters; |
266 | 266 | } |
@@ -271,18 +271,18 @@ discard block |
||
271 | 271 | * @return bool |
272 | 272 | */ |
273 | 273 | private function waitResponseGetInitialData(& $response):bool{ |
274 | - if ( !is_resource($this->socket) && !$this->connectDefault()) { |
|
274 | + if (!is_resource($this->socket) && !$this->connectDefault()) { |
|
275 | 275 | return false; |
276 | 276 | } |
277 | 277 | $result = true; |
278 | 278 | $response = $this->getDataFromSocket(); |
279 | - if(isset($response['error'])) { |
|
279 | + if (isset($response['error'])) { |
|
280 | 280 | usleep(500000); |
281 | - if($this->connectDefault()){ |
|
281 | + if ($this->connectDefault()) { |
|
282 | 282 | $response = $this->getDataFromSocket(); |
283 | 283 | } |
284 | 284 | } |
285 | - if(isset($response['error'])) { |
|
285 | + if (isset($response['error'])) { |
|
286 | 286 | $result = false; |
287 | 287 | } |
288 | 288 | return $result; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @param $type |
318 | 318 | */ |
319 | 319 | private function waitResponseGetEventType($parameters, $buffer, $a, & $type):void{ |
320 | - if ( ! count($parameters)) { |
|
320 | + if (!count($parameters)) { |
|
321 | 321 | $type = strtolower(substr($buffer, 0, $a)); |
322 | 322 | } |
323 | 323 | } |
@@ -328,13 +328,13 @@ discard block |
||
328 | 328 | * @param $parameters |
329 | 329 | */ |
330 | 330 | private function waitResponseReadFollowsPart($event_text, & $parameters):void{ |
331 | - if ( ($event_text === 'Follows') && !count($parameters)) { |
|
331 | + if (($event_text === 'Follows') && !count($parameters)) { |
|
332 | 332 | // A follows response means there is a miltiline field that follows. |
333 | 333 | $parameters['data'] = ''; |
334 | 334 | $buff = $this->getStringDataFromSocket(); |
335 | 335 | while (strpos($buff, '--END ') !== 0) { |
336 | 336 | $parameters['data'] .= $buff; |
337 | - $buff = $this->getStringDataFromSocket(); |
|
337 | + $buff = $this->getStringDataFromSocket(); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | } |
@@ -360,11 +360,11 @@ discard block |
||
360 | 360 | 'Following are Events for each Outbound registration' => 'OutboundRegistrationDetailComplete', |
361 | 361 | 'A listing of Endpoints follows, presented as EndpointList events' => 'EndpointListComplete' |
362 | 362 | ]; |
363 | - $eventsAsNotArray = [ 'EndpointDetailComplete' ]; |
|
363 | + $eventsAsNotArray = ['EndpointDetailComplete']; |
|
364 | 364 | |
365 | - $endString = $settings[$event_text]??false; |
|
366 | - if($endString !== false){ |
|
367 | - $NotArray = !in_array($endString,$eventsAsNotArray); |
|
365 | + $endString = $settings[$event_text] ?? false; |
|
366 | + if ($endString !== false) { |
|
367 | + $NotArray = !in_array($endString, $eventsAsNotArray); |
|
368 | 368 | $this->waitResponseGetSubData($parameters, $endString, $NotArray); |
369 | 369 | } |
370 | 370 | } |
@@ -375,20 +375,20 @@ discard block |
||
375 | 375 | */ |
376 | 376 | private function getDataFromSocket() { |
377 | 377 | $response = []; |
378 | - if(!is_resource($this->socket)){ |
|
378 | + if (!is_resource($this->socket)) { |
|
379 | 379 | $response['error'] = 'Socket not init.'; |
380 | 380 | return $response; |
381 | 381 | } |
382 | 382 | try { |
383 | 383 | $resultFgets = fgets($this->socket, 4096); |
384 | - if($resultFgets !== false){ |
|
384 | + if ($resultFgets !== false) { |
|
385 | 385 | $buffer = trim($resultFgets); |
386 | 386 | $response['data'] = $buffer; |
387 | - }else{ |
|
387 | + } else { |
|
388 | 388 | $response['error'] = 'Read data error.'; |
389 | 389 | } |
390 | 390 | |
391 | - }catch (\Exception $e){ |
|
391 | + } catch (\Exception $e) { |
|
392 | 392 | $response['error'] = $e->getMessage(); |
393 | 393 | } |
394 | 394 | |
@@ -410,16 +410,16 @@ discard block |
||
410 | 410 | * @return bool |
411 | 411 | */ |
412 | 412 | private function sendDataToSocket($req) : bool{ |
413 | - if(!is_resource($this->socket)){ |
|
413 | + if (!is_resource($this->socket)) { |
|
414 | 414 | return false; |
415 | 415 | } |
416 | 416 | $result = true; |
417 | 417 | try { |
418 | 418 | $resultWrite = fwrite($this->socket, $req); |
419 | - if($resultWrite === false){ |
|
419 | + if ($resultWrite === false) { |
|
420 | 420 | $result = false; |
421 | 421 | } |
422 | - }catch (\Exception $e){ |
|
422 | + } catch (\Exception $e) { |
|
423 | 423 | $result = false; |
424 | 424 | } |
425 | 425 | return $result; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | |
428 | 428 | private function waitResponseGetSubData(&$parameters, $end_string = '', $event_as_array = true): void |
429 | 429 | { |
430 | - if ( ! is_array($parameters)) { |
|
430 | + if (!is_array($parameters)) { |
|
431 | 431 | $parameters = []; |
432 | 432 | } |
433 | 433 | if (empty($end_string)) { |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $value = ''; |
440 | 440 | $buff = $this->getStringDataFromSocket().$value; |
441 | 441 | $a_pos = strpos($buff, ':'); |
442 | - if ( ! $a_pos) { |
|
442 | + if (!$a_pos) { |
|
443 | 443 | if (count($m) > 0) { |
444 | 444 | if ($event_as_array) { |
445 | 445 | $parameters['data'][$m['Event']][] = $m; |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | { |
492 | 492 | [$usec, $sec] = explode(" ", microtime()); |
493 | 493 | |
494 | - return ((float)$usec + (float)$sec); |
|
494 | + return ((float) $usec + (float) $sec); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | /** |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | while ($buffer !== '') { |
522 | 522 | $pos = strpos($buffer, ':'); |
523 | 523 | if ($pos) { |
524 | - if ( ! count($parameters)) { |
|
524 | + if (!count($parameters)) { |
|
525 | 525 | $type = strtolower(substr($buffer, 0, $pos)); |
526 | 526 | } |
527 | 527 | $parameters[substr($buffer, 0, $pos)] = substr($buffer, $pos + 2); |
@@ -530,10 +530,10 @@ discard block |
||
530 | 530 | } |
531 | 531 | if ($type === '' && count($this->Ping()) === 0) { |
532 | 532 | $timeout = $allow_timeout; |
533 | - } elseif (stripos($type, 'event')!==false ) { |
|
533 | + } elseif (stripos($type, 'event') !== false) { |
|
534 | 534 | $this->processEvent($parameters); |
535 | 535 | } |
536 | - } while ( ! $timeout); |
|
536 | + } while (!$timeout); |
|
537 | 537 | |
538 | 538 | return $parameters; |
539 | 539 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | if (strpos($server, ':') !== false) { |
573 | 573 | $c = explode(':', $server); |
574 | 574 | $this->server = $c[0]; |
575 | - $this->port = (int)$c[1]; |
|
575 | + $this->port = (int) $c[1]; |
|
576 | 576 | } else { |
577 | 577 | $this->server = $server; |
578 | 578 | $this->port = $this->config['asmanager']['port']; |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $req .= "$var: $val\r\n"; |
627 | 627 | } |
628 | 628 | $req .= "\r\n"; |
629 | - if ( ! is_resource($this->socket)) { |
|
629 | + if (!is_resource($this->socket)) { |
|
630 | 630 | return []; |
631 | 631 | } |
632 | 632 | $this->sendDataToSocket($req); |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | if (null !== $channels) { |
771 | 771 | foreach ($channels as $chan) { |
772 | 772 | if ($group === true) { |
773 | - if ( ! isset($chan['Linkedid'])) { |
|
773 | + if (!isset($chan['Linkedid'])) { |
|
774 | 774 | continue; |
775 | 775 | } |
776 | 776 | $channels_id[$chan['Linkedid']][] = $chan['Channel']; |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | if ($format) { |
932 | 932 | $parameters['Format'] = $format; |
933 | 933 | } |
934 | - if ( ! is_null($file)) { |
|
934 | + if (!is_null($file)) { |
|
935 | 935 | $parameters['Mix'] = ($mix) ? 'true' : 'false'; |
936 | 936 | } |
937 | 937 | |
@@ -1075,8 +1075,8 @@ discard block |
||
1075 | 1075 | 'ActionID' => $actionid |
1076 | 1076 | ]; |
1077 | 1077 | $keys = array_keys($parameters); |
1078 | - foreach ($keys as $key){ |
|
1079 | - if(empty($parameters[$key])){ |
|
1078 | + foreach ($keys as $key) { |
|
1079 | + if (empty($parameters[$key])) { |
|
1080 | 1080 | unset($parameters[$key]); |
1081 | 1081 | } |
1082 | 1082 | } |
@@ -1348,7 +1348,7 @@ discard block |
||
1348 | 1348 | 'Not in use' => 'OK', |
1349 | 1349 | 'Busy' => 'OK', |
1350 | 1350 | ]; |
1351 | - $state = $state_array[$peer['DeviceState']] ?? 'UNKNOWN'; |
|
1351 | + $state = $state_array[$peer['DeviceState']] ?? 'UNKNOWN'; |
|
1352 | 1352 | |
1353 | 1353 | $peers[] = [ |
1354 | 1354 | 'id' => $peer['ObjectName'], |
@@ -1371,12 +1371,12 @@ discard block |
||
1371 | 1371 | $res = $this->sendRequestTimeout('SIPpeers'); |
1372 | 1372 | if (isset($res['data']) && $res['data'] != null && $res['data']['PeerEntry'] != null) { |
1373 | 1373 | foreach ($res['data']['PeerEntry'] as $peer) { |
1374 | - if ( ! is_numeric($peer['ObjectName'])) { |
|
1374 | + if (!is_numeric($peer['ObjectName'])) { |
|
1375 | 1375 | continue; |
1376 | 1376 | } |
1377 | 1377 | // if ('Unmonitored' == $peer['Status']) continue; |
1378 | 1378 | $arr_status = explode(' ', $peer['Status']); |
1379 | - $peers[] = ['id' => $peer['ObjectName'], 'state' => strtoupper($arr_status[0]),]; |
|
1379 | + $peers[] = ['id' => $peer['ObjectName'], 'state' => strtoupper($arr_status[0]), ]; |
|
1380 | 1380 | } |
1381 | 1381 | } |
1382 | 1382 | |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | if (isset($res['data']['ContactStatusDetail'])) { |
1418 | 1418 | $result = $res['data']['ContactStatusDetail']; |
1419 | 1419 | } |
1420 | - $result['state'] = isset($result['URI']) && ! empty($result['URI']) ? 'OK' : 'UNKNOWN'; |
|
1420 | + $result['state'] = isset($result['URI']) && !empty($result['URI']) ? 'OK' : 'UNKNOWN'; |
|
1421 | 1421 | |
1422 | 1422 | return $result; |
1423 | 1423 | } |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | { |
1442 | 1442 | $result = []; |
1443 | 1443 | $conf_data = $this->MeetmeList($conference); |
1444 | - if ( ! isset($conf_data['data']['MeetmeList'])) { |
|
1444 | + if (!isset($conf_data['data']['MeetmeList'])) { |
|
1445 | 1445 | return $result; |
1446 | 1446 | } |
1447 | 1447 | foreach ($conf_data['data']['MeetmeList'] as $user_data) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $res->success = true; |
64 | 64 | $di = Di::getDefault(); |
65 | 65 | $dirsConfig = $di->getShared('config'); |
66 | - $filenameTmp = $dirsConfig->path('www.downloadCacheDir') . '/' . __FUNCTION__ . '_' . time() . '.txt'; |
|
66 | + $filenameTmp = $dirsConfig->path('www.downloadCacheDir').'/'.__FUNCTION__.'_'.time().'.txt'; |
|
67 | 67 | |
68 | 68 | $content = self::prepareSysyinfoContent(); |
69 | 69 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $content .= self::getAsteriskInfo(); |
98 | 98 | $content .= self::getChangedConfigFiles(); |
99 | 99 | $content .= self::getCorruptedFiles(); |
100 | - $content .= PHP_EOL . PHP_EOL; |
|
100 | + $content .= PHP_EOL.PHP_EOL; |
|
101 | 101 | |
102 | 102 | return $content; |
103 | 103 | } |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | public static function getDate(): string |
111 | 111 | { |
112 | 112 | $content = '───────────────────────────────────────── Date ─────────────────────────────────────────'; |
113 | - $content .= PHP_EOL . PHP_EOL; |
|
113 | + $content .= PHP_EOL.PHP_EOL; |
|
114 | 114 | $datePath = Util::which('date'); |
115 | 115 | $ut = []; |
116 | 116 | Util::mwExec($datePath, $ut); |
117 | - $content .= implode(PHP_EOL, $ut). PHP_EOL; |
|
118 | - $content .= PHP_EOL . PHP_EOL; |
|
117 | + $content .= implode(PHP_EOL, $ut).PHP_EOL; |
|
118 | + $content .= PHP_EOL.PHP_EOL; |
|
119 | 119 | return $content; |
120 | 120 | } |
121 | 121 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | { |
129 | 129 | $version = PbxSettings::getValueByKey('PBXVersion'); |
130 | 130 | $content = '─────────────────────────────────────── PBXVersion ───────────────────────────────────────'; |
131 | - $content .= PHP_EOL . PHP_EOL; |
|
132 | - $content .= $version . PHP_EOL; |
|
133 | - $content .= PHP_EOL . PHP_EOL; |
|
131 | + $content .= PHP_EOL.PHP_EOL; |
|
132 | + $content .= $version.PHP_EOL; |
|
133 | + $content .= PHP_EOL.PHP_EOL; |
|
134 | 134 | return $content; |
135 | 135 | } |
136 | 136 | |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | public static function getUpTime(): string |
143 | 143 | { |
144 | 144 | $content = '───────────────────────────────────────── Uptime ─────────────────────────────────────────'; |
145 | - $content .= PHP_EOL . PHP_EOL; |
|
145 | + $content .= PHP_EOL.PHP_EOL; |
|
146 | 146 | $uptimePath = Util::which('uptime'); |
147 | 147 | $ut = []; |
148 | 148 | Util::mwExec($uptimePath, $ut); |
149 | - $uptime = implode(PHP_EOL, $ut); |
|
150 | - $content .= $uptime . PHP_EOL; |
|
151 | - $content .= PHP_EOL . PHP_EOL; |
|
149 | + $uptime = implode(PHP_EOL, $ut); |
|
150 | + $content .= $uptime.PHP_EOL; |
|
151 | + $content .= PHP_EOL.PHP_EOL; |
|
152 | 152 | return $content; |
153 | 153 | } |
154 | 154 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | public static function getCpu(): string |
161 | 161 | { |
162 | 162 | $content = '───────────────────────────────────────── CPU load ───────────────────────────────────────'; |
163 | - $content .= PHP_EOL . PHP_EOL; |
|
163 | + $content .= PHP_EOL.PHP_EOL; |
|
164 | 164 | $ut = []; |
165 | 165 | $grepPath = Util::which('grep'); |
166 | 166 | $mpstatPath = Util::which('mpstat'); |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | $rv = 100; |
173 | 173 | } |
174 | 174 | |
175 | - $content .= round($rv, 2) . PHP_EOL; |
|
176 | - $content .= PHP_EOL . PHP_EOL; |
|
175 | + $content .= round($rv, 2).PHP_EOL; |
|
176 | + $content .= PHP_EOL.PHP_EOL; |
|
177 | 177 | return $content; |
178 | 178 | } |
179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | public static function getMemInfo(): string |
186 | 186 | { |
187 | 187 | $content = '───────────────────────────────────────── MemInfo ────────────────────────────────────────'; |
188 | - $content .= PHP_EOL . PHP_EOL; |
|
188 | + $content .= PHP_EOL.PHP_EOL; |
|
189 | 189 | $out = []; |
190 | 190 | $catPath = Util::which('cat'); |
191 | 191 | $grepPath = Util::which('grep'); |
@@ -193,19 +193,19 @@ discard block |
||
193 | 193 | $freePath = Util::which('free'); |
194 | 194 | Util::mwExec("{$catPath} /proc/meminfo | {$grepPath} -C 0 'Inactive:' | {$awkPath} '{print $2}'", $out); |
195 | 195 | $inactive = round((1 * implode($out)) / 1024, 2); |
196 | - $content .= "inactive = {$inactive}" . PHP_EOL; |
|
196 | + $content .= "inactive = {$inactive}".PHP_EOL; |
|
197 | 197 | Util::mwExec("{$catPath} /proc/meminfo | {$grepPath} -C 0 'MemFree:' | {$awkPath} '{print $2}'", $out); |
198 | 198 | $free = round((1 * implode($out)) / 1024, 2); |
199 | - $content .= "free = {$free}" . PHP_EOL; |
|
199 | + $content .= "free = {$free}".PHP_EOL; |
|
200 | 200 | Util::mwExec("{$catPath} /proc/meminfo | {$grepPath} -C 0 'MemTotal:' | {$awkPath} '{print $2}'", $out); |
201 | 201 | $total = round((1 * implode($out)) / 1024, 2); |
202 | - $content .= "total = {$total}" . PHP_EOL . PHP_EOL; |
|
202 | + $content .= "total = {$total}".PHP_EOL.PHP_EOL; |
|
203 | 203 | |
204 | 204 | $content .= '────────────────────────────────────────── Free ─────────────────────────────────────────'; |
205 | - $content .= PHP_EOL . PHP_EOL; |
|
205 | + $content .= PHP_EOL.PHP_EOL; |
|
206 | 206 | Util::mwExec($freePath, $out); |
207 | - $content .= implode(PHP_EOL, $out) . PHP_EOL; |
|
208 | - $content .= PHP_EOL . PHP_EOL; |
|
207 | + $content .= implode(PHP_EOL, $out).PHP_EOL; |
|
208 | + $content .= PHP_EOL.PHP_EOL; |
|
209 | 209 | return $content; |
210 | 210 | } |
211 | 211 | |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | private static function getStorageInfo(): string |
218 | 218 | { |
219 | 219 | $content = '─────────────────────────────────────────── df ───────────────────────────────────────────'; |
220 | - $content .= PHP_EOL . PHP_EOL; |
|
220 | + $content .= PHP_EOL.PHP_EOL; |
|
221 | 221 | $dfPath = Util::which('df'); |
222 | 222 | $out = []; |
223 | 223 | Util::mwExec("{$dfPath} -h", $out); |
224 | 224 | $dfOut = implode(PHP_EOL, $out); |
225 | - $content .= $dfOut . PHP_EOL; |
|
226 | - $content .= PHP_EOL . PHP_EOL; |
|
225 | + $content .= $dfOut.PHP_EOL; |
|
226 | + $content .= PHP_EOL.PHP_EOL; |
|
227 | 227 | return $content; |
228 | 228 | } |
229 | 229 | |
@@ -235,13 +235,13 @@ discard block |
||
235 | 235 | private static function getIfconfigInfo(): string |
236 | 236 | { |
237 | 237 | $content = '─────────────────────────────────────── ifconfig ──────────────────────────────────────'; |
238 | - $content .= PHP_EOL . PHP_EOL; |
|
238 | + $content .= PHP_EOL.PHP_EOL; |
|
239 | 239 | $ifconfigPath = Util::which('ifconfig'); |
240 | 240 | $out = []; |
241 | 241 | Util::mwExec($ifconfigPath, $out); |
242 | 242 | $ifconfigOut = implode(PHP_EOL, $out); |
243 | - $content .= $ifconfigOut . PHP_EOL; |
|
244 | - $content .= PHP_EOL . PHP_EOL; |
|
243 | + $content .= $ifconfigOut.PHP_EOL; |
|
244 | + $content .= PHP_EOL.PHP_EOL; |
|
245 | 245 | return $content; |
246 | 246 | } |
247 | 247 | |
@@ -253,13 +253,13 @@ discard block |
||
253 | 253 | private static function getArpInfo(): string |
254 | 254 | { |
255 | 255 | $content = '─────────────────────────────────────────── arp ──────────────────────────────────────────'; |
256 | - $content .= PHP_EOL . PHP_EOL; |
|
256 | + $content .= PHP_EOL.PHP_EOL; |
|
257 | 257 | $arpPath = Util::which('arp'); |
258 | 258 | $out = []; |
259 | 259 | Util::mwExec($arpPath, $out); |
260 | 260 | $arpOut = implode(PHP_EOL, $out); |
261 | - $content .= $arpOut . PHP_EOL; |
|
262 | - $content .= PHP_EOL . PHP_EOL; |
|
261 | + $content .= $arpOut.PHP_EOL; |
|
262 | + $content .= PHP_EOL.PHP_EOL; |
|
263 | 263 | return $content; |
264 | 264 | } |
265 | 265 | |
@@ -271,13 +271,13 @@ discard block |
||
271 | 271 | private static function getRouteInfo(): string |
272 | 272 | { |
273 | 273 | $content = '────────────────────────────────────────── route ─────────────────────────────────────────'; |
274 | - $content .= PHP_EOL . PHP_EOL; |
|
274 | + $content .= PHP_EOL.PHP_EOL; |
|
275 | 275 | $routePath = Util::which('route'); |
276 | 276 | $out = []; |
277 | 277 | Util::mwExec($routePath, $out); |
278 | 278 | $routeOut = implode(PHP_EOL, $out); |
279 | - $content .= $routeOut . PHP_EOL; |
|
280 | - $content .= PHP_EOL . PHP_EOL; |
|
279 | + $content .= $routeOut.PHP_EOL; |
|
280 | + $content .= PHP_EOL.PHP_EOL; |
|
281 | 281 | return $content; |
282 | 282 | } |
283 | 283 | |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | private static function getIptablesInfo(): string |
290 | 290 | { |
291 | 291 | $content = '────────────────────────────────────────── iptables ──────────────────────────────────────'; |
292 | - $content .= PHP_EOL . PHP_EOL; |
|
292 | + $content .= PHP_EOL.PHP_EOL; |
|
293 | 293 | $iptablesPath = Util::which('iptables'); |
294 | 294 | $out = []; |
295 | 295 | Util::mwExec("{$iptablesPath} -S", $out); |
296 | 296 | $iptablesOut = implode(PHP_EOL, $out); |
297 | - $content .= $iptablesOut . PHP_EOL; |
|
298 | - $content .= PHP_EOL . PHP_EOL; |
|
297 | + $content .= $iptablesOut.PHP_EOL; |
|
298 | + $content .= PHP_EOL.PHP_EOL; |
|
299 | 299 | return $content; |
300 | 300 | } |
301 | 301 | |
@@ -307,17 +307,17 @@ discard block |
||
307 | 307 | private static function getPingInfo(): string |
308 | 308 | { |
309 | 309 | $content = '──────────────────────────────────────────── ping ────────────────────────────────────────'; |
310 | - $content .= PHP_EOL . PHP_EOL; |
|
310 | + $content .= PHP_EOL.PHP_EOL; |
|
311 | 311 | $pingPath = Util::which('ping'); |
312 | 312 | $out = []; |
313 | 313 | Util::mwExec("{$pingPath} 8.8.8.8 -w 2", $out); |
314 | 314 | $pingOut = implode(PHP_EOL, $out); |
315 | 315 | Util::mwExec("{$pingPath} ya.ru -w 2", $out); |
316 | 316 | $ping2Out = implode(PHP_EOL, $out); |
317 | - $content .= $pingOut . PHP_EOL; |
|
318 | - $content .= PHP_EOL . PHP_EOL; |
|
319 | - $content .= $ping2Out . PHP_EOL; |
|
320 | - $content .= PHP_EOL . PHP_EOL; |
|
317 | + $content .= $pingOut.PHP_EOL; |
|
318 | + $content .= PHP_EOL.PHP_EOL; |
|
319 | + $content .= $ping2Out.PHP_EOL; |
|
320 | + $content .= PHP_EOL.PHP_EOL; |
|
321 | 321 | return $content; |
322 | 322 | } |
323 | 323 | |
@@ -331,12 +331,12 @@ discard block |
||
331 | 331 | $opensslPath = Util::which('openssl'); |
332 | 332 | |
333 | 333 | $content = '─────────────────────────────────────── openssl ─────────────────────────────────────────'; |
334 | - $content .= PHP_EOL . PHP_EOL; |
|
334 | + $content .= PHP_EOL.PHP_EOL; |
|
335 | 335 | $out = []; |
336 | 336 | Util::mwExec("{$opensslPath} s_client -connect lic.miko.ru:443", $out); |
337 | 337 | $opensslOut = implode(PHP_EOL, $out); |
338 | - $content .= $opensslOut . PHP_EOL; |
|
339 | - $content .= PHP_EOL . PHP_EOL; |
|
338 | + $content .= $opensslOut.PHP_EOL; |
|
339 | + $content .= PHP_EOL.PHP_EOL; |
|
340 | 340 | return $content; |
341 | 341 | } |
342 | 342 | |
@@ -350,23 +350,23 @@ discard block |
||
350 | 350 | $asteriskPath = Util::which('asterisk'); |
351 | 351 | |
352 | 352 | $content = '────────────────────────────────── asterisk registrations ────────────────────────────────'; |
353 | - $content .= PHP_EOL . PHP_EOL; |
|
353 | + $content .= PHP_EOL.PHP_EOL; |
|
354 | 354 | Util::mwExec("{$asteriskPath} -rx 'pjsip show registrations' ", $out); |
355 | 355 | $asteriskOut = implode(PHP_EOL, $out); |
356 | - $content .= $asteriskOut . PHP_EOL; |
|
356 | + $content .= $asteriskOut.PHP_EOL; |
|
357 | 357 | |
358 | 358 | $content .= '────────────────────────────────── asterisk endpoints ───────────────────────────────────'; |
359 | - $content .= PHP_EOL . PHP_EOL; |
|
359 | + $content .= PHP_EOL.PHP_EOL; |
|
360 | 360 | Util::mwExec("{$asteriskPath} -rx 'pjsip show endpoints' ", $out); |
361 | 361 | $asteriskOut = implode(PHP_EOL, $out); |
362 | - $content .= $asteriskOut . PHP_EOL; |
|
362 | + $content .= $asteriskOut.PHP_EOL; |
|
363 | 363 | |
364 | 364 | $content .= '─────────────────────────────────── asterisk contacts ───────────────────────────────────'; |
365 | - $content .= PHP_EOL . PHP_EOL; |
|
365 | + $content .= PHP_EOL.PHP_EOL; |
|
366 | 366 | Util::mwExec("{$asteriskPath} -rx 'pjsip show contacts' ", $out); |
367 | 367 | $asteriskOut = implode(PHP_EOL, $out); |
368 | - $content .= $asteriskOut . PHP_EOL; |
|
369 | - $content .= PHP_EOL . PHP_EOL; |
|
368 | + $content .= $asteriskOut.PHP_EOL; |
|
369 | + $content .= PHP_EOL.PHP_EOL; |
|
370 | 370 | return $content; |
371 | 371 | } |
372 | 372 | |
@@ -378,12 +378,12 @@ discard block |
||
378 | 378 | private static function getChangedConfigFiles(): string |
379 | 379 | { |
380 | 380 | $content = '────────────────────────────────── Changed config files ─────────────────────────────────'; |
381 | - $content .= PHP_EOL . PHP_EOL; |
|
381 | + $content .= PHP_EOL.PHP_EOL; |
|
382 | 382 | $files = CustomFiles::find('mode!="none"'); |
383 | 383 | foreach ($files as $file) { |
384 | - $content .= "({$file->mode}){$file->filepath}" . PHP_EOL; |
|
384 | + $content .= "({$file->mode}){$file->filepath}".PHP_EOL; |
|
385 | 385 | } |
386 | - $content .= PHP_EOL . PHP_EOL; |
|
386 | + $content .= PHP_EOL.PHP_EOL; |
|
387 | 387 | return $content; |
388 | 388 | } |
389 | 389 | |
@@ -395,12 +395,12 @@ discard block |
||
395 | 395 | private static function getCorruptedFiles(): string |
396 | 396 | { |
397 | 397 | $content = '──────────────────────────────────── Corrupted files ────────────────────────────────────'; |
398 | - $content .= PHP_EOL . PHP_EOL; |
|
398 | + $content .= PHP_EOL.PHP_EOL; |
|
399 | 399 | $files = Main::checkForCorruptedFiles(); |
400 | 400 | foreach ($files as $file) { |
401 | - $content .= $file . PHP_EOL; |
|
401 | + $content .= $file.PHP_EOL; |
|
402 | 402 | } |
403 | - $content .= PHP_EOL . PHP_EOL; |
|
403 | + $content .= PHP_EOL.PHP_EOL; |
|
404 | 404 | return $content; |
405 | 405 | } |
406 | 406 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $response = json_decode($resultrequest, true); |
439 | 439 | $res->data['ip'] = $response['ip']; |
440 | 440 | } else { |
441 | - $res->messages[] = 'Error format data ' . $resultrequest; |
|
441 | + $res->messages[] = 'Error format data '.$resultrequest; |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | return $res; |