Completed
Pull Request — master (#26)
by Christopher
07:26
created
src/classes/Controller/RoleController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 {
14 14
     public function getAssignRolesForm(ServerRequestInterface $request, ResponseInterface $response, $args)
15 15
     {
16
-        $this->logger->info("Fetch user GET '/user/".$args['id']."/roles'");
16
+        $this->logger->info("Fetch user GET '/user/" . $args['id'] . "/roles'");
17 17
         $r = RoleQuery::create()->find();
18 18
         $u = UserQuery::create()->findPK($args['id']);
19 19
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function postUserAssignRoles(ServerRequestInterface $request, ResponseInterface $response, $args)
28 28
     {
29
-        $this->logger->info("Create user people POST '/user/".$args['id']."/roles'");
29
+        $this->logger->info("Create user people POST '/user/" . $args['id'] . "/roles'");
30 30
 
31 31
         $userId = filter_var($args['id'], FILTER_SANITIZE_NUMBER_INT);
32 32
         $existingRoles = RoleQuery::create()->useUserRoleQuery()->filterByUserId($userId)->endUse()->find();
Please login to merge, or discard this patch.
src/classes/Controller/CalendarController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     public function getRevokeCalendar(ServerRequestInterface $request, ResponseInterface $response, $args)
78 78
     {
79
-        $this->logger->info("Fetch settings GET '/user/me/calendar/".$args['id']."/revoke'");
79
+        $this->logger->info("Fetch settings GET '/user/me/calendar/" . $args['id'] . "/revoke'");
80 80
 
81 81
         $auth = $this->auth;
82 82
         $u = $auth->currentUser();
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
     public function getRenderedCalendar(ServerRequestInterface $request, ResponseInterface $response, $args)
103 103
     {
104
-        $this->logger->info("Fetch calendar GET '/calendar/".$args['token'].'.'.$args['format']."'");
104
+        $this->logger->info("Fetch calendar GET '/calendar/" . $args['token'] . '.' . $args['format'] . "'");
105 105
 
106 106
         $c = CalendarTokenQuery::create()
107 107
             ->filterByToken($args['token'])
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     {
119 119
         $getParameters = $request->getQueryParams();
120 120
 
121
-        $this->logger->info("Fetch -LEGACY- calendar GET '/calendar.php?user=".$getParameters['user'].'&token='.$getParameters['token'].'&format='.$getParameters['format']."'");
121
+        $this->logger->info("Fetch -LEGACY- calendar GET '/calendar.php?user=" . $getParameters['user'] . '&token=' . $getParameters['token'] . '&format=' . $getParameters['format'] . "'");
122 122
 
123 123
         $userId = filter_var($getParameters['user'], FILTER_VALIDATE_INT);
124 124
         $token = $getParameters['token'];
Please login to merge, or discard this patch.
src/classes/Controller/ResourceController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     public function getResourceEditForm(ServerRequestInterface $request, ResponseInterface $response, $args)
63 63
     {
64
-        $this->logger->info("Fetch resource GET '/resource/".$args['id']."/edit'");
64
+        $this->logger->info("Fetch resource GET '/resource/" . $args['id'] . "/edit'");
65 65
         $d = DocumentQuery::create()->findPK($args['id']);
66 66
 
67 67
         if (!is_null($d)) {
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 
74 74
     public function getResourceFile(ServerRequestInterface $request, ResponseInterface $response, $args)
75 75
     {
76
-        $this->logger->info("Fetch resource GET '/resource/".$args['id']."'");
76
+        $this->logger->info("Fetch resource GET '/resource/" . $args['id'] . "'");
77 77
         $resource = DocumentQuery::create()->findPk($args['id']);
78 78
 
79 79
         if (!is_null($resource)) {
80
-            if (file_exists(__DIR__.'/../documents/'.$resource->getUrl())) {
81
-                $file = __DIR__.'/../documents/'.$resource->getUrl();
82
-            } elseif (file_exists(__DIR__.'/../documents/'.$resource->getId())) {
83
-                $file = __DIR__.'/../documents/'.$resource->getId();
80
+            if (file_exists(__DIR__ . '/../documents/' . $resource->getUrl())) {
81
+                $file = __DIR__ . '/../documents/' . $resource->getUrl();
82
+            } elseif (file_exists(__DIR__ . '/../documents/' . $resource->getId())) {
83
+                $file = __DIR__ . '/../documents/' . $resource->getId();
84 84
             } else {
85 85
                 return $this->view->render($response, 'error.twig');
86 86
             }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                             ->withHeader('Content-Type', 'application/download')
95 95
                             ->withHeader('Content-Description', 'File Transfer')
96 96
                             ->withHeader('Content-Transfer-Encoding', 'binary')
97
-                            ->withHeader('Content-Disposition', 'attachment; filename="'.$resource->getUrl().'"')
97
+                            ->withHeader('Content-Disposition', 'attachment; filename="' . $resource->getUrl() . '"')
98 98
                             ->withHeader('Expires', '0')
99 99
                             ->withHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
100 100
                             ->withHeader('Pragma', 'public')
Please login to merge, or discard this patch.
src/classes/EmailAddress.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
         if (filter_var(trim($email), FILTER_VALIDATE_EMAIL)) {
14 14
             $this->email = filter_var(trim($email), FILTER_SANITIZE_EMAIL);
15 15
         } else {
16
-            throw new InvalidArgumentException('Invalid email address: '.$email);
16
+            throw new InvalidArgumentException('Invalid email address: ' . $email);
17 17
         }
18 18
     }
19 19
 
Please login to merge, or discard this patch.
src/middleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 // e.g: $app->add(new \Slim\Csrf\Guard);
11 11
 
12 12
 // 3) add route information to twig
13
-$app->add(function (Request $request, Response $response, callable $next) {
13
+$app->add(function(Request $request, Response $response, callable $next) {
14 14
     $route = $request->getAttribute('route');
15 15
 
16 16
     // return NotFound for non existent route
Please login to merge, or discard this patch.
api-classes/Database.php 3 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -148,6 +148,12 @@  discard block
 block discarded – undo
148 148
         return $statement->fetchAll(PDO::FETCH_CLASS, $returnClass);
149 149
     }
150 150
 
151
+    /**
152
+     * @param string $returnClass
153
+     * @param string $table
154
+     * @param string[] $columns
155
+     * @param string[] $where
156
+     */
151 157
     public function selectSingle($returnClass, $table, $columns, $where = null)
152 158
     {
153 159
         $statement = $this->selectStatement($table, $columns, $where);
@@ -215,6 +221,8 @@  discard block
 block discarded – undo
215 221
 
216 222
     /**
217 223
      * Use with caution: it is often better to archive items to prevent creating null references.
224
+     * @param string $table
225
+     * @param string[] $where
218 226
      */
219 227
     public function delete($table, $where)
220 228
     {
@@ -253,6 +261,9 @@  discard block
 block discarded – undo
253 261
         return $table;
254 262
     }
255 263
 
264
+    /**
265
+     * @param string $table
266
+     */
256 267
     private function tableExists($table)
257 268
     {
258 269
         // todo: implement table check
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -272,8 +272,8 @@
 block discarded – undo
272 272
     public function count($table, $column, $where = null)
273 273
     {
274 274
         $columns = [
275
-      'COUNT('.$column.') AS count',
276
-     ];
275
+        'COUNT('.$column.') AS count',
276
+        ];
277 277
         $statement = $this->selectStatement($table, $columns, $where);
278 278
 
279 279
         return $statement->fetchObject()->count;
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
             if ($first) {
181 181
                 $first = false;
182 182
                 $fields .= $item['field'];
183
-                $valuesPlaceholder .= ':'.$item['field'];
183
+                $valuesPlaceholder .= ':' . $item['field'];
184 184
             } else {
185
-                $fields .= ', '.$item['field'];
186
-                $valuesPlaceholder .= ', :'.$item['field'];
185
+                $fields .= ', ' . $item['field'];
186
+                $valuesPlaceholder .= ', :' . $item['field'];
187 187
             }
188 188
 
189 189
             if ($item['type'] == 's' || $item['type'] == 'string') {
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
             }
202 202
         }
203 203
 
204
-        $statement = $this->db_connection->prepare('INSERT INTO '.$table.' ('.$fields.') VALUES ('.$valuesPlaceholder.')');
204
+        $statement = $this->db_connection->prepare('INSERT INTO ' . $table . ' (' . $fields . ') VALUES (' . $valuesPlaceholder . ')');
205 205
         foreach ($data as $item) {
206
-            $statement->bindParam(':'.$item['field'], $item['value']);
206
+            $statement->bindParam(':' . $item['field'], $item['value']);
207 207
         }
208 208
 
209 209
         if ($statement->execute()) {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
     private function addPrefix($table)
250 250
     {
251
-        $table = $this->db_prefix.$table;
251
+        $table = $this->db_prefix . $table;
252 252
 
253 253
         return $table;
254 254
     }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
     public function count($table, $column, $where = null)
273 273
     {
274 274
         $columns = [
275
-      'COUNT('.$column.') AS count',
275
+      'COUNT(' . $column . ') AS count',
276 276
      ];
277 277
         $statement = $this->selectStatement($table, $columns, $where);
278 278
 
Please login to merge, or discard this patch.
public/old/calendar.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 // fetch events
52 52
 
53 53
 switch ($_GET['format']) {
54
-  case 'ical':
54
+    case 'ical':
55 55
     icalOutput($events);
56 56
     break;
57 57
 }
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
     $value = trim($value);
126 126
     $value = strip_tags($value);
127 127
     $value = preg_replace('/\n+/', ' ', $value); // remove newlines
128
-  $value = preg_replace('/\s{2,}/', ' ', $value); // remove whitespace
129
-  $value = str_replace(',', '\,', $value); // escape commas
130
-  $preamble_len = strlen($preamble);
128
+    $value = preg_replace('/\s{2,}/', ' ', $value); // remove whitespace
129
+    $value = str_replace(',', '\,', $value); // escape commas
130
+    $preamble_len = strlen($preamble);
131 131
     $lines = [];
132 132
     while (strlen($value) > (75 - $preamble_len)) {
133 133
         $space = (75 - $preamble_len);
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 METHOD:PUBLISH
69 69
 VERSION:2.0
70 70
 PRODID:-//Church Rota//Church Rota//EN
71
-X-WR-CALNAME:'.siteSettings()->getOwner()." Rota
71
+X-WR-CALNAME:'.siteSettings()->getOwner() . " Rota
72 72
 CALSCALE:GREGORIAN
73 73
 BEGIN:VTIMEZONE
74 74
 TZID:Europe/London
@@ -94,16 +94,16 @@  discard block
 block discarded – undo
94 94
     foreach ($events as $event):
95 95
     $output .=
96 96
 'BEGIN:VEVENT
97
-SUMMARY:'.$event->role.($event->name ? ' | '.$event->name.' ('.$event->type.')' : ' ('.$event->type.')').'
98
-DESCRIPTION:'.ical_split('DESCRIPTION:', $event->series.':\n'.$event->sermonTitle.' ('.$event->bibleVerse.')\n\nIf you are unable to do '.$event->role.' at this event, please request a swap:\n'.siteSettings()->getSiteUrl().'/swap.php?event='.$event->id.'\n\nOnce the swap is accepted, this event will be removed from your calendar.\nPlease be aware that changes may take up to 24 hours or longer to be reflected. This is due to your calendar, not on the rota system.').'
99
-UID:ROTA'.$event->id.'
100
-ORGANIZER;CN="'.siteSettings()->getOwner().'":MAILTO:'.siteSettings()->getAdminEmailAddress().'
101
-STATUS:'.'CONFIRMED'.'
102
-DTSTART;TZID="Europe/London":'.date(DATE_ICAL, strtotime($event->date)).'
103
-DTEND;TZID="Europe/London":'.date(DATE_ICAL, strtotime($event->date) + HOUR).'
104
-LAST-MODIFIED:'.date(DATE_ICAL, strtotime($event->updated)).'Z
105
-LOCATION:'.ical_split('LOCATION:', $event->locationName.', '.$event->locationAddress).'
106
-URL:'.siteSettings()->getSiteUrl().'/event.php?id='.$event->id."
97
+SUMMARY:'.$event->role . ($event->name ? ' | ' . $event->name . ' (' . $event->type . ')' : ' (' . $event->type . ')') . '
98
+DESCRIPTION:'.ical_split('DESCRIPTION:', $event->series . ':\n' . $event->sermonTitle . ' (' . $event->bibleVerse . ')\n\nIf you are unable to do ' . $event->role . ' at this event, please request a swap:\n' . siteSettings()->getSiteUrl() . '/swap.php?event=' . $event->id . '\n\nOnce the swap is accepted, this event will be removed from your calendar.\nPlease be aware that changes may take up to 24 hours or longer to be reflected. This is due to your calendar, not on the rota system.') . '
99
+UID:ROTA'.$event->id . '
100
+ORGANIZER;CN="'.siteSettings()->getOwner() . '":MAILTO:' . siteSettings()->getAdminEmailAddress() . '
101
+STATUS:'.'CONFIRMED' . '
102
+DTSTART;TZID="Europe/London":'.date(DATE_ICAL, strtotime($event->date)) . '
103
+DTEND;TZID="Europe/London":'.date(DATE_ICAL, strtotime($event->date) + HOUR) . '
104
+LAST-MODIFIED:'.date(DATE_ICAL, strtotime($event->updated)) . 'Z
105
+LOCATION:'.ical_split('LOCATION:', $event->locationName . ', ' . $event->locationAddress) . '
106
+URL:'.siteSettings()->getSiteUrl() . '/event.php?id=' . $event->id . "
107 107
 BEGIN:VALARM
108 108
 ACTION:DISPLAY
109 109
 DESCRIPTION:Reminder for Rota
Please login to merge, or discard this patch.
public/old/update.settings.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     exit;
34 34
 }
35 35
 if (!isAdmin()) {
36
-    header('Location: error.php?no=100&page='.basename($_SERVER['SCRIPT_FILENAME']));
36
+    header('Location: error.php?no=100&page=' . basename($_SERVER['SCRIPT_FILENAME']));
37 37
     exit;
38 38
 }
39 39
 
@@ -57,20 +57,20 @@  discard block
 block discarded – undo
57 57
 if ($action == 'update') {
58 58
     //if ($language='de-de')
59 59
     if ($rowSettings['lang_locale'] == 'en_GB') {
60
-        executeDbSql("update cr_settings set lang_locale = 'de_DE'");                     // de_DE
60
+        executeDbSql("update cr_settings set lang_locale = 'de_DE'"); // de_DE
61 61
             executeDbSql("update cr_settings set time_format_long = '%A, %e. %B %Y, %R Uhr, KW%V'"); // de_DE: %A, %e. %B %Y, %R Uhr, KW%V
62 62
             executeDbSql("update cr_settings set time_format_normal = '%d.%m.%Y %H:%M '"); // de_DE: %d.%m.%Y %H:%M
63
-            executeDbSql("update cr_settings set time_format_short = '%a, <strong>%e. %b</strong>, %R'");              // de_DE: %a, <strong>%e. %b</strong>, KW%V
63
+            executeDbSql("update cr_settings set time_format_short = '%a, <strong>%e. %b</strong>, %R'"); // de_DE: %a, <strong>%e. %b</strong>, KW%V
64 64
             executeDbSql("update cr_settings set time_zone = 'Europe/Berlin'"); //de_DE: Europe/Berlin
65 65
             executeDbSql("update cr_settings set google_group_calendar = ''");
66 66
         executeDbSql("update cr_settings set overviewemail = '{{Gottesdienst-Planung [MONTH] [YEAR]}}\r\nHallo zusammen,\r\n\r\nanbei die Gottesdienst-Planung fuer [MONTH] [YEAR]\r\n\r\n[OVERVIEW]\r\n\r\nBitte fruehzeitig Bescheid geben, wenn etwas NICHT passt, ansonsten gehe ich davon aus, dass ihr wie geplant koennt.\r\n\r\nAlles Gute und Gottes Segen f�r Euch und Euren Dienst.\r\nEuer Gottesdienst Orga-Team'");
67 67
     }
68 68
     //else
69 69
     if ($rowSettings['lang_locale'] == 'de_DE') {
70
-        executeDbSql("update cr_settings set lang_locale = 'en_GB'");                     // de_DE
70
+        executeDbSql("update cr_settings set lang_locale = 'en_GB'"); // de_DE
71 71
             executeDbSql("update cr_settings set time_format_long = '%A, %B %e @ %I:%M %p'"); // de_DE: %A, %e. %B %Y, %R Uhr, KW%V
72 72
             executeDbSql("update cr_settings set time_format_normal = '%m/%d/%y %I:%M %p'"); // de_DE: %d.%m.%Y %H:%M
73
-            executeDbSql("update cr_settings set time_format_short = '%a, <strong>%b %e</strong>, %I:%M %p'");              // de_DE: %a, <strong>%e. %b</strong>, KW%V
73
+            executeDbSql("update cr_settings set time_format_short = '%a, <strong>%b %e</strong>, %I:%M %p'"); // de_DE: %a, <strong>%e. %b</strong>, KW%V
74 74
             executeDbSql("update cr_settings set time_zone = 'Europe/London'"); //de_DE: Europe/Berlin
75 75
             executeDbSql("update cr_settings set google_group_calendar = ''");
76 76
         executeDbSql("update cr_settings set overviewemail = 'Hello,\r\n\r\nIn this email you find the Rota for [MONTH] [YEAR].\r\n\r\n[OVERVIEW]\r\n\r\nPlease inform us as soon as possible, if you are not able to serve as scheduled.\r\n\r\nBe blessed.\r\nChurch Support Stuff'");
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     $resultSettings = mysqli_query(db(), $sqlSettings) or die(mysqli_error(db()));
83 83
     $rowSettings = mysqli_fetch_array($resultSettings, MYSQLI_ASSOC);
84 84
 
85
-    $updateNotification = 'Settings updated successfully to: '.$rowSettings['lang_locale'].' <br>&nbsp;<br>';
85
+    $updateNotification = 'Settings updated successfully to: ' . $rowSettings['lang_locale'] . ' <br>&nbsp;<br>';
86 86
 }
87 87
 
88 88
 $formatting = 'true';
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 	<hr>
95 95
 	This page has only beta status. <br>Please do only use it in testing environments!
96 96
 	<hr>
97
-	<?php echo 'Your web browser identifies your language as: '.$language; ?><br>
98
-	<?php echo 'Church Rota is set to use: '.$rowSettings['lang_locale']; ?><br>&nbsp;<br>
97
+	<?php echo 'Your web browser identifies your language as: ' . $language; ?><br>
98
+	<?php echo 'Church Rota is set to use: ' . $rowSettings['lang_locale']; ?><br>&nbsp;<br>
99 99
 	
100 100
 <?php
101 101
 if ($updateNotification == '') {
Please login to merge, or discard this patch.
public/old/fb-link.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
     ini_set('log_errors', true);
9 9
     error_reporting(E_ALL);
10 10
 
11
-  date_default_timezone_set('Europe/London');
11
+    date_default_timezone_set('Europe/London');
12 12
 
13 13
 // Include files, including the database connection
14 14
 include 'includes/config.php';
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 } require_once 'vendor/autoload.php';
25 25
 
26 26
 $fb = new Facebook\Facebook([
27
-  'app_id'                => $config['auth']['facebook']['appId'],
28
-  'app_secret'            => $config['auth']['facebook']['appSecret'],
29
-  'default_graph_version' => 'v2.2',
30
-  ]);
27
+    'app_id'                => $config['auth']['facebook']['appId'],
28
+    'app_secret'            => $config['auth']['facebook']['appSecret'],
29
+    'default_graph_version' => 'v2.2',
30
+    ]);
31 31
 
32 32
 $accessToken = $_SESSION['fb_access_token'];
33 33
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Facebook;
6 6
 
7
-ini_set('display_errors', false);    // set on for development, off for production
7
+ini_set('display_errors', false); // set on for development, off for production
8 8
     ini_set('log_errors', true);
9 9
     error_reporting(E_ALL);
10 10
 
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
     // Returns a `Facebook\FacebookResponse` object
38 38
     $response = $fb->get('/me?fields=id,name,email', $accessToken);
39 39
 } catch (Facebook\Exceptions\FacebookResponseException $e) {
40
-    echo 'Graph returned an error: '.$e->getMessage();
40
+    echo 'Graph returned an error: ' . $e->getMessage();
41 41
     exit;
42 42
 } catch (Facebook\Exceptions\FacebookSDKException $e) {
43
-    echo 'Facebook SDK returned an error: '.$e->getMessage();
43
+    echo 'Facebook SDK returned an error: ' . $e->getMessage();
44 44
     exit;
45 45
 }
46 46
 
Please login to merge, or discard this patch.