@@ -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 | { |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | $config = $di->getShared('config'); |
39 | 39 | $modulesDir = $config->path('core.modulesDir'); |
40 | 40 | |
41 | - $results = glob($modulesDir . '/*/module.json', GLOB_NOSORT); |
|
41 | + $results = glob($modulesDir.'/*/module.json', GLOB_NOSORT); |
|
42 | 42 | |
43 | 43 | foreach ($results as $moduleJson) { |
44 | - $jsonString = file_get_contents($moduleJson); |
|
45 | - if ($jsonString === false){ |
|
44 | + $jsonString = file_get_contents($moduleJson); |
|
45 | + if ($jsonString === false) { |
|
46 | 46 | continue; |
47 | 47 | } |
48 | 48 | $jsonModuleDescription = json_decode($jsonString, true); |
49 | - if ( ! is_array($jsonModuleDescription) |
|
49 | + if (!is_array($jsonModuleDescription) |
|
50 | 50 | || !array_key_exists('moduleUniqueID', $jsonModuleDescription)) { |
51 | 51 | continue; |
52 | 52 | } |
53 | 53 | |
54 | 54 | $moduleUniqueId = $jsonModuleDescription['moduleUniqueID']; |
55 | - if ( ! isset($moduleUniqueId)) { |
|
55 | + if (!isset($moduleUniqueId)) { |
|
56 | 56 | continue; |
57 | 57 | } |
58 | 58 | |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | if ( |
75 | - ! class_exists($moduleModelClass) |
|
75 | + !class_exists($moduleModelClass) |
|
76 | 76 | || count(get_class_vars($moduleModelClass)) === 0) { |
77 | 77 | continue; |
78 | 78 | } |
79 | 79 | |
80 | 80 | $model = new $moduleModelClass(); |
81 | 81 | $connectionServiceName = $model->getReadConnectionService(); |
82 | - if ( ! isset($connectionServiceName)) { |
|
82 | + if (!isset($connectionServiceName)) { |
|
83 | 83 | continue; |
84 | 84 | } |
85 | 85 | $registeredDBServices[] = $connectionServiceName; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | // Create and connect database |
91 | 91 | $dbDir = "{$config->path('core.modulesDir')}/{$moduleUniqueId}/db"; |
92 | - if (!file_exists($dbDir)){ |
|
92 | + if (!file_exists($dbDir)) { |
|
93 | 93 | Util::mwMkdir($dbDir, true); |
94 | 94 | } |
95 | 95 | $dbFileName = "{$dbDir}/module.db"; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | // Log |
99 | 99 | $logDir = "{$config->path('core.logsDir')}/$moduleUniqueId/db"; |
100 | 100 | $logFileName = "{$logDir}/queries.log"; |
101 | - if (!is_dir($logDir)){ |
|
101 | + if (!is_dir($logDir)) { |
|
102 | 102 | Util::mwMkdir($logDir, true); |
103 | 103 | $touchPath = Util::which('touch'); |
104 | 104 | Util::mwExec("{$touchPath} {$logFileName}"); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $this->registerDBService($connectionServiceName, $di, $params); |
116 | 116 | |
117 | 117 | // if database was created, we have to apply rules |
118 | - if (!$dbFileExistBeforeAttachToConnection){ |
|
118 | + if (!$dbFileExistBeforeAttachToConnection) { |
|
119 | 119 | Util::addRegularWWWRights($dbDir); |
120 | 120 | } |
121 | 121 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | // Attach all created connections to one transaction manager |
132 | 132 | $eventsManager->attach( |
133 | 133 | 'db', |
134 | - function ($event) use ($registeredDBServices, $di) { |
|
134 | + function($event) use ($registeredDBServices, $di) { |
|
135 | 135 | switch ($event->getType()) { |
136 | 136 | case 'beginTransaction': |
137 | 137 | { |
@@ -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; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $result = []; |
130 | 130 | $modules = PbxExtensionModules::find('disabled="0"'); |
131 | 131 | foreach ($modules as $module) { |
132 | - $menuSettings = "AdditionalMenuItem{$module->uniqid}"; |
|
132 | + $menuSettings = "additionalmenuitem{$module->uniqid}"; |
|
133 | 133 | $previousMenuSettings = PbxSettings::findFirstByKey($menuSettings); |
134 | 134 | if ($previousMenuSettings !== null) { |
135 | 135 | $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 |