diff --git a/composer.json b/composer.json
index e591aea8b..8320e42c9 100644
--- a/composer.json
+++ b/composer.json
@@ -17,6 +17,7 @@
"ext-sqlite3": "*",
"ext-zip": "*",
"ext-mailparse": "*",
+ "ext-xdebug": "*",
"filp/whoops": "^2.15.2",
"guzzlehttp/guzzle": "^7.5.3",
"malkusch/lock": "*",
@@ -31,13 +32,13 @@
"sentry/sdk": "^3.3.0"
},
"require-dev": {
- "ext-xdebug": "*",
- "roave/security-advisories": "dev-master",
+ "roave/security-advisories": "dev-master",
"phpunit/phpunit-selenium": "^9.0",
"php-webdriver/webdriver": "^1.14.0",
"browserstack/browserstack-local": "^v1.1.0",
"phpunit/phpunit": "^9.0",
- "phalcon/ide-stubs": "^5.0.0"
+ "phalcon/ide-stubs": "^5.0.0",
+ "squizlabs/php_codesniffer": "*"
},
"autoload": {
"psr-4": {
@@ -97,5 +98,8 @@
"allow-plugins": {
"php-http/discovery": true
}
+ },
+ "scripts": {
+ "phpcs": "phpcs --standard=PSR12"
}
}
diff --git a/sites/admin-cabinet/index.php b/sites/admin-cabinet/index.php
index 758431cdb..ab217dc9d 100644
--- a/sites/admin-cabinet/index.php
+++ b/sites/admin-cabinet/index.php
@@ -16,12 +16,10 @@
* You should have received a copy of the GNU General Public License along with this program.
* If not, see
', $errors));
} elseif (!$this->request->isAjax()) {
$this->flash->success($this->translation->_('ms_SuccessfulSaved'));
- if ($reloadPath!==''){
+ if ($reloadPath!=='') {
$this->forward($reloadPath);
}
}
if ($this->request->isAjax()) {
$this->view->success = $success;
- if ($reloadPath!=='' && $success){
+ if ($reloadPath!=='' && $success) {
$this->view->reload = str_replace('{id}', $entity->id, $reloadPath);
}
}
@@ -353,7 +356,7 @@ protected function saveEntity(mixed $entity, string $reloadPath=''): bool
* @param mixed $entity The entity to be deleted.
* @return bool True if the entity was successfully deleted, false otherwise.
*/
- protected function deleteEntity(mixed $entity, string $reloadPath=''): bool
+ protected function deleteEntity(mixed $entity, string $reloadPath = ''): bool
{
$success = $entity->delete();
@@ -362,14 +365,14 @@ protected function deleteEntity(mixed $entity, string $reloadPath=''): bool
$this->flash->error(implode('
', $errors));
} elseif (!$this->request->isAjax()) {
// $this->flash->success($this->translation->_('ms_SuccessfulSaved'));
- if ($reloadPath!==''){
+ if ($reloadPath!=='') {
$this->forward($reloadPath);
}
}
if ($this->request->isAjax()) {
$this->view->success = $success;
- if ($reloadPath!=='' && $success){
+ if ($reloadPath!=='' && $success) {
$this->view->reload = $reloadPath;
}
}
@@ -438,5 +441,4 @@ public static function sanitizeData(array $data, \Phalcon\Filter\FilterInterface
return $data;
}
-
}
diff --git a/src/AdminCabinet/Controllers/CallDetailRecordsController.php b/src/AdminCabinet/Controllers/CallDetailRecordsController.php
index 1c66ac2a2..a4179c5e2 100644
--- a/src/AdminCabinet/Controllers/CallDetailRecordsController.php
+++ b/src/AdminCabinet/Controllers/CallDetailRecordsController.php
@@ -231,7 +231,7 @@ private function prepareConditionsForSearchPhrases(string &$searchPhrase, array
$needCloseAnd = true;
}
if (count($matches[0]) === 1) {
- if ($extensionsLength === strlen($matches[0][0])) {
+ if ($extensionsLength == strlen($matches[0][0])) {
$parameters['conditions'] .= 'src_num = :SearchPhrase1: OR dst_num = :SearchPhrase2:';
$parameters['bind']['SearchPhrase1'] = $matches[0][0];
$parameters['bind']['SearchPhrase2'] = $matches[0][0];
@@ -245,7 +245,7 @@ private function prepareConditionsForSearchPhrases(string &$searchPhrase, array
$searchPhrase = str_replace($matches[0][0], '', $searchPhrase);
} elseif (count($matches[0]) === 2) {
- if ($extensionsLength === strlen($matches[0][0]) && $extensionsLength === strlen($matches[0][1])) {
+ if ($extensionsLength == strlen($matches[0][0]) && $extensionsLength === strlen($matches[0][1])) {
$parameters['conditions'] .= '(src_num = :SearchPhrase1: AND dst_num = :SearchPhrase2:)';
$parameters['conditions'] .= ' OR (src_num = :SearchPhrase3: AND dst_num = :SearchPhrase4:)';
$parameters['conditions'] .= ' OR (src_num = :SearchPhrase5: AND did = :SearchPhrase6:)';
@@ -258,9 +258,9 @@ private function prepareConditionsForSearchPhrases(string &$searchPhrase, array
$parameters['bind']['SearchPhrase6'] = $matches[0][0];
$parameters['bind']['SearchPhrase7'] = $matches[0][1];
$parameters['bind']['SearchPhrase8'] = $matches[0][0];
- } elseif ($extensionsLength === strlen($matches[0][0]) && $extensionsLength !== strlen(
- $matches[0][1]
- )) {
+ } elseif ($extensionsLength == strlen($matches[0][0]) && $extensionsLength !== strlen(
+ $matches[0][1]
+ )) {
$seekNumber = substr($matches[0][1], -9);
$parameters['conditions'] .= '(src_num = :SearchPhrase1: AND dst_num LIKE :SearchPhrase2:)';
$parameters['conditions'] .= ' OR (src_num LIKE :SearchPhrase3: AND dst_num = :SearchPhrase4:)';
@@ -275,8 +275,8 @@ private function prepareConditionsForSearchPhrases(string &$searchPhrase, array
$parameters['bind']['SearchPhrase7'] = "%$seekNumber%";
$parameters['bind']['SearchPhrase8'] = $matches[0][0];
} elseif ($extensionsLength !== strlen($matches[0][0]) && $extensionsLength === strlen(
- $matches[0][1]
- )) {
+ $matches[0][1]
+ )) {
$seekNumber = substr($matches[0][0], -9);
$parameters['conditions'] .= '(src_num LIKE :SearchPhrase1: AND dst_num = :SearchPhrase2:)';
$parameters['conditions'] .= ' OR (src_num = :SearchPhrase3: AND dst_num LIKE :SearchPhrase4:)';
@@ -327,10 +327,10 @@ private function prepareConditionsForSearchPhrases(string &$searchPhrase, array
*/
private function selectCDRRecordsWithFilters(array $parameters): array
{
- // Apply ACL filters to CDR query using hook method
+ // Apply ACL filters to CDR query using a hook method
PBXConfModulesProvider::hookModulesMethod(CDRConfigInterface::APPLY_ACL_FILTERS_TO_CDR_QUERY, [&$parameters]);
// Retrieve CDR records based on the filtered parameters
return CDRDatabaseProvider::getCdr($parameters);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/CallQueuesController.php b/src/AdminCabinet/Controllers/CallQueuesController.php
index 829ee27ef..a32e40688 100644
--- a/src/AdminCabinet/Controllers/CallQueuesController.php
+++ b/src/AdminCabinet/Controllers/CallQueuesController.php
@@ -1,4 +1,5 @@
queue][$record->id]=[
- 'priority'=>$record->priority,
- 'represent'=>$record->Extensions===null?'ERROR':$record->Extensions->getRepresent()
+ $callQueueMembers[$record->queue][$record->id] = [
+ 'priority' => $record->priority,
+ 'represent' => $record->Extensions === null ? 'ERROR' : $record->Extensions->getRepresent()
];
}
$records = CallQueues::find();
- $callQueuesList=[];
+ $callQueuesList = [];
foreach ($records as $record) {
$members = $callQueueMembers[$record->uniqid];
- if (is_array($members)){
+ if (is_array($members)) {
usort($members, [__CLASS__, 'sortArrayByPriority']);
} else {
$members = [];
}
- $callQueuesList[]=[
- 'uniqid'=>$record->uniqid,
- 'name'=>$record->name,
- 'extension'=>$record->extension,
- 'members'=>$members,
- 'description'=>$record->description,
+ $callQueuesList[] = [
+ 'uniqid' => $record->uniqid,
+ 'name' => $record->name,
+ 'extension' => $record->extension,
+ 'members' => $members,
+ 'description' => $record->description,
];
}
$this->view->callQueuesList = $callQueuesList;
-
}
/**
@@ -96,7 +98,7 @@ public function modifyAction(string $uniqid = ''): void
'id' => $member->id,
'number' => $member->extension,
'priority' => $member->priority,
- 'callerid' => $member->Extensions===null?'ERROR':$member->Extensions->getRepresent(),
+ 'callerid' => $member->Extensions === null ? 'ERROR' : $member->Extensions->getRepresent(),
];
}
usort($queueMembersList, [__CLASS__, 'sortArrayByPriority']);
@@ -127,15 +129,16 @@ public function modifyAction(string $uniqid = ''): void
$soundFiles = SoundFiles::find(['columns' => 'id,name,category']);
foreach ($soundFiles as $soundFile) {
- if(SoundFiles::CATEGORY_CUSTOM === $soundFile->category){
+ if (SoundFiles::CATEGORY_CUSTOM === $soundFile->category) {
$soundfilesList[$soundFile->id] = $soundFile->name;
- }else{
+ } else {
$mohSoundFilesList[$soundFile->id] = $soundFile->name;
}
}
$form = new CallQueueEditForm(
- $queue, [
+ $queue,
+ [
'extensions' => $extensionList,
'soundfiles' => $soundfilesList,
'mohSoundFiles' => $mohSoundFilesList,
@@ -157,7 +160,7 @@ public function modifyAction(string $uniqid = ''): void
*/
public function saveAction(): void
{
- if ( ! $this->request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
$this->db->begin();
@@ -178,7 +181,7 @@ public function saveAction(): void
}
// Update the extension parameters
- if ( ! $this->updateExtension($extension, $data)) {
+ if (! $this->updateExtension($extension, $data)) {
$this->view->success = false;
$this->db->rollback();
@@ -186,7 +189,7 @@ public function saveAction(): void
}
// Update the queue parameters
- if ( ! $this->updateQueue($queue, $data)) {
+ if (! $this->updateQueue($queue, $data)) {
$this->view->success = false;
$this->db->rollback();
@@ -194,7 +197,7 @@ public function saveAction(): void
}
// Update the queue members
- if ( ! $this->updateQueueMembers($data)) {
+ if (! $this->updateQueueMembers($data)) {
$this->view->success = false;
$this->db->rollback();
@@ -267,7 +270,7 @@ private function updateQueue(CallQueues $queue, array $data): bool
case "moh_sound_id":
case "redirect_to_extension_if_repeat_exceeded":
case "redirect_to_extension_if_empty":
- if ( ! array_key_exists($name, $data) || empty($data[$name])) {
+ if (! array_key_exists($name, $data) || empty($data[$name])) {
$queue->$name = null;
continue 2;
}
@@ -276,7 +279,7 @@ private function updateQueue(CallQueues $queue, array $data): bool
break;
case "timeout_to_redirect_to_extension":
case "number_unanswered_calls_to_redirect":
- if ( ! array_key_exists($name, $data)) {
+ if (! array_key_exists($name, $data)) {
continue 2;
}
if (empty($data[$name])) {
@@ -286,10 +289,12 @@ private function updateQueue(CallQueues $queue, array $data): bool
}
break;
case "timeout_extension":
- if ( ! array_key_exists($name, $data)
+ if (
+ ! array_key_exists($name, $data)
|| empty($data[$name])
|| (array_key_exists('timeout_to_redirect_to_extension', $data)
- && intval($data['timeout_to_redirect_to_extension']) === 0)) {
+ && intval($data['timeout_to_redirect_to_extension']) === 0)
+ ) {
$queue->$name = null;
continue 2;
}
@@ -297,10 +302,12 @@ private function updateQueue(CallQueues $queue, array $data): bool
break;
case "redirect_to_extension_if_unanswered":
- if ( ! array_key_exists($name, $data)
+ if (
+ ! array_key_exists($name, $data)
|| empty($data[$name])
|| (array_key_exists('number_unanswered_calls_to_redirect', $data)
- && intval($data['number_unanswered_calls_to_redirect']) === 0)) {
+ && intval($data['number_unanswered_calls_to_redirect']) === 0)
+ ) {
$queue->$name = null;
continue 2;
}
@@ -308,7 +315,7 @@ private function updateQueue(CallQueues $queue, array $data): bool
break;
default:
- if ( ! array_key_exists($name, $data)) {
+ if (! array_key_exists($name, $data)) {
continue 2;
}
$queue->$name = $data[$name];
@@ -391,5 +398,4 @@ private function updateQueueMembers(array $data): bool
return true;
}
-
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/ConferenceRoomsController.php b/src/AdminCabinet/Controllers/ConferenceRoomsController.php
index 8713f068e..243788f24 100644
--- a/src/AdminCabinet/Controllers/ConferenceRoomsController.php
+++ b/src/AdminCabinet/Controllers/ConferenceRoomsController.php
@@ -20,8 +20,8 @@
namespace MikoPBX\AdminCabinet\Controllers;
use MikoPBX\AdminCabinet\Forms\ConferenceRoomEditForm;
-use MikoPBX\Common\Models\{ConferenceRooms, Extensions};
-
+use MikoPBX\Common\Models\ConferenceRooms;
+use MikoPBX\Common\Models\Extensions;
class ConferenceRoomsController extends BaseController
{
@@ -58,7 +58,7 @@ public function modifyAction(string $uniqid = null): void
*/
public function saveAction(): void
{
- if ( ! $this->request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
$this->db->begin();
@@ -79,7 +79,7 @@ public function saveAction(): void
}
// Update extension parameters
- if ( ! $this->updateExtension($extension, $data)) {
+ if (! $this->updateExtension($extension, $data)) {
$this->view->success = false;
$this->db->rollback();
@@ -87,7 +87,7 @@ public function saveAction(): void
}
// Update conference room parameters
- if ( ! $this->updateConferenceRoom($room, $data)) {
+ if (! $this->updateConferenceRoom($room, $data)) {
$this->view->success = false;
$this->db->rollback();
@@ -143,7 +143,7 @@ private function updateConferenceRoom(ConferenceRooms $room, array $data): bool
$room->$name = $data[$name];
break;
default:
- if ( ! array_key_exists($name, $data)) {
+ if (! array_key_exists($name, $data)) {
continue 2;
}
$room->$name = $data[$name];
@@ -158,5 +158,4 @@ private function updateConferenceRoom(ConferenceRooms $room, array $data): bool
return true;
}
-
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/ConsoleController.php b/src/AdminCabinet/Controllers/ConsoleController.php
index 9711204ac..57e2d07b1 100644
--- a/src/AdminCabinet/Controllers/ConsoleController.php
+++ b/src/AdminCabinet/Controllers/ConsoleController.php
@@ -1,4 +1,5 @@
request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
@@ -82,16 +81,16 @@ public function saveAction(): void
$customFile->setContent($data[$name]);
break;
default:
- if ( ! array_key_exists($name, $data)) {
+ if (! array_key_exists($name, $data)) {
continue 2;
}
$customFile->$name = $data[$name];
}
}
- if (empty($customFile->getContent())){
+ if (empty($customFile->getContent())) {
$customFile->mode = CustomFiles::MODE_NONE;
}
$this->saveEntity($customFile, "custom-files/modify/{id}");
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/DialplanApplicationsController.php b/src/AdminCabinet/Controllers/DialplanApplicationsController.php
index 32b0ec324..bc33d3783 100644
--- a/src/AdminCabinet/Controllers/DialplanApplicationsController.php
+++ b/src/AdminCabinet/Controllers/DialplanApplicationsController.php
@@ -1,4 +1,5 @@
request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
@@ -86,7 +85,7 @@ public function saveAction(): void
}
// Заполним параметры внутреннего номера
- if ( ! $this->updateExtension($extension, $data)) {
+ if (! $this->updateExtension($extension, $data)) {
$this->view->success = false;
$this->db->rollback();
@@ -94,7 +93,7 @@ public function saveAction(): void
}
// Заполним параметры пользователя
- if ( ! $this->updateDialplanApplication($appRecord, $data)) {
+ if (! $this->updateDialplanApplication($appRecord, $data)) {
$this->view->success = false;
$this->db->rollback();
@@ -170,5 +169,4 @@ private function updateDialplanApplication(DialplanApplications $application, ar
return true;
}
-
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/ErrorsController.php b/src/AdminCabinet/Controllers/ErrorsController.php
index 6dde466f9..53f61df27 100644
--- a/src/AdminCabinet/Controllers/ErrorsController.php
+++ b/src/AdminCabinet/Controllers/ErrorsController.php
@@ -1,4 +1,5 @@
executeMainQuery($parameters);
-
}
/**
@@ -304,4 +304,4 @@ public function modifyAction(string $id = ''): void
$this->view->represent = $extension->getRepresent();
$this->view->avatar = $getRecordStructure->user_avatar;
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/Fail2BanController.php b/src/AdminCabinet/Controllers/Fail2BanController.php
index 6affc9e61..6b463cb12 100644
--- a/src/AdminCabinet/Controllers/Fail2BanController.php
+++ b/src/AdminCabinet/Controllers/Fail2BanController.php
@@ -1,4 +1,5 @@
view->success = false;
$this->db->commit();
}
-
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/FirewallController.php b/src/AdminCabinet/Controllers/FirewallController.php
index 8dcce1951..a44198dfc 100644
--- a/src/AdminCabinet/Controllers/FirewallController.php
+++ b/src/AdminCabinet/Controllers/FirewallController.php
@@ -1,4 +1,5 @@
subnet, '.')) {
$localAddresses[] = $calculator->cidr2network(
- $interface->ipaddr,
- $interface->subnet
- ) . '/' . $interface->subnet;
+ $interface->ipaddr,
+ intval($interface->subnet)
+ ) . '/' . $interface->subnet;
} else {
$cidr = $calculator->netmask2cidr($interface->subnet);
$localAddresses[] = $calculator->cidr2network($interface->ipaddr, $cidr) . '/' . $cidr;
@@ -64,15 +64,15 @@ public function indexAction(): void
if (!str_contains($permitParts[1], '.')) {
$networksTable[$filter->id]['network'] = $calculator->cidr2network(
- $permitParts[0],
- $permitParts[1]
- ) . '/' . $permitParts[1];
+ $permitParts[0],
+ intval($permitParts[1])
+ ) . '/' . $permitParts[1];
} else {
$cidr = $calculator->netmask2cidr($permitParts[1]);
$networksTable[$filter->id]['network'] = $calculator->cidr2network(
- $permitParts[0],
- $cidr
- ) . '/' . $cidr;
+ $permitParts[0],
+ $cidr
+ ) . '/' . $cidr;
}
$networksTable[$filter->id]['permanent'] = false;
@@ -89,7 +89,7 @@ public function indexAction(): void
$firewallRules = $filter->FirewallRules;
foreach ($firewallRules as $rule) {
$networksTable[$filter->id]['category'][$rule->category]['action'] = $rule->action;
- if ( ! array_key_exists('name', $networksTable[$filter->id]['category'][$rule->category])) {
+ if (! array_key_exists('name', $networksTable[$filter->id]['category'][$rule->category])) {
$networksTable[$filter->id]['category'][$rule->category]['name'] = $rule->category;
}
}
@@ -105,7 +105,7 @@ public function indexAction(): void
break;
}
}
- if ( ! $existsPersistentRecord) {
+ if (! $existsPersistentRecord) {
foreach ($defaultRules as $key => $value) {
$networksTableNewRecord['category'][$key] = [
'name' => $key,
@@ -166,7 +166,7 @@ public function modifyAction(string $networkId = ''): void
*/
public function saveAction(): void
{
- if ( ! $this->request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
@@ -189,7 +189,7 @@ public function saveAction(): void
// Update firewall rules Firewall
$data['id'] = $filterRecordId;
- if ( ! $this->updateFirewallRules($data)) {
+ if (! $this->updateFirewallRules($data)) {
$this->view->success = false;
$this->db->rollback();
@@ -222,9 +222,9 @@ private function updateNetworkFilters(string $networkId, array $data): string
switch ($name) {
case 'permit':
$filterRecord->$name = $calculator->cidr2network(
- $data['network'],
- $data['subnet']
- ) . '/' . $data['subnet'];
+ $data['network'],
+ intval($data['subnet'])
+ ) . '/' . $data['subnet'];
break;
case 'deny':
$filterRecord->$name = '0.0.0.0/0';
@@ -450,4 +450,4 @@ private function sortArrayByNetwork($a, $b): bool
return false;
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/GeneralSettingsController.php b/src/AdminCabinet/Controllers/GeneralSettingsController.php
index b4b8e40fe..a2a973927 100644
--- a/src/AdminCabinet/Controllers/GeneralSettingsController.php
+++ b/src/AdminCabinet/Controllers/GeneralSettingsController.php
@@ -1,4 +1,5 @@
view->form = new GeneralSettingsEditForm(null, $pbxSettings);
$this->view->submitMode = null;
-
}
/**
@@ -155,7 +155,6 @@ public function saveAction(): void
$this->flash->success($this->translation->_('ms_SuccessfulSaved'));
$this->view->success = true;
$this->db->commit();
-
}
@@ -244,15 +243,17 @@ private function updateCodecs(string $codecsData): array
*
* @return array
*/
- private function updatePBXSettings(array $data):array
+ private function updatePBXSettings(array $data): array
{
- $messages = ['error'=>[]];
+ $messages = ['error' => []];
$pbxSettings = PbxSettings::getDefaultArrayValues();
// Process SSHPassword and set SSHPasswordHash accordingly
if (isset($data[PbxSettings::SSH_PASSWORD])) {
- if ($data[PbxSettings::SSH_PASSWORD] === $pbxSettings[PbxSettings::SSH_PASSWORD]
- || $data[PbxSettings::SSH_PASSWORD] === GeneralSettingsEditForm::HIDDEN_PASSWORD) {
+ if (
+ $data[PbxSettings::SSH_PASSWORD] === $pbxSettings[PbxSettings::SSH_PASSWORD]
+ || $data[PbxSettings::SSH_PASSWORD] === GeneralSettingsEditForm::HIDDEN_PASSWORD
+ ) {
$data[PbxSettings::SSH_PASSWORD_HASH_STRING] = md5($data[PbxSettings::WEB_ADMIN_PASSWORD]);
} else {
$data[PbxSettings::SSH_PASSWORD_HASH_STRING] = md5($data[PbxSettings::SSH_PASSWORD]);
@@ -315,5 +316,4 @@ private function updatePBXSettings(array $data):array
$result = count($messages['error']) === 0;
return [$result, $messages];
}
-
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/IncomingRoutesController.php b/src/AdminCabinet/Controllers/IncomingRoutesController.php
index cf6fb8768..d6ced5bb5 100644
--- a/src/AdminCabinet/Controllers/IncomingRoutesController.php
+++ b/src/AdminCabinet/Controllers/IncomingRoutesController.php
@@ -1,4 +1,5 @@
$forwardingExtensions,
'soundfiles' => $soundFilesList,
- ]);
+ ]
+ );
$this->view->form = $form;
$this->view->routingTable = $routingTable;
$this->view->submitMode = null;
@@ -119,18 +121,18 @@ public function modifyAction(string $ruleId = ''): void
} // First row is the default route, don't modify it.
$idIsEmpty = false;
- if(empty($ruleId)){
+ if (empty($ruleId)) {
$idIsEmpty = true;
- $ruleId = (string)($_GET['copy-source']??'');
+ $ruleId = (string)($_GET['copy-source'] ?? '');
}
$rule = IncomingRoutingTable::findFirstByid($ruleId);
if ($rule === null) {
$rule = new IncomingRoutingTable();
$rule->priority = IncomingRoutingTable::getMaxNewPriority();
- }elseif($idIsEmpty) {
+ } elseif ($idIsEmpty) {
$oldRule = $rule;
$rule = new IncomingRoutingTable();
- foreach ($oldRule->toArray() as $key => $value){
+ foreach ($oldRule->toArray() as $key => $value) {
$rule->writeAttribute($key, $value);
}
$rule->id = '';
@@ -138,7 +140,7 @@ public function modifyAction(string $ruleId = ''): void
$rule->priority = IncomingRoutingTable::getMaxNewPriority();
}
- if (empty($rule->provider)){
+ if (empty($rule->provider)) {
$rule->provider = 'none';
}
@@ -164,7 +166,7 @@ public function modifyAction(string $ruleId = ''): void
*/
public function saveAction(): void
{
- if ( ! $this->request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
$this->db->begin();
@@ -216,7 +218,7 @@ public function saveAction(): void
// Retrieve time conditions associated with the rule's number and provider
$manager = $this->di->get('modelsManager');
- $providerCondition = empty($rule->provider)? 'provider IS NULL':'provider = "'.$rule->provider.'"';
+ $providerCondition = empty($rule->provider) ? 'provider IS NULL' : 'provider = "' . $rule->provider . '"';
$options = [
'models' => [
'IncomingRoutingTable' => IncomingRoutingTable::class,
@@ -224,7 +226,7 @@ public function saveAction(): void
'columns' => [
'timeConditionId' => 'OutWorkTimesRouts.timeConditionId',
],
- 'conditions' => 'number = :did: AND '.$providerCondition,
+ 'conditions' => 'number = :did: AND ' . $providerCondition,
'bind' => [
'did' => $rule->number,
],
@@ -242,7 +244,7 @@ public function saveAction(): void
$result = array_merge(...$query->execute()->toArray());
// Create or update OutWorkTimesRouts records based on time conditions
- foreach ($result as $conditionId){
+ foreach ($result as $conditionId) {
$filter = [
'conditions' => 'timeConditionId=:timeConditionId: AND routId=:routId:',
'bind' => [
@@ -251,7 +253,7 @@ public function saveAction(): void
],
];
$outTime = OutWorkTimesRouts::findFirst($filter);
- if(!$outTime){
+ if (!$outTime) {
$outTime = new OutWorkTimesRouts();
$outTime->routId = $rule->id;
$outTime->timeConditionId = $conditionId;
@@ -297,17 +299,17 @@ public function changePriorityAction(): void
$this->view->disable();
$result = true;
- if ( ! $this->request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
$priorityTable = $this->request->getPost();
$rules = IncomingRoutingTable::find();
- foreach ($rules as $rule){
- if (array_key_exists ( $rule->id, $priorityTable)){
+ foreach ($rules as $rule) {
+ if (array_key_exists($rule->id, $priorityTable)) {
$rule->priority = $priorityTable[$rule->id];
$result .= $rule->update();
}
}
echo json_encode($result);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/IvrMenuController.php b/src/AdminCabinet/Controllers/IvrMenuController.php
index 6f9f4f6f2..44b55dbcb 100644
--- a/src/AdminCabinet/Controllers/IvrMenuController.php
+++ b/src/AdminCabinet/Controllers/IvrMenuController.php
@@ -1,4 +1,5 @@
ivr_menu_id][$record->id]=[
- 'digits'=>$record->digits,
- 'represent'=>$record->Extensions===null?'ERROR':$record->Extensions->getRepresent()
+ $ivrMenuActions[$record->ivr_menu_id][$record->id] = [
+ 'digits' => $record->digits,
+ 'represent' => $record->Extensions === null ? 'ERROR' : $record->Extensions->getRepresent()
];
}
$records = IvrMenu::find();
- $ivrMenuList=[];
+ $ivrMenuList = [];
// Retrieve IVR menus and build the representation
foreach ($records as $record) {
usort($ivrMenuActions[$record->uniqid], [__CLASS__, 'sortArrayByDigits']);
- $ivrMenuList[]=[
- 'uniqid'=>$record->uniqid,
- 'name'=>$record->name,
- 'extension'=>$record->extension,
- 'actions'=>$ivrMenuActions[$record->uniqid],
- 'description'=>$record->description,
- 'timeoutExtension'=>$record->TimeoutExtensions===null?'ERROR':$record->TimeoutExtensions->getRepresent()
+ $ivrMenuList[] = [
+ 'uniqid' => $record->uniqid,
+ 'name' => $record->name,
+ 'extension' => $record->extension,
+ 'actions' => $ivrMenuActions[$record->uniqid],
+ 'description' => $record->description,
+ 'timeoutExtension' => $record->TimeoutExtensions === null ? 'ERROR' : $record->TimeoutExtensions->getRepresent()
];
}
$this->view->ivrmenu = $ivrMenuList;
@@ -101,7 +100,7 @@ public function modifyAction(string $ivrmenuid = ''): void
];
$actions = IvrMenuActions::find($parameters);
foreach ($actions as $action) {
- $represent = $action->Extensions===null?"ERROR":$action->Extensions->getRepresent();
+ $represent = $action->Extensions === null ? "ERROR" : $action->Extensions->getRepresent();
// Build IVR menu actions array
$ivrActionsList[] = [
'id' => $action->id,
@@ -139,10 +138,11 @@ public function modifyAction(string $ivrmenuid = ''): void
// Construct the form for modifying the IVR menu
$form = new IvrMenuEditForm(
- $ivrmenu, [
+ $ivrmenu,
+ [
'extensions' => $extensionList,
'soundfiles' => $soundfilesList,
- ]
+ ]
);
// Assign data to the view for rendering
@@ -150,7 +150,6 @@ public function modifyAction(string $ivrmenuid = ''): void
$this->view->ivractions = $ivrActionsList;
$this->view->represent = $ivrmenu->getRepresent();
$this->view->extension = $ivrmenu->extension;
-
}
/**
@@ -177,7 +176,7 @@ public function sortArrayByDigits($a, $b): ?int
*/
public function saveAction(): void
{
- if ( ! $this->request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
@@ -199,7 +198,7 @@ public function saveAction(): void
}
// Update IVR menu parameters
- if ( ! $this->updateExtension($extension, $data)) {
+ if (! $this->updateExtension($extension, $data)) {
$this->view->success = false;
$this->db->rollback();
@@ -207,7 +206,7 @@ public function saveAction(): void
}
// Update IVR menu actions
- if ( ! $this->updateIVRMenu($ivrMenuRecord, $data)) {
+ if (! $this->updateIVRMenu($ivrMenuRecord, $data)) {
$this->view->success = false;
$this->db->rollback();
@@ -215,7 +214,7 @@ public function saveAction(): void
}
// Update IVR menu actions
- if ( ! $this->updateIVRMenuActions($data)) {
+ if (! $this->updateIVRMenuActions($data)) {
$this->view->success = false;
$this->db->rollback();
@@ -278,7 +277,7 @@ private function updateIVRMenu(IvrMenu $ivrMenu, array $data): bool
}
break;
default:
- if ( ! array_key_exists($name, $data)) {
+ if (! array_key_exists($name, $data)) {
continue 2;
}
$ivrMenu->$name = $data[$name];
@@ -351,5 +350,4 @@ private function updateIVRMenuActions(array $data): bool
return true;
}
-
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/LanguageController.php b/src/AdminCabinet/Controllers/LanguageController.php
index 79e0399fb..6bec97157 100644
--- a/src/AdminCabinet/Controllers/LanguageController.php
+++ b/src/AdminCabinet/Controllers/LanguageController.php
@@ -1,4 +1,5 @@
['name' => $translation->_('ex_Chinese'), 'flag' => 'china'],
];
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/LicensingController.php b/src/AdminCabinet/Controllers/LicensingController.php
index 70b3c2962..3e366279d 100644
--- a/src/AdminCabinet/Controllers/LicensingController.php
+++ b/src/AdminCabinet/Controllers/LicensingController.php
@@ -1,4 +1,5 @@
redirect($redirectUrl)->send();
-
}
/**
- * After some changes on form we will refresh some session cache
+ * After some changes on form, we will refresh some session cache
*/
public function saveAction(): void
{
$this->session->remove(PbxSettings::PBX_LICENSE);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/LocalizationController.php b/src/AdminCabinet/Controllers/LocalizationController.php
index acce40132..b8513ae10 100644
--- a/src/AdminCabinet/Controllers/LocalizationController.php
+++ b/src/AdminCabinet/Controllers/LocalizationController.php
@@ -1,4 +1,5 @@
view->success = true;
$this->view->results = json_encode($arrStr);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/MailSettingsController.php b/src/AdminCabinet/Controllers/MailSettingsController.php
index 288d1dc49..62fc6b7ea 100644
--- a/src/AdminCabinet/Controllers/MailSettingsController.php
+++ b/src/AdminCabinet/Controllers/MailSettingsController.php
@@ -1,4 +1,5 @@
request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
$data = $this->request->getPost();
@@ -100,7 +100,7 @@ public function saveAction(): void
$record->value = ($data[$key] == 'on') ? "1" : "0";
break;
default:
- if ( ! array_key_exists($key, $data)) {
+ if (! array_key_exists($key, $data)) {
continue 2;
}
$record->value = $data[$key];
diff --git a/src/AdminCabinet/Controllers/NetworkController.php b/src/AdminCabinet/Controllers/NetworkController.php
index 92ed88777..9e46d1bda 100644
--- a/src/AdminCabinet/Controllers/NetworkController.php
+++ b/src/AdminCabinet/Controllers/NetworkController.php
@@ -1,4 +1,5 @@
$messages]];
+ return [$result, ['error' => $messages]];
}
/**
diff --git a/src/AdminCabinet/Controllers/OutOffWorkTimeController.php b/src/AdminCabinet/Controllers/OutOffWorkTimeController.php
index e9a759702..191b1204b 100644
--- a/src/AdminCabinet/Controllers/OutOffWorkTimeController.php
+++ b/src/AdminCabinet/Controllers/OutOffWorkTimeController.php
@@ -1,4 +1,5 @@
description) < 45){
+ if (mb_strlen($timeFrame->description) < 45) {
$shot_description = $timeFrame->description;
} else {
- $shot_description = trim(mb_substr($timeFrame->description, 0 , 45)).'...';
+ $shot_description = trim(mb_substr($timeFrame->description, 0, 45)) . '...';
}
// Add the formatted OutWorkTimes record to the array of records to be displayed on the index page.
$timeframesTable[] = [
@@ -69,8 +68,8 @@ public function indexAction(): void
'calType' => $calTypeArray[$timeFrame->calType],
'date_from' => ( ! empty($timeFrame->date_from)) > 0 ? date("d.m.Y", $timeFrame->date_from) : '',
'date_to' => ( ! empty($timeFrame->date_to)) > 0 ? date("d.m.Y", $timeFrame->date_to) : '',
- 'weekday_from' => ( ! empty($timeFrame->weekday_from)) ? $this->translation->_(date('D',strtotime("Sunday +$timeFrame->weekday_from days"))) : '',
- 'weekday_to' => ( ! empty($timeFrame->weekday_to)) ? $this->translation->_(date('D',strtotime("Sunday +$timeFrame->weekday_to days"))) : '',
+ 'weekday_from' => ( ! empty($timeFrame->weekday_from)) ? $this->translation->_(date('D', strtotime("Sunday +$timeFrame->weekday_from days"))) : '',
+ 'weekday_to' => ( ! empty($timeFrame->weekday_to)) ? $this->translation->_(date('D', strtotime("Sunday +$timeFrame->weekday_to days"))) : '',
'time_from' => $timeFrame->time_from,
'time_to' => $timeFrame->time_to,
'action' => $timeFrame->action,
@@ -91,13 +90,13 @@ public function changePriorityAction(): void
$this->view->disable();
$result = true;
- if ( ! $this->request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
$priorityTable = $this->request->getPost();
$rules = OutWorkTimes::find();
- foreach ($rules as $rule){
- if (array_key_exists ( $rule->id, $priorityTable)){
+ foreach ($rules as $rule) {
+ if (array_key_exists($rule->id, $priorityTable)) {
$rule->priority = $priorityTable[$rule->id];
$result .= $rule->update();
}
@@ -162,7 +161,8 @@ public function modifyAction(string $id = ''): void
// Create a new TimeFrameEditForm object with the $timeFrame and arrays for the forwarding extensions, audio messages, available actions, and week days.
$form = new TimeFrameEditForm(
- $timeFrame, [
+ $timeFrame,
+ [
'extensions' => $forwardingExtensions,
'audio-message' => $audioMessages,
'available-actions' => $availableActions,
@@ -192,11 +192,11 @@ public function modifyAction(string $id = ''): void
];
$data = Sip::find($filter)->toArray();
$providersId = [];
- foreach ($data as $providerData){
- if($providerData['registration_type'] === Sip::REG_TYPE_INBOUND || empty($providerData['host'])){
+ foreach ($data as $providerData) {
+ if ($providerData['registration_type'] === Sip::REG_TYPE_INBOUND || empty($providerData['host'])) {
$providersId[$providerData['uniqid']] = $providerData['uniqid'];
- }else{
- $providersId[$providerData['uniqid']] = SIPConf::getContextId($providerData['host'] , $providerData['port']);
+ } else {
+ $providersId[$providerData['uniqid']] = SIPConf::getContextId($providerData['host'], $providerData['port']);
}
}
unset($data);
@@ -245,7 +245,7 @@ public function modifyAction(string $id = ''): void
public function saveAction(): void
{
// Check if the request method is POST
- if ( ! $this->request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
@@ -266,16 +266,16 @@ public function saveAction(): void
switch ($name) {
case 'weekday_from':
case 'weekday_to':
- if ( ! array_key_exists($name, $data)) {
+ if (! array_key_exists($name, $data)) {
$timeFrame->$name = '';
} else {
$timeFrame->$name = ($data[$name] < 1) ? null : $data[$name];
}
break;
case 'allowRestriction':
- if(isset($data[$name])){
+ if (isset($data[$name])) {
$timeFrame->$name = ($data[$name] === 'on') ? '1' : '0';
- }else{
+ } else {
$timeFrame->$name = '0';
}
break;
@@ -286,14 +286,14 @@ public function saveAction(): void
case 'date_to':
case 'time_from':
case 'time_to':
- if ( ! array_key_exists($name, $data)) {
+ if (! array_key_exists($name, $data)) {
$timeFrame->$name = '';
} else {
$timeFrame->$name = $data[$name];
}
break;
default:
- if ( ! array_key_exists($name, $data)) {
+ if (! array_key_exists($name, $data)) {
continue 2;
}
$timeFrame->$name = $data[$name];
@@ -301,7 +301,7 @@ public function saveAction(): void
}
// If the action is 'playmessage', set the extension to an empty string
- if('playmessage' === $timeFrame->action){
+ if ('playmessage' === $timeFrame->action) {
$timeFrame->extension = '';
}
@@ -396,5 +396,4 @@ public function deleteAction(string $id = ''): void
// Redirect to the OutOffWorkTime index page
$this->forward('OutOffWorkTime/index');
}
-
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/OutboundRoutesController.php b/src/AdminCabinet/Controllers/OutboundRoutesController.php
index dbcf40990..cb586d9c4 100644
--- a/src/AdminCabinet/Controllers/OutboundRoutesController.php
+++ b/src/AdminCabinet/Controllers/OutboundRoutesController.php
@@ -1,4 +1,5 @@
priority = (int)OutgoingRoutingTable::maximum(['column' => 'priority'])+1;
- }elseif($idIsEmpty){
+ $rule->priority = (int)OutgoingRoutingTable::maximum(['column' => 'priority']) + 1;
+ } elseif ($idIsEmpty) {
$oldRule = $rule;
$rule = new OutgoingRoutingTable();
- $rule->priority = (int)OutgoingRoutingTable::maximum(['column' => 'priority'])+1;
- foreach ($oldRule->toArray() as $key => $value){
+ $rule->priority = (int)OutgoingRoutingTable::maximum(['column' => 'priority']) + 1;
+ foreach ($oldRule->toArray() as $key => $value) {
$rule->writeAttribute($key, $value);
}
$rule->rulename = '';
@@ -131,14 +130,14 @@ public function saveAction(): void
switch ($name) {
case 'restnumbers':
{
- if ( ! array_key_exists($name, $data)) {
+ if (! array_key_exists($name, $data)) {
continue 2;
}
$rule->$name = $data[$name] === '' ? '-1' : $data[$name];
break;
}
default:
- if ( ! array_key_exists($name, $data)) {
+ if (! array_key_exists($name, $data)) {
continue 2;
}
$rule->$name = $data[$name];
@@ -188,13 +187,13 @@ public function changePriorityAction(): void
$this->view->disable();
$result = true;
- if ( ! $this->request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
$priorityTable = $this->request->getPost();
$rules = OutgoingRoutingTable::find();
- foreach ($rules as $rule){
- if (array_key_exists ( $rule->id, $priorityTable)){
+ foreach ($rules as $rule) {
+ if (array_key_exists($rule->id, $priorityTable)) {
$rule->priority = $priorityTable[$rule->id];
$result .= $rule->update();
}
@@ -221,4 +220,4 @@ private function sortArrayByNameAndState($a, $b): ?int
return ($a < $b) ? -1 : 1;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/PbxExtensionModulesController.php b/src/AdminCabinet/Controllers/PbxExtensionModulesController.php
index b5b319e37..3e4419d91 100644
--- a/src/AdminCabinet/Controllers/PbxExtensionModulesController.php
+++ b/src/AdminCabinet/Controllers/PbxExtensionModulesController.php
@@ -1,4 +1,5 @@
true,
];
- if ($module['disabled'] === '1'){
+ if ($module['disabled'] === '1') {
$moduleRecord['status'] = 'disabled';
$moduleRecord['disableReason'] = $module['disableReason'];
$moduleRecord['disableReasonText'] = $module['disableReasonText'];
// Translate the license message
- if ($moduleRecord['disableReason'] === PbxExtensionState::DISABLED_BY_LICENSE
- && isset($moduleRecord['disableReasonText'])) {
+ if (
+ $moduleRecord['disableReason'] === PbxExtensionState::DISABLED_BY_LICENSE
+ && isset($moduleRecord['disableReasonText'])
+ ) {
$lic = $this->di->getShared(MarketPlaceProvider::SERVICE_NAME);
$moduleRecord['disableReasonText'] = $lic->translateLicenseErrorMessage((string)$moduleRecord['disableReasonText']);
}
@@ -71,14 +74,18 @@ public function indexAction(): void
// License key management tab //
$licKey = PbxSettings::getValueByKey(PbxSettings::PBX_LICENSE);
- if (strlen($licKey) !== 28
- || !Text::startsWith($licKey, 'MIKO-')) {
+ if (
+ strlen($licKey) !== 28
+ || !Text::startsWith($licKey, 'MIKO-')
+ ) {
$licKey = '';
}
// License key form
- $this->view->setVar('changeLicenseKeyForm',
- new LicensingChangeLicenseKeyForm(null, ['licKey' => $licKey]));
+ $this->view->setVar(
+ 'changeLicenseKeyForm',
+ new LicensingChangeLicenseKeyForm(null, ['licKey' => $licKey])
+ );
// Coupon form
$this->view->setVar('activateCouponForm', new LicensingActivateCouponForm());
@@ -87,7 +94,6 @@ public function indexAction(): void
$this->view->setVar('getKeyForm', new LicensingGetKeyForm());
$this->view->setVar('submitMode', null);
-
}
/**
@@ -120,8 +126,8 @@ public function modifyAction(string $uniqid): void
}
$this->view->form = new PbxExtensionModuleSettingsForm($previousMenuSettings, $options);
$this->view->title = $this->translation->_('ext_SettingsForModule') . ' ' . $this->translation->_(
- "Breadcrumb$uniqid"
- );
+ "Breadcrumb$uniqid"
+ );
$this->view->submitMode = null;
$this->view->indexUrl = 'pbx-extension-modules/index/';
}
@@ -160,5 +166,4 @@ public function saveAction(): void
$this->flash->success($this->translation->_('ms_SuccessfulSaved'));
$this->view->success = true;
}
-
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/ProvidersController.php b/src/AdminCabinet/Controllers/ProvidersController.php
index 717521b11..8a58a63ed 100644
--- a/src/AdminCabinet/Controllers/ProvidersController.php
+++ b/src/AdminCabinet/Controllers/ProvidersController.php
@@ -1,4 +1,5 @@
Sip->qualifyfreq = 60;
$provider->Sip->qualify = '1';
$provider->Sip->secret = SIP::generateSipPassword();
- }elseif($idIsEmpty){
+ } elseif ($idIsEmpty) {
$uniqId = Sip::generateUniqueID('SIP-TRUNK-');
$oldProvider = $provider;
$provider = new Providers();
- foreach ($oldProvider->toArray() as $key => $value){
+ foreach ($oldProvider->toArray() as $key => $value) {
$provider->writeAttribute($key, $value);
}
$provider->Sip = new Sip();
- foreach ($oldProvider->Sip->toArray() as $key => $value){
+ foreach ($oldProvider->Sip->toArray() as $key => $value) {
$provider->Sip->writeAttribute($key, $value);
}
$provider->id = '';
@@ -121,9 +121,9 @@ public function modifysipAction(string $uniqId = ''): void
public function modifyiaxAction(string $uniqId = ''): void
{
$idIsEmpty = false;
- if(empty($uniqId)){
+ if (empty($uniqId)) {
$idIsEmpty = true;
- $uniqId = (string)($_GET['copy-source']??'');
+ $uniqId = (string)($_GET['copy-source'] ?? '');
}
$provider = Providers::findFirstByUniqid($uniqId);
@@ -138,15 +138,15 @@ public function modifyiaxAction(string $uniqId = ''): void
$provider->Iax->uniqid = $uniqId;
$provider->Iax->disabled = '0';
$provider->Iax->qualify = '1';
- }elseif($idIsEmpty){
+ } elseif ($idIsEmpty) {
$uniqId = Iax::generateUniqueID('IAX-TRUNK-');
$oldProvider = $provider;
$provider = new Providers();
- foreach ($oldProvider->toArray() as $key => $value){
+ foreach ($oldProvider->toArray() as $key => $value) {
$provider->writeAttribute($key, $value);
}
$provider->Iax = new Iax();
- foreach ($oldProvider->Iax->toArray() as $key => $value){
+ foreach ($oldProvider->Iax->toArray() as $key => $value) {
$provider->Iax->writeAttribute($key, $value);
}
$provider->id = '';
@@ -292,7 +292,7 @@ private function saveProvider(array $data, string $type): bool
}
}
- if (isset($data['note'])){
+ if (isset($data['note'])) {
$provider->note = $data['note'];
}
if ($provider->save() === false) {
@@ -446,5 +446,4 @@ public function deleteAction(string $uniqid = ''): void
$this->forward('providers/index');
}
-
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/RestartController.php b/src/AdminCabinet/Controllers/RestartController.php
index 770c66300..df5b28214 100644
--- a/src/AdminCabinet/Controllers/RestartController.php
+++ b/src/AdminCabinet/Controllers/RestartController.php
@@ -1,4 +1,5 @@
view->setVar('NameFromSettings', PbxSettings::getValueByKey(PbxSettings::PBX_NAME));
$description = PbxSettings::getValueByKey(PbxSettings::PBX_DESCRIPTION);
- if ($description===PbxSettings::DEFAULT_CLOUD_PASSWORD_DESCRIPTION){
- $description=$this->translation->_($description);
+ if ($description === PbxSettings::DEFAULT_CLOUD_PASSWORD_DESCRIPTION) {
+ $description = $this->translation->_($description);
}
$this->view->setVar('DescriptionFromSettings', $description);
$this->view->setVar('form', new LoginForm());
$remoteAddress = $this->request->getClientAddress(true);
- $remainAttempts = $this->countRemainAttempts($remoteAddress,false,self::LOGIN_ATTEMPTS_INTERVAL,self::LOGIN_ATTEMPTS);
+ $remainAttempts = $this->countRemainAttempts($remoteAddress, false, self::LOGIN_ATTEMPTS_INTERVAL, self::LOGIN_ATTEMPTS);
$this->view->remainAttempts = $remainAttempts;
$this->view->loginAttemptsInterval = self::LOGIN_ATTEMPTS_INTERVAL;
}
@@ -105,11 +106,11 @@ public function startAction(): void
$this->forward('session/index');
}
$remoteAddress = $this->request->getClientAddress(true);
- $remainAttempts = $this->countRemainAttempts($remoteAddress,true,self::LOGIN_ATTEMPTS_INTERVAL,self::LOGIN_ATTEMPTS);
+ $remainAttempts = $this->countRemainAttempts($remoteAddress, true, self::LOGIN_ATTEMPTS_INTERVAL, self::LOGIN_ATTEMPTS);
if ($remainAttempts === 0) {
$userAgent = $this->request->getUserAgent();
$this->loggerAuth->warning("From: $remoteAddress UserAgent:$userAgent Cause: Wrong password");
- $this->flash->error($this->translation->_('auth_TooManyLoginAttempts',['interval'=>self::LOGIN_ATTEMPTS_INTERVAL]));
+ $this->flash->error($this->translation->_('auth_TooManyLoginAttempts', ['interval' => self::LOGIN_ATTEMPTS_INTERVAL]));
$this->view->success = true;
$this->view->reload = $this->url->get('session/index');
return;
@@ -121,8 +122,7 @@ public function startAction(): void
$userLoggedIn = false;
$sessionParams = [];
// Check if the provided login and password match the stored values
- if ($this->checkCredentials($loginFromUser, $passFromUser))
- {
+ if ($this->checkCredentials($loginFromUser, $passFromUser)) {
$sessionParams = [
SessionController::ROLE => AclProvider::ROLE_ADMINS,
SessionController::HOME_PAGE => $this->url->get('extensions/index'),
@@ -147,7 +147,7 @@ public function startAction(): void
if ($userLoggedIn) {
// Register the session with the specified parameters
$this->_registerSession($sessionParams);
- if ($this->session->has(PbxSettings::WEB_ADMIN_LANGUAGE)){
+ if ($this->session->has(PbxSettings::WEB_ADMIN_LANGUAGE)) {
LanguageController::updateSystemLanguage($this->session->get(PbxSettings::WEB_ADMIN_LANGUAGE));
}
$this->view->success = true;
@@ -160,10 +160,9 @@ public function startAction(): void
} else {
// Authentication failed
$this->view->success = false;
- $this->flash->error($this->translation->_('auth_WrongLoginPassword',['attempts'=>$remainAttempts]));
+ $this->flash->error($this->translation->_('auth_WrongLoginPassword', ['attempts' => $remainAttempts]));
$this->clearAuthCookies();
}
-
}
/**
@@ -265,7 +264,7 @@ public function endAction(): void
* @return bool True if credentials are correct, otherwise false.
* @throws ErrorException Throws an exception if there is an error during the process.
*/
- private function checkCredentials(string $login, string $password):bool
+ private function checkCredentials(string $login, string $password): bool
{
// Check admin login name
$storedLogin = PbxSettings::getValueByKey(PbxSettings::WEB_ADMIN_LOGIN);
@@ -280,7 +279,7 @@ private function checkCredentials(string $login, string $password):bool
}
// New password check method
- set_error_handler(function($severity, $message, $file, $line) {
+ set_error_handler(function ($severity, $message, $file, $line) {
throw new ErrorException($message, 0, $severity, $file, $line);
});
@@ -316,14 +315,14 @@ private static function getSessionsKeepAliveKey(int $interval): string
* @param int $maxCount The maximum allowed login attempts within the given interval.
* @return int The remaining number of attempts within the interval.
*/
- private function countRemainAttempts(mixed $remoteAddress, bool $increment = true, int $interval=300, int $maxCount=10): int
+ private function countRemainAttempts(mixed $remoteAddress, bool $increment = true, int $interval = 300, int $maxCount = 10): int
{
- if (!is_string($remoteAddress)){
+ if (!is_string($remoteAddress)) {
return $maxCount;
}
$redisAdapter = $this->di->getShared(ManagedCacheProvider::SERVICE_NAME)->getAdapter();
$zKey = self::getSessionsKeepAliveKey($interval);
- if ($increment){
+ if ($increment) {
$redisAdapter->zIncrBy($zKey, 1, $remoteAddress);
} else {
$redisAdapter->zIncrBy($zKey, 0, $remoteAddress);
@@ -331,6 +330,6 @@ private function countRemainAttempts(mixed $remoteAddress, bool $increment = tru
$redisAdapter->expire($zKey, $interval);
$count = $redisAdapter->zScore($zKey, $remoteAddress);
- return Max($maxCount-$count,0);
+ return Max($maxCount - $count, 0);
}
}
diff --git a/src/AdminCabinet/Controllers/SoundFilesController.php b/src/AdminCabinet/Controllers/SoundFilesController.php
index 2cf09fa6a..b6e09984d 100644
--- a/src/AdminCabinet/Controllers/SoundFilesController.php
+++ b/src/AdminCabinet/Controllers/SoundFilesController.php
@@ -1,4 +1,5 @@
view->results = $soundFilesList;
$this->view->success = true;
}
-
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/SystemDiagnosticController.php b/src/AdminCabinet/Controllers/SystemDiagnosticController.php
index 107a82430..208a1415e 100644
--- a/src/AdminCabinet/Controllers/SystemDiagnosticController.php
+++ b/src/AdminCabinet/Controllers/SystemDiagnosticController.php
@@ -1,4 +1,5 @@
view->form = new SystemDiagnosticForm();
}
-
-
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/TimeSettingsController.php b/src/AdminCabinet/Controllers/TimeSettingsController.php
index 56abde4da..41da9e032 100644
--- a/src/AdminCabinet/Controllers/TimeSettingsController.php
+++ b/src/AdminCabinet/Controllers/TimeSettingsController.php
@@ -1,4 +1,5 @@
request->isPost()) {
+ if (! $this->request->isPost()) {
return;
}
@@ -134,12 +134,12 @@ public function saveAction(): void
break;
case PbxSettings::NTP_SERVER:
$ntp_servers = preg_split('/\r\n|\r|\n| |,/', $data[$key]);
- if (is_array($ntp_servers)){
+ if (is_array($ntp_servers)) {
$record->value = implode(PHP_EOL, $ntp_servers);
}
break;
default:
- if ( ! array_key_exists($key, $data)) {
+ if (! array_key_exists($key, $data)) {
continue 2;
}
$record->value = $data[$key];
@@ -158,4 +158,4 @@ public function saveAction(): void
$this->view->success = true;
$this->db->commit();
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/TopMenuSearchController.php b/src/AdminCabinet/Controllers/TopMenuSearchController.php
index c90f4127c..f90a30256 100644
--- a/src/AdminCabinet/Controllers/TopMenuSearchController.php
+++ b/src/AdminCabinet/Controllers/TopMenuSearchController.php
@@ -1,4 +1,5 @@
$action) {
$this->addAdditionalMenuItem($controllerClass, $action, $items);
}
-
}
/**
@@ -175,4 +175,4 @@ private function addAdditionalMenuItem(string $controllerClass, string $action,
];
}
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/UpdateController.php b/src/AdminCabinet/Controllers/UpdateController.php
index 20a305140..3542a6f4a 100644
--- a/src/AdminCabinet/Controllers/UpdateController.php
+++ b/src/AdminCabinet/Controllers/UpdateController.php
@@ -1,4 +1,5 @@
view->setVars(
[
- 'isDocker'=>Util::isDocker(),
- 'submitMode'=>null,
+ 'isDocker' => Util::isDocker(),
+ 'submitMode' => null,
]
);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Controllers/WikiLinksController.php b/src/AdminCabinet/Controllers/WikiLinksController.php
index b19d4a11a..bd081d427 100644
--- a/src/AdminCabinet/Controllers/WikiLinksController.php
+++ b/src/AdminCabinet/Controllers/WikiLinksController.php
@@ -1,4 +1,5 @@
set($cacheKey, $links, $ttl);
}
if (empty($links)) {
-
$filename = appPath(str_replace('LANG', $language, 'src/Common/WikiLinks/LANG.json'));
if (file_exists($filename)) {
try {
@@ -123,4 +124,4 @@ private function customModuleWikiLinks(string $uniqid): void
$this->view->success = true;
$this->view->message = $links[$this->language] ?? [];
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/AsteriskManagerEditForm.php b/src/AdminCabinet/Forms/AsteriskManagerEditForm.php
index 7c6f9040f..6ffb8b332 100644
--- a/src/AdminCabinet/Forms/AsteriskManagerEditForm.php
+++ b/src/AdminCabinet/Forms/AsteriskManagerEditForm.php
@@ -1,4 +1,5 @@
[
'id',
'name',
@@ -78,7 +81,6 @@ public function initialize($entity = null, $options = null): void
$this->add($networkfilterid);
// Description
- $this->addTextArea('description', $entity->description??'', 65);
-
+ $this->addTextArea('description', $entity->description ?? '', 65);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/BaseForm.php b/src/AdminCabinet/Forms/BaseForm.php
index ae6cb8b69..9a5eedbbf 100644
--- a/src/AdminCabinet/Forms/BaseForm.php
+++ b/src/AdminCabinet/Forms/BaseForm.php
@@ -1,4 +1,5 @@
add(new TextArea($areaName, $options));
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/CallDetailRecordsFilterForm.php b/src/AdminCabinet/Forms/CallDetailRecordsFilterForm.php
index 3feacd658..e43e4f91f 100644
--- a/src/AdminCabinet/Forms/CallDetailRecordsFilterForm.php
+++ b/src/AdminCabinet/Forms/CallDetailRecordsFilterForm.php
@@ -1,4 +1,5 @@
add(new Text('date_to', ['value' => $options['date_to']]));
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/CallQueueEditForm.php b/src/AdminCabinet/Forms/CallQueueEditForm.php
index 57984d0bb..4d7ccc627 100644
--- a/src/AdminCabinet/Forms/CallQueueEditForm.php
+++ b/src/AdminCabinet/Forms/CallQueueEditForm.php
@@ -1,4 +1,5 @@
[
'id',
'name',
@@ -96,7 +99,9 @@ public function initialize($entity = null, $options = null): void
];
$callerhear = new Select(
- 'caller_hear', $arrActions, [
+ 'caller_hear',
+ $arrActions,
+ [
'using' => [
'id',
'name',
@@ -125,7 +130,9 @@ public function initialize($entity = null, $options = null): void
$periodicannouncesoundid = new Select(
- 'periodic_announce_sound_id', $options['soundfiles'], [
+ 'periodic_announce_sound_id',
+ $options['soundfiles'],
+ [
'using' => [
'id',
'name',
@@ -137,7 +144,9 @@ public function initialize($entity = null, $options = null): void
$this->add($periodicannouncesoundid);
$periodicannouncesoundid = new Select(
- 'moh_sound_id', $options['mohSoundFiles'], [
+ 'moh_sound_id',
+ $options['mohSoundFiles'],
+ [
'using' => [
'id',
'name',
@@ -166,7 +175,9 @@ public function initialize($entity = null, $options = null): void
// Timeoutextension
$extension = new Select(
- 'timeout_extension', $options['extensions'], [
+ 'timeout_extension',
+ $options['extensions'],
+ [
'using' => [
'id',
'name',
@@ -179,7 +190,9 @@ public function initialize($entity = null, $options = null): void
// Redirecttoextensionifempty
$extension = new Select(
- 'redirect_to_extension_if_empty', $options['extensions'], [
+ 'redirect_to_extension_if_empty',
+ $options['extensions'],
+ [
'using' => [
'id',
'name',
@@ -205,7 +218,9 @@ public function initialize($entity = null, $options = null): void
// Redirecttoextensionifunanswered
$extension = new Select(
- 'redirect_to_extension_if_unanswered', $options['extensions'], [
+ 'redirect_to_extension_if_unanswered',
+ $options['extensions'],
+ [
'using' => [
'id',
'name',
@@ -231,7 +246,9 @@ public function initialize($entity = null, $options = null): void
// Redirecttoextensionifrepeatexceeded
$extension = new Select(
- 'redirect_to_extension_if_repeat_exceeded', $options['extensions'], [
+ 'redirect_to_extension_if_repeat_exceeded',
+ $options['extensions'],
+ [
'using' => [
'id',
'name',
@@ -246,6 +263,6 @@ public function initialize($entity = null, $options = null): void
$this->add(new Text('callerid_prefix'));
// Description
- $this->addTextArea('description', $entity->description??'', 65);
+ $this->addTextArea('description', $entity->description ?? '', 65);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/ConferenceRoomEditForm.php b/src/AdminCabinet/Forms/ConferenceRoomEditForm.php
index d72a5e32d..f69844e1c 100644
--- a/src/AdminCabinet/Forms/ConferenceRoomEditForm.php
+++ b/src/AdminCabinet/Forms/ConferenceRoomEditForm.php
@@ -1,4 +1,5 @@
add(new Text('pinCode'));
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/CustomFilesEditForm.php b/src/AdminCabinet/Forms/CustomFilesEditForm.php
index 3c8e855ae..71f39cc4a 100644
--- a/src/AdminCabinet/Forms/CustomFilesEditForm.php
+++ b/src/AdminCabinet/Forms/CustomFilesEditForm.php
@@ -1,4 +1,5 @@
add(new Hidden($key));
break;
case "description":
- $this->addTextArea($key, $value??'', 65);
+ $this->addTextArea($key, $value ?? '', 65);
break;
case "mode":
$select = new Select(
@@ -57,8 +57,8 @@ public function initialize($entity = null, $options = null): void
CustomFiles::MODE_APPEND => $this->translation->_("cf_FileActionsAppend"),
CustomFiles::MODE_OVERRIDE => $this->translation->_("cf_FileActionsOverride"),
CustomFiles::MODE_SCRIPT => $this->translation->_("cf_FileActionsScript"),
- ]
- , [
+ ],
+ [
'using' => [
'id',
'name',
@@ -77,4 +77,4 @@ public function initialize($entity = null, $options = null): void
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/DefaultIncomingRouteForm.php b/src/AdminCabinet/Forms/DefaultIncomingRouteForm.php
index ea20de10c..2dada9278 100644
--- a/src/AdminCabinet/Forms/DefaultIncomingRouteForm.php
+++ b/src/AdminCabinet/Forms/DefaultIncomingRouteForm.php
@@ -1,4 +1,5 @@
[
'id',
'name',
@@ -65,11 +67,13 @@ public function initialize($entity = null, $options = null): void
case 'audio_message_id' :{
// Audio_message_id
$fileId = (string)$options['soundfiles'];
- if(empty($fileId)){
+ if (empty($fileId)) {
$fileId = 'none';
}
$audioMessage = new Select(
- 'audio_message_id', $fileId, [
+ 'audio_message_id',
+ $fileId,
+ [
'using' => [
'id',
'name',
@@ -84,7 +88,9 @@ public function initialize($entity = null, $options = null): void
{
// Extension
$extension = new Select(
- 'extension', $options['extensions'], [
+ 'extension',
+ $options['extensions'],
+ [
'using' => [
'id',
'name',
@@ -102,4 +108,4 @@ public function initialize($entity = null, $options = null): void
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/DialplanApplicationEditForm.php b/src/AdminCabinet/Forms/DialplanApplicationEditForm.php
index 26851487c..6e53a4e82 100644
--- a/src/AdminCabinet/Forms/DialplanApplicationEditForm.php
+++ b/src/AdminCabinet/Forms/DialplanApplicationEditForm.php
@@ -1,4 +1,5 @@
add(new Hidden($key));
break;
case "description":
- $this->addTextArea($key, $value??'', 95);
+ $this->addTextArea($key, $value ?? '', 95);
break;
case "type":
$select = new Select(
@@ -52,8 +53,8 @@ public function initialize($entity = null, $options = null): void
[
'php' => $this->translation->_("da_TypePhp"),
'plaintext' => $this->translation->_("da_TypePlaintext"),
- ]
- , [
+ ],
+ [
'using' => [
'id',
'name',
@@ -72,4 +73,4 @@ public function initialize($entity = null, $options = null): void
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/ExtensionEditForm.php b/src/AdminCabinet/Forms/ExtensionEditForm.php
index 5971a3f7d..bde006362 100644
--- a/src/AdminCabinet/Forms/ExtensionEditForm.php
+++ b/src/AdminCabinet/Forms/ExtensionEditForm.php
@@ -1,4 +1,5 @@
add(
new Text(
- 'number', [
+ 'number',
+ [
"data-inputmask" => "'mask': '9{2,$extensionsLength}'",
]
)
@@ -88,7 +89,8 @@ public function initialize($entity = null, $options = null): void
// USER Email
$this->add(
new Text(
- 'user_email', ["value" => $entity->user_email, 'autocomplete' => 'off']
+ 'user_email',
+ ["value" => $entity->user_email, 'autocomplete' => 'off']
)
);
@@ -107,7 +109,8 @@ public function initialize($entity = null, $options = null): void
// SIP Secret
$this->add(
new Text(
- 'sip_secret', [
+ 'sip_secret',
+ [
"value" => $entity->sip_secret,
"class" => "confidential-field",
'autocomplete' => 'off'
@@ -125,7 +128,9 @@ public function initialize($entity = null, $options = null): void
];
$dtmfmode = new Select(
- 'sip_dtmfmode', $arrDTMFType, [
+ 'sip_dtmfmode',
+ $arrDTMFType,
+ [
'using' => [
'id',
'name',
@@ -152,7 +157,9 @@ public function initialize($entity = null, $options = null): void
];
$transport = new Select(
- 'sip_transport', $arrTransport, [
+ 'sip_transport',
+ $arrTransport,
+ [
'using' => [
'id',
'name',
@@ -168,7 +175,9 @@ public function initialize($entity = null, $options = null): void
// SIP Networkfilterid
$networkfilterid = new Select(
- 'sip_networkfilterid', $this->prepareNetworkFilters(), [
+ 'sip_networkfilterid',
+ $this->prepareNetworkFilters(),
+ [
'using' => [
'id',
'name',
@@ -181,7 +190,7 @@ public function initialize($entity = null, $options = null): void
$this->add($networkfilterid);
// SIP Manualattributes
- $this->addTextArea('sip_manualattributes', base64_decode($entity->sip_manualattributes)??'', 80);
+ $this->addTextArea('sip_manualattributes', base64_decode($entity->sip_manualattributes) ?? '', 80);
// EXTERNAL Extension
$this->add(new Text('mobile_number', ["value" => $entity->mobile_number, 'autocomplete' => 'off']));
@@ -203,7 +212,9 @@ public function initialize($entity = null, $options = null): void
// Forwarding
$this->add(
new Select(
- 'fwd_forwarding', $forwardingExtensions, [
+ 'fwd_forwarding',
+ $forwardingExtensions,
+ [
'using' => [
'id',
'name',
@@ -218,7 +229,9 @@ public function initialize($entity = null, $options = null): void
// Forwardingonbusy
$this->add(
new Select(
- 'fwd_forwardingonbusy', $forwardingExtensions, [
+ 'fwd_forwardingonbusy',
+ $forwardingExtensions,
+ [
'using' => [
'id',
'name',
@@ -233,7 +246,9 @@ public function initialize($entity = null, $options = null): void
// Forwardingonunavailable
$this->add(
new Select(
- 'fwd_forwardingonunavailable', $forwardingExtensions, [
+ 'fwd_forwardingonunavailable',
+ $forwardingExtensions,
+ [
'using' => [
'id',
'name',
@@ -249,7 +264,8 @@ public function initialize($entity = null, $options = null): void
$ringDuration = (int)$entity->fwd_ringlength;
$this->add(
new Numeric(
- 'fwd_ringlength', [
+ 'fwd_ringlength',
+ [
"maxlength" => 2,
"style" => "width: 80px;",
"defaultValue" => 120,
@@ -303,4 +319,4 @@ private function prepareNetworkFilters(): array
}
return $arrNetworkFilters;
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/Fail2BanEditForm.php b/src/AdminCabinet/Forms/Fail2BanEditForm.php
index 77d14a0d7..d7cffd7a8 100644
--- a/src/AdminCabinet/Forms/Fail2BanEditForm.php
+++ b/src/AdminCabinet/Forms/Fail2BanEditForm.php
@@ -1,4 +1,5 @@
add(new Numeric($key));
break;
case "whitelist":
- $this->addTextArea($key, $value??'', 95);
+ $this->addTextArea($key, $value ?? '', 95);
break;
default:
$this->add(new Text($key));
@@ -65,4 +65,4 @@ public function initialize($entity = null, $options = null): void
}
$this->add(new Check(PbxSettings::PBX_FAIL2BAN_ENABLED, $cheskarr));
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/FirewallEditForm.php b/src/AdminCabinet/Forms/FirewallEditForm.php
index ebc241aac..e31f7f4ce 100644
--- a/src/AdminCabinet/Forms/FirewallEditForm.php
+++ b/src/AdminCabinet/Forms/FirewallEditForm.php
@@ -1,4 +1,5 @@
[
'id',
'name',
@@ -109,4 +112,4 @@ public function initialize($entity = null, $options = null): void
$this->add(new Check('local_network', $cheskarr));
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/GeneralSettingsEditForm.php b/src/AdminCabinet/Forms/GeneralSettingsEditForm.php
index 4d81b7433..98458f56a 100644
--- a/src/AdminCabinet/Forms/GeneralSettingsEditForm.php
+++ b/src/AdminCabinet/Forms/GeneralSettingsEditForm.php
@@ -1,4 +1,5 @@
add(new Numeric($key, ['value' => $value, 'style'=>'width:130px;']));
+ $this->add(new Numeric($key, ['value' => $value, 'style' => 'width:130px;']));
break;
case PbxSettings::SSH_PASSWORD:
$this->add(new Password($key, ['value' => self::HIDDEN_PASSWORD]));
@@ -97,7 +98,7 @@ public function initialize($entity = null, $options = null): void
case PbxSettings::WEB_HTTPS_PUBLIC_KEY:
case PbxSettings::WEB_HTTPS_PRIVATE_KEY:
case '***ALL TEXTAREA ABOVE***':
- $this->addTextArea($key, $value??'', 65);
+ $this->addTextArea($key, $value ?? '', 65);
break;
case PbxSettings::PBX_LANGUAGE:
$language = new Select(
@@ -119,8 +120,8 @@ public function initialize($entity = null, $options = null): void
'sv-sv' => $this->translation->_('ex_Swedish'),
'cs-cs' => $this->translation->_('ex_Czech'),
'tr-tr' => $this->translation->_('ex_Turkish'),
- ]
- , [
+ ],
+ [
'using' => [
'id',
'name',
@@ -143,8 +144,8 @@ public function initialize($entity = null, $options = null): void
6 => $this->translation->_('gs_SixDigthts'),
7 => $this->translation->_('gs_SevenDigthts'),
11 => $this->translation->_('gs_ElevenDigthts'),
- ]
- , [
+ ],
+ [
'using' => [
'id',
'name',
@@ -156,7 +157,7 @@ public function initialize($entity = null, $options = null): void
);
$this->add($extLength);
break;
- case PbxSettings::PBX_RECORD_ANNOUNCEMENT_IN :
+ case PbxSettings::PBX_RECORD_ANNOUNCEMENT_IN:
case PbxSettings::PBX_RECORD_ANNOUNCEMENT_OUT:
$currentSoundFile = SoundFiles::findFirstById($value);
$selectArray = [];
@@ -166,7 +167,9 @@ public function initialize($entity = null, $options = null): void
// Audio_message_id
$audioMessage = new Select(
- $key, $selectArray, [
+ $key,
+ $selectArray,
+ [
'using' => [
'id',
'name',
@@ -202,4 +205,4 @@ public function initialize($entity = null, $options = null): void
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/IaxProviderEditForm.php b/src/AdminCabinet/Forms/IaxProviderEditForm.php
index 9d50d69f5..4740c8c55 100644
--- a/src/AdminCabinet/Forms/IaxProviderEditForm.php
+++ b/src/AdminCabinet/Forms/IaxProviderEditForm.php
@@ -1,4 +1,5 @@
add(new Check('noregister', $cheskarr));
// Manualattributes
- $this->addTextArea('manualattributes', $entity->getManualAttributes()??'', 80);
+ $this->addTextArea('manualattributes', $entity->getManualAttributes() ?? '', 80);
// Note
- $this->addTextArea('note', $options['note']??'', 80,['class'=>'confidential-field']);
+ $this->addTextArea('note', $options['note'] ?? '', 80, ['class' => 'confidential-field']);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/IncomingRouteEditForm.php b/src/AdminCabinet/Forms/IncomingRouteEditForm.php
index e641481f0..98f541f94 100644
--- a/src/AdminCabinet/Forms/IncomingRouteEditForm.php
+++ b/src/AdminCabinet/Forms/IncomingRouteEditForm.php
@@ -1,4 +1,5 @@
prepareProviders(), [
+ 'provider',
+ $this->prepareProviders(),
+ [
'using' => ['id', 'name'],
'useEmpty' => false,
'class' => 'ui selection dropdown provider-select',
@@ -79,7 +82,9 @@ public function initialize($entity = null, $options = null): void
// Add select dropdown for Extension
$extension = new Select(
- 'extension', $this->prepareForwardingExtensions($entity->extension ?? ''), [
+ 'extension',
+ $this->prepareForwardingExtensions($entity->extension ?? ''),
+ [
'using' => [
'id',
'name',
@@ -92,7 +97,9 @@ public function initialize($entity = null, $options = null): void
// Audio_message_id
$audioMessage = new Select(
- 'audio_message_id', $options['soundfiles'], [
+ 'audio_message_id',
+ $options['soundfiles'],
+ [
'using' => [
'id',
'name',
@@ -127,7 +134,6 @@ private function prepareProviders(): array
$modelType = ucfirst($provider->type);
$provByType = $provider->$modelType;
$providersList[$provByType->uniqid] = $provByType->getRepresent();
-
}
return $providersList;
}
@@ -153,4 +159,4 @@ private function prepareForwardingExtensions(string $extension): array
$forwardingExtensions[$record->number] = $record ? $record->getRepresent() : '';
return $forwardingExtensions;
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/IvrMenuEditForm.php b/src/AdminCabinet/Forms/IvrMenuEditForm.php
index 3e9e9182a..ef28323e8 100644
--- a/src/AdminCabinet/Forms/IvrMenuEditForm.php
+++ b/src/AdminCabinet/Forms/IvrMenuEditForm.php
@@ -1,4 +1,5 @@
add(
new Numeric(
- 'number_of_repeat', [
+ 'number_of_repeat',
+ [
"maxlength" => 2,
"style" => "width: 80px;",
"defaultValue" => 3,
@@ -63,7 +65,8 @@ public function initialize($entity = null, $options = null): void
// Timeout
$this->add(
new Numeric(
- 'timeout', [
+ 'timeout',
+ [
"maxlength" => 2,
"style" => "width: 80px;",
"defaultValue" => 7,
@@ -73,7 +76,9 @@ public function initialize($entity = null, $options = null): void
// Timeoutextension
$extension = new Select(
- 'timeout_extension', $options['extensions'], [
+ 'timeout_extension',
+ $options['extensions'],
+ [
'using' => [
'id',
'name',
@@ -86,7 +91,9 @@ public function initialize($entity = null, $options = null): void
// Audio_message_id
$audioMessage = new Select(
- 'audio_message_id', $options['soundfiles'], [
+ 'audio_message_id',
+ $options['soundfiles'],
+ [
'using' => [
'id',
'name',
@@ -106,7 +113,6 @@ public function initialize($entity = null, $options = null): void
$this->add(new Check('allow_enter_any_internal_extension', $cheskarr));
// Description
- $this->addTextArea('description', $entity->description??'', 65);
-
+ $this->addTextArea('description', $entity->description ?? '', 65);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/LicensingActivateCouponForm.php b/src/AdminCabinet/Forms/LicensingActivateCouponForm.php
index 32b6f2622..cc042fa80 100644
--- a/src/AdminCabinet/Forms/LicensingActivateCouponForm.php
+++ b/src/AdminCabinet/Forms/LicensingActivateCouponForm.php
@@ -1,4 +1,5 @@
add(new Text('coupon'));
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/LicensingChangeLicenseKeyForm.php b/src/AdminCabinet/Forms/LicensingChangeLicenseKeyForm.php
index 66154f687..300e93b75 100644
--- a/src/AdminCabinet/Forms/LicensingChangeLicenseKeyForm.php
+++ b/src/AdminCabinet/Forms/LicensingChangeLicenseKeyForm.php
@@ -1,4 +1,5 @@
add(new Text('licKey', ["value" => $options['licKey']]));
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/LicensingGetKeyForm.php b/src/AdminCabinet/Forms/LicensingGetKeyForm.php
index c2f264f66..a4a945f8e 100644
--- a/src/AdminCabinet/Forms/LicensingGetKeyForm.php
+++ b/src/AdminCabinet/Forms/LicensingGetKeyForm.php
@@ -1,4 +1,5 @@
add(new Numeric('inn'));
$this->add(new Text('telefone'));
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/LoginForm.php b/src/AdminCabinet/Forms/LoginForm.php
index c323e2614..b6e443656 100644
--- a/src/AdminCabinet/Forms/LoginForm.php
+++ b/src/AdminCabinet/Forms/LoginForm.php
@@ -1,4 +1,5 @@
add(new Check('rememberMeCheckBox', ['value' => null]));
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/MailSettingsEditForm.php b/src/AdminCabinet/Forms/MailSettingsEditForm.php
index 8cef9a415..9204e267a 100644
--- a/src/AdminCabinet/Forms/MailSettingsEditForm.php
+++ b/src/AdminCabinet/Forms/MailSettingsEditForm.php
@@ -1,4 +1,5 @@
$value) {
switch ($key) {
- case PbxSettings::MAIL_ENABLE_NOTIFICATIONS :
- case PbxSettings::MAIL_SMTP_USE_TLS :
- case PbxSettings::MAIL_SMTP_CERT_CHECK :
+ case PbxSettings::MAIL_ENABLE_NOTIFICATIONS:
+ case PbxSettings::MAIL_SMTP_USE_TLS:
+ case PbxSettings::MAIL_SMTP_CERT_CHECK:
$cheskarr = ['value' => null];
if ($value) {
$cheskarr = ['checked' => 'checked', 'value' => null];
@@ -50,34 +51,36 @@ public function initialize($entity = null, $options = null): void
$this->add(new Check($key, $cheskarr));
break;
- case PbxSettings::MAIL_TPL_MISSED_CALL_BODY :
- case PbxSettings::MAIL_TPL_MISSED_CALL_FOOTER :
- case PbxSettings::MAIL_TPL_VOICEMAIL_BODY :
- case PbxSettings::MAIL_TPL_VOICEMAIL_FOOTER :
-
+ case PbxSettings::MAIL_TPL_MISSED_CALL_BODY:
+ case PbxSettings::MAIL_TPL_MISSED_CALL_FOOTER:
+ case PbxSettings::MAIL_TPL_VOICEMAIL_BODY:
+ case PbxSettings::MAIL_TPL_VOICEMAIL_FOOTER:
$this->add(
new TextArea(
- $key, [
+ $key,
+ [
'value' => $value,
]
)
);
break;
- case PbxSettings::MAIL_SMTP_PASSWORD :
+ case PbxSettings::MAIL_SMTP_PASSWORD:
$this->add(
new Password(
- $key, [
+ $key,
+ [
'value' => $value,
]
)
);
break;
- default :
+ default:
$this->add(
new Text(
- $key, [
+ $key,
+ [
'value' => $value,
]
)
@@ -85,5 +88,4 @@ public function initialize($entity = null, $options = null): void
}
}
}
-
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/NetworkEditForm.php b/src/AdminCabinet/Forms/NetworkEditForm.php
index 3d2ca1fa2..36fed35a8 100644
--- a/src/AdminCabinet/Forms/NetworkEditForm.php
+++ b/src/AdminCabinet/Forms/NetworkEditForm.php
@@ -1,4 +1,5 @@
add(new Text('gateway', ['class' => 'ipaddress']));
$this->add(new Text('primarydns', ['class' => 'ipaddress']));
$this->add(new Text('secondarydns', ['class' => 'ipaddress']));
- $this->add(new Text('extipaddr', ['placeholder'=>'123.111.123.111']));
- $this->add(new Text('exthostname', ['placeholder'=>'mikopbx.company.com']));
- $this->add(new Numeric(PbxSettings::EXTERNAL_SIP_PORT,
+ $this->add(new Text('extipaddr', ['placeholder' => '123.111.123.111']));
+ $this->add(new Text('exthostname', ['placeholder' => 'mikopbx.company.com']));
+ $this->add(new Numeric(
+ PbxSettings::EXTERNAL_SIP_PORT,
[
- 'placeholder'=>PbxSettings::getDefaultArrayValues()[PbxSettings::EXTERNAL_SIP_PORT],
- 'style'=>'width:130px;',
- 'value'=>PbxSettings::getValueByKey(PbxSettings::EXTERNAL_SIP_PORT)
- ]));
- $this->add(new Numeric(PbxSettings::EXTERNAL_TLS_PORT,
+ 'placeholder' => PbxSettings::getDefaultArrayValues()[PbxSettings::EXTERNAL_SIP_PORT],
+ 'style' => 'width:130px;',
+ 'value' => PbxSettings::getValueByKey(PbxSettings::EXTERNAL_SIP_PORT)
+ ]
+ ));
+ $this->add(new Numeric(
+ PbxSettings::EXTERNAL_TLS_PORT,
[
- 'placeholder'=>PbxSettings::getDefaultArrayValues()[PbxSettings::EXTERNAL_TLS_PORT],
- 'style'=>'width:130px;',
- 'value'=>PbxSettings::getValueByKey(PbxSettings::EXTERNAL_TLS_PORT)
- ]));
+ 'placeholder' => PbxSettings::getDefaultArrayValues()[PbxSettings::EXTERNAL_TLS_PORT],
+ 'style' => 'width:130px;',
+ 'value' => PbxSettings::getValueByKey(PbxSettings::EXTERNAL_TLS_PORT)
+ ]
+ ));
// topology
$cheskArr = ['value' => null];
@@ -81,7 +86,8 @@ public function initialize($entity = null, $options = null): void
foreach ($options['eths'] as $eth) {
$this->add(
new Hidden(
- 'interface_' . $eth->id, [
+ 'interface_' . $eth->id,
+ [
'value' => $eth->interface,
]
)
@@ -89,7 +95,8 @@ public function initialize($entity = null, $options = null): void
$this->add(
new Text(
- 'name_' . $eth->id, [
+ 'name_' . $eth->id,
+ [
'value' => $eth->name,
]
)
@@ -105,7 +112,8 @@ public function initialize($entity = null, $options = null): void
$this->add(
new Text(
- 'ipaddr_' . $eth->id, [
+ 'ipaddr_' . $eth->id,
+ [
'value' => $eth->ipaddr,
'class' => 'ipaddress',
]
@@ -149,7 +157,9 @@ public function initialize($entity = null, $options = null): void
"32" => "32 - 255.255.255.255",
];
$mask = new Select(
- 'subnet_' . $eth->id, $arrMasks, [
+ 'subnet_' . $eth->id,
+ $arrMasks,
+ [
'using' => [
'id',
'name',
@@ -163,7 +173,8 @@ public function initialize($entity = null, $options = null): void
$this->add(
new Numeric(
- 'vlanid_' . $eth->id, [
+ 'vlanid_' . $eth->id,
+ [
'value' => $eth->vlanid,
]
)
@@ -180,7 +191,9 @@ public function initialize($entity = null, $options = null): void
// Selector the internet interface
$internetInterface = new Select(
- 'internet_interface', $arrInterfaces, [
+ 'internet_interface',
+ $arrInterfaces,
+ [
'using' => [
'id',
'name',
@@ -195,7 +208,9 @@ public function initialize($entity = null, $options = null): void
// Template for new lan
$newInterface = new Select(
- 'interface_0', $arrRealInterfaces, [
+ 'interface_0',
+ $arrRealInterfaces,
+ [
'using' => [
'id',
'name',
@@ -206,4 +221,4 @@ public function initialize($entity = null, $options = null): void
);
$this->add($newInterface);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/OutgoingRouteEditForm.php b/src/AdminCabinet/Forms/OutgoingRouteEditForm.php
index 97ea19bbc..74fa5cffb 100644
--- a/src/AdminCabinet/Forms/OutgoingRouteEditForm.php
+++ b/src/AdminCabinet/Forms/OutgoingRouteEditForm.php
@@ -1,4 +1,5 @@
add(new Text('rulename'));
// Note
- $this->addTextArea('note', $entity->note??'', 65);
+ $this->addTextArea('note', $entity->note ?? '', 65);
// Numberbeginswith
$this->add(new Text('numberbeginswith'));
@@ -63,7 +64,9 @@ public function initialize($entity = null, $options = null): void
// Providers
$providers = new Select(
- 'providerid', $options, [
+ 'providerid',
+ $options,
+ [
'using' => [
'id',
'name',
@@ -74,4 +77,4 @@ public function initialize($entity = null, $options = null): void
);
$this->add($providers);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/PbxExtensionModuleSettingsForm.php b/src/AdminCabinet/Forms/PbxExtensionModuleSettingsForm.php
index b759c68e5..c7fe92e02 100644
--- a/src/AdminCabinet/Forms/PbxExtensionModuleSettingsForm.php
+++ b/src/AdminCabinet/Forms/PbxExtensionModuleSettingsForm.php
@@ -1,4 +1,5 @@
add(
new Text(
- 'caption', [
+ 'caption',
+ [
'value' => $this->di->get('translation')->_($options['caption']),
]
)
@@ -70,7 +71,9 @@ public function initialize($entity = null, $options = null): void
$menuGroups = $this->di->getElements()->getMenuGroups();
$groups = new Select(
- 'menu-group', $menuGroups, [
+ 'menu-group',
+ $menuGroups,
+ [
'using' => [
'id',
'name',
@@ -82,4 +85,4 @@ public function initialize($entity = null, $options = null): void
);
$this->add($groups);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/SipProviderEditForm.php b/src/AdminCabinet/Forms/SipProviderEditForm.php
index cd5a1ae74..2a58db505 100644
--- a/src/AdminCabinet/Forms/SipProviderEditForm.php
+++ b/src/AdminCabinet/Forms/SipProviderEditForm.php
@@ -1,4 +1,5 @@
[
'id',
'name',
@@ -100,7 +103,9 @@ public function initialize($entity = null, $options = null): void
$regTypeValue = ($entity->noregister === '0') ? Sip::REG_TYPE_OUTBOUND : Sip::REG_TYPE_NONE;
}
$regType = new Select(
- 'registration_type', $regTypeArray, [
+ 'registration_type',
+ $regTypeArray,
+ [
'using' => [
'id',
'name',
@@ -119,7 +124,9 @@ public function initialize($entity = null, $options = null): void
Sip::TRANSPORT_TLS => Sip::TRANSPORT_TLS,
];
$transport = new Select(
- 'transport', $arrTransport, [
+ 'transport',
+ $arrTransport,
+ [
'using' => [
'id',
'name',
@@ -146,7 +153,7 @@ public function initialize($entity = null, $options = null): void
$this->add(new Check('qualify', $cheskarr));
// Qualifyfreq
- $this->add(new Numeric('qualifyfreq',["maxlength" => 3,
+ $this->add(new Numeric('qualifyfreq', ["maxlength" => 3,
"style" => "width: 80px;"]));
// Fromuser
@@ -177,9 +184,9 @@ public function initialize($entity = null, $options = null): void
$this->add(new Check('receive_calls_without_auth', $cheskarr));
// Manualattributes
- $this->addTextArea('manualattributes', $entity->getManualAttributes()??'', 65);
+ $this->addTextArea('manualattributes', $entity->getManualAttributes() ?? '', 65);
// Note
- $this->addTextArea('note', $options['note']??'', 80, ['class'=>'confidential-field']);
+ $this->addTextArea('note', $options['note'] ?? '', 80, ['class' => 'confidential-field']);
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/SoundFilesEditForm.php b/src/AdminCabinet/Forms/SoundFilesEditForm.php
index 15c0ea69d..255b95a17 100644
--- a/src/AdminCabinet/Forms/SoundFilesEditForm.php
+++ b/src/AdminCabinet/Forms/SoundFilesEditForm.php
@@ -1,4 +1,5 @@
'ui fluid selection search dropdown filenames-select']
+ 'filenames',
+ [],
+ ['class' => 'ui fluid selection search dropdown filenames-select']
);
$this->add($filenames);
$this->add(new Hidden('filename', ['value' => $_REQUEST['filename'] ?? '']));
@@ -48,4 +50,4 @@ public function initialize($entity = null, $options = null): void
$this->add(new Numeric('lines', ['value' => '1500']));
$this->add(new Numeric('offset', ['value' => '0']));
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/TimeFrameEditForm.php b/src/AdminCabinet/Forms/TimeFrameEditForm.php
index f1642225c..12b51f94d 100644
--- a/src/AdminCabinet/Forms/TimeFrameEditForm.php
+++ b/src/AdminCabinet/Forms/TimeFrameEditForm.php
@@ -1,4 +1,5 @@
$value) {
switch ($key) {
- case 'id' :
+ case 'id':
$this->add(new Hidden($key));
break;
- case 'allowRestriction' :
+ case 'allowRestriction':
$cheskarr = ['value' => null];
if ($value) {
$cheskarr = ['checked' => 'checked', 'value' => null];
}
$this->add(new Check('allowRestriction', $cheskarr));
break;
- case 'extension' :
+ case 'extension':
$extension = new Select(
- $key, $options['extensions'], [
+ $key,
+ $options['extensions'],
+ [
'using' => [
'id',
'name',
@@ -64,9 +66,11 @@ public function initialize($entity = null, $options = null): void
);
$this->add($extension);
break;
- case 'audio_message_id' :
+ case 'audio_message_id':
$audiomessageid = new Select(
- $key, $options['audio-message'], [
+ $key,
+ $options['audio-message'],
+ [
'using' => [
'id',
'name',
@@ -77,9 +81,11 @@ public function initialize($entity = null, $options = null): void
);
$this->add($audiomessageid);
break;
- case 'action' :
+ case 'action':
$action = new Select(
- $key, $options['available-actions'], [
+ $key,
+ $options['available-actions'],
+ [
'using' => [
'id',
'name',
@@ -90,7 +96,7 @@ public function initialize($entity = null, $options = null): void
);
$this->add($action);
break;
- case 'calType' :
+ case 'calType':
$calTypeArray = [
OutWorkTimes::CAL_TYPE_NONE => $this->translation->_('tf_CAL_TYPE_NONE'),
OutWorkTimes::CAL_TYPE_CALDAV => $this->translation->_('tf_CAL_TYPE_CALDAV'),
@@ -101,7 +107,9 @@ public function initialize($entity = null, $options = null): void
$value = OutWorkTimes::CAL_TYPE_NONE;
}
$calType = new Select(
- $key, $calTypeArray, [
+ $key,
+ $calTypeArray,
+ [
'using' => [
'id',
'name',
@@ -109,14 +117,16 @@ public function initialize($entity = null, $options = null): void
'useEmpty' => false,
'value' => $value,
'class' => 'ui selection dropdown search',
- ]
+ ]
);
$this->add($calType);
break;
- case 'weekday_from' :
- case 'weekday_to' :
+ case 'weekday_from':
+ case 'weekday_to':
$action = new Select(
- $key, $options['week-days'], [
+ $key,
+ $options['week-days'],
+ [
'using' => [
'id',
'name',
@@ -128,15 +138,15 @@ public function initialize($entity = null, $options = null): void
);
$this->add($action);
break;
- case 'description' :
- $this->addTextArea($key, $value??'', 65);
+ case 'description':
+ $this->addTextArea($key, $value ?? '', 65);
break;
- case 'calSecret' :
+ case 'calSecret':
$this->add(new Password($key, ['value' => $value]));
break;
- default :
+ default:
$this->add(new Text($key, ['autocomplete' => 'off']));
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Forms/TimeSettingsEditForm.php b/src/AdminCabinet/Forms/TimeSettingsEditForm.php
index aa6c0eeb3..1522a5ff8 100644
--- a/src/AdminCabinet/Forms/TimeSettingsEditForm.php
+++ b/src/AdminCabinet/Forms/TimeSettingsEditForm.php
@@ -1,4 +1,5 @@
[
'id',
'name',
@@ -72,7 +75,8 @@ public function initialize($entity = null, $options = null): void
{
$this->add(
new Text(
- $item->key, [
+ $item->key,
+ [
'value' => $item->value,
]
)
@@ -82,6 +86,5 @@ public function initialize($entity = null, $options = null): void
}
$this->add(new Text('ManualDateTime', ['value' => '']));
-
}
-}
\ No newline at end of file
+}
diff --git a/src/AdminCabinet/Library/Cidr.php b/src/AdminCabinet/Library/Cidr.php
index 11ef55dba..628755c9a 100644
--- a/src/AdminCabinet/Library/Cidr.php
+++ b/src/AdminCabinet/Library/Cidr.php
@@ -1,4 +1,5 @@
[
@@ -309,7 +309,7 @@ public function getMenu(): void
$groupHtml .= "