@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | $content = $this->getContent(); |
| 93 | 93 | $timestamp = date('c'); |
| 94 | - $hash = sha1($timestamp . $content); |
|
| 94 | + $hash = sha1($timestamp.$content); |
|
| 95 | 95 | $eTag = sha1($content); |
| 96 | 96 | |
| 97 | 97 | /** @var array $content */ |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | 'version' => '1.0', |
| 102 | 102 | ], |
| 103 | 103 | ]; |
| 104 | - $meta = [ |
|
| 104 | + $meta = [ |
|
| 105 | 105 | 'meta' => [ |
| 106 | 106 | 'timestamp' => $timestamp, |
| 107 | 107 | 'hash' => $hash, |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | /** @var \MikoPBX\Common\Models\PbxExtensionModules $modules */ |
| 110 | 110 | $modules = PbxExtensionModules::find(); |
| 111 | 111 | foreach ($modules as $module) { |
| 112 | - if ( ! is_dir("{$this->config->path('core.modulesDir')}/{$module->uniqid}")) { |
|
| 112 | + if (!is_dir("{$this->config->path('core.modulesDir')}/{$module->uniqid}")) { |
|
| 113 | 113 | $module->delete(); |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | /** @var \MikoPBX\Common\Models\Sip $peer */ |
| 126 | 126 | $peers = Sip::find('type="peer"'); |
| 127 | 127 | foreach ($peers as $peer) { |
| 128 | - $peer->secret = md5('' . time() . 'sip' . $peer->id); |
|
| 128 | + $peer->secret = md5(''.time().'sip'.$peer->id); |
|
| 129 | 129 | $peer->save(); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | /** @var \MikoPBX\Common\Models\AsteriskManagerUsers $manager */ |
| 134 | 134 | $managers = AsteriskManagerUsers::find(); |
| 135 | 135 | foreach ($managers as $manager) { |
| 136 | - $manager->secret = md5('' . time() . 'manager' . $manager->id); |
|
| 136 | + $manager->secret = md5(''.time().'manager'.$manager->id); |
|
| 137 | 137 | $manager->save(); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | /** @var \MikoPBX\Common\Models\DialplanApplications $res */ |
| 187 | 187 | $app_number = '10000100'; |
| 188 | 188 | $app_logic = base64_encode('1,Goto(voice_mail_peer,voicemail,1)'); |
| 189 | - $d_app = DialplanApplications::findFirst('extension="' . $app_number . '"'); |
|
| 189 | + $d_app = DialplanApplications::findFirst('extension="'.$app_number.'"'); |
|
| 190 | 190 | if ($d_app === null) { |
| 191 | 191 | $d_app = new DialplanApplications(); |
| 192 | 192 | $d_app->applicationlogic = $app_logic; |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $d_app->description = 'Voice Mail'; |
| 195 | 195 | $d_app->name = 'VOICEMAIL'; |
| 196 | 196 | $d_app->type = 'plaintext'; |
| 197 | - $d_app->uniqid = 'DIALPLAN-APPLICATION-' . md5(time()); |
|
| 197 | + $d_app->uniqid = 'DIALPLAN-APPLICATION-'.md5(time()); |
|
| 198 | 198 | |
| 199 | 199 | if ($d_app->save()) { |
| 200 | 200 | $extension = ExtensionsModel::findFirst("number = '{$app_number}'"); |
@@ -249,19 +249,19 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | |
| 251 | 251 | $app_number = '10003246'; |
| 252 | - $d_app = DialplanApplications::findFirst('extension="' . $app_number . '"'); |
|
| 252 | + $d_app = DialplanApplications::findFirst('extension="'.$app_number.'"'); |
|
| 253 | 253 | if ($d_app === null) { |
| 254 | - $app_text = '1,Answer()' . "\n" . |
|
| 255 | - 'n,AGI(cdr_connector.php,${ISTRANSFER}dial_answer)' . "\n" . |
|
| 256 | - 'n,Echo()' . "\n" . |
|
| 257 | - 'n,Hangup()' . "\n"; |
|
| 254 | + $app_text = '1,Answer()'."\n". |
|
| 255 | + 'n,AGI(cdr_connector.php,${ISTRANSFER}dial_answer)'."\n". |
|
| 256 | + 'n,Echo()'."\n". |
|
| 257 | + 'n,Hangup()'."\n"; |
|
| 258 | 258 | $d_app = new DialplanApplications(); |
| 259 | 259 | $d_app->applicationlogic = base64_encode($app_text); |
| 260 | 260 | $d_app->extension = $app_number; |
| 261 | 261 | $d_app->description = 'Echos audio and video back to the caller as soon as it is received. Used to test connection delay.'; |
| 262 | 262 | $d_app->name = 'Echo test'; |
| 263 | 263 | $d_app->type = 'plaintext'; |
| 264 | - $d_app->uniqid = 'DIALPLAN-APPLICATION-' . md5(time()); |
|
| 264 | + $d_app->uniqid = 'DIALPLAN-APPLICATION-'.md5(time()); |
|
| 265 | 265 | |
| 266 | 266 | if ($d_app->save()) { |
| 267 | 267 | $extension = ExtensionsModel::findFirst("number = '{$app_number}'"); |
@@ -311,34 +311,34 @@ discard block |
||
| 311 | 311 | $savedCodecs = []; |
| 312 | 312 | // Удалим лишние кодеки |
| 313 | 313 | /** @var \MikoPBX\Common\Models\Codecs $codec */ |
| 314 | - foreach ($codecs as $codec){ |
|
| 315 | - if(array_key_exists($codec->name, $availCodecs)){ |
|
| 314 | + foreach ($codecs as $codec) { |
|
| 315 | + if (array_key_exists($codec->name, $availCodecs)) { |
|
| 316 | 316 | $savedCodecs[] = $codec->name; |
| 317 | 317 | continue; |
| 318 | 318 | } |
| 319 | - if(!$codec->delete()){ |
|
| 320 | - Util::sysLogMsg(__CLASS__, 'Can not delete codec '.$codec->name. ' from MikoPBX\Common\Models\Codecs'); |
|
| 319 | + if (!$codec->delete()) { |
|
| 320 | + Util::sysLogMsg(__CLASS__, 'Can not delete codec '.$codec->name.' from MikoPBX\Common\Models\Codecs'); |
|
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - foreach ($availCodecs as $availCodec => $desc){ |
|
| 324 | + foreach ($availCodecs as $availCodec => $desc) { |
|
| 325 | 325 | $codecData = Codecs::findFirst('name="'.$availCodec.'"'); |
| 326 | 326 | if ($codecData === null) { |
| 327 | - $codecData = new Codecs(); |
|
| 328 | - }elseif($codecData->description === $desc){ |
|
| 327 | + $codecData = new Codecs(); |
|
| 328 | + }elseif ($codecData->description === $desc) { |
|
| 329 | 329 | unset($codecData); |
| 330 | 330 | continue; |
| 331 | 331 | } |
| 332 | - $codecData->name = $availCodec; |
|
| 333 | - if(substr($availCodec,0,3) === 'h26'){ |
|
| 332 | + $codecData->name = $availCodec; |
|
| 333 | + if (substr($availCodec, 0, 3) === 'h26') { |
|
| 334 | 334 | $type = 'video'; |
| 335 | - }else{ |
|
| 335 | + } else { |
|
| 336 | 336 | $type = 'audio'; |
| 337 | 337 | } |
| 338 | 338 | $codecData->type = $type; |
| 339 | 339 | $codecData->description = $desc; |
| 340 | - if(!$codecData->save()){ |
|
| 341 | - Util::sysLogMsg(__CLASS__, 'Can not update codec info '.$codec->name. ' from \MikoPBX\Common\Models\Codecs'); |
|
| 340 | + if (!$codecData->save()) { |
|
| 341 | + Util::sysLogMsg(__CLASS__, 'Can not update codec info '.$codec->name.' from \MikoPBX\Common\Models\Codecs'); |
|
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | unset($codecs); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | // Clean AstDB |
| 354 | 354 | $astDbPath = $this->config->path('astDatabase.dbfile'); |
| 355 | - if(file_exists($astDbPath)){ |
|
| 355 | + if (file_exists($astDbPath)) { |
|
| 356 | 356 | $table = 'astdb'; |
| 357 | 357 | $sql = 'DELETE FROM '.$table.' WHERE key LIKE "/DND/SIP%" OR key LIKE "/CF/SIP%" OR key LIKE "/UserBuddyStatus/SIP%"'; |
| 358 | 358 | $db = new \SQLite3($astDbPath); |
@@ -367,13 +367,13 @@ discard block |
||
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | // Add moh files to db and copy them to storage |
| 370 | - $oldMohDir = $this->config->path('asterisk.astvarlibdir') . '/sounds/moh'; |
|
| 370 | + $oldMohDir = $this->config->path('asterisk.astvarlibdir').'/sounds/moh'; |
|
| 371 | 371 | $currentMohDir = $this->config->path('asterisk.mohdir'); |
| 372 | - if ( ! Util::mwMkdir($currentMohDir)) { |
|
| 372 | + if (!Util::mwMkdir($currentMohDir)) { |
|
| 373 | 373 | return; |
| 374 | 374 | } |
| 375 | - if(!file_exists($oldMohDir)){ |
|
| 376 | - if(!file_exists('/offload/livecd')){ |
|
| 375 | + if (!file_exists($oldMohDir)) { |
|
| 376 | + if (!file_exists('/offload/livecd')) { |
|
| 377 | 377 | Util::sysLogMsg("UpdateConfigsUpToVer20202314", 'Directory sounds/moh not found', LOG_ERR); |
| 378 | 378 | } |
| 379 | 379 | return; |
@@ -383,9 +383,9 @@ discard block |
||
| 383 | 383 | if (in_array($file, ['.', '..'])) { |
| 384 | 384 | continue; |
| 385 | 385 | } |
| 386 | - if (copy($oldMohDir . '/' . $file, $currentMohDir . '/' . $file)) { |
|
| 386 | + if (copy($oldMohDir.'/'.$file, $currentMohDir.'/'.$file)) { |
|
| 387 | 387 | $sound_file = new SoundFiles(); |
| 388 | - $sound_file->path = $currentMohDir . '/' . $file; |
|
| 388 | + $sound_file->path = $currentMohDir.'/'.$file; |
|
| 389 | 389 | $sound_file->category = SoundFiles::CATEGORY_MOH; |
| 390 | 390 | $sound_file->name = $file; |
| 391 | 391 | $sound_file->save(); |
@@ -411,8 +411,8 @@ discard block |
||
| 411 | 411 | 'conditions' => 'not show_in_phonebook="1" AND is_general_user_number="1"', |
| 412 | 412 | ]; |
| 413 | 413 | $wrongRecords = Extensions::find($parameters); |
| 414 | - foreach ($wrongRecords as $extension){ |
|
| 415 | - $extension->show_in_phonebook='1'; |
|
| 414 | + foreach ($wrongRecords as $extension) { |
|
| 415 | + $extension->show_in_phonebook = '1'; |
|
| 416 | 416 | $extension->update(); |
| 417 | 417 | } |
| 418 | 418 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * Request result |
| 20 | 20 | * @var bool |
| 21 | 21 | */ |
| 22 | - public bool $success=false; |
|
| 22 | + public bool $success = false; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Array of result fields |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function __construct() |
| 50 | 50 | { |
| 51 | - $this->success= false; |
|
| 51 | + $this->success = false; |
|
| 52 | 52 | $this->data = []; |
| 53 | 53 | $this->messages = []; |
| 54 | - $this->function =''; |
|
| 54 | + $this->function = ''; |
|
| 55 | 55 | $this->processor = ''; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | $newResult = $this->$currentAdvice(); |
| 50 | - if ( ! empty($newResult)) { |
|
| 50 | + if (!empty($newResult)) { |
|
| 51 | 51 | $arrMessages[] = $newResult; |
| 52 | 52 | } |
| 53 | 53 | $this->session->set( |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $result = []; |
| 67 | 67 | foreach ($arrMessages as $message) { |
| 68 | 68 | foreach ($message as $key => $value) { |
| 69 | - if ( ! empty($value)) { |
|
| 69 | + if (!empty($value)) { |
|
| 70 | 70 | $result[$key][] = $value; |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | private function checkStorage(): array |
| 134 | 134 | { |
| 135 | - if ( ! is_array($_COOKIE) || ! array_key_exists(session_name(), $_COOKIE)) { |
|
| 135 | + if (!is_array($_COOKIE) || !array_key_exists(session_name(), $_COOKIE)) { |
|
| 136 | 136 | return []; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | if ($storageList !== null && property_exists($storageList, 'data')) { |
| 148 | 148 | $storageDiskMounted = false; |
| 149 | 149 | $disks = $storageList->data; |
| 150 | - if ( ! is_array($disks)) { |
|
| 150 | + if (!is_array($disks)) { |
|
| 151 | 151 | $disks = [$disks]; |
| 152 | 152 | } |
| 153 | 153 | foreach ($disks as $disk) { |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | private function checkRegistration(): array |
| 218 | 218 | { |
| 219 | 219 | $licKey = PbxSettings::getValueByKey('PBXLicense'); |
| 220 | - if ( ! empty($licKey)) { |
|
| 220 | + if (!empty($licKey)) { |
|
| 221 | 221 | $checkBaseFeature = $this->license->featureAvailable(33); |
| 222 | 222 | if ($checkBaseFeature['success'] === false) { |
| 223 | 223 | if ($this->language === 'ru') { |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | * |
| 91 | 91 | * @return bool результат удаления |
| 92 | 92 | */ |
| 93 | - public function unInstallFiles(bool $keepSettings = false);//: bool Пока мешает удалять и обновлять старые модули, раскоменитровать после релиза 2020.5; |
|
| 93 | + public function unInstallFiles(bool $keepSettings = false); //: bool Пока мешает удалять и обновлять старые модули, раскоменитровать после релиза 2020.5; |
|
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | 96 | * Returns error messages |