@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | if ($availableCommits[0]['sha'] !== $commitHash) { |
93 | 93 | $updateAvailable = true; |
94 | 94 | |
95 | - $email = siteSettings()->getOwner().' <'.siteSettings()->getAdminEmailAddress().'>'; |
|
95 | + $email = siteSettings()->getOwner() . ' <' . siteSettings()->getAdminEmailAddress() . '>'; |
|
96 | 96 | $message = <<<'MESSAGE' |
97 | 97 | There is an update available for your installation of Rota. |
98 | 98 | |
@@ -114,23 +114,23 @@ discard block |
||
114 | 114 | WHERE |
115 | 115 | date >= CURDATE() |
116 | 116 | AND date_format( date , "%y-%m-%d" ) |
117 | - <= date_format( DATE_ADD(now(), INTERVAL '.$daysAlert.' DAY ) , "%y-%m-%d" )'; |
|
117 | + <= date_format( DATE_ADD(now(), INTERVAL '.$daysAlert . ' DAY ) , "%y-%m-%d" )'; |
|
118 | 118 | $resultEvents = mysqli_query(db(), $sqlEvents) or die(mysqli_error(db())); |
119 | 119 | $i = 0; |
120 | 120 | while ($rowEvents = mysqli_fetch_array($resultEvents, MYSQLI_ASSOC)) { |
121 | 121 | $usersNotified = notifyEveryoneForEvent($rowEvents['id']); |
122 | 122 | if (count($usersNotified) > 0) { |
123 | - $out = $out.'Automatic notifications sent to users ('.implode(', ', $usersNotified).') for event '.$rowEvents['id'].' on '.$rowEvents['date'].".<br>\r\n"; |
|
123 | + $out = $out . 'Automatic notifications sent to users (' . implode(', ', $usersNotified) . ') for event ' . $rowEvents['id'] . ' on ' . $rowEvents['date'] . ".<br>\r\n"; |
|
124 | 124 | } else { |
125 | - $out = $out.'No notifications sent for event '.$rowEvents['id'].' on '.$rowEvents['date'].".<br>\r\n"; |
|
125 | + $out = $out . 'No notifications sent for event ' . $rowEvents['id'] . ' on ' . $rowEvents['date'] . ".<br>\r\n"; |
|
126 | 126 | } |
127 | 127 | $i = $i + 1; |
128 | 128 | } |
129 | 129 | if ($i == 0) { |
130 | - $out = $out.'No events found to automatically notify for.'; |
|
130 | + $out = $out . 'No events found to automatically notify for.'; |
|
131 | 131 | } |
132 | 132 | } else { |
133 | - $out = $out.'Automatic notifications are disabled.'; |
|
133 | + $out = $out . 'Automatic notifications are disabled.'; |
|
134 | 134 | } ?> |
135 | 135 | <html> |
136 | 136 | <body> |
@@ -6,16 +6,16 @@ discard block |
||
6 | 6 | use Monolog\Handler\StreamHandler; |
7 | 7 | use Monolog\Logger; |
8 | 8 | |
9 | -include __DIR__.'/errors.php'; |
|
9 | +include __DIR__ . '/errors.php'; |
|
10 | 10 | |
11 | 11 | // setup the autoloading |
12 | -require_once __DIR__.'/../../../vendor/autoload.php'; |
|
12 | +require_once __DIR__ . '/../../../vendor/autoload.php'; |
|
13 | 13 | |
14 | 14 | // setup Propel |
15 | -require_once __DIR__.'/../../../generated-conf/config.php'; |
|
15 | +require_once __DIR__ . '/../../../generated-conf/config.php'; |
|
16 | 16 | |
17 | 17 | $defaultLogger = new Logger('defaultLogger'); |
18 | -$defaultLogger->pushHandler(new StreamHandler(__DIR__.'/../../../logs/propel.log', Logger::WARNING)); |
|
18 | +$defaultLogger->pushHandler(new StreamHandler(__DIR__ . '/../../../logs/propel.log', Logger::WARNING)); |
|
19 | 19 | |
20 | 20 | $serviceContainer->setLogger('defaultLogger', $defaultLogger); |
21 | 21 | |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | return SettingsQuery::create()->findOne(); |
65 | 65 | } |
66 | 66 | |
67 | -include __DIR__.'/functions.auth.php'; |
|
68 | -include __DIR__.'/functions.notifications.php'; |
|
69 | -include __DIR__.'/functions.mail.php'; |
|
70 | -include __DIR__.'/functions.remove.php'; |
|
71 | -include __DIR__.'/functions.discussion.php'; |
|
72 | -include __DIR__.'/functions.event.php'; |
|
73 | -include __DIR__.'/functions.password.php'; |
|
74 | -include __DIR__.'/functions.users.php'; |
|
75 | -include __DIR__.'/functions.roles.php'; |
|
76 | -include __DIR__.'/functions.database.php'; |
|
77 | -include __DIR__.'/functions.calendars.php'; |
|
78 | -include __DIR__.'/functions.facebook.php'; |
|
67 | +include __DIR__ . '/functions.auth.php'; |
|
68 | +include __DIR__ . '/functions.notifications.php'; |
|
69 | +include __DIR__ . '/functions.mail.php'; |
|
70 | +include __DIR__ . '/functions.remove.php'; |
|
71 | +include __DIR__ . '/functions.discussion.php'; |
|
72 | +include __DIR__ . '/functions.event.php'; |
|
73 | +include __DIR__ . '/functions.password.php'; |
|
74 | +include __DIR__ . '/functions.users.php'; |
|
75 | +include __DIR__ . '/functions.roles.php'; |
|
76 | +include __DIR__ . '/functions.database.php'; |
|
77 | +include __DIR__ . '/functions.calendars.php'; |
|
78 | +include __DIR__ . '/functions.facebook.php'; |
|
79 | 79 | |
80 | 80 | date_default_timezone_set(siteSettings()->getTimeZone()); |
81 | 81 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $stat_id = $_SESSION['login_statistic_id']; |
176 | 176 | if (($stat_id != '') && ($stat_id != '0')) { |
177 | 177 | $stat = StatisticQuery::create()->findPk($stat_id); |
178 | - $stat->setDetail1($stat->getDetail1().'/'.$detail1); |
|
178 | + $stat->setDetail1($stat->getDetail1() . '/' . $detail1); |
|
179 | 179 | $stat->setDetail2($stat->getDate()->diff(new DateTime())); |
180 | 180 | $stat->save(); |
181 | 181 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | return 'never'; |
209 | 209 | } |
210 | 210 | |
211 | - return timeInWords($time).' ago'; |
|
211 | + return timeInWords($time) . ' ago'; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | function timeInWordsWithTense($time) |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | if ($time->getTimestamp() > (new DateTime())->getTimestamp()) { |
225 | - return 'in '.timeInWords($time); |
|
225 | + return 'in ' . timeInWords($time); |
|
226 | 226 | } else { |
227 | - return timeInWords($time).' ago'; |
|
227 | + return timeInWords($time) . ' ago'; |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 |
@@ -21,35 +21,35 @@ discard block |
||
21 | 21 | // USER |
22 | 22 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
23 | 23 | |
24 | -$app->group('/user', function () { |
|
25 | - $this->get('s', UserController::class.':getAllUsers')->setName('users'); |
|
24 | +$app->group('/user', function() { |
|
25 | + $this->get('s', UserController::class . ':getAllUsers')->setName('users'); |
|
26 | 26 | |
27 | - $this->get('/{id}/widget-only', UserController::class.':getUserWidgetOnly')->setName('user-widget-only'); |
|
27 | + $this->get('/{id}/widget-only', UserController::class . ':getUserWidgetOnly')->setName('user-widget-only'); |
|
28 | 28 | |
29 | - $this->get('/new', UserController::class.':getNewUserForm')->setName('user-new'); |
|
30 | - $this->get('/{id}/edit', UserController::class.':getUserEditForm')->setName('user-edit'); |
|
31 | - $this->get('/{id}/password', UserController::class.':getUserPasswordForm')->setName('user-password'); |
|
29 | + $this->get('/new', UserController::class . ':getNewUserForm')->setName('user-new'); |
|
30 | + $this->get('/{id}/edit', UserController::class . ':getUserEditForm')->setName('user-edit'); |
|
31 | + $this->get('/{id}/password', UserController::class . ':getUserPasswordForm')->setName('user-password'); |
|
32 | 32 | |
33 | - $this->get('/me', UserController::class.':getCurrentUser')->setName('user-me'); |
|
34 | - $this->get('/{id}', UserController::class.':getUser')->setName('user'); |
|
33 | + $this->get('/me', UserController::class . ':getCurrentUser')->setName('user-me'); |
|
34 | + $this->get('/{id}', UserController::class . ':getUser')->setName('user'); |
|
35 | 35 | |
36 | - $this->post('[/{id}]', UserController::class.':postUser')->setName('user-post'); |
|
37 | - $this->post('/{id}/password', UserController::class.':postUserPasswordChange')->setName('user-password-post'); |
|
36 | + $this->post('[/{id}]', UserController::class . ':postUser')->setName('user-post'); |
|
37 | + $this->post('/{id}/password', UserController::class . ':postUserPasswordChange')->setName('user-password-post'); |
|
38 | 38 | |
39 | 39 | // roles |
40 | - $this->get('/{id}/roles', RoleController::class.':getAssignRolesForm')->setName('user-roles'); |
|
41 | - $this->post('/{id}/roles', RoleController::class.':postUserAssignRoles')->setName('user-assign-post'); |
|
40 | + $this->get('/{id}/roles', RoleController::class . ':getAssignRolesForm')->setName('user-roles'); |
|
41 | + $this->post('/{id}/roles', RoleController::class . ':postUserAssignRoles')->setName('user-assign-post'); |
|
42 | 42 | |
43 | 43 | // availability |
44 | - $this->get('/{id}/availability', AvailabilityController::class.':getAvailabilityForm')->setName('user-availability'); |
|
45 | - $this->post('/{id}/availability', AvailabilityController::class.':postAvailability')->setName('user-availability-post'); |
|
44 | + $this->get('/{id}/availability', AvailabilityController::class . ':getAvailabilityForm')->setName('user-availability'); |
|
45 | + $this->post('/{id}/availability', AvailabilityController::class . ':postAvailability')->setName('user-availability-post'); |
|
46 | 46 | |
47 | 47 | // calendar |
48 | - $this->group('/me/calendar', function () { |
|
49 | - $this->get('s', CalendarController::class.':getCalendarTokens')->setName('user-calendars'); |
|
50 | - $this->get('/new', CalendarController::class.':getNewCalendarForm')->setName('user-calendars'); |
|
51 | - $this->get('/{id}/revoke', CalendarController::class.':getRevokeCalendar')->setName('user-calendar-revoke'); |
|
52 | - $this->post('/new', CalendarController::class.':postNewCalendar')->setName('user-calendar-new-post'); |
|
48 | + $this->group('/me/calendar', function() { |
|
49 | + $this->get('s', CalendarController::class . ':getCalendarTokens')->setName('user-calendars'); |
|
50 | + $this->get('/new', CalendarController::class . ':getNewCalendarForm')->setName('user-calendars'); |
|
51 | + $this->get('/{id}/revoke', CalendarController::class . ':getRevokeCalendar')->setName('user-calendar-revoke'); |
|
52 | + $this->post('/new', CalendarController::class . ':postNewCalendar')->setName('user-calendar-new-post'); |
|
53 | 53 | }); |
54 | 54 | }); |
55 | 55 | |
@@ -57,103 +57,103 @@ discard block |
||
57 | 57 | // EVENT |
58 | 58 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
59 | 59 | |
60 | -$app->group('/event', function () { |
|
61 | - $this->get('s', EventController::class.':getAllEvents')->setName('events'); |
|
62 | - $this->get('s/type/{id}', EventController::class.':getAllEventsWithType')->setName('events-eventtype'); |
|
63 | - $this->get('s/subtype/{id}', EventController::class.':getAllEventsWithSubType')->setName('events-eventsubtype'); |
|
60 | +$app->group('/event', function() { |
|
61 | + $this->get('s', EventController::class . ':getAllEvents')->setName('events'); |
|
62 | + $this->get('s/type/{id}', EventController::class . ':getAllEventsWithType')->setName('events-eventtype'); |
|
63 | + $this->get('s/subtype/{id}', EventController::class . ':getAllEventsWithSubType')->setName('events-eventsubtype'); |
|
64 | 64 | |
65 | - $this->get('s/print/info', EventController::class.':getAllEventInfoToPrint')->setName('events-print-info'); |
|
65 | + $this->get('s/print/info', EventController::class . ':getAllEventInfoToPrint')->setName('events-print-info'); |
|
66 | 66 | |
67 | - $this->get('/new', EventController::class.':getNewEventForm')->setName('event-new'); |
|
68 | - $this->get('/{id}/edit', EventController::class.':getEventEditForm')->setName('event-edit'); |
|
69 | - $this->get('/{id}/copy', EventController::class.':getEventCopyForm')->setName('event-copy'); |
|
70 | - $this->get('/{id}/assign', EventController::class.':getEventAssignForm')->setName('event-assign'); |
|
67 | + $this->get('/new', EventController::class . ':getNewEventForm')->setName('event-new'); |
|
68 | + $this->get('/{id}/edit', EventController::class . ':getEventEditForm')->setName('event-edit'); |
|
69 | + $this->get('/{id}/copy', EventController::class . ':getEventCopyForm')->setName('event-copy'); |
|
70 | + $this->get('/{id}/assign', EventController::class . ':getEventAssignForm')->setName('event-assign'); |
|
71 | 71 | |
72 | - $this->get('/{id}', EventController::class.':getEvent')->setName('event'); |
|
72 | + $this->get('/{id}', EventController::class . ':getEvent')->setName('event'); |
|
73 | 73 | |
74 | - $this->post('[/{id}]', EventController::class.':postEvent')->setName('event-post'); |
|
75 | - $this->post('/{id}/assign', EventController::class.':postEventAssign')->setName('event-assign-post'); |
|
76 | - $this->post('/{id}/comment', EventController::class.':postEventComment')->setName('event-comment-post'); |
|
74 | + $this->post('[/{id}]', EventController::class . ':postEvent')->setName('event-post'); |
|
75 | + $this->post('/{id}/assign', EventController::class . ':postEventAssign')->setName('event-assign-post'); |
|
76 | + $this->post('/{id}/comment', EventController::class . ':postEventComment')->setName('event-comment-post'); |
|
77 | 77 | }); |
78 | 78 | |
79 | 79 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
80 | 80 | // RESOURCE |
81 | 81 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
82 | 82 | |
83 | -$app->group('/resource', function () { |
|
84 | - $this->get('s', ResourceController::class.':getAllResources')->setName('resources'); |
|
83 | +$app->group('/resource', function() { |
|
84 | + $this->get('s', ResourceController::class . ':getAllResources')->setName('resources'); |
|
85 | 85 | |
86 | - $this->get('[/new]', ResourceController::class.':getNewResourceForm')->setName('resource-new'); |
|
87 | - $this->get('/{id}/edit', ResourceController::class.':getResourceEditForm')->setName('resource-edit'); |
|
86 | + $this->get('[/new]', ResourceController::class . ':getNewResourceForm')->setName('resource-new'); |
|
87 | + $this->get('/{id}/edit', ResourceController::class . ':getResourceEditForm')->setName('resource-edit'); |
|
88 | 88 | |
89 | - $this->get('/{id}', ResourceController::class.':getResourceFile')->setName('resource'); |
|
89 | + $this->get('/{id}', ResourceController::class . ':getResourceFile')->setName('resource'); |
|
90 | 90 | |
91 | - $this->post('[/{id}]', ResourceController::class.':postResource')->setName('resource-post'); |
|
91 | + $this->post('[/{id}]', ResourceController::class . ':postResource')->setName('resource-post'); |
|
92 | 92 | }); |
93 | 93 | |
94 | 94 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
95 | 95 | // ROLES & GROUPS |
96 | 96 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
97 | 97 | |
98 | -$app->group('/group', function () { |
|
99 | - $this->get('/{id}', GroupController::class.':getGroup')->setName('group'); |
|
100 | - $this->get('/{id}/roles', GroupController::class.':getGroupRoles')->setName('group-roles'); |
|
98 | +$app->group('/group', function() { |
|
99 | + $this->get('/{id}', GroupController::class . ':getGroup')->setName('group'); |
|
100 | + $this->get('/{id}/roles', GroupController::class . ':getGroupRoles')->setName('group-roles'); |
|
101 | 101 | |
102 | - $this->get('/{id}/events', EventController::class.':getAllEventsToPrintForGroup')->setName('group-events-print'); |
|
102 | + $this->get('/{id}/events', EventController::class . ':getAllEventsToPrintForGroup')->setName('group-events-print'); |
|
103 | 103 | |
104 | - $this->post('[/{id}]', GroupController::class.':postGroup')->setName('group-post'); |
|
104 | + $this->post('[/{id}]', GroupController::class . ':postGroup')->setName('group-post'); |
|
105 | 105 | }); |
106 | 106 | |
107 | 107 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
108 | 108 | // AUTH |
109 | 109 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
110 | 110 | |
111 | -$app->get('/login', AuthController::class.':getLoginForm')->setName('login'); |
|
111 | +$app->get('/login', AuthController::class . ':getLoginForm')->setName('login'); |
|
112 | 112 | |
113 | -$app->get('/login/{provider}', AuthController::class.':getLoginAuth')->setName('login-auth'); |
|
114 | -$app->get('/login/{provider}/callback', AuthController::class.':getLoginCallback')->setName('login-callback'); |
|
115 | -$app->get('/signup', PendingUserController::class.':getSignUpForm')->setName('sign-up'); |
|
116 | -$app->get('/signup/cancel', PendingUserController::class.':getSignUpCancel')->setName('sign-up-cancel'); |
|
113 | +$app->get('/login/{provider}', AuthController::class . ':getLoginAuth')->setName('login-auth'); |
|
114 | +$app->get('/login/{provider}/callback', AuthController::class . ':getLoginCallback')->setName('login-callback'); |
|
115 | +$app->get('/signup', PendingUserController::class . ':getSignUpForm')->setName('sign-up'); |
|
116 | +$app->get('/signup/cancel', PendingUserController::class . ':getSignUpCancel')->setName('sign-up-cancel'); |
|
117 | 117 | |
118 | -$app->get('/logout', AuthController::class.':getLogout')->setName('logout'); |
|
118 | +$app->get('/logout', AuthController::class . ':getLogout')->setName('logout'); |
|
119 | 119 | |
120 | -$app->post('/login', AuthController::class.':postLogin')->setName('login-post'); |
|
121 | -$app->post('/signup', PendingUserController::class.':postSignUp')->setName('sign-up-post'); |
|
120 | +$app->post('/login', AuthController::class . ':postLogin')->setName('login-post'); |
|
121 | +$app->post('/signup', PendingUserController::class . ':postSignUp')->setName('sign-up-post'); |
|
122 | 122 | |
123 | 123 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
124 | 124 | // NOTIFICATIONS |
125 | 125 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
126 | 126 | |
127 | -$app->get('/notification/{id}[/{referrer}]', NotificationController::class.':getNotificationClick')->setName('notification'); |
|
127 | +$app->get('/notification/{id}[/{referrer}]', NotificationController::class . ':getNotificationClick')->setName('notification'); |
|
128 | 128 | |
129 | 129 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
130 | 130 | // CALENDAR |
131 | 131 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
132 | 132 | |
133 | -$app->get('/calendar/{token}.{format}', CalendarController::class.':getRenderedCalendar')->setName('user-calendar'); |
|
133 | +$app->get('/calendar/{token}.{format}', CalendarController::class . ':getRenderedCalendar')->setName('user-calendar'); |
|
134 | 134 | |
135 | 135 | // legacy |
136 | -$app->get('/calendar.php', CalendarController::class.':getLegacyRenderedCalendar')->setName('user-calendar'); |
|
136 | +$app->get('/calendar.php', CalendarController::class . ':getLegacyRenderedCalendar')->setName('user-calendar'); |
|
137 | 137 | |
138 | 138 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
139 | 139 | // OTHER |
140 | 140 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
141 | 141 | |
142 | -$app->get('/settings', function ($request, $response, $args) { |
|
142 | +$app->get('/settings', function($request, $response, $args) { |
|
143 | 143 | // Sample log message |
144 | 144 | $this->logger->info("Fetch settings GET '/settings'"); |
145 | 145 | |
146 | - $url = $this->router->pathFor('home').'old/settings.php'; |
|
146 | + $url = $this->router->pathFor('home') . 'old/settings.php'; |
|
147 | 147 | |
148 | 148 | return $response->withStatus(303)->withHeader('Location', $url); |
149 | 149 | //return $this->view->render($response, 'settings.twig', []); |
150 | 150 | })->setName('settings'); |
151 | 151 | |
152 | -$app->get('/token', function ($request, $response, $args) { |
|
152 | +$app->get('/token', function($request, $response, $args) { |
|
153 | 153 | return $response->getBody()->write(Crypt::generateToken(30)); |
154 | 154 | })->setName('token'); |
155 | 155 | |
156 | -$app->get('/', function ($request, $response, $args) { |
|
156 | +$app->get('/', function($request, $response, $args) { |
|
157 | 157 | // Sample log message |
158 | 158 | $this->logger->info("Fetch home GET '/'"); |
159 | 159 | |
@@ -173,6 +173,6 @@ discard block |
||
173 | 173 | // JOBS |
174 | 174 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
175 | 175 | |
176 | -$app->group('/job', function () { |
|
177 | - $this->get('/daily/{token}', JobController::class.':getDaily')->setName('job-daily'); |
|
176 | +$app->group('/job', function() { |
|
177 | + $this->get('/daily/{token}', JobController::class . ':getDaily')->setName('job-daily'); |
|
178 | 178 | }); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | $client = new Client(); |
22 | - $url = $site->getUrl()['base'].$this->router->pathFor('home').'old/cr_daily.php'; |
|
22 | + $url = $site->getUrl()['base'] . $this->router->pathFor('home') . 'old/cr_daily.php'; |
|
23 | 23 | $response = $client->get($url, [ |
24 | 24 | 'query' => [ |
25 | 25 | 'token' => $args['token'], |