@@ -46,7 +46,7 @@ |
||
46 | 46 | <br> |
47 | 47 | The following error has occurred |
48 | 48 | <?php |
49 | -echo " on page '".$page."':<br><br>"; |
|
49 | +echo " on page '" . $page . "':<br><br>"; |
|
50 | 50 | echo '<strong>'; |
51 | 51 | |
52 | 52 | switch ($no) { |
@@ -87,23 +87,23 @@ |
||
87 | 87 | WHERE |
88 | 88 | date >= CURDATE() |
89 | 89 | AND date_format( date , "%y-%m-%d" ) |
90 | - <= date_format( DATE_ADD(now(), INTERVAL '.$daysAlert.' DAY ) , "%y-%m-%d" )'; |
|
90 | + <= date_format( DATE_ADD(now(), INTERVAL '.$daysAlert . ' DAY ) , "%y-%m-%d" )'; |
|
91 | 91 | $resultEvents = mysqli_query(db(), $sqlEvents) or die(mysqli_error(db())); |
92 | 92 | $i = 0; |
93 | 93 | while ($rowEvents = mysqli_fetch_array($resultEvents, MYSQLI_ASSOC)) { |
94 | 94 | $usersNotified = notifyEveryoneForEvent($rowEvents['id']); |
95 | 95 | if (count($usersNotified) > 0) { |
96 | - $out = $out.'Automatic notifications sent to users ('.implode(', ', $usersNotified).') for event '.$rowEvents['id'].' on '.$rowEvents['date'].".<br>\r\n"; |
|
96 | + $out = $out . 'Automatic notifications sent to users (' . implode(', ', $usersNotified) . ') for event ' . $rowEvents['id'] . ' on ' . $rowEvents['date'] . ".<br>\r\n"; |
|
97 | 97 | } else { |
98 | - $out = $out.'No notifications sent for event '.$rowEvents['id'].' on '.$rowEvents['date'].".<br>\r\n"; |
|
98 | + $out = $out . 'No notifications sent for event ' . $rowEvents['id'] . ' on ' . $rowEvents['date'] . ".<br>\r\n"; |
|
99 | 99 | } |
100 | 100 | $i = $i + 1; |
101 | 101 | } |
102 | 102 | if ($i == 0) { |
103 | - $out = $out.'No events found to automatically notify for.'; |
|
103 | + $out = $out . 'No events found to automatically notify for.'; |
|
104 | 104 | } |
105 | 105 | } else { |
106 | - $out = $out.'Automatic notifications are disabled.'; |
|
106 | + $out = $out . 'Automatic notifications are disabled.'; |
|
107 | 107 | } ?> |
108 | 108 | <html> |
109 | 109 | <body> |
@@ -3,7 +3,7 @@ |
||
3 | 3 | namespace TechWilk\Rota; |
4 | 4 | |
5 | 5 | if (!empty($_GET['id'])) { |
6 | - header('Location: ../user/'.(int) $_GET['id'].'/password'); |
|
6 | + header('Location: ../user/' . (int) $_GET['id'] . '/password'); |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 |
@@ -20,35 +20,35 @@ discard block |
||
20 | 20 | // USER |
21 | 21 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
22 | 22 | |
23 | -$app->group('/user', function () { |
|
24 | - $this->get('s', UserController::class.':getAllUsers')->setName('users'); |
|
23 | +$app->group('/user', function() { |
|
24 | + $this->get('s', UserController::class . ':getAllUsers')->setName('users'); |
|
25 | 25 | |
26 | - $this->get('/{id}/widget-only', UserController::class.':getUserWidgetOnly')->setName('user-widget-only'); |
|
26 | + $this->get('/{id}/widget-only', UserController::class . ':getUserWidgetOnly')->setName('user-widget-only'); |
|
27 | 27 | |
28 | - $this->get('/new', UserController::class.':getNewUserForm')->setName('user-new'); |
|
29 | - $this->get('/{id}/edit', UserController::class.':getUserEditForm')->setName('user-edit'); |
|
30 | - $this->get('/{id}/password', UserController::class.':getUserPasswordForm')->setName('user-password'); |
|
28 | + $this->get('/new', UserController::class . ':getNewUserForm')->setName('user-new'); |
|
29 | + $this->get('/{id}/edit', UserController::class . ':getUserEditForm')->setName('user-edit'); |
|
30 | + $this->get('/{id}/password', UserController::class . ':getUserPasswordForm')->setName('user-password'); |
|
31 | 31 | |
32 | - $this->get('/me', UserController::class.':getCurrentUser')->setName('user-me'); |
|
33 | - $this->get('/{id}', UserController::class.':getUser')->setName('user'); |
|
32 | + $this->get('/me', UserController::class . ':getCurrentUser')->setName('user-me'); |
|
33 | + $this->get('/{id}', UserController::class . ':getUser')->setName('user'); |
|
34 | 34 | |
35 | - $this->post('[/{id}]', UserController::class.':postUser')->setName('user-post'); |
|
36 | - $this->post('/{id}/password', UserController::class.':postUserPasswordChange')->setName('user-password-post'); |
|
35 | + $this->post('[/{id}]', UserController::class . ':postUser')->setName('user-post'); |
|
36 | + $this->post('/{id}/password', UserController::class . ':postUserPasswordChange')->setName('user-password-post'); |
|
37 | 37 | |
38 | 38 | // roles |
39 | - $this->get('/{id}/roles', RoleController::class.':getAssignRolesForm')->setName('user-roles'); |
|
40 | - $this->post('/{id}/roles', RoleController::class.':postUserAssignRoles')->setName('user-assign-post'); |
|
39 | + $this->get('/{id}/roles', RoleController::class . ':getAssignRolesForm')->setName('user-roles'); |
|
40 | + $this->post('/{id}/roles', RoleController::class . ':postUserAssignRoles')->setName('user-assign-post'); |
|
41 | 41 | |
42 | 42 | // availability |
43 | - $this->get('/{id}/availability', AvailabilityController::class.':getAvailabilityForm')->setName('user-availability'); |
|
44 | - $this->post('/{id}/availability', AvailabilityController::class.':postAvailability')->setName('user-availability-post'); |
|
43 | + $this->get('/{id}/availability', AvailabilityController::class . ':getAvailabilityForm')->setName('user-availability'); |
|
44 | + $this->post('/{id}/availability', AvailabilityController::class . ':postAvailability')->setName('user-availability-post'); |
|
45 | 45 | |
46 | 46 | // calendar |
47 | - $this->group('/me/calendar', function () { |
|
48 | - $this->get('s', CalendarController::class.':getCalendarTokens')->setName('user-calendars'); |
|
49 | - $this->get('/new', CalendarController::class.':getNewCalendarForm')->setName('user-calendars'); |
|
50 | - $this->get('/{id}/revoke', CalendarController::class.':getRevokeCalendar')->setName('user-calendar-revoke'); |
|
51 | - $this->post('/new', CalendarController::class.':postNewCalendar')->setName('user-calendar-new-post'); |
|
47 | + $this->group('/me/calendar', function() { |
|
48 | + $this->get('s', CalendarController::class . ':getCalendarTokens')->setName('user-calendars'); |
|
49 | + $this->get('/new', CalendarController::class . ':getNewCalendarForm')->setName('user-calendars'); |
|
50 | + $this->get('/{id}/revoke', CalendarController::class . ':getRevokeCalendar')->setName('user-calendar-revoke'); |
|
51 | + $this->post('/new', CalendarController::class . ':postNewCalendar')->setName('user-calendar-new-post'); |
|
52 | 52 | }); |
53 | 53 | }); |
54 | 54 | |
@@ -56,98 +56,98 @@ discard block |
||
56 | 56 | // EVENT |
57 | 57 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
58 | 58 | |
59 | -$app->group('/event', function () { |
|
60 | - $this->get('s', EventController::class.':getAllEvents')->setName('events'); |
|
61 | - $this->get('s/type/{id}', EventController::class.':getAllEventsWithType')->setName('events-eventtype'); |
|
62 | - $this->get('s/subtype/{id}', EventController::class.':getAllEventsWithSubType')->setName('events-eventsubtype'); |
|
59 | +$app->group('/event', function() { |
|
60 | + $this->get('s', EventController::class . ':getAllEvents')->setName('events'); |
|
61 | + $this->get('s/type/{id}', EventController::class . ':getAllEventsWithType')->setName('events-eventtype'); |
|
62 | + $this->get('s/subtype/{id}', EventController::class . ':getAllEventsWithSubType')->setName('events-eventsubtype'); |
|
63 | 63 | |
64 | - $this->get('s/print/preachers', EventController::class.':getAllEventsToPrint')->setName('events-print'); |
|
64 | + $this->get('s/print/preachers', EventController::class . ':getAllEventsToPrint')->setName('events-print'); |
|
65 | 65 | |
66 | - $this->get('/new', EventController::class.':getNewEventForm')->setName('event-new'); |
|
67 | - $this->get('/{id}/edit', EventController::class.':getEventEditForm')->setName('event-edit'); |
|
68 | - $this->get('/{id}/copy', EventController::class.':getEventCopyForm')->setName('event-copy'); |
|
69 | - $this->get('/{id}/assign', EventController::class.':getEventAssignForm')->setName('event-assign'); |
|
66 | + $this->get('/new', EventController::class . ':getNewEventForm')->setName('event-new'); |
|
67 | + $this->get('/{id}/edit', EventController::class . ':getEventEditForm')->setName('event-edit'); |
|
68 | + $this->get('/{id}/copy', EventController::class . ':getEventCopyForm')->setName('event-copy'); |
|
69 | + $this->get('/{id}/assign', EventController::class . ':getEventAssignForm')->setName('event-assign'); |
|
70 | 70 | |
71 | - $this->get('/{id}', EventController::class.':getEvent')->setName('event'); |
|
71 | + $this->get('/{id}', EventController::class . ':getEvent')->setName('event'); |
|
72 | 72 | |
73 | - $this->post('[/{id}]', EventController::class.':postEvent')->setName('event-post'); |
|
74 | - $this->post('/{id}/assign', EventController::class.':postEventAssign')->setName('event-assign-post'); |
|
73 | + $this->post('[/{id}]', EventController::class . ':postEvent')->setName('event-post'); |
|
74 | + $this->post('/{id}/assign', EventController::class . ':postEventAssign')->setName('event-assign-post'); |
|
75 | 75 | }); |
76 | 76 | |
77 | 77 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
78 | 78 | // RESOURCE |
79 | 79 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
80 | 80 | |
81 | -$app->group('/resource', function () { |
|
82 | - $this->get('s', ResourceController::class.':getAllResources')->setName('resources'); |
|
81 | +$app->group('/resource', function() { |
|
82 | + $this->get('s', ResourceController::class . ':getAllResources')->setName('resources'); |
|
83 | 83 | |
84 | - $this->get('[/new]', ResourceController::class.':getNewResourceForm')->setName('resource-new'); |
|
85 | - $this->get('/{id}/edit', ResourceController::class.':getResourceEditForm')->setName('resource-edit'); |
|
84 | + $this->get('[/new]', ResourceController::class . ':getNewResourceForm')->setName('resource-new'); |
|
85 | + $this->get('/{id}/edit', ResourceController::class . ':getResourceEditForm')->setName('resource-edit'); |
|
86 | 86 | |
87 | - $this->get('/{id}', ResourceController::class.':getResourceFile')->setName('resource'); |
|
87 | + $this->get('/{id}', ResourceController::class . ':getResourceFile')->setName('resource'); |
|
88 | 88 | |
89 | - $this->post('[/{id}]', ResourceController::class.':postResource')->setName('resource-post'); |
|
89 | + $this->post('[/{id}]', ResourceController::class . ':postResource')->setName('resource-post'); |
|
90 | 90 | }); |
91 | 91 | |
92 | 92 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
93 | 93 | // ROLES & GROUPS |
94 | 94 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
95 | 95 | |
96 | -$app->group('/group', function () { |
|
97 | - $this->get('/{id}', GroupController::class.':getGroup')->setName('group'); |
|
98 | - $this->get('/{id}/roles', GroupController::class.':getGroupRoles')->setName('group-roles'); |
|
96 | +$app->group('/group', function() { |
|
97 | + $this->get('/{id}', GroupController::class . ':getGroup')->setName('group'); |
|
98 | + $this->get('/{id}/roles', GroupController::class . ':getGroupRoles')->setName('group-roles'); |
|
99 | 99 | }); |
100 | 100 | |
101 | 101 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
102 | 102 | // AUTH |
103 | 103 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
104 | 104 | |
105 | -$app->get('/login', AuthController::class.':getLoginForm')->setName('login'); |
|
105 | +$app->get('/login', AuthController::class . ':getLoginForm')->setName('login'); |
|
106 | 106 | |
107 | -$app->get('/login/{provider}', AuthController::class.':getLoginAuth')->setName('login-auth'); |
|
108 | -$app->get('/login/{provider}/callback', AuthController::class.':getLoginCallback')->setName('login-callback'); |
|
109 | -$app->get('/signup', PendingUserController::class.':getSignUpForm')->setName('sign-up'); |
|
110 | -$app->get('/signup/cancel', PendingUserController::class.':getSignUpCancel')->setName('sign-up-cancel'); |
|
107 | +$app->get('/login/{provider}', AuthController::class . ':getLoginAuth')->setName('login-auth'); |
|
108 | +$app->get('/login/{provider}/callback', AuthController::class . ':getLoginCallback')->setName('login-callback'); |
|
109 | +$app->get('/signup', PendingUserController::class . ':getSignUpForm')->setName('sign-up'); |
|
110 | +$app->get('/signup/cancel', PendingUserController::class . ':getSignUpCancel')->setName('sign-up-cancel'); |
|
111 | 111 | |
112 | -$app->get('/logout', AuthController::class.':getLogout')->setName('logout'); |
|
112 | +$app->get('/logout', AuthController::class . ':getLogout')->setName('logout'); |
|
113 | 113 | |
114 | -$app->post('/login', AuthController::class.':postLogin')->setName('login-post'); |
|
115 | -$app->post('/signup', PendingUserController::class.':postSignUp')->setName('sign-up-post'); |
|
114 | +$app->post('/login', AuthController::class . ':postLogin')->setName('login-post'); |
|
115 | +$app->post('/signup', PendingUserController::class . ':postSignUp')->setName('sign-up-post'); |
|
116 | 116 | |
117 | 117 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
118 | 118 | // NOTIFICATIONS |
119 | 119 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
120 | 120 | |
121 | -$app->get('/notification/{id}[/{referrer}]', NotificationController::class.':getNotificationClick')->setName('notification'); |
|
121 | +$app->get('/notification/{id}[/{referrer}]', NotificationController::class . ':getNotificationClick')->setName('notification'); |
|
122 | 122 | |
123 | 123 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
124 | 124 | // CALENDAR |
125 | 125 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
126 | 126 | |
127 | -$app->get('/calendar/{token}.{format}', CalendarController::class.':getRenderedCalendar')->setName('user-calendar'); |
|
127 | +$app->get('/calendar/{token}.{format}', CalendarController::class . ':getRenderedCalendar')->setName('user-calendar'); |
|
128 | 128 | |
129 | 129 | // legacy |
130 | -$app->get('/calendar.php', CalendarController::class.':getLegacyRenderedCalendar')->setName('user-calendar'); |
|
130 | +$app->get('/calendar.php', CalendarController::class . ':getLegacyRenderedCalendar')->setName('user-calendar'); |
|
131 | 131 | |
132 | 132 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
133 | 133 | // OTHER |
134 | 134 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
135 | 135 | |
136 | -$app->get('/settings', function ($request, $response, $args) { |
|
136 | +$app->get('/settings', function($request, $response, $args) { |
|
137 | 137 | // Sample log message |
138 | 138 | $this->logger->info("Fetch settings GET '/settings'"); |
139 | 139 | |
140 | - $url = $this->router->pathFor('home').'old/settings.php'; |
|
140 | + $url = $this->router->pathFor('home') . 'old/settings.php'; |
|
141 | 141 | |
142 | 142 | return $response->withStatus(303)->withHeader('Location', $url); |
143 | 143 | //return $this->view->render($response, 'settings.twig', []); |
144 | 144 | })->setName('settings'); |
145 | 145 | |
146 | -$app->get('/token', function ($request, $response, $args) { |
|
146 | +$app->get('/token', function($request, $response, $args) { |
|
147 | 147 | return $response->getBody()->write(Crypt::generateToken(30)); |
148 | 148 | })->setName('token'); |
149 | 149 | |
150 | -$app->get('/', function ($request, $response, $args) { |
|
150 | +$app->get('/', function($request, $response, $args) { |
|
151 | 151 | // Sample log message |
152 | 152 | $this->logger->info("Fetch home GET '/'"); |
153 | 153 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | public function getLoginAuth(ServerRequestInterface $request, ResponseInterface $response, $args) |
80 | 80 | { |
81 | - $this->logger->info("Login auth GET '/login/".$args['provider']."'"); |
|
81 | + $this->logger->info("Login auth GET '/login/" . $args['provider'] . "'"); |
|
82 | 82 | |
83 | 83 | // login |
84 | 84 | $authUrl = $this->auth->getCallbackUrl(); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | public function getLoginCallback(ServerRequestInterface $request, ResponseInterface $response, $args) |
90 | 90 | { |
91 | - $this->logger->info("Login auth GET '/login/".$args['provider']."/callback'"); |
|
91 | + $this->logger->info("Login auth GET '/login/" . $args['provider'] . "/callback'"); |
|
92 | 92 | |
93 | 93 | // login |
94 | 94 | try { |
@@ -61,7 +61,7 @@ discard block |
||
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,15 +73,15 @@ discard block |
||
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 | - $directory = __DIR__.'/../../../documents/'; |
|
78 | + $directory = __DIR__ . '/../../../documents/'; |
|
79 | 79 | |
80 | 80 | if (!is_null($resource)) { |
81 | - if (file_exists($directory.$resource->getUrl())) { |
|
82 | - $file = $directory.$resource->getUrl(); |
|
83 | - } elseif (file_exists($directory.$resource->getId())) { |
|
84 | - $file = $directory.$resource->getId(); |
|
81 | + if (file_exists($directory . $resource->getUrl())) { |
|
82 | + $file = $directory . $resource->getUrl(); |
|
83 | + } elseif (file_exists($directory . $resource->getId())) { |
|
84 | + $file = $directory . $resource->getId(); |
|
85 | 85 | } else { |
86 | 86 | return $this->view->render($response, 'error.twig'); |
87 | 87 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ->withHeader('Content-Type', 'application/download') |
96 | 96 | ->withHeader('Content-Description', 'File Transfer') |
97 | 97 | ->withHeader('Content-Transfer-Encoding', 'binary') |
98 | - ->withHeader('Content-Disposition', 'attachment; filename="'.$resource->getUrl().'"') |
|
98 | + ->withHeader('Content-Disposition', 'attachment; filename="' . $resource->getUrl() . '"') |
|
99 | 99 | ->withHeader('Expires', '0') |
100 | 100 | ->withHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') |
101 | 101 | ->withHeader('Pragma', 'public') |