@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | 'slin' => 'Signed Linear PCM', |
| 85 | 85 | 'opus' => 'Opus', |
| 86 | 86 | ]; |
| 87 | - $codecs = Codecs::find(); |
|
| 87 | + $codecs = Codecs::find(); |
|
| 88 | 88 | // Удалим лишние кодеки |
| 89 | 89 | /** @var Codecs $codec */ |
| 90 | 90 | foreach ($codecs as $codec) { |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | $this->checkDisabledCodec($codec); |
| 93 | 93 | continue; |
| 94 | 94 | } |
| 95 | - if ( ! $codec->delete()) { |
|
| 95 | + if (!$codec->delete()) { |
|
| 96 | 96 | Util::sysLogMsg( |
| 97 | 97 | __CLASS__, |
| 98 | - 'Can not delete codec ' . $codec->name . ' from MikoPBX\Common\Models\Codecs' |
|
| 98 | + 'Can not delete codec '.$codec->name.' from MikoPBX\Common\Models\Codecs' |
|
| 99 | 99 | ); |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | private function checkDisabledCodec(Codecs $codec): void |
| 112 | 112 | { |
| 113 | - if ( ! in_array($codec->disabled, ['0', '1'], true)) { |
|
| 113 | + if (!in_array($codec->disabled, ['0', '1'], true)) { |
|
| 114 | 114 | $codec->disabled = '0'; |
| 115 | 115 | $codec->save(); |
| 116 | 116 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | private function addNewCodecs(array $availCodecs): void |
| 125 | 125 | { |
| 126 | 126 | foreach ($availCodecs as $availCodec => $desc) { |
| 127 | - $codecData = Codecs::findFirst('name="' . $availCodec . '"'); |
|
| 127 | + $codecData = Codecs::findFirst('name="'.$availCodec.'"'); |
|
| 128 | 128 | if ($codecData === null) { |
| 129 | 129 | $codecData = new Codecs(); |
| 130 | 130 | } elseif ($codecData->description === $desc) { |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | $codecData->type = $type; |
| 141 | 141 | $codecData->description = $desc; |
| 142 | - if ( ! $codecData->save()) { |
|
| 142 | + if (!$codecData->save()) { |
|
| 143 | 143 | Util::sysLogMsg( |
| 144 | 144 | __CLASS__, |
| 145 | - 'Can not update codec info ' . $codecData->name . ' from \MikoPBX\Common\Models\Codecs' |
|
| 145 | + 'Can not update codec info '.$codecData->name.' from \MikoPBX\Common\Models\Codecs' |
|
| 146 | 146 | ); |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | $astDbPath = $this->config->path('astDatabase.dbfile'); |
| 195 | 195 | if (file_exists($astDbPath)) { |
| 196 | 196 | $table = 'astdb'; |
| 197 | - $sql = 'DELETE FROM ' . $table . ' WHERE key LIKE "/DND/SIP%" OR key LIKE "/CF/SIP%" OR key LIKE "/UserBuddyStatus/SIP%"'; |
|
| 197 | + $sql = 'DELETE FROM '.$table.' WHERE key LIKE "/DND/SIP%" OR key LIKE "/CF/SIP%" OR key LIKE "/UserBuddyStatus/SIP%"'; |
|
| 198 | 198 | $db = new SQLite3($astDbPath); |
| 199 | 199 | try { |
| 200 | 200 | $db->exec($sql); |
| 201 | 201 | } catch (Throwable $e) { |
| 202 | - Util::sysLogMsg(__CLASS__, 'Can clean astdb from UserBuddyStatus...' . $e->getMessage()); |
|
| 202 | + Util::sysLogMsg(__CLASS__, 'Can clean astdb from UserBuddyStatus...'.$e->getMessage()); |
|
| 203 | 203 | sleep(2); |
| 204 | 204 | } |
| 205 | 205 | $db->close(); |
@@ -212,12 +212,12 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | private function copyMohFilesToStorage(): void |
| 214 | 214 | { |
| 215 | - $oldMohDir = $this->config->path('asterisk.astvarlibdir') . '/sounds/moh'; |
|
| 216 | - if ( ! file_exists($oldMohDir)) { |
|
| 215 | + $oldMohDir = $this->config->path('asterisk.astvarlibdir').'/sounds/moh'; |
|
| 216 | + if (!file_exists($oldMohDir)) { |
|
| 217 | 217 | return; |
| 218 | 218 | } |
| 219 | 219 | $currentMohDir = $this->config->path('asterisk.mohdir'); |
| 220 | - if ( ! Util::mwMkdir($currentMohDir)) { |
|
| 220 | + if (!Util::mwMkdir($currentMohDir)) { |
|
| 221 | 221 | return; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -226,9 +226,9 @@ discard block |
||
| 226 | 226 | if (in_array($file, ['.', '..'])) { |
| 227 | 227 | continue; |
| 228 | 228 | } |
| 229 | - if (copy($oldMohDir . '/' . $file, $currentMohDir . '/' . $file)) { |
|
| 229 | + if (copy($oldMohDir.'/'.$file, $currentMohDir.'/'.$file)) { |
|
| 230 | 230 | $sound_file = new SoundFiles(); |
| 231 | - $sound_file->path = $currentMohDir . '/' . $file; |
|
| 231 | + $sound_file->path = $currentMohDir.'/'.$file; |
|
| 232 | 232 | $sound_file->category = SoundFiles::CATEGORY_MOH; |
| 233 | 233 | $sound_file->name = $file; |
| 234 | 234 | $sound_file->save(); |
@@ -292,13 +292,13 @@ discard block |
||
| 292 | 292 | Extensions::TYPE_CONFERENCE, |
| 293 | 293 | |
| 294 | 294 | ]; |
| 295 | - $parameters=[ |
|
| 295 | + $parameters = [ |
|
| 296 | 296 | 'conditions'=>'show_in_phonebook!=1 and type IN ({ids:array})', |
| 297 | 297 | 'bind' => [ |
| 298 | 298 | 'ids' => $showInPhonebookTypes, |
| 299 | 299 | ], |
| 300 | 300 | ]; |
| 301 | - $extensions = Extensions::find($parameters); |
|
| 301 | + $extensions = Extensions::find($parameters); |
|
| 302 | 302 | foreach ($extensions as $extension) { |
| 303 | 303 | if (in_array($extension->type, $showInPhonebookTypes)) { |
| 304 | 304 | $extension->show_in_phonebook = '1'; |
@@ -313,14 +313,14 @@ discard block |
||
| 313 | 313 | */ |
| 314 | 314 | private function moveReadOnlySoundsToStorage(): void |
| 315 | 315 | { |
| 316 | - $currentMediaDir = $this->config->path('asterisk.customSoundDir') . '/'; |
|
| 317 | - if ( ! is_dir($currentMediaDir)) { |
|
| 316 | + $currentMediaDir = $this->config->path('asterisk.customSoundDir').'/'; |
|
| 317 | + if (!is_dir($currentMediaDir)) { |
|
| 318 | 318 | Util::mwMkdir($currentMediaDir); |
| 319 | 319 | } |
| 320 | 320 | $soundFiles = SoundFiles::find(); |
| 321 | 321 | foreach ($soundFiles as $soundFile) { |
| 322 | 322 | if (stripos($soundFile->path, '/offload/asterisk/sounds/other/') === 0) { |
| 323 | - $newPath = $currentMediaDir . pathinfo($soundFile->path)['basename']; |
|
| 323 | + $newPath = $currentMediaDir.pathinfo($soundFile->path)['basename']; |
|
| 324 | 324 | if (copy($soundFile->path, $newPath)) { |
| 325 | 325 | $soundFile->path = $newPath; |
| 326 | 326 | $soundFile->update(); |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | file_put_contents('/etc/iptables/iptables.mikopbx', implode("\n", $arr_command)); |
| 87 | 87 | file_put_contents( |
| 88 | 88 | '/etc/iptables/iptables.mikopbx', |
| 89 | - "\n" . implode("\n", $arr_commands_custom), |
|
| 89 | + "\n".implode("\n", $arr_commands_custom), |
|
| 90 | 90 | FILE_APPEND |
| 91 | 91 | ); |
| 92 | 92 | file_put_contents( |
| 93 | 93 | '/etc/iptables/iptables.mikopbx', |
| 94 | - "\n" . $dropCommand, |
|
| 94 | + "\n".$dropCommand, |
|
| 95 | 95 | FILE_APPEND |
| 96 | 96 | ); |
| 97 | 97 | $systemctlPath = Util::which('systemctl'); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | $data_port = ''; |
| 138 | 138 | if (trim($dport) !== '') { |
| 139 | - $data_port = '--dport ' . $dport; |
|
| 139 | + $data_port = '--dport '.$dport; |
|
| 140 | 140 | } |
| 141 | 141 | $other_data = trim($other_data); |
| 142 | 142 | |
@@ -169,9 +169,9 @@ discard block |
||
| 169 | 169 | continue; |
| 170 | 170 | } |
| 171 | 171 | $other_data = "-p {$rule->protocol}"; |
| 172 | - $other_data .= ($network_filter === null) ? '' : ' -s ' . $network_filter->permit; |
|
| 172 | + $other_data .= ($network_filter === null) ? '' : ' -s '.$network_filter->permit; |
|
| 173 | 173 | if ($rule->protocol === 'icmp') { |
| 174 | - $port = ''; |
|
| 174 | + $port = ''; |
|
| 175 | 175 | $other_data .= ' --icmp-type echo-request'; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } else { |
| 219 | 219 | $newRule->action = 'block'; |
| 220 | 220 | } |
| 221 | - if (key_exists($key, $currentRules[$networkFilter->id])){ |
|
| 221 | + if (key_exists($key, $currentRules[$networkFilter->id])) { |
|
| 222 | 222 | $newRule->description = $currentRules[$networkFilter->id][$key]['description']; |
| 223 | 223 | } |
| 224 | 224 | $newRule->save(); |