Completed
Push — master ( 2a0848...d60430 )
by
unknown
02:28
created
assets/lib/MODxAPI/modUsers.php 2 patches
Braces   +104 added lines, -100 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 /**
5 5
  * Class modUsers
6 6
  */
7
-class modUsers extends MODxAPI
8
-{
7
+class modUsers extends MODxAPI
8
+{
9 9
     /**
10 10
      * @var array
11 11
      */
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
      * @param $key
58 58
      * @return bool
59 59
      */
60
-    public function issetField($key)
61
-    {
60
+    public function issetField($key)
61
+    {
62 62
         return (array_key_exists($key, $this->default_field['user']) || array_key_exists($key,
63 63
                 $this->default_field['attribute']) || in_array($key, $this->default_field['hidden']));
64 64
     }
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
      * @param string $data
68 68
      * @return string|false
69 69
      */
70
-    protected function findUser($data)
71
-    {
72
-        switch (true) {
70
+    protected function findUser($data)
71
+    {
72
+        switch (true) {
73 73
             case (is_int($data) || ((int)$data > 0 && (string)intval($data) === $data)):
74 74
                 $find = 'attribute.internalKey';
75 75
                 break;
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
      * @param array $data
91 91
      * @return $this
92 92
      */
93
-    public function create($data = array())
94
-    {
93
+    public function create($data = array())
94
+    {
95 95
         parent::create($data);
96 96
         $this->set('createdon', time());
97 97
 
@@ -102,16 +102,16 @@  discard block
 block discarded – undo
102 102
      * @param $id
103 103
      * @return $this
104 104
      */
105
-    public function edit($id)
106
-    {
105
+    public function edit($id)
106
+    {
107 107
         $id = is_scalar($id) ? trim($id) : '';
108
-        if ($this->getID() != $id) {
108
+        if ($this->getID() != $id) {
109 109
             $this->close();
110 110
             $this->newDoc = false;
111 111
 
112
-            if (!$find = $this->findUser($id)) {
112
+            if (!$find = $this->findUser($id)) {
113 113
                 $this->id = null;
114
-            } else {
114
+            } else {
115 115
                 $this->set('editedon', time());
116 116
                 $result = $this->query("
117 117
                     SELECT * from {$this->makeTable('web_user_attributes')} as attribute
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
      * @param $value
136 136
      * @return $this
137 137
      */
138
-    public function set($key, $value)
139
-    {
140
-        if (is_scalar($value) && is_scalar($key) && !empty($key)) {
141
-            switch ($key) {
138
+    public function set($key, $value)
139
+    {
140
+        if (is_scalar($value) && is_scalar($key) && !empty($key)) {
141
+            switch ($key) {
142 142
                 case 'password':
143 143
                     $this->givenPassword = $value;
144 144
                     $value = $this->getPassword($value);
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
                 case 'sessionid':
147 147
                     session_regenerate_id(false);
148 148
                     $value = session_id();
149
-                    if ($mid = $this->modx->getLoginUserID('mgr')) {
149
+                    if ($mid = $this->modx->getLoginUserID('mgr')) {
150 150
                         $this->query("UPDATE {$this->makeTable('active_user_locks')} SET `sid`='{$value}' WHERE `internalKey`={$mid}");
151 151
                         $this->query("UPDATE {$this->makeTable('active_user_sessions')} SET `sid`='{$value}' WHERE `internalKey`={$mid}");
152 152
                         $this->query("UPDATE {$this->makeTable('active_users')} SET `sid`='{$value}' WHERE `internalKey`={$mid}");
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
      * @param $pass
168 168
      * @return string
169 169
      */
170
-    public function getPassword($pass)
171
-    {
170
+    public function getPassword($pass)
171
+    {
172 172
         return md5($pass);
173 173
     }
174 174
 
@@ -177,83 +177,83 @@  discard block
 block discarded – undo
177 177
      * @param bool $clearCache
178 178
      * @return bool|int|null|void
179 179
      */
180
-    public function save($fire_events = false, $clearCache = false)
181
-    {
182
-        if ($this->get('email') == '' || $this->get('username') == '' || $this->get('password') == '') {
180
+    public function save($fire_events = false, $clearCache = false)
181
+    {
182
+        if ($this->get('email') == '' || $this->get('username') == '' || $this->get('password') == '') {
183 183
             $this->log['EmptyPKField'] = 'Email, username or password is empty <pre>' . print_r($this->toArray(),
184 184
                     true) . '</pre>';
185 185
 
186 186
             return false;
187 187
         }
188 188
 
189
-        if (!$this->checkUnique('web_users', 'username')) {
189
+        if (!$this->checkUnique('web_users', 'username')) {
190 190
             $this->log['UniqueUsername'] = 'username not unique <pre>' . print_r($this->get('username'),
191 191
                     true) . '</pre>';
192 192
 
193 193
             return false;
194 194
         }
195 195
 
196
-        if (!$this->checkUnique('web_user_attributes', 'email', 'internalKey')) {
196
+        if (!$this->checkUnique('web_user_attributes', 'email', 'internalKey')) {
197 197
             $this->log['UniqueEmail'] = 'Email not unique <pre>' . print_r($this->get('email'), true) . '</pre>';
198 198
 
199 199
             return false;
200 200
         }
201 201
         $this->set('sessionid', '');
202 202
         $fld = $this->toArray();
203
-        foreach ($this->default_field['user'] as $key => $value) {
203
+        foreach ($this->default_field['user'] as $key => $value) {
204 204
             $tmp = $this->get($key);
205
-            if ($this->newDoc && (!is_int($tmp) && $tmp == '')) {
205
+            if ($this->newDoc && (!is_int($tmp) && $tmp == '')) {
206 206
                 $this->field[$key] = $value;
207 207
             }
208 208
             $this->Uset($key, 'user');
209 209
             unset($fld[$key]);
210 210
         }
211
-        if (!empty($this->set['user'])) {
212
-            if ($this->newDoc) {
211
+        if (!empty($this->set['user'])) {
212
+            if ($this->newDoc) {
213 213
                 $SQL = "INSERT into {$this->makeTable('web_users')} SET " . implode(', ', $this->set['user']);
214
-            } else {
214
+            } else {
215 215
                 $SQL = "UPDATE {$this->makeTable('web_users')} SET " . implode(', ',
216 216
                         $this->set['user']) . " WHERE id = " . $this->id;
217 217
             }
218 218
             $this->query($SQL);
219 219
         }
220 220
 
221
-        if ($this->newDoc) {
221
+        if ($this->newDoc) {
222 222
             $this->id = $this->modx->db->getInsertId();
223 223
         }
224 224
 
225
-        foreach ($this->default_field['attribute'] as $key => $value) {
225
+        foreach ($this->default_field['attribute'] as $key => $value) {
226 226
             $tmp = $this->get($key);
227
-            if ($this->newDoc && (!is_int($tmp) && $tmp == '')) {
227
+            if ($this->newDoc && (!is_int($tmp) && $tmp == '')) {
228 228
                 $this->field[$key] = $value;
229 229
             }
230 230
             $this->Uset($key, 'attribute');
231 231
             unset($fld[$key]);
232 232
         }
233
-        if (!empty($this->set['attribute'])) {
234
-            if ($this->newDoc) {
233
+        if (!empty($this->set['attribute'])) {
234
+            if ($this->newDoc) {
235 235
                 $this->set('internalKey', $this->id)->Uset('internalKey', 'attribute');
236 236
                 $SQL = "INSERT into {$this->makeTable('web_user_attributes')} SET " . implode(', ',
237 237
                         $this->set['attribute']);
238
-            } else {
238
+            } else {
239 239
                 $SQL = "UPDATE {$this->makeTable('web_user_attributes')} SET " . implode(', ',
240 240
                         $this->set['attribute']) . " WHERE  internalKey = " . $this->getID();
241 241
             }
242 242
             $this->query($SQL);
243 243
         }
244 244
         unset($fld['id']);
245
-        foreach ($fld as $key => $value) {
246
-            if ($value == '' || !$this->isChanged($key)) {
245
+        foreach ($fld as $key => $value) {
246
+            if ($value == '' || !$this->isChanged($key)) {
247 247
                 continue;
248 248
             }
249 249
             $result = $this->query("SELECT `setting_value` FROM {$this->makeTable('web_user_settings')} WHERE `webuser` = '{$this->id}' AND `setting_name` = '{$key}'");
250
-            if ($this->modx->db->getRecordCount($result) > 0) {
250
+            if ($this->modx->db->getRecordCount($result) > 0) {
251 251
                 $this->query("UPDATE {$this->makeTable('web_user_settings')} SET `setting_value` = '{$value}' WHERE `webuser` = '{$this->id}' AND `setting_name` = '{$key}';");
252
-            } else {
252
+            } else {
253 253
                 $this->query("INSERT into {$this->makeTable('web_user_settings')} SET `webuser` = {$this->id},`setting_name` = '{$key}',`setting_value` = '{$value}';");
254 254
             }
255 255
         }
256
-        if (!$this->newDoc && $this->givenPassword) {
256
+        if (!$this->newDoc && $this->givenPassword) {
257 257
             $this->invokeEvent('OnWebChangePassword', array(
258 258
                 'userObj'      => $this,
259 259
                 'userid'       => $this->id,
@@ -264,7 +264,9 @@  discard block
 block discarded – undo
264 264
             ), $fire_events);
265 265
         }
266 266
         
267
-        if ($this->groupIds) $this->setUserGroups($this->id, $this->groupIds);
267
+        if ($this->groupIds) {
268
+            $this->setUserGroups($this->id, $this->groupIds);
269
+        }
268 270
         
269 271
         $this->invokeEvent('OnWebSaveUser', array(
270 272
             'userObj' => $this,
@@ -273,7 +275,7 @@  discard block
 block discarded – undo
273 275
             'user'    => $this->toArray()
274 276
         ), $fire_events);
275 277
 
276
-        if ($clearCache) {
278
+        if ($clearCache) {
277 279
             $this->clearCache($fire_events);
278 280
         }
279 281
 
@@ -285,9 +287,9 @@  discard block
 block discarded – undo
285 287
      * @param bool $fire_events
286 288
      * @return bool|null|void
287 289
      */
288
-    public function delete($ids, $fire_events = false)
289
-    {
290
-        if ($this->edit($ids)) {
290
+    public function delete($ids, $fire_events = false)
291
+    {
292
+        if ($this->edit($ids)) {
291 293
             $flag = $this->query("
292 294
           DELETE user,attribute FROM {$this->makeTable('web_user_attributes')} as attribute
293 295
             LEFT JOIN {$this->makeTable('web_users')} as user ON user.id=attribute.internalKey
@@ -301,7 +303,7 @@  discard block
 block discarded – undo
301 303
                 'username'    => $this->get('username'),
302 304
                 'timestamp'   => time()
303 305
             ), $fire_events);
304
-        } else {
306
+        } else {
305 307
             $flag = false;
306 308
         }
307 309
         $this->close();
@@ -316,13 +318,13 @@  discard block
 block discarded – undo
316 318
      * @param bool $fire_events
317 319
      * @return bool
318 320
      */
319
-    public function authUser($id = 0, $fulltime = true, $cookieName = 'WebLoginPE', $fire_events = false)
320
-    {
321
+    public function authUser($id = 0, $fulltime = true, $cookieName = 'WebLoginPE', $fire_events = false)
322
+    {
321 323
         $flag = false;
322
-        if (null === $this->getID() && $id) {
324
+        if (null === $this->getID() && $id) {
323 325
             $this->edit($id);
324 326
         }
325
-        if (null !== $this->getID()) {
327
+        if (null !== $this->getID()) {
326 328
             $flag = true;
327 329
             $this->save(false);
328 330
             $this->SessionHandler('start', $cookieName, $fulltime);
@@ -342,10 +344,10 @@  discard block
 block discarded – undo
342 344
      * @param int $id
343 345
      * @return bool
344 346
      */
345
-    public function checkBlock($id = 0)
346
-    {
347
+    public function checkBlock($id = 0)
348
+    {
347 349
         $tmp = clone $this;
348
-        if ($id && $tmp->getID() != $id) {
350
+        if ($id && $tmp->getID() != $id) {
349 351
             $tmp->edit($id);
350 352
         }
351 353
         $now = time();
@@ -366,17 +368,17 @@  discard block
 block discarded – undo
366 368
      * @param bool $fire_events
367 369
      * @return bool
368 370
      */
369
-    public function testAuth($id, $password, $blocker, $fire_events = false)
370
-    {
371
+    public function testAuth($id, $password, $blocker, $fire_events = false)
372
+    {
371 373
         $tmp = clone $this;
372
-        if ($id && $tmp->getID() != $id) {
374
+        if ($id && $tmp->getID() != $id) {
373 375
             $tmp->edit($id);
374 376
         }
375 377
 
376 378
         $flag = $pluginFlag = false;
377 379
         if (
378 380
             (null !== $tmp->getID()) && (!$blocker || ($blocker && !$tmp->checkBlock($id)))
379
-        ) {
381
+        ) {
380 382
             $eventResult = $this->getInvokeEventResult('OnWebAuthentication', array(
381 383
                 'userObj'       => $this,
382 384
                 'userid'        => $tmp->getID(),
@@ -384,14 +386,14 @@  discard block
 block discarded – undo
384 386
                 'userpassword'  => $password,
385 387
                 'savedpassword' => $tmp->get('password')
386 388
             ), $fire_events);
387
-            if (is_array($eventResult)) {
388
-                foreach ($eventResult as $result) {
389
+            if (is_array($eventResult)) {
390
+                foreach ($eventResult as $result) {
389 391
                     $pluginFlag = (bool)$result;
390 392
                 }
391
-            } else {
393
+            } else {
392 394
                 $pluginFlag = (bool)$eventResult;
393 395
             }
394
-            if (!$pluginFlag) {
396
+            if (!$pluginFlag) {
395 397
                 $flag = ($tmp->get('password') == $tmp->getPassword($password));
396 398
             }
397 399
         }
@@ -405,13 +407,13 @@  discard block
 block discarded – undo
405 407
      * @param string $cookieName
406 408
      * @return bool
407 409
      */
408
-    public function AutoLogin($fulltime = true, $cookieName = 'WebLoginPE', $fire_events = null)
409
-    {
410
+    public function AutoLogin($fulltime = true, $cookieName = 'WebLoginPE', $fire_events = null)
411
+    {
410 412
         $flag = false;
411
-        if (isset($_COOKIE[$cookieName])) {
413
+        if (isset($_COOKIE[$cookieName])) {
412 414
             $cookie = explode('|', $_COOKIE[$cookieName], 4);
413
-            if (isset($cookie[0], $cookie[1], $cookie[2]) && strlen($cookie[0]) == 32 && strlen($cookie[1]) == 32) {
414
-                if (!$fulltime && isset($cookie[4])) {
415
+            if (isset($cookie[0], $cookie[1], $cookie[2]) && strlen($cookie[0]) == 32 && strlen($cookie[1]) == 32) {
416
+                if (!$fulltime && isset($cookie[4])) {
415 417
                     $fulltime = (int)$cookie[4];
416 418
                 }
417 419
                 $this->close();
@@ -423,7 +425,7 @@  discard block
 block discarded – undo
423 425
                     && $this->get('password') == $cookie[1] 
424 426
                     && $this->get('sessionid') == $cookie[2] 
425 427
                     && !$this->checkBlock($this->getID())
426
-                ) {
428
+                ) {
427 429
                     $flag = $this->authUser($this->getID(), $fulltime, $cookieName, $fire_events);
428 430
 
429 431
                 }
@@ -437,9 +439,9 @@  discard block
 block discarded – undo
437 439
      * @param string $cookieName
438 440
      * @param null $fire_events
439 441
      */
440
-    public function logOut($cookieName = 'WebLoginPE', $fire_events = null)
441
-    {
442
-        if (!$uid = $this->modx->getLoginUserID('web')) {
442
+    public function logOut($cookieName = 'WebLoginPE', $fire_events = null)
443
+    {
444
+        if (!$uid = $this->modx->getLoginUserID('web')) {
443 445
             return;
444 446
         }
445 447
         $params = array(
@@ -464,11 +466,11 @@  discard block
 block discarded – undo
464 466
      *
465 467
      * remeber может быть числом в секундах
466 468
      */
467
-    protected function SessionHandler($directive, $cookieName, $remember = true)
468
-    {
469
-        switch ($directive) {
469
+    protected function SessionHandler($directive, $cookieName, $remember = true)
470
+    {
471
+        switch ($directive) {
470 472
             case 'start':
471
-                if ($this->getID()) {
473
+                if ($this->getID()) {
472 474
                     $_SESSION['webShortname'] = $this->get('username');
473 475
                     $_SESSION['webFullname'] = $this->get('fullname');
474 476
                     $_SESSION['webEmail'] = $this->get('email');
@@ -482,13 +484,13 @@  discard block
 block discarded – undo
482 484
                     $_SESSION['webUsrConfigSet'] = array();
483 485
                     $_SESSION['webUserGroupNames'] = $this->getUserGroups();
484 486
                     $_SESSION['webDocgroups'] = $this->getDocumentGroups();
485
-                    if ($remember) {
487
+                    if ($remember) {
486 488
                         $this->setAutoLoginCookie($cookieName, $remember);
487 489
                     }
488 490
                 }
489 491
                 break;
490 492
             case 'destroy':
491
-                if (isset($_SESSION['mgrValidated'])) {
493
+                if (isset($_SESSION['mgrValidated'])) {
492 494
                     unset($_SESSION['webShortname']);
493 495
                     unset($_SESSION['webFullname']);
494 496
                     unset($_SESSION['webEmail']);
@@ -504,8 +506,8 @@  discard block
 block discarded – undo
504 506
                     unset($_SESSION['webDocgroups']);
505 507
 
506 508
                     setcookie($cookieName, '', time() - 60, MODX_BASE_URL);
507
-                } else {
508
-                    if (isset($_COOKIE[session_name()])) {
509
+                } else {
510
+                    if (isset($_COOKIE[session_name()])) {
509 511
                         setcookie(session_name(), '', time() - 60, MODX_BASE_URL);
510 512
                     }
511 513
                     setcookie($cookieName, '', time() - 60, MODX_BASE_URL);
@@ -520,8 +522,8 @@  discard block
 block discarded – undo
520 522
     /**
521 523
      * @return bool
522 524
      */
523
-    public function isSecure()
524
-    {
525
+    public function isSecure()
526
+    {
525 527
         $out = $this->modxConfig('server_protocol') == 'http' ? false : true;
526 528
 
527 529
         return $out;
@@ -532,9 +534,9 @@  discard block
 block discarded – undo
532 534
      * @param bool $remember
533 535
      * @return $this
534 536
      */
535
-    public function setAutoLoginCookie($cookieName, $remember = true)
536
-    {
537
-        if (!empty($cookieName) && $this->getID()) {
537
+    public function setAutoLoginCookie($cookieName, $remember = true)
538
+    {
539
+        if (!empty($cookieName) && $this->getID()) {
538 540
             $secure = $this->isSecure();
539 541
             $remember = is_bool($remember) ? (60 * 60 * 24 * 365 * 5) : (int)$remember;
540 542
             $cookieValue = array(md5($this->get('username')), $this->get('password'), $this->get('sessionid'), $remember);
@@ -550,11 +552,11 @@  discard block
 block discarded – undo
550 552
      * @param int $userID
551 553
      * @return array
552 554
      */
553
-    public function getDocumentGroups($userID = 0)
554
-    {
555
+    public function getDocumentGroups($userID = 0)
556
+    {
555 557
         $out = array();
556 558
         $user = $this->switchObject($userID);
557
-        if (null !== $user->getID()) {
559
+        if (null !== $user->getID()) {
558 560
             $web_groups = $this->modx->getFullTableName('web_groups');
559 561
             $webgroup_access = $this->modx->getFullTableName('webgroup_access');
560 562
 
@@ -573,18 +575,18 @@  discard block
 block discarded – undo
573 575
      * @param int $userID
574 576
      * @return array
575 577
      */
576
-    public function getUserGroups($userID = 0)
577
-    {
578
+    public function getUserGroups($userID = 0)
579
+    {
578 580
         $out = array();
579 581
         $user = $this->switchObject($userID);
580
-        if (null !== $user->getID()) {
582
+        if (null !== $user->getID()) {
581 583
             $web_groups = $this->makeTable('web_groups');
582 584
             $webgroup_names = $this->makeTable('webgroup_names');
583 585
 
584 586
             $rs = $this->query("SELECT `ug`.`webgroup`, `ugn`.`name` FROM {$web_groups} as `ug`
585 587
                 INNER JOIN {$webgroup_names} as `ugn` ON `ugn`.`id`=`ug`.`webgroup`
586 588
                 WHERE `ug`.`webuser` = " . $user->getID());
587
-            while ($row = $this->modx->db->getRow($rs)) {
589
+            while ($row = $this->modx->db->getRow($rs)) {
588 590
                 $out[$row['webgroup']] = $row['name'];
589 591
             }
590 592
         }
@@ -598,18 +600,20 @@  discard block
 block discarded – undo
598 600
      * @param array $groupIds
599 601
      * @return $this
600 602
      */
601
-    public function setUserGroups($userID = 0, $groupIds = array())
602
-    {
603
-        if (!is_array($groupIds)) return $this;
604
-        if ($this->newDoc && $userID == 0) {
603
+    public function setUserGroups($userID = 0, $groupIds = array())
604
+    {
605
+        if (!is_array($groupIds)) {
606
+            return $this;
607
+        }
608
+        if ($this->newDoc && $userID == 0) {
605 609
             $this->groupIds = $groupIds;
606
-        } else {
610
+        } else {
607 611
             $user = $this->switchObject($userID);
608
-            if ($uid = $user->getID()) {
609
-                foreach ($groupIds as $gid) {
612
+            if ($uid = $user->getID()) {
613
+                foreach ($groupIds as $gid) {
610 614
                     $this->query("REPLACE INTO {$this->makeTable('web_groups')} (`webgroup`, `webuser`) VALUES ('{$gid}', '{$uid}')");
611 615
                 }
612
-                if (!$this->newDoc) {
616
+                if (!$this->newDoc) {
613 617
                     $groupIds = empty($groupIds) ? '0' : implode(',', $groupIds);
614 618
                     $this->query("DELETE FROM {$this->makeTable('web_groups')} WHERE `webuser`={$uid} AND `webgroup` NOT IN ({$groupIds})");
615 619
                 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
                     session_regenerate_id(false);
148 148
                     $value = session_id();
149 149
                     if ($mid = $this->modx->getLoginUserID('mgr')) {
150
-                        $this->query("UPDATE {$this->makeTable('active_user_locks')} SET `sid`='{$value}' WHERE `internalKey`={$mid}");
151
-                        $this->query("UPDATE {$this->makeTable('active_user_sessions')} SET `sid`='{$value}' WHERE `internalKey`={$mid}");
152
-                        $this->query("UPDATE {$this->makeTable('active_users')} SET `sid`='{$value}' WHERE `internalKey`={$mid}");
150
+                        $this->query("update {$this->makeTable('active_user_locks')} SET `sid`='{$value}' WHERE `internalKey`={$mid}");
151
+                        $this->query("update {$this->makeTable('active_user_sessions')} SET `sid`='{$value}' WHERE `internalKey`={$mid}");
152
+                        $this->query("update {$this->makeTable('active_users')} SET `sid`='{$value}' WHERE `internalKey`={$mid}");
153 153
                     }
154 154
                     break;
155 155
                 case 'editedon':
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
             if ($this->newDoc) {
213 213
                 $SQL = "INSERT into {$this->makeTable('web_users')} SET " . implode(', ', $this->set['user']);
214 214
             } else {
215
-                $SQL = "UPDATE {$this->makeTable('web_users')} SET " . implode(', ',
215
+                $SQL = "update {$this->makeTable('web_users')} SET " . implode(', ',
216 216
                         $this->set['user']) . " WHERE id = " . $this->id;
217 217
             }
218 218
             $this->query($SQL);
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
                 $SQL = "INSERT into {$this->makeTable('web_user_attributes')} SET " . implode(', ',
237 237
                         $this->set['attribute']);
238 238
             } else {
239
-                $SQL = "UPDATE {$this->makeTable('web_user_attributes')} SET " . implode(', ',
239
+                $SQL = "update {$this->makeTable('web_user_attributes')} SET " . implode(', ',
240 240
                         $this->set['attribute']) . " WHERE  internalKey = " . $this->getID();
241 241
             }
242 242
             $this->query($SQL);
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             }
249 249
             $result = $this->query("SELECT `setting_value` FROM {$this->makeTable('web_user_settings')} WHERE `webuser` = '{$this->id}' AND `setting_name` = '{$key}'");
250 250
             if ($this->modx->db->getRecordCount($result) > 0) {
251
-                $this->query("UPDATE {$this->makeTable('web_user_settings')} SET `setting_value` = '{$value}' WHERE `webuser` = '{$this->id}' AND `setting_name` = '{$key}';");
251
+                $this->query("update {$this->makeTable('web_user_settings')} SET `setting_value` = '{$value}' WHERE `webuser` = '{$this->id}' AND `setting_name` = '{$key}';");
252 252
             } else {
253 253
                 $this->query("INSERT into {$this->makeTable('web_user_settings')} SET `webuser` = {$this->id},`setting_name` = '{$key}',`setting_value` = '{$value}';");
254 254
             }
Please login to merge, or discard this patch.