@@ -196,7 +196,7 @@ |
||
196 | 196 | /** |
197 | 197 | * Determine if the user is marked as available for an event. |
198 | 198 | * |
199 | - * @return bool if user is available |
|
199 | + * @return null|boolean if user is available |
|
200 | 200 | */ |
201 | 201 | public function isAvailableForEvent(Event $event) |
202 | 202 | { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getName() |
79 | 79 | { |
80 | - return $this->firstname.' '.$this->lastname; |
|
80 | + return $this->firstname . ' ' . $this->lastname; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -96,16 +96,16 @@ discard block |
||
96 | 96 | if ($socialAuth->getPlatform() == 'facebook') { |
97 | 97 | switch ($size) { |
98 | 98 | case 'small': // 50px x 50px |
99 | - return '//graph.facebook.com/'.$socialAuth->getSocialId().'/picture?type=square'; |
|
99 | + return '//graph.facebook.com/' . $socialAuth->getSocialId() . '/picture?type=square'; |
|
100 | 100 | break; |
101 | 101 | case 'medium': // 200px x 200px |
102 | - return '//graph.facebook.com/'.$socialAuth->getSocialId().'/picture?type=large'; |
|
102 | + return '//graph.facebook.com/' . $socialAuth->getSocialId() . '/picture?type=large'; |
|
103 | 103 | break; |
104 | 104 | case 'large': // 200px x 200px |
105 | - return '//graph.facebook.com/'.$socialAuth->getSocialId().'/picture?type=large'; |
|
105 | + return '//graph.facebook.com/' . $socialAuth->getSocialId() . '/picture?type=large'; |
|
106 | 106 | break; |
107 | 107 | default: |
108 | - return '//graph.facebook.com/'.$socialAuth->getSocialId().'/picture'; |
|
108 | + return '//graph.facebook.com/' . $socialAuth->getSocialId() . '/picture'; |
|
109 | 109 | break; |
110 | 110 | } |
111 | 111 | } elseif ($socialAuth->getPlatform() == 'onebody') { |
@@ -114,16 +114,16 @@ discard block |
||
114 | 114 | $extension = pathinfo($socialAuth->getMeta()['photo-file-name'], PATHINFO_EXTENSION); |
115 | 115 | switch ($size) { |
116 | 116 | case 'small': // 50px x 50px |
117 | - return $baseUrl.'/system/production/people/photos/'.$socialAuth->getSocialId().'/tn/'.$photoFingerprint.'.'.$extension; |
|
117 | + return $baseUrl . '/system/production/people/photos/' . $socialAuth->getSocialId() . '/tn/' . $photoFingerprint . '.' . $extension; |
|
118 | 118 | break; |
119 | 119 | case 'medium': // 150px x 150px |
120 | - return $baseUrl.'/system/production/people/photos/'.$socialAuth->getSocialId().'/small/'.$photoFingerprint.'.'.$extension; |
|
120 | + return $baseUrl . '/system/production/people/photos/' . $socialAuth->getSocialId() . '/small/' . $photoFingerprint . '.' . $extension; |
|
121 | 121 | break; |
122 | 122 | case 'large': // 500px x 500px |
123 | - return $baseUrl.'/system/production/people/photos/'.$socialAuth->getSocialId().'/medium/'.$photoFingerprint.'.'.$extension; |
|
123 | + return $baseUrl . '/system/production/people/photos/' . $socialAuth->getSocialId() . '/medium/' . $photoFingerprint . '.' . $extension; |
|
124 | 124 | break; |
125 | 125 | default: |
126 | - return $baseUrl.'/system/production/people/photos/'.$socialAuth->getSocialId().'/tn/'.$photoFingerprint.'.'.$extension; |
|
126 | + return $baseUrl . '/system/production/people/photos/' . $socialAuth->getSocialId() . '/tn/' . $photoFingerprint . '.' . $extension; |
|
127 | 127 | break; |
128 | 128 | } |
129 | 129 | } |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | |
133 | 133 | switch ($size) { |
134 | 134 | case 'small': // 50px x 50px |
135 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($this->email))).'?s=50&d=mm'; |
|
135 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($this->email))) . '?s=50&d=mm'; |
|
136 | 136 | break; |
137 | 137 | case 'medium': // 200px x 200px |
138 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($this->email))).'?s=200&d=mm'; |
|
138 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($this->email))) . '?s=200&d=mm'; |
|
139 | 139 | break; |
140 | 140 | case 'large': // 500px x 500px |
141 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($this->email))).'?s=500&d=mm'; |
|
141 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($this->email))) . '?s=500&d=mm'; |
|
142 | 142 | break; |
143 | 143 | default: |
144 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($this->email))).'?s=50&d=mm'; |
|
144 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($this->email))) . '?s=50&d=mm'; |
|
145 | 145 | break; |
146 | 146 | } |
147 | 147 | } |
@@ -119,6 +119,9 @@ |
||
119 | 119 | return true; |
120 | 120 | } |
121 | 121 | |
122 | + /** |
|
123 | + * @param EmailAddress $username |
|
124 | + */ |
|
122 | 125 | private function numberOfLoginAttemptsIsOk($username) |
123 | 126 | { |
124 | 127 | $numberOfAllowedAttempts = 8; |
@@ -29,11 +29,11 @@ |
||
29 | 29 | // parameter represents the DataTables column identifier. In this case simple |
30 | 30 | // indexes |
31 | 31 | $columns = [ |
32 | - ['db' => 'id', 'dt' => 0], |
|
33 | - ['db' => 'firstname', 'dt' => 1], |
|
34 | - ['db' => 'surname', 'dt' => 2], |
|
35 | - ['db' => 'zip', 'dt' => 3], |
|
36 | - ['db' => 'country', 'dt' => 4], |
|
32 | + ['db' => 'id', 'dt' => 0], |
|
33 | + ['db' => 'firstname', 'dt' => 1], |
|
34 | + ['db' => 'surname', 'dt' => 2], |
|
35 | + ['db' => 'zip', 'dt' => 3], |
|
36 | + ['db' => 'country', 'dt' => 4], |
|
37 | 37 | ]; |
38 | 38 | |
39 | 39 | // SQL server connection information |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | // ensure user is allowed to see page |
40 | 40 | |
41 | 41 | if (!isAdmin() && $queryStringUser != $sessionUserId) { |
42 | - header('Location: swaps.php?user='.$sessionUserId); |
|
42 | + header('Location: swaps.php?user=' . $sessionUserId); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // fetch swaps |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | <p> |
91 | 91 | <strong> |
92 | 92 | <s class="text-red"> |
93 | - <?php echo $swap->getOldUserRole()->getUser()->getFirstName().' '.$swap->getOldUserRole()->getUser()->getLastName() ?> (<?php echo $swap->getOldUserRole()->getRole()->getName() ?>) |
|
93 | + <?php echo $swap->getOldUserRole()->getUser()->getFirstName() . ' ' . $swap->getOldUserRole()->getUser()->getLastName() ?> (<?php echo $swap->getOldUserRole()->getRole()->getName() ?>) |
|
94 | 94 | </s> |
95 | 95 | → |
96 | 96 | <span class="text-green"> |
97 | - <?php echo $swap->getNewUserRole()->getUser()->getFirstName().' '.$swap->getNewUserRole()->getUser()->getLastName() ?> (<?php echo $swap->getNewUserRole()->getRole()->getName() ?>) |
|
97 | + <?php echo $swap->getNewUserRole()->getUser()->getFirstName() . ' ' . $swap->getNewUserRole()->getUser()->getLastName() ?> (<?php echo $swap->getNewUserRole()->getRole()->getName() ?>) |
|
98 | 98 | </span> |
99 | 99 | </strong> |
100 | 100 | </p> |
@@ -64,21 +64,21 @@ discard block |
||
64 | 64 | case 'accept': |
65 | 65 | if (canAcceptSwap($swapId) || $verify == verificationCodeForSwap($swapId)) { |
66 | 66 | switch (acceptSwap($swapId)) { |
67 | - case '1': |
|
68 | - $message = 'Swap Successful'; |
|
69 | - break; |
|
70 | - case '2': |
|
71 | - $message = 'Swap already accepted.'; |
|
72 | - break; |
|
73 | - case '3': |
|
74 | - $message = 'Swap already declined.'; |
|
75 | - break; |
|
76 | - case '4': |
|
77 | - $message = 'Swap already reverted.'; |
|
78 | - break; |
|
79 | - default: |
|
80 | - $err = 'Technical issue - please inform system administrator'; |
|
81 | - break; |
|
67 | + case '1': |
|
68 | + $message = 'Swap Successful'; |
|
69 | + break; |
|
70 | + case '2': |
|
71 | + $message = 'Swap already accepted.'; |
|
72 | + break; |
|
73 | + case '3': |
|
74 | + $message = 'Swap already declined.'; |
|
75 | + break; |
|
76 | + case '4': |
|
77 | + $message = 'Swap already reverted.'; |
|
78 | + break; |
|
79 | + default: |
|
80 | + $err = 'Technical issue - please inform system administrator'; |
|
81 | + break; |
|
82 | 82 | } |
83 | 83 | } else { |
84 | 84 | $err = 'Swap Already Actioned or Verification Code Invalid'; |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | case 'decline': |
88 | 88 | if (canDeclineSwap($swapId) || $verify == verificationCodeForSwap($swapId)) { |
89 | 89 | switch (declineSwap($swapId)) { |
90 | - case '1': |
|
91 | - $message = 'Swap declined'; |
|
92 | - break; |
|
93 | - case '2': |
|
94 | - $message = 'Swap already declined.'; |
|
95 | - break; |
|
96 | - default: |
|
97 | - $err = 'Technical issue - please inform system administrator'; |
|
98 | - break; |
|
90 | + case '1': |
|
91 | + $message = 'Swap declined'; |
|
92 | + break; |
|
93 | + case '2': |
|
94 | + $message = 'Swap already declined.'; |
|
95 | + break; |
|
96 | + default: |
|
97 | + $err = 'Technical issue - please inform system administrator'; |
|
98 | + break; |
|
99 | 99 | } |
100 | 100 | } else { |
101 | 101 | $err = 'Swap Already Actioned or Verification Code Invalid'; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $swapId = filter_var($swapId, FILTER_SANITIZE_NUMBER_INT); |
50 | 50 | |
51 | 51 | switch ($action) { |
52 | - case 'swap': |
|
52 | + case 'swap': |
|
53 | 53 | if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
54 | 54 | $eventPersonId = $_POST['eventPerson']; |
55 | 55 | $newUserRoleId = $_POST['newUserRole']; |
@@ -63,48 +63,48 @@ discard block |
||
63 | 63 | $err = 'Swap details incorrect, please try again.'; |
64 | 64 | } |
65 | 65 | break; |
66 | - case 'accept': |
|
66 | + case 'accept': |
|
67 | 67 | if (canAcceptSwap($swapId) || $verify == verificationCodeForSwap($swapId)) { |
68 | 68 | switch (acceptSwap($swapId)) { |
69 | 69 | case '1': |
70 | 70 | $message = 'Swap Successful'; |
71 | - break; |
|
71 | + break; |
|
72 | 72 | case '2': |
73 | 73 | $message = 'Swap already accepted.'; |
74 | - break; |
|
74 | + break; |
|
75 | 75 | case '3': |
76 | 76 | $message = 'Swap already declined.'; |
77 | - break; |
|
77 | + break; |
|
78 | 78 | case '4': |
79 | 79 | $message = 'Swap already reverted.'; |
80 | - break; |
|
80 | + break; |
|
81 | 81 | default: |
82 | 82 | $err = 'Technical issue - please inform system administrator'; |
83 | - break; |
|
84 | - } |
|
83 | + break; |
|
84 | + } |
|
85 | 85 | } else { |
86 | 86 | $err = 'Swap Already Actioned or Verification Code Invalid'; |
87 | 87 | } |
88 | 88 | break; |
89 | - case 'decline': |
|
89 | + case 'decline': |
|
90 | 90 | if (canDeclineSwap($swapId) || $verify == verificationCodeForSwap($swapId)) { |
91 | 91 | switch (declineSwap($swapId)) { |
92 | 92 | case '1': |
93 | 93 | $message = 'Swap declined'; |
94 | - break; |
|
94 | + break; |
|
95 | 95 | case '2': |
96 | 96 | $message = 'Swap already declined.'; |
97 | - break; |
|
97 | + break; |
|
98 | 98 | default: |
99 | 99 | $err = 'Technical issue - please inform system administrator'; |
100 | - break; |
|
100 | + break; |
|
101 | 101 | } |
102 | 102 | } else { |
103 | 103 | $err = 'Swap Already Actioned or Verification Code Invalid'; |
104 | 104 | } |
105 | 105 | break; |
106 | 106 | |
107 | - default: |
|
107 | + default: |
|
108 | 108 | // code... |
109 | 109 | break; |
110 | 110 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <section class="content"> |
166 | 166 | |
167 | 167 | <?php |
168 | - if (isset($message)) { ?> |
|
168 | + if (isset($message)) { ?> |
|
169 | 169 | |
170 | 170 | <p><?php echo $message ?></p> |
171 | 171 | |
@@ -226,19 +226,19 @@ discard block |
||
226 | 226 | <label for="newUserRole">Swap To:</label> |
227 | 227 | <select name="newUserRole" class="form-control"> |
228 | 228 | <?php |
229 | - if (roleCanSwapToOtherRoleInGroup($role->roleId)) { |
|
230 | - $whereAnd = 'r.groupId = '.groupIdWithRole($role->roleId).' AND r.allowRoleSwaps IS NOT FALSE'; |
|
231 | - } else { |
|
232 | - $whereAnd = 'r.id = '.$role->roleId; |
|
233 | - } |
|
234 | - $sql = 'SELECT ur.id, u.firstName, u.lastName, r.name FROM users u INNER JOIN userRoles ur ON ur.userId = u.id INNER JOIN roles r ON r.id = ur.roleId WHERE u.id <> '.$role->userId.' AND '.$whereAnd.' ORDER BY lastName, firstName, r.name'; |
|
235 | - $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); |
|
236 | - |
|
237 | - while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
|
238 | - ?> |
|
229 | + if (roleCanSwapToOtherRoleInGroup($role->roleId)) { |
|
230 | + $whereAnd = 'r.groupId = '.groupIdWithRole($role->roleId).' AND r.allowRoleSwaps IS NOT FALSE'; |
|
231 | + } else { |
|
232 | + $whereAnd = 'r.id = '.$role->roleId; |
|
233 | + } |
|
234 | + $sql = 'SELECT ur.id, u.firstName, u.lastName, r.name FROM users u INNER JOIN userRoles ur ON ur.userId = u.id INNER JOIN roles r ON r.id = ur.roleId WHERE u.id <> '.$role->userId.' AND '.$whereAnd.' ORDER BY lastName, firstName, r.name'; |
|
235 | + $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); |
|
236 | + |
|
237 | + while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
|
238 | + ?> |
|
239 | 239 | <option value='<?php echo $row['id']; ?>'><?php echo $row['firstName'].' '.$row['lastName'].' ('.$row['name'].')'; ?></option> |
240 | 240 | <?php |
241 | - } ?> |
|
241 | + } ?> |
|
242 | 242 | </select> |
243 | 243 | </div> |
244 | 244 | </div> |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if (!empty($eventId)) { |
113 | 113 | // ensure user is logged in before allowing creation of swap |
114 | 114 | if (!(isset($_SESSION['is_logged_in']) || $_SESSION['db_is_logged_in'] == true)) { |
115 | - $_SESSION['redirectUrl'] = siteSettings()->getSiteUrl().'/swap.php?event='.$eventId; |
|
115 | + $_SESSION['redirectUrl'] = siteSettings()->getSiteUrl() . '/swap.php?event=' . $eventId; |
|
116 | 116 | header('Location: login.php'); |
117 | 117 | } |
118 | 118 | $createSwap = true; |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | <p> |
189 | 189 | <strong> |
190 | 190 | <s class="text-red"> |
191 | - <?php echo $swap->getOldUserRole()->getUser()->getFirstName().' '.$swap->getOldUserRole()->getUser()->getLastName() ?> (<?php echo $swap->getOldUserRole()->getRole()->getName() ?>) |
|
191 | + <?php echo $swap->getOldUserRole()->getUser()->getFirstName() . ' ' . $swap->getOldUserRole()->getUser()->getLastName() ?> (<?php echo $swap->getOldUserRole()->getRole()->getName() ?>) |
|
192 | 192 | </s> |
193 | 193 | → |
194 | 194 | <span class="text-green"> |
195 | - <?php echo $swap->getNewUserRole()->getUser()->getFirstName().' '.$swap->getNewUserRole()->getUser()->getLastName() ?> (<?php echo $swap->getNewUserRole()->getRole()->getName() ?>) |
|
195 | + <?php echo $swap->getNewUserRole()->getUser()->getFirstName() . ' ' . $swap->getNewUserRole()->getUser()->getLastName() ?> (<?php echo $swap->getNewUserRole()->getRole()->getName() ?>) |
|
196 | 196 | </span> |
197 | 197 | </strong> |
198 | 198 | </p> |
@@ -227,16 +227,16 @@ discard block |
||
227 | 227 | <select name="newUserRole" class="form-control"> |
228 | 228 | <?php |
229 | 229 | if (roleCanSwapToOtherRoleInGroup($role->roleId)) { |
230 | - $whereAnd = 'r.groupId = '.groupIdWithRole($role->roleId).' AND r.allowRoleSwaps IS NOT FALSE'; |
|
230 | + $whereAnd = 'r.groupId = ' . groupIdWithRole($role->roleId) . ' AND r.allowRoleSwaps IS NOT FALSE'; |
|
231 | 231 | } else { |
232 | - $whereAnd = 'r.id = '.$role->roleId; |
|
232 | + $whereAnd = 'r.id = ' . $role->roleId; |
|
233 | 233 | } |
234 | - $sql = 'SELECT ur.id, u.firstName, u.lastName, r.name FROM users u INNER JOIN userRoles ur ON ur.userId = u.id INNER JOIN roles r ON r.id = ur.roleId WHERE u.id <> '.$role->userId.' AND '.$whereAnd.' ORDER BY lastName, firstName, r.name'; |
|
234 | + $sql = 'SELECT ur.id, u.firstName, u.lastName, r.name FROM users u INNER JOIN userRoles ur ON ur.userId = u.id INNER JOIN roles r ON r.id = ur.roleId WHERE u.id <> ' . $role->userId . ' AND ' . $whereAnd . ' ORDER BY lastName, firstName, r.name'; |
|
235 | 235 | $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); |
236 | 236 | |
237 | 237 | while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
238 | 238 | ?> |
239 | - <option value='<?php echo $row['id']; ?>'><?php echo $row['firstName'].' '.$row['lastName'].' ('.$row['name'].')'; ?></option> |
|
239 | + <option value='<?php echo $row['id']; ?>'><?php echo $row['firstName'] . ' ' . $row['lastName'] . ' (' . $row['name'] . ')'; ?></option> |
|
240 | 240 | <?php |
241 | 241 | } ?> |
242 | 242 | </select> |
@@ -53,8 +53,8 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | // After we have inserted the data, we want to head back to the main users page |
56 | - header('Location: subTypes.php'); // Move to the home page of the admin section |
|
57 | - exit; |
|
56 | + header('Location: subTypes.php'); // Move to the home page of the admin section |
|
57 | + exit; |
|
58 | 58 | } |
59 | 59 | include 'includes/header.php'; |
60 | 60 | ?> |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | if (!isAdmin()) { |
19 | - header('Location: error.php?no=100&page='.basename($_SERVER['SCRIPT_FILENAME'])); |
|
19 | + header('Location: error.php?no=100&page=' . basename($_SERVER['SCRIPT_FILENAME'])); |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | $sql = ("INSERT INTO eventSubTypes (name, description) VALUES ('$name', '$description')"); |
41 | 41 | if (!mysqli_query(db(), $sql)) { |
42 | - exit('Error: '.mysqli_error(db())); |
|
42 | + exit('Error: ' . mysqli_error(db())); |
|
43 | 43 | } |
44 | 44 | } else { |
45 | 45 | // Otherwise we are dealing with edits, not new stuff |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); |
91 | 91 | |
92 | 92 | while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
93 | - echo '<input type="hidden" name="formindex[]" value="'.$row['id'].'" />'; |
|
94 | - echo "<input name='name[]' value='".$row['name']."' />"; |
|
93 | + echo '<input type="hidden" name="formindex[]" value="' . $row['id'] . '" />'; |
|
94 | + echo "<input name='name[]' value='" . $row['name'] . "' />"; |
|
95 | 95 | |
96 | - echo " <a href='subTypes.php?method=remove&subType=".$row['id']."'><i class='fa fa-times'></i></a><br />"; |
|
96 | + echo " <a href='subTypes.php?method=remove&subType=" . $row['id'] . "'><i class='fa fa-times'></i></a><br />"; |
|
97 | 97 | } ?> |
98 | 98 | </div><!-- /.box-body --> |
99 | 99 | <div class="box-footer"> |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $statusMessage = 'Sent successfully'; |
54 | 54 | } else { |
55 | 55 | foreach ($sent as $errorMessage) { |
56 | - $statusMessage .= '<p>'.$errorMessage.'</p>'; |
|
56 | + $statusMessage .= '<p>' . $errorMessage . '</p>'; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | if (!isAdmin()) { |
37 | - header('Location: error.php?no=100&page='.basename($_SERVER['SCRIPT_FILENAME'])); |
|
37 | + header('Location: error.php?no=100&page=' . basename($_SERVER['SCRIPT_FILENAME'])); |
|
38 | 38 | exit; |
39 | 39 | } |
40 | 40 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | if (!isAdmin()) { |
17 | - header('Location: error.php?no=100&page='.basename($_SERVER['SCRIPT_FILENAME'])); |
|
17 | + header('Location: error.php?no=100&page=' . basename($_SERVER['SCRIPT_FILENAME'])); |
|
18 | 18 | exit; |
19 | 19 | } |
20 | 20 |