@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | function executeDbSql($sql) |
25 | 25 | { |
26 | 26 | if (!mysqli_query(db(), $sql)) { |
27 | - exit('Error: '.mysqli_error(db()).', SQL: '.$sql); |
|
27 | + exit('Error: ' . mysqli_error(db()) . ', SQL: ' . $sql); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | 31 | function updateDatabase() |
32 | 32 | { |
33 | 33 | $sql = 'SELECT VERSION( ) AS mysqli_version'; |
34 | - $result = mysqli_query(db(), $sql) or exit('MySQL-Error: '.mysqli_error(db())); |
|
34 | + $result = mysqli_query(db(), $sql) or exit('MySQL-Error: ' . mysqli_error(db())); |
|
35 | 35 | $dbv = mysqli_fetch_array($result, MYSQLI_ASSOC); |
36 | 36 | $mysqli_version = $dbv['mysqli_version']; |
37 | 37 | //echo $mysqli_version."<br>"; |
@@ -85,41 +85,41 @@ discard block |
||
85 | 85 | executeDbSql("alter table users add(isOverviewRecipient char(2) NOT NULL DEFAULT '0')"); |
86 | 86 | executeDbSql('alter table groups add(short_name char(2))'); |
87 | 87 | |
88 | - executeDbSql("update settings set lang_locale = 'en_GB'"); // de_DE |
|
88 | + executeDbSql("update settings set lang_locale = 'en_GB'"); // de_DE |
|
89 | 89 | executeDbSql('update settings set event_sorting_latest = 0'); |
90 | 90 | executeDbSql('update settings set snapshot_show_two_month = 0'); |
91 | 91 | executeDbSql('update settings set snapshot_reduce_skills_by_group = 0'); |
92 | 92 | executeDbSql('update settings set logged_in_show_snapshot_button = 0'); |
93 | 93 | executeDbSql("update settings set time_format_long = '%A, %B %e @ %I:%M %p'"); // de_DE: %A, %e. %B %Y, %R Uhr, KW%V |
94 | 94 | executeDbSql("update settings set time_format_normal = '%m/%d/%y %I:%M %p'"); // de_DE: %d.%m.%Y %H:%M |
95 | - executeDbSql("update settings set time_format_short = '%a, <strong>%b %e</strong>, %I:%M %p'"); // de_DE: %a, <strong>%e. %b</strong>, KW%V |
|
95 | + executeDbSql("update settings set time_format_short = '%a, <strong>%b %e</strong>, %I:%M %p'"); // de_DE: %a, <strong>%e. %b</strong>, KW%V |
|
96 | 96 | executeDbSql("update settings set version = '2.1.0'"); |
97 | 97 | executeDbSql('update settings set users_start_with_myevents = 0'); |
98 | 98 | executeDbSql("update settings set time_zone = 'Europe/London'"); //de_DE: Europe/Berlin |
99 | 99 | executeDbSql("update settings set google_group_calendar = ''"); |
100 | 100 | executeDbSql("update 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'"); |
101 | 101 | |
102 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.1.0', $_SESSION['userid']); |
|
102 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.1.0', $_SESSION['userid']); |
|
103 | 103 | case '2.1.0': |
104 | 104 | executeDbSql('create table settings_bkp2_1_0 as select * from settings'); |
105 | 105 | executeDbSql('alter table settings add(group_sorting_name int(1))'); |
106 | 106 | executeDbSql("update settings set version = '2.1.1'"); |
107 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.1.1', $_SESSION['userid']); |
|
107 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.1.1', $_SESSION['userid']); |
|
108 | 108 | case '2.1.1': |
109 | 109 | executeDbSql("update settings set version = '2.1.2'"); |
110 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.1.2', $_SESSION['userid']); |
|
110 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.1.2', $_SESSION['userid']); |
|
111 | 111 | case '2.1.2': |
112 | 112 | executeDbSql("alter table settings add(debug_mode int(1) DEFAULT '0')"); |
113 | - executeDbSql('update settings set group_sorting_name = 0'); //was a workaround, fixed in V2.2.1 |
|
113 | + executeDbSql('update settings set group_sorting_name = 0'); //was a workaround, fixed in V2.2.1 |
|
114 | 114 | |
115 | 115 | executeDbSql("update settings set version = '2.2.0'"); |
116 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.2.0', $_SESSION['userid']); |
|
116 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.2.0', $_SESSION['userid']); |
|
117 | 117 | case '2.2.0': |
118 | 118 | executeDbSql("alter table users add(isBandAdmin char(2) NOT NULL DEFAULT '0')"); |
119 | 119 | executeDbSql('update settings set group_sorting_name = 0'); //due to an error reset it again |
120 | 120 | |
121 | 121 | executeDbSql("update settings set version = '2.2.1'"); |
122 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.2.1', $_SESSION['userid']); |
|
122 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.2.1', $_SESSION['userid']); |
|
123 | 123 | case '2.2.1': |
124 | 124 | $sql = "CREATE TABLE IF NOT EXISTS `statistics` ( |
125 | 125 | `id` int(11) NOT NULL AUTO_INCREMENT, |
@@ -135,21 +135,21 @@ discard block |
||
135 | 135 | executeDbSql($sql); |
136 | 136 | |
137 | 137 | executeDbSql("update settings set version = '2.3.0'"); |
138 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.3.0', $_SESSION['userid']); |
|
138 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.3.0', $_SESSION['userid']); |
|
139 | 139 | insertStatistics('system', __FILE__, 'db-update', '2.3.0', $version); |
140 | 140 | case '2.3.0': |
141 | 141 | executeDbSql("alter table users add(isEventEditor char(2) NOT NULL DEFAULT '0')"); |
142 | 142 | |
143 | 143 | executeDbSql("update settings set version = '2.3.1'"); |
144 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.3.1', $_SESSION['userid']); |
|
144 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.3.1', $_SESSION['userid']); |
|
145 | 145 | insertStatistics('system', __FILE__, 'db-update', '2.3.1', $version); |
146 | 146 | case '2.3.1': |
147 | 147 | executeDbSql("update settings set version = '2.3.2'"); |
148 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.3.2', $_SESSION['userid']); |
|
148 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.3.2', $_SESSION['userid']); |
|
149 | 149 | insertStatistics('system', __FILE__, 'db-update', '2.3.2', $version); |
150 | 150 | case '2.3.2': |
151 | 151 | executeDbSql("update settings set version = '2.3.3'"); |
152 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.3.3', $_SESSION['userid']); |
|
152 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.3.3', $_SESSION['userid']); |
|
153 | 153 | insertStatistics('system', __FILE__, 'db-update', '2.3.3', $version); |
154 | 154 | case '2.3.3': |
155 | 155 | if (substr($mysqli_version, 0, 1) == 5) { |
@@ -198,33 +198,33 @@ discard block |
||
198 | 198 | ); |
199 | 199 | } |
200 | 200 | executeDbSql("update settings set version = '2.3.4'"); |
201 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.3.4', $_SESSION['userid']); |
|
201 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.3.4', $_SESSION['userid']); |
|
202 | 202 | insertStatistics('system', __FILE__, 'db-update', '2.3.4', $version); |
203 | 203 | case '2.3.4': |
204 | 204 | executeDbSql("update settings set version = '2.3.5'"); |
205 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.3.5', $_SESSION['userid']); |
|
205 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.3.5', $_SESSION['userid']); |
|
206 | 206 | insertStatistics('system', __FILE__, 'db-update', '2.3.5', $version); |
207 | 207 | case '2.3.5': |
208 | 208 | executeDbSql("update settings set version = '2.4.0'"); |
209 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.4.0', $_SESSION['userid']); |
|
209 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.4.0', $_SESSION['userid']); |
|
210 | 210 | insertStatistics('system', __FILE__, 'db-update', '2.4.0', $version); |
211 | 211 | case '2.4.0': |
212 | 212 | executeDbSql("update settings set version = '2.4.1'"); |
213 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.4.1', $_SESSION['userid']); |
|
213 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.4.1', $_SESSION['userid']); |
|
214 | 214 | insertStatistics('system', __FILE__, 'db-update', '2.4.1', $version); |
215 | 215 | case '2.4.1': |
216 | 216 | executeDbSql('alter table settings add(days_to_alert int(2) DEFAULT 5) '); |
217 | 217 | executeDbSql("alter table settings add(token varchar(100) DEFAULT '') "); |
218 | 218 | executeDbSql("update settings set version = '2.4.2'"); |
219 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.4.2', $_SESSION['userid']); |
|
219 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.4.2', $_SESSION['userid']); |
|
220 | 220 | insertStatistics('system', __FILE__, 'db-update', '2.4.2', $version); |
221 | 221 | case '2.4.2': |
222 | 222 | executeDbSql("update settings set version = '2.4.3'"); |
223 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.4.3', $_SESSION['userid']); |
|
223 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.4.3', $_SESSION['userid']); |
|
224 | 224 | insertStatistics('system', __FILE__, 'db-update', '2.4.3', $version); |
225 | 225 | case '2.4.3': |
226 | 226 | executeDbSql("update settings set version = '2.4.4'"); |
227 | - notifyInfo(__FILE__, 'db-update='.$version.'->2.4.4', $_SESSION['userid']); |
|
227 | + notifyInfo(__FILE__, 'db-update=' . $version . '->2.4.4', $_SESSION['userid']); |
|
228 | 228 | insertStatistics('system', __FILE__, 'db-update', '2.4.4', $version); |
229 | 229 | case '2.4.4': |
230 | 230 | if (substr($mysqli_version, 0, 1) == 5) { |
@@ -274,27 +274,27 @@ discard block |
||
274 | 274 | ); |
275 | 275 | } |
276 | 276 | executeDbSql("update 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 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 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 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 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 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 users |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | executeDbSql($sql); |
371 | 371 | executeDbSql("update 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 notifications ( |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | <!-- Menu toggle button --> |
296 | 296 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
297 | 297 | <i class="fa fa-bell-o"></i> |
298 | - <?php echo $unseen >= 1 ? '<span class="label label-warning">'.$unseen.'</span>' : '' ?> |
|
298 | + <?php echo $unseen >= 1 ? '<span class="label label-warning">' . $unseen . '</span>' : '' ?> |
|
299 | 299 | </a> |
300 | 300 | <ul class="dropdown-menu"> |
301 | 301 | <li class="header">You have <?php echo $unseen >= 1 ? $unseen : 'no' ?> new notifications</li> |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | <?php foreach ($notifications as $n) { ?> |
306 | 306 | <li><!-- start notification --> |
307 | 307 | <a href="notification.php?click=notifications-panel&id=<?php echo $n->id ?>"> |
308 | - <i class="fa fa-users text-aqua"></i> <?php echo $n->seen ? $n->summary : '<strong>'.$n->summary.'</strong>' ?> |
|
308 | + <i class="fa fa-users text-aqua"></i> <?php echo $n->seen ? $n->summary : '<strong>' . $n->summary . '</strong>' ?> |
|
309 | 309 | <small><?php echo timeAgoInWords($n->timestamp) ?></small> |
310 | 310 | </a> |
311 | 311 | </li><!-- end notification --> |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | <!-- User Account Menu --> |
361 | 361 | <li class="dropdown user user-menu"> |
362 | 362 | <?php |
363 | - $sql = 'SELECT u.created FROM users u WHERE id = '.$_SESSION['userid']; |
|
363 | + $sql = 'SELECT u.created FROM users u WHERE id = ' . $_SESSION['userid']; |
|
364 | 364 | $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); |
365 | 365 | $currentUser = mysqli_fetch_object($result); |
366 | 366 | ?> |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | // create username and remove all whitespace |
38 | - $username = $firstNameLower.'.'.$lastNameLower; |
|
38 | + $username = $firstNameLower . '.' . $lastNameLower; |
|
39 | 39 | $username = preg_replace('/\s+/', '', $username); |
40 | 40 | |
41 | 41 | $sql = ("INSERT INTO users (firstName, lastName, username, email, mobile, password, created, updated) |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | $id = mysqli_insert_id(db()); |
47 | 47 | |
48 | 48 | $notificationMessage = "Welcome to your new account on the rota system.\n |
49 | -If you have any issues, please get in touch with us [".siteSettings()->getAdminEmailAddress().'](mailto:'.siteSettings()->getAdminEmailAddress().").\n |
|
49 | +If you have any issues, please get in touch with us [".siteSettings()->getAdminEmailAddress() . '](mailto:' . siteSettings()->getAdminEmailAddress() . ").\n |
|
50 | 50 | ---\n |
51 | 51 | **Sync to digital calendar**\n |
52 | 52 | You may wish to link the rota to your digital calendar on your computer and phone. To do so, generate a [calendar token](calendarTokens.php) which will present you with your unique URL. Follow instructions from your digital calendar provider for exact details on how import an iCal feed, or get in touch and we may be able to help.\n"; |
53 | 53 | |
54 | - createNotificationForUser($id, 'Welcome '.$firstName, $notificationMessage, 'feature'); |
|
54 | + createNotificationForUser($id, 'Welcome ' . $firstName, $notificationMessage, 'feature'); |
|
55 | 55 | createNotificationForUser($id, 'Change your password', 'Please change your password to something unique and memorable.', 'account', 'editPassword.php'); |
56 | 56 | |
57 | 57 | return $id; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $sql = "SELECT firstName, lastName FROM users WHERE id = '$id'"; |
146 | 146 | $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); |
147 | 147 | $ob = mysqli_fetch_object($result); |
148 | - $name = $ob->firstName.' '.$ob->lastName; |
|
148 | + $name = $ob->firstName . ' ' . $ob->lastName; |
|
149 | 149 | |
150 | 150 | return $name; |
151 | 151 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $currentTimestamp = date('Y-m-d H:i:s'); |
220 | 220 | $sql = "UPDATE users SET password = '$newPassword', passwordChanged = '$currentTimestamp' WHERE id = '$userId'"; |
221 | 221 | $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); |
222 | - insertStatistics('user', __FILE__, 'password force changed for user '.getNameWithId($userId), null, $_SERVER['HTTP_USER_AGENT']); |
|
222 | + insertStatistics('user', __FILE__, 'password force changed for user ' . getNameWithId($userId), null, $_SERVER['HTTP_USER_AGENT']); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | function hashPassword($plainTextPassword) |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | if ($loginFailures < $numberOfAllowedAttempts) { |
266 | 266 | return true; |
267 | 267 | } else { |
268 | - insertStatistics('user', __FILE__, 'Login attempts exceeded for username: '.$username, $ipAddress, $_SERVER['HTTP_USER_AGENT']); |
|
268 | + insertStatistics('user', __FILE__, 'Login attempts exceeded for username: ' . $username, $ipAddress, $_SERVER['HTTP_USER_AGENT']); |
|
269 | 269 | |
270 | 270 | return false; |
271 | 271 | } |
@@ -341,11 +341,11 @@ discard block |
||
341 | 341 | $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); |
342 | 342 | |
343 | 343 | $pendingId = mysqli_insert_id(db()); |
344 | - $linkToApprove = 'pendingAccounts.php?id='.$pendingId; |
|
344 | + $linkToApprove = 'pendingAccounts.php?id=' . $pendingId; |
|
345 | 345 | |
346 | - $email = siteSettings()->getOwner().'<'.siteSettings()->getAdminEmailAddress().'>'; |
|
347 | - $subject = $firstName.' requested an account'; |
|
348 | - $message = $subject.' through '.$source.".\nApprove or decline: ".siteSettings()->getSiteUrl().'/'.$linkToApprove; |
|
346 | + $email = siteSettings()->getOwner() . '<' . siteSettings()->getAdminEmailAddress() . '>'; |
|
347 | + $subject = $firstName . ' requested an account'; |
|
348 | + $message = $subject . ' through ' . $source . ".\nApprove or decline: " . siteSettings()->getSiteUrl() . '/' . $linkToApprove; |
|
349 | 349 | |
350 | 350 | sendMail($email, $subject, $message, $email); |
351 | 351 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | addSocialAuthToUserWithId($userId, $pendingUser->socialId, $pendingUser->source); |
418 | 418 | updateUser($userId, $pendingUser->firstName, $pendingUser->lastName, $pendingUser->email, null); |
419 | 419 | |
420 | - createNotificationForUser($userId, 'Social Login added: '.$pendingUser->source, 'Your social media login details for '.$pendingUser->source.' have been added to your existing account', 'account'); |
|
420 | + createNotificationForUser($userId, 'Social Login added: ' . $pendingUser->source, 'Your social media login details for ' . $pendingUser->source . ' have been added to your existing account', 'account'); |
|
421 | 421 | createFacebookNotificationForUser($userId, 'login.php', 'Your account request has been approved. You can now login via Facebook.'); |
422 | 422 | |
423 | 423 | return true; |
@@ -500,32 +500,32 @@ discard block |
||
500 | 500 | |
501 | 501 | function getProfileImageUrl($userId, $size = 'small') |
502 | 502 | { |
503 | - $sql = 'SELECT sa.socialId, u.email FROM users u LEFT JOIN socialAuth sa ON sa.userId = u.id WHERE id = '.$userId; |
|
503 | + $sql = 'SELECT sa.socialId, u.email FROM users u LEFT JOIN socialAuth sa ON sa.userId = u.id WHERE id = ' . $userId; |
|
504 | 504 | $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); |
505 | 505 | $user = mysqli_fetch_object($result); |
506 | 506 | |
507 | 507 | if ($user->socialId) { |
508 | 508 | switch ($size) { |
509 | 509 | case 'small': // 50px x 50px |
510 | - return '//graph.facebook.com/'.$user->socialId.'/picture?type=square'; |
|
510 | + return '//graph.facebook.com/' . $user->socialId . '/picture?type=square'; |
|
511 | 511 | break; |
512 | 512 | case 'large': // 200px x 200px |
513 | - return '//graph.facebook.com/'.$user->socialId.'/picture?type=large'; |
|
513 | + return '//graph.facebook.com/' . $user->socialId . '/picture?type=large'; |
|
514 | 514 | break; |
515 | 515 | default: |
516 | - return '//graph.facebook.com/'.$user->socialId.'/picture'; |
|
516 | + return '//graph.facebook.com/' . $user->socialId . '/picture'; |
|
517 | 517 | break; |
518 | 518 | } |
519 | 519 | } else { |
520 | 520 | switch ($size) { |
521 | 521 | case 'small': // 50px x 50px |
522 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($user->email))).'?s=50&d=mm'; |
|
522 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($user->email))) . '?s=50&d=mm'; |
|
523 | 523 | break; |
524 | 524 | case 'large': // 200px x 200px |
525 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($user->email))).'?s=200&d=mm'; |
|
525 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($user->email))) . '?s=200&d=mm'; |
|
526 | 526 | break; |
527 | 527 | default: |
528 | - return '//www.gravatar.com/avatar/'.md5(strtolower(trim($user->email))).'?s=50&d=mm'; |
|
528 | + return '//www.gravatar.com/avatar/' . md5(strtolower(trim($user->email))) . '?s=50&d=mm'; |
|
529 | 529 | break; |
530 | 530 | } |
531 | 531 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $sql = "UPDATE roles SET name = '$name', description = '$description' WHERE id = '$id'"; |
31 | 31 | |
32 | 32 | if (!mysqli_query(db(), $sql)) { |
33 | - exit('Error: '.mysqli_error(db())); |
|
33 | + exit('Error: ' . mysqli_error(db())); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | $sql = "UPDATE groups SET name = '$name' WHERE groupId = '$key'"; |
40 | 40 | |
41 | 41 | if (!mysqli_query(db(), $sql)) { |
42 | - exit('Error: '.mysqli_error(db())); |
|
42 | + exit('Error: ' . mysqli_error(db())); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $sql = "UPDATE groups SET description = '$description' WHERE groupId = '$key'"; |
46 | 46 | |
47 | 47 | if (!mysqli_query(db(), $sql)) { |
48 | - exit('Error: '.mysqli_error(db())); |
|
48 | + exit('Error: ' . mysqli_error(db())); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $sql = "UPDATE roles SET groupId = '$value' WHERE id = '$roleID'"; |
55 | 55 | |
56 | 56 | if (!mysqli_query(db(), $sql)) { |
57 | - exit('Error: '.mysqli_error(db())); |
|
57 | + exit('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 groups WHERE id = '".$ob->groupId."'"; |
|
134 | + $sql = "SELECT allowRoleSwaps FROM groups WHERE id = '" . $ob->groupId . "'"; |
|
135 | 135 | $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); |
136 | 136 | $ob = mysqli_fetch_object($result); |
137 | 137 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | if (!isAdmin()) { |
19 | - header('Location: error.php?no=100&page='.basename($_SERVER['SCRIPT_FILENAME'])); |
|
19 | + header('Location: error.php?no=100&page=' . basename($_SERVER['SCRIPT_FILENAME'])); |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -28,28 +28,28 @@ discard block |
||
28 | 28 | if ($method == 'truncate') { |
29 | 29 | $sql = "CREATE TABLE tmp_system_statistics as SELECT * from statistics WHERE type='system'"; |
30 | 30 | if (!mysqli_query(db(), $sql)) { |
31 | - exit('Error: '.mysqli_error(db())); |
|
31 | + exit('Error: ' . mysqli_error(db())); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $sql = ('TRUNCATE TABLE statistics'); |
35 | 35 | if (!mysqli_query(db(), $sql)) { |
36 | - exit('Error: '.mysqli_error(db())); |
|
36 | + exit('Error: ' . mysqli_error(db())); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $sql = ('ALTER TABLE statistics AUTO_INCREMENT = 50'); |
40 | 40 | if (!mysqli_query(db(), $sql)) { |
41 | - exit('Error: '.mysqli_error(db())); |
|
41 | + exit('Error: ' . mysqli_error(db())); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $sql = 'INSERT INTO statistics (userid,date,type,detail1,detail2,detail3,script) '; |
45 | - $sql = $sql.'SELECT userid,date,type,detail1,detail2,detail3,script from tmp_system_statistics order by date'; |
|
45 | + $sql = $sql . 'SELECT userid,date,type,detail1,detail2,detail3,script from tmp_system_statistics order by date'; |
|
46 | 46 | if (!mysqli_query(db(), $sql)) { |
47 | - exit('Error: '.mysqli_error(db())); |
|
47 | + exit('Error: ' . mysqli_error(db())); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | $sql = 'DROP TABLE tmp_system_statistics'; |
51 | 51 | if (!mysqli_query(db(), $sql)) { |
52 | - exit('Error: '.mysqli_error(db())); |
|
52 | + exit('Error: ' . mysqli_error(db())); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | insertStatistics('system', __FILE__, 'statistics deleted'); |
@@ -105,22 +105,22 @@ discard block |
||
105 | 105 | <?php |
106 | 106 | |
107 | 107 | $sql = 'SELECT VERSION( ) AS mysqli_version'; |
108 | - $result = mysqli_query(db(), $sql) or exit('MySQL-Error: '.mysqli_error(db())); |
|
108 | + $result = mysqli_query(db(), $sql) or exit('MySQL-Error: ' . mysqli_error(db())); |
|
109 | 109 | $dbv = mysqli_fetch_array($result, MYSQLI_ASSOC); |
110 | 110 | $mysqli_version = $dbv['mysqli_version']; |
111 | 111 | |
112 | 112 | if (substr($mysqli_version, 0, 1) == 5) { |
113 | - $sql = "SELECT getBrowserInfo(detail3) as browser,count(*) as count from statistics where detail1 like 'login%' and detail3!='' group by getBrowserInfo(detail3) order by count desc ".$browserLimit; |
|
113 | + $sql = "SELECT getBrowserInfo(detail3) as browser,count(*) as count from statistics where detail1 like 'login%' and detail3!='' group by getBrowserInfo(detail3) order by count desc " . $browserLimit; |
|
114 | 114 | } else { |
115 | - $sql = "SELECT detail3 as browser,count(*) as count from statistics where detail1 like 'login%' and detail3!='' group by detail3 order by count desc ".$browserLimit; |
|
115 | + $sql = "SELECT detail3 as browser,count(*) as count from statistics where detail1 like 'login%' and detail3!='' group by detail3 order by count desc " . $browserLimit; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); |
119 | 119 | while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
120 | 120 | extract($row); |
121 | 121 | echo '<tr>'; |
122 | - echo '<td>'.$browser.'</td>'; |
|
123 | - echo '<td>'.$count.'</td>'; |
|
122 | + echo '<td>' . $browser . '</td>'; |
|
123 | + echo '<td>' . $count . '</td>'; |
|
124 | 124 | echo '</tr>'; |
125 | 125 | } ?> |
126 | 126 | |
@@ -147,16 +147,16 @@ discard block |
||
147 | 147 | $sql .= " AND s.type = 'system'"; |
148 | 148 | } |
149 | 149 | } |
150 | - $sql .= ' ORDER BY date desc '.$limit; |
|
150 | + $sql .= ' ORDER BY date desc ' . $limit; |
|
151 | 151 | $result = mysqli_query(db(), $sql) or exit(mysqli_error(db())); |
152 | 152 | while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
153 | 153 | extract($row); |
154 | 154 | echo '<tr>'; |
155 | - echo '<td>'.$date.'</td>'; |
|
156 | - echo '<td>'.$name.'</td>'; |
|
157 | - echo '<td>'.$type.'</td>'; |
|
158 | - echo '<td>'.$detail1.'</td>'; |
|
159 | - echo '<td>'.$detail2.'</td>'; |
|
155 | + echo '<td>' . $date . '</td>'; |
|
156 | + echo '<td>' . $name . '</td>'; |
|
157 | + echo '<td>' . $type . '</td>'; |
|
158 | + echo '<td>' . $detail1 . '</td>'; |
|
159 | + echo '<td>' . $detail2 . '</td>'; |
|
160 | 160 | //echo "<td>".$detail3."</td>"; |
161 | 161 | echo '</tr>'; |
162 | 162 | } |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | // Start of API |
24 | 24 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
25 | 25 | |
26 | - require_once __DIR__.'/../../../vendor/autoload.php'; |
|
26 | + require_once __DIR__ . '/../../../vendor/autoload.php'; |
|
27 | 27 | |
28 | - require_once __DIR__.'/../../../generated-conf/config.php'; |
|
28 | + require_once __DIR__ . '/../../../generated-conf/config.php'; |
|
29 | 29 | |
30 | 30 | // Create and configure Slim app |
31 | 31 | $app = new \Slim\App(['settings' => $config]); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $container = $app->getContainer(); |
38 | 38 | |
39 | - $container['db'] = function ($c) { |
|
39 | + $container['db'] = function($c) { |
|
40 | 40 | $db_config = $c['settings']['db']; |
41 | 41 | $db = new Database($db_config); |
42 | 42 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | // ~~~~~~~~~~~~~~~ Series ~~~~~~~~~~~~~~~ |
51 | 51 | |
52 | - $app->post('/series', function ($request, $response, $args) { |
|
52 | + $app->post('/series', function($request, $response, $args) { |
|
53 | 53 | $postData = $request->getParsedBody(); |
54 | 54 | |
55 | 55 | $name = filter_var($postData['name'], FILTER_SANITIZE_STRING); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require __DIR__.'/../config/database.php'; |
|
3 | +require __DIR__ . '/../config/database.php'; |
|
4 | 4 | $serviceContainer = \Propel\Runtime\Propel::getServiceContainer(); |
5 | 5 | $serviceContainer->checkVersion('2.0.0-dev'); |
6 | 6 | |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | $manager = new \Propel\Runtime\Connection\ConnectionManagerSingle(); |
9 | 9 | $manager->setConfiguration([ |
10 | 10 | 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', |
11 | - 'dsn' => 'mysql:host='.$config['db']['host'].';dbname='.$config['db']['dbname'], |
|
11 | + 'dsn' => 'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['dbname'], |
|
12 | 12 | 'user' => $config['db']['user'], |
13 | 13 | 'password' => $config['db']['pass'], |
14 | 14 | 'attributes' => [ |