@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | if (!isAdmin()) { |
17 | - header('Location: error.php?no=100&page='.basename($_SERVER['SCRIPT_FILENAME'])); |
|
17 | + header('Location: error.php?no=100&page=' . basename($_SERVER['SCRIPT_FILENAME'])); |
|
18 | 18 | exit; |
19 | 19 | } |
20 | 20 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | if ($role && $assignTo) { |
35 | 35 | $sql = "UPDATE cr_roles r SET r.groupId = '$assignTo' WHERE r.id = '$role'"; |
36 | 36 | if (!mysqli_query(db(), $sql)) { |
37 | - die('Error: '.mysqli_error(db())); |
|
37 | + die('Error: ' . mysqli_error(db())); |
|
38 | 38 | } |
39 | 39 | header('Location: roles.php'); |
40 | 40 | exit; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $sql = "INSERT INTO cr_roles (name, description, rehersalId, groupId) |
71 | 71 | VALUES ('$newrole', '$newrole', $rehersal, $groupId)"; |
72 | 72 | if (!mysqli_query(db(), $sql)) { |
73 | - die('Error: '.mysqli_error(db())); |
|
73 | + die('Error: ' . mysqli_error(db())); |
|
74 | 74 | } |
75 | 75 | } else { |
76 | 76 | // Handle renaming of the roles |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | $i = 1; |
104 | 104 | while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
105 | 105 | if ($type == 'option') { |
106 | - $list = $list."<option value='".$row['id']."'>".$row['name'].'</option>'; |
|
106 | + $list = $list . "<option value='" . $row['id'] . "'>" . $row['name'] . '</option>'; |
|
107 | 107 | } elseif ($type == 'li') { |
108 | - $list = $list.'<li>'.$row['name'].'</li>'; |
|
108 | + $list = $list . '<li>' . $row['name'] . '</li>'; |
|
109 | 109 | } elseif ($type == 'li-a') { |
110 | - $list = $list."<li><a href='roles.php?role=".$roleId.'&assignto='.$row['id']."'>".$row['name'].'</a></li>'; |
|
110 | + $list = $list . "<li><a href='roles.php?role=" . $roleId . '&assignto=' . $row['id'] . "'>" . $row['name'] . '</a></li>'; |
|
111 | 111 | } |
112 | 112 | $i++; |
113 | 113 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $group = $row['groupId']; |
174 | 174 | $down = $group + 1; |
175 | 175 | $up = $group - 1; |
176 | - echo '<div><strong>'.$groupname.'</strong><br />'; |
|
176 | + echo '<div><strong>' . $groupname . '</strong><br />'; |
|
177 | 177 | } |
178 | 178 | // Print text input box if a role exists for the group. |
179 | 179 | // Allows user to update role names and move roles between groups |
@@ -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,103 +56,103 @@ 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/info', EventController::class.':getAllEventInfoToPrint')->setName('events-print-info'); |
|
64 | + $this->get('s/print/info', EventController::class . ':getAllEventInfoToPrint')->setName('events-print-info'); |
|
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'); |
|
75 | - $this->post('/{id}/comment', EventController::class.':postEventComment')->setName('event-comment-post'); |
|
73 | + $this->post('[/{id}]', EventController::class . ':postEvent')->setName('event-post'); |
|
74 | + $this->post('/{id}/assign', EventController::class . ':postEventAssign')->setName('event-assign-post'); |
|
75 | + $this->post('/{id}/comment', EventController::class . ':postEventComment')->setName('event-comment-post'); |
|
76 | 76 | }); |
77 | 77 | |
78 | 78 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
79 | 79 | // RESOURCE |
80 | 80 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
81 | 81 | |
82 | -$app->group('/resource', function () { |
|
83 | - $this->get('s', ResourceController::class.':getAllResources')->setName('resources'); |
|
82 | +$app->group('/resource', function() { |
|
83 | + $this->get('s', ResourceController::class . ':getAllResources')->setName('resources'); |
|
84 | 84 | |
85 | - $this->get('[/new]', ResourceController::class.':getNewResourceForm')->setName('resource-new'); |
|
86 | - $this->get('/{id}/edit', ResourceController::class.':getResourceEditForm')->setName('resource-edit'); |
|
85 | + $this->get('[/new]', ResourceController::class . ':getNewResourceForm')->setName('resource-new'); |
|
86 | + $this->get('/{id}/edit', ResourceController::class . ':getResourceEditForm')->setName('resource-edit'); |
|
87 | 87 | |
88 | - $this->get('/{id}', ResourceController::class.':getResourceFile')->setName('resource'); |
|
88 | + $this->get('/{id}', ResourceController::class . ':getResourceFile')->setName('resource'); |
|
89 | 89 | |
90 | - $this->post('[/{id}]', ResourceController::class.':postResource')->setName('resource-post'); |
|
90 | + $this->post('[/{id}]', ResourceController::class . ':postResource')->setName('resource-post'); |
|
91 | 91 | }); |
92 | 92 | |
93 | 93 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
94 | 94 | // ROLES & GROUPS |
95 | 95 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
96 | 96 | |
97 | -$app->group('/group', function () { |
|
98 | - $this->get('/{id}', GroupController::class.':getGroup')->setName('group'); |
|
99 | - $this->get('/{id}/roles', GroupController::class.':getGroupRoles')->setName('group-roles'); |
|
97 | +$app->group('/group', function() { |
|
98 | + $this->get('/{id}', GroupController::class . ':getGroup')->setName('group'); |
|
99 | + $this->get('/{id}/roles', GroupController::class . ':getGroupRoles')->setName('group-roles'); |
|
100 | 100 | |
101 | - $this->get('/{id}/events', EventController::class.':getAllEventsToPrintForGroup')->setName('group-events-print'); |
|
101 | + $this->get('/{id}/events', EventController::class . ':getAllEventsToPrintForGroup')->setName('group-events-print'); |
|
102 | 102 | |
103 | - $this->post('[/{id}]', GroupController::class.':postGroup')->setName('group-post'); |
|
103 | + $this->post('[/{id}]', GroupController::class . ':postGroup')->setName('group-post'); |
|
104 | 104 | }); |
105 | 105 | |
106 | 106 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
107 | 107 | // AUTH |
108 | 108 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
109 | 109 | |
110 | -$app->get('/login', AuthController::class.':getLoginForm')->setName('login'); |
|
110 | +$app->get('/login', AuthController::class . ':getLoginForm')->setName('login'); |
|
111 | 111 | |
112 | -$app->get('/login/{provider}', AuthController::class.':getLoginAuth')->setName('login-auth'); |
|
113 | -$app->get('/login/{provider}/callback', AuthController::class.':getLoginCallback')->setName('login-callback'); |
|
114 | -$app->get('/signup', PendingUserController::class.':getSignUpForm')->setName('sign-up'); |
|
115 | -$app->get('/signup/cancel', PendingUserController::class.':getSignUpCancel')->setName('sign-up-cancel'); |
|
112 | +$app->get('/login/{provider}', AuthController::class . ':getLoginAuth')->setName('login-auth'); |
|
113 | +$app->get('/login/{provider}/callback', AuthController::class . ':getLoginCallback')->setName('login-callback'); |
|
114 | +$app->get('/signup', PendingUserController::class . ':getSignUpForm')->setName('sign-up'); |
|
115 | +$app->get('/signup/cancel', PendingUserController::class . ':getSignUpCancel')->setName('sign-up-cancel'); |
|
116 | 116 | |
117 | -$app->get('/logout', AuthController::class.':getLogout')->setName('logout'); |
|
117 | +$app->get('/logout', AuthController::class . ':getLogout')->setName('logout'); |
|
118 | 118 | |
119 | -$app->post('/login', AuthController::class.':postLogin')->setName('login-post'); |
|
120 | -$app->post('/signup', PendingUserController::class.':postSignUp')->setName('sign-up-post'); |
|
119 | +$app->post('/login', AuthController::class . ':postLogin')->setName('login-post'); |
|
120 | +$app->post('/signup', PendingUserController::class . ':postSignUp')->setName('sign-up-post'); |
|
121 | 121 | |
122 | 122 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
123 | 123 | // NOTIFICATIONS |
124 | 124 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
125 | 125 | |
126 | -$app->get('/notification/{id}[/{referrer}]', NotificationController::class.':getNotificationClick')->setName('notification'); |
|
126 | +$app->get('/notification/{id}[/{referrer}]', NotificationController::class . ':getNotificationClick')->setName('notification'); |
|
127 | 127 | |
128 | 128 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
129 | 129 | // CALENDAR |
130 | 130 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
131 | 131 | |
132 | -$app->get('/calendar/{token}.{format}', CalendarController::class.':getRenderedCalendar')->setName('user-calendar'); |
|
132 | +$app->get('/calendar/{token}.{format}', CalendarController::class . ':getRenderedCalendar')->setName('user-calendar'); |
|
133 | 133 | |
134 | 134 | // legacy |
135 | -$app->get('/calendar.php', CalendarController::class.':getLegacyRenderedCalendar')->setName('user-calendar'); |
|
135 | +$app->get('/calendar.php', CalendarController::class . ':getLegacyRenderedCalendar')->setName('user-calendar'); |
|
136 | 136 | |
137 | 137 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
138 | 138 | // OTHER |
139 | 139 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
140 | 140 | |
141 | -$app->get('/settings', function ($request, $response, $args) { |
|
141 | +$app->get('/settings', function($request, $response, $args) { |
|
142 | 142 | // Sample log message |
143 | 143 | $this->logger->info("Fetch settings GET '/settings'"); |
144 | 144 | |
145 | - $url = $this->router->pathFor('home').'old/settings.php'; |
|
145 | + $url = $this->router->pathFor('home') . 'old/settings.php'; |
|
146 | 146 | |
147 | 147 | return $response->withStatus(303)->withHeader('Location', $url); |
148 | 148 | //return $this->view->render($response, 'settings.twig', []); |
149 | 149 | })->setName('settings'); |
150 | 150 | |
151 | -$app->get('/token', function ($request, $response, $args) { |
|
151 | +$app->get('/token', function($request, $response, $args) { |
|
152 | 152 | return $response->getBody()->write(Crypt::generateToken(30)); |
153 | 153 | })->setName('token'); |
154 | 154 | |
155 | -$app->get('/', function ($request, $response, $args) { |
|
155 | +$app->get('/', function($request, $response, $args) { |
|
156 | 156 | // Sample log message |
157 | 157 | $this->logger->info("Fetch home GET '/'"); |
158 | 158 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public function getAllEventsWithType(ServerRequestInterface $request, ResponseInterface $response, $args) |
33 | 33 | { |
34 | - $this->logger->info("Fetch event GET '/events/type/".$args['id']."'"); |
|
34 | + $this->logger->info("Fetch event GET '/events/type/" . $args['id'] . "'"); |
|
35 | 35 | |
36 | 36 | $eventType = EventTypeQuery::create()->findPk($args['id']); |
37 | 37 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | public function getAllEventsWithSubType(ServerRequestInterface $request, ResponseInterface $response, $args) |
44 | 44 | { |
45 | - $this->logger->info("Fetch event GET '/events/type/".$args['id']."'"); |
|
45 | + $this->logger->info("Fetch event GET '/events/type/" . $args['id'] . "'"); |
|
46 | 46 | |
47 | 47 | $eventType = EventSubTypeQuery::create()->findPk($args['id']); |
48 | 48 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $e->setCreatedBy($this->auth->currentUser()); |
86 | 86 | } |
87 | 87 | $e->setName($data['name']); |
88 | - $e->setDate(DateTime::createFromFormat('d/m/Y H:i', $data['date'].' '.$data['time'])); |
|
88 | + $e->setDate(DateTime::createFromFormat('d/m/Y H:i', $data['date'] . ' ' . $data['time'])); |
|
89 | 89 | $e->setEventTypeId($data['type']); |
90 | 90 | $e->setEventSubTypeId($data['subtype']); |
91 | 91 | $e->setLocationId($data['location']); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | public function getEvent(ServerRequestInterface $request, ResponseInterface $response, $args) |
120 | 120 | { |
121 | - $this->logger->info("Fetch event GET '/event/".$args['id']."'"); |
|
121 | + $this->logger->info("Fetch event GET '/event/" . $args['id'] . "'"); |
|
122 | 122 | $e = EventQuery::create()->findPK($args['id']); |
123 | 123 | |
124 | 124 | if (!$e->authoriser()->readableBy($this->auth->currentUser())) { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | public function getEventEditForm(ServerRequestInterface $request, ResponseInterface $response, $args) |
136 | 136 | { |
137 | - $this->logger->info("Fetch event GET '/event/".$args['id']."/edit'"); |
|
137 | + $this->logger->info("Fetch event GET '/event/" . $args['id'] . "/edit'"); |
|
138 | 138 | $e = EventQuery::create()->findPK($args['id']); |
139 | 139 | $l = LocationQuery::create()->orderByName()->find(); |
140 | 140 | $et = EventTypeQuery::create()->orderByName()->find(); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | public function getEventCopyForm(ServerRequestInterface $request, ResponseInterface $response, $args) |
151 | 151 | { |
152 | - $this->logger->info("Fetch event GET '/event/".$args['id']."/copy'"); |
|
152 | + $this->logger->info("Fetch event GET '/event/" . $args['id'] . "/copy'"); |
|
153 | 153 | $e = EventQuery::create()->findPK($args['id']); |
154 | 154 | $l = LocationQuery::create()->orderByName()->find(); |
155 | 155 | $et = EventTypeQuery::create()->orderByName()->find(); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | public function getEventAssignForm(ServerRequestInterface $request, ResponseInterface $response, $args) |
166 | 166 | { |
167 | - $this->logger->info("Fetch event GET '/event/".$args['id']."/assign'"); |
|
167 | + $this->logger->info("Fetch event GET '/event/" . $args['id'] . "/assign'"); |
|
168 | 168 | $e = EventQuery::create()->findPK($args['id']); |
169 | 169 | $ur = UserRoleQuery::create()->find(); |
170 | 170 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | public function postEventAssign(ServerRequestInterface $request, ResponseInterface $response, $args) |
179 | 179 | { |
180 | - $this->logger->info("Create event people POST '/event".$args['id']."/assign'"); |
|
180 | + $this->logger->info("Create event people POST '/event" . $args['id'] . "/assign'"); |
|
181 | 181 | |
182 | 182 | $eventId = filter_var($args['id'], FILTER_SANITIZE_NUMBER_INT); |
183 | 183 | $existingUserRoles = UserRoleQuery::create()->useEventPersonQuery()->filterByEventId($eventId)->endUse()->find(); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | public function getAllEventsToPrintForGroup(ServerRequestInterface $request, ResponseInterface $response, $args) |
225 | 225 | { |
226 | - $this->logger->info("Fetch event printable page GET '/group/".$args['id']."/events'"); |
|
226 | + $this->logger->info("Fetch event printable page GET '/group/" . $args['id'] . "/events'"); |
|
227 | 227 | |
228 | 228 | $groupId = (int) $args['id']; |
229 | 229 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | |
270 | 270 | public function postEventComment(ServerRequestInterface $request, ResponseInterface $response, $args) |
271 | 271 | { |
272 | - $this->logger->info("Create event people POST '/event".$args['id']."/comment'"); |
|
272 | + $this->logger->info("Create event people POST '/event" . $args['id'] . "/comment'"); |
|
273 | 273 | |
274 | 274 | $eventId = filter_var($args['id'], FILTER_SANITIZE_NUMBER_INT); |
275 | 275 |