Completed
Pull Request — master (#26)
by Christopher
07:26
created
public/old/includes/config.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace TechWilk\Rota;
4 4
 
5
-include __DIR__.'/../../../config/database.php';
6
-include __DIR__.'/../../../config/auth.php';
7
-include __DIR__.'/../../../config/email.php';
8
-include __DIR__.'/../../../config/recording.php';
5
+include __DIR__ . '/../../../config/database.php';
6
+include __DIR__ . '/../../../config/auth.php';
7
+include __DIR__ . '/../../../config/email.php';
8
+include __DIR__ . '/../../../config/recording.php';
9 9
 
10 10
 // -- Setup database --
11 11
 
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 }
18 18
 
19 19
 // Connect to the database server
20
-$dbh = @mysqli_connect($config['db']['host'], $config['db']['user'], $config['db']['pass']) or die('Connection to '.$config['db']['host']." with login '".$config['db']['user']."'/'$pwdMasked' failed.");
20
+$dbh = @mysqli_connect($config['db']['host'], $config['db']['user'], $config['db']['pass']) or die('Connection to ' . $config['db']['host'] . " with login '" . $config['db']['user'] . "'/'$pwdMasked' failed.");
21 21
 
22 22
 // Choose the right database
23
-$db = @mysqli_select_db($dbh, $config['db']['dbname']) or die("Connection made, but database '".$config['db']['dbname']."' was not found.");
23
+$db = @mysqli_select_db($dbh, $config['db']['dbname']) or die("Connection made, but database '" . $config['db']['dbname'] . "' was not found.");
24 24
 
25 25
 // allow config to be fetched in functions
26 26
 
Please login to merge, or discard this patch.
public/old/includes/functions.mail.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -266,8 +266,10 @@  discard block
 block discarded – undo
266 266
     if (is_array($rotaoutput)):
267 267
         foreach ($rotaoutput as $key => $skill):
268 268
             $skillfinal = $skillfinal.$skill.' ';
269
-    endforeach; else:
269
+    endforeach; else {
270
+        :
270 271
         $skillfinal = $rotaoutput;
272
+    }
271 273
     endif;
272 274
     $message = str_replace('[rotaoutput]', $skillfinal, $message);
273 275
     $message = str_replace('[siteurl]', $siteurl, $message);
@@ -445,8 +447,10 @@  discard block
 block discarded – undo
445 447
             $roles = [];
446 448
             while ($roleRow = mysqli_fetch_array($roleResult, MYSQLI_ASSOC)) {
447 449
                 if (($roleRow['name'] == '') || ($roleRow['name'] == $roleRow['description'])):
448
-                    $roles[] = $roleRow['description']; else:
450
+                    $roles[] = $roleRow['description']; else {
451
+                        :
449 452
                     $roles[] = $roleRow['description'].' - '.$roleRow['name'];
453
+                    }
450 454
                 endif;
451 455
             }
452 456
 
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 {
28 28
     $dbMailId = mailToDb($to, $subject, $message, $from, $bcc);
29 29
 
30
-    $subject = '[rota] '.$subject;
30
+    $subject = '[rota] ' . $subject;
31 31
 
32 32
     $message .= "\n\n";
33
-    $message .= siteSettings()->getOwner()."\n";
34
-    $message .= 'Mail generated with ChurchRota V.'.siteSettings()->getVersion()."\n";
35
-    $message .= siteSettings()->getSiteUrl()."\n";
33
+    $message .= siteSettings()->getOwner() . "\n";
34
+    $message .= 'Mail generated with ChurchRota V.' . siteSettings()->getVersion() . "\n";
35
+    $message .= siteSettings()->getSiteUrl() . "\n";
36 36
 
37 37
     $mailSentOk = false;
38 38
 
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
     //rfc sais \r\n, but this makes trouble in outlook. several spaces plus \n works fine in outlook and thunderbird.
77 77
     //spaces to suppress automatic removal of "unnecessary linefeeds" in outlook 2003
78 78
     $crlf = "      \n";
79
-    $message = str_replace("\r\n", $crlf, $message);  //replace crlf's
79
+    $message = str_replace("\r\n", $crlf, $message); //replace crlf's
80 80
 
81 81
     //--------------------------------------------------------------------------------
82
-    $headers = 'From: '.$from.$crlf.
83
-    'Reply-To: '.$from.$crlf.
84
-    'Mime-Version: 1.0'.$crlf.
85
-    'Content-Type: text/plain; charset=ISO-8859-1'.$crlf;
86
-    'Content-Transfer-Encoding: quoted-printable'.$crlf;
82
+    $headers = 'From: ' . $from . $crlf .
83
+    'Reply-To: ' . $from . $crlf .
84
+    'Mime-Version: 1.0' . $crlf .
85
+    'Content-Type: text/plain; charset=ISO-8859-1' . $crlf;
86
+    'Content-Transfer-Encoding: quoted-printable' . $crlf;
87 87
     $headerSimple = $headers;
88 88
 
89 89
     //--------------------------------------------------------------------------------
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
     $to = str_replace(';', ',', $to);
93 93
 
94 94
     if ($mail_dbg) {
95
-        $subject = ' - Mail Debug: '.$subject;   //debug output
96
-        $message .= $crlf.'To: '.$to.$crlf;   //debug move to to end of message
95
+        $subject = ' - Mail Debug: ' . $subject; //debug output
96
+        $message .= $crlf . 'To: ' . $to . $crlf; //debug move to to end of message
97 97
     }
98 98
 
99 99
     //--------------------------------------------------------------------------------
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
     foreach ($teile as $adr) {
106 106
         if (preg_replace("/([a-zA-Z0-9._%+-]+)(@)([a-zA-Z0-9.-]+)(\.)([a-zA-Z]+)/i", '# # #', trim($adr)) == '# # #') {
107 107
             if ($mail_dbg) {
108
-                $message .= 'Bcc: '.trim($adr).$crlf;
108
+                $message .= 'Bcc: ' . trim($adr) . $crlf;
109 109
             } else {
110
-                $headers .= 'Bcc: '.trim($adr).$crlf;
110
+                $headers .= 'Bcc: ' . trim($adr) . $crlf;
111 111
             }
112 112
             $i = $i + 1;
113 113
         } else {
114
-            $bcc_err .= $adr.$crlf;
114
+            $bcc_err .= $adr . $crlf;
115 115
             $err .= +1;
116 116
         }
117 117
     }
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
         if ($mailOk) {
145 145
             //mail($from, "[ChurchRota] Mail status - OK", "address ok: " . $i, $headerSimple);
146 146
         } else {
147
-            mail($from, '[Rota] Mail status - ERROR', 'to: '.$to.$crlf.'address ok: '.$i.$crlf.'address errors: '.$err.$crlf.$bcc_err, $headerSimple);
147
+            mail($from, '[Rota] Mail status - ERROR', 'to: ' . $to . $crlf . 'address ok: ' . $i . $crlf . 'address errors: ' . $err . $crlf . $bcc_err, $headerSimple);
148 148
 
149 149
             return false;
150
-            logFailedMailWithId($dbMailId, 'address ok: '.$i.$crlf.'address errors: '.$err.$crlf.$bcc_err, $headerSimple);
150
+            logFailedMailWithId($dbMailId, 'address ok: ' . $i . $crlf . 'address errors: ' . $err . $crlf . $bcc_err, $headerSimple);
151 151
         }
152 152
     }
153 153
 
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
         }
205 205
         $categoryname = $row['categoryname'];
206 206
         $to = $row['email'];
207
-        $subject = 'New post: '.$objectname;
207
+        $subject = 'New post: ' . $objectname;
208 208
 
209
-        $finalmessage = 'Dear '.$postname."\n \n".$message.$objectname."\n \n".
209
+        $finalmessage = 'Dear ' . $postname . "\n \n" . $message . $objectname . "\n \n" .
210 210
         'To see the post, please login using your username and password';
211 211
 
212 212
         sendMail($to, $subject, $finalmessage, $row['siteadmin']);
@@ -226,19 +226,19 @@  discard block
 block discarded – undo
226 226
 
227 227
     $message = siteSettings()->getNewUserMessage();
228 228
 
229
-    $name = $user->firstName.' '.$user->lastName;
229
+    $name = $user->firstName . ' ' . $user->lastName;
230 230
     $message = str_replace('[name]', $name, $message);
231 231
     $message = str_replace('[username]', $user->username, $message);
232 232
     $message = str_replace('[password]', $password, $message);
233 233
     $message = str_replace('[siteurl]', siteSettings()->getSiteUrl(), $message);
234 234
 
235
-    $subject = 'Account created for '.$name;
235
+    $subject = 'Account created for ' . $name;
236 236
 
237
-    $to = $name.' <'.$user->email.'>';
238
-    $from = siteSettings()->getOwner().' <'.siteSettings()->getAdminEmailAddress().'>';
237
+    $to = $name . ' <' . $user->email . '>';
238
+    $from = siteSettings()->getOwner() . ' <' . siteSettings()->getAdminEmailAddress() . '>';
239 239
 
240 240
     sendMail($to, $subject, $message, $from);
241
-    sendMail($from, 'ADMIN COPY: '.$subject, $message, $from);
241
+    sendMail($from, 'ADMIN COPY: ' . $subject, $message, $from);
242 242
 }
243 243
 
244 244
 function parseEmailTemplate($message, $values)
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     $values['siteemail'] = siteSettings()->getAdminEmailAddress();
250 250
 
251 251
     foreach ($values as $template_field => $value) {
252
-        $message = str_ireplace('['.$template_field.']', trim($value), $message);
252
+        $message = str_ireplace('[' . $template_field . ']', trim($value), $message);
253 253
     }
254 254
     $message = trim($message);
255 255
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     $message = str_replace('[rehearsal]', $rehearsal, $message);
266 266
     if (is_array($rotaoutput)):
267 267
         foreach ($rotaoutput as $key => $skill):
268
-            $skillfinal = $skillfinal.$skill.' ';
268
+            $skillfinal = $skillfinal . $skill . ' ';
269 269
     endforeach; else:
270 270
         $skillfinal = $rotaoutput;
271 271
     endif;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 function notifyIndividual($userID, $eventID, $skillID)
284 284
 {
285 285
     notifyEveryoneForEvent($eventID, $skillID, $userID);
286
-    $eventID = 0;  //disables following code through empty sql result
286
+    $eventID = 0; //disables following code through empty sql result
287 287
 
288 288
     $sql = "SELECT *,
289 289
 	(SELECT CONCAT(`firstname`, ' ', `lastname`) FROM cr_users WHERE `cr_users`.id = `cr_skills`.`userID` ORDER BY `cr_users`.firstname) AS `name`,
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
             if (($row['eventRehearsal'] == '0') or ($row['eventRehearsalChange'] == '1')) {
325 325
                 $rehearsal = $row['norehearsalemail'];
326 326
             } else {
327
-                $rehearsal = $row['yesrehearsal'].' on '.$rehearsaldate.' at '.$location;
327
+                $rehearsal = $row['yesrehearsal'] . ' on ' . $rehearsaldate . ' at ' . $location;
328 328
             }
329 329
         }
330 330
 
331 331
         $skill = $row['category'];
332 332
         if ($row['joinedskill'] != '') {
333
-            $skill = $skill.' - '.$row['joinedskill'];
333
+            $skill = $skill . ' - ' . $row['joinedskill'];
334 334
         } else {
335 335
             // If there is no skill, then we don't need to mention this fact.
336 336
         }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         $location = $row['eventLocationFormatted'];
347 347
         $rotaoutput = $skill;
348 348
         $to = $row['email'];
349
-        $subject = 'Rota reminder: '.$date;
349
+        $subject = 'Rota reminder: ' . $date;
350 350
 
351 351
         $message = emailTemplate($message, $name, $date, $location, $rehearsal, $rotaoutput, $username, $siteurl);
352 352
 
@@ -421,9 +421,9 @@  discard block
 block discarded – undo
421 421
                     $comment = '-';
422 422
                 }
423 423
 
424
-                $eventdetails = $eventrow['eventGroup'].': '.$eventrow['sermonTitle'];
424
+                $eventdetails = $eventrow['eventGroup'] . ': ' . $eventrow['sermonTitle'];
425 425
                 if (!empty($eventrow['bibleVerse'])) {
426
-                    $eventdetails .= ' ('.$eventrow['bibleVerse'].')';
426
+                    $eventdetails .= ' (' . $eventrow['bibleVerse'] . ')';
427 427
                 }
428 428
             }
429 429
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
             while ($roleRow = mysqli_fetch_array($roleResult, MYSQLI_ASSOC)) {
447 447
                 if (($roleRow['name'] == '') || ($roleRow['name'] == $roleRow['description'])):
448 448
                     $roles[] = $roleRow['description']; else:
449
-                    $roles[] = $roleRow['description'].' - '.$roleRow['name'];
449
+                    $roles[] = $roleRow['description'] . ' - ' . $roleRow['name'];
450 450
                 endif;
451 451
             }
452 452
 
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
             $message = siteSettings()->getNotificationEmail();
467 467
             $rotaoutput = implode(', ', $roles);
468 468
 
469
-            $to = $ob->name.' <'.$ob->email.'>';
470
-            $from = siteSettings()->getOwner().' <'.siteSettings()->getAdminEmailAddress().'>';
469
+            $to = $ob->name . ' <' . $ob->email . '>';
470
+            $from = siteSettings()->getOwner() . ' <' . siteSettings()->getAdminEmailAddress() . '>';
471 471
 
472 472
             //$subject = "Rota reminder: " . $date;
473
-            $subject = 'Reminder: '.implode(', ', $roles).' - '.$type.': '.$date;
473
+            $subject = 'Reminder: ' . implode(', ', $roles) . ' - ' . $type . ': ' . $date;
474 474
 
475 475
             $rotadetails = getEventDetails($eventId, "\r\n", 0, false, "\t");
476 476
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 							ep.notified = 1
507 507
 						WHERE
508 508
 							ep.eventId = '$eventId'
509
-							AND ur.userId IN (".implode(', ', $countarray).')';
509
+							AND ur.userId IN (" . implode(', ', $countarray) . ')';
510 510
 
511 511
         mysqli_query(db(), $sql) or die(mysqli_error(db()));
512 512
     }
@@ -535,14 +535,14 @@  discard block
 block discarded – undo
535 535
     $user = mysqli_fetch_object($result);
536 536
 
537 537
     if (!$user->email) {
538
-        return 'No email address present for '.$user->firstName.' '.$user->lastName;
538
+        return 'No email address present for ' . $user->firstName . ' ' . $user->lastName;
539 539
     }
540 540
 
541 541
     if (!$user->recieveReminderEmails) {
542
-        return $user->firstName.' '.$user->lastName.' opted not to recieve reminder emails';
542
+        return $user->firstName . ' ' . $user->lastName . ' opted not to recieve reminder emails';
543 543
     }
544 544
 
545
-    $name = $user->firstName.' '.$user->lastName;
545
+    $name = $user->firstName . ' ' . $user->lastName;
546 546
 
547 547
     //line seperator for mails
548 548
     //rfc sais \r\n, but this makes trouble in outlook. several spaces plus \n works fine in outlook and thunderbird.
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
     $eventDetails .= ' - ';
577 577
     $eventDetails .= "\r\n";
578 578
     $eventDetails .= $event->type;
579
-    $eventDetails .= $event->eventGroup.': '.$event->sermonTitle.' ('.$event->bibleVerse.')';
579
+    $eventDetails .= $event->eventGroup . ': ' . $event->sermonTitle . ' (' . $event->bibleVerse . ')';
580 580
     $eventDetails .= "\r\n";
581
-    $eventDetails .= 'Notes: '.$event->comment;
581
+    $eventDetails .= 'Notes: ' . $event->comment;
582 582
     $eventDetails .= "\r\n";
583 583
     $eventDetails .= "\r\n";
584 584
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
         'event.location' => $event->location,
604 604
         'event.comment'  => $event->comment,
605 605
 
606
-        'event.sermon'        => $event->eventGroup.': '.$event->sermonTitle.' ('.$event->bibleVerse.')',
606
+        'event.sermon'        => $event->eventGroup . ': ' . $event->sermonTitle . ' (' . $event->bibleVerse . ')',
607 607
         'event.sermon.name'   => $event->sermonTitle,
608 608
         'event.sermon.series' => $event->eventGroup,
609 609
         'event.sermon.verse'  => $event->bibleVerse,
@@ -617,8 +617,8 @@  discard block
 block discarded – undo
617 617
 
618 618
     //$message = str_replace("\r\n",$crlf,$message);
619 619
 
620
-    $to = $name.' <'.$user->email.'>';
621
-    $from = siteSettings()->getOwner().' <'.$siteSettings()->getAdminEmailAddress().'>';
620
+    $to = $name . ' <' . $user->email . '>';
621
+    $from = siteSettings()->getOwner() . ' <' . $siteSettings()->getAdminEmailAddress() . '>';
622 622
 
623 623
     $sent = false;
624 624
     $sent = sendMail($to, $subject, $message, $from);
@@ -626,10 +626,10 @@  discard block
 block discarded – undo
626 626
     if ($sent == true) {
627 627
         return true;
628 628
     } else {
629
-        return 'Error while sending mail to '.$user->firstName.' '.$user->lastName;
629
+        return 'Error while sending mail to ' . $user->firstName . ' ' . $user->lastName;
630 630
     }
631 631
 
632
-    return 'Unknown error for '.$user->firstName.' '.$user->lastName;
632
+    return 'Unknown error for ' . $user->firstName . ' ' . $user->lastName;
633 633
 }
634 634
 
635 635
 function getEventEmailSubject($eventId)
@@ -676,16 +676,16 @@  discard block
 block discarded – undo
676 676
     $result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
677 677
     $groupNames = '';
678 678
     while ($group = mysqli_fetch_object($result)) {
679
-        $groupNames .= $group->name.', ';
679
+        $groupNames .= $group->name . ', ';
680 680
     }
681 681
 
682 682
     if (isset($errors)) {
683
-        createNotificationForUser($_SESSION['userid'], 'Email sent with warnings', 'Email sent to '.$groupNames.' groups with errors: '.implode(', ', $errors), 'email');
683
+        createNotificationForUser($_SESSION['userid'], 'Email sent with warnings', 'Email sent to ' . $groupNames . ' groups with errors: ' . implode(', ', $errors), 'email');
684 684
 
685 685
         return $errors;
686 686
     }
687 687
 
688
-    createNotificationForUser($_SESSION['userid'], 'Group email sent', 'Email sent successfully to '.$groupNames, 'email');
688
+    createNotificationForUser($_SESSION['userid'], 'Group email sent', 'Email sent successfully to ' . $groupNames, 'email');
689 689
 
690 690
     return $true;
691 691
 }
@@ -737,16 +737,16 @@  discard block
 block discarded – undo
737 737
     $result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
738 738
     $groupNames = '';
739 739
     while ($group = mysqli_fetch_object($result)) {
740
-        $groupNames .= $group->name.', ';
740
+        $groupNames .= $group->name . ', ';
741 741
     }
742 742
 
743 743
     if (isset($errors)) {
744
-        createNotificationForUser($_SESSION['userid'], 'Email sent with warnings', 'Email sent to '.$groupNames." groups with errors: \n- ".implode("\n- ", $errors), 'email');
744
+        createNotificationForUser($_SESSION['userid'], 'Email sent with warnings', 'Email sent to ' . $groupNames . " groups with errors: \n- " . implode("\n- ", $errors), 'email');
745 745
 
746 746
         return $errors;
747 747
     }
748 748
 
749
-    createNotificationForUser($_SESSION['userid'], 'Group email sent', 'Email sent successfully to '.$groupNames, 'email');
749
+    createNotificationForUser($_SESSION['userid'], 'Group email sent', 'Email sent successfully to ' . $groupNames, 'email');
750 750
 
751 751
     return $true;
752 752
 }
@@ -762,14 +762,14 @@  discard block
 block discarded – undo
762 762
     $user = mysqli_fetch_object($result);
763 763
 
764 764
     if (!$user->email) {
765
-        return 'No email address present for '.$user->firstName.' '.$user->lastName;
765
+        return 'No email address present for ' . $user->firstName . ' ' . $user->lastName;
766 766
     }
767 767
 
768 768
     if (!$user->isOverviewRecipient) {
769
-        return $user->firstName.' '.$user->lastName.' opted not to recieve group emails';
769
+        return $user->firstName . ' ' . $user->lastName . ' opted not to recieve group emails';
770 770
     }
771 771
 
772
-    $name = $user->firstName.' '.$user->lastName;
772
+    $name = $user->firstName . ' ' . $user->lastName;
773 773
 
774 774
     //line seperator for mails
775 775
     //rfc sais \r\n, but this makes trouble in outlook. several spaces plus \n works fine in outlook and thunderbird.
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 
817 817
     $eventDetails .= $ob->roles;
818 818
     $eventDetails .= "\r\n";
819
-    $eventDetails .= 'Notes: '.$ob->comment;
819
+    $eventDetails .= 'Notes: ' . $ob->comment;
820 820
     $eventDetails .= "\r\n";
821 821
     $eventDetails .= "\r\n";
822 822
 
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
 
836 836
     //$message = str_replace("\r\n",$crlf,$message);
837 837
 
838
-    $to = $name.' <'.$user->email.'>';
839
-    $from = siteSettings()->getOwner().' <'.$siteadmin.'>';
838
+    $to = $name . ' <' . $user->email . '>';
839
+    $from = siteSettings()->getOwner() . ' <' . $siteadmin . '>';
840 840
 
841 841
     $sent = false;
842 842
     $sent = sendMail($to, $subject, $message, $from);
@@ -844,10 +844,10 @@  discard block
 block discarded – undo
844 844
     if ($sent == true) {
845 845
         return true;
846 846
     } else {
847
-        return 'Error while sending mail to '.$user->firstName.' '.$user->lastName;
847
+        return 'Error while sending mail to ' . $user->firstName . ' ' . $user->lastName;
848 848
     }
849 849
 
850
-    return 'Unknown error for '.$user->firstName.' '.$user->lastName;
850
+    return 'Unknown error for ' . $user->firstName . ' ' . $user->lastName;
851 851
 }
852 852
 
853 853
 // returns either true, or error message string
@@ -860,14 +860,14 @@  discard block
 block discarded – undo
860 860
     $user = mysqli_fetch_object($result);
861 861
 
862 862
     if (!$user->email) {
863
-        return 'No email address present for '.$user->firstName.' '.$user->lastName;
863
+        return 'No email address present for ' . $user->firstName . ' ' . $user->lastName;
864 864
     }
865 865
 
866 866
     if (!$user->isOverviewRecipient) {
867
-        return $user->firstName.' '.$user->lastName.' opted not to recieve group emails';
867
+        return $user->firstName . ' ' . $user->lastName . ' opted not to recieve group emails';
868 868
     }
869 869
 
870
-    $name = $user->firstName.' '.$user->lastName;
870
+    $name = $user->firstName . ' ' . $user->lastName;
871 871
 
872 872
     //line seperator for mails
873 873
     //rfc sais \r\n, but this makes trouble in outlook. several spaces plus \n works fine in outlook and thunderbird.
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
     }
901 901
 
902 902
     if (!isset($events)) {
903
-        return $name.' has no events in the upcoming rota';
903
+        return $name . ' has no events in the upcoming rota';
904 904
     }
905 905
 
906 906
     $events = implode(', ', $events);
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 
956 956
         $eventDetails .= $row['joinedskills'];
957 957
         $eventDetails .= "\r\n";
958
-        $eventDetails .= 'Notes: '.$row['comment'];
958
+        $eventDetails .= 'Notes: ' . $row['comment'];
959 959
         $eventDetails .= "\r\n";
960 960
         $eventDetails .= "\r\n";
961 961
     }
@@ -971,8 +971,8 @@  discard block
 block discarded – undo
971 971
 
972 972
     //$message = str_replace("\r\n",$crlf,$message);
973 973
 
974
-    $to = $name.' <'.$user->email.'>';
975
-    $from = siteSettings()->getOwner().' <'.$siteadmin.'>';
974
+    $to = $name . ' <' . $user->email . '>';
975
+    $from = siteSettings()->getOwner() . ' <' . $siteadmin . '>';
976 976
 
977 977
     $sent = false;
978 978
     $sent = sendMail($to, $subject, $message, $from);
@@ -980,10 +980,10 @@  discard block
 block discarded – undo
980 980
     if ($sent == true) {
981 981
         return true;
982 982
     } else {
983
-        return 'Error while sending mail to '.$user->firstName.' '.$user->lastName;
983
+        return 'Error while sending mail to ' . $user->firstName . ' ' . $user->lastName;
984 984
     }
985 985
 
986
-    return 'Unknown error for '.$user->firstName.' '.$user->lastName;
986
+    return 'Unknown error for ' . $user->firstName . ' ' . $user->lastName;
987 987
 }
988 988
 
989 989
 function notifyAttack($fileName, $attackType, $attackerID)
@@ -998,10 +998,10 @@  discard block
 block discarded – undo
998 998
 
999 999
     while ($row = mysqli_fetch_array($userresult, MYSQLI_ASSOC)) {
1000 1000
         $subject = 'SECURITY-ALERT - Attack blocked successfully';
1001
-        $message = "Type:\t\t ".$attackType."<br>\r\n".
1002
-                    "Attacker:\t ".$row[name]."<br>\r\n".
1003
-                    "Date:\t\t ".date('Y-m-d H:i:s')."<br>\r\n".
1004
-                    "Script:\t\t ".$fileName."\r\n "."<br>\r\n";
1001
+        $message = "Type:\t\t " . $attackType . "<br>\r\n" .
1002
+                    "Attacker:\t " . $row[name] . "<br>\r\n" .
1003
+                    "Date:\t\t " . date('Y-m-d H:i:s') . "<br>\r\n" .
1004
+                    "Script:\t\t " . $fileName . "\r\n " . "<br>\r\n";
1005 1005
 
1006 1006
         //$headers = 'From: ' . $row['siteadmin'] . "\r\n" .
1007 1007
         //'Reply-To: ' . $row['siteadmin'] . "\r\n";
@@ -1011,8 +1011,8 @@  discard block
 block discarded – undo
1011 1011
         //mail($to, $subject, strip_tags($message), $headers);
1012 1012
         sendMail($to, $subject, strip_tags($message), $to);
1013 1013
 
1014
-        echo $subject.'<br><br>';
1015
-        echo $message.'<br>';
1014
+        echo $subject . '<br><br>';
1015
+        echo $message . '<br>';
1016 1016
         echo 'An email about this incident was sent to administrator!';
1017 1017
     }
1018 1018
 }
@@ -1027,11 +1027,11 @@  discard block
 block discarded – undo
1027 1027
     $userresult = mysqli_query(db(), $sql) or die(mysqli_error(db()));
1028 1028
 
1029 1029
     while ($row = mysqli_fetch_array($userresult, MYSQLI_ASSOC)) {
1030
-        $subject = 'Info - '.$infoMsg.' - '.$row[name];
1031
-        $message = "Type:\t\t ".$infoMsg."<br>\r\n".
1032
-                    "User:\t\t ".$row[name]."<br>\r\n".
1033
-                    "Date:\t\t ".date('Y-m-d H:i:s')."<br>\r\n".
1034
-                    "Script:\t\t ".$fileName."\r\n "."<br>\r\n";
1030
+        $subject = 'Info - ' . $infoMsg . ' - ' . $row[name];
1031
+        $message = "Type:\t\t " . $infoMsg . "<br>\r\n" .
1032
+                    "User:\t\t " . $row[name] . "<br>\r\n" .
1033
+                    "Date:\t\t " . date('Y-m-d H:i:s') . "<br>\r\n" .
1034
+                    "Script:\t\t " . $fileName . "\r\n " . "<br>\r\n";
1035 1035
 
1036 1036
         //$headers = 'From: ' . $row['siteadmin'] . "\r\n" .
1037 1037
         //'Reply-To: ' . $row['siteadmin'] . "\r\n";
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
     if (preg_match("/(\{\{)((.)+){1}(\}\})/", $message, $matches) == 1) {
1049 1049
         $defaultSubject = $matches[2];
1050 1050
         //$subject = str_replace(array("{{","}}"),"",$matches[0]);
1051
-        $message = str_replace($matches[1].$matches[2].$matches[4], '', $message);
1051
+        $message = str_replace($matches[1] . $matches[2] . $matches[4], '', $message);
1052 1052
         //$message = $matches[4];
1053 1053
 
1054 1054
         //$message = $message . "\r\n\r\n";
Please login to merge, or discard this patch.
public/old/includes/functions.users.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
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 cr_users (firstName, lastName, username, email, mobile, password, created, updated)
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
145 145
     $sql = "SELECT firstName, lastName FROM cr_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
 block discarded – undo
219 219
     $currentTimestamp = date('Y-m-d H:i:s');
220 220
     $sql = "UPDATE cr_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)
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     if ($loginFailures < $numberOfAllowedAttempts) {
265 265
         return true;
266 266
     } else {
267
-        insertStatistics('user', __FILE__, 'Login attempts exceeded for username: '.$username, $ipAddress, $_SERVER['HTTP_USER_AGENT']);
267
+        insertStatistics('user', __FILE__, 'Login attempts exceeded for username: ' . $username, $ipAddress, $_SERVER['HTTP_USER_AGENT']);
268 268
 
269 269
         return false;
270 270
     }
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
     $result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
341 341
 
342 342
     $pendingId = mysqli_insert_id(db());
343
-    $linkToApprove = 'pendingAccounts.php?id='.$pendingId;
343
+    $linkToApprove = 'pendingAccounts.php?id=' . $pendingId;
344 344
 
345
-    $email = siteSettings()->getOwner().'<'.siteSettings()->getAdminEmailAddress().'>';
346
-    $subject = $firstName.' requested an account';
347
-    $message = $subject.' through '.$source.".\nApprove or decline: ".siteSettings()->getSiteUrl().'/'.$linkToApprove;
345
+    $email = siteSettings()->getOwner() . '<' . siteSettings()->getAdminEmailAddress() . '>';
346
+    $subject = $firstName . ' requested an account';
347
+    $message = $subject . ' through ' . $source . ".\nApprove or decline: " . siteSettings()->getSiteUrl() . '/' . $linkToApprove;
348 348
 
349 349
     sendMail($email, $subject, $message, $email);
350 350
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
     addSocialAuthToUserWithId($userId, $pendingUser->socialId, $pendingUser->source);
417 417
     updateUser($userId, $pendingUser->firstName, $pendingUser->lastName, $pendingUser->email, null);
418 418
 
419
-    createNotificationForUser($userId, 'Social Login added: '.$pendingUser->source, 'Your social media login details for '.$pendingUser->source.' have been added to your existing account', 'account');
419
+    createNotificationForUser($userId, 'Social Login added: ' . $pendingUser->source, 'Your social media login details for ' . $pendingUser->source . ' have been added to your existing account', 'account');
420 420
     createFacebookNotificationForUser($userId, 'login.php', 'Your account request has been approved. You can now login via Facebook.');
421 421
 
422 422
     return true;
@@ -499,32 +499,32 @@  discard block
 block discarded – undo
499 499
 
500 500
 function getProfileImageUrl($userId, $size = 'small')
501 501
 {
502
-    $sql = 'SELECT sa.socialId, u.email FROM cr_users u LEFT JOIN cr_socialAuth sa ON sa.userId = u.id WHERE id = '.$userId;
502
+    $sql = 'SELECT sa.socialId, u.email FROM cr_users u LEFT JOIN cr_socialAuth sa ON sa.userId = u.id WHERE id = ' . $userId;
503 503
     $result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
504 504
     $user = mysqli_fetch_object($result);
505 505
 
506 506
     if ($user->socialId) {
507 507
         switch ($size) {
508 508
             case 'small': // 50px x 50px
509
-                return '//graph.facebook.com/'.$user->socialId.'/picture?type=square';
509
+                return '//graph.facebook.com/' . $user->socialId . '/picture?type=square';
510 510
                 break;
511 511
             case 'large': // 200px x 200px
512
-                return '//graph.facebook.com/'.$user->socialId.'/picture?type=large';
512
+                return '//graph.facebook.com/' . $user->socialId . '/picture?type=large';
513 513
                 break;
514 514
             default:
515
-                return '//graph.facebook.com/'.$user->socialId.'/picture';
515
+                return '//graph.facebook.com/' . $user->socialId . '/picture';
516 516
                 break;
517 517
         }
518 518
     } else {
519 519
         switch ($size) {
520 520
             case 'small': // 50px x 50px
521
-                return '//www.gravatar.com/avatar/'.md5(strtolower(trim($user->email))).'?s=50&d=mm';
521
+                return '//www.gravatar.com/avatar/' . md5(strtolower(trim($user->email))) . '?s=50&d=mm';
522 522
                 break;
523 523
             case 'large': // 200px x 200px
524
-                return '//www.gravatar.com/avatar/'.md5(strtolower(trim($user->email))).'?s=200&d=mm';
524
+                return '//www.gravatar.com/avatar/' . md5(strtolower(trim($user->email))) . '?s=200&d=mm';
525 525
                 break;
526 526
             default:
527
-                return '//www.gravatar.com/avatar/'.md5(strtolower(trim($user->email))).'?s=50&d=mm';
527
+                return '//www.gravatar.com/avatar/' . md5(strtolower(trim($user->email))) . '?s=50&d=mm';
528 528
                 break;
529 529
         }
530 530
     }
Please login to merge, or discard this patch.
public/old/includes/functions.discussion.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
         '#(http://(www.)?youtube.com)?/(v/|watch\?v\=)([-|~_0-9A-Za-z]+)&?.*?#i',
47 47
         '<iframe title="YouTube Video" width="560" height="340" src="http://www.youtube.com/embed/$4" frameborder="0" allowfullscreen></iframe>',
48 48
     $string
49
-  );
49
+    );
50 50
 
51 51
     return $string;
52 52
 }
Please login to merge, or discard this patch.
public/old/includes/header.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 							<!-- Menu toggle button -->
295 295
 							<a href="#" class="dropdown-toggle" data-toggle="dropdown">
296 296
 								<i class="fa fa-bell-o"></i>
297
-								<?php echo $unseen >= 1 ? '<span class="label label-warning">'.$unseen.'</span>' : '' ?>
297
+								<?php echo $unseen >= 1 ? '<span class="label label-warning">' . $unseen . '</span>' : '' ?>
298 298
 							</a>
299 299
 							<ul class="dropdown-menu">
300 300
 								<li class="header">You have <?php echo $unseen >= 1 ? $unseen : 'no' ?> new notifications</li>
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 									<?php foreach ($notifications as $n): ?>
305 305
 										<li><!-- start notification -->
306 306
 											<a href="notification.php?click=notifications-panel&id=<?php echo $n->id ?>">
307
-												<i class="fa fa-users text-aqua"></i> <?php echo $n->seen ? $n->summary : '<strong>'.$n->summary.'</strong>' ?>
307
+												<i class="fa fa-users text-aqua"></i> <?php echo $n->seen ? $n->summary : '<strong>' . $n->summary . '</strong>' ?>
308 308
 												<small><?php echo timeAgoInWords($n->timestamp) ?></small>
309 309
 											</a>
310 310
 										</li><!-- end notification -->
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 						<!-- User Account Menu -->
360 360
 						<li class="dropdown user user-menu">
361 361
 							<?php
362
-                            $sql = 'SELECT u.created FROM cr_users u WHERE id = '.$_SESSION['userid'];
362
+                            $sql = 'SELECT u.created FROM cr_users u WHERE id = ' . $_SESSION['userid'];
363 363
                                             $result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
364 364
                                             $currentUser = mysqli_fetch_object($result);
365 365
                             ?>
Please login to merge, or discard this patch.
public/old/includes/functions.auth.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         $_SESSION['db_is_logged_in'] = true;
18 18
         $_SESSION['isAdmin'] = $row['isAdmin']; // Set the admin status to be carried across this session
19 19
         $_SESSION['userid'] = $row['id'];
20
-        $_SESSION['name'] = $row['firstName'].' '.$row['lastName'];
20
+        $_SESSION['name'] = $row['firstName'] . ' ' . $row['lastName'];
21 21
         $_SESSION['isBandAdmin'] = $row['isBandAdmin']; // Set the band admin status to be carried across this session
22 22
         $_SESSION['isEventEditor'] = $row['isEventEditor']; // Set the event editor status to be carried across this session
23 23
         $_SESSION['onlyShowUserEvents'] = $users_start_with_myevents; // 1 if users_start_with_myevents is set in settings, can be changed by user during session
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 
30 30
         // admin section
31 31
         if ($_SESSION['isAdmin'] == 1) {
32
-            updateDatabase();                        //check for db updates
32
+            updateDatabase(); //check for db updates
33 33
             //$_SESSION['onlyShowUserEvents'] = '0';		//show all events for admin, regardless what settings say
34 34
         }
35 35
 
36 36
         // Update last login timestamp
37 37
         $currentTimestamp = date('Y-m-d H:i:s');
38
-        $sql = "UPDATE cr_users SET lastLogin = '$currentTimestamp' WHERE id = '".$row['id']."'";
38
+        $sql = "UPDATE cr_users SET lastLogin = '$currentTimestamp' WHERE id = '" . $row['id'] . "'";
39 39
         mysqli_query(db(), $sql) or die(mysqli_error(db()));
40 40
 
41 41
         // redirect
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
             $redirectFromSession = strip_tags($_SESSION['redirectUrl']);
45 45
             unset($_SESSION['redirectUrl']);
46 46
             // check is url is on same domain and prevents redirecting to logout page
47
-            if (strncmp(strtolower(siteSettings()->getSiteUrl().'/'), strtolower($redirectFromSession), (strlen(siteSettings()->getSiteUrl()) + 1)) == 0 && strpos($redirectFromSession, 'logout.php') === false) {
47
+            if (strncmp(strtolower(siteSettings()->getSiteUrl() . '/'), strtolower($redirectFromSession), (strlen(siteSettings()->getSiteUrl()) + 1)) == 0 && strpos($redirectFromSession, 'logout.php') === false) {
48 48
                 $redirectUrl = $redirectFromSession;
49 49
             }
50 50
         }
51
-        header('Location: '.$redirectUrl);
51
+        header('Location: ' . $redirectUrl);
52 52
         exit;
53 53
     }
54 54
 }
Please login to merge, or discard this patch.
public/old/includes/functions.roles.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     $sql = "UPDATE cr_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
 block discarded – undo
39 39
     $sql = "UPDATE cr_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 cr_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
 block discarded – undo
54 54
     $sql = "UPDATE cr_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
 block discarded – undo
131 131
         return $ob->allowRoleSwaps;
132 132
     }
133 133
 
134
-    $sql = "SELECT allowRoleSwaps FROM cr_groups WHERE id = '".$ob->groupId."'";
134
+    $sql = "SELECT allowRoleSwaps FROM cr_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
 
Please login to merge, or discard this patch.
public/old/includes/functions.event.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     $sql = ("INSERT INTO cr_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
 block discarded – undo
29 29
 {
30 30
     $sql = "DELETE FROM cr_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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
496 496
 
497 497
     $sql = "UPDATE cr_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
 block discarded – undo
505 505
     $sql = "INSERT INTO cr_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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
public/old/includes/functions.notifications.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     7 => 'swap-pending',
16 16
     8 => 'swap-approved',
17 17
     9 => 'email',
18
-  ];
18
+    ];
19 19
 }
20 20
 
21 21
 function createNotificationForUser($userId, $summary, $body, $typeName, $link = null)
Please login to merge, or discard this patch.