@@ -190,16 +190,16 @@ |
||
190 | 190 | //FIXME: Query duplication. |
191 | 191 | if($this->User->id !== $userID) { |
192 | 192 | $query = $this->db->select("options->\"$.{$option}\" AS value", FALSE) |
193 | - ->from('auth_users') |
|
194 | - ->where('id', $userID) |
|
195 | - ->limit(1); |
|
193 | + ->from('auth_users') |
|
194 | + ->where('id', $userID) |
|
195 | + ->limit(1); |
|
196 | 196 | $data = $query->get()->row_object(); |
197 | 197 | } else { |
198 | 198 | //if(!($data = $this->session->tempdata("option_{$option}"))) { |
199 | 199 | $query = $this->db->select("options->\"$.{$option}\" AS value", FALSE) |
200 | - ->from('auth_users') |
|
201 | - ->where('id', $userID) |
|
202 | - ->limit(1); |
|
200 | + ->from('auth_users') |
|
201 | + ->where('id', $userID) |
|
202 | + ->limit(1); |
|
203 | 203 | $data = $query->get()->row_object(); |
204 | 204 | $this->session->set_tempdata("option_{$option}", $data, 3600); |
205 | 205 | //} |
@@ -237,7 +237,7 @@ |
||
237 | 237 | ); |
238 | 238 | //FIXME: Get a better solution than str_replace for removing special characters |
239 | 239 | $elements = array(); |
240 | - foreach (array_values($this->options[$option]['valid_options']) as $valid_option) { |
|
240 | + foreach(array_values($this->options[$option]['valid_options']) as $valid_option) { |
|
241 | 241 | $elements[$option.'_'.str_replace(',', '_', $valid_option)] = array_merge($base_attributes, array( |
242 | 242 | 'value' => $valid_option |
243 | 243 | )); |
@@ -154,7 +154,9 @@ discard block |
||
154 | 154 | //CI doesn't have any nice way of using the query builder with JSON columns. |
155 | 155 | $sql = 'UPDATE `auth_users` SET `options` = JSON_SET(COALESCE(`options`, \'{}\'), ?, ?) WHERE `id` = ?'; |
156 | 156 | if($success = $this->db->query($sql, ["$.{$option}", $parsedValue, $this->User->id])) { |
157 | - if($success) $this->session->unset_tempdata("option_{$option}"); |
|
157 | + if($success) { |
|
158 | + $this->session->unset_tempdata("option_{$option}"); |
|
159 | + } |
|
158 | 160 | } |
159 | 161 | } |
160 | 162 | } |
@@ -177,7 +179,9 @@ discard block |
||
177 | 179 | } |
178 | 180 | |
179 | 181 | //Overall fallback method. |
180 | - if(!isset($value)) $value = $this->options[$option]['default']; |
|
182 | + if(!isset($value)) { |
|
183 | + $value = $this->options[$option]['default']; |
|
184 | + } |
|
181 | 185 | } else { |
182 | 186 | $value = FALSE; |
183 | 187 | } |
@@ -224,7 +228,10 @@ discard block |
||
224 | 228 | //This should never happen. |
225 | 229 | break; |
226 | 230 | } |
227 | - if(!isset($value)) $value = FALSE; //FIXME: This won't play nice with BOOL type false? |
|
231 | + if(!isset($value)) { |
|
232 | + $value = FALSE; |
|
233 | + } |
|
234 | + //FIXME: This won't play nice with BOOL type false? |
|
228 | 235 | return $value; |
229 | 236 | } |
230 | 237 |