@@ -34,7 +34,9 @@ |
||
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 data for specific entity |
@@ -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 |
@@ -20,13 +20,19 @@ discard block |
||
20 | 20 | |
21 | 21 | # Validate values |
22 | 22 | |
23 | - if (false === ($email = Validate::userEmail($email))) return ['email', 'USER_ERROR_EMAIL_INVALID']; |
|
23 | + if (false === ($email = Validate::userEmail($email))) { |
|
24 | + return ['email', 'USER_ERROR_EMAIL_INVALID']; |
|
25 | + } |
|
24 | 26 | |
25 | 27 | # Check email exists |
26 | 28 | |
27 | - if (false === ($check_email = Auth::user()->check($email, 'email'))) return 'USER_ERROR_EDIT_PERSONAL'; |
|
29 | + if (false === ($check_email = Auth::user()->check($email, 'email'))) { |
|
30 | + return 'USER_ERROR_EDIT_PERSONAL'; |
|
31 | + } |
|
28 | 32 | |
29 | - if ($check_email === 1) return ['email', 'USER_ERROR_EMAIL_DUPLICATE']; |
|
33 | + if ($check_email === 1) { |
|
34 | + return ['email', 'USER_ERROR_EMAIL_DUPLICATE']; |
|
35 | + } |
|
30 | 36 | |
31 | 37 | # Update user |
32 | 38 | |
@@ -40,7 +46,9 @@ discard block |
||
40 | 46 | $data['country'] = $country; |
41 | 47 | $data['timezone'] = $timezone; |
42 | 48 | |
43 | - if (!Auth::user()->edit($data)) return 'USER_ERROR_EDIT_PERSONAL'; |
|
49 | + if (!Auth::user()->edit($data)) { |
|
50 | + return 'USER_ERROR_EDIT_PERSONAL'; |
|
51 | + } |
|
44 | 52 | |
45 | 53 | # ------------------------ |
46 | 54 |
@@ -50,7 +50,9 @@ |
||
50 | 50 | |
51 | 51 | # Display success message |
52 | 52 | |
53 | - if (false !== Request::get('submitted')) Messages::set('success', Language::get('USER_SUCCESS_EDIT')); |
|
53 | + if (false !== Request::get('submitted')) { |
|
54 | + Messages::set('success', Language::get('USER_SUCCESS_EDIT')); |
|
55 | + } |
|
54 | 56 | |
55 | 57 | # ------------------------ |
56 | 58 |