@@ -35,7 +35,8 @@ discard block |
||
| 35 | 35 | //Set View |
| 36 | 36 | if(isset($_GET['view'])) |
| 37 | 37 | { |
| 38 | - switch ($_GET['view']) { |
|
| 38 | + switch ($_GET['view']) |
|
| 39 | + { |
|
| 39 | 40 | case 'comment': |
| 40 | 41 | $view = 'comment'; |
| 41 | 42 | break; |
@@ -55,7 +56,8 @@ discard block |
||
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | //Set Location |
| 58 | - if(isset($_GET['city'])) { |
|
| 59 | + if(isset($_GET['city'])) |
|
| 60 | + { |
|
| 59 | 61 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
| 60 | 62 | $result = Requests::post($url); |
| 61 | 63 | if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
@@ -99,11 +101,14 @@ discard block |
||
| 99 | 101 | } |
| 100 | 102 | |
| 101 | 103 | //Vote |
| 102 | - if(isset($_GET['vote']) && isset($_GET['postID'])) { |
|
| 103 | - if($_GET['vote'] == "up") { |
|
| 104 | + if(isset($_GET['vote']) && isset($_GET['postID'])) |
|
| 105 | + { |
|
| 106 | + if($_GET['vote'] == "up") |
|
| 107 | + { |
|
| 104 | 108 | $accountCreator = new Upvote(); |
| 105 | 109 | } |
| 106 | - else if($_GET['vote'] == "down") { |
|
| 110 | + else if($_GET['vote'] == "down") |
|
| 111 | + { |
|
| 107 | 112 | $accountCreator = new Downvote(); |
| 108 | 113 | } |
| 109 | 114 | $accountCreator->setAccessToken($accessToken_forId1); |
@@ -116,7 +121,8 @@ discard block |
||
| 116 | 121 | |
| 117 | 122 | |
| 118 | 123 | //SendJodel |
| 119 | - if(isset($_POST['message'])) { |
|
| 124 | + if(isset($_POST['message'])) |
|
| 125 | + { |
|
| 120 | 126 | $accountCreator = new SendJodel(); |
| 121 | 127 | |
| 122 | 128 | if(isset($_POST['ancestor'])) |
@@ -127,7 +133,8 @@ discard block |
||
| 127 | 133 | if(isset($_POST['color'])) |
| 128 | 134 | { |
| 129 | 135 | $color = $_POST['color']; |
| 130 | - switch ($color) { |
|
| 136 | + switch ($color) |
|
| 137 | + { |
|
| 131 | 138 | case '8ABDB0': |
| 132 | 139 | $color = '8ABDB0'; |
| 133 | 140 | break; |
@@ -273,7 +280,8 @@ discard block |
||
| 273 | 280 | $data = $accountCreator->execute(); |
| 274 | 281 | |
| 275 | 282 | $posts[0] = $data; |
| 276 | - if(property_exists($data, 'children')) { |
|
| 283 | + if(property_exists($data, 'children')) |
|
| 284 | + { |
|
| 277 | 285 | foreach($data['children'] as $key => $child) |
| 278 | 286 | { |
| 279 | 287 | |
@@ -295,7 +303,9 @@ discard block |
||
| 295 | 303 | } |
| 296 | 304 | $loops = $data['child_count'] + 1; |
| 297 | 305 | } |
| 298 | - else $loops = 1; |
|
| 306 | + else { |
|
| 307 | + $loops = 1; |
|
| 308 | + } |
|
| 299 | 309 | $isDetailedView = TRUE; |
| 300 | 310 | } |
| 301 | 311 | //Get Posts |
@@ -345,7 +355,9 @@ discard block |
||
| 345 | 355 | |
| 346 | 356 | </content> |
| 347 | 357 | |
| 348 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 358 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
| 359 | +{ |
|
| 360 | +?> |
|
| 349 | 361 | <p id="loading"> |
| 350 | 362 | Loading… |
| 351 | 363 | </p> |
@@ -358,7 +370,11 @@ discard block |
||
| 358 | 370 | <div> |
| 359 | 371 | <h2>Position</h2> |
| 360 | 372 | <form method="get"> |
| 361 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
| 373 | + <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) |
|
| 374 | +{ |
|
| 375 | + echo $newPositionStatus; |
|
| 376 | +} |
|
| 377 | +?>" required> |
|
| 362 | 378 | |
| 363 | 379 | <input type="submit" value="Set Location" /> |
| 364 | 380 | </form> |
@@ -374,7 +390,9 @@ discard block |
||
| 374 | 390 | |
| 375 | 391 | <article> |
| 376 | 392 | <div> |
| 377 | - <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
|
| 393 | + <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) |
|
| 394 | +{ |
|
| 395 | +?> |
|
| 378 | 396 | <h2>Comment on Jodel</h2> |
| 379 | 397 | <form method="POST"> |
| 380 | 398 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
@@ -382,7 +400,10 @@ discard block |
||
| 382 | 400 | <br /> |
| 383 | 401 | <input type="submit" value="SEND" /> |
| 384 | 402 | </form> |
| 385 | - <?php } else { ?> |
|
| 403 | + <?php } |
|
| 404 | +else |
|
| 405 | +{ |
|
| 406 | +?> |
|
| 386 | 407 | <h2>New Jodel</h2> |
| 387 | 408 | <form method="POST"> |
| 388 | 409 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -414,13 +435,25 @@ discard block |
||
| 414 | 435 | <div class="col-sm-12"> |
| 415 | 436 | <div class="row"> |
| 416 | 437 | <div class="col-sm-3"> |
| 417 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 438 | + <a href="index.php" <?php if($view=='time') |
|
| 439 | +{ |
|
| 440 | + echo 'class="active"'; |
|
| 441 | +} |
|
| 442 | +?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 418 | 443 | </div> |
| 419 | 444 | <div class="col-sm-3"> |
| 420 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 445 | + <a href="index.php?view=comment" <?php if($view=='comment') |
|
| 446 | +{ |
|
| 447 | + echo 'class="active"'; |
|
| 448 | +} |
|
| 449 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 421 | 450 | </div> |
| 422 | 451 | <div class="col-sm-3"> |
| 423 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 452 | + <a href="index.php?view=upVote" <?php if($view=='upVote') |
|
| 453 | +{ |
|
| 454 | + echo 'class="active"'; |
|
| 455 | +} |
|
| 456 | +?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 424 | 457 | </div> |
| 425 | 458 | <div class="col-sm-3"> |
| 426 | 459 | <nav> |
@@ -463,7 +496,9 @@ discard block |
||
| 463 | 496 | $('html,body').animate({scrollTop: aTag.offset().top-90},'slow'); |
| 464 | 497 | } |
| 465 | 498 | |
| 466 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 499 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
| 500 | +{ |
|
| 501 | +?> |
|
| 467 | 502 | |
| 468 | 503 | |
| 469 | 504 | |