@@ -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()) |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | <a href="index.php"> |
| 115 | 115 | <h1> |
| 116 | 116 | JodelBlue |
| 117 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?> |
|
| 117 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>'; ?> |
|
| 118 | 118 | </h1> |
| 119 | 119 | </a> |
| 120 | 120 | <div class="clear"></div> |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | //Set View |
| 131 | 131 | if(isset($_GET['view'])) |
| 132 | 132 | { |
| 133 | - switch ($_GET['view']) { |
|
| 133 | + switch($_GET['view']) { |
|
| 134 | 134 | case 'comment': |
| 135 | 135 | $view = 'comment'; |
| 136 | 136 | break; |
@@ -153,11 +153,11 @@ discard block |
||
| 153 | 153 | if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { |
| 154 | 154 | //Header Nav in Comment View |
| 155 | 155 | ?> |
| 156 | - <a id="comment-back" href="index.php?view=<?php echo $view;?>#postId-<?php echo htmlspecialchars($_GET['postID']);?>"> |
|
| 156 | + <a id="comment-back" href="index.php?view=<?php echo $view; ?>#postId-<?php echo htmlspecialchars($_GET['postID']); ?>"> |
|
| 157 | 157 | <i class="fa fa-angle-left fa-3x"></i> |
| 158 | 158 | </a> |
| 159 | 159 | |
| 160 | - <a id="comment-refresh" href="index.php?getPostDetails=<?php echo htmlspecialchars($_GET['getPostDetails']);?>&postID=<?php echo htmlspecialchars($_GET['postID']);?>"> |
|
| 160 | + <a id="comment-refresh" href="index.php?getPostDetails=<?php echo htmlspecialchars($_GET['getPostDetails']); ?>&postID=<?php echo htmlspecialchars($_GET['postID']); ?>"> |
|
| 161 | 161 | <i class="fa fa-refresh fa-2x"></i> |
| 162 | 162 | </a> |
| 163 | 163 | <?php |
@@ -180,13 +180,13 @@ discard block |
||
| 180 | 180 | //Get Posts |
| 181 | 181 | else |
| 182 | 182 | { |
| 183 | - if($view=='comment') |
|
| 183 | + if($view == 'comment') |
|
| 184 | 184 | { |
| 185 | 185 | $url = "/v2/posts/location/discussed/"; |
| 186 | 186 | } |
| 187 | 187 | else |
| 188 | 188 | { |
| 189 | - if($view=='upVote') |
|
| 189 | + if($view == 'upVote') |
|
| 190 | 190 | { |
| 191 | 191 | $url = "/v2/posts/location/popular/"; |
| 192 | 192 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
| 205 | - for($i = 0; $i<$loops; $i++) { |
|
| 205 | + for($i = 0; $i < $loops; $i++) { |
|
| 206 | 206 | |
| 207 | 207 | if(isset($posts[$i])) { |
| 208 | 208 | $lastPostId = $posts[$i]['post_id']; |
@@ -220,24 +220,24 @@ discard block |
||
| 220 | 220 | $timediff_inHours = (string)$timediff->format('%h'); |
| 221 | 221 | $timediff_inDays = (string)$timediff->format('%d'); |
| 222 | 222 | $timediff_inMonth = (string)$timediff->format('%m'); |
| 223 | - if($timediff_inMonth!=0) { |
|
| 223 | + if($timediff_inMonth != 0) { |
|
| 224 | 224 | $timediff = $timediff_inMonth . "m"; |
| 225 | 225 | } |
| 226 | 226 | else |
| 227 | 227 | { |
| 228 | - if($timediff_inDays!=0) |
|
| 228 | + if($timediff_inDays != 0) |
|
| 229 | 229 | { |
| 230 | 230 | $timediff = $timediff_inDays . "d"; |
| 231 | 231 | } |
| 232 | 232 | else |
| 233 | 233 | { |
| 234 | - if($timediff_inHours!=0) |
|
| 234 | + if($timediff_inHours != 0) |
|
| 235 | 235 | { |
| 236 | 236 | $timediff = $timediff_inHours . "h"; |
| 237 | 237 | } |
| 238 | 238 | else |
| 239 | 239 | { |
| 240 | - if($timediff_inMinutes!=0) |
|
| 240 | + if($timediff_inMinutes != 0) |
|
| 241 | 241 | { |
| 242 | 242 | $timediff = $timediff_inMinutes . "m"; |
| 243 | 243 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | } |
| 251 | 251 | ?> |
| 252 | 252 | |
| 253 | - <article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;"> |
|
| 253 | + <article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"]; ?>;"> |
|
| 254 | 254 | <content> |
| 255 | 255 | <?php |
| 256 | 256 | if(isset($posts[$i]["image_url"])) { |
@@ -262,12 +262,12 @@ discard block |
||
| 262 | 262 | ?> |
| 263 | 263 | </content> |
| 264 | 264 | <aside> |
| 265 | - <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 265 | + <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
| 266 | 266 | <i class="fa fa-angle-up fa-3x"></i> |
| 267 | 267 | </a> |
| 268 | 268 | <br /> |
| 269 | - <?php echo $posts[$i]["vote_count"];?><br /> |
|
| 270 | - <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 269 | + <?php echo $posts[$i]["vote_count"]; ?><br /> |
|
| 270 | + <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
| 271 | 271 | <i class="fa fa-angle-down fa-3x"></i> |
| 272 | 272 | </a> |
| 273 | 273 | </aside> |
@@ -278,13 +278,13 @@ discard block |
||
| 278 | 278 | <td class="time"> |
| 279 | 279 | <span data-tooltip="Time"> |
| 280 | 280 | <i class="fa fa-clock-o"></i> |
| 281 | - <?php echo $timediff;?> |
|
| 281 | + <?php echo $timediff; ?> |
|
| 282 | 282 | </span> |
| 283 | 283 | </td> |
| 284 | 284 | <td class="comments"> |
| 285 | 285 | <?php if($showCommentIcon) {?> |
| 286 | 286 | <span data-tooltip="Comments"> |
| 287 | - <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 287 | + <a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
| 288 | 288 | <i class="fa fa-commenting-o"></i> |
| 289 | 289 | <?php if(array_key_exists("child_count", $posts[$i])) { |
| 290 | 290 | echo $posts[$i]["child_count"]; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | <td class="distance"> |
| 298 | 298 | <span data-tooltip="Distance"> |
| 299 | 299 | <i class="fa fa-map-marker"></i> |
| 300 | - <?php echo $posts[$i]["distance"];?> km |
|
| 300 | + <?php echo $posts[$i]["distance"]; ?> km |
|
| 301 | 301 | </span> |
| 302 | 302 | </td> |
| 303 | 303 | </tr> |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
| 340 | 340 | <h2>Comment on Jodel</h2> |
| 341 | 341 | <form method="POST"> |
| 342 | - <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
|
| 342 | + <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" /> |
|
| 343 | 343 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
| 344 | 344 | <br /> |
| 345 | 345 | <input type="submit" value="SEND" /> |
@@ -364,13 +364,13 @@ discard block |
||
| 364 | 364 | <div class="col-sm-12"> |
| 365 | 365 | <div class="row"> |
| 366 | 366 | <div class="col-sm-3"> |
| 367 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 367 | + <a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 368 | 368 | </div> |
| 369 | 369 | <div class="col-sm-3"> |
| 370 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 370 | + <a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 371 | 371 | </div> |
| 372 | 372 | <div class="col-sm-3"> |
| 373 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 373 | + <a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 374 | 374 | </div> |
| 375 | 375 | <div class="col-sm-3"> |
| 376 | 376 | <nav> |
@@ -31,7 +31,8 @@ discard block |
||
| 31 | 31 | //createAccount(); |
| 32 | 32 | |
| 33 | 33 | //Set Location |
| 34 | - if(isset($_GET['city'])) { |
|
| 34 | + if(isset($_GET['city'])) |
|
| 35 | + { |
|
| 35 | 36 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
| 36 | 37 | $result = Requests::post($url); |
| 37 | 38 | if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
@@ -52,11 +53,14 @@ discard block |
||
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | //Vote |
| 55 | - if(isset($_GET['vote']) && isset($_GET['postID'])) { |
|
| 56 | - if($_GET['vote'] == "up") { |
|
| 56 | + if(isset($_GET['vote']) && isset($_GET['postID'])) |
|
| 57 | + { |
|
| 58 | + if($_GET['vote'] == "up") |
|
| 59 | + { |
|
| 57 | 60 | $accountCreator = new Upvote(); |
| 58 | 61 | } |
| 59 | - else if($_GET['vote'] == "down") { |
|
| 62 | + else if($_GET['vote'] == "down") |
|
| 63 | + { |
|
| 60 | 64 | $accountCreator = new Downvote(); |
| 61 | 65 | } |
| 62 | 66 | $accountCreator->setAccessToken($accessToken); |
@@ -68,7 +72,8 @@ discard block |
||
| 68 | 72 | |
| 69 | 73 | |
| 70 | 74 | //SendJodel |
| 71 | - if(isset($_POST['message'])) { |
|
| 75 | + if(isset($_POST['message'])) |
|
| 76 | + { |
|
| 72 | 77 | $ancestor; |
| 73 | 78 | if(isset($_POST['ancestor'])) |
| 74 | 79 | { |
@@ -114,7 +119,11 @@ discard block |
||
| 114 | 119 | <a href="index.php"> |
| 115 | 120 | <h1> |
| 116 | 121 | JodelBlue |
| 117 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?> |
|
| 122 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
| 123 | +{ |
|
| 124 | + echo '<i class="fa fa-refresh fa-1x"></i>'; |
|
| 125 | +} |
|
| 126 | +?> |
|
| 118 | 127 | </h1> |
| 119 | 128 | </a> |
| 120 | 129 | <div class="clear"></div> |
@@ -130,7 +139,8 @@ discard block |
||
| 130 | 139 | //Set View |
| 131 | 140 | if(isset($_GET['view'])) |
| 132 | 141 | { |
| 133 | - switch ($_GET['view']) { |
|
| 142 | + switch ($_GET['view']) |
|
| 143 | + { |
|
| 134 | 144 | case 'comment': |
| 135 | 145 | $view = 'comment'; |
| 136 | 146 | break; |
@@ -150,7 +160,8 @@ discard block |
||
| 150 | 160 | } |
| 151 | 161 | |
| 152 | 162 | //Get Post Details |
| 153 | - if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { |
|
| 163 | + if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) |
|
| 164 | + { |
|
| 154 | 165 | //Header Nav in Comment View |
| 155 | 166 | ?> |
| 156 | 167 | <a id="comment-back" href="index.php?view=<?php echo $view;?>#postId-<?php echo htmlspecialchars($_GET['postID']);?>"> |
@@ -168,13 +179,17 @@ discard block |
||
| 168 | 179 | $data = $accountCreator->execute(); |
| 169 | 180 | |
| 170 | 181 | $posts[0] = $data; |
| 171 | - if(isset($data['children'])) { |
|
| 172 | - foreach($data['children'] as $child) { |
|
| 182 | + if(isset($data['children'])) |
|
| 183 | + { |
|
| 184 | + foreach($data['children'] as $child) |
|
| 185 | + { |
|
| 173 | 186 | array_push($posts, $child); |
| 174 | 187 | } |
| 175 | 188 | $loops = $data['child_count'] + 1; |
| 176 | 189 | } |
| 177 | - else $loops = 1; |
|
| 190 | + else { |
|
| 191 | + $loops = 1; |
|
| 192 | + } |
|
| 178 | 193 | $showCommentIcon = FALSE; |
| 179 | 194 | } |
| 180 | 195 | //Get Posts |
@@ -202,9 +217,11 @@ discard block |
||
| 202 | 217 | } |
| 203 | 218 | |
| 204 | 219 | |
| 205 | - for($i = 0; $i<$loops; $i++) { |
|
| 220 | + for($i = 0; $i<$loops; $i++) |
|
| 221 | + { |
|
| 206 | 222 | |
| 207 | - if(isset($posts[$i])) { |
|
| 223 | + if(isset($posts[$i])) |
|
| 224 | + { |
|
| 208 | 225 | $lastPostId = $posts[$i]['post_id']; |
| 209 | 226 | |
| 210 | 227 | |
@@ -220,7 +237,8 @@ discard block |
||
| 220 | 237 | $timediff_inHours = (string)$timediff->format('%h'); |
| 221 | 238 | $timediff_inDays = (string)$timediff->format('%d'); |
| 222 | 239 | $timediff_inMonth = (string)$timediff->format('%m'); |
| 223 | - if($timediff_inMonth!=0) { |
|
| 240 | + if($timediff_inMonth!=0) |
|
| 241 | + { |
|
| 224 | 242 | $timediff = $timediff_inMonth . "m"; |
| 225 | 243 | } |
| 226 | 244 | else |
@@ -253,10 +271,12 @@ discard block |
||
| 253 | 271 | <article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;"> |
| 254 | 272 | <content> |
| 255 | 273 | <?php |
| 256 | - if(isset($posts[$i]["image_url"])) { |
|
| 274 | + if(isset($posts[$i]["image_url"])) |
|
| 275 | + { |
|
| 257 | 276 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
| 258 | 277 | } |
| 259 | - else { |
|
| 278 | + else |
|
| 279 | + { |
|
| 260 | 280 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($posts[$i]["message"]))); |
| 261 | 281 | } |
| 262 | 282 | ?> |
@@ -282,13 +302,19 @@ discard block |
||
| 282 | 302 | </span> |
| 283 | 303 | </td> |
| 284 | 304 | <td class="comments"> |
| 285 | - <?php if($showCommentIcon) {?> |
|
| 305 | + <?php if($showCommentIcon) |
|
| 306 | +{ |
|
| 307 | +?> |
|
| 286 | 308 | <span data-tooltip="Comments"> |
| 287 | 309 | <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $posts[$i]["post_id"];?>"> |
| 288 | 310 | <i class="fa fa-commenting-o"></i> |
| 289 | - <?php if(array_key_exists("child_count", $posts[$i])) { |
|
| 311 | + <?php if(array_key_exists("child_count", $posts[$i])) |
|
| 312 | +{ |
|
| 290 | 313 | echo $posts[$i]["child_count"]; |
| 291 | - } else echo "0"; |
|
| 314 | + } |
|
| 315 | + else { |
|
| 316 | + echo "0"; |
|
| 317 | + } |
|
| 292 | 318 | ?> |
| 293 | 319 | </a> |
| 294 | 320 | </span> |
@@ -312,7 +338,9 @@ discard block |
||
| 312 | 338 | |
| 313 | 339 | </content> |
| 314 | 340 | |
| 315 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 341 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
| 342 | +{ |
|
| 343 | +?> |
|
| 316 | 344 | <p id="loading"> |
| 317 | 345 | Loading… |
| 318 | 346 | </p> |
@@ -323,7 +351,14 @@ discard block |
||
| 323 | 351 | <article> |
| 324 | 352 | <h2>Position</h2> |
| 325 | 353 | <form method="get"> |
| 326 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; else echo htmlspecialchars($posts[0]["location"]["name"]); ?>" required> |
|
| 354 | + <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) |
|
| 355 | +{ |
|
| 356 | + echo $newPositionStatus; |
|
| 357 | +} |
|
| 358 | +else { |
|
| 359 | + echo htmlspecialchars($posts[0]["location"]["name"]); |
|
| 360 | +} |
|
| 361 | +?>" required> |
|
| 327 | 362 | |
| 328 | 363 | <input type="submit" value="Set Location" /> |
| 329 | 364 | </form> |
@@ -336,7 +371,9 @@ discard block |
||
| 336 | 371 | </article> |
| 337 | 372 | |
| 338 | 373 | <article> |
| 339 | - <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
|
| 374 | + <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) |
|
| 375 | +{ |
|
| 376 | +?> |
|
| 340 | 377 | <h2>Comment on Jodel</h2> |
| 341 | 378 | <form method="POST"> |
| 342 | 379 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
@@ -344,7 +381,10 @@ discard block |
||
| 344 | 381 | <br /> |
| 345 | 382 | <input type="submit" value="SEND" /> |
| 346 | 383 | </form> |
| 347 | - <?php } else { ?> |
|
| 384 | + <?php } |
|
| 385 | +else |
|
| 386 | +{ |
|
| 387 | +?> |
|
| 348 | 388 | <h2>New Jodel</h2> |
| 349 | 389 | <form method="POST"> |
| 350 | 390 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -364,13 +404,25 @@ discard block |
||
| 364 | 404 | <div class="col-sm-12"> |
| 365 | 405 | <div class="row"> |
| 366 | 406 | <div class="col-sm-3"> |
| 367 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 407 | + <a href="index.php" <?php if($view=='time') |
|
| 408 | +{ |
|
| 409 | + echo 'class="active"'; |
|
| 410 | +} |
|
| 411 | +?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 368 | 412 | </div> |
| 369 | 413 | <div class="col-sm-3"> |
| 370 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 414 | + <a href="index.php?view=comment" <?php if($view=='comment') |
|
| 415 | +{ |
|
| 416 | + echo 'class="active"'; |
|
| 417 | +} |
|
| 418 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 371 | 419 | </div> |
| 372 | 420 | <div class="col-sm-3"> |
| 373 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 421 | + <a href="index.php?view=upVote" <?php if($view=='upVote') |
|
| 422 | +{ |
|
| 423 | + echo 'class="active"'; |
|
| 424 | +} |
|
| 425 | +?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 374 | 426 | </div> |
| 375 | 427 | <div class="col-sm-3"> |
| 376 | 428 | <nav> |
@@ -394,7 +446,9 @@ discard block |
||
| 394 | 446 | $(this).addClass('selected'); |
| 395 | 447 | }); |
| 396 | 448 | |
| 397 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 449 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
| 450 | +{ |
|
| 451 | +?> |
|
| 398 | 452 | $(document).ready(function() { |
| 399 | 453 | var win = $(window); |
| 400 | 454 | var lastPostId = "<?php echo $lastPostId; ?>"; |
@@ -19,14 +19,14 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | function getPosts($lastPostId, $url) { |
| 21 | 21 | $db = new DatabaseConnect(); |
| 22 | - if ($db->connect_errno) { |
|
| 22 | + if($db->connect_errno) { |
|
| 23 | 23 | echo 'Sorry, die Verbindung zu unserem superfetten endgeilen |
| 24 | 24 | Server ist hops gegangen. Wegen '. $db -> connect_error; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $result = $db->query("SELECT * FROM accounts WHERE id='1'"); |
| 28 | 28 | |
| 29 | - if ($result->num_rows > 0) { |
|
| 29 | + if($result->num_rows > 0) { |
|
| 30 | 30 | // output data of each row |
| 31 | 31 | while($row = $result->fetch_assoc()) { |
| 32 | 32 | $access_token = $row["access_token"]; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | if(isset($_GET['view'])) |
| 51 | 51 | { |
| 52 | - switch ($_GET['view']) { |
|
| 52 | + switch($_GET['view']) { |
|
| 53 | 53 | case 'comment': |
| 54 | 54 | $view = 'comment'; |
| 55 | 55 | break; |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | $view = 'time'; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if($view=='comment') |
|
| 71 | + if($view == 'comment') |
|
| 72 | 72 | { |
| 73 | 73 | $url = "/v2/posts/location/discussed/"; |
| 74 | 74 | } |
| 75 | 75 | else |
| 76 | 76 | { |
| 77 | - if($view=='upVote') |
|
| 77 | + if($view == 'upVote') |
|
| 78 | 78 | { |
| 79 | 79 | $url = "/v2/posts/location/popular/"; |
| 80 | 80 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | ?> |
| 95 | 95 | <div class="nextPosts"> |
| 96 | 96 | <?php |
| 97 | - for($i = 0; $i<$loops; $i++) { |
|
| 97 | + for($i = 0; $i < $loops; $i++) { |
|
| 98 | 98 | |
| 99 | 99 | if(isset($posts[$i])) { |
| 100 | 100 | $lastPostId = $posts[$i]['post_id']; |
@@ -112,24 +112,24 @@ discard block |
||
| 112 | 112 | $timediff_inHours = (string)$timediff->format('%h'); |
| 113 | 113 | $timediff_inDays = (string)$timediff->format('%d'); |
| 114 | 114 | $timediff_inMonth = (string)$timediff->format('%m'); |
| 115 | - if($timediff_inMonth!=0) { |
|
| 115 | + if($timediff_inMonth != 0) { |
|
| 116 | 116 | $timediff = $timediff_inMonth . "m"; |
| 117 | 117 | } |
| 118 | 118 | else |
| 119 | 119 | { |
| 120 | - if($timediff_inDays!=0) |
|
| 120 | + if($timediff_inDays != 0) |
|
| 121 | 121 | { |
| 122 | 122 | $timediff = $timediff_inDays . "d"; |
| 123 | 123 | } |
| 124 | 124 | else |
| 125 | 125 | { |
| 126 | - if($timediff_inHours!=0) |
|
| 126 | + if($timediff_inHours != 0) |
|
| 127 | 127 | { |
| 128 | 128 | $timediff = $timediff_inHours . "h"; |
| 129 | 129 | } |
| 130 | 130 | else |
| 131 | 131 | { |
| 132 | - if($timediff_inMinutes!=0) |
|
| 132 | + if($timediff_inMinutes != 0) |
|
| 133 | 133 | { |
| 134 | 134 | $timediff = $timediff_inMinutes . "m"; |
| 135 | 135 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | ?> |
| 144 | 144 | |
| 145 | - <article class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;"> |
|
| 145 | + <article class="jodel" style="background-color: #<?php echo $posts[$i]["color"]; ?>;"> |
|
| 146 | 146 | <content> |
| 147 | 147 | <?php |
| 148 | 148 | if(isset($posts[$i]["image_url"])) { |
@@ -154,12 +154,12 @@ discard block |
||
| 154 | 154 | ?> |
| 155 | 155 | </content> |
| 156 | 156 | <aside> |
| 157 | - <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 157 | + <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
| 158 | 158 | <i class="fa fa-angle-up fa-3x"></i> |
| 159 | 159 | </a> |
| 160 | 160 | <br /> |
| 161 | - <?php echo $posts[$i]["vote_count"];?><br /> |
|
| 162 | - <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 161 | + <?php echo $posts[$i]["vote_count"]; ?><br /> |
|
| 162 | + <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
| 163 | 163 | <i class="fa fa-angle-down fa-3x"></i> |
| 164 | 164 | </a> |
| 165 | 165 | </aside> |
@@ -170,13 +170,13 @@ discard block |
||
| 170 | 170 | <td class="time"> |
| 171 | 171 | <span data-tooltip="Time"> |
| 172 | 172 | <i class="fa fa-clock-o"></i> |
| 173 | - <?php echo $timediff;?> |
|
| 173 | + <?php echo $timediff; ?> |
|
| 174 | 174 | </span> |
| 175 | 175 | </td> |
| 176 | 176 | <td class="comments"> |
| 177 | 177 | <?php if($showCommentIcon) {?> |
| 178 | 178 | <span data-tooltip="Comments"> |
| 179 | - <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 179 | + <a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
| 180 | 180 | <i class="fa fa-commenting-o"></i> |
| 181 | 181 | <?php if(array_key_exists("child_count", $posts[$i])) { |
| 182 | 182 | echo $posts[$i]["child_count"]; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | <td class="distance"> |
| 190 | 190 | <span data-tooltip="Distance"> |
| 191 | 191 | <i class="fa fa-map-marker"></i> |
| 192 | - <?php echo $posts[$i]["distance"];?> km |
|
| 192 | + <?php echo $posts[$i]["distance"]; ?> km |
|
| 193 | 193 | </span> |
| 194 | 194 | </td> |
| 195 | 195 | </tr> |
@@ -17,18 +17,22 @@ discard block |
||
| 17 | 17 | require_once 'php/Requests/libary/Requests.php'; |
| 18 | 18 | Requests::register_autoloader(); |
| 19 | 19 | |
| 20 | -function getPosts($lastPostId, $url) { |
|
| 20 | +function getPosts($lastPostId, $url) |
|
| 21 | +{ |
|
| 21 | 22 | $db = new DatabaseConnect(); |
| 22 | - if ($db->connect_errno) { |
|
| 23 | + if ($db->connect_errno) |
|
| 24 | + { |
|
| 23 | 25 | echo 'Sorry, die Verbindung zu unserem superfetten endgeilen |
| 24 | 26 | Server ist hops gegangen. Wegen '. $db -> connect_error; |
| 25 | 27 | } |
| 26 | 28 | |
| 27 | 29 | $result = $db->query("SELECT * FROM accounts WHERE id='1'"); |
| 28 | 30 | |
| 29 | - if ($result->num_rows > 0) { |
|
| 31 | + if ($result->num_rows > 0) |
|
| 32 | + { |
|
| 30 | 33 | // output data of each row |
| 31 | - while($row = $result->fetch_assoc()) { |
|
| 34 | + while($row = $result->fetch_assoc()) |
|
| 35 | + { |
|
| 32 | 36 | $access_token = $row["access_token"]; |
| 33 | 37 | } |
| 34 | 38 | } |
@@ -49,7 +53,8 @@ discard block |
||
| 49 | 53 | |
| 50 | 54 | if(isset($_GET['view'])) |
| 51 | 55 | { |
| 52 | - switch ($_GET['view']) { |
|
| 56 | + switch ($_GET['view']) |
|
| 57 | + { |
|
| 53 | 58 | case 'comment': |
| 54 | 59 | $view = 'comment'; |
| 55 | 60 | break; |
@@ -84,7 +89,8 @@ discard block |
||
| 84 | 89 | } |
| 85 | 90 | } |
| 86 | 91 | |
| 87 | - if(isset($_GET['lastPostId'])) { |
|
| 92 | + if(isset($_GET['lastPostId'])) |
|
| 93 | + { |
|
| 88 | 94 | |
| 89 | 95 | $lastPostId = htmlspecialchars($_GET['lastPostId']); |
| 90 | 96 | |
@@ -94,9 +100,11 @@ discard block |
||
| 94 | 100 | ?> |
| 95 | 101 | <div class="nextPosts"> |
| 96 | 102 | <?php |
| 97 | - for($i = 0; $i<$loops; $i++) { |
|
| 103 | + for($i = 0; $i<$loops; $i++) |
|
| 104 | + { |
|
| 98 | 105 | |
| 99 | - if(isset($posts[$i])) { |
|
| 106 | + if(isset($posts[$i])) |
|
| 107 | + { |
|
| 100 | 108 | $lastPostId = $posts[$i]['post_id']; |
| 101 | 109 | |
| 102 | 110 | |
@@ -112,7 +120,8 @@ discard block |
||
| 112 | 120 | $timediff_inHours = (string)$timediff->format('%h'); |
| 113 | 121 | $timediff_inDays = (string)$timediff->format('%d'); |
| 114 | 122 | $timediff_inMonth = (string)$timediff->format('%m'); |
| 115 | - if($timediff_inMonth!=0) { |
|
| 123 | + if($timediff_inMonth!=0) |
|
| 124 | + { |
|
| 116 | 125 | $timediff = $timediff_inMonth . "m"; |
| 117 | 126 | } |
| 118 | 127 | else |
@@ -145,10 +154,12 @@ discard block |
||
| 145 | 154 | <article class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;"> |
| 146 | 155 | <content> |
| 147 | 156 | <?php |
| 148 | - if(isset($posts[$i]["image_url"])) { |
|
| 157 | + if(isset($posts[$i]["image_url"])) |
|
| 158 | + { |
|
| 149 | 159 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
| 150 | 160 | } |
| 151 | - else { |
|
| 161 | + else |
|
| 162 | + { |
|
| 152 | 163 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($posts[$i]["message"]))); |
| 153 | 164 | } |
| 154 | 165 | ?> |
@@ -174,13 +185,19 @@ discard block |
||
| 174 | 185 | </span> |
| 175 | 186 | </td> |
| 176 | 187 | <td class="comments"> |
| 177 | - <?php if($showCommentIcon) {?> |
|
| 188 | + <?php if($showCommentIcon) |
|
| 189 | +{ |
|
| 190 | +?> |
|
| 178 | 191 | <span data-tooltip="Comments"> |
| 179 | 192 | <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $posts[$i]["post_id"];?>"> |
| 180 | 193 | <i class="fa fa-commenting-o"></i> |
| 181 | - <?php if(array_key_exists("child_count", $posts[$i])) { |
|
| 194 | + <?php if(array_key_exists("child_count", $posts[$i])) |
|
| 195 | +{ |
|
| 182 | 196 | echo $posts[$i]["child_count"]; |
| 183 | - } else echo "0"; |
|
| 197 | + } |
|
| 198 | + else { |
|
| 199 | + echo "0"; |
|
| 200 | + } |
|
| 184 | 201 | ?> |
| 185 | 202 | </a> |
| 186 | 203 | </span> |