@@ -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 |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | |
65 | 65 | $query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") . |
66 | 66 | |
67 | - ("FROM " . static::$table . " ent ") . |
|
67 | + ("FROM " . static::$table . " ent ") . |
|
68 | 68 | |
69 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
69 | + ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
70 | 70 | |
71 | - ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::user()->rank . " AND ") . |
|
71 | + ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::user()->rank . " AND ") . |
|
72 | 72 | |
73 | - ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
73 | + ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
74 | 74 | |
75 | 75 | # Select entity from DB |
76 | 76 | |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | |
92 | 92 | $query = ("UPDATE " . static::$table . " ent JOIN (") . |
93 | 93 | |
94 | - ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
94 | + ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
95 | 95 | |
96 | - ("FROM " . static::$table_relations . " rel ") . |
|
96 | + ("FROM " . static::$table_relations . " rel ") . |
|
97 | 97 | |
98 | - ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
98 | + ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
99 | 99 | |
100 | - ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
100 | + ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
101 | 101 | |
102 | - ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
102 | + ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
103 | 103 | |
104 | - (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
|
104 | + (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
|
105 | 105 | |
106 | 106 | if (!(DB::send($query) && DB::last()->status)) return false; |
107 | 107 | |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | |
110 | 110 | $query = ("UPDATE " . static::$table . " ent JOIN (") . |
111 | 111 | |
112 | - ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
112 | + ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
113 | 113 | |
114 | - ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
114 | + ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
115 | 115 | |
116 | - ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
116 | + ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
117 | 117 | |
118 | - ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
118 | + ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
119 | 119 | |
120 | - (") chk ON chk.id = ent.id SET ent.locked = 0"); |
|
120 | + (") chk ON chk.id = ent.id SET ent.locked = 0"); |
|
121 | 121 | |
122 | 122 | if (!(DB::send($query) && DB::last()->status)) return false; |
123 | 123 |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Entity { |
4 | 4 | |
5 | - use Modules\Auth, Modules\Entitizer, DB; |
|
5 | + use Modules\Auth; |
|
6 | + use Modules\Entitizer; |
|
7 | + use DB; |
|
6 | 8 | |
7 | 9 | class Page extends Entitizer\Utils\Entity { |
8 | 10 |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | |
23 | 23 | $selection = array_keys($this->definition->params()); |
24 | 24 | |
25 | - foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field); |
|
25 | + foreach ($selection as $key => $field) $selection[$key] = ('ent.'.$field); |
|
26 | 26 | |
27 | 27 | # Process query |
28 | 28 | |
29 | - $query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") . |
|
29 | + $query = ("SELECT ".implode(', ', $selection).", rel.ancestor as parent_id "). |
|
30 | 30 | |
31 | - ("FROM " . static::$table . " ent ") . |
|
31 | + ("FROM ".static::$table." ent "). |
|
32 | 32 | |
33 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
33 | + ("LEFT JOIN ".static::$table_relations." rel ON rel.descendant = ent.id AND rel.depth = 1 "). |
|
34 | 34 | |
35 | - ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::user()->rank . " AND ") . |
|
35 | + ("WHERE ent.visibility = ".VISIBILITY_PUBLISHED." AND ent.access <= ".Auth::user()->rank." AND "). |
|
36 | 36 | |
37 | - ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
37 | + ("ent.locked = 0 AND ent.slug = '".addslashes($slug)."' LIMIT 1"); |
|
38 | 38 | |
39 | 39 | # Select entity from DB |
40 | 40 | |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | |
54 | 54 | # Send lock/update request |
55 | 55 | |
56 | - $query = ("UPDATE " . static::$table . " ent JOIN (") . |
|
56 | + $query = ("UPDATE ".static::$table." ent JOIN ("). |
|
57 | 57 | |
58 | - ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
58 | + ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug "). |
|
59 | 59 | |
60 | - ("FROM " . static::$table_relations . " rel ") . |
|
60 | + ("FROM ".static::$table_relations." rel "). |
|
61 | 61 | |
62 | - ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
62 | + ("JOIN ".static::$table_relations." rls ON rls.descendant = rel.descendant "). |
|
63 | 63 | |
64 | - ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
64 | + ("JOIN ".static::$table." ens ON ens.id = rls.ancestor "). |
|
65 | 65 | |
66 | - ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
66 | + ("WHERE rel.ancestor = ".$this->id." GROUP BY rel.descendant"). |
|
67 | 67 | |
68 | 68 | (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
69 | 69 | |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | |
72 | 72 | # Send unlock request |
73 | 73 | |
74 | - $query = ("UPDATE " . static::$table . " ent JOIN (") . |
|
74 | + $query = ("UPDATE ".static::$table." ent JOIN ("). |
|
75 | 75 | |
76 | - ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
76 | + ("SELECT rel.descendant as id FROM ".static::$table_relations." rel "). |
|
77 | 77 | |
78 | - ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
78 | + ("JOIN ".static::$table." enc ON enc.id = rel.descendant AND enc.locked = 1 "). |
|
79 | 79 | |
80 | - ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
80 | + ("LEFT JOIN ".static::$table." end ON end.id != enc.id AND end.slug = enc.slug "). |
|
81 | 81 | |
82 | - ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
82 | + ("WHERE end.id IS NULL GROUP BY rel.descendant"). |
|
83 | 83 | |
84 | 84 | (") chk ON chk.id = ent.id SET ent.locked = 0"); |
85 | 85 |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | public function initBySlug(string $slug) { |
14 | 14 | |
15 | - if (0 !== $this->id) return false; |
|
15 | + if (0 !== $this->id) { |
|
16 | + return false; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # Process value |
18 | 20 | |
@@ -22,7 +24,9 @@ discard block |
||
22 | 24 | |
23 | 25 | $selection = array_keys($this->definition->params()); |
24 | 26 | |
25 | - foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field); |
|
27 | + foreach ($selection as $key => $field) { |
|
28 | + $selection[$key] = ('ent.' . $field); |
|
29 | + } |
|
26 | 30 | |
27 | 31 | # Process query |
28 | 32 | |
@@ -38,7 +42,9 @@ discard block |
||
38 | 42 | |
39 | 43 | # Select entity from DB |
40 | 44 | |
41 | - if (!(DB::send($query) && (DB::last()->rows === 1))) return false; |
|
45 | + if (!(DB::send($query) && (DB::last()->rows === 1))) { |
|
46 | + return false; |
|
47 | + } |
|
42 | 48 | |
43 | 49 | # ------------------------ |
44 | 50 | |
@@ -49,7 +55,9 @@ discard block |
||
49 | 55 | |
50 | 56 | public function updateSlugs() { |
51 | 57 | |
52 | - if (0 === $this->id) return false; |
|
58 | + if (0 === $this->id) { |
|
59 | + return false; |
|
60 | + } |
|
53 | 61 | |
54 | 62 | # Send lock/update request |
55 | 63 | |
@@ -67,7 +75,9 @@ discard block |
||
67 | 75 | |
68 | 76 | (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
69 | 77 | |
70 | - if (!(DB::send($query) && DB::last()->status)) return false; |
|
78 | + if (!(DB::send($query) && DB::last()->status)) { |
|
79 | + return false; |
|
80 | + } |
|
71 | 81 | |
72 | 82 | # Send unlock request |
73 | 83 | |
@@ -83,7 +93,9 @@ discard block |
||
83 | 93 | |
84 | 94 | (") chk ON chk.id = ent.id SET ent.locked = 0"); |
85 | 95 | |
86 | - if (!(DB::send($query) && DB::last()->status)) return false; |
|
96 | + if (!(DB::send($query) && DB::last()->status)) { |
|
97 | + return false; |
|
98 | + } |
|
87 | 99 | |
88 | 100 | # ------------------------ |
89 | 101 | |
@@ -94,7 +106,9 @@ discard block |
||
94 | 106 | |
95 | 107 | public function create(array $data) { |
96 | 108 | |
97 | - if (!parent::create($data)) return false; |
|
109 | + if (!parent::create($data)) { |
|
110 | + return false; |
|
111 | + } |
|
98 | 112 | |
99 | 113 | $this->updateSlugs(); |
100 | 114 | |
@@ -107,7 +121,9 @@ discard block |
||
107 | 121 | |
108 | 122 | public function edit(array $data) { |
109 | 123 | |
110 | - if (!parent::edit($data)) return false; |
|
124 | + if (!parent::edit($data)) { |
|
125 | + return false; |
|
126 | + } |
|
111 | 127 | |
112 | 128 | $this->updateSlugs(); |
113 | 129 | |
@@ -120,7 +136,9 @@ discard block |
||
120 | 136 | |
121 | 137 | public function move(int $parent_id) { |
122 | 138 | |
123 | - if (!parent::move($parent_id)) return false; |
|
139 | + if (!parent::move($parent_id)) { |
|
140 | + return false; |
|
141 | + } |
|
124 | 142 | |
125 | 143 | $this->updateSlugs(); |
126 | 144 |
@@ -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 |
@@ -32,7 +32,9 @@ |
||
32 | 32 | |
33 | 33 | $parent->block('browse')->disable(); $parent->block('browse_disabled')->enable(); |
34 | 34 | |
35 | - } else $parent->block('browse')->link = $this->parent->link; |
|
35 | + } else { |
|
36 | + $parent->block('browse')->link = $this->parent->link; |
|
37 | + } |
|
36 | 38 | } |
37 | 39 | |
38 | 40 | # Add item additional data |
@@ -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 |
@@ -37,7 +37,9 @@ discard block |
||
37 | 37 | |
38 | 38 | public static function __autoload() { |
39 | 39 | |
40 | - if (self::$loaded || empty($host = getenv('HTTP_HOST'))) return; |
|
40 | + if (self::$loaded || empty($host = getenv('HTTP_HOST'))) { |
|
41 | + return; |
|
42 | + } |
|
41 | 43 | |
42 | 44 | self::$settings['system_url'] = ((Request::isSecure() ? 'https://' : 'http://') . $host); |
43 | 45 | |
@@ -52,7 +54,9 @@ discard block |
||
52 | 54 | |
53 | 55 | self::$loaded = (false !== ($settings = Explorer::json($settings_file))); |
54 | 56 | |
55 | - if (self::$loaded) foreach ($settings as $name => $value) self::set($name, $value); |
|
57 | + if (self::$loaded) { |
|
58 | + foreach ($settings as $name => $value) self::set($name, $value); |
|
59 | + } |
|
56 | 60 | |
57 | 61 | # ------------------------ |
58 | 62 | |
@@ -65,9 +69,13 @@ discard block |
||
65 | 69 | |
66 | 70 | $settings_file = (DIR_SYSTEM_DATA . 'Settings.json'); |
67 | 71 | |
68 | - if (false === ($settings = json_encode(self::$settings, JSON_PRETTY_PRINT))) return false; |
|
72 | + if (false === ($settings = json_encode(self::$settings, JSON_PRETTY_PRINT))) { |
|
73 | + return false; |
|
74 | + } |
|
69 | 75 | |
70 | - if (false === Explorer::save($settings_file, $settings, true)) return false; |
|
76 | + if (false === Explorer::save($settings_file, $settings, true)) { |
|
77 | + return false; |
|
78 | + } |
|
71 | 79 | |
72 | 80 | # ------------------------ |
73 | 81 | |
@@ -85,34 +93,44 @@ discard block |
||
85 | 93 | |
86 | 94 | public static function set(string $name, $value) { |
87 | 95 | |
88 | - if (!isset(self::$settings[$name]) || !is_scalar($value)) return false; |
|
96 | + if (!isset(self::$settings[$name]) || !is_scalar($value)) { |
|
97 | + return false; |
|
98 | + } |
|
89 | 99 | |
90 | 100 | # Validate language |
91 | 101 | |
92 | 102 | if (($name === 'admin_language') || ($name === 'site_language')) { |
93 | 103 | |
94 | - if (false === ($value = Extend\Languages::validate($value))) return false; |
|
104 | + if (false === ($value = Extend\Languages::validate($value))) { |
|
105 | + return false; |
|
106 | + } |
|
95 | 107 | } |
96 | 108 | |
97 | 109 | # Validate template |
98 | 110 | |
99 | 111 | else if (($name === 'admin_template') || ($name === 'site_template')) { |
100 | 112 | |
101 | - if (false === ($value = Extend\Templates::validate($value))) return false; |
|
113 | + if (false === ($value = Extend\Templates::validate($value))) { |
|
114 | + return false; |
|
115 | + } |
|
102 | 116 | } |
103 | 117 | |
104 | 118 | # Validate site title |
105 | 119 | |
106 | 120 | else if ($name === 'site_title') { |
107 | 121 | |
108 | - if ('' === ($value = strval($value))) return false; |
|
122 | + if ('' === ($value = strval($value))) { |
|
123 | + return false; |
|
124 | + } |
|
109 | 125 | } |
110 | 126 | |
111 | 127 | # Validate site status |
112 | 128 | |
113 | 129 | else if ($name === 'site_status') { |
114 | 130 | |
115 | - if (false === ($value = Range\Status::validate($value))) return false; |
|
131 | + if (false === ($value = Range\Status::validate($value))) { |
|
132 | + return false; |
|
133 | + } |
|
116 | 134 | } |
117 | 135 | |
118 | 136 | # Validate site slogan/description/keywords |
@@ -126,21 +144,27 @@ discard block |
||
126 | 144 | |
127 | 145 | else if ($name === 'system_url') { |
128 | 146 | |
129 | - if (false === ($value = Validate::url($value))) return false; |
|
147 | + if (false === ($value = Validate::url($value))) { |
|
148 | + return false; |
|
149 | + } |
|
130 | 150 | } |
131 | 151 | |
132 | 152 | # Validate system email |
133 | 153 | |
134 | 154 | else if ($name === 'system_email') { |
135 | 155 | |
136 | - if (false === ($value = Validate::email($value))) return false; |
|
156 | + if (false === ($value = Validate::email($value))) { |
|
157 | + return false; |
|
158 | + } |
|
137 | 159 | } |
138 | 160 | |
139 | 161 | # Validate system timezone |
140 | 162 | |
141 | 163 | else if ($name === 'system_timezone') { |
142 | 164 | |
143 | - if (false === ($value = Timezone::validate($value))) return false; |
|
165 | + if (false === ($value = Timezone::validate($value))) { |
|
166 | + return false; |
|
167 | + } |
|
144 | 168 | } |
145 | 169 | |
146 | 170 | # Validate users registration |
@@ -163,7 +187,9 @@ discard block |
||
163 | 187 | |
164 | 188 | public static function get(string $name = null) { |
165 | 189 | |
166 | - if (null === $name) return self::$settings; |
|
190 | + if (null === $name) { |
|
191 | + return self::$settings; |
|
192 | + } |
|
167 | 193 | |
168 | 194 | return (isset(self::$settings[$name]) ? self::$settings[$name] : null); |
169 | 195 | } |
@@ -40,7 +40,9 @@ |
||
40 | 40 | |
41 | 41 | # Display success message |
42 | 42 | |
43 | - if (false !== Request::get('submitted')) Popup::set('positive', Language::get('SETTINGS_SUCCESS')); |
|
43 | + if (false !== Request::get('submitted')) { |
|
44 | + Popup::set('positive', Language::get('SETTINGS_SUCCESS')); |
|
45 | + } |
|
44 | 46 | |
45 | 47 | # ------------------------ |
46 | 48 |
@@ -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 |