@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | // create username and remove all whitespace |
38 | - $username = $firstNameLower.'.'.$lastNameLower; |
|
38 | + $username = $firstNameLower . '.' . $lastNameLower; |
|
39 | 39 | $username = preg_replace('/\s+/', '', $username); |
40 | 40 | |
41 | 41 | $sql = ("INSERT INTO users (firstName, lastName, username, email, mobile, password, created, updated) |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | $id = mysqli_insert_id(db()); |
47 | 47 | |
48 | 48 | $notificationMessage = "Welcome to your new account on the rota system.\n |
49 | -If you have any issues, please get in touch with us [".siteSettings()->getAdminEmailAddress().'](mailto:'.siteSettings()->getAdminEmailAddress().").\n |
|
49 | +If you have any issues, please get in touch with us [".siteSettings()->getAdminEmailAddress() . '](mailto:' . siteSettings()->getAdminEmailAddress() . ").\n |
|
50 | 50 | ---\n |
51 | 51 | **Sync to digital calendar**\n |
52 | 52 | You may wish to link the rota to your digital calendar on your computer and phone. To do so, generate a [calendar token](calendarTokens.php) which will present you with your unique URL. Follow instructions from your digital calendar provider for exact details on how import an iCal feed, or get in touch and we may be able to help.\n"; |
53 | 53 | |
54 | - createNotificationForUser($id, 'Welcome '.$firstName, $notificationMessage, 'feature'); |
|
54 | + createNotificationForUser($id, 'Welcome ' . $firstName, $notificationMessage, 'feature'); |
|
55 | 55 | createNotificationForUser($id, 'Change your password', 'Please change your password to something unique and memorable.', 'account', 'editPassword.php'); |
56 | 56 | |
57 | 57 | return $id; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $sql = "SELECT firstName, lastName FROM users WHERE id = '$id'"; |
146 | 146 | $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); |
147 | 147 | $ob = mysqli_fetch_object($result); |
148 | - $name = $ob->firstName.' '.$ob->lastName; |
|
148 | + $name = $ob->firstName . ' ' . $ob->lastName; |
|
149 | 149 | |
150 | 150 | return $name; |
151 | 151 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $currentTimestamp = date('Y-m-d H:i:s'); |
220 | 220 | $sql = "UPDATE users SET password = '$newPassword', passwordChanged = '$currentTimestamp' WHERE id = '$userId'"; |
221 | 221 | $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); |
222 | - insertStatistics('user', __FILE__, 'password force changed for user '.getNameWithId($userId), null, $_SERVER['HTTP_USER_AGENT']); |
|
222 | + insertStatistics('user', __FILE__, 'password force changed for user ' . getNameWithId($userId), null, $_SERVER['HTTP_USER_AGENT']); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | function hashPassword($plainTextPassword) |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | if ($loginFailures < $numberOfAllowedAttempts) { |
266 | 266 | return true; |
267 | 267 | } else { |
268 | - insertStatistics('user', __FILE__, 'Login attempts exceeded for username: '.$username, $ipAddress, $_SERVER['HTTP_USER_AGENT']); |
|
268 | + insertStatistics('user', __FILE__, 'Login attempts exceeded for username: ' . $username, $ipAddress, $_SERVER['HTTP_USER_AGENT']); |
|
269 | 269 | |
270 | 270 | return false; |
271 | 271 | } |
@@ -341,11 +341,11 @@ discard block |
||
341 | 341 | $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); |
342 | 342 | |
343 | 343 | $pendingId = mysqli_insert_id(db()); |
344 | - $linkToApprove = 'pendingAccounts.php?id='.$pendingId; |
|
344 | + $linkToApprove = 'pendingAccounts.php?id=' . $pendingId; |
|
345 | 345 | |
346 | - $email = siteSettings()->getOwner().'<'.siteSettings()->getAdminEmailAddress().'>'; |
|
347 | - $subject = $firstName.' requested an account'; |
|
348 | - $message = $subject.' through '.$source.".\nApprove or decline: ".siteSettings()->getSiteUrl().'/'.$linkToApprove; |
|
346 | + $email = siteSettings()->getOwner() . '<' . siteSettings()->getAdminEmailAddress() . '>'; |
|
347 | + $subject = $firstName . ' requested an account'; |
|
348 | + $message = $subject . ' through ' . $source . ".\nApprove or decline: " . siteSettings()->getSiteUrl() . '/' . $linkToApprove; |
|
349 | 349 | |
350 | 350 | sendMail($email, $subject, $message, $email); |
351 | 351 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | addSocialAuthToUserWithId($userId, $pendingUser->socialId, $pendingUser->source); |
418 | 418 | updateUser($userId, $pendingUser->firstName, $pendingUser->lastName, $pendingUser->email, null); |
419 | 419 | |
420 | - createNotificationForUser($userId, 'Social Login added: '.$pendingUser->source, 'Your social media login details for '.$pendingUser->source.' have been added to your existing account', 'account'); |
|
420 | + createNotificationForUser($userId, 'Social Login added: ' . $pendingUser->source, 'Your social media login details for ' . $pendingUser->source . ' have been added to your existing account', 'account'); |
|
421 | 421 | createFacebookNotificationForUser($userId, 'login.php', 'Your account request has been approved. You can now login via Facebook.'); |
422 | 422 | |
423 | 423 | return true; |
@@ -500,32 +500,32 @@ discard block |
||
500 | 500 | |
501 | 501 | function getProfileImageUrl($userId, $size = 'small') |
502 | 502 | { |
503 | - $sql = 'SELECT sa.socialId, u.email FROM users u LEFT JOIN socialAuth sa ON sa.userId = u.id WHERE id = '.$userId; |
|
503 | + $sql = 'SELECT sa.socialId, u.email FROM users u LEFT JOIN socialAuth sa ON sa.userId = u.id WHERE id = ' . $userId; |
|
504 | 504 | $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); |
505 | 505 | $user = mysqli_fetch_object($result); |
506 | 506 | |
507 | 507 | if ($user->socialId) { |
508 | 508 | switch ($size) { |
509 | 509 | case 'small': // 50px x 50px |
510 | - return '//graph.facebook.com/'.$user->socialId.'/picture?type=square'; |
|
510 | + return '//graph.facebook.com/' . $user->socialId . '/picture?type=square'; |
|
511 | 511 | break; |
512 | 512 | case 'large': // 200px x 200px |
513 | - return '//graph.facebook.com/'.$user->socialId.'/picture?type=large'; |
|
513 | + return '//graph.facebook.com/' . $user->socialId . '/picture?type=large'; |
|
514 | 514 | break; |
515 | 515 | default: |
516 | - return '//graph.facebook.com/'.$user->socialId.'/picture'; |
|
516 | + return '//graph.facebook.com/' . $user->socialId . '/picture'; |
|
517 | 517 | break; |
518 | 518 | } |
519 | 519 | } else { |
520 | 520 | switch ($size) { |
521 | 521 | case 'small': // 50px x 50px |
522 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($user->email))).'?s=50&d=mm'; |
|
522 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($user->email))) . '?s=50&d=mm'; |
|
523 | 523 | break; |
524 | 524 | case 'large': // 200px x 200px |
525 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($user->email))).'?s=200&d=mm'; |
|
525 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($user->email))) . '?s=200&d=mm'; |
|
526 | 526 | break; |
527 | 527 | default: |
528 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($user->email))).'?s=50&d=mm'; |
|
528 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($user->email))) . '?s=50&d=mm'; |
|
529 | 529 | break; |
530 | 530 | } |
531 | 531 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $sql = "UPDATE roles SET name = '$name', description = '$description' WHERE id = '$id'"; |
31 | 31 | |
32 | 32 | if (!mysqli_query(db(), $sql)) { |
33 | - die('Error: '.mysqli_error(db())); |
|
33 | + die('Error: ' . mysqli_error(db())); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | $sql = "UPDATE groups SET name = '$name' WHERE groupId = '$key'"; |
40 | 40 | |
41 | 41 | if (!mysqli_query(db(), $sql)) { |
42 | - die('Error: '.mysqli_error(db())); |
|
42 | + die('Error: ' . mysqli_error(db())); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $sql = "UPDATE groups SET description = '$description' WHERE groupId = '$key'"; |
46 | 46 | |
47 | 47 | if (!mysqli_query(db(), $sql)) { |
48 | - die('Error: '.mysqli_error(db())); |
|
48 | + die('Error: ' . mysqli_error(db())); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $sql = "UPDATE roles SET groupId = '$value' WHERE id = '$roleID'"; |
55 | 55 | |
56 | 56 | if (!mysqli_query(db(), $sql)) { |
57 | - die('Error: '.mysqli_error(db())); |
|
57 | + die('Error: ' . mysqli_error(db())); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | return $ob->allowRoleSwaps; |
132 | 132 | } |
133 | 133 | |
134 | - $sql = "SELECT allowRoleSwaps FROM groups WHERE id = '".$ob->groupId."'"; |
|
134 | + $sql = "SELECT allowRoleSwaps FROM groups WHERE id = '" . $ob->groupId . "'"; |
|
135 | 135 | $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); |
136 | 136 | $ob = mysqli_fetch_object($result); |
137 | 137 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $sql = ("INSERT INTO eventPeople (eventId, userRoleId) VALUES ('$eventId', '$userRoleId')"); |
15 | 15 | |
16 | 16 | if (!mysqli_query(db(), $sql)) { |
17 | - die('Error: '.mysqli_error(db())); |
|
17 | + die('Error: ' . mysqli_error(db())); |
|
18 | 18 | } |
19 | 19 | } |
20 | 20 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $sql = "DELETE FROM eventPeople WHERE eventId = '$id' AND userRoleId = '$userRoleId'"; |
31 | 31 | if (!mysqli_query(db(), $sql)) { |
32 | - die('Error: '.mysqli_error(db())); |
|
32 | + die('Error: ' . mysqli_error(db())); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
@@ -170,40 +170,40 @@ discard block |
||
170 | 170 | |
171 | 171 | $ob = mysqli_fetch_object($result); |
172 | 172 | |
173 | - $subject = 'Swap requested: '.$ob->newUserName.' - '.$ob->eventDate; |
|
174 | - $message = "Date:\t\t ".strftime($ob->time_format_long, strtotime($ob->eventDate))."\r\n". |
|
175 | - "Requested by:\t\t ".$ob->requestedBy."\r\n". |
|
176 | - "Swap from:\t\t ".$ob->oldUserName.' - '.$ob->oldRole."\r\n". |
|
177 | - "Swap to:\t\t ".$ob->newUserName.' - '.$ob->newRole."\r\n". |
|
178 | - "Accept:\t\t ".$ob->siteurl.'/swap.php?action='.'accept&swap='.$swapId.'&verify='.$verificationCode."\r\n "."\r\n". |
|
179 | - "Decline:\t\t ".$ob->siteurl.'/swap.php?action='.'decline&swap='.$swapId.'&verify='.$verificationCode."\r\n "."\r\n"; |
|
173 | + $subject = 'Swap requested: ' . $ob->newUserName . ' - ' . $ob->eventDate; |
|
174 | + $message = "Date:\t\t " . strftime($ob->time_format_long, strtotime($ob->eventDate)) . "\r\n" . |
|
175 | + "Requested by:\t\t " . $ob->requestedBy . "\r\n" . |
|
176 | + "Swap from:\t\t " . $ob->oldUserName . ' - ' . $ob->oldRole . "\r\n" . |
|
177 | + "Swap to:\t\t " . $ob->newUserName . ' - ' . $ob->newRole . "\r\n" . |
|
178 | + "Accept:\t\t " . $ob->siteurl . '/swap.php?action=' . 'accept&swap=' . $swapId . '&verify=' . $verificationCode . "\r\n " . "\r\n" . |
|
179 | + "Decline:\t\t " . $ob->siteurl . '/swap.php?action=' . 'decline&swap=' . $swapId . '&verify=' . $verificationCode . "\r\n " . "\r\n"; |
|
180 | 180 | |
181 | 181 | $from = $ob->siteadmin; |
182 | 182 | |
183 | - $linkToSwap = 'swap.php?swap='.$swapId; |
|
183 | + $linkToSwap = 'swap.php?swap=' . $swapId; |
|
184 | 184 | |
185 | 185 | $sessionUserId = $_SESSION['userid']; |
186 | 186 | |
187 | 187 | if ($sessionUserId == $ob->oldUserId) { // if old user requests swap |
188 | 188 | // notify new user |
189 | - $notificationMessage = $ob->oldUserFirstName.' requested a swap'; |
|
189 | + $notificationMessage = $ob->oldUserFirstName . ' requested a swap'; |
|
190 | 190 | $notificationId = createNotificationForUser($ob->newUserId, $notificationMessage, $message, 'swap', $linkToSwap); |
191 | - createFacebookNotificationForUser($ob->newUserId, 'notification.php?id='.$notificationId, $notificationMessage); |
|
191 | + createFacebookNotificationForUser($ob->newUserId, 'notification.php?id=' . $notificationId, $notificationMessage); |
|
192 | 192 | sendMail(getEmailWithId($ob->newUserId), $subject, $message, $from); |
193 | 193 | } elseif ($sessionUserId == $ob->newUserId) { // if new user requests swap |
194 | 194 | // notify old user |
195 | - $notificationMessage = $ob->newUserFirstName.' requested a swap'; |
|
195 | + $notificationMessage = $ob->newUserFirstName . ' requested a swap'; |
|
196 | 196 | $notificationId = createNotificationForUser($ob->oldUserId, $notificationMessage, $message, 'swap', $linkToSwap); |
197 | - createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id='.$notificationId, $notificationMessage); |
|
197 | + createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id=' . $notificationId, $notificationMessage); |
|
198 | 198 | sendMail(getEmailWithId($ob->oldUserId), $subject, $message, $from); |
199 | 199 | } else { // notify both users |
200 | 200 | $sessionUserFirstName = getFirstNameWithId($sessionUserId); |
201 | - $notificationMessageOldUser = $sessionUserFirstName.' requested a swap for '.$ob->newUserFirstName; |
|
202 | - $notificationMessageNewUser = $sessionUserFirstName.' requested a swap for '.$ob->oldUserFirstName; |
|
201 | + $notificationMessageOldUser = $sessionUserFirstName . ' requested a swap for ' . $ob->newUserFirstName; |
|
202 | + $notificationMessageNewUser = $sessionUserFirstName . ' requested a swap for ' . $ob->oldUserFirstName; |
|
203 | 203 | $notificationIdOldUser = createNotificationForUser($ob->oldUserId, $notificationMessageOldUser, $message, 'swap', $linkToSwap); |
204 | 204 | $notificationIdNewUser = createNotificationForUser($ob->newUserId, $notificationMessageNewUser, $message, 'swap', $linkToSwap); |
205 | - createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id='.$notificationIdOldUser, $notificationMessageOldUser); |
|
206 | - createFacebookNotificationForUser($ob->newUserId, 'notification.php?id='.$notificationIdNewUser, $notificationMessageNewUser); |
|
205 | + createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id=' . $notificationIdOldUser, $notificationMessageOldUser); |
|
206 | + createFacebookNotificationForUser($ob->newUserId, 'notification.php?id=' . $notificationIdNewUser, $notificationMessageNewUser); |
|
207 | 207 | sendMail(getEmailWithId($ob->oldUserId), $subject, $message, $from); |
208 | 208 | sendMail(getEmailWithId($ob->newUserId), $subject, $message, $from); |
209 | 209 | } |
@@ -233,60 +233,60 @@ discard block |
||
233 | 233 | |
234 | 234 | $ob = mysqli_fetch_object($result); |
235 | 235 | |
236 | - $subject = 'Swap accepted: '.$ob->newUserName.' - '.$ob->eventDate; |
|
237 | - $message = "The following swap has been accepted\r\n\r\n". |
|
238 | - "Date:\t\t ".strftime($ob->time_format_long, strtotime($ob->eventDate))."\r\n". |
|
239 | - "Requested by:\t\t ".$ob->requestedBy."\r\n". |
|
240 | - "Swap from:\t\t ".$ob->oldUserName.' - '.$ob->oldRole."\r\n". |
|
241 | - "Swap to:\t\t ".$ob->newUserName.' - '.$ob->newRole."\r\n"; |
|
236 | + $subject = 'Swap accepted: ' . $ob->newUserName . ' - ' . $ob->eventDate; |
|
237 | + $message = "The following swap has been accepted\r\n\r\n" . |
|
238 | + "Date:\t\t " . strftime($ob->time_format_long, strtotime($ob->eventDate)) . "\r\n" . |
|
239 | + "Requested by:\t\t " . $ob->requestedBy . "\r\n" . |
|
240 | + "Swap from:\t\t " . $ob->oldUserName . ' - ' . $ob->oldRole . "\r\n" . |
|
241 | + "Swap to:\t\t " . $ob->newUserName . ' - ' . $ob->newRole . "\r\n"; |
|
242 | 242 | $from = $ob->siteadmin; |
243 | 243 | |
244 | - $linkToSwap = 'swap.php?swap='.$swapId; |
|
244 | + $linkToSwap = 'swap.php?swap=' . $swapId; |
|
245 | 245 | |
246 | 246 | $sessionUserId = $_SESSION['userid']; |
247 | 247 | |
248 | 248 | if ($sessionUserId == $ob->oldUserId) { // if old user accepted swap |
249 | 249 | // notify new user |
250 | - $notificationMessage = $ob->oldUserFirstName.' accepted a swap'; |
|
250 | + $notificationMessage = $ob->oldUserFirstName . ' accepted a swap'; |
|
251 | 251 | $notificationId = createNotificationForUser($ob->newUserId, $notificationMessage, $message, 'swap', $linkToSwap); |
252 | - createFacebookNotificationForUser($ob->newUserId, 'notification.php?id='.$notificationId, $notificationMessage); |
|
252 | + createFacebookNotificationForUser($ob->newUserId, 'notification.php?id=' . $notificationId, $notificationMessage); |
|
253 | 253 | sendMail(getEmailWithId($ob->newUserId), $subject, $message, $from); |
254 | 254 | } elseif ($sessionUserId == $ob->newUserId) { // if new user accepted swap |
255 | 255 | // notify old user |
256 | - $notificationMessage = $ob->newUserFirstName.' accepted a swap'; |
|
256 | + $notificationMessage = $ob->newUserFirstName . ' accepted a swap'; |
|
257 | 257 | $notificationId = createNotificationForUser($ob->oldUserId, $notificationMessage, $message, 'swap', $linkToSwap); |
258 | - createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id='.$notificationId, $notificationMessage); |
|
258 | + createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id=' . $notificationId, $notificationMessage); |
|
259 | 259 | sendMail(getEmailWithId($ob->oldUserId), $subject, $message, $from); |
260 | 260 | } elseif (isset($_GET['token'])) { // if accepted by email URL with token |
261 | 261 | // notify whoever requested swap |
262 | 262 | if ($ob->newUserId == $ob->requestedBy) { |
263 | - $notificationMessage = 'Swap accepted with '.$ob->oldUserFirstName; |
|
263 | + $notificationMessage = 'Swap accepted with ' . $ob->oldUserFirstName; |
|
264 | 264 | $notificationId = createNotificationForUser($ob->newUserId, $notificationMessage, $message, 'swap', $linkToSwap); |
265 | - createFacebookNotificationForUser($ob->newUserId, 'notification.php?id='.$notificationId, $notificationMessage); |
|
265 | + createFacebookNotificationForUser($ob->newUserId, 'notification.php?id=' . $notificationId, $notificationMessage); |
|
266 | 266 | sendMail(getEmailWithId($ob->newUserId), $subject, $message, $from); |
267 | 267 | } elseif ($ob->oldUserId == $ob->requestedBy) { |
268 | - $notificationMessage = 'Swap accepted with '.$ob->newUserFirstName; |
|
268 | + $notificationMessage = 'Swap accepted with ' . $ob->newUserFirstName; |
|
269 | 269 | $notificationId = createNotificationForUser($ob->oldUserId, $notificationMessage, $message, 'swap', $linkToSwap); |
270 | - createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id='.$notificationId, $notificationMessage); |
|
270 | + createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id=' . $notificationId, $notificationMessage); |
|
271 | 271 | sendMail(getEmailWithId($ob->oldUserId), $subject, $message, $from); |
272 | 272 | } else { // notify both |
273 | - $notificationMessageOldUser = 'Swap accepted with '.$ob->newUserFirstName; |
|
274 | - $notificationMessageNewUser = 'Swap accepted with '.$ob->oldUserFirstName; |
|
273 | + $notificationMessageOldUser = 'Swap accepted with ' . $ob->newUserFirstName; |
|
274 | + $notificationMessageNewUser = 'Swap accepted with ' . $ob->oldUserFirstName; |
|
275 | 275 | $notificationIdOldUser = createNotificationForUser($ob->oldUserId, $notificationMessageOldUser, $message, 'swap', $linkToSwap); |
276 | 276 | $notificationIdNewUser = createNotificationForUser($ob->newUserId, $notificationMessageNewUser, $message, 'swap', $linkToSwap); |
277 | - createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id='.$notificationIdOldUser, $notificationMessage); |
|
278 | - createFacebookNotificationForUser($ob->newUserId, 'notification.php?id='.$notificationIdNewUser, $notificationMessage); |
|
277 | + createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id=' . $notificationIdOldUser, $notificationMessage); |
|
278 | + createFacebookNotificationForUser($ob->newUserId, 'notification.php?id=' . $notificationIdNewUser, $notificationMessage); |
|
279 | 279 | sendMail(getEmailWithId($ob->oldUserId), $subject, $message, $from); |
280 | 280 | sendMail(getEmailWithId($ob->newUserId), $subject, $message, $from); |
281 | 281 | } |
282 | 282 | } else { // notify both users |
283 | 283 | $sessionUserFirstName = getFirstNameWithId($sessionUserId); |
284 | - $notificationMessageOldUser = $sessionUserFirstName.' accepted a swap for '.$ob->newUserFirstName; |
|
285 | - $notificationMessageNewUser = $sessionUserFirstName.' accepted a swap for '.$ob->oldUserFirstName; |
|
284 | + $notificationMessageOldUser = $sessionUserFirstName . ' accepted a swap for ' . $ob->newUserFirstName; |
|
285 | + $notificationMessageNewUser = $sessionUserFirstName . ' accepted a swap for ' . $ob->oldUserFirstName; |
|
286 | 286 | $notificationIdOldUser = createNotificationForUser($ob->oldUserId, $notificationMessageOldUser, $message, 'swap', $linkToSwap); |
287 | 287 | $notificationIdNewUser = createNotificationForUser($ob->newUserId, $notificationMessageNewUser, $message, 'swap', $linkToSwap); |
288 | - createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id='.$notificationIdOldUser, $notificationMessage); |
|
289 | - createFacebookNotificationForUser($ob->newUserId, 'notification.php?id='.$notificationIdNewUser, $notificationMessage); |
|
288 | + createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id=' . $notificationIdOldUser, $notificationMessage); |
|
289 | + createFacebookNotificationForUser($ob->newUserId, 'notification.php?id=' . $notificationIdNewUser, $notificationMessage); |
|
290 | 290 | sendMail(getEmailWithId($ob->oldUserId), $subject, $message, $from); |
291 | 291 | sendMail(getEmailWithId($ob->newUserId), $subject, $message, $from); |
292 | 292 | } |
@@ -315,39 +315,39 @@ discard block |
||
315 | 315 | |
316 | 316 | $ob = mysqli_fetch_object($result); |
317 | 317 | |
318 | - $subject = 'Swap declined: '.$ob->newUserName.' - '.$ob->eventDate; |
|
319 | - $message = "The following swap has been declined\r\n\r\n". |
|
320 | - "Date:\t\t ".strftime($ob->time_format_long, strtotime($ob->eventDate))."\r\n". |
|
321 | - "Requested by:\t\t ".$ob->requestedBy."\r\n". |
|
322 | - "Swap from:\t\t ".$ob->oldUserName.' - '.$ob->oldRole."\r\n". |
|
323 | - "Swap to:\t\t ".$ob->newUserName.' - '.$ob->newRole."\r\n"; |
|
318 | + $subject = 'Swap declined: ' . $ob->newUserName . ' - ' . $ob->eventDate; |
|
319 | + $message = "The following swap has been declined\r\n\r\n" . |
|
320 | + "Date:\t\t " . strftime($ob->time_format_long, strtotime($ob->eventDate)) . "\r\n" . |
|
321 | + "Requested by:\t\t " . $ob->requestedBy . "\r\n" . |
|
322 | + "Swap from:\t\t " . $ob->oldUserName . ' - ' . $ob->oldRole . "\r\n" . |
|
323 | + "Swap to:\t\t " . $ob->newUserName . ' - ' . $ob->newRole . "\r\n"; |
|
324 | 324 | |
325 | 325 | $from = $ob->siteadmin; |
326 | 326 | |
327 | - $linkToSwap = 'swap.php?swap='.$swapId; |
|
327 | + $linkToSwap = 'swap.php?swap=' . $swapId; |
|
328 | 328 | |
329 | 329 | $sessionUserId = $_SESSION['userid']; |
330 | 330 | |
331 | 331 | if ($sessionUserId == $ob->oldUserId) { // if old user declines swap |
332 | 332 | // notify new user |
333 | - $notificationMessage = $ob->oldUserFirstName.' declined a swap'; |
|
333 | + $notificationMessage = $ob->oldUserFirstName . ' declined a swap'; |
|
334 | 334 | $notificationId = createNotificationForUser($ob->newUserId, $notificationMessage, $message, 'swap', $linkToSwap); |
335 | - createFacebookNotificationForUser($ob->newUserId, 'notification.php?id='.$notificationId, $notificationMessage); |
|
335 | + createFacebookNotificationForUser($ob->newUserId, 'notification.php?id=' . $notificationId, $notificationMessage); |
|
336 | 336 | sendMail(getEmailWithId($ob->newUserId), $subject, $message, $from); |
337 | 337 | } elseif ($sessionUserId == $ob->newUserId) { // if new user declines swap |
338 | 338 | // notify old user |
339 | - $notificationMessage = $ob->newUserFirstName.' declined a swap'; |
|
339 | + $notificationMessage = $ob->newUserFirstName . ' declined a swap'; |
|
340 | 340 | $notificationId = createNotificationForUser($ob->oldUserId, $notificationMessage, $message, 'swap', $linkToSwap); |
341 | - createFacebookNotificationForUser($ob->newUserId, 'notification.php?id='.$notificationId, $notificationMessage); |
|
341 | + createFacebookNotificationForUser($ob->newUserId, 'notification.php?id=' . $notificationId, $notificationMessage); |
|
342 | 342 | sendMail(getEmailWithId($ob->oldUserId), $subject, $message, $from); |
343 | 343 | } else { // notify both users |
344 | 344 | $sessionUserFirstName = getFirstNameWithId($sessionUserId); |
345 | - $notificationMessageOldUser = $sessionUserFirstName.' declined a swap for '.$ob->newUserFirstName; |
|
346 | - $notificationMessageNewUser = $sessionUserFirstName.' declined a swap for '.$ob->oldUserFirstName; |
|
345 | + $notificationMessageOldUser = $sessionUserFirstName . ' declined a swap for ' . $ob->newUserFirstName; |
|
346 | + $notificationMessageNewUser = $sessionUserFirstName . ' declined a swap for ' . $ob->oldUserFirstName; |
|
347 | 347 | $notificationIdOldUser = createNotificationForUser($ob->oldUserId, $notificationMessageOldUser, $message, 'swap', $linkToSwap); |
348 | 348 | $notificationIdNewUser = createNotificationForUser($ob->newUserId, $notificationMessageNewUser, $message, 'swap', $linkToSwap); |
349 | - createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id='.$notificationIdOldUser, $notificationMessage); |
|
350 | - createFacebookNotificationForUser($ob->newUserId, 'notification.php?id='.$notificationIdNewUser, $notificationMessage); |
|
349 | + createFacebookNotificationForUser($ob->oldUserId, 'notification.php?id=' . $notificationIdOldUser, $notificationMessage); |
|
350 | + createFacebookNotificationForUser($ob->newUserId, 'notification.php?id=' . $notificationIdNewUser, $notificationMessage); |
|
351 | 351 | sendMail(getEmailWithId($ob->newUserId), $subject, $message, $from); |
352 | 352 | sendMail(getEmailWithId($ob->oldUserId), $subject, $message, $from); |
353 | 353 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | |
497 | 497 | $sql = "UPDATE eventGroups SET archived = true WHERE id = '$seriesId'"; |
498 | 498 | if (!mysqli_query(db(), $sql)) { |
499 | - die('Error: '.mysqli_error(db())); |
|
499 | + die('Error: ' . mysqli_error(db())); |
|
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
@@ -505,13 +505,13 @@ discard block |
||
505 | 505 | $sql = "INSERT INTO bandMembers (bandId, userRoleId) VALUES ('$bandId', '$userRoleId')"; |
506 | 506 | |
507 | 507 | if (!mysqli_query(db(), $sql)) { |
508 | - die('Error: '.mysqli_error(db())); |
|
508 | + die('Error: ' . mysqli_error(db())); |
|
509 | 509 | } |
510 | 510 | } |
511 | 511 | |
512 | 512 | function getEventUrl($eventId) |
513 | 513 | { |
514 | - return 'event.php?id='.$eventId; |
|
514 | + return 'event.php?id=' . $eventId; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | function getEventDetails($eventID, $separator, $type = 4, $apprev_description = true, $prefix = '') |
@@ -551,9 +551,9 @@ discard block |
||
551 | 551 | e.id = $eventID "; |
552 | 552 | |
553 | 553 | if ($type == 1) { |
554 | - $sql = $sql."AND ((g.id in (10,11)) OR (g.id=2 and u.firstname='Team')) "; |
|
554 | + $sql = $sql . "AND ((g.id in (10,11)) OR (g.id=2 and u.firstname='Team')) "; |
|
555 | 555 | } |
556 | - $sql = $sql.'ORDER BY e.id, g.id desc, role, firstname, lastname '; |
|
556 | + $sql = $sql . 'ORDER BY e.id, g.id desc, role, firstname, lastname '; |
|
557 | 557 | |
558 | 558 | $result = mysqli_query(db(), $sql) or die(mysqli_error(db())); |
559 | 559 | |
@@ -571,32 +571,32 @@ discard block |
||
571 | 571 | |
572 | 572 | $firstname = $row['firstname']; |
573 | 573 | if ($firstname != 'Team') { |
574 | - $firstname = ltrim(substr($firstname, 0, 1).'.', '.'); |
|
574 | + $firstname = ltrim(substr($firstname, 0, 1) . '.', '.'); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | $lastname = $row['lastname']; |
578 | 578 | |
579 | - $returnValue = $returnValue.$separator; |
|
579 | + $returnValue = $returnValue . $separator; |
|
580 | 580 | switch ($type) { |
581 | 581 | case 0: |
582 | 582 | //all persons of event |
583 | 583 | //break; -> no special handling, fallthrough to case 1 |
584 | 584 | case 1: |
585 | 585 | //only persons with groupID in 10,11,2 -> handled in sql query |
586 | - $returnValue = $returnValue.$prefix.ltrim($group.': '); |
|
587 | - $returnValue = $returnValue.trim($firstname.' '.$lastname); |
|
586 | + $returnValue = $returnValue . $prefix . ltrim($group . ': '); |
|
587 | + $returnValue = $returnValue . trim($firstname . ' ' . $lastname); |
|
588 | 588 | break; |
589 | 589 | case 2: |
590 | 590 | //only event date and event type |
591 | - $returnValue = $returnValue.strftime($time_format_normal, strtotime($eventDate)); |
|
592 | - $returnValue = $returnValue.$separator; |
|
593 | - $returnValue = $returnValue.$eventType; |
|
591 | + $returnValue = $returnValue . strftime($time_format_normal, strtotime($eventDate)); |
|
592 | + $returnValue = $returnValue . $separator; |
|
593 | + $returnValue = $returnValue . $eventType; |
|
594 | 594 | |
595 | 595 | return trim(substr($returnValue, strlen($separator) - 1)); //ends while loop |
596 | 596 | break; |
597 | 597 | case 4: |
598 | 598 | //only event type |
599 | - $returnValue = $returnValue.$eventType; |
|
599 | + $returnValue = $returnValue . $eventType; |
|
600 | 600 | |
601 | 601 | return trim(substr($returnValue, strlen($separator) - 1)); //ends while loop |
602 | 602 | break; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | exit; |
36 | 36 | } |
37 | 37 | if (!isAdmin()) { |
38 | - header('Location: error.php?no=100&page='.basename($_SERVER['SCRIPT_FILENAME'])); |
|
38 | + header('Location: error.php?no=100&page=' . basename($_SERVER['SCRIPT_FILENAME'])); |
|
39 | 39 | exit; |
40 | 40 | } |
41 | 41 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | skin='$skin'"; |
168 | 168 | |
169 | 169 | if (!mysqli_query(db(), $sql)) { |
170 | - die('Error: '.mysqli_error(db())); |
|
170 | + die('Error: ' . mysqli_error(db())); |
|
171 | 171 | } |
172 | 172 | header('Location: settings.php'); |
173 | 173 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | <!-- Content Header (Page header) --> |
195 | 195 | <section class="content-header"> |
196 | 196 | <h1>Settings |
197 | - <?php echo '<small>v'.$row['version'].'</small>'; ?> |
|
197 | + <?php echo '<small>v' . $row['version'] . '</small>'; ?> |
|
198 | 198 | </h1> |
199 | 199 | <ol class="breadcrumb"> |
200 | 200 | <li><a href="<?php echo siteSettings()->getSiteUrl() ?>"><i class="fa fa-dashboard"></i> Home</a></li> |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $container = $app->getContainer(); |
22 | 22 | |
23 | 23 | // TWIG view renderer |
24 | -$container['view'] = function ($c) { |
|
24 | +$container['view'] = function($c) { |
|
25 | 25 | $settings = $c->get('settings')['renderer']; |
26 | 26 | $view = new Twig($settings['template_path'], [ |
27 | 27 | 'cache' => false, // or 'path/to/cache' |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $env = $view->getEnvironment(); |
47 | 47 | $env->addGlobal('site', new Site()); |
48 | 48 | $env->addGlobal('currenturl', $c->get('request')->getUri()); |
49 | - $env->addGlobal('currentpath', $c->get('request')->getUri()->getBasePath().'/'.$c->get('request')->getUri()->getPath()); |
|
49 | + $env->addGlobal('currentpath', $c->get('request')->getUri()->getBasePath() . '/' . $c->get('request')->getUri()->getPath()); |
|
50 | 50 | |
51 | 51 | if (isset($_SESSION['userId'])) { |
52 | 52 | $u = UserQuery::create()->findPk($_SESSION['userId']); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | }; |
60 | 60 | |
61 | 61 | // monolog |
62 | -$container['logger'] = function ($c) { |
|
62 | +$container['logger'] = function($c) { |
|
63 | 63 | $settings = $c->get('settings')['logger']; |
64 | 64 | $logger = new Monolog\Logger($settings['name']); |
65 | 65 | $logger->pushProcessor(new Monolog\Processor\UidProcessor()); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | return $logger; |
69 | 69 | }; |
70 | 70 | |
71 | -$container['auth'] = function ($c) { |
|
71 | +$container['auth'] = function($c) { |
|
72 | 72 | $authConfig = getConfig()['auth']; |
73 | 73 | |
74 | 74 | // full domain e.g. https://example.com |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | break; |
87 | 87 | |
88 | 88 | case 'onebody': |
89 | - $url = $authConfig['onebody']['url'].'/'; |
|
89 | + $url = $authConfig['onebody']['url'] . '/'; |
|
90 | 90 | $email = new EmailAddress($authConfig['onebody']['email']); |
91 | 91 | $apiKey = $authConfig['onebody']['apiKey']; |
92 | 92 | |
@@ -116,6 +116,6 @@ discard block |
||
116 | 116 | return new Authentication($c, $authProvider, $allowedRoutes); |
117 | 117 | }; |
118 | 118 | |
119 | -$container['csrf'] = function ($c) { |
|
119 | +$container['csrf'] = function($c) { |
|
120 | 120 | return new Guard(); |
121 | 121 | }; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | // Application middleware |
9 | 9 | |
10 | 10 | // 4) add route information to twig |
11 | -$app->add(function (Request $request, Response $response, callable $next) { |
|
11 | +$app->add(function(Request $request, Response $response, callable $next) { |
|
12 | 12 | $route = $request->getAttribute('route'); |
13 | 13 | |
14 | 14 | // return NotFound for non existent route |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | |
25 | 25 | $stage = 1; |
26 | 26 | |
27 | - $configPath = __DIR__.'/../../../config'; |
|
27 | + $configPath = __DIR__ . '/../../../config'; |
|
28 | 28 | if ( |
29 | - file_exists($configPath.'/auth.php') |
|
30 | - && file_exists($configPath.'/database.php') |
|
31 | - && file_exists($configPath.'/email.php') |
|
32 | - && file_exists($configPath.'/recording.php') |
|
29 | + file_exists($configPath . '/auth.php') |
|
30 | + && file_exists($configPath . '/database.php') |
|
31 | + && file_exists($configPath . '/email.php') |
|
32 | + && file_exists($configPath . '/recording.php') |
|
33 | 33 | ) { |
34 | 34 | $stage = 2; |
35 | 35 | } |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | 'command' => 'sql:build', |
78 | 78 | '-vvv' => true, |
79 | 79 | '--overwrite' => true, |
80 | - '--config-dir' => __DIR__.'/../../../generated-conf', |
|
81 | - '--schema-dir' => __DIR__.'/../../../', |
|
82 | - '--output-dir' => __DIR__.'/../../../build/sql', |
|
80 | + '--config-dir' => __DIR__ . '/../../../generated-conf', |
|
81 | + '--schema-dir' => __DIR__ . '/../../../', |
|
82 | + '--output-dir' => __DIR__ . '/../../../build/sql', |
|
83 | 83 | ]); |
84 | 84 | $propelGenerator->run($input, $output); |
85 | 85 | |
86 | 86 | $input = new ArrayInput([ |
87 | 87 | 'command' => 'sql:insert', |
88 | 88 | '-vvv' => true, |
89 | - '--config-dir' => __DIR__.'/../../../generated-conf', |
|
90 | - '--sql-dir' => __DIR__.'/../../../build/sql', |
|
89 | + '--config-dir' => __DIR__ . '/../../../generated-conf', |
|
90 | + '--sql-dir' => __DIR__ . '/../../../build/sql', |
|
91 | 91 | ]); |
92 | 92 | $propelGenerator->run($input, $output); |
93 | 93 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $existingUserCount = UserQuery::create()->count(); |
100 | 100 | } catch (\Propel\Runtime\Exception\PropelException $e) { |
101 | 101 | if ($e->getPrevious()->getCode() === '42S02') { |
102 | - return $response->getBody()->write('Error installing database:'."\n".$outputString); |
|
102 | + return $response->getBody()->write('Error installing database:' . "\n" . $outputString); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | return $this->view->render($response, 'login-credentials.twig', [ |
154 | 154 | 'username' => $user->getEmail(), |
155 | - 'message' => 'Your password is: '.$password.' Copy it somewhere safe as it will not be displayed again. You can change it once you\'ve logged in.', |
|
155 | + 'message' => 'Your password is: ' . $password . ' Copy it somewhere safe as it will not be displayed again. You can change it once you\'ve logged in.', |
|
156 | 156 | ]); |
157 | 157 | } |
158 | 158 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require __DIR__.'/../config/database.php'; |
|
3 | +require __DIR__ . '/../config/database.php'; |
|
4 | 4 | |
5 | 5 | return [ |
6 | 6 | 'propel' => [ |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | 'default' => [ |
10 | 10 | 'adapter' => 'mysql', |
11 | 11 | 'classname' => 'Propel\Runtime\Connection\ConnectionWrapper', |
12 | - 'dsn' => 'mysql:host='.$config['db']['host'].';dbname='.$config['db']['dbname'], |
|
12 | + 'dsn' => 'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['dbname'], |
|
13 | 13 | 'user' => $config['db']['user'], |
14 | 14 | 'password' => $config['db']['pass'], |
15 | 15 | 'attributes' => [], |
@@ -6,7 +6,7 @@ |
||
6 | 6 | } |
7 | 7 | |
8 | 8 | if (isset($_GET['filter'])) { |
9 | - header('Location: ../events/type/'.(int) $_GET['filter']); |
|
9 | + header('Location: ../events/type/' . (int) $_GET['filter']); |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 |