@@ -24,7 +24,7 @@ |
||
| 24 | 24 | $agi->set_variable('BLINDTRANSFER', ''); |
| 25 | 25 | |
| 26 | 26 | try { |
| 27 | - $filter = [ |
|
| 27 | + $filter = [ |
|
| 28 | 28 | '(dst_chan=:chan: OR src_chan=:chan:) AND linkedid=:linkedid:', |
| 29 | 29 | 'bind' => ['chan' => $chan, 'linkedid' => $linkedid], |
| 30 | 30 | 'limit' => 1, |
@@ -259,7 +259,8 @@ |
||
| 259 | 259 | return implode( |
| 260 | 260 | $separator, |
| 261 | 261 | array_map( |
| 262 | - function ($x) use ($format) { |
|
| 262 | + function ($x) use ($format) |
|
| 263 | + { |
|
| 263 | 264 | return sprintf($format, $x); |
| 264 | 265 | }, |
| 265 | 266 | $this->quads |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | private function validateInputs($ip, $network_size) |
| 87 | 87 | { |
| 88 | - if ( ! filter_var($ip, FILTER_VALIDATE_IP)) { |
|
| 88 | + if (!filter_var($ip, FILTER_VALIDATE_IP)) { |
|
| 89 | 89 | throw new Error("IP address $ip not valid."); |
| 90 | 90 | } |
| 91 | 91 | if (($network_size < 1) || ($network_size > 32)) { |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | public function getSubnetArrayReport() |
| 186 | 186 | { |
| 187 | 187 | return [ |
| 188 | - 'ip_address_with_network_size' => $this->getIPAddress() . '/' . $this->getNetworkSize(), |
|
| 188 | + 'ip_address_with_network_size' => $this->getIPAddress().'/'.$this->getNetworkSize(), |
|
| 189 | 189 | 'ip_address' => [ |
| 190 | 190 | 'quads' => $this->getIPAddress(), |
| 191 | 191 | 'hex' => $this->getIPAddressHex(), |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | return implode( |
| 258 | 258 | $separator, |
| 259 | 259 | array_map( |
| 260 | - function ($x) use ($format) { |
|
| 260 | + function($x) use ($format) { |
|
| 261 | 261 | return sprintf($format, $x); |
| 262 | 262 | }, |
| 263 | 263 | $this->quads |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public static function isIpAddress($ipaddr): ?bool |
| 22 | 22 | { |
| 23 | - if ( ! is_string($ipaddr)) { |
|
| 23 | + if (!is_string($ipaddr)) { |
|
| 24 | 24 | return false; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -110,10 +110,10 @@ |
||
| 110 | 110 | case'save': |
| 111 | 111 | case'modify': |
| 112 | 112 | case'*** WITHOUT ACTION ***': |
| 113 | - $title .= '|'. $this->translation->_("Breadcrumb{$this->controllerName}"); |
|
| 113 | + $title .= '|'. $this->translation->_("breadcrumb{$this->controllerName}"); |
|
| 114 | 114 | break; |
| 115 | 115 | default: |
| 116 | - $title .= '|'. $this->translation->_("Breadcrumb{$this->controllerName}{$this->actionName}"); |
|
| 116 | + $title .= '|'. $this->translation->_("breadcrumb{$this->controllerName}{$this->actionName}"); |
|
| 117 | 117 | } |
| 118 | 118 | Tag::setTitle($title); |
| 119 | 119 | $this->view->t = $this->translation; |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | case'save': |
| 106 | 106 | case'modify': |
| 107 | 107 | case'*** WITHOUT ACTION ***': |
| 108 | - $title .= '|'. $this->translation->_("Breadcrumb{$this->controllerName}"); |
|
| 108 | + $title .= '|'.$this->translation->_("Breadcrumb{$this->controllerName}"); |
|
| 109 | 109 | break; |
| 110 | 110 | default: |
| 111 | - $title .= '|'. $this->translation->_("Breadcrumb{$this->controllerName}{$this->actionName}"); |
|
| 111 | + $title .= '|'.$this->translation->_("Breadcrumb{$this->controllerName}{$this->actionName}"); |
|
| 112 | 112 | } |
| 113 | 113 | Tag::setTitle($title); |
| 114 | 114 | $this->view->t = $this->translation; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | protected function getSessionData(string $key): string |
| 150 | 150 | { |
| 151 | 151 | $roSession = $this->sessionRO; |
| 152 | - if ($roSession !== null && array_key_exists($key, $roSession) && ! empty($roSession[$key])) { |
|
| 152 | + if ($roSession !== null && array_key_exists($key, $roSession) && !empty($roSession[$key])) { |
|
| 153 | 153 | $value = $roSession[$key]; |
| 154 | 154 | } else { |
| 155 | 155 | $value = PbxSettings::getValueByKey($key); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | { |
| 227 | 227 | if ($this->request->isPost()) { |
| 228 | 228 | $data = $this->request->getPost('submitMode'); |
| 229 | - if ( ! empty($data)) { |
|
| 229 | + if (!empty($data)) { |
|
| 230 | 230 | $this->session->set('SubmitMode', $data); |
| 231 | 231 | } |
| 232 | 232 | } |
@@ -16,6 +16,6 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | function appPath(string $path = ''): string |
| 18 | 18 | { |
| 19 | - return dirname(__DIR__,3) . ($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
| 19 | + return dirname(__DIR__, 3).($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
| 20 | 20 | } |
| 21 | 21 | } |
@@ -111,7 +111,8 @@ |
||
| 111 | 111 | // Attach all created connections to one transaction manager |
| 112 | 112 | $eventsManager->attach( |
| 113 | 113 | 'db', |
| 114 | - function ($event) use ($registeredDBServices, $di) { |
|
| 114 | + function ($event) use ($registeredDBServices, $di) |
|
| 115 | + { |
|
| 115 | 116 | switch ($event->getType()) { |
| 116 | 117 | case 'beginTransaction': |
| 117 | 118 | { |
@@ -40,21 +40,21 @@ discard block |
||
| 40 | 40 | $config = $di->getShared('config'); |
| 41 | 41 | $modulesDir = $config->path('core.modulesDir'); |
| 42 | 42 | |
| 43 | - $results = glob($modulesDir . '/*/module.json', GLOB_NOSORT); |
|
| 43 | + $results = glob($modulesDir.'/*/module.json', GLOB_NOSORT); |
|
| 44 | 44 | |
| 45 | 45 | foreach ($results as $moduleJson) { |
| 46 | - $jsonString = file_get_contents($moduleJson); |
|
| 47 | - if ($jsonString === false){ |
|
| 46 | + $jsonString = file_get_contents($moduleJson); |
|
| 47 | + if ($jsonString === false) { |
|
| 48 | 48 | continue; |
| 49 | 49 | } |
| 50 | 50 | $jsonModuleDescription = json_decode($jsonString, true); |
| 51 | - if ( ! is_array($jsonModuleDescription) |
|
| 51 | + if (!is_array($jsonModuleDescription) |
|
| 52 | 52 | || !array_key_exists('moduleUniqueID', $jsonModuleDescription)) { |
| 53 | 53 | continue; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $moduleUniqueId = $jsonModuleDescription['moduleUniqueID']; |
| 57 | - if ( ! isset($moduleUniqueId)) { |
|
| 57 | + if (!isset($moduleUniqueId)) { |
|
| 58 | 58 | continue; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -74,14 +74,14 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | if ( |
| 77 | - ! class_exists($moduleModelClass) |
|
| 77 | + !class_exists($moduleModelClass) |
|
| 78 | 78 | || count(get_class_vars($moduleModelClass)) === 0) { |
| 79 | 79 | continue; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $model = new $moduleModelClass(); |
| 83 | 83 | $connectionServiceName = $model->getReadConnectionService(); |
| 84 | - if ( ! isset($connectionServiceName)) { |
|
| 84 | + if (!isset($connectionServiceName)) { |
|
| 85 | 85 | continue; |
| 86 | 86 | } |
| 87 | 87 | $registeredDBServices[] = $connectionServiceName; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | // Create and connect database |
| 93 | 93 | $dbDir = "{$config->path('core.modulesDir')}/{$moduleUniqueId}/db"; |
| 94 | - if (!file_exists($dbDir)){ |
|
| 94 | + if (!file_exists($dbDir)) { |
|
| 95 | 95 | Util::mwMkdir($dbDir, true); |
| 96 | 96 | } |
| 97 | 97 | $dbFileName = "{$dbDir}/module.db"; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | // Log |
| 101 | 101 | $logDir = "{$config->path('core.logsDir')}/$moduleUniqueId/db"; |
| 102 | 102 | $logFileName = "{$logDir}/queries.log"; |
| 103 | - if (!is_dir($logDir)){ |
|
| 103 | + if (!is_dir($logDir)) { |
|
| 104 | 104 | Util::mwMkdir($logDir, true); |
| 105 | 105 | $touchPath = Util::which('touch'); |
| 106 | 106 | Processes::mwExec("{$touchPath} {$logFileName}"); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $this->registerDBService($connectionServiceName, $di, $params); |
| 118 | 118 | |
| 119 | 119 | // if database was created, we have to apply rules |
| 120 | - if (!$dbFileExistBeforeAttachToConnection){ |
|
| 120 | + if (!$dbFileExistBeforeAttachToConnection) { |
|
| 121 | 121 | Util::addRegularWWWRights($dbDir); |
| 122 | 122 | } |
| 123 | 123 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | // Attach all created connections to one transaction manager |
| 134 | 134 | $eventsManager->attach( |
| 135 | 135 | 'db', |
| 136 | - function ($event) use ($registeredDBServices, $di) { |
|
| 136 | + function($event) use ($registeredDBServices, $di) { |
|
| 137 | 137 | switch ($event->getType()) { |
| 138 | 138 | case 'beginTransaction': |
| 139 | 139 | { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | $licKey = PbxSettings::getValueByKey('PBXLicense'); |
| 25 | 25 | if (strlen($licKey) !== 28 |
| 26 | - || ! Text::startsWith($licKey, 'MIKO-')) { |
|
| 26 | + || !Text::startsWith($licKey, 'MIKO-')) { |
|
| 27 | 27 | $this->forward('licensing/modify/pbx-extension-modules'); |
| 28 | 28 | } |
| 29 | 29 | // Очистим кеш хранилища для получения актульной информации о свободном месте |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | $options = json_decode($previousMenuSettings->value, true); |
| 78 | 78 | $this->view->form = new PbxExtensionModuleSettingsForm($previousMenuSettings, $options); |
| 79 | - $this->view->title = $this->translation->_('ext_SettingsForModule') . ' ' . $this->translation->_( |
|
| 79 | + $this->view->title = $this->translation->_('ext_SettingsForModule').' '.$this->translation->_( |
|
| 80 | 80 | "Breadcrumb$uniqid" |
| 81 | 81 | ); |
| 82 | 82 | $this->view->submitMode = null; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function saveModuleSettingsAction(): void |
| 91 | 91 | { |
| 92 | - if ( ! $this->request->isPost()) { |
|
| 92 | + if (!$this->request->isPost()) { |
|
| 93 | 93 | return; |
| 94 | 94 | } |
| 95 | 95 | $data = $this->request->getPost(); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $record = new PbxSettings(); |
| 100 | 100 | $record->key = $data['key']; |
| 101 | 101 | } |
| 102 | - $value = [ |
|
| 102 | + $value = [ |
|
| 103 | 103 | 'uniqid' => $data['uniqid'], |
| 104 | 104 | 'href' => $data['href'], |
| 105 | 105 | 'group' => $data['menu-group'], |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function modifyAction(string $uniqid): void |
| 59 | 59 | { |
| 60 | - $menuSettings = "AdditionalMenuItem{$uniqid}"; |
|
| 60 | + $menuSettings = "additionalmenuitem{$uniqid}"; |
|
| 61 | 61 | $unCamelizedControllerName = Text::uncamelize($uniqid, '-'); |
| 62 | 62 | $previousMenuSettings = PbxSettings::findFirstByKey($menuSettings); |
| 63 | 63 | $this->view->showAtMainMenu = $previousMenuSettings !== false; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | 'href' => $this->url->get($unCamelizedControllerName), |
| 70 | 70 | 'group' => '', |
| 71 | 71 | 'iconClass' => 'puzzle piece', |
| 72 | - 'caption' => "Breadcrumb$uniqid", |
|
| 72 | + 'caption' => "breadcrumb$uniqid", |
|
| 73 | 73 | 'showAtSidebar' => false, |
| 74 | 74 | ]; |
| 75 | 75 | $previousMenuSettings->value = json_encode($value); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $options = json_decode($previousMenuSettings->value, true); |
| 78 | 78 | $this->view->form = new PbxExtensionModuleSettingsForm($previousMenuSettings, $options); |
| 79 | 79 | $this->view->title = $this->translation->_('ext_SettingsForModule') . ' ' . $this->translation->_( |
| 80 | - "Breadcrumb$uniqid" |
|
| 80 | + "breadcrumb$uniqid" |
|
| 81 | 81 | ); |
| 82 | 82 | $this->view->submitMode = null; |
| 83 | 83 | $this->view->indexUrl = $unCamelizedControllerName; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $result = []; |
| 129 | 129 | $modules = PbxExtensionModules::getEnabledModulesArray(); |
| 130 | 130 | foreach ($modules as $module) { |
| 131 | - $menuSettings = "AdditionalMenuItem{$module['uniqid']}"; |
|
| 131 | + $menuSettings = "additionalmenuitem{$module['uniqid']}"; |
|
| 132 | 132 | $previousMenuSettings = PbxSettings::findFirstByKey($menuSettings); |
| 133 | 133 | if ($previousMenuSettings !== null) { |
| 134 | 134 | $result['items'][] = json_decode($previousMenuSettings->value, true); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public static function exceptionHandler($e) |
| 24 | 24 | { |
| 25 | - if ( ! empty($e)) { |
|
| 25 | + if (!empty($e)) { |
|
| 26 | 26 | // Record Error |
| 27 | 27 | self::errorHandler(0, $e->getMessage(), $e->getFile(), $e->getLine()); |
| 28 | 28 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | public static function runtimeShutdown() |
| 73 | 73 | { |
| 74 | 74 | $e = error_get_last(); |
| 75 | - if ( ! empty($e)) { |
|
| 75 | + if (!empty($e)) { |
|
| 76 | 76 | // Record Error |
| 77 | 77 | self::errorHandler($e['type'], $e['message'], $e['file'], $e['line']); |
| 78 | 78 | } |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function extensionGenInternal(): string |
| 42 | 42 | { |
| 43 | - if ($this->arrExternalPhones===null){ |
|
| 43 | + if ($this->arrExternalPhones === null) { |
|
| 44 | 44 | $this->getSettings(); |
| 45 | 45 | } |
| 46 | 46 | $conf = ''; |
| 47 | 47 | foreach ($this->arrExternalPhones as $external) { |
| 48 | - $conf .= "exten => _{$external['extension']},1,Set(EXTERNALPHONE=" . $external['dialstring'] . ")\n\t"; |
|
| 48 | + $conf .= "exten => _{$external['extension']},1,Set(EXTERNALPHONE=".$external['dialstring'].")\n\t"; |
|
| 49 | 49 | $conf .= "same => n,Goto(outgoing,{$external['dialstring']},1)\n\t"; |
| 50 | 50 | $conf .= "same => n,AGI(check_redirect.php,\${BLINDTRANSFER})\n"; |
| 51 | 51 | } |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function extensionGenInternalTransfer(): string |
| 61 | 61 | { |
| 62 | - if ($this->arrExternalPhones===null){ |
|
| 62 | + if ($this->arrExternalPhones === null) { |
|
| 63 | 63 | $this->getSettings(); |
| 64 | 64 | } |
| 65 | 65 | $conf = ''; |
| 66 | 66 | foreach ($this->arrExternalPhones as $external) { |
| 67 | - $conf .= 'exten => _' . $external['extension'] . ',1,Set(__ISTRANSFER=transfer_)' . " \n\t"; |
|
| 68 | - $conf .= 'same => n,Goto(internal,${EXTEN},1)' . " \n"; |
|
| 67 | + $conf .= 'exten => _'.$external['extension'].',1,Set(__ISTRANSFER=transfer_)'." \n\t"; |
|
| 68 | + $conf .= 'same => n,Goto(internal,${EXTEN},1)'." \n"; |
|
| 69 | 69 | } |
| 70 | 70 | $conf .= "\n"; |
| 71 | 71 | |