@@ -41,12 +41,12 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | public function start($argv): void |
20 | 20 | { |
21 | 21 | $settings_file = trim($argv[1]); |
22 | - if ( ! file_exists($settings_file)) { |
|
22 | + if (!file_exists($settings_file)) { |
|
23 | 23 | Util::sysLogMsg(__CLASS__, 'File with settings not found'); |
24 | 24 | |
25 | 25 | return; |
26 | 26 | } |
27 | 27 | $settings = json_decode(file_get_contents($settings_file), true); |
28 | - $progress_file = $settings['tempDir'] . '/merging_progress'; |
|
28 | + $progress_file = $settings['tempDir'].'/merging_progress'; |
|
29 | 29 | $this->mergeFilesInDirectory( |
30 | 30 | $settings['tempDir'], |
31 | 31 | $settings['resumableFilename'], |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | // Check filesize is equal uploaded size |
38 | 38 | $resultFileSize = filesize($settings['fullUploadedFileName']); |
39 | - if ((int)$settings['resumableTotalSize'] === $resultFileSize) { |
|
39 | + if ((int) $settings['resumableTotalSize'] === $resultFileSize) { |
|
40 | 40 | file_put_contents($progress_file, '100'); |
41 | 41 | } else { |
42 | 42 | Util::sysLogMsg( |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | // Delete uploaded file after 10 minutes |
49 | 49 | Util::mwExecBg( |
50 | - '/sbin/shell_functions.sh killprocesses ' . $settings['tempDir'] . ' -TERM 0;rm -rf ' . $settings['tempDir'], |
|
50 | + '/sbin/shell_functions.sh killprocesses '.$settings['tempDir'].' -TERM 0;rm -rf '.$settings['tempDir'], |
|
51 | 51 | '/dev/null', |
52 | 52 | 600 |
53 | 53 | ); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // Restore original file from chunks |
74 | 74 | if (($fp = fopen($result_file, 'w')) !== false) { |
75 | 75 | for ($i = 1; $i <= $total_files; $i++) { |
76 | - $tmp_file = $tempDir . '/' . $fileName . '.part' . $i; |
|
76 | + $tmp_file = $tempDir.'/'.$fileName.'.part'.$i; |
|
77 | 77 | fwrite($fp, file_get_contents($tmp_file)); |
78 | 78 | unlink($tmp_file); |
79 | 79 | $currentProgress = round($i / $total_files * 100); |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | } |
83 | 83 | fclose($fp); |
84 | 84 | } else { |
85 | - Util::sysLogMsg('UploadFile', 'cannot create the destination file - ' . $result_file); |
|
85 | + Util::sysLogMsg('UploadFile', 'cannot create the destination file - '.$result_file); |
|
86 | 86 | |
87 | 87 | return; |
88 | 88 | } |
89 | - Util::sysLogMsg('UploadFile', 'destination file - ' . $result_file); |
|
89 | + Util::sysLogMsg('UploadFile', 'destination file - '.$result_file); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 |
@@ -41,7 +41,7 @@ |
||
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 |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | if (file_exists('/etc/TZ')) { |
175 | 175 | $origin_tz = file_get_contents("/etc/TZ"); |
176 | 176 | } |
177 | - if ($origin_tz !== $db_tz){ |
|
177 | + if ($origin_tz !== $db_tz) { |
|
178 | 178 | self::timezoneConfigure(); |
179 | 179 | } |
180 | 180 | $origin_tz = $db_tz; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | } |
245 | 245 | if ($timezone) { |
246 | 246 | $zone_file = "/usr/share/zoneinfo/{$timezone}"; |
247 | - if ( ! file_exists($zone_file)) { |
|
247 | + if (!file_exists($zone_file)) { |
|
248 | 248 | return; |
249 | 249 | } |
250 | 250 | $cpPath = Util::which('cp'); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | try { |
283 | 283 | /** @var \MikoPBX\Modules\Config\ConfigClass $appClass */ |
284 | 284 | $appClass->onAfterPbxStarted(); |
285 | - }catch (\Error $e){ |
|
285 | + } catch (\Error $e) { |
|
286 | 286 | Util::sysLogMsg('onAfterPbxStarted', $e->getMessage()); |
287 | 287 | } |
288 | 288 | } |
@@ -282,7 +282,7 @@ |
||
282 | 282 | try { |
283 | 283 | /** @var \MikoPBX\Modules\Config\ConfigClass $appClass */ |
284 | 284 | $appClass->onAfterPbxStarted(); |
285 | - }catch (\Error $e){ |
|
285 | + } catch (\Error $e){ |
|
286 | 286 | Util::sysLogMsg('onAfterPbxStarted', $e->getMessage()); |
287 | 287 | } |
288 | 288 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | Util::killByName('pcapsipdump'); |
32 | - $log_dir = System::getLogDir() . '/pcapsipdump'; |
|
32 | + $log_dir = System::getLogDir().'/pcapsipdump'; |
|
33 | 33 | Util::mwMkdir($log_dir); |
34 | 34 | |
35 | 35 | $network = new Network(); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | foreach ($arr_eth as $eth) { |
39 | 39 | $pid_file = "/var/run/pcapsipdump_{$eth}.pid"; |
40 | 40 | Util::mwExecBg( |
41 | - $pcapsipdumpPath . ' -T 120 -P ' . $pid_file . ' -i ' . $eth . ' -m \'^(INVITE|REGISTER)$\' -L ' . $log_dir . '/dump.db' |
|
41 | + $pcapsipdumpPath.' -T 120 -P '.$pid_file.' -i '.$eth.' -m \'^(INVITE|REGISTER)$\' -L '.$log_dir.'/dump.db' |
|
42 | 42 | ); |
43 | 43 | } |
44 | 44 | } |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | /** @var \MikoPBX\Common\Models\LanInterfaces $res */ |
147 | 147 | $res = LanInterfaces::findFirst("internet = '1'"); |
148 | 148 | if (null !== $res) { |
149 | - if ( ! empty($res->primarydns) && '127.0.0.1' != $res->primarydns) { |
|
149 | + if (!empty($res->primarydns) && '127.0.0.1' != $res->primarydns) { |
|
150 | 150 | $dns[] = $res->primarydns; |
151 | 151 | } |
152 | - if ( ! empty($res->secondarydns) && '127.0.0.1' != $res->secondarydns) { |
|
152 | + if (!empty($res->secondarydns) && '127.0.0.1' != $res->secondarydns) { |
|
153 | 153 | $dns[] = $res->secondarydns; |
154 | 154 | } |
155 | 155 | } |
@@ -165,39 +165,39 @@ discard block |
||
165 | 165 | public function generatePdnsdConfig($named_dns): void |
166 | 166 | { |
167 | 167 | $tempDir = $this->di->getShared('config')->path('core.tempDir'); |
168 | - $cache_dir = $tempDir . '/pdnsd/cache'; |
|
168 | + $cache_dir = $tempDir.'/pdnsd/cache'; |
|
169 | 169 | Util::mwMkdir($cache_dir); |
170 | 170 | |
171 | - $conf = 'global {' . "\n" . |
|
172 | - ' perm_cache=10240;' . "\n" . |
|
173 | - ' cache_dir="' . $cache_dir . '";' . "\n" . |
|
174 | - ' pid_file = /var/run/pdnsd.pid;' . "\n" . |
|
175 | - ' run_as="nobody";' . "\n" . |
|
176 | - ' server_ip = 127.0.0.1;' . "\n" . |
|
177 | - ' status_ctl = on;' . "\n" . |
|
178 | - ' query_method=udp_tcp;' . "\n" . |
|
179 | - ' min_ttl=15m;' . "\n" . |
|
180 | - ' max_ttl=1w;' . "\n" . |
|
181 | - ' timeout=10;' . "\n" . |
|
182 | - ' neg_domain_pol=on;' . "\n" . |
|
183 | - ' run_as=root;' . "\n" . |
|
184 | - ' daemon=on;' . "\n" . |
|
185 | - '}' . "\n" . |
|
186 | - 'server {' . "\n" . |
|
187 | - ' label = "main";' . "\n" . |
|
188 | - ' ip = ' . implode(', ', $named_dns) . ';' . "\n" . |
|
189 | - ' interface=lo;' . "\n" . |
|
190 | - ' uptest=if;' . "\n" . |
|
191 | - ' interval=10m;' . "\n" . |
|
192 | - ' purge_cache=off;' . "\n" . |
|
171 | + $conf = 'global {'."\n". |
|
172 | + ' perm_cache=10240;'."\n". |
|
173 | + ' cache_dir="'.$cache_dir.'";'."\n". |
|
174 | + ' pid_file = /var/run/pdnsd.pid;'."\n". |
|
175 | + ' run_as="nobody";'."\n". |
|
176 | + ' server_ip = 127.0.0.1;'."\n". |
|
177 | + ' status_ctl = on;'."\n". |
|
178 | + ' query_method=udp_tcp;'."\n". |
|
179 | + ' min_ttl=15m;'."\n". |
|
180 | + ' max_ttl=1w;'."\n". |
|
181 | + ' timeout=10;'."\n". |
|
182 | + ' neg_domain_pol=on;'."\n". |
|
183 | + ' run_as=root;'."\n". |
|
184 | + ' daemon=on;'."\n". |
|
185 | + '}'."\n". |
|
186 | + 'server {'."\n". |
|
187 | + ' label = "main";'."\n". |
|
188 | + ' ip = '.implode(', ', $named_dns).';'."\n". |
|
189 | + ' interface=lo;'."\n". |
|
190 | + ' uptest=if;'."\n". |
|
191 | + ' interval=10m;'."\n". |
|
192 | + ' purge_cache=off;'."\n". |
|
193 | 193 | '}'; |
194 | 194 | |
195 | - $pdnsdConfFile = '/etc/pdnsd.conf'; |
|
195 | + $pdnsdConfFile = '/etc/pdnsd.conf'; |
|
196 | 196 | $savedConf = ''; |
197 | - if(file_exists($pdnsdConfFile)){ |
|
197 | + if (file_exists($pdnsdConfFile)) { |
|
198 | 198 | $savedConf = file_get_contents($pdnsdConfFile); |
199 | 199 | } |
200 | - if($savedConf != $conf){ |
|
200 | + if ($savedConf != $conf) { |
|
201 | 201 | file_put_contents($pdnsdConfFile, $conf); |
202 | 202 | } |
203 | 203 | $pdnsdPath = Util::which('pdnsd'); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | if (!empty($pid) && $savedConf === $conf) { |
206 | 206 | // Выполним дополнительную проверку, работает ли сервер. |
207 | 207 | $resultResolve = gethostbynamel('lic.miko.ru'); |
208 | - if($resultResolve !== false){ |
|
208 | + if ($resultResolve !== false) { |
|
209 | 209 | // Ничего делать не нужно. Конфиг не изменился. Рестарт не требуется. |
210 | 210 | return; |
211 | 211 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | */ |
283 | 283 | $pid_file = "/var/run/udhcpc_{$if_name}"; |
284 | 284 | $pid_pcc = Util::getPidOfProcess($pid_file); |
285 | - if ( ! empty($pid_pcc) && file_exists($pid_file)) { |
|
285 | + if (!empty($pid_pcc) && file_exists($pid_file)) { |
|
286 | 286 | // Завершаем старый процесс. |
287 | 287 | $killPath = Util::which('kill'); |
288 | 288 | $catPath = Util::which('cat'); |
@@ -411,10 +411,10 @@ discard block |
||
411 | 411 | |
412 | 412 | $result = ['']; |
413 | 413 | if (file_exists('/etc/static-routes')) { |
414 | - $command = "{$catPath} /etc/static-routes " . |
|
415 | - "| {$grepPath} '^rout' " . |
|
416 | - "| {$busyboxPath} awk -F ';' '{print $1}' " . |
|
417 | - "| {$grepPath} '{$if_name}\$' " . |
|
414 | + $command = "{$catPath} /etc/static-routes ". |
|
415 | + "| {$grepPath} '^rout' ". |
|
416 | + "| {$busyboxPath} awk -F ';' '{print $1}' ". |
|
417 | + "| {$grepPath} '{$if_name}\$' ". |
|
418 | 418 | "| {$awkPath} -F 'dev {$if_name}' '{ print $1 }'"; |
419 | 419 | Util::mwExec($command, $result); |
420 | 420 | } |
@@ -424,19 +424,19 @@ discard block |
||
424 | 424 | |
425 | 425 | if ($if_data['vlanid'] > 0) { |
426 | 426 | // Пока только статика. |
427 | - $lan_config = "auto {$if_data['interface_orign']}.{$if_data['vlanid']}\n" . |
|
428 | - "iface {$if_data['interface_orign']}.{$if_data['vlanid']} inet static \n" . |
|
429 | - "address {$ipaddr}\n" . |
|
430 | - "netmask {$subnet}\n" . |
|
431 | - "gateway {$gateway}\n" . |
|
432 | - "dns-nameservers 127.0.0.1\n" . |
|
433 | - "vlan_raw_device {$if_data['interface_orign']}\n" . |
|
434 | - "{$routs_add}\n" . |
|
427 | + $lan_config = "auto {$if_data['interface_orign']}.{$if_data['vlanid']}\n". |
|
428 | + "iface {$if_data['interface_orign']}.{$if_data['vlanid']} inet static \n". |
|
429 | + "address {$ipaddr}\n". |
|
430 | + "netmask {$subnet}\n". |
|
431 | + "gateway {$gateway}\n". |
|
432 | + "dns-nameservers 127.0.0.1\n". |
|
433 | + "vlan_raw_device {$if_data['interface_orign']}\n". |
|
434 | + "{$routs_add}\n". |
|
435 | 435 | "{$routs_rem}\n"; |
436 | 436 | } elseif (trim($if_data['dhcp']) === '1') { |
437 | - $lan_config = "auto {$if_name}\n" . |
|
438 | - "iface {$if_name} inet dhcp\n" . |
|
439 | - "{$routs_add}\n" . |
|
437 | + $lan_config = "auto {$if_name}\n". |
|
438 | + "iface {$if_name} inet dhcp\n". |
|
439 | + "{$routs_add}\n". |
|
440 | 440 | "{$routs_rem}\n"; |
441 | 441 | } else { |
442 | 442 | if (empty($ipaddr)) { |
@@ -449,13 +449,13 @@ discard block |
||
449 | 449 | echo "Caught exception: $ipaddr $subnet", $e->getMessage(), "\n"; |
450 | 450 | continue; |
451 | 451 | } |
452 | - $lan_config = "auto {$if_name}\n" . |
|
453 | - "iface {$if_name} inet static\n" . |
|
454 | - "address {$ipaddr}\n" . |
|
455 | - "netmask {$subnet}\n" . |
|
456 | - "gateway {$gateway}\n" . |
|
457 | - "dns-nameservers 127.0.0.1\n" . |
|
458 | - "{$routs_add}\n" . |
|
452 | + $lan_config = "auto {$if_name}\n". |
|
453 | + "iface {$if_name} inet static\n". |
|
454 | + "address {$ipaddr}\n". |
|
455 | + "netmask {$subnet}\n". |
|
456 | + "gateway {$gateway}\n". |
|
457 | + "dns-nameservers 127.0.0.1\n". |
|
458 | + "{$routs_add}\n". |
|
459 | 459 | "{$routs_rem}\n"; |
460 | 460 | } |
461 | 461 | file_put_contents("/etc/network/interfaces.d/{$if_name}", $lan_config); |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $net_mask = explode(".", $net_mask); |
547 | 547 | |
548 | 548 | foreach ($net_mask as $oct_ect) { |
549 | - $bits += strlen(str_replace("0", "", decbin((int)$oct_ect))); |
|
549 | + $bits += strlen(str_replace("0", "", decbin((int) $oct_ect))); |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | return $bits; |
@@ -603,13 +603,13 @@ discard block |
||
603 | 603 | $data->name = $name; |
604 | 604 | $data->interface = $name; |
605 | 605 | $data->dhcp = '1'; |
606 | - $data->internet = ($general === true) ? '1' : '0';; |
|
606 | + $data->internet = ($general === true) ? '1' : '0'; ; |
|
607 | 607 | $data->disabled = '0'; |
608 | 608 | $data->vlanid = '0'; |
609 | 609 | $data->hostname = 'mikopbx'; |
610 | 610 | $data->domain = ''; |
611 | 611 | $data->topology = 'private'; |
612 | - $data->primarydns= ''; |
|
612 | + $data->primarydns = ''; |
|
613 | 613 | $data->save(); |
614 | 614 | |
615 | 615 | return $data->toArray(); |
@@ -630,15 +630,15 @@ discard block |
||
630 | 630 | public function hostnameConfigure(): void |
631 | 631 | { |
632 | 632 | $data = Network::getHostName(); |
633 | - $hosts_conf = "127.0.0.1 localhost\n" . |
|
633 | + $hosts_conf = "127.0.0.1 localhost\n". |
|
634 | 634 | "127.0.0.1 {$data['hostname']}\n"; |
635 | - if ( ! empty($data['domain'])) { |
|
635 | + if (!empty($data['domain'])) { |
|
636 | 636 | $hosts_conf .= "127.0.0.1 {$data['hostname']}.{$data['domain']}\n"; |
637 | 637 | } |
638 | 638 | Util::fileWriteContent('/etc/hosts', $hosts_conf); |
639 | 639 | |
640 | 640 | $hostnamePath = Util::which('hostname'); |
641 | - Util::mwExec($hostnamePath . ' ' . escapeshellarg("{$data['hostname']}")); |
|
641 | + Util::mwExec($hostnamePath.' '.escapeshellarg("{$data['hostname']}")); |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | /** |
@@ -652,12 +652,12 @@ discard block |
||
652 | 652 | |
653 | 653 | $pidFile = '/var/run/openvpn.pid'; |
654 | 654 | $pid = Util::getPidOfProcess('openvpn'); |
655 | - if ( ! empty($pid)) { |
|
655 | + if (!empty($pid)) { |
|
656 | 656 | // Завершаем процесс. |
657 | 657 | $busyboxPath = Util::which('busybox'); |
658 | 658 | Util::mwExec("{$busyboxPath} kill '$pid'"); |
659 | 659 | } |
660 | - if ( ! empty($data)) { |
|
660 | + if (!empty($data)) { |
|
661 | 661 | $openvpnPath = Util::which('openvpn'); |
662 | 662 | Util::mwExecBg("{$openvpnPath} --config /etc/openvpn.ovpn --writepid {$pidFile}", '/dev/null', 5); |
663 | 663 | } |
@@ -867,12 +867,12 @@ discard block |
||
867 | 867 | if ($res === null) { |
868 | 868 | return; |
869 | 869 | } |
870 | - if (empty($res->primarydns) && ! empty($data['primarydns'])) { |
|
870 | + if (empty($res->primarydns) && !empty($data['primarydns'])) { |
|
871 | 871 | $res->writeAttribute('primarydns', $data['primarydns']); |
872 | 872 | } elseif (empty($res->secondarydns) && $res->primarydns !== $data['primarydns']) { |
873 | 873 | $res->writeAttribute('secondarydns', $data['primarydns']); |
874 | 874 | } |
875 | - if (empty($res->secondarydns) && ! empty($data['secondarydns'])) { |
|
875 | + if (empty($res->secondarydns) && !empty($data['secondarydns'])) { |
|
876 | 876 | $res->writeAttribute('secondarydns', $data['secondarydns']); |
877 | 877 | } |
878 | 878 | $res->save(); |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | { |
916 | 916 | // Настройка по умолчанию. |
917 | 917 | $interface = trim(getenv('interface')); |
918 | - if ( ! Util::isSystemctl()) { |
|
918 | + if (!Util::isSystemctl()) { |
|
919 | 919 | // Для MIKO LFS Edition. |
920 | 920 | $busyboxPath = Util::which('busybox'); |
921 | 921 | Util::mwExec("{$busyboxPath} ifconfig $interface 192.168.2.1 netmask 255.255.255.0"); |
@@ -90,18 +90,18 @@ discard block |
||
90 | 90 | } |
91 | 91 | $parameters['uploadDir'] = $di->getShared('config')->path('www.uploadDir'); |
92 | 92 | $parameters['tempDir'] = "{$parameters['uploadDir']}/{$parameters['resumableIdentifier']}"; |
93 | - if ( ! Util::mwMkdir($parameters['tempDir'])) { |
|
94 | - $res->messages[] = 'Temp dir does not exist ' . $parameters['tempDir']; |
|
93 | + if (!Util::mwMkdir($parameters['tempDir'])) { |
|
94 | + $res->messages[] = 'Temp dir does not exist '.$parameters['tempDir']; |
|
95 | 95 | |
96 | 96 | return $res; |
97 | 97 | } |
98 | 98 | |
99 | 99 | $fileName = pathinfo($parameters['resumableFilename'], PATHINFO_FILENAME); |
100 | - $fileName = preg_replace( '/[\W]/', '', $fileName); |
|
101 | - if (strlen($fileName)<10){ |
|
100 | + $fileName = preg_replace('/[\W]/', '', $fileName); |
|
101 | + if (strlen($fileName) < 10) { |
|
102 | 102 | $fileName = ''.md5(time()).'-'.$fileName; |
103 | 103 | } |
104 | - $fileName .= '.'.pathinfo($parameters['resumableFilename'], PATHINFO_EXTENSION); |
|
104 | + $fileName .= '.'.pathinfo($parameters['resumableFilename'], PATHINFO_EXTENSION); |
|
105 | 105 | $parameters['resumableFilename'] = $fileName; |
106 | 106 | $parameters['fullUploadedFileName'] = "{$parameters['tempDir']}/{$fileName}"; |
107 | 107 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | foreach ($parameters['files'] as $file_data) { |
118 | - if ( ! self::moveUploadedPartToSeparateDir($parameters, $file_data)) { |
|
119 | - $res->messages[] = 'Does not found any uploaded chunks on with path ' . $file_data['file_path']; |
|
118 | + if (!self::moveUploadedPartToSeparateDir($parameters, $file_data)) { |
|
119 | + $res->messages[] = 'Does not found any uploaded chunks on with path '.$file_data['file_path']; |
|
120 | 120 | |
121 | 121 | return $res; |
122 | 122 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | private static function moveUploadedPartToSeparateDir(array $parameters, array $file_data): bool |
146 | 146 | { |
147 | - if ( ! file_exists($file_data['file_path'])) { |
|
147 | + if (!file_exists($file_data['file_path'])) { |
|
148 | 148 | return false; |
149 | 149 | } |
150 | 150 | $factory = new StreamFactory(); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | { |
178 | 178 | $totalFilesOnServerSize = 0; |
179 | 179 | foreach (scandir($parameters['tempDir']) as $file) { |
180 | - $totalFilesOnServerSize += filesize($parameters['tempDir'] . '/' . $file); |
|
180 | + $totalFilesOnServerSize += filesize($parameters['tempDir'].'/'.$file); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | if ($totalFilesOnServerSize >= $parameters['resumableTotalSize']) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | 'resumableTotalSize' => $parameters['resumableTotalSize'], |
190 | 190 | 'resumableTotalChunks' => $parameters['resumableTotalChunks'], |
191 | 191 | ]; |
192 | - $settings_file = "{$parameters['tempDir']}/merge_settings"; |
|
192 | + $settings_file = "{$parameters['tempDir']}/merge_settings"; |
|
193 | 193 | file_put_contents( |
194 | 194 | $settings_file, |
195 | 195 | json_encode($merge_settings, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT) |
@@ -226,22 +226,22 @@ discard block |
||
226 | 226 | $uploadDir = $di->getShared('config')->path('www.uploadDir'); |
227 | 227 | |
228 | 228 | $upload_id = $postData['id'] ?? null; |
229 | - $progress_dir = $uploadDir . '/' . $upload_id; |
|
230 | - $progress_file = $progress_dir . '/merging_progress'; |
|
229 | + $progress_dir = $uploadDir.'/'.$upload_id; |
|
230 | + $progress_file = $progress_dir.'/merging_progress'; |
|
231 | 231 | if (empty($upload_id)) { |
232 | 232 | $res->success = false; |
233 | 233 | $res->data['d_status_progress'] = '0'; |
234 | 234 | $res->data['d_status'] = 'ID_NOT_SET'; |
235 | 235 | $res->messages[] = 'Upload ID does not set'; |
236 | - } elseif ( ! file_exists($progress_file) && file_exists($progress_dir)) { |
|
236 | + } elseif (!file_exists($progress_file) && file_exists($progress_dir)) { |
|
237 | 237 | $res->success = true; |
238 | 238 | $res->data['d_status_progress'] = '0'; |
239 | 239 | $res->data['d_status'] = 'INPROGRESS'; |
240 | - } elseif ( ! file_exists($progress_dir)) { |
|
240 | + } elseif (!file_exists($progress_dir)) { |
|
241 | 241 | $res->success = false; |
242 | 242 | $res->data['d_status_progress'] = '0'; |
243 | 243 | $res->data['d_status'] = 'NOT_FOUND'; |
244 | - $res->messages[] = 'Does not found anything with path: ' . $progress_dir; |
|
244 | + $res->messages[] = 'Does not found anything with path: '.$progress_dir; |
|
245 | 245 | } elseif ('100' === file_get_contents($progress_file)) { |
246 | 246 | $res->success = true; |
247 | 247 | $res->data['d_status_progress'] = '100'; |
@@ -267,14 +267,14 @@ discard block |
||
267 | 267 | $res = new PBXApiResult(); |
268 | 268 | $res->processor = __METHOD__; |
269 | 269 | $extension = Util::getExtensionOfFile($filePath); |
270 | - if ( ! in_array($extension, ['mp3', 'wav', 'alaw'])) { |
|
270 | + if (!in_array($extension, ['mp3', 'wav', 'alaw'])) { |
|
271 | 271 | $res->success = false; |
272 | 272 | $res->messages[] = "It is forbidden to remove the file type $extension."; |
273 | 273 | |
274 | 274 | return $res; |
275 | 275 | } |
276 | 276 | |
277 | - if ( ! file_exists($filePath)) { |
|
277 | + if (!file_exists($filePath)) { |
|
278 | 278 | $res->success = true; |
279 | 279 | $res->data['message'] = "File '{$filePath}' already deleted"; |
280 | 280 | |
@@ -284,13 +284,13 @@ discard block |
||
284 | 284 | $out = []; |
285 | 285 | |
286 | 286 | $arrDeletedFiles = [ |
287 | - escapeshellarg(Util::trimExtensionForFile($filePath) . ".wav"), |
|
288 | - escapeshellarg(Util::trimExtensionForFile($filePath) . ".mp3"), |
|
289 | - escapeshellarg(Util::trimExtensionForFile($filePath) . ".alaw"), |
|
287 | + escapeshellarg(Util::trimExtensionForFile($filePath).".wav"), |
|
288 | + escapeshellarg(Util::trimExtensionForFile($filePath).".mp3"), |
|
289 | + escapeshellarg(Util::trimExtensionForFile($filePath).".alaw"), |
|
290 | 290 | ]; |
291 | 291 | |
292 | 292 | $rmPath = Util::which('rm'); |
293 | - Util::mwExec("{$rmPath} -rf " . implode(' ', $arrDeletedFiles), $out); |
|
293 | + Util::mwExec("{$rmPath} -rf ".implode(' ', $arrDeletedFiles), $out); |
|
294 | 294 | if (file_exists($filePath)) { |
295 | 295 | $res->success = false; |
296 | 296 | $res->messages = $out; |
@@ -323,13 +323,13 @@ discard block |
||
323 | 323 | $cat = Util::which('cat'); |
324 | 324 | $di = Di::getDefault(); |
325 | 325 | $dirsConfig = $di->getShared('config'); |
326 | - $filenameTmp = $dirsConfig->path('www.downloadCacheDir') . '/' . __FUNCTION__ . '_' . time() . '.conf'; |
|
326 | + $filenameTmp = $dirsConfig->path('www.downloadCacheDir').'/'.__FUNCTION__.'_'.time().'.conf'; |
|
327 | 327 | $cmd = "{$cat} {$filename} > {$filenameTmp}"; |
328 | 328 | Util::mwExec("{$cmd}; chown www:www {$filenameTmp}"); |
329 | 329 | $res->data['filename'] = $filenameTmp; |
330 | 330 | } else { |
331 | 331 | $res->success = false; |
332 | - $res->messages[] = 'No access to the file ' . $filename; |
|
332 | + $res->messages[] = 'No access to the file '.$filename; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | return $res; |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $res->success = true; |
399 | 399 | |
400 | 400 | $firmwareDirTmp = dirname($imgFileName); |
401 | - $progress_file = $firmwareDirTmp . '/progress'; |
|
401 | + $progress_file = $firmwareDirTmp.'/progress'; |
|
402 | 402 | |
403 | 403 | // Wait until download process started |
404 | 404 | $d_pid = Util::getPidOfProcess("{$firmwareDirTmp}/download_settings.json"); |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $error = trim(file_get_contents("{$firmwareDirTmp}/error")); |
411 | 411 | } |
412 | 412 | |
413 | - if ( ! file_exists($progress_file)) { |
|
413 | + if (!file_exists($progress_file)) { |
|
414 | 414 | $res->data['d_status_progress'] = '0'; |
415 | 415 | $res->messages[] = 'NOT_FOUND'; |
416 | 416 | $res->success = false; |
@@ -514,11 +514,11 @@ discard block |
||
514 | 514 | } else { |
515 | 515 | $tempDir = '/tmp'; |
516 | 516 | } |
517 | - $moduleDirTmp = $tempDir . '/' . $moduleUniqueID; |
|
518 | - $progress_file = $moduleDirTmp . '/progress'; |
|
517 | + $moduleDirTmp = $tempDir.'/'.$moduleUniqueID; |
|
518 | + $progress_file = $moduleDirTmp.'/progress'; |
|
519 | 519 | $error = ''; |
520 | - if (file_exists($moduleDirTmp . '/error')) { |
|
521 | - $error = trim(file_get_contents($moduleDirTmp . '/error')); |
|
520 | + if (file_exists($moduleDirTmp.'/error')) { |
|
521 | + $error = trim(file_get_contents($moduleDirTmp.'/error')); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | // Wait until download process started |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | usleep(500000); |
528 | 528 | } |
529 | 529 | |
530 | - if ( ! file_exists($progress_file)) { |
|
530 | + if (!file_exists($progress_file)) { |
|
531 | 531 | $res->data['d_status_progress'] = '0'; |
532 | 532 | $res->data['d_status'] = 'NOT_FOUND'; |
533 | 533 | $res->success = false; |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | $res->data['d_status'] = 'DOWNLOAD_ERROR'; |
536 | 536 | $res->data['d_status_progress'] = file_get_contents($progress_file); |
537 | 537 | $res->data['d_error'] = $error; |
538 | - $res->messages[] = file_get_contents($moduleDirTmp . '/error'); |
|
538 | + $res->messages[] = file_get_contents($moduleDirTmp.'/error'); |
|
539 | 539 | $res->success = false; |
540 | 540 | } elseif ('100' === file_get_contents($progress_file)) { |
541 | 541 | $res->data['d_status_progress'] = '100'; |
@@ -544,11 +544,11 @@ discard block |
||
544 | 544 | $res->success = true; |
545 | 545 | } else { |
546 | 546 | $res->data['d_status_progress'] = file_get_contents($progress_file); |
547 | - $d_pid = Util::getPidOfProcess($moduleDirTmp . '/download_settings.json'); |
|
547 | + $d_pid = Util::getPidOfProcess($moduleDirTmp.'/download_settings.json'); |
|
548 | 548 | if (empty($d_pid)) { |
549 | 549 | $res->data['d_status'] = 'DOWNLOAD_ERROR'; |
550 | - if (file_exists($moduleDirTmp . '/error')) { |
|
551 | - $res->messages[] = file_get_contents($moduleDirTmp . '/error'); |
|
550 | + if (file_exists($moduleDirTmp.'/error')) { |
|
551 | + $res->messages[] = file_get_contents($moduleDirTmp.'/error'); |
|
552 | 552 | } else { |
553 | 553 | $res->messages[] = "Download process interrupted at {$res->data['d_status_progress']}%"; |
554 | 554 | } |
@@ -579,13 +579,13 @@ discard block |
||
579 | 579 | $grepPath = Util::which('grep'); |
580 | 580 | $echoPath = Util::which('echo'); |
581 | 581 | $awkPath = Util::which('awk'); |
582 | - $cmd = 'f="' . $filePath . '"; p=`' . $sevenZaPath . ' l $f | ' . $grepPath . ' module.json`;if [ "$?" == "0" ]; then ' . $sevenZaPath . ' -so e -y -r $f `' . $echoPath . ' $p | ' . $awkPath . ' -F" " \'{print $6}\'`; fi'; |
|
582 | + $cmd = 'f="'.$filePath.'"; p=`'.$sevenZaPath.' l $f | '.$grepPath.' module.json`;if [ "$?" == "0" ]; then '.$sevenZaPath.' -so e -y -r $f `'.$echoPath.' $p | '.$awkPath.' -F" " \'{print $6}\'`; fi'; |
|
583 | 583 | |
584 | 584 | Util::mwExec($cmd, $out); |
585 | 585 | $settings = json_decode(implode("\n", $out), true); |
586 | 586 | |
587 | 587 | $moduleUniqueID = $settings['moduleUniqueID'] ?? null; |
588 | - if ( ! $moduleUniqueID) { |
|
588 | + if (!$moduleUniqueID) { |
|
589 | 589 | $res->messages[] = 'The" moduleUniqueID " in the module file is not described.the json or file does not exist.'; |
590 | 590 | |
591 | 591 | return $res; |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | $this->messages = []; |
115 | 115 | $this->db = $this->di->getShared('db'); |
116 | 116 | $this->config = $this->di->getShared('config'); |
117 | - $this->license = $this->di->getShared('license'); |
|
118 | - $this->moduleDir = $this->config->path('core.modulesDir') . '/' . $this->moduleUniqueID; |
|
117 | + $this->license = $this->di->getShared('license'); |
|
118 | + $this->moduleDir = $this->config->path('core.modulesDir').'/'.$this->moduleUniqueID; |
|
119 | 119 | $settings_file = "{$this->moduleDir}/module.json"; |
120 | 120 | if (file_exists($settings_file)) { |
121 | 121 | $module_settings = json_decode(file_get_contents($settings_file), true); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | - $this->messages = []; |
|
142 | + $this->messages = []; |
|
143 | 143 | |
144 | 144 | |
145 | 145 | } |
@@ -154,21 +154,21 @@ discard block |
||
154 | 154 | { |
155 | 155 | $result = true; |
156 | 156 | try { |
157 | - if ( ! $this->activateLicense()) { |
|
157 | + if (!$this->activateLicense()) { |
|
158 | 158 | $this->messages[] = 'License activate error'; |
159 | 159 | $result = false; |
160 | 160 | } |
161 | - if ( ! $this->installFiles()) { |
|
161 | + if (!$this->installFiles()) { |
|
162 | 162 | $this->messages[] = ' installFiles error'; |
163 | 163 | $result = false; |
164 | 164 | } |
165 | - if ( ! $this->installDB()) { |
|
165 | + if (!$this->installDB()) { |
|
166 | 166 | $this->messages[] = ' installDB error'; |
167 | 167 | $result = false; |
168 | 168 | } |
169 | 169 | $this->fixFilesRights(); |
170 | 170 | } catch (\Exception $exception) { |
171 | - $result = false; |
|
171 | + $result = false; |
|
172 | 172 | $this->messages[] = $exception->getMessage(); |
173 | 173 | } |
174 | 174 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | PbxExtensionUtils::createAgiBinSymlinks($this->moduleUniqueID); |
200 | 200 | |
201 | 201 | // Restore database settings |
202 | - $modulesDir = $this->config->path('core.modulesDir'); |
|
202 | + $modulesDir = $this->config->path('core.modulesDir'); |
|
203 | 203 | $backupPath = "{$modulesDir}/Backup/{$this->moduleUniqueID}"; |
204 | 204 | if (is_dir($backupPath)) { |
205 | 205 | $cpPath = Util::which('cp'); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | "{$this->moduleDir}/bin" |
223 | 223 | ]; |
224 | 224 | foreach ($dirs as $dir) { |
225 | - if(file_exists($dir) && is_dir($dir)){ |
|
225 | + if (file_exists($dir) && is_dir($dir)) { |
|
226 | 226 | // Add executable right to module's binary |
227 | 227 | Util::addExecutableRights($dir); |
228 | 228 | } |
@@ -257,16 +257,16 @@ discard block |
||
257 | 257 | { |
258 | 258 | $result = true; |
259 | 259 | try { |
260 | - if ( ! $this->unInstallDB($keepSettings)) { |
|
260 | + if (!$this->unInstallDB($keepSettings)) { |
|
261 | 261 | $this->messages[] = ' unInstallDB error'; |
262 | 262 | $result = false; |
263 | 263 | } |
264 | - if ($result && ! $this->unInstallFiles($keepSettings)) { |
|
264 | + if ($result && !$this->unInstallFiles($keepSettings)) { |
|
265 | 265 | $this->messages[] = ' unInstallFiles error'; |
266 | 266 | $result = false; |
267 | 267 | } |
268 | 268 | } catch (\Exception $exception) { |
269 | - $result = false; |
|
269 | + $result = false; |
|
270 | 270 | $this->messages[] = $exception->getMessage(); |
271 | 271 | } |
272 | 272 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | { |
315 | 315 | $cpPath = Util::which('cp'); |
316 | 316 | $rmPath = Util::which('rm'); |
317 | - $modulesDir = $this->config->path('core.modulesDir'); |
|
317 | + $modulesDir = $this->config->path('core.modulesDir'); |
|
318 | 318 | $backupPath = "{$modulesDir}/Backup/{$this->moduleUniqueID}"; |
319 | 319 | Util::mwExec("{$rmPath} -rf {$backupPath}"); |
320 | 320 | if ($keepSettings) { |
@@ -327,21 +327,21 @@ discard block |
||
327 | 327 | // IMG |
328 | 328 | $imgCacheDir = appPath('sites/admin-cabinet/assets/img/cache'); |
329 | 329 | $moduleImageCacheDir = "{$imgCacheDir}/{$this->moduleUniqueID}"; |
330 | - if (file_exists($moduleImageCacheDir)){ |
|
330 | + if (file_exists($moduleImageCacheDir)) { |
|
331 | 331 | unlink($moduleImageCacheDir); |
332 | 332 | } |
333 | 333 | |
334 | 334 | // CSS |
335 | 335 | $cssCacheDir = appPath('sites/admin-cabinet/assets/css/cache'); |
336 | 336 | $moduleCSSCacheDir = "{$cssCacheDir}/{$this->moduleUniqueID}"; |
337 | - if (file_exists($moduleCSSCacheDir)){ |
|
337 | + if (file_exists($moduleCSSCacheDir)) { |
|
338 | 338 | unlink($moduleCSSCacheDir); |
339 | 339 | } |
340 | 340 | |
341 | 341 | // JS |
342 | 342 | $jsCacheDir = appPath('sites/admin-cabinet/assets/js/cache'); |
343 | 343 | $moduleJSCacheDir = "{$jsCacheDir}/{$this->moduleUniqueID}"; |
344 | - if (file_exists($moduleJSCacheDir)){ |
|
344 | + if (file_exists($moduleJSCacheDir)) { |
|
345 | 345 | unlink($moduleJSCacheDir); |
346 | 346 | } |
347 | 347 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | $module = PbxExtensionModules::findFirstByUniqid($this->moduleUniqueID); |
378 | - if ( ! $module) { |
|
378 | + if (!$module) { |
|
379 | 379 | $module = new PbxExtensionModules(); |
380 | 380 | $module->name = $this->locString("Breadcrumb{$this->moduleUniqueID}"); |
381 | 381 | $module->disabled = '1'; |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $language = substr(PbxSettings::getValueByKey('WebAdminLanguage'), 0, 2); |
402 | 402 | $translates = []; |
403 | 403 | $extensionsTranslates = [[]]; |
404 | - $results = glob($this->moduleDir . '/{Messages}/en.php', GLOB_BRACE); |
|
404 | + $results = glob($this->moduleDir.'/{Messages}/en.php', GLOB_BRACE); |
|
405 | 405 | foreach ($results as $path) { |
406 | 406 | $langArr = require $path; |
407 | 407 | if (is_array($langArr)) { |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | } |
414 | 414 | if ($language !== 'en') { |
415 | 415 | $additionalTranslates = [[]]; |
416 | - $results = glob($this->moduleDir . "/{Messages}/{$language}.php", GLOB_BRACE); |
|
416 | + $results = glob($this->moduleDir."/{Messages}/{$language}.php", GLOB_BRACE); |
|
417 | 417 | foreach ($results as $path) { |
418 | 418 | $langArr = require $path; |
419 | 419 | if (is_array($langArr)) { |
@@ -444,13 +444,13 @@ discard block |
||
444 | 444 | // Add new connection for this module after add new Models folder |
445 | 445 | RegisterDIServices::recreateModulesDBConnections(); |
446 | 446 | |
447 | - $results = glob($this->moduleDir . '/Models/*.php', GLOB_NOSORT); |
|
447 | + $results = glob($this->moduleDir.'/Models/*.php', GLOB_NOSORT); |
|
448 | 448 | $dbUpgrade = new UpdateDatabase(); |
449 | 449 | foreach ($results as $file) { |
450 | 450 | $className = pathinfo($file)['filename']; |
451 | 451 | $moduleModelClass = "\\Modules\\{$this->moduleUniqueID}\\Models\\{$className}"; |
452 | 452 | $upgradeResult = $dbUpgrade->createUpdateDbTableByAnnotations($moduleModelClass); |
453 | - if (!$upgradeResult){ |
|
453 | + if (!$upgradeResult) { |
|
454 | 454 | return false; |
455 | 455 | } |
456 | 456 | |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | $menuSettings = new PbxSettings(); |
477 | 477 | $menuSettings->key = $menuSettingsKey; |
478 | 478 | } |
479 | - $value = [ |
|
479 | + $value = [ |
|
480 | 480 | 'uniqid' => $this->moduleUniqueID, |
481 | 481 | 'href' => "/admin-cabinet/{$unCamelizedControllerName}", |
482 | 482 | 'group' => 'modules', |
@@ -377,13 +377,13 @@ discard block |
||
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 |
||
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 |
||
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); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return; |
91 | 91 | } |
92 | 92 | $max_size = 2; |
93 | - $log_dir = System::getLogDir() . '/asterisk/'; |
|
93 | + $log_dir = System::getLogDir().'/asterisk/'; |
|
94 | 94 | $text_config = "{$log_dir}{$f_name} { |
95 | 95 | nocreate |
96 | 96 | nocopytruncate |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | {$asteriskPath} -rx 'logger reload' > /dev/null 2> /dev/null |
106 | 106 | endscript |
107 | 107 | }"; |
108 | - $varEtcDir = $di->getShared('config')->path('core.varEtcDir'); |
|
109 | - $path_conf = $varEtcDir . '/asterisk_logrotate_' . $f_name . '.conf'; |
|
108 | + $varEtcDir = $di->getShared('config')->path('core.varEtcDir'); |
|
109 | + $path_conf = $varEtcDir.'/asterisk_logrotate_'.$f_name.'.conf'; |
|
110 | 110 | file_put_contents($path_conf, $text_config); |
111 | 111 | $mb10 = $max_size * 1024 * 1024; |
112 | 112 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | public static function checkCodec($name, $desc, $type): void |
204 | 204 | { |
205 | - $codec = Codecs::findFirst('name="' . $name . '"'); |
|
205 | + $codec = Codecs::findFirst('name="'.$name.'"'); |
|
206 | 206 | if ($codec === null) { |
207 | 207 | /** @var \MikoPBX\Common\Models\Codecs $codec_g722 */ |
208 | 208 | $codec = new Codecs(); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public static function sipReload():void |
220 | 220 | { |
221 | - $di = Di::getDefault(); |
|
221 | + $di = Di::getDefault(); |
|
222 | 222 | if ($di === null) { |
223 | 223 | return; |
224 | 224 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | Util::mwExec("{$asteriskPath} -rx 'module reload acl'"); |
235 | 235 | Util::mwExec("{$asteriskPath} -rx 'core reload'"); |
236 | 236 | } else { |
237 | - Util::sysLogMsg('SIP RELOAD', 'Need reload asterisk',LOG_INFO, LOG_INFO); |
|
237 | + Util::sysLogMsg('SIP RELOAD', 'Need reload asterisk', LOG_INFO, LOG_INFO); |
|
238 | 238 | // Завершаем каналы. |
239 | 239 | Util::mwExec("{$asteriskPath} -rx 'channel request hangup all'"); |
240 | 240 | usleep(500000); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public static function iaxReload(): void |
249 | 249 | { |
250 | - $iax = new IAXConf(); |
|
250 | + $iax = new IAXConf(); |
|
251 | 251 | $iax->generateConfig(); |
252 | 252 | $asteriskPath = Util::which('asterisk'); |
253 | 253 | Util::mwExec("{$asteriskPath} -rx 'iax2 reload'"); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | 'result' => 'ERROR', |
305 | 305 | ]; |
306 | 306 | |
307 | - if ( ! $this->di->getShared('registry')->booting) { |
|
307 | + if (!$this->di->getShared('registry')->booting) { |
|
308 | 308 | $this->stop(); |
309 | 309 | } |
310 | 310 | /** |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | // Создание базы данных истории звонков. |
321 | 321 | /** @var \Phalcon\Db\Adapter\Pdo\Sqlite $connection */ |
322 | 322 | $connection = $this->di->get('dbCDR'); |
323 | - if ( ! $connection->tableExists('cdr')) { |
|
323 | + if (!$connection->tableExists('cdr')) { |
|
324 | 324 | RegisterDIServices::recreateDBConnections(); |
325 | 325 | } else { |
326 | 326 | CdrDb::checkDb(); |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | $conf .= $this->generateProvidersPj(); |
56 | 56 | $conf .= $this->generatePeersPj(); |
57 | 57 | |
58 | - Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/pjsip.conf', $conf); |
|
58 | + Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/pjsip.conf', $conf); |
|
59 | 59 | $pjConf = '[log_mappings]'."\n". |
60 | 60 | 'type=log_mappings'."\n". |
61 | 61 | 'asterisk_error = 0'."\n". |
62 | 62 | 'asterisk_warning = 2'."\n". |
63 | 63 | 'asterisk_debug = 1,3,4,5,6'."\n\n"; |
64 | 64 | |
65 | - file_put_contents($this->config->path('asterisk.astetcdir') . '/pjproject.conf', $pjConf); |
|
66 | - file_put_contents($this->config->path('asterisk.astetcdir') . '/sorcery.conf', ''); |
|
65 | + file_put_contents($this->config->path('asterisk.astetcdir').'/pjproject.conf', $pjConf); |
|
66 | + file_put_contents($this->config->path('asterisk.astetcdir').'/sorcery.conf', ''); |
|
67 | 67 | |
68 | 68 | $db = new AstDB(); |
69 | 69 | foreach ($this->data_peers as $peer) { |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | */ |
85 | 85 | private function generateGeneralPj(): string |
86 | 86 | { |
87 | - $lang = $this->generalSettings['PBXLanguage']; |
|
87 | + $lang = $this->generalSettings['PBXLanguage']; |
|
88 | 88 | [$topology, $extipaddr, $exthostname, $subnets] = $this->getTopologyData(); |
89 | 89 | |
90 | 90 | $codecs = $this->getCodecs(); |
91 | 91 | $codecConf = ''; |
92 | - foreach ($codecs as $codec){ |
|
93 | - $codecConf.= "allow = {$codec}\n"; |
|
92 | + foreach ($codecs as $codec) { |
|
93 | + $codecConf .= "allow = {$codec}\n"; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $pbxVersion = PbxSettings::getValueByKey('PBXVersion'); |
@@ -99,50 +99,50 @@ discard block |
||
99 | 99 | foreach ($subnets as $net) { |
100 | 100 | $natConf .= "local_net={$net}\n"; |
101 | 101 | } |
102 | - if ( ! empty($exthostname)) { |
|
102 | + if (!empty($exthostname)) { |
|
103 | 103 | $parts = explode(':', $exthostname); |
104 | - $natConf .= 'external_media_address=' . $parts[0] . "\n"; |
|
105 | - $natConf .= 'external_signaling_address=' . $parts[0] . "\n"; |
|
106 | - $natConf .= 'external_signaling_port=' . ($parts[1] ?? '5060'); |
|
107 | - } elseif ( ! empty($extipaddr)) { |
|
104 | + $natConf .= 'external_media_address='.$parts[0]."\n"; |
|
105 | + $natConf .= 'external_signaling_address='.$parts[0]."\n"; |
|
106 | + $natConf .= 'external_signaling_port='.($parts[1] ?? '5060'); |
|
107 | + } elseif (!empty($extipaddr)) { |
|
108 | 108 | $parts = explode(':', $extipaddr); |
109 | - $natConf .= 'external_media_address=' . $parts[0] . "\n"; |
|
110 | - $natConf .= 'external_signaling_address=' . $parts[0] . "\n"; |
|
111 | - $natConf .= 'external_signaling_port=' . ($parts[1] ?? '5060'); |
|
109 | + $natConf .= 'external_media_address='.$parts[0]."\n"; |
|
110 | + $natConf .= 'external_signaling_address='.$parts[0]."\n"; |
|
111 | + $natConf .= 'external_signaling_port='.($parts[1] ?? '5060'); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - $conf = "[general] \n" . |
|
116 | - "disable_multi_domain=on\n" . |
|
117 | - "transport = udp \n\n" . |
|
115 | + $conf = "[general] \n". |
|
116 | + "disable_multi_domain=on\n". |
|
117 | + "transport = udp \n\n". |
|
118 | 118 | |
119 | - "[global] \n" . |
|
120 | - "type = global\n" . |
|
121 | - "endpoint_identifier_order=username,ip,anonymous\n" . |
|
122 | - "user_agent = mikopbx-{$pbxVersion}\n\n" . |
|
119 | + "[global] \n". |
|
120 | + "type = global\n". |
|
121 | + "endpoint_identifier_order=username,ip,anonymous\n". |
|
122 | + "user_agent = mikopbx-{$pbxVersion}\n\n". |
|
123 | 123 | |
124 | - "[anonymous]\n" . |
|
125 | - "type = endpoint\n" . |
|
124 | + "[anonymous]\n". |
|
125 | + "type = endpoint\n". |
|
126 | 126 | $codecConf. |
127 | 127 | "language={$lang}\n". |
128 | - "timers = no\n" . |
|
128 | + "timers = no\n". |
|
129 | 129 | "context = public-direct-dial\n\n". |
130 | 130 | |
131 | - "[transport-udp]\n" . |
|
132 | - "type = transport\n" . |
|
133 | - "protocol = udp\n" . |
|
131 | + "[transport-udp]\n". |
|
132 | + "type = transport\n". |
|
133 | + "protocol = udp\n". |
|
134 | 134 | "bind=0.0.0.0:{$this->generalSettings['SIPPort']}\n". |
135 | 135 | "{$natConf}\n\n". |
136 | 136 | |
137 | - "[transport-tcp]\n" . |
|
138 | - "type = transport\n" . |
|
139 | - "protocol = tcp\n" . |
|
137 | + "[transport-tcp]\n". |
|
138 | + "type = transport\n". |
|
139 | + "protocol = tcp\n". |
|
140 | 140 | "bind=0.0.0.0:{$this->generalSettings['SIPPort']}\n". |
141 | 141 | "{$natConf}\n\n". |
142 | 142 | ''; |
143 | 143 | |
144 | 144 | $varEtcDir = $this->config->path('core.varEtcDir'); |
145 | - file_put_contents($varEtcDir . '/topology_hash', md5($topology . $exthostname . $extipaddr. $this->generalSettings['SIPPort'])); |
|
145 | + file_put_contents($varEtcDir.'/topology_hash', md5($topology.$exthostname.$extipaddr.$this->generalSettings['SIPPort'])); |
|
146 | 146 | $conf .= "\n"; |
147 | 147 | |
148 | 148 | return $conf; |
@@ -154,19 +154,19 @@ discard block |
||
154 | 154 | * @return bool |
155 | 155 | */ |
156 | 156 | public function needAsteriskRestart():bool{ |
157 | - $di = Di::getDefault(); |
|
157 | + $di = Di::getDefault(); |
|
158 | 158 | if ($di === null) { |
159 | 159 | return false; |
160 | 160 | } |
161 | - $mikoPBXConfig = new MikoPBXConfig(); |
|
161 | + $mikoPBXConfig = new MikoPBXConfig(); |
|
162 | 162 | [$topology, $extipaddr, $exthostname] = $this->getTopologyData(); |
163 | 163 | |
164 | 164 | $generalSettings = $mikoPBXConfig->getGeneralSettings(); |
165 | - $now_hadh = md5($topology . $exthostname . $extipaddr. $generalSettings['SIPPort']); |
|
166 | - $old_hash = ''; |
|
165 | + $now_hadh = md5($topology.$exthostname.$extipaddr.$generalSettings['SIPPort']); |
|
166 | + $old_hash = ''; |
|
167 | 167 | $varEtcDir = $di->getShared('config')->path('core.varEtcDir'); |
168 | - if (file_exists($varEtcDir . '/topology_hash')) { |
|
169 | - $old_hash = file_get_contents($varEtcDir . '/topology_hash'); |
|
168 | + if (file_exists($varEtcDir.'/topology_hash')) { |
|
169 | + $old_hash = file_get_contents($varEtcDir.'/topology_hash'); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return $old_hash !== $now_hadh; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | continue; |
190 | 190 | } |
191 | 191 | $sub = new SubnetCalculator($lan_config['ipaddr'], $lan_config['subnet']); |
192 | - $net = $sub->getNetworkPortion() . '/' . $lan_config['subnet']; |
|
192 | + $net = $sub->getNetworkPortion().'/'.$lan_config['subnet']; |
|
193 | 193 | if ($if_data['topology'] === 'private' && in_array($net, $subnets, true) === false) { |
194 | 194 | $subnets[] = $net; |
195 | 195 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $conf = ''; |
228 | 228 | $reg_strings = ''; |
229 | 229 | $prov_config = ''; |
230 | - if ($this->data_providers===null){ |
|
230 | + if ($this->data_providers === null) { |
|
231 | 231 | $this->getSettings(); |
232 | 232 | } |
233 | 233 | foreach ($this->data_providers as $provider) { |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | $need_register = $provider['noregister'] !== '1'; |
238 | 238 | if ($need_register) { |
239 | - $options = [ |
|
239 | + $options = [ |
|
240 | 240 | 'type' => 'auth', |
241 | 241 | 'username' => $provider['username'], |
242 | 242 | 'password' => $provider['secret'], |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $reg_strings .= "[REG-AUTH-{$provider['uniqid']}]\n"; |
245 | 245 | $reg_strings .= Util::overrideConfigurationArray($options, $manual_attributes, 'registration-auth'); |
246 | 246 | |
247 | - $options = [ |
|
247 | + $options = [ |
|
248 | 248 | 'type' => 'registration', |
249 | 249 | // 'transport' => 'transport-udp', |
250 | 250 | 'outbound_auth' => "REG-AUTH-{$provider['uniqid']}", |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | if ('1' !== $provider['receive_calls_without_auth']) { |
265 | - $options = [ |
|
265 | + $options = [ |
|
266 | 266 | 'type' => 'auth', |
267 | 267 | 'username' => $provider['username'], |
268 | 268 | 'password' => $provider['secret'], |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | $defaultuser = (trim($provider['defaultuser']) === '') ? $provider['username'] : $provider['defaultuser']; |
275 | - if ( ! empty($defaultuser) && '1' !== $provider['receive_calls_without_auth']) { |
|
275 | + if (!empty($defaultuser) && '1' !== $provider['receive_calls_without_auth']) { |
|
276 | 276 | $contact = "sip:$defaultuser@{$provider['host']}:{$port}"; |
277 | 277 | } else { |
278 | 278 | $contact = "sip:{$provider['host']}:{$port}"; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | 'minimum_expiration' => $this->generalSettings['SIPMinExpiry'], |
287 | 287 | 'default_expiration' => $this->generalSettings['SIPDefaultExpiry'], |
288 | 288 | ]; |
289 | - if($provider['qualify'] === '1'){ |
|
289 | + if ($provider['qualify'] === '1') { |
|
290 | 290 | $options['qualify_frequency'] = $provider['qualifyfreq']; |
291 | 291 | $options['qualify_timeout'] = '3.0'; |
292 | 292 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | $prov_config .= "[{$provider['uniqid']}]\n"; |
295 | 295 | $prov_config .= Util::overrideConfigurationArray($options, $manual_attributes, 'aor'); |
296 | 296 | |
297 | - $options = [ |
|
297 | + $options = [ |
|
298 | 298 | 'type' => 'identify', |
299 | 299 | 'endpoint' => $provider['uniqid'], |
300 | 300 | 'match' => $provider['host'], |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | */ |
356 | 356 | public function generatePeersPj(): string |
357 | 357 | { |
358 | - if ($this->data_peers===null){ |
|
358 | + if ($this->data_peers === null) { |
|
359 | 359 | $this->getSettings(); |
360 | 360 | } |
361 | 361 | $lang = $this->generalSettings['PBXLanguage']; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $language = (trim($language) === '') ? 'en-en' : $language; |
370 | 370 | |
371 | 371 | $calleridname = (trim($peer['calleridname']) === '') ? $peer['extension'] : $peer['calleridname']; |
372 | - $busylevel = (trim($peer['busylevel']) === '') ? '1' : '' . $peer['busylevel']; |
|
372 | + $busylevel = (trim($peer['busylevel']) === '') ? '1' : ''.$peer['busylevel']; |
|
373 | 373 | |
374 | 374 | $options = [ |
375 | 375 | 'type' => 'auth', |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | 'conditions'=>'disabled="0"', |
522 | 522 | 'order' => 'type, priority', |
523 | 523 | ]; |
524 | - $codecs = Codecs::find($filter); |
|
524 | + $codecs = Codecs::find($filter); |
|
525 | 525 | foreach ($codecs as $codec_data) { |
526 | 526 | $arr_codecs[] = $codec_data->name; |
527 | 527 | } |
@@ -551,8 +551,8 @@ discard block |
||
551 | 551 | // Получим используемые кодеки. |
552 | 552 | $arr_data['codecs'] = $this->getCodecs(); |
553 | 553 | |
554 | - $context_id = preg_replace("/[^a-z\d]/iu", '', $sip_peer->host . $sip_peer->port); |
|
555 | - if ( ! isset($this->contexts_data[$context_id])) { |
|
554 | + $context_id = preg_replace("/[^a-z\d]/iu", '', $sip_peer->host.$sip_peer->port); |
|
555 | + if (!isset($this->contexts_data[$context_id])) { |
|
556 | 556 | $this->contexts_data[$context_id] = []; |
557 | 557 | } |
558 | 558 | $this->contexts_data[$context_id][$sip_peer->uniqid] = $sip_peer->username; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | */ |
572 | 572 | private function getOutRoutes(): array |
573 | 573 | { |
574 | - if ($this->data_peers===null){ |
|
574 | + if ($this->data_peers === null) { |
|
575 | 575 | $this->getSettings(); |
576 | 576 | } |
577 | 577 | /** @var \MikoPBX\Common\Models\OutgoingRoutingTable $rout */ |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | */ |
607 | 607 | public function extensionGenContexts(): string |
608 | 608 | { |
609 | - if ($this->data_peers===null){ |
|
609 | + if ($this->data_peers === null) { |
|
610 | 610 | $this->getSettings(); |
611 | 611 | } |
612 | 612 | // Генерация внутреннего номерного плана. |
@@ -624,8 +624,8 @@ discard block |
||
624 | 624 | $contexts_data = $this->contexts_data[$provider['context_id']]; |
625 | 625 | if (count($contexts_data) === 1) { |
626 | 626 | $conf .= ExtensionsConf::generateIncomingContextPeers($provider['uniqid'], $provider['username'], ''); |
627 | - } elseif ( ! in_array($provider['context_id'], $contexts, true)) { |
|
628 | - $conf .= ExtensionsConf::generateIncomingContextPeers( |
|
627 | + } elseif (!in_array($provider['context_id'], $contexts, true)) { |
|
628 | + $conf .= ExtensionsConf::generateIncomingContextPeers( |
|
629 | 629 | $contexts_data, |
630 | 630 | null, |
631 | 631 | $provider['context_id'] |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | */ |
645 | 645 | public function extensionGenHints(): string |
646 | 646 | { |
647 | - if ($this->data_peers===null){ |
|
647 | + if ($this->data_peers === null) { |
|
648 | 648 | $this->getSettings(); |
649 | 649 | } |
650 | 650 | $conf = ''; |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | |
658 | 658 | public function extensionGenInternal(): string |
659 | 659 | { |
660 | - if ($this->data_peers===null){ |
|
660 | + if ($this->data_peers === null) { |
|
661 | 661 | $this->getSettings(); |
662 | 662 | } |
663 | 663 | // Генерация внутреннего номерного плана. |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | |
673 | 673 | public function extensionGenInternalTransfer(): string |
674 | 674 | { |
675 | - if ($this->data_peers===null){ |
|
675 | + if ($this->data_peers === null) { |
|
676 | 676 | $this->getSettings(); |
677 | 677 | } |
678 | 678 | // Генерация внутреннего номерного плана. |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public const SELECT_CDR_TUBE = 'select_cdr_tube'; |
25 | 25 | public const UPDATE_CDR_TUBE = 'update_cdr_tube'; |
26 | - protected int $maxProc=1; |
|
26 | + protected int $maxProc = 1; |
|
27 | 27 | |
28 | 28 | |
29 | 29 | private BeanstalkClient $client_queue; |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | $result = json_decode($result_data, true); |
94 | 94 | if (file_exists($result)) { |
95 | 95 | $file_data = json_decode(file_get_contents($result), true); |
96 | - if(!is_dir($result)){ |
|
96 | + if (!is_dir($result)) { |
|
97 | 97 | Util::mwExec("rm -rf {$result}"); |
98 | 98 | } |
99 | 99 | $result = $file_data; |
100 | 100 | } |
101 | - if ( ! is_array($result) && ! is_object($result)) { |
|
101 | + if (!is_array($result) && !is_object($result)) { |
|
102 | 102 | return; |
103 | 103 | } |
104 | 104 | if (count($result) < 1) { |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | if (trim($row['recordingfile']) !== '') { |
116 | 116 | // Если каналов не существует с ID, то можно удалить временные файлы. |
117 | 117 | $p_info = pathinfo($row['recordingfile']); |
118 | - $fname = $p_info['dirname'] . '/' . $p_info['filename'] . '.wav'; |
|
118 | + $fname = $p_info['dirname'].'/'.$p_info['filename'].'.wav'; |
|
119 | 119 | if (file_exists($fname) && !is_dir($fname)) { |
120 | 120 | Util::mwExec("rm -rf {$fname}"); |
121 | 121 | } |
@@ -139,19 +139,19 @@ discard block |
||
139 | 139 | $row['answer'] = ''; |
140 | 140 | $billsec = 0; |
141 | 141 | |
142 | - if ( ! empty($row['recordingfile'])) { |
|
142 | + if (!empty($row['recordingfile'])) { |
|
143 | 143 | $p_info = pathinfo($row['recordingfile']); |
144 | 144 | $file_list = [ |
145 | - $p_info['dirname'] . '/' . $p_info['filename'] . '.mp3', |
|
146 | - $p_info['dirname'] . '/' . $p_info['filename'] . '.wav', |
|
147 | - $p_info['dirname'] . '/' . $p_info['filename'] . '_in.wav', |
|
148 | - $p_info['dirname'] . '/' . $p_info['filename'] . '_out.wav', |
|
145 | + $p_info['dirname'].'/'.$p_info['filename'].'.mp3', |
|
146 | + $p_info['dirname'].'/'.$p_info['filename'].'.wav', |
|
147 | + $p_info['dirname'].'/'.$p_info['filename'].'_in.wav', |
|
148 | + $p_info['dirname'].'/'.$p_info['filename'].'_out.wav', |
|
149 | 149 | ]; |
150 | 150 | foreach ($file_list as $file) { |
151 | - if ( ! file_exists($file)) { |
|
151 | + if (!file_exists($file)) { |
|
152 | 152 | continue; |
153 | 153 | } |
154 | - if(!is_dir($file)){ |
|
154 | + if (!is_dir($file)) { |
|
155 | 155 | Util::mwExec("rm -rf {$file}"); |
156 | 156 | } |
157 | 157 | } |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | if (file_exists($row['recordingfile']) && !is_dir($row['recordingfile'])) { |
163 | 163 | Util::mwExec("rm -rf {$row['recordingfile']}"); |
164 | 164 | } |
165 | - } elseif ( ! empty($row['recordingfile']) && |
|
166 | - ! file_exists(Util::trimExtensionForFile($row['recordingfile']) . 'wav') && |
|
167 | - ! file_exists( $row['recordingfile']) ) { |
|
165 | + } elseif (!empty($row['recordingfile']) && |
|
166 | + !file_exists(Util::trimExtensionForFile($row['recordingfile']).'wav') && |
|
167 | + !file_exists($row['recordingfile'])) { |
|
168 | 168 | /** @var CallDetailRecordsTmp $rec_data */ |
169 | 169 | $rec_data = CallDetailRecordsTmp::findFirst( |
170 | 170 | "linkedid='{$row['linkedid']}' AND dst_chan='{$row['dst_chan']}'" |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | private function getActiveIdChannels(): array |
215 | 215 | { |
216 | - $am = Util::getAstManager('off'); |
|
216 | + $am = Util::getAstManager('off'); |
|
217 | 217 | return $am->GetChannels(true); |
218 | 218 | } |
219 | 219 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $this->no_answered_calls[$row['linkedid']]['NOANSWER'] = false; |
229 | 229 | return; |
230 | 230 | } |
231 | - if ( ! array_key_exists($row['dst_num'], $this->internal_numbers)) { |
|
231 | + if (!array_key_exists($row['dst_num'], $this->internal_numbers)) { |
|
232 | 232 | // dst_num - не является номером сотрудника. Это исходящий. |
233 | 233 | return; |
234 | 234 | } |