@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | if (file_exists('/etc/TZ')) { |
| 176 | 176 | $origin_tz = file_get_contents("/etc/TZ"); |
| 177 | 177 | } |
| 178 | - if ($origin_tz !== $db_tz){ |
|
| 178 | + if ($origin_tz !== $db_tz) { |
|
| 179 | 179 | self::timezoneConfigure(); |
| 180 | 180 | } |
| 181 | 181 | $origin_tz = $db_tz; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | if ($timezone) { |
| 247 | 247 | $zone_file = "/usr/share/zoneinfo/{$timezone}"; |
| 248 | - if ( ! file_exists($zone_file)) { |
|
| 248 | + if (!file_exists($zone_file)) { |
|
| 249 | 249 | return; |
| 250 | 250 | } |
| 251 | 251 | $cpPath = Util::which('cp'); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | try { |
| 284 | 284 | /** @var \MikoPBX\Modules\Config\ConfigClass $appClass */ |
| 285 | 285 | $appClass->onAfterPbxStarted(); |
| 286 | - }catch (Throwable $e){ |
|
| 286 | + } catch (Throwable $e) { |
|
| 287 | 287 | Util::sysLogMsg('onAfterPbxStarted', $e->getMessage()); |
| 288 | 288 | } |
| 289 | 289 | } |
@@ -283,7 +283,7 @@ |
||
| 283 | 283 | try { |
| 284 | 284 | /** @var \MikoPBX\Modules\Config\ConfigClass $appClass */ |
| 285 | 285 | $appClass->onAfterPbxStarted(); |
| 286 | - }catch (Throwable $e){ |
|
| 286 | + } catch (Throwable $e){ |
|
| 287 | 287 | Util::sysLogMsg('onAfterPbxStarted', $e->getMessage()); |
| 288 | 288 | } |
| 289 | 289 | } |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | if ($result === true || $this->db === null) { |
| 87 | 87 | return $result; |
| 88 | 88 | } |
| 89 | - $sql = "INSERT" . " OR REPLACE INTO astdb (key, value) VALUES ('/{$family}/{$key}', '{$value}')"; |
|
| 89 | + $sql = "INSERT"." OR REPLACE INTO astdb (key, value) VALUES ('/{$family}/{$key}', '{$value}')"; |
|
| 90 | 90 | try { |
| 91 | 91 | $result = $this->db->exec($sql); |
| 92 | 92 | } catch (Throwable $e) { |
@@ -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 (Throwable $e){ |
|
| 391 | + } catch (Throwable $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 (Throwable $e){ |
|
| 422 | + } catch (Throwable $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 | |
@@ -950,12 +950,12 @@ discard block |
||
| 950 | 950 | * |
| 951 | 951 | * @return array |
| 952 | 952 | */ |
| 953 | - public function MixMonitor($channel, $file, $options, $command='') |
|
| 953 | + public function MixMonitor($channel, $file, $options, $command = '') |
|
| 954 | 954 | { |
| 955 | 955 | $parameters = ['Channel' => $channel]; |
| 956 | 956 | $parameters['File'] = $file; |
| 957 | 957 | $parameters['options'] = $options; |
| 958 | - if(!empty($command)){ |
|
| 958 | + if (!empty($command)) { |
|
| 959 | 959 | $parameters['Command'] = $command; |
| 960 | 960 | } |
| 961 | 961 | |
@@ -1077,8 +1077,8 @@ discard block |
||
| 1077 | 1077 | 'ActionID' => $actionid |
| 1078 | 1078 | ]; |
| 1079 | 1079 | $keys = array_keys($parameters); |
| 1080 | - foreach ($keys as $key){ |
|
| 1081 | - if(empty($parameters[$key])){ |
|
| 1080 | + foreach ($keys as $key) { |
|
| 1081 | + if (empty($parameters[$key])) { |
|
| 1082 | 1082 | unset($parameters[$key]); |
| 1083 | 1083 | } |
| 1084 | 1084 | } |
@@ -1350,7 +1350,7 @@ discard block |
||
| 1350 | 1350 | 'Not in use' => 'OK', |
| 1351 | 1351 | 'Busy' => 'OK', |
| 1352 | 1352 | ]; |
| 1353 | - $state = $state_array[$peer['DeviceState']] ?? 'UNKNOWN'; |
|
| 1353 | + $state = $state_array[$peer['DeviceState']] ?? 'UNKNOWN'; |
|
| 1354 | 1354 | |
| 1355 | 1355 | $peers[] = [ |
| 1356 | 1356 | 'id' => $peer['ObjectName'], |
@@ -1373,12 +1373,12 @@ discard block |
||
| 1373 | 1373 | $res = $this->sendRequestTimeout('SIPpeers'); |
| 1374 | 1374 | if (isset($res['data']) && $res['data'] != null && $res['data']['PeerEntry'] != null) { |
| 1375 | 1375 | foreach ($res['data']['PeerEntry'] as $peer) { |
| 1376 | - if ( ! is_numeric($peer['ObjectName'])) { |
|
| 1376 | + if (!is_numeric($peer['ObjectName'])) { |
|
| 1377 | 1377 | continue; |
| 1378 | 1378 | } |
| 1379 | 1379 | // if ('Unmonitored' == $peer['Status']) continue; |
| 1380 | 1380 | $arr_status = explode(' ', $peer['Status']); |
| 1381 | - $peers[] = ['id' => $peer['ObjectName'], 'state' => strtoupper($arr_status[0]),]; |
|
| 1381 | + $peers[] = ['id' => $peer['ObjectName'], 'state' => strtoupper($arr_status[0]), ]; |
|
| 1382 | 1382 | } |
| 1383 | 1383 | } |
| 1384 | 1384 | |
@@ -1419,7 +1419,7 @@ discard block |
||
| 1419 | 1419 | if (isset($res['data']['ContactStatusDetail'])) { |
| 1420 | 1420 | $result = $res['data']['ContactStatusDetail']; |
| 1421 | 1421 | } |
| 1422 | - $result['state'] = isset($result['URI']) && ! empty($result['URI']) ? 'OK' : 'UNKNOWN'; |
|
| 1422 | + $result['state'] = isset($result['URI']) && !empty($result['URI']) ? 'OK' : 'UNKNOWN'; |
|
| 1423 | 1423 | |
| 1424 | 1424 | return $result; |
| 1425 | 1425 | } |
@@ -1443,7 +1443,7 @@ discard block |
||
| 1443 | 1443 | { |
| 1444 | 1444 | $result = []; |
| 1445 | 1445 | $conf_data = $this->MeetmeList($conference); |
| 1446 | - if ( ! isset($conf_data['data']['MeetmeList'])) { |
|
| 1446 | + if (!isset($conf_data['data']['MeetmeList'])) { |
|
| 1447 | 1447 | return $result; |
| 1448 | 1448 | } |
| 1449 | 1449 | foreach ($conf_data['data']['MeetmeList'] as $user_data) { |
@@ -373,7 +373,8 @@ discard block |
||
| 373 | 373 | * Читает данные из сокета. Если возникает ошибка возвращает ее. |
| 374 | 374 | * @return array |
| 375 | 375 | */ |
| 376 | - private function getDataFromSocket() { |
|
| 376 | + private function getDataFromSocket() |
|
| 377 | + { |
|
| 377 | 378 | $response = []; |
| 378 | 379 | if(!is_resource($this->socket)){ |
| 379 | 380 | $response['error'] = 'Socket not init.'; |
@@ -384,11 +385,11 @@ discard block |
||
| 384 | 385 | if($resultFgets !== false){ |
| 385 | 386 | $buffer = trim($resultFgets); |
| 386 | 387 | $response['data'] = $buffer; |
| 387 | - }else{ |
|
| 388 | + } else{ |
|
| 388 | 389 | $response['error'] = 'Read data error.'; |
| 389 | 390 | } |
| 390 | 391 | |
| 391 | - }catch (Throwable $e){ |
|
| 392 | + } catch (Throwable $e){ |
|
| 392 | 393 | $response['error'] = $e->getMessage(); |
| 393 | 394 | } |
| 394 | 395 | |
@@ -399,7 +400,8 @@ discard block |
||
| 399 | 400 | * Читает данные из сокета |
| 400 | 401 | * @return string |
| 401 | 402 | */ |
| 402 | - private function getStringDataFromSocket() { |
|
| 403 | + private function getStringDataFromSocket() |
|
| 404 | + { |
|
| 403 | 405 | $response = $this->getDataFromSocket(); |
| 404 | 406 | return $response['data'] ?? ''; |
| 405 | 407 | } |
@@ -419,7 +421,7 @@ discard block |
||
| 419 | 421 | if($resultWrite === false){ |
| 420 | 422 | $result = false; |
| 421 | 423 | } |
| 422 | - }catch (Throwable $e){ |
|
| 424 | + } catch (Throwable $e){ |
|
| 423 | 425 | $result = false; |
| 424 | 426 | } |
| 425 | 427 | return $result; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $freeExtension = '2200100'; |
| 113 | 113 | for ($i = 100; ; $i++) { |
| 114 | 114 | $freeExtension = "2200{$i}"; |
| 115 | - if ( ! in_array(['number' => $freeExtension], $result, false)) { |
|
| 115 | + if (!in_array(['number' => $freeExtension], $result, false)) { |
|
| 116 | 116 | break; |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -421,8 +421,8 @@ discard block |
||
| 421 | 421 | $relatedModel = $relation->getReferencedModel(); |
| 422 | 422 | $referencedFields = is_array($referencedFields) ? $referencedFields : [$referencedFields]; |
| 423 | 423 | foreach ($referencedFields as $referencedField) { |
| 424 | - $parameters = [ |
|
| 425 | - 'conditions' => $referencedField . '= :oldNumber:', |
|
| 424 | + $parameters = [ |
|
| 425 | + 'conditions' => $referencedField.'= :oldNumber:', |
|
| 426 | 426 | 'bind' => ['oldNumber' => $snapShotData['number']], |
| 427 | 427 | ]; |
| 428 | 428 | $relatedRecords = call_user_func([$relatedModel, 'find'], $parameters); |
@@ -476,8 +476,8 @@ discard block |
||
| 476 | 476 | $relatedModel = $relation->getReferencedModel(); |
| 477 | 477 | $referencedFields = is_array($referencedFields) ? $referencedFields : [$referencedFields]; |
| 478 | 478 | foreach ($referencedFields as $referencedField) { |
| 479 | - $parameters = [ |
|
| 480 | - 'conditions' => $referencedField . '= :Number:', |
|
| 479 | + $parameters = [ |
|
| 480 | + 'conditions' => $referencedField.'= :Number:', |
|
| 481 | 481 | 'bind' => ['Number' => $this->number], |
| 482 | 482 | ]; |
| 483 | 483 | $relatedRecords = call_user_func([$relatedModel, 'find'], $parameters); |
@@ -50,10 +50,10 @@ |
||
| 50 | 50 | { |
| 51 | 51 | $di->setShared( |
| 52 | 52 | self::SERVICE_NAME, |
| 53 | - function () { |
|
| 53 | + function() { |
|
| 54 | 54 | try { |
| 55 | 55 | return new License('http://127.0.0.1:8223'); |
| 56 | - } catch (Throwable $exception){ |
|
| 56 | + } catch (Throwable $exception) { |
|
| 57 | 57 | Util::sysLogMsg(__CLASS__, $exception); |
| 58 | 58 | } |
| 59 | 59 | return null; |
@@ -50,7 +50,8 @@ |
||
| 50 | 50 | { |
| 51 | 51 | $di->setShared( |
| 52 | 52 | self::SERVICE_NAME, |
| 53 | - function () { |
|
| 53 | + function () |
|
| 54 | + { |
|
| 54 | 55 | try { |
| 55 | 56 | return new License('http://127.0.0.1:8223'); |
| 56 | 57 | } catch (Throwable $exception){ |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | $coreConfig = $di->getShared('config')->path('core'); |
| 34 | 34 | $di->setShared( |
| 35 | 35 | self::SERVICE_NAME, |
| 36 | - function () use ($di, $coreConfig) { |
|
| 36 | + function() use ($di, $coreConfig) { |
|
| 37 | 37 | $cacheKey = false; |
| 38 | - if (php_sapi_name() === 'cli'){ |
|
| 39 | - if (cli_get_process_title()=== WorkerApiCommands::class){ |
|
| 38 | + if (php_sapi_name() === 'cli') { |
|
| 39 | + if (cli_get_process_title() === WorkerApiCommands::class) { |
|
| 40 | 40 | $language = PbxSettings::getValueByKey('WebAdminLanguage'); |
| 41 | 41 | } else { |
| 42 | 42 | $language = PbxSettings::getValueByKey('SSHLanguage'); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $language = $di->get('language'); |
| 46 | 46 | $session = $di->get('session'); |
| 47 | 47 | if ($session !== null && $session->has('versionHash')) { |
| 48 | - $cacheKey = 'LocalisationArray' . $session->get('versionHash') . $language . '.php'; |
|
| 48 | + $cacheKey = 'LocalisationArray'.$session->get('versionHash').$language.'.php'; |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | // Возьмем английский перевод расширений |
| 81 | 81 | $extensionsTranslates = [[]]; |
| 82 | - $results = glob($coreConfig->modulesDir . '/*/{Messages}/en.php', GLOB_BRACE); |
|
| 82 | + $results = glob($coreConfig->modulesDir.'/*/{Messages}/en.php', GLOB_BRACE); |
|
| 83 | 83 | foreach ($results as $path) { |
| 84 | 84 | $langArr = require $path; |
| 85 | 85 | if (is_array($langArr)) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | if ($language !== 'en') { |
| 93 | 93 | $additionalTranslates = [[]]; |
| 94 | 94 | $results = glob( |
| 95 | - $coreConfig->modulesDir . "/*/{Messages}/{$language}.php", |
|
| 95 | + $coreConfig->modulesDir."/*/{Messages}/{$language}.php", |
|
| 96 | 96 | GLOB_BRACE |
| 97 | 97 | ); |
| 98 | 98 | foreach ($results as $path) { |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | // IncomingRoutingTable', |
| 47 | 47 | // OutgoingRoutingTable', |
| 48 | 48 | ]; |
| 49 | - $results = [[]]; |
|
| 49 | + $results = [[]]; |
|
| 50 | 50 | foreach ($arrClasses as $itemClass) { |
| 51 | 51 | $records = call_user_func([$itemClass, 'find']); |
| 52 | 52 | $categoryItems = []; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | 'typeLocalized' => $this->translation->_("ex_dropdownCategory_{$type}"), |
| 91 | 91 | 'sorter' => $clearedRepresent, |
| 92 | 92 | ]; |
| 93 | - $items[] = $result; |
|
| 93 | + $items[] = $result; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $elements = $this->elements; |
| 104 | 104 | |
| 105 | 105 | $items[] = [ |
| 106 | - 'name' => $elements->getIconByController('incoming-routes') . ' ' . $this->translation->_( |
|
| 106 | + 'name' => $elements->getIconByController('incoming-routes').' '.$this->translation->_( |
|
| 107 | 107 | 'mm_IncomingRoutes' |
| 108 | 108 | ), |
| 109 | 109 | 'value' => $this->url->get('incoming-routes'), |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | 'sorter' => strip_tags($this->translation->_('mm_IncomingRoutes')), |
| 113 | 113 | ]; |
| 114 | 114 | $items[] = [ |
| 115 | - 'name' => $elements->getIconByController('outbound-routes') . ' ' . $this->translation->_( |
|
| 115 | + 'name' => $elements->getIconByController('outbound-routes').' '.$this->translation->_( |
|
| 116 | 116 | 'mm_OutboundRoutes' |
| 117 | 117 | ), |
| 118 | 118 | 'value' => $this->url->get('outbound-routes'), |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | 'sorter' => strip_tags($this->translation->_('mm_OutboundRoutes')), |
| 122 | 122 | ]; |
| 123 | 123 | $items[] = [ |
| 124 | - 'name' => $elements->getIconByController('general-settings') . ' ' . $this->translation->_( |
|
| 124 | + 'name' => $elements->getIconByController('general-settings').' '.$this->translation->_( |
|
| 125 | 125 | 'mm_GeneralSettings' |
| 126 | 126 | ), |
| 127 | 127 | 'value' => $this->url->get('general-settings/modify'), |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | 'sorter' => strip_tags($this->translation->_('mm_GeneralSettings')), |
| 131 | 131 | ]; |
| 132 | 132 | $items[] = [ |
| 133 | - 'name' => $elements->getIconByController('time-settings') . ' ' . $this->translation->_( |
|
| 133 | + 'name' => $elements->getIconByController('time-settings').' '.$this->translation->_( |
|
| 134 | 134 | 'mm_SystemClock' |
| 135 | 135 | ), |
| 136 | 136 | 'value' => $this->url->get('time-settings/modify'), |
@@ -139,14 +139,14 @@ discard block |
||
| 139 | 139 | 'sorter' => strip_tags($this->translation->_('mm_SystemClock')), |
| 140 | 140 | ]; |
| 141 | 141 | $items[] = [ |
| 142 | - 'name' => $elements->getIconByController('network') . ' ' . $this->translation->_('mm_Network'), |
|
| 142 | + 'name' => $elements->getIconByController('network').' '.$this->translation->_('mm_Network'), |
|
| 143 | 143 | 'value' => $this->url->get('network/modify/'), |
| 144 | 144 | 'type' => 'MENUITEMS', |
| 145 | 145 | 'typeLocalized' => $this->translation->_('ex_dropdownCategory_MENUITEMS'), |
| 146 | 146 | 'sorter' => strip_tags($this->translation->_('mm_Network')), |
| 147 | 147 | ]; |
| 148 | 148 | $items[] = [ |
| 149 | - 'name' => $elements->getIconByController('mail-settings') . ' ' . $this->translation->_( |
|
| 149 | + 'name' => $elements->getIconByController('mail-settings').' '.$this->translation->_( |
|
| 150 | 150 | 'mm_MailSettings' |
| 151 | 151 | ), |
| 152 | 152 | 'value' => $this->url->get('mail-settings/modify'), |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | 'sorter' => strip_tags($this->translation->_('mm_MailSettings')), |
| 156 | 156 | ]; |
| 157 | 157 | $items[] = [ |
| 158 | - 'name' => $elements->getIconByController('call-detail-records') . ' ' . $this->translation->_( |
|
| 158 | + 'name' => $elements->getIconByController('call-detail-records').' '.$this->translation->_( |
|
| 159 | 159 | 'mm_CallDetailRecords' |
| 160 | 160 | ), |
| 161 | 161 | 'value' => $this->url->get('call-detail-records'), |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | 'sorter' => strip_tags($this->translation->_('mm_CallDetailRecords')), |
| 165 | 165 | ]; |
| 166 | 166 | $items[] = [ |
| 167 | - 'name' => $elements->getIconByController('sound-files') . ' ' . $this->translation->_( |
|
| 167 | + 'name' => $elements->getIconByController('sound-files').' '.$this->translation->_( |
|
| 168 | 168 | 'mm_SoundFiles' |
| 169 | 169 | ), |
| 170 | 170 | 'value' => $this->url->get('sound-files'), |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | ]; |
| 175 | 175 | |
| 176 | 176 | $items[] = [ |
| 177 | - 'name' => $elements->getIconByController('licensing') . ' ' . $this->translation->_( |
|
| 177 | + 'name' => $elements->getIconByController('licensing').' '.$this->translation->_( |
|
| 178 | 178 | 'mm_Licensing' |
| 179 | 179 | ), |
| 180 | 180 | 'value' => $this->url->get('licensing/modify/'), |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | ]; |
| 185 | 185 | |
| 186 | 186 | $items[] = [ |
| 187 | - 'name' => $elements->getIconByController('pbx-extension-modules') . ' ' . $this->translation->_( |
|
| 187 | + 'name' => $elements->getIconByController('pbx-extension-modules').' '.$this->translation->_( |
|
| 188 | 188 | 'BreadcrumbPbxExtensionModules' |
| 189 | 189 | ), |
| 190 | 190 | 'value' => $this->url->get('pbx-extension-modules'), |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | ]; |
| 195 | 195 | |
| 196 | 196 | $items[] = [ |
| 197 | - 'name' => $elements->getIconByController('system-diagnostic') . ' ' . $this->translation->_( |
|
| 197 | + 'name' => $elements->getIconByController('system-diagnostic').' '.$this->translation->_( |
|
| 198 | 198 | 'mm_SystemDiagnostic' |
| 199 | 199 | ), |
| 200 | 200 | 'value' => $this->url->get('system-diagnostic'), |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | ]; |
| 205 | 205 | |
| 206 | 206 | $items[] = [ |
| 207 | - 'name' => $elements->getIconByController('fail2-ban') . ' ' . $this->translation->_( |
|
| 207 | + 'name' => $elements->getIconByController('fail2-ban').' '.$this->translation->_( |
|
| 208 | 208 | 'mm_BruteForceProtection' |
| 209 | 209 | ), |
| 210 | 210 | 'value' => $this->url->get('fail2-ban'), |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | 'sorter' => strip_tags($this->translation->_('mm_BruteForceProtection')), |
| 214 | 214 | ]; |
| 215 | 215 | $items[] = [ |
| 216 | - 'name' => $elements->getIconByController('update') . ' ' . $this->translation->_( |
|
| 216 | + 'name' => $elements->getIconByController('update').' '.$this->translation->_( |
|
| 217 | 217 | 'mm_UpdateSystem' |
| 218 | 218 | ), |
| 219 | 219 | 'value' => $this->url->get('update'), |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function indexAction(): void |
| 16 | 16 | { |
| 17 | - $this->view->form = new SystemDiagnosticForm(); |
|
| 17 | + $this->view->form = new SystemDiagnosticForm(); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | |
@@ -44,9 +44,9 @@ |
||
| 44 | 44 | |
| 45 | 45 | try { |
| 46 | 46 | $application = new Application($di); |
| 47 | - echo $application->handle($_SERVER['REQUEST_URI'])->getContent(); |
|
| 47 | + echo $application->handle($_SERVER['REQUEST_URI'])->getContent(); |
|
| 48 | 48 | } catch (Throwable $e) { |
| 49 | - $errorLogger->captureException($e); |
|
| 50 | - PhpError::exceptionHandler($e); |
|
| 51 | - echo $e->getMessage(); |
|
| 49 | + $errorLogger->captureException($e); |
|
| 50 | + PhpError::exceptionHandler($e); |
|
| 51 | + echo $e->getMessage(); |
|
| 52 | 52 | } |
| 53 | 53 | \ No newline at end of file |