@@ -12,29 +12,29 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->config->add('rank', null, function (int $rank = null) { |
|
15 | + $this->config->add('rank', null, function(int $rank = null) { |
|
16 | 16 | |
17 | - return ((null !== $rank) ? ("ent.rank >= " . $rank) : ''); |
|
17 | + return ((null !== $rank) ? ("ent.rank >= ".$rank) : ''); |
|
18 | 18 | }); |
19 | 19 | |
20 | - $this->config->add('time_registered >=', 0, function (int $time) { |
|
20 | + $this->config->add('time_registered >=', 0, function(int $time) { |
|
21 | 21 | |
22 | - return ((0 < $time) ? ("ent.time_registered >= " . $time) : ''); |
|
22 | + return ((0 < $time) ? ("ent.time_registered >= ".$time) : ''); |
|
23 | 23 | }); |
24 | 24 | |
25 | - $this->config->add('time_registered <=', 0, function (int $time) { |
|
25 | + $this->config->add('time_registered <=', 0, function(int $time) { |
|
26 | 26 | |
27 | - return ((0 < $time) ? ("ent.time_registered <= " . $time) : ''); |
|
27 | + return ((0 < $time) ? ("ent.time_registered <= ".$time) : ''); |
|
28 | 28 | }); |
29 | 29 | |
30 | - $this->config->add('time_logged >=', 0, function (int $time) { |
|
30 | + $this->config->add('time_logged >=', 0, function(int $time) { |
|
31 | 31 | |
32 | - return ((0 < $time) ? ("ent.time_logged >= " . $time) : ''); |
|
32 | + return ((0 < $time) ? ("ent.time_logged >= ".$time) : ''); |
|
33 | 33 | }); |
34 | 34 | |
35 | - $this->config->add('time_logged <=', 0, function (int $time) { |
|
35 | + $this->config->add('time_logged <=', 0, function(int $time) { |
|
36 | 36 | |
37 | - return ((0 < $time) ? ("ent.time_logged <= " . $time) : ''); |
|
37 | + return ((0 < $time) ? ("ent.time_logged <= ".$time) : ''); |
|
38 | 38 | }); |
39 | 39 | } |
40 | 40 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->config->add('active', false, function (bool $active) { |
|
15 | + $this->config->add('active', false, function(bool $active) { |
|
16 | 16 | |
17 | 17 | return ($active ? "ent.active = 1" : ''); |
18 | 18 | }); |
@@ -44,11 +44,15 @@ |
||
44 | 44 | $data['contents'] = $contents; |
45 | 45 | $data['time_modified'] = REQUEST_TIME; |
46 | 46 | |
47 | - if (0 === $this->page->id) $data['time_created'] = REQUEST_TIME; |
|
47 | + if (0 === $this->page->id) { |
|
48 | + $data['time_created'] = REQUEST_TIME; |
|
49 | + } |
|
48 | 50 | |
49 | 51 | $modifier = ((0 === $this->page->id) ? 'create' : 'edit'); |
50 | 52 | |
51 | - if (!$this->page->$modifier($data)) return 'PAGE_ERROR_MODIFY'; |
|
53 | + if (!$this->page->$modifier($data)) { |
|
54 | + return 'PAGE_ERROR_MODIFY'; |
|
55 | + } |
|
52 | 56 | |
53 | 57 | # ------------------------ |
54 | 58 |
@@ -29,9 +29,13 @@ discard block |
||
29 | 29 | |
30 | 30 | # Check name exists |
31 | 31 | |
32 | - if (false === ($check_name = $this->widget->check($name, 'name'))) return 'WIDGET_ERROR_MODIFY'; |
|
32 | + if (false === ($check_name = $this->widget->check($name, 'name'))) { |
|
33 | + return 'WIDGET_ERROR_MODIFY'; |
|
34 | + } |
|
33 | 35 | |
34 | - if ($check_name === 1) return ['name', 'WIDGET_ERROR_NAME_DUPLICATE']; |
|
36 | + if ($check_name === 1) { |
|
37 | + return ['name', 'WIDGET_ERROR_NAME_DUPLICATE']; |
|
38 | + } |
|
35 | 39 | |
36 | 40 | # Modify widget |
37 | 41 | |
@@ -44,7 +48,9 @@ discard block |
||
44 | 48 | |
45 | 49 | $modifier = ((0 === $this->widget->id) ? 'create' : 'edit'); |
46 | 50 | |
47 | - if (!$this->widget->$modifier($data)) return 'WIDGET_ERROR_MODIFY'; |
|
51 | + if (!$this->widget->$modifier($data)) { |
|
52 | + return 'WIDGET_ERROR_MODIFY'; |
|
53 | + } |
|
48 | 54 | |
49 | 55 | # ------------------------ |
50 | 56 |
@@ -29,9 +29,13 @@ discard block |
||
29 | 29 | |
30 | 30 | # Check name exists |
31 | 31 | |
32 | - if (false === ($check_name = $this->variable->check($name, 'name'))) return 'VARIABLE_ERROR_MODIFY'; |
|
32 | + if (false === ($check_name = $this->variable->check($name, 'name'))) { |
|
33 | + return 'VARIABLE_ERROR_MODIFY'; |
|
34 | + } |
|
33 | 35 | |
34 | - if ($check_name === 1) return ['name', 'VARIABLE_ERROR_NAME_DUPLICATE']; |
|
36 | + if ($check_name === 1) { |
|
37 | + return ['name', 'VARIABLE_ERROR_NAME_DUPLICATE']; |
|
38 | + } |
|
35 | 39 | |
36 | 40 | # Modify variable |
37 | 41 | |
@@ -43,7 +47,9 @@ discard block |
||
43 | 47 | |
44 | 48 | $modifier = ((0 === $this->variable->id) ? 'create' : 'edit'); |
45 | 49 | |
46 | - if (!$this->variable->$modifier($data)) return 'VARIABLE_ERROR_MODIFY'; |
|
50 | + if (!$this->variable->$modifier($data)) { |
|
51 | + return 'VARIABLE_ERROR_MODIFY'; |
|
52 | + } |
|
47 | 53 | |
48 | 54 | # ------------------------ |
49 | 55 |
@@ -34,14 +34,18 @@ |
||
34 | 34 | |
35 | 35 | $parent->block('browse')->disable(); $parent->block('browse_disabled')->enable(); |
36 | 36 | |
37 | - } else $parent->block('browse')->link = $this->parent->link; |
|
37 | + } else { |
|
38 | + $parent->block('browse')->link = $this->parent->link; |
|
39 | + } |
|
38 | 40 | } |
39 | 41 | |
40 | 42 | # Add additional parent data for specific entity |
41 | 43 | |
42 | 44 | protected function processEntity(Template\Asset\Block $contents) { |
43 | 45 | |
44 | - if (!$this->create && $this->parent->locked) $contents->block('locked')->enable(); |
|
46 | + if (!$this->create && $this->parent->locked) { |
|
47 | + $contents->block('locked')->enable(); |
|
48 | + } |
|
45 | 49 | } |
46 | 50 | } |
47 | 51 | } |
@@ -28,7 +28,9 @@ |
||
28 | 28 | |
29 | 29 | protected function processEntity(Template\Asset\Block $contents) { |
30 | 30 | |
31 | - if ($this->create) $contents->block('info')->disable(); else { |
|
31 | + if ($this->create) { |
|
32 | + $contents->block('info')->disable(); |
|
33 | + } else { |
|
32 | 34 | |
33 | 35 | $contents->block('info')->time_registered = Date::get(DATE_FORMAT_DATETIME, $this->entity->time_registered); |
34 | 36 |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | # Check for demo mode |
14 | 14 | |
15 | - if (Informer::isDemoMode()) return 'DEMO_MODE_RESTRICTION'; |
|
15 | + if (Informer::isDemoMode()) { |
|
16 | + return 'DEMO_MODE_RESTRICTION'; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # Define errors list |
18 | 20 | |
@@ -23,13 +25,17 @@ discard block |
||
23 | 25 | |
24 | 26 | # Process post data |
25 | 27 | |
26 | - foreach ($post as $name => $value) if (!Settings::set($name, $value)) |
|
28 | + foreach ($post as $name => $value) { |
|
29 | + if (!Settings::set($name, $value)) |
|
27 | 30 | |
28 | 31 | return (isset($errors[$name]) ? [$name, $errors[$name]] : false); |
32 | + } |
|
29 | 33 | |
30 | 34 | # Save settings |
31 | 35 | |
32 | - if (!Settings::save()) return 'SETTINGS_ERROR_SAVE'; |
|
36 | + if (!Settings::save()) { |
|
37 | + return 'SETTINGS_ERROR_SAVE'; |
|
38 | + } |
|
33 | 39 | |
34 | 40 | # ------------------------ |
35 | 41 |
@@ -20,23 +20,28 @@ discard block |
||
20 | 20 | |
21 | 21 | # Validate values |
22 | 22 | |
23 | - if (false === ($password = Validate::userPassword($password))) |
|
24 | - |
|
23 | + if (false === ($password = Validate::userPassword($password))) { |
|
24 | + |
|
25 | 25 | return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
26 | + } |
|
26 | 27 | |
27 | - if (false === ($password_new = Validate::userPassword($password_new))) |
|
28 | - |
|
28 | + if (false === ($password_new = Validate::userPassword($password_new))) { |
|
29 | + |
|
29 | 30 | return ['password_new', 'USER_ERROR_PASSWORD_NEW_INVALID']; |
31 | + } |
|
30 | 32 | |
31 | - if (0 !== strcmp($password_new, $password_retype)) |
|
32 | - |
|
33 | + if (0 !== strcmp($password_new, $password_retype)) { |
|
34 | + |
|
33 | 35 | return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH']; |
36 | + } |
|
34 | 37 | |
35 | 38 | # Check password |
36 | 39 | |
37 | 40 | $password = Str::encode(Auth::user()->auth_key, $password); |
38 | 41 | |
39 | - if (0 !== strcmp(Auth::user()->password, $password)) return ['password', 'USER_ERROR_PASSWORD_INCORRECT']; |
|
42 | + if (0 !== strcmp(Auth::user()->password, $password)) { |
|
43 | + return ['password', 'USER_ERROR_PASSWORD_INCORRECT']; |
|
44 | + } |
|
40 | 45 | |
41 | 46 | # Encode password |
42 | 47 | |
@@ -49,7 +54,9 @@ discard block |
||
49 | 54 | $data['auth_key'] = $auth_key; |
50 | 55 | $data['password'] = $password; |
51 | 56 | |
52 | - if (!Auth::user()->edit($data)) return 'USER_ERROR_EDIT_PASSWORD'; |
|
57 | + if (!Auth::user()->edit($data)) { |
|
58 | + return 'USER_ERROR_EDIT_PASSWORD'; |
|
59 | + } |
|
53 | 60 | |
54 | 61 | # ------------------------ |
55 | 62 |