| @@ -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(array_key_exists('children', $data)) { | |
| 283 | +								if(array_key_exists('children', $data)) | |
| 284 | +								{ | |
| 277 | 285 | foreach($data['children'] as $key => $child) | 
| 278 | 286 |  									{ | 
| 279 | 287 | |
| @@ -348,7 +356,9 @@ discard block | ||
| 348 | 356 | |
| 349 | 357 | </content> | 
| 350 | 358 | |
| 351 | -					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> | |
| 359 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) | |
| 360 | +{ | |
| 361 | +?> | |
| 352 | 362 | <p id="loading"> | 
| 353 | 363 | Loading… | 
| 354 | 364 | </p> | 
| @@ -361,7 +371,11 @@ discard block | ||
| 361 | 371 | <div> | 
| 362 | 372 | <h2>Position</h2> | 
| 363 | 373 | <form method="get"> | 
| 364 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> | |
| 374 | + <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) | |
| 375 | +{ | |
| 376 | + echo $newPositionStatus; | |
| 377 | +} | |
| 378 | +?>" required> | |
| 365 | 379 | |
| 366 | 380 | <input type="submit" value="Set Location" /> | 
| 367 | 381 | </form> | 
| @@ -377,7 +391,9 @@ discard block | ||
| 377 | 391 | |
| 378 | 392 | <article> | 
| 379 | 393 | <div> | 
| 380 | -								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> | |
| 394 | + <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) | |
| 395 | +{ | |
| 396 | +?> | |
| 381 | 397 | <h2>Comment on Jodel</h2> | 
| 382 | 398 | <form method="POST"> | 
| 383 | 399 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> | 
| @@ -385,7 +401,10 @@ discard block | ||
| 385 | 401 | <br /> | 
| 386 | 402 | <input type="submit" value="SEND" /> | 
| 387 | 403 | </form> | 
| 388 | -									<?php } else { ?> | |
| 404 | + <?php } | |
| 405 | +else | |
| 406 | +{ | |
| 407 | +?> | |
| 389 | 408 | <h2>New Jodel</h2> | 
| 390 | 409 | <form method="POST"> | 
| 391 | 410 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> | 
| @@ -417,13 +436,25 @@ discard block | ||
| 417 | 436 | <div class="col-sm-12"> | 
| 418 | 437 | <div class="row"> | 
| 419 | 438 | <div class="col-sm-3"> | 
| 420 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> | |
| 439 | + <a href="index.php" <?php if($view=='time') | |
| 440 | +{ | |
| 441 | + echo 'class="active"'; | |
| 442 | +} | |
| 443 | +?>><i class="fa fa-clock-o fa-3x"></i></a> | |
| 421 | 444 | </div> | 
| 422 | 445 | <div class="col-sm-3"> | 
| 423 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> | |
| 446 | + <a href="index.php?view=comment" <?php if($view=='comment') | |
| 447 | +{ | |
| 448 | + echo 'class="active"'; | |
| 449 | +} | |
| 450 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> | |
| 424 | 451 | </div> | 
| 425 | 452 | <div class="col-sm-3"> | 
| 426 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> | |
| 453 | + <a href="index.php?view=upVote" <?php if($view=='upVote') | |
| 454 | +{ | |
| 455 | + echo 'class="active"'; | |
| 456 | +} | |
| 457 | +?>><i class="fa fa-angle-up fa-3x"></i></a> | |
| 427 | 458 | </div> | 
| 428 | 459 | <div class="col-sm-3"> | 
| 429 | 460 | <nav> | 
| @@ -466,7 +497,9 @@ discard block | ||
| 466 | 497 |  				    $('html,body').animate({scrollTop: aTag.offset().top-90},'slow'); | 
| 467 | 498 | } | 
| 468 | 499 | |
| 469 | -				<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> | |
| 500 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) | |
| 501 | +{ | |
| 502 | +?> | |
| 470 | 503 | |
| 471 | 504 | |
| 472 | 505 | |