@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | function executeDbSql($sql) |
27 | 27 | { |
28 | 28 | if (!mysqli_query(db(), $sql)) { |
29 | - die('Error: '.mysqli_error(db()).', SQL: '.$sql); |
|
29 | + die('Error: ' . mysqli_error(db()) . ', SQL: ' . $sql); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | function updateDatabase() |
34 | 34 | { |
35 | 35 | $sql = 'SELECT VERSION( ) AS mysqli_version'; |
36 | - $result = mysqli_query(db(), $sql) or die('MySQL-Error: '.mysqli_error(db())); |
|
36 | + $result = mysqli_query(db(), $sql) or die('MySQL-Error: ' . mysqli_error(db())); |
|
37 | 37 | $dbv = mysqli_fetch_array($result, MYSQLI_ASSOC); |
38 | 38 | $mysqli_version = $dbv['mysqli_version']; |
39 | 39 | //echo $mysqli_version."<br>"; |
@@ -87,41 +87,41 @@ discard block |
||
87 | 87 | executeDbSql("alter table cr_users add(isOverviewRecipient char(2) NOT NULL DEFAULT '0')"); |
88 | 88 | executeDbSql('alter table cr_groups add(short_name char(2))'); |
89 | 89 | |
90 | - executeDbSql("update cr_settings set lang_locale = 'en_GB'"); // de_DE |
|
90 | + executeDbSql("update cr_settings set lang_locale = 'en_GB'"); // de_DE |
|
91 | 91 | executeDbSql('update cr_settings set event_sorting_latest = 0'); |
92 | 92 | executeDbSql('update cr_settings set snapshot_show_two_month = 0'); |
93 | 93 | executeDbSql('update cr_settings set snapshot_reduce_skills_by_group = 0'); |
94 | 94 | executeDbSql('update cr_settings set logged_in_show_snapshot_button = 0'); |
95 | 95 | executeDbSql("update cr_settings set time_format_long = '%A, %B %e @ %I:%M %p'"); // de_DE: %A, %e. %B %Y, %R Uhr, KW%V |
96 | 96 | executeDbSql("update cr_settings set time_format_normal = '%m/%d/%y %I:%M %p'"); // de_DE: %d.%m.%Y %H:%M |
97 | - 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 |
|
97 | + 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 |
|
98 | 98 | executeDbSql("update cr_settings set version = '2.1.0'"); |
99 | 99 | executeDbSql('update cr_settings set users_start_with_myevents = 0'); |
100 | 100 | executeDbSql("update cr_settings set time_zone = 'Europe/London'"); //de_DE: Europe/Berlin |
101 | 101 | executeDbSql("update cr_settings set google_group_calendar = ''"); |
102 | 102 | 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'"); |
103 | 103 | |
104 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.1.0', $_SESSION['userid']); |
|
104 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.1.0', $_SESSION['userid']); |
|
105 | 105 | case '2.1.0': |
106 | 106 | executeDbSql('create table cr_settings_bkp2_1_0 as select * from cr_settings'); |
107 | 107 | executeDbSql('alter table cr_settings add(group_sorting_name int(1))'); |
108 | 108 | executeDbSql("update cr_settings set version = '2.1.1'"); |
109 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.1.1', $_SESSION['userid']); |
|
109 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.1.1', $_SESSION['userid']); |
|
110 | 110 | case '2.1.1': |
111 | 111 | executeDbSql("update cr_settings set version = '2.1.2'"); |
112 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.1.2', $_SESSION['userid']); |
|
112 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.1.2', $_SESSION['userid']); |
|
113 | 113 | case '2.1.2': |
114 | 114 | executeDbSql("alter table cr_settings add(debug_mode int(1) DEFAULT '0')"); |
115 | - executeDbSql('update cr_settings set group_sorting_name = 0'); //was a workaround, fixed in V2.2.1 |
|
115 | + executeDbSql('update cr_settings set group_sorting_name = 0'); //was a workaround, fixed in V2.2.1 |
|
116 | 116 | |
117 | 117 | executeDbSql("update cr_settings set version = '2.2.0'"); |
118 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.2.0', $_SESSION['userid']); |
|
118 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.2.0', $_SESSION['userid']); |
|
119 | 119 | case '2.2.0': |
120 | 120 | executeDbSql("alter table cr_users add(isBandAdmin char(2) NOT NULL DEFAULT '0')"); |
121 | 121 | executeDbSql('update cr_settings set group_sorting_name = 0'); //due to an error reset it again |
122 | 122 | |
123 | 123 | executeDbSql("update cr_settings set version = '2.2.1'"); |
124 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.2.1', $_SESSION['userid']); |
|
124 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.2.1', $_SESSION['userid']); |
|
125 | 125 | case '2.2.1': |
126 | 126 | $sql = "CREATE TABLE IF NOT EXISTS `cr_statistics` ( |
127 | 127 | `id` int(11) NOT NULL AUTO_INCREMENT, |
@@ -137,21 +137,21 @@ discard block |
||
137 | 137 | executeDbSql($sql); |
138 | 138 | |
139 | 139 | executeDbSql("update cr_settings set version = '2.3.0'"); |
140 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.3.0', $_SESSION['userid']); |
|
140 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.3.0', $_SESSION['userid']); |
|
141 | 141 | insertStatistics('system', __FILE__, 'db-update', '2.3.0', $version); |
142 | 142 | case '2.3.0': |
143 | 143 | executeDbSql("alter table cr_users add(isEventEditor char(2) NOT NULL DEFAULT '0')"); |
144 | 144 | |
145 | 145 | executeDbSql("update cr_settings set version = '2.3.1'"); |
146 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.3.1', $_SESSION['userid']); |
|
146 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.3.1', $_SESSION['userid']); |
|
147 | 147 | insertStatistics('system', __FILE__, 'db-update', '2.3.1', $version); |
148 | 148 | case '2.3.1': |
149 | 149 | executeDbSql("update cr_settings set version = '2.3.2'"); |
150 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.3.2', $_SESSION['userid']); |
|
150 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.3.2', $_SESSION['userid']); |
|
151 | 151 | insertStatistics('system', __FILE__, 'db-update', '2.3.2', $version); |
152 | 152 | case '2.3.2': |
153 | 153 | executeDbSql("update cr_settings set version = '2.3.3'"); |
154 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.3.3', $_SESSION['userid']); |
|
154 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.3.3', $_SESSION['userid']); |
|
155 | 155 | insertStatistics('system', __FILE__, 'db-update', '2.3.3', $version); |
156 | 156 | case '2.3.3': |
157 | 157 | if (substr($mysqli_version, 0, 1) == 5) { |
@@ -199,33 +199,33 @@ discard block |
||
199 | 199 | ); |
200 | 200 | } |
201 | 201 | executeDbSql("update cr_settings set version = '2.3.4'"); |
202 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.3.4', $_SESSION['userid']); |
|
202 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.3.4', $_SESSION['userid']); |
|
203 | 203 | insertStatistics('system', __FILE__, 'db-update', '2.3.4', $version); |
204 | 204 | case '2.3.4': |
205 | 205 | executeDbSql("update cr_settings set version = '2.3.5'"); |
206 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.3.5', $_SESSION['userid']); |
|
206 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.3.5', $_SESSION['userid']); |
|
207 | 207 | insertStatistics('system', __FILE__, 'db-update', '2.3.5', $version); |
208 | 208 | case '2.3.5': |
209 | 209 | executeDbSql("update cr_settings set version = '2.4.0'"); |
210 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.4.0', $_SESSION['userid']); |
|
210 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.4.0', $_SESSION['userid']); |
|
211 | 211 | insertStatistics('system', __FILE__, 'db-update', '2.4.0', $version); |
212 | 212 | case '2.4.0': |
213 | 213 | executeDbSql("update cr_settings set version = '2.4.1'"); |
214 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.4.1', $_SESSION['userid']); |
|
214 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.4.1', $_SESSION['userid']); |
|
215 | 215 | insertStatistics('system', __FILE__, 'db-update', '2.4.1', $version); |
216 | 216 | case '2.4.1': |
217 | 217 | executeDbSql('alter table cr_settings add(days_to_alert int(2) DEFAULT 5) '); |
218 | 218 | executeDbSql("alter table cr_settings add(token varchar(100) DEFAULT '') "); |
219 | 219 | executeDbSql("update cr_settings set version = '2.4.2'"); |
220 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.4.2', $_SESSION['userid']); |
|
220 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.4.2', $_SESSION['userid']); |
|
221 | 221 | insertStatistics('system', __FILE__, 'db-update', '2.4.2', $version); |
222 | 222 | case '2.4.2': |
223 | 223 | executeDbSql("update cr_settings set version = '2.4.3'"); |
224 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.4.3', $_SESSION['userid']); |
|
224 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.4.3', $_SESSION['userid']); |
|
225 | 225 | insertStatistics('system', __FILE__, 'db-update', '2.4.3', $version); |
226 | 226 | case '2.4.3': |
227 | 227 | executeDbSql("update cr_settings set version = '2.4.4'"); |
228 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.4.4', $_SESSION['userid']); |
|
228 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.4.4', $_SESSION['userid']); |
|
229 | 229 | insertStatistics('system', __FILE__, 'db-update', '2.4.4', $version); |
230 | 230 | case '2.4.4': |
231 | 231 | if (substr($mysqli_version, 0, 1) == 5) { |
@@ -274,27 +274,27 @@ discard block |
||
274 | 274 | ); |
275 | 275 | } |
276 | 276 | executeDbSql("update cr_settings set version = '2.4.5'"); |
277 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.4.5', $_SESSION['userid']); |
|
277 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.4.5', $_SESSION['userid']); |
|
278 | 278 | insertStatistics('system', __FILE__, 'db-update', '2.4.5', $version); |
279 | 279 | case '2.4.5': |
280 | 280 | executeDbSql("update cr_settings set version = '2.5.0'"); |
281 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.5.0', $_SESSION['userid']); |
|
281 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.5.0', $_SESSION['userid']); |
|
282 | 282 | insertStatistics('system', __FILE__, 'db-update', '2.5.0', $version); |
283 | 283 | case '2.5.0': |
284 | 284 | executeDbSql("update cr_settings set version = '2.5.1'"); |
285 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.5.1', $_SESSION['userid']); |
|
285 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.5.1', $_SESSION['userid']); |
|
286 | 286 | insertStatistics('system', __FILE__, 'db-update', '2.5.1', $version); |
287 | 287 | case '2.5.1': |
288 | 288 | executeDbSql("update cr_settings set version = '2.5.2'"); |
289 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.5.2', $_SESSION['userid']); |
|
289 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.5.2', $_SESSION['userid']); |
|
290 | 290 | insertStatistics('system', __FILE__, 'db-update', '2.5.2', $version); |
291 | 291 | case '2.5.2': |
292 | 292 | executeDbSql("update cr_settings set version = '2.5.3'"); |
293 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.5.3', $_SESSION['userid']); |
|
293 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.5.3', $_SESSION['userid']); |
|
294 | 294 | insertStatistics('system', __FILE__, 'db-update', '2.5.3', $version); |
295 | 295 | case '2.5.3': |
296 | 296 | executeDbSql("update cr_settings set version = '2.6.0'"); |
297 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.6.0', $_SESSION['userid']); |
|
297 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.6.0', $_SESSION['userid']); |
|
298 | 298 | insertStatistics('system', __FILE__, 'db-update', '2.6.0', $version); |
299 | 299 | case '2.6.0': |
300 | 300 | $sql = "ALTER TABLE cr_users |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | executeDbSql($sql); |
371 | 371 | executeDbSql("update cr_settings set version = '3.0.0-pre1'"); |
372 | 372 | |
373 | - notifyInfo(__FILE__, 'db-update='.$version.'->3.0.0-pre1', $_SESSION['userid']); |
|
373 | + notifyInfo(__FILE__, 'db-update=' . $version . '->3.0.0-pre1', $_SESSION['userid']); |
|
374 | 374 | insertStatistics('system', __FILE__, 'db-update', '3.0.0-pre1', $version); |
375 | 375 | case '3.0.0-pre1': |
376 | 376 | $sql = "CREATE TABLE IF NOT EXISTS cr_notifications ( |
@@ -17,7 +17,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -30,7 +30,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -14,7 +14,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | exit; |
36 | 36 | } |
37 | 37 | if (!isAdmin()) { |
38 | - header('Location: error.php?no=100&page='.basename($_SERVER['SCRIPT_FILENAME'])); |
|
38 | + header('Location: error.php?no=100&page=' . basename($_SERVER['SCRIPT_FILENAME'])); |
|
39 | 39 | exit; |
40 | 40 | } |
41 | 41 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if ($editskillID != '') { |
72 | 72 | $sql = ("INSERT INTO cr_eventPeople (eventID, skillID) VALUES ('$editeventID', '$editskillID')"); |
73 | 73 | if (!mysqli_query(db(), $sql)) { |
74 | - die('Error: '.mysqli_error(db())); |
|
74 | + die('Error: ' . mysqli_error(db())); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | // After we have inserted the data, we want to head back to the main page |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | $sql = ("INSERT INTO cr_eventPeople (eventID, skillID) VALUES ('$editeventID', '$editskillID')"); |
90 | 90 | if (!mysqli_query(db(), $sql)) { |
91 | - die('Error: '.mysqli_error(db())); |
|
91 | + die('Error: ' . mysqli_error(db())); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 |
@@ -47,7 +47,7 @@ |
||
47 | 47 | break; |
48 | 48 | case 'unlink': |
49 | 49 | removeSocialAuthFromUserWithId($id, $platform); |
50 | - createNotificationForUser($id, ucfirst($platform).' account unlinked', 'You have successfully unlinked your Facebook account. Login via Facebook is now disabled for your account. Feel free to relink your account at any time.', 'account', 'linkSocialAuth.php'); |
|
50 | + createNotificationForUser($id, ucfirst($platform) . ' account unlinked', 'You have successfully unlinked your Facebook account. Login via Facebook is now disabled for your account. Feel free to relink your account at any time.', 'account', 'linkSocialAuth.php'); |
|
51 | 51 | break; |
52 | 52 | |
53 | 53 | default: |
@@ -6,31 +6,31 @@ |
||
6 | 6 | // To help the built-in PHP dev server, check if the request was actually for |
7 | 7 | // something which should probably be served as a static file |
8 | 8 | $url = parse_url($_SERVER['REQUEST_URI']); |
9 | - $file = __DIR__.$url['path']; |
|
9 | + $file = __DIR__ . $url['path']; |
|
10 | 10 | if (is_file($file)) { |
11 | 11 | return false; |
12 | 12 | } |
13 | 13 | } |
14 | 14 | |
15 | -require __DIR__.'/../vendor/autoload.php'; |
|
15 | +require __DIR__ . '/../vendor/autoload.php'; |
|
16 | 16 | |
17 | 17 | // setup Propel (autoload configured though composer) |
18 | -require_once __DIR__.'/../generated-conf/config.php'; |
|
18 | +require_once __DIR__ . '/../generated-conf/config.php'; |
|
19 | 19 | |
20 | 20 | session_start(); |
21 | 21 | |
22 | 22 | // Instantiate the app |
23 | -$settings = require __DIR__.'/../src/settings.php'; |
|
23 | +$settings = require __DIR__ . '/../src/settings.php'; |
|
24 | 24 | $app = new \Slim\App($settings); |
25 | 25 | |
26 | 26 | // Set up dependencies |
27 | -require __DIR__.'/../src/dependencies.php'; |
|
27 | +require __DIR__ . '/../src/dependencies.php'; |
|
28 | 28 | |
29 | 29 | // Register middleware |
30 | -require __DIR__.'/../src/middleware.php'; |
|
30 | +require __DIR__ . '/../src/middleware.php'; |
|
31 | 31 | |
32 | 32 | // Register routes |
33 | -require __DIR__.'/../src/routes.php'; |
|
33 | +require __DIR__ . '/../src/routes.php'; |
|
34 | 34 | |
35 | 35 | // Run app |
36 | 36 | $app->run(); |
@@ -22,16 +22,16 @@ |
||
22 | 22 | } |
23 | 23 | //$acceptedFileExtensions = ['jpg', 'png', 'jpeg', 'gif', 'docx', 'pdf', 'xlsx', 'pptx']; |
24 | 24 | $acceptedFileTypes = ['image/gif', 'image/png', 'image/jpeg', 'application/pdf', 'application/msword', 'application/excel']; |
25 | - $target_dir = __DIR__.'/../documents/'; |
|
25 | + $target_dir = __DIR__ . '/../documents/'; |
|
26 | 26 | $this->setUrl($file->getClientFilename()); |
27 | 27 | //$fileExtension = pathinfo(basename($file->getName()),PATHINFO_EXTENSION); |
28 | 28 | |
29 | 29 | // Allow certain file formats only |
30 | 30 | if (!in_array($file->getClientMediaType(), $acceptedFileTypes)) { |
31 | - throw new InvalidArgumentException('Sorry, only '.implode(', ', $acceptedFileTypes).' files are allowed.'); |
|
31 | + throw new InvalidArgumentException('Sorry, only ' . implode(', ', $acceptedFileTypes) . ' files are allowed.'); |
|
32 | 32 | } |
33 | 33 | $this->save(); |
34 | - $target_file = $target_dir.$this->getId(); |
|
34 | + $target_file = $target_dir . $this->getId(); |
|
35 | 35 | |
36 | 36 | // Check if file already exists |
37 | 37 | if (file_exists($target_file)) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getName() |
79 | 79 | { |
80 | - return $this->firstname.' '.$this->lastname; |
|
80 | + return $this->firstname . ' ' . $this->lastname; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -96,16 +96,16 @@ discard block |
||
96 | 96 | if ($socialAuth->getPlatform() == 'facebook') { |
97 | 97 | switch ($size) { |
98 | 98 | case 'small': // 50px x 50px |
99 | - return '//graph.facebook.com/'.$socialAuth->getSocialId().'/picture?type=square'; |
|
99 | + return '//graph.facebook.com/' . $socialAuth->getSocialId() . '/picture?type=square'; |
|
100 | 100 | break; |
101 | 101 | case 'medium': // 200px x 200px |
102 | - return '//graph.facebook.com/'.$socialAuth->getSocialId().'/picture?type=large'; |
|
102 | + return '//graph.facebook.com/' . $socialAuth->getSocialId() . '/picture?type=large'; |
|
103 | 103 | break; |
104 | 104 | case 'large': // 200px x 200px |
105 | - return '//graph.facebook.com/'.$socialAuth->getSocialId().'/picture?type=large'; |
|
105 | + return '//graph.facebook.com/' . $socialAuth->getSocialId() . '/picture?type=large'; |
|
106 | 106 | break; |
107 | 107 | default: |
108 | - return '//graph.facebook.com/'.$socialAuth->getSocialId().'/picture'; |
|
108 | + return '//graph.facebook.com/' . $socialAuth->getSocialId() . '/picture'; |
|
109 | 109 | break; |
110 | 110 | } |
111 | 111 | } elseif ($socialAuth->getPlatform() == 'onebody') { |
@@ -114,16 +114,16 @@ discard block |
||
114 | 114 | $extension = pathinfo($socialAuth->getMeta()['photo-file-name'], PATHINFO_EXTENSION); |
115 | 115 | switch ($size) { |
116 | 116 | case 'small': // 50px x 50px |
117 | - return $baseUrl.'/system/production/people/photos/'.$socialAuth->getSocialId().'/tn/'.$photoFingerprint.'.'.$extension; |
|
117 | + return $baseUrl . '/system/production/people/photos/' . $socialAuth->getSocialId() . '/tn/' . $photoFingerprint . '.' . $extension; |
|
118 | 118 | break; |
119 | 119 | case 'medium': // 150px x 150px |
120 | - return $baseUrl.'/system/production/people/photos/'.$socialAuth->getSocialId().'/small/'.$photoFingerprint.'.'.$extension; |
|
120 | + return $baseUrl . '/system/production/people/photos/' . $socialAuth->getSocialId() . '/small/' . $photoFingerprint . '.' . $extension; |
|
121 | 121 | break; |
122 | 122 | case 'large': // 500px x 500px |
123 | - return $baseUrl.'/system/production/people/photos/'.$socialAuth->getSocialId().'/medium/'.$photoFingerprint.'.'.$extension; |
|
123 | + return $baseUrl . '/system/production/people/photos/' . $socialAuth->getSocialId() . '/medium/' . $photoFingerprint . '.' . $extension; |
|
124 | 124 | break; |
125 | 125 | default: |
126 | - return $baseUrl.'/system/production/people/photos/'.$socialAuth->getSocialId().'/tn/'.$photoFingerprint.'.'.$extension; |
|
126 | + return $baseUrl . '/system/production/people/photos/' . $socialAuth->getSocialId() . '/tn/' . $photoFingerprint . '.' . $extension; |
|
127 | 127 | break; |
128 | 128 | } |
129 | 129 | } |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | |
133 | 133 | switch ($size) { |
134 | 134 | case 'small': // 50px x 50px |
135 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($this->email))).'?s=50&d=mm'; |
|
135 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($this->email))) . '?s=50&d=mm'; |
|
136 | 136 | break; |
137 | 137 | case 'medium': // 200px x 200px |
138 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($this->email))).'?s=200&d=mm'; |
|
138 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($this->email))) . '?s=200&d=mm'; |
|
139 | 139 | break; |
140 | 140 | case 'large': // 500px x 500px |
141 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($this->email))).'?s=500&d=mm'; |
|
141 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($this->email))) . '?s=500&d=mm'; |
|
142 | 142 | break; |
143 | 143 | default: |
144 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($this->email))).'?s=50&d=mm'; |
|
144 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($this->email))) . '?s=50&d=mm'; |
|
145 | 145 | break; |
146 | 146 | } |
147 | 147 | } |