@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | if(!isset($_COOKIE['JodelDeviceId']) || !isDeviceUidInDatabase($db->real_escape_string($_COOKIE['JodelDeviceId']))) |
| 40 | 40 | { |
| 41 | 41 | $deviceUid = createAccount(); |
| 42 | - setcookie('JodelDeviceId', $deviceUid, time()+60*60*24*365*10); |
|
| 43 | - error_log('Created account with JodelDeviceId:' . $deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
|
| 42 | + setcookie('JodelDeviceId', $deviceUid, time() + 60 * 60 * 24 * 365 * 10); |
|
| 43 | + error_log('Created account with JodelDeviceId:' . $deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | else |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | //Set View |
| 62 | 62 | if(isset($_GET['view'])) |
| 63 | 63 | { |
| 64 | - switch ($_GET['view']) { |
|
| 64 | + switch($_GET['view']) { |
|
| 65 | 65 | case 'comment': |
| 66 | 66 | $view = 'comment'; |
| 67 | 67 | break; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | else |
| 120 | 120 | { |
| 121 | 121 | $newPositionStatus = $name; |
| 122 | - error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 122 | + error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | if(isset($_POST['color'])) |
| 173 | 173 | { |
| 174 | 174 | $color = $_POST['color']; |
| 175 | - switch ($color) { |
|
| 175 | + switch($color) { |
|
| 176 | 176 | case '8ABDB0': |
| 177 | 177 | $color = '8ABDB0'; |
| 178 | 178 | break; |
@@ -267,13 +267,13 @@ discard block |
||
| 267 | 267 | else |
| 268 | 268 | { |
| 269 | 269 | $version = 'v2'; |
| 270 | - if($view=='comment') |
|
| 270 | + if($view == 'comment') |
|
| 271 | 271 | { |
| 272 | 272 | $url = "/v2/posts/location/discussed/"; |
| 273 | 273 | } |
| 274 | 274 | else |
| 275 | 275 | { |
| 276 | - if($view=='upVote') |
|
| 276 | + if($view == 'upVote') |
|
| 277 | 277 | { |
| 278 | 278 | $url = "/v2/posts/location/popular/"; |
| 279 | 279 | } |
@@ -299,13 +299,13 @@ discard block |
||
| 299 | 299 | <!DOCTYPE html> |
| 300 | 300 | <html lang="en"> |
| 301 | 301 | <head> |
| 302 | - <title><?php echo getTitle($posts[0], $view, $isDetailedView);?></title> |
|
| 302 | + <title><?php echo getTitle($posts[0], $view, $isDetailedView); ?></title> |
|
| 303 | 303 | |
| 304 | 304 | <meta charset="utf-8"> |
| 305 | 305 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
| 306 | 306 | <meta http-equiv="x-ua-compatible" content="ie=edge"> |
| 307 | 307 | |
| 308 | - <meta name="description" content="<?php echo getMetaDescription($posts[0], $view, $isDetailedView);?>"> |
|
| 308 | + <meta name="description" content="<?php echo getMetaDescription($posts[0], $view, $isDetailedView); ?>"> |
|
| 309 | 309 | <meta name="keywords" content="jodelblue, jodel, blue, webclient, web, client, web-app, browser, app"> |
| 310 | 310 | |
| 311 | 311 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous"> |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | <content id="posts"> |
| 388 | 388 | <?php |
| 389 | - for($i = 0; $i<$loops; $i++) |
|
| 389 | + for($i = 0; $i < $loops; $i++) |
|
| 390 | 390 | { |
| 391 | 391 | if(array_key_exists($i, $posts) && array_key_exists('post_id', $posts[$i]) && isset($posts[$i]['post_id'])) |
| 392 | 392 | { |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
| 431 | 431 | <h2>Comment on Jodel</h2> |
| 432 | 432 | <form method="POST"> |
| 433 | - <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
|
| 433 | + <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" /> |
|
| 434 | 434 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
| 435 | 435 | <br /> |
| 436 | 436 | <input type="submit" value="SEND" /> |
@@ -467,13 +467,13 @@ discard block |
||
| 467 | 467 | <div class="col-xs-12"> |
| 468 | 468 | <div class="row"> |
| 469 | 469 | <div class="col-xs-3"> |
| 470 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 470 | + <a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 471 | 471 | </div> |
| 472 | 472 | <div class="col-xs-3"> |
| 473 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 473 | + <a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 474 | 474 | </div> |
| 475 | 475 | <div class="col-xs-3"> |
| 476 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 476 | + <a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 477 | 477 | </div> |
| 478 | 478 | <div class="col-xs-3"> |
| 479 | 479 | <nav> |
@@ -61,7 +61,8 @@ discard block |
||
| 61 | 61 | //Set View |
| 62 | 62 | if(isset($_GET['view'])) |
| 63 | 63 | { |
| 64 | - switch ($_GET['view']) { |
|
| 64 | + switch ($_GET['view']) |
|
| 65 | + { |
|
| 65 | 66 | case 'comment': |
| 66 | 67 | $view = 'comment'; |
| 67 | 68 | break; |
@@ -81,7 +82,8 @@ discard block |
||
| 81 | 82 | } |
| 82 | 83 | |
| 83 | 84 | //Set Location |
| 84 | - if(isset($_GET['city'])) { |
|
| 85 | + if(isset($_GET['city'])) |
|
| 86 | + { |
|
| 85 | 87 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
| 86 | 88 | $result = Requests::post($url); |
| 87 | 89 | if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
@@ -172,7 +174,8 @@ discard block |
||
| 172 | 174 | if(isset($_POST['color'])) |
| 173 | 175 | { |
| 174 | 176 | $color = $_POST['color']; |
| 175 | - switch ($color) { |
|
| 177 | + switch ($color) |
|
| 178 | + { |
|
| 176 | 179 | case '8ABDB0': |
| 177 | 180 | $color = '8ABDB0'; |
| 178 | 181 | break; |
@@ -235,7 +238,8 @@ discard block |
||
| 235 | 238 | $data = $accountCreator->execute(); |
| 236 | 239 | |
| 237 | 240 | $posts[0] = $data; |
| 238 | - if(array_key_exists('children', $data)) { |
|
| 241 | + if(array_key_exists('children', $data)) |
|
| 242 | + { |
|
| 239 | 243 | foreach($data['children'] as $key => $child) |
| 240 | 244 | { |
| 241 | 245 | |
@@ -371,7 +375,11 @@ discard block |
||
| 371 | 375 | |
| 372 | 376 | <div id="location_mobile" class="hidden-sm-up"> |
| 373 | 377 | <form method="get"> |
| 374 | - <input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
| 378 | + <input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus)) |
|
| 379 | +{ |
|
| 380 | + echo $newPositionStatus; |
|
| 381 | +} |
|
| 382 | +?>" required> |
|
| 375 | 383 | |
| 376 | 384 | <input type="submit" id="submit_mobile" class="fa" value="" /> |
| 377 | 385 | </form> |
@@ -398,7 +406,9 @@ discard block |
||
| 398 | 406 | |
| 399 | 407 | </content> |
| 400 | 408 | |
| 401 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 409 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
| 410 | +{ |
|
| 411 | +?> |
|
| 402 | 412 | <p id="loading"> |
| 403 | 413 | Loading… |
| 404 | 414 | </p> |
@@ -411,7 +421,11 @@ discard block |
||
| 411 | 421 | <div> |
| 412 | 422 | <h2>Position</h2> |
| 413 | 423 | <form method="get"> |
| 414 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
| 424 | + <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) |
|
| 425 | +{ |
|
| 426 | + echo $newPositionStatus; |
|
| 427 | +} |
|
| 428 | +?>" required> |
|
| 415 | 429 | |
| 416 | 430 | <input type="submit" value="Set Location" /> |
| 417 | 431 | </form> |
@@ -427,7 +441,9 @@ discard block |
||
| 427 | 441 | |
| 428 | 442 | <article> |
| 429 | 443 | <div> |
| 430 | - <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
|
| 444 | + <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) |
|
| 445 | +{ |
|
| 446 | +?> |
|
| 431 | 447 | <h2>Comment on Jodel</h2> |
| 432 | 448 | <form method="POST"> |
| 433 | 449 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
@@ -435,7 +451,10 @@ discard block |
||
| 435 | 451 | <br /> |
| 436 | 452 | <input type="submit" value="SEND" /> |
| 437 | 453 | </form> |
| 438 | - <?php } else { ?> |
|
| 454 | + <?php } |
|
| 455 | +else |
|
| 456 | +{ |
|
| 457 | +?> |
|
| 439 | 458 | <h2>New Jodel</h2> |
| 440 | 459 | <form method="POST"> |
| 441 | 460 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -467,13 +486,25 @@ discard block |
||
| 467 | 486 | <div class="col-xs-12"> |
| 468 | 487 | <div class="row"> |
| 469 | 488 | <div class="col-xs-3"> |
| 470 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 489 | + <a href="index.php" <?php if($view=='time') |
|
| 490 | +{ |
|
| 491 | + echo 'class="active"'; |
|
| 492 | +} |
|
| 493 | +?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 471 | 494 | </div> |
| 472 | 495 | <div class="col-xs-3"> |
| 473 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 496 | + <a href="index.php?view=comment" <?php if($view=='comment') |
|
| 497 | +{ |
|
| 498 | + echo 'class="active"'; |
|
| 499 | +} |
|
| 500 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 474 | 501 | </div> |
| 475 | 502 | <div class="col-xs-3"> |
| 476 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 503 | + <a href="index.php?view=upVote" <?php if($view=='upVote') |
|
| 504 | +{ |
|
| 505 | + echo 'class="active"'; |
|
| 506 | +} |
|
| 507 | +?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 477 | 508 | </div> |
| 478 | 509 | <div class="col-xs-3"> |
| 479 | 510 | <nav> |
@@ -516,7 +547,9 @@ discard block |
||
| 516 | 547 | $('html,body').animate({scrollTop: aTag.offset().top-90},'slow'); |
| 517 | 548 | } |
| 518 | 549 | |
| 519 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 550 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
| 551 | +{ |
|
| 552 | +?> |
|
| 520 | 553 | |
| 521 | 554 | |
| 522 | 555 | |