@@ -28,7 +28,8 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $posts[0] = $data; |
| 30 | 30 | |
| 31 | - if(array_key_exists('children', $data)) { |
|
| 31 | + if(array_key_exists('children', $data)) |
|
| 32 | + { |
|
| 32 | 33 | foreach($data['children'] as $key => $child) |
| 33 | 34 | { |
| 34 | 35 | |
@@ -91,7 +92,9 @@ discard block |
||
| 91 | 92 | } ?> |
| 92 | 93 | </content> |
| 93 | 94 | |
| 94 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 95 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
| 96 | +{ |
|
| 97 | +?> |
|
| 95 | 98 | <p id="loading"> |
| 96 | 99 | Loading… |
| 97 | 100 | </p> |
@@ -99,12 +102,20 @@ discard block |
||
| 99 | 102 | </article> |
| 100 | 103 | |
| 101 | 104 | <aside class="topSidebar col-sm-4 sidebar-outer"> |
| 102 | - <div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile');?>"> |
|
| 105 | + <div class="fixed<?php if(!$view->isDetailedView) |
|
| 106 | +{ |
|
| 107 | + echo(' hide-mobile'); |
|
| 108 | +} |
|
| 109 | +?>"> |
|
| 103 | 110 | <article> |
| 104 | 111 | <div> |
| 105 | 112 | <h2>Position / Hashtag</h2> |
| 106 | 113 | <form action="index.php" method="get"> |
| 107 | - <input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
| 114 | + <input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) |
|
| 115 | +{ |
|
| 116 | + echo $newPositionStatus; |
|
| 117 | +} |
|
| 118 | +?>" required> |
|
| 108 | 119 | <label>try: #jhj</label><br> |
| 109 | 120 | <input type="submit" value="Set Location" /> |
| 110 | 121 | </form> |
@@ -120,7 +131,9 @@ discard block |
||
| 120 | 131 | |
| 121 | 132 | <article> |
| 122 | 133 | <div> |
| 123 | - <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?> |
|
| 134 | + <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) |
|
| 135 | +{ |
|
| 136 | +?> |
|
| 124 | 137 | <h2>Comment on Jodel</h2> |
| 125 | 138 | <form method="POST"> |
| 126 | 139 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" /> |
@@ -128,7 +141,10 @@ discard block |
||
| 128 | 141 | <br /> |
| 129 | 142 | <input type="submit" value="SEND" /> |
| 130 | 143 | </form> |
| 131 | - <?php } else { ?> |
|
| 144 | + <?php } |
|
| 145 | +else |
|
| 146 | +{ |
|
| 147 | +?> |
|
| 132 | 148 | <h2>New Jodel</h2> |
| 133 | 149 | <form enctype="multipart/form-data" method="POST"> |
| 134 | 150 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | $this->refreshToken(); |
| 37 | 37 | } |
| 38 | - $this->accessToken = $this->getAccessToken(); |
|
| 38 | + $this->accessToken = $this->getAccessToken(); |
|
| 39 | 39 | |
| 40 | 40 | /* if($this->isAccountVerified() != 1) |
| 41 | 41 | { |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $db = new DatabaseConnect(); |
| 109 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 109 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 110 | 110 | |
| 111 | 111 | $location = new Location(); |
| 112 | 112 | |
| 113 | - if ($result->num_rows > 0) |
|
| 113 | + if($result->num_rows > 0) |
|
| 114 | 114 | { |
| 115 | 115 | // output data of each row |
| 116 | 116 | while($row = $result->fetch_assoc()) |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | else |
| 184 | 184 | { |
| 185 | - user_log('User with JodelDeviceId:' . $this->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 185 | + user_log('User with JodelDeviceId:' . $this->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
@@ -194,11 +194,11 @@ discard block |
||
| 194 | 194 | function getLocation() |
| 195 | 195 | { |
| 196 | 196 | $db = new DatabaseConnect(); |
| 197 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 197 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 198 | 198 | |
| 199 | 199 | $location = new Location(); |
| 200 | 200 | |
| 201 | - if ($result->num_rows > 0) |
|
| 201 | + if($result->num_rows > 0) |
|
| 202 | 202 | { |
| 203 | 203 | // output data of each row |
| 204 | 204 | while($row = $result->fetch_assoc()) |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | if(isset($_POST['color'])) |
| 322 | 322 | { |
| 323 | 323 | $color = $_POST['color']; |
| 324 | - switch ($color) { |
|
| 324 | + switch($color) { |
|
| 325 | 325 | case '8ABDB0': |
| 326 | 326 | $color = '8ABDB0'; |
| 327 | 327 | break; |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $db = new DatabaseConnect(); |
| 390 | 390 | $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
| 391 | 391 | |
| 392 | - if ($result->num_rows > 0) |
|
| 392 | + if($result->num_rows > 0) |
|
| 393 | 393 | { |
| 394 | 394 | // output data of each row |
| 395 | 395 | while($row = $result->fetch_assoc()) |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | expiration_date='" . $expiration_date . "' |
| 429 | 429 | WHERE device_uid='" . $device_uid . "'"); |
| 430 | 430 | |
| 431 | - if($result === false){ |
|
| 431 | + if($result === false) { |
|
| 432 | 432 | error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
| 433 | 433 | } |
| 434 | 434 | } |
@@ -438,11 +438,11 @@ discard block |
||
| 438 | 438 | function getAccessToken() |
| 439 | 439 | { |
| 440 | 440 | $db = new DatabaseConnect(); |
| 441 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 441 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 442 | 442 | |
| 443 | 443 | $accessToken; |
| 444 | 444 | |
| 445 | - if ($result->num_rows > 0) |
|
| 445 | + if($result->num_rows > 0) |
|
| 446 | 446 | { |
| 447 | 447 | // output data of each row |
| 448 | 448 | while($row = $result->fetch_assoc()) |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
| 509 | 509 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
| 510 | 510 | |
| 511 | - if($result === false){ |
|
| 511 | + if($result === false) { |
|
| 512 | 512 | $error = db_error(); |
| 513 | 513 | echo $error; |
| 514 | 514 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
@@ -536,11 +536,11 @@ discard block |
||
| 536 | 536 | $result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type, |
| 537 | 537 | expires_in, expiration_date, distinct_id, device_uid, name, lat, lng) |
| 538 | 538 | VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type . |
| 539 | - "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 539 | + "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 540 | 540 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 541 | 541 | |
| 542 | 542 | $success = TRUE; |
| 543 | - if($result === false){ |
|
| 543 | + if($result === false) { |
|
| 544 | 544 | $error = $db->error(); |
| 545 | 545 | echo $error; |
| 546 | 546 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $header = $this->getSignHeaders(); |
| 30 | 30 | $url = $this->getFullUrl(); |
| 31 | 31 | |
| 32 | - if ($this->getAccessToken()) { |
|
| 32 | + if($this->getAccessToken()) { |
|
| 33 | 33 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
| 34 | 34 | } |
| 35 | 35 | //Comment out to debug the Request: |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | 'proxy' => '186.103.169.165:8080', |
| 53 | 53 | );*/ |
| 54 | 54 | |
| 55 | - switch ($this->getMethod()) { |
|
| 55 | + switch($this->getMethod()) { |
|
| 56 | 56 | case 'POST': |
| 57 | 57 | $result = Requests::post($url, $header, $this->payLoad); |
| 58 | 58 | break; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $result = Requests::put($url, $header, $this->payLoad); |
| 71 | 71 | break; |
| 72 | 72 | } |
| 73 | - switch ($result->status_code) { |
|
| 73 | + switch($result->status_code) { |
|
| 74 | 74 | case 200: |
| 75 | 75 | $result = json_decode($result->body, true); |
| 76 | 76 | break; |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable"') |
| 109 | 109 | { |
| 110 | - header('location:'.$_SERVER['PHP_SELF']); |
|
| 110 | + header('location:' . $_SERVER['PHP_SELF']); |
|
| 111 | 111 | } |
| 112 | 112 | break; |
| 113 | 113 | default: |
| 114 | - error_log('Error '.$result->status_code.' - Unauthorized'); |
|
| 114 | + error_log('Error ' . $result->status_code . ' - Unauthorized'); |
|
| 115 | 115 | $result = json_decode($result->body, true); |
| 116 | 116 | } |
| 117 | 117 | |