@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | if ($result) { |
51 | 51 | $this->Flash->success(__d('community', 'The group has been saved.')); |
52 | 52 | return $this->App->redirect([ |
53 | - 'apply' => ['action' => 'edit', $result->id], |
|
53 | + 'apply' => [ 'action' => 'edit', $result->id ], |
|
54 | 54 | ]); |
55 | 55 | } else { |
56 | 56 | $this->Flash->error(__d('community', 'The group could not be saved. Please, try again.')); |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | public function edit($id) |
87 | 87 | { |
88 | 88 | /** @var Group $group */ |
89 | - $group = $this->Groups->get($id, ['contain' => []]); |
|
90 | - if ($this->request->is(['patch', 'post', 'put'])) { |
|
89 | + $group = $this->Groups->get($id, [ 'contain' => [ ] ]); |
|
90 | + if ($this->request->is([ 'patch', 'post', 'put' ])) { |
|
91 | 91 | $group = $this->Groups->patchEntity($group, $this->request->getData()); |
92 | 92 | if ($result = $this->Groups->save($group)) { |
93 | 93 | $this->Flash->success(__d('community', 'The group has been updated.')); |
94 | 94 | return $this->App->redirect([ |
95 | - 'apply' => ['action' => 'edit', $result->id] |
|
95 | + 'apply' => [ 'action' => 'edit', $result->id ] |
|
96 | 96 | ]); |
97 | 97 | } else { |
98 | 98 | $this->Flash->error(__d('community', 'The group could not be updated. Please, try again.')); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | /** |
38 | 38 | * Edit action. |
39 | 39 | * |
40 | - * @return mixed |
|
40 | + * @return \Cake\Http\Response|null |
|
41 | 41 | * |
42 | 42 | * @throws RolledbackTransactionException |
43 | 43 | */ |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $result->get('login') |
64 | 64 | ))); |
65 | 65 | |
66 | - return $this->App->redirect(['apply' => ['action' => 'edit', $result->id]]); |
|
66 | + return $this->App->redirect([ 'apply' => [ 'action' => 'edit', $result->id ] ]); |
|
67 | 67 | } else { |
68 | 68 | $this->Flash->error(__d('community', 'User could not be updated. Please, try again.')); |
69 | 69 | } |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function changePassword($id = null) |
86 | 86 | { |
87 | - $user = $this->Users->get($id, ['contain' => []]); |
|
87 | + $user = $this->Users->get($id, [ 'contain' => [ ] ]); |
|
88 | 88 | $user->set('password', null); |
89 | 89 | |
90 | - if ($this->request->is(['patch', 'post', 'put'])) { |
|
90 | + if ($this->request->is([ 'patch', 'post', 'put' ])) { |
|
91 | 91 | $user = $this->Users->patchEntity($user, $this->request->getData()); |
92 | 92 | if ($result = $this->Users->save($user)) { |
93 | 93 | $this->Flash->success(__d('community', 'Password has been updated.')); |
94 | - return $this->App->redirect(['apply' => ['action' => 'edit', $result->id]]); |
|
94 | + return $this->App->redirect([ 'apply' => [ 'action' => 'edit', $result->id ] ]); |
|
95 | 95 | } else { |
96 | 96 | $this->Flash->error(__d('community', 'Password could not be updated. Please, try again.')); |
97 | 97 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $user = $this->Users->get($id); |
119 | 119 | $groups = $this->Users->Groups->getTreeList(); |
120 | 120 | |
121 | - if ($this->request->is(['patch', 'post', 'put'])) { |
|
121 | + if ($this->request->is([ 'patch', 'post', 'put' ])) { |
|
122 | 122 | $group = $this->Users->patchEntity($user, $this->request->getData()); |
123 | 123 | if ($result = $this->Users->save($group)) { |
124 | 124 | $this->Flash->success(__d('community', 'The user {0} has been saved.', sprintf( |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $result->get('login') |
127 | 127 | ))); |
128 | 128 | return $this->App->redirect([ |
129 | - 'apply' => ['action' => 'edit', $result->id] |
|
129 | + 'apply' => [ 'action' => 'edit', $result->id ] |
|
130 | 130 | ]); |
131 | 131 | } else { |
132 | 132 | $this->Flash->error(__d('community', 'User could not be updated. Please, try again.')); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | public function initialize() |
170 | 170 | { |
171 | 171 | parent::initialize(); |
172 | - $this->Security->setConfig('unlockedFields', ['password', 'password_confirm']); |
|
172 | + $this->Security->setConfig('unlockedFields', [ 'password', 'password_confirm' ]); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param array|\ArrayAccess $options The options to use when saving. |
73 | 73 | * @return \Cake\Datasource\EntityInterface|false |
74 | 74 | */ |
75 | - public function save(EntityInterface $entity, $options = []) |
|
75 | + public function save(EntityInterface $entity, $options = [ ]) |
|
76 | 76 | { |
77 | 77 | EventManager::trigger('Model.User.beforeSave', $this, [ |
78 | 78 | 'user' => $entity |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | 'message' => __d('community', 'User with this login already exists.') |
106 | 106 | ]) |
107 | 107 | ->add('login', 'length', [ |
108 | - 'rule' => ['minLength', MIN_LENGTH_LOGIN], |
|
108 | + 'rule' => [ 'minLength', MIN_LENGTH_LOGIN ], |
|
109 | 109 | 'message' => __d('community', 'The minimum login length must be {0} characters', MIN_LENGTH_LOGIN) |
110 | 110 | ]); |
111 | 111 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | 'message' => __d('community', 'User with this alias already exists.') |
119 | 119 | ]) |
120 | 120 | ->add('slug', 'length', [ |
121 | - 'rule' => ['minLength', MIN_LENGTH_LOGIN], |
|
121 | + 'rule' => [ 'minLength', MIN_LENGTH_LOGIN ], |
|
122 | 122 | 'message' => __d('community', 'The minimum alias length must be {0} characters', MIN_LENGTH_LOGIN) |
123 | 123 | ]); |
124 | 124 | |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | $validator |
143 | 143 | ->notEmpty('password', __d('community', 'Please, enter you password.')) |
144 | 144 | ->add('password', 'minLength', [ |
145 | - 'rule' => ['minLength', MIN_LENGTH_PASS], |
|
145 | + 'rule' => [ 'minLength', MIN_LENGTH_PASS ], |
|
146 | 146 | 'message' => __d('community', 'The minimum password length is {0}', MIN_LENGTH_PASS) |
147 | 147 | ]); |
148 | 148 | |
149 | 149 | $validator |
150 | 150 | ->notEmpty('password_confirm', __d('community', 'Please, confirm you password.')) |
151 | 151 | ->add('password_confirm', 'no-misspelling', [ |
152 | - 'rule' => ['compareWith', 'password'], |
|
152 | + 'rule' => [ 'compareWith', 'password' ], |
|
153 | 153 | 'message' => __d('community', 'Passwords are not equal') |
154 | 154 | ]); |
155 | 155 |
@@ -16,9 +16,9 @@ |
||
16 | 16 | use Cake\Routing\Router; |
17 | 17 | use Cake\Routing\RouteBuilder; |
18 | 18 | |
19 | -Router::plugin('Community', ['path' => '/'], function (RouteBuilder $routeBuilder) { |
|
20 | - $routeBuilder->prefix('admin', function (RouteBuilder $routeBuilder) { |
|
21 | - $routeBuilder->connect('/community/:controller/:action/*', []); |
|
19 | +Router::plugin('Community', [ 'path' => '/' ], function(RouteBuilder $routeBuilder) { |
|
20 | + $routeBuilder->prefix('admin', function(RouteBuilder $routeBuilder) { |
|
21 | + $routeBuilder->connect('/community/:controller/:action/*', [ ]); |
|
22 | 22 | }); |
23 | 23 | |
24 | 24 | $routeBuilder->connect('profile/:action/*', [ |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | $result = $this->Users->save($user); |
59 | 59 | if ($result) { |
60 | - EventManager::trigger('Controller.Users.successActivate', $this, ['user' => $result]); |
|
60 | + EventManager::trigger('Controller.Users.successActivate', $this, [ 'user' => $result ]); |
|
61 | 61 | $this->Flash->success(__d( |
62 | 62 | 'community', |
63 | 63 | '«{0}», you profile has been activate successfully.', |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | - return $this->redirect(['action' => 'login']); |
|
75 | + return $this->redirect([ 'action' => 'login' ]); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | throw new BadRequestException(__d('community', 'User was not found')); |
100 | 100 | } |
101 | 101 | |
102 | - if ($this->request->is(['patch', 'post', 'put'])) { |
|
102 | + if ($this->request->is([ 'patch', 'post', 'put' ])) { |
|
103 | 103 | $entity = $this->Users->patchEntity($user, $this->request->getData()); |
104 | 104 | if ($user->status) { |
105 | 105 | $entity->set('token', null); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | ]); |
123 | 123 | } |
124 | 124 | |
125 | - return $this->redirect(['action' => 'login']); |
|
125 | + return $this->redirect([ 'action' => 'login' ]); |
|
126 | 126 | } else { |
127 | 127 | $this->Flash->error(__d('community', 'An error has occurred. Please, try again.')); |
128 | 128 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * See https://book.cakephp.org/3.0/ru/orm/behaviors/tree.html |
35 | 35 | * @return \Cake\ORM\Query |
36 | 36 | */ |
37 | - public function getTreeList(array $options = []) |
|
37 | + public function getTreeList(array $options = [ ]) |
|
38 | 38 | { |
39 | 39 | $options = Hash::merge([ |
40 | 40 | 'lft' => 'ASC', |