@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | error_reporting(-1); |
| 3 | 3 | |
| 4 | -include 'php/jodel-web.php';/* |
|
| 4 | +include 'php/jodel-web.php'; /* |
|
| 5 | 5 | include 'php/DatabaseConnect.php'; |
| 6 | 6 | include 'php/Requests/AbstractRequest.php'; |
| 7 | 7 | include 'php/Requests/CreateUser.php'; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $accessToken; |
| 30 | 30 | $newPositionStatus; |
| 31 | 31 | |
| 32 | -if ($result->num_rows > 0) |
|
| 32 | +if($result->num_rows > 0) |
|
| 33 | 33 | { |
| 34 | 34 | // output data of each row |
| 35 | 35 | while($row = $result->fetch_assoc()) |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | if(isset($_GET['view'])) |
| 47 | 47 | { |
| 48 | - switch ($_GET['view']) { |
|
| 48 | + switch($_GET['view']) { |
|
| 49 | 49 | case 'comment': |
| 50 | 50 | $view = 'comment'; |
| 51 | 51 | break; |
@@ -64,13 +64,13 @@ discard block |
||
| 64 | 64 | $view = 'time'; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if($view=='comment') |
|
| 67 | + if($view == 'comment') |
|
| 68 | 68 | { |
| 69 | 69 | $url = "/v2/posts/location/discussed/"; |
| 70 | 70 | } |
| 71 | 71 | else |
| 72 | 72 | { |
| 73 | - if($view=='upVote') |
|
| 73 | + if($view == 'upVote') |
|
| 74 | 74 | { |
| 75 | 75 | $url = "/v2/posts/location/popular/"; |
| 76 | 76 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | ?> |
| 91 | 91 | <div class="nextPosts"> |
| 92 | 92 | <?php |
| 93 | - for($i = 0; $i<$loops; $i++) |
|
| 93 | + for($i = 0; $i < $loops; $i++) |
|
| 94 | 94 | { |
| 95 | 95 | if(isset($posts[$i])) |
| 96 | 96 | { |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $accessToken; |
| 15 | 15 | $newPositionStatus; |
| 16 | 16 | |
| 17 | - if ($result->num_rows > 0) |
|
| 17 | + if($result->num_rows > 0) |
|
| 18 | 18 | { |
| 19 | 19 | // output data of each row |
| 20 | 20 | while($row = $result->fetch_assoc()) |
@@ -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; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | if(isset($_POST['color'])) |
| 127 | 127 | { |
| 128 | 128 | $color = $_POST['color']; |
| 129 | - switch ($color) { |
|
| 129 | + switch($color) { |
|
| 130 | 130 | case '8ABDB0': |
| 131 | 131 | $color = '8ABDB0'; |
| 132 | 132 | break; |
@@ -256,13 +256,13 @@ discard block |
||
| 256 | 256 | //Get Posts |
| 257 | 257 | else |
| 258 | 258 | { |
| 259 | - if($view=='comment') |
|
| 259 | + if($view == 'comment') |
|
| 260 | 260 | { |
| 261 | 261 | $url = "/v2/posts/location/discussed/"; |
| 262 | 262 | } |
| 263 | 263 | else |
| 264 | 264 | { |
| 265 | - if($view=='upVote') |
|
| 265 | + if($view == 'upVote') |
|
| 266 | 266 | { |
| 267 | 267 | $url = "/v2/posts/location/popular/"; |
| 268 | 268 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | |
| 281 | - for($i = 0; $i<$loops; $i++) |
|
| 281 | + for($i = 0; $i < $loops; $i++) |
|
| 282 | 282 | { |
| 283 | 283 | |
| 284 | 284 | if(isset($posts[$i])) |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
| 324 | 324 | <h2>Comment on Jodel</h2> |
| 325 | 325 | <form method="POST"> |
| 326 | - <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
|
| 326 | + <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" /> |
|
| 327 | 327 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
| 328 | 328 | <br /> |
| 329 | 329 | <input type="submit" value="SEND" /> |
@@ -360,13 +360,13 @@ discard block |
||
| 360 | 360 | <div class="col-sm-12"> |
| 361 | 361 | <div class="row"> |
| 362 | 362 | <div class="col-sm-3"> |
| 363 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 363 | + <a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 364 | 364 | </div> |
| 365 | 365 | <div class="col-sm-3"> |
| 366 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 366 | + <a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 367 | 367 | </div> |
| 368 | 368 | <div class="col-sm-3"> |
| 369 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 369 | + <a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 370 | 370 | </div> |
| 371 | 371 | <div class="col-sm-3"> |
| 372 | 372 | <nav> |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $db = new DatabaseConnect(); |
| 23 | 23 | $result = $db->query("SELECT * FROM accounts WHERE id='1'"); |
| 24 | 24 | |
| 25 | - if ($result->num_rows > 0) |
|
| 25 | + if($result->num_rows > 0) |
|
| 26 | 26 | { |
| 27 | 27 | // output data of each row |
| 28 | 28 | while($row = $result->fetch_assoc()) { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | if($expiration_date <= time()) { |
| 41 | 41 | $accountCreator = new CreateUser(); |
| 42 | - $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
|
| 42 | + $accountCreator->setAccessToken($access_token); //$accountData->getAccessToken()); |
|
| 43 | 43 | $accountCreator->setDeviceUid($deviceUid); |
| 44 | 44 | $accountCreator->setLocation($location); |
| 45 | 45 | $data = $accountCreator->execute(); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | expiration_date='" . $expiration_date . "' |
| 55 | 55 | WHERE device_uid='" . $device_uid . "'"); |
| 56 | 56 | |
| 57 | - if($result === false){ |
|
| 57 | + if($result === false) { |
|
| 58 | 58 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | $result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type, |
| 93 | 93 | expires_in, expiration_date, distinct_id, device_uid, name, lat, lng) |
| 94 | 94 | VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type . |
| 95 | - "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 95 | + "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 96 | 96 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 97 | 97 | |
| 98 | 98 | $success = TRUE; |
| 99 | - if($result === false){ |
|
| 99 | + if($result === false) { |
|
| 100 | 100 | $error = db_error(); |
| 101 | 101 | echo $error; |
| 102 | 102 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -144,25 +144,25 @@ discard block |
||
| 144 | 144 | $timediff_inDays = (string)$timediff->format('%d'); |
| 145 | 145 | $timediff_inMonth = (string)$timediff->format('%m'); |
| 146 | 146 | |
| 147 | - if($timediff_inMonth!=0) |
|
| 147 | + if($timediff_inMonth != 0) |
|
| 148 | 148 | { |
| 149 | 149 | $timediff = $timediff_inMonth . "m"; |
| 150 | 150 | } |
| 151 | 151 | else |
| 152 | 152 | { |
| 153 | - if($timediff_inDays!=0) |
|
| 153 | + if($timediff_inDays != 0) |
|
| 154 | 154 | { |
| 155 | 155 | $timediff = $timediff_inDays . "d"; |
| 156 | 156 | } |
| 157 | 157 | else |
| 158 | 158 | { |
| 159 | - if($timediff_inHours!=0) |
|
| 159 | + if($timediff_inHours != 0) |
|
| 160 | 160 | { |
| 161 | 161 | $timediff = $timediff_inHours . "h"; |
| 162 | 162 | } |
| 163 | 163 | else |
| 164 | 164 | { |
| 165 | - if($timediff_inMinutes!=0) |
|
| 165 | + if($timediff_inMinutes != 0) |
|
| 166 | 166 | { |
| 167 | 167 | $timediff = $timediff_inMinutes . "m"; |
| 168 | 168 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | |
| 178 | 178 | ?> |
| 179 | - <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;"> |
|
| 179 | + <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"]; ?>;"> |
|
| 180 | 180 | <content> |
| 181 | 181 | <?php |
| 182 | 182 | if(isset($post["image_url"])) { |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | ?> |
| 189 | 189 | </content> |
| 190 | 190 | <aside> |
| 191 | - <a href="index.php?vote=up&postID=<?php echo $post["post_id"];?>"> |
|
| 191 | + <a href="index.php?vote=up&postID=<?php echo $post["post_id"]; ?>"> |
|
| 192 | 192 | <i class="fa fa-angle-up fa-3x"></i> |
| 193 | 193 | </a> |
| 194 | 194 | <br /> |
| 195 | - <?php echo $post["vote_count"];?><br /> |
|
| 196 | - <a href="index.php?vote=down&postID=<?php echo $post["post_id"];?>"> |
|
| 195 | + <?php echo $post["vote_count"]; ?><br /> |
|
| 196 | + <a href="index.php?vote=down&postID=<?php echo $post["post_id"]; ?>"> |
|
| 197 | 197 | <i class="fa fa-angle-down fa-3x"></i> |
| 198 | 198 | </a> |
| 199 | 199 | </aside> |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | <td class="time"> |
| 205 | 205 | <span data-tooltip="Time"> |
| 206 | 206 | <i class="fa fa-clock-o"></i> |
| 207 | - <?php echo $timediff;?> |
|
| 207 | + <?php echo $timediff; ?> |
|
| 208 | 208 | </span> |
| 209 | 209 | </td> |
| 210 | 210 | <td class="comments"> |
| 211 | 211 | <?php if(!$isDetailedView) {?> |
| 212 | 212 | <span data-tooltip="Comments"> |
| 213 | - <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>"> |
|
| 213 | + <a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $post["post_id"]; ?>"> |
|
| 214 | 214 | <i class="fa fa-commenting-o"></i> |
| 215 | 215 | <?php if(array_key_exists("child_count", $post)) { |
| 216 | 216 | echo $post["child_count"]; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | { |
| 240 | 240 | ?> |
| 241 | 241 | <span data-tooltip="Author"> |
| 242 | - <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> | |
|
| 242 | + <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"]; ?> | |
|
| 243 | 243 | </span> |
| 244 | 244 | <?php |
| 245 | 245 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | <span data-tooltip="Distance"> |
| 251 | 251 | <i class="fa fa-map-marker"></i> |
| 252 | - <?php echo $post["distance"];?> km |
|
| 252 | + <?php echo $post["distance"]; ?> km |
|
| 253 | 253 | </span> |
| 254 | 254 | </td> |
| 255 | 255 | </tr> |