@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | $accessToken_forId1; |
12 | 12 | $deviceUid; |
13 | 13 | |
14 | - setcookie("JodelId", "", time()-3600); |
|
14 | + setcookie("JodelId", "", time() - 3600); |
|
15 | 15 | |
16 | 16 | if(!isset($_COOKIE["JodelDeviceId"])) |
17 | 17 | { |
18 | 18 | $deviceUid = createAccount(); |
19 | - setcookie("JodelDeviceId", $deviceUid, time()+60*60*24*365*10); |
|
19 | + setcookie("JodelDeviceId", $deviceUid, time() + 60 * 60 * 24 * 365 * 10); |
|
20 | 20 | |
21 | 21 | } |
22 | 22 | else |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | //Set View |
36 | 36 | if(isset($_GET['view'])) |
37 | 37 | { |
38 | - switch ($_GET['view']) { |
|
38 | + switch($_GET['view']) { |
|
39 | 39 | case 'comment': |
40 | 40 | $view = 'comment'; |
41 | 41 | break; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | if(isset($_POST['color'])) |
128 | 128 | { |
129 | 129 | $color = $_POST['color']; |
130 | - switch ($color) { |
|
130 | + switch($color) { |
|
131 | 131 | case '8ABDB0': |
132 | 132 | $color = '8ABDB0'; |
133 | 133 | break; |
@@ -297,13 +297,13 @@ discard block |
||
297 | 297 | else |
298 | 298 | { |
299 | 299 | $version = 'v2'; |
300 | - if($view=='comment') |
|
300 | + if($view == 'comment') |
|
301 | 301 | { |
302 | 302 | $url = "/v2/posts/location/discussed/"; |
303 | 303 | } |
304 | 304 | else |
305 | 305 | { |
306 | - if($view=='upVote') |
|
306 | + if($view == 'upVote') |
|
307 | 307 | { |
308 | 308 | $url = "/v2/posts/location/popular/"; |
309 | 309 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | } |
328 | 328 | |
329 | 329 | |
330 | - for($i = 0; $i<$loops; $i++) |
|
330 | + for($i = 0; $i < $loops; $i++) |
|
331 | 331 | { |
332 | 332 | |
333 | 333 | if(isset($posts[$i])) |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
373 | 373 | <h2>Comment on Jodel</h2> |
374 | 374 | <form method="POST"> |
375 | - <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
|
375 | + <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" /> |
|
376 | 376 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
377 | 377 | <br /> |
378 | 378 | <input type="submit" value="SEND" /> |
@@ -409,13 +409,13 @@ discard block |
||
409 | 409 | <div class="col-sm-12"> |
410 | 410 | <div class="row"> |
411 | 411 | <div class="col-sm-3"> |
412 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
412 | + <a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
413 | 413 | </div> |
414 | 414 | <div class="col-sm-3"> |
415 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
415 | + <a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
416 | 416 | </div> |
417 | 417 | <div class="col-sm-3"> |
418 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
418 | + <a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
419 | 419 | </div> |
420 | 420 | <div class="col-sm-3"> |
421 | 421 | <nav> |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | $access_token; |
27 | 27 | |
28 | - if ($result->num_rows > 0) |
|
28 | + if($result->num_rows > 0) |
|
29 | 29 | { |
30 | 30 | // output data of each row |
31 | 31 | while($row = $result->fetch_assoc()) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | if($expiration_date <= time()) { |
44 | 44 | $accountCreator = new CreateUser(); |
45 | - $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
|
45 | + $accountCreator->setAccessToken($access_token); //$accountData->getAccessToken()); |
|
46 | 46 | $accountCreator->setDeviceUid($deviceUid); |
47 | 47 | $accountCreator->setLocation($location); |
48 | 48 | $data = $accountCreator->execute(); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | expiration_date='" . $expiration_date . "' |
58 | 58 | WHERE device_uid='" . $device_uid . "'"); |
59 | 59 | |
60 | - if($result === false){ |
|
60 | + if($result === false) { |
|
61 | 61 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
62 | 62 | } |
63 | 63 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $db = new DatabaseConnect(); |
71 | 71 | $result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
72 | 72 | |
73 | - if ($result->num_rows > 0) |
|
73 | + if($result->num_rows > 0) |
|
74 | 74 | { |
75 | 75 | // output data of each row |
76 | 76 | while($row = $result->fetch_assoc()) { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | if($expiration_date <= time()) { |
89 | 89 | $accountCreator = new CreateUser(); |
90 | - $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
|
90 | + $accountCreator->setAccessToken($access_token); //$accountData->getAccessToken()); |
|
91 | 91 | $accountCreator->setDeviceUid($deviceUid); |
92 | 92 | $accountCreator->setLocation($location); |
93 | 93 | $data = $accountCreator->execute(); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | expiration_date='" . $expiration_date . "' |
103 | 103 | WHERE device_uid='" . $device_uid . "'"); |
104 | 104 | |
105 | - if($result === false){ |
|
105 | + if($result === false) { |
|
106 | 106 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
107 | 107 | } |
108 | 108 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | $access_token; |
119 | 119 | |
120 | - if ($result->num_rows > 0) |
|
120 | + if($result->num_rows > 0) |
|
121 | 121 | { |
122 | 122 | // output data of each row |
123 | 123 | while($row = $result->fetch_assoc()) { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | expiration_date='" . $expiration_date . "' |
150 | 150 | WHERE device_uid='" . $device_uid . "'"); |
151 | 151 | |
152 | - if($result === false){ |
|
152 | + if($result === false) { |
|
153 | 153 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
154 | 154 | } |
155 | 155 | } |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | function getLocationByAccessToken($accessToken) |
161 | 161 | { |
162 | 162 | $db = new DatabaseConnect(); |
163 | - $result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
|
163 | + $result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
|
164 | 164 | |
165 | 165 | $location = new Location(); |
166 | 166 | |
167 | - if ($result->num_rows > 0) |
|
167 | + if($result->num_rows > 0) |
|
168 | 168 | { |
169 | 169 | // output data of each row |
170 | 170 | while($row = $result->fetch_assoc()) |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | function getLocationByDeviceUid($deviceUid) |
186 | 186 | { |
187 | 187 | $db = new DatabaseConnect(); |
188 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
188 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
189 | 189 | |
190 | 190 | $location = new Location(); |
191 | 191 | |
192 | - if ($result->num_rows > 0) |
|
192 | + if($result->num_rows > 0) |
|
193 | 193 | { |
194 | 194 | // output data of each row |
195 | 195 | while($row = $result->fetch_assoc()) |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | function getAccessTokenByDeviceUid($deviceUid) |
211 | 211 | { |
212 | 212 | $db = new DatabaseConnect(); |
213 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
213 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
214 | 214 | |
215 | 215 | $accessToken; |
216 | 216 | |
217 | - if ($result->num_rows > 0) |
|
217 | + if($result->num_rows > 0) |
|
218 | 218 | { |
219 | 219 | // output data of each row |
220 | 220 | while($row = $result->fetch_assoc()) |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | $result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type, |
262 | 262 | expires_in, expiration_date, distinct_id, device_uid, name, lat, lng) |
263 | 263 | VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type . |
264 | - "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
264 | + "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
265 | 265 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
266 | 266 | |
267 | 267 | $success = TRUE; |
268 | - if($result === false){ |
|
268 | + if($result === false) { |
|
269 | 269 | $error = db_error(); |
270 | 270 | echo $error; |
271 | 271 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -321,25 +321,25 @@ discard block |
||
321 | 321 | $timediff_inDays = (string)$timediff->format('%d'); |
322 | 322 | $timediff_inMonth = (string)$timediff->format('%m'); |
323 | 323 | |
324 | - if($timediff_inMonth!=0) |
|
324 | + if($timediff_inMonth != 0) |
|
325 | 325 | { |
326 | 326 | $timediff = $timediff_inMonth . "m"; |
327 | 327 | } |
328 | 328 | else |
329 | 329 | { |
330 | - if($timediff_inDays!=0) |
|
330 | + if($timediff_inDays != 0) |
|
331 | 331 | { |
332 | 332 | $timediff = $timediff_inDays . "d"; |
333 | 333 | } |
334 | 334 | else |
335 | 335 | { |
336 | - if($timediff_inHours!=0) |
|
336 | + if($timediff_inHours != 0) |
|
337 | 337 | { |
338 | 338 | $timediff = $timediff_inHours . "h"; |
339 | 339 | } |
340 | 340 | else |
341 | 341 | { |
342 | - if($timediff_inMinutes!=0) |
|
342 | + if($timediff_inMinutes != 0) |
|
343 | 343 | { |
344 | 344 | $timediff = $timediff_inMinutes . "m"; |
345 | 345 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | |
355 | 355 | ?> |
356 | - <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;"> |
|
356 | + <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"]; ?>;"> |
|
357 | 357 | <content> |
358 | 358 | <?php |
359 | 359 | if(isset($post["image_url"])) { |
@@ -365,12 +365,12 @@ discard block |
||
365 | 365 | ?> |
366 | 366 | </content> |
367 | 367 | <aside> |
368 | - <a href="index.php?vote=up&postID=<?php echo $post["post_id"];?>"> |
|
368 | + <a href="index.php?vote=up&postID=<?php echo $post["post_id"]; ?>"> |
|
369 | 369 | <i class="fa fa-angle-up fa-3x"></i> |
370 | 370 | </a> |
371 | 371 | <br /> |
372 | - <?php echo $post["vote_count"];?><br /> |
|
373 | - <a href="index.php?vote=down&postID=<?php echo $post["post_id"];?>"> |
|
372 | + <?php echo $post["vote_count"]; ?><br /> |
|
373 | + <a href="index.php?vote=down&postID=<?php echo $post["post_id"]; ?>"> |
|
374 | 374 | <i class="fa fa-angle-down fa-3x"></i> |
375 | 375 | </a> |
376 | 376 | </aside> |
@@ -381,14 +381,14 @@ discard block |
||
381 | 381 | <td class="time"> |
382 | 382 | <span class="tip" data-tooltip="Time"> |
383 | 383 | <i class="fa fa-clock-o"></i> |
384 | - <?php echo $timediff;?> |
|
385 | - <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span> |
|
384 | + <?php echo $timediff; ?> |
|
385 | + <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s'); ?></span> |
|
386 | 386 | </span> |
387 | 387 | </td> |
388 | 388 | <td class="comments"> |
389 | 389 | <?php if(!$isDetailedView) {?> |
390 | 390 | <span data-tooltip="Comments"> |
391 | - <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>"> |
|
391 | + <a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $post["post_id"]; ?>"> |
|
392 | 392 | <i class="fa fa-commenting-o"></i> |
393 | 393 | <?php if(array_key_exists("child_count", $post)) { |
394 | 394 | echo $post["child_count"]; |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | { |
418 | 418 | ?> |
419 | 419 | <span data-tooltip="Author"> |
420 | - <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> | |
|
420 | + <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"]; ?> | |
|
421 | 421 | </span> |
422 | 422 | <?php |
423 | 423 | } |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | |
428 | 428 | <span class="tip" data-tooltip="Distance"> |
429 | 429 | <i class="fa fa-map-marker"></i> |
430 | - <?php echo $post['distance'];?> km |
|
431 | - <span class="tiptext"><?php echo $post['location']['name'];?></span> |
|
430 | + <?php echo $post['distance']; ?> km |
|
431 | + <span class="tiptext"><?php echo $post['location']['name']; ?></span> |
|
432 | 432 | </span> |
433 | 433 | </td> |
434 | 434 | </tr> |