@@ -55,23 +55,23 @@ discard block |
||
55 | 55 | */ |
56 | 56 | |
57 | 57 | class USER { |
58 | - public $user_id = "0"; // So we have an ID for non-logged in users reporting comments etc. |
|
59 | - public $firstname = "Guest"; // So we have something to print for non-logged in users. |
|
58 | + public $user_id = "0"; // So we have an ID for non-logged in users reporting comments etc. |
|
59 | + public $firstname = "Guest"; // So we have something to print for non-logged in users. |
|
60 | 60 | public $lastname = ""; |
61 | - public $password = ""; // This will be a hashed version of a plaintext pw. |
|
61 | + public $password = ""; // This will be a hashed version of a plaintext pw. |
|
62 | 62 | public $email = ""; |
63 | 63 | public $postcode = ""; |
64 | 64 | public $url = ""; |
65 | - public $lastvisit = ""; // Last time the logged-in user loaded a page (GMT). |
|
65 | + public $lastvisit = ""; // Last time the logged-in user loaded a page (GMT). |
|
66 | 66 | public $registrationtime = ""; // When they registered (GMT). |
67 | - public $registrationip = ""; // Where they registered from. |
|
68 | - public $optin = ""; // Int containing multiple binary opt-ins. (See top of User.php) |
|
69 | - public $deleted = ""; // User can't log in or have their info displayed. |
|
70 | - public $confirmed = ''; // boolean - Has the user confirmed via email? |
|
71 | - public $facebook_id = ''; // Facebook ID for users who login with FB |
|
72 | - public $facebook_token = ''; // Facebook token for users who login with FB |
|
73 | - public $can_annotate = false; // Can the user add annotations |
|
74 | - public $organisation = ''; // The organisation the user belongs to |
|
67 | + public $registrationip = ""; // Where they registered from. |
|
68 | + public $optin = ""; // Int containing multiple binary opt-ins. (See top of User.php) |
|
69 | + public $deleted = ""; // User can't log in or have their info displayed. |
|
70 | + public $confirmed = ''; // boolean - Has the user confirmed via email? |
|
71 | + public $facebook_id = ''; // Facebook ID for users who login with FB |
|
72 | + public $facebook_token = ''; // Facebook token for users who login with FB |
|
73 | + public $can_annotate = false; // Can the user add annotations |
|
74 | + public $organisation = ''; // The organisation the user belongs to |
|
75 | 75 | // Don't use the status to check access privileges - use the is_able_to() function. |
76 | 76 | public $status = "Viewer"; |
77 | 77 | |
@@ -324,12 +324,12 @@ discard block |
||
324 | 324 | $confirmurl = 'https://' . DOMAIN . '/E/' . $urltoken; |
325 | 325 | |
326 | 326 | // Arrays we need to send a templated email. |
327 | - $data = [ |
|
327 | + $data = [ |
|
328 | 328 | 'to' => $details['email'], |
329 | 329 | 'template' => 'email_confirmation', |
330 | 330 | ]; |
331 | 331 | |
332 | - $merge = [ |
|
332 | + $merge = [ |
|
333 | 333 | 'CONFIRMURL' => $confirmurl, |
334 | 334 | ]; |
335 | 335 | |
@@ -367,12 +367,12 @@ discard block |
||
367 | 367 | } |
368 | 368 | |
369 | 369 | // Arrays we need to send a templated email. |
370 | - $data = [ |
|
370 | + $data = [ |
|
371 | 371 | 'to' => $details['email'], |
372 | 372 | 'template' => 'join_confirmation', |
373 | 373 | ]; |
374 | 374 | |
375 | - $merge = [ |
|
375 | + $merge = [ |
|
376 | 376 | 'CONFIRMURL' => $confirmurl, |
377 | 377 | ]; |
378 | 378 | |
@@ -438,13 +438,13 @@ discard block |
||
438 | 438 | // Generates the password .... |
439 | 439 | for ($x = 0; $x < 6;) { |
440 | 440 | $y = rand(1, 1000); |
441 | - if($y > 350 && $y < 601) { |
|
441 | + if ($y > 350 && $y < 601) { |
|
442 | 442 | $d = chr(rand(48, 57)); |
443 | 443 | } |
444 | - if($y < 351) { |
|
444 | + if ($y < 351) { |
|
445 | 445 | $d = chr(rand(65, 90)); |
446 | 446 | } |
447 | - if($y > 600) { |
|
447 | + if ($y > 600) { |
|
448 | 448 | $d = chr(rand(97, 122)); |
449 | 449 | } |
450 | 450 | if ($d != $o && !preg_match('#[O01lI]#', $d)) { |
@@ -504,14 +504,14 @@ discard block |
||
504 | 504 | return false; |
505 | 505 | } |
506 | 506 | |
507 | - $data = [ |
|
507 | + $data = [ |
|
508 | 508 | 'to' => $this->email(), |
509 | 509 | 'template' => 'new_password', |
510 | 510 | ]; |
511 | 511 | |
512 | 512 | $URL = new \MySociety\TheyWorkForYou\Url("userlogin"); |
513 | 513 | |
514 | - $merge = [ |
|
514 | + $merge = [ |
|
515 | 515 | 'EMAIL' => $this->email(), |
516 | 516 | 'LOGINURL' => "https://" . DOMAIN . $URL->generate(), |
517 | 517 | 'PASSWORD' => $this->password(), |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | // Maybe there's a way of fetching these from the DB, |
688 | 688 | // so we don't duplicate them here...? |
689 | 689 | |
690 | - $statuses = ["Viewer", "User", "Moderator", "Administrator", "Superuser"]; |
|
690 | + $statuses = ["Viewer", "User", "Moderator", "Administrator", "Superuser"]; |
|
691 | 691 | |
692 | 692 | return $statuses; |
693 | 693 | |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | $date_now = gmdate("Y-m-d H:i:s"); |
1032 | 1032 | $this->db->query( |
1033 | 1033 | "UPDATE users SET lastvisit = :lastvisit WHERE user_id = :user_id", |
1034 | - [ ':lastvisit' => $date_now, ':user_id' => $this->user_id() ] |
|
1034 | + [':lastvisit' => $date_now, ':user_id' => $this->user_id()] |
|
1035 | 1035 | ); |
1036 | 1036 | |
1037 | 1037 | $this->lastvisit = $date_now; |
@@ -1427,7 +1427,7 @@ discard block |
||
1427 | 1427 | |
1428 | 1428 | twfy_debug("THEUSER", "User with ID found to confirm: " . $this->user_id()); |
1429 | 1429 | // We'll need these to be set before logging the user in. |
1430 | - $this->email = $q['email']; |
|
1430 | + $this->email = $q['email']; |
|
1431 | 1431 | |
1432 | 1432 | // Set that they're confirmed in the DB. |
1433 | 1433 | $r = $this->db->query("UPDATE users |