@@ -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 | |
| 36 | 37 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . $_GET['city'] . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
| 37 | 38 | $result = Requests::post($url); |
@@ -53,11 +54,14 @@ discard block |
||
| 53 | 54 | } |
| 54 | 55 | |
| 55 | 56 | //Vote |
| 56 | - if(isset($_GET['vote']) && isset($_GET['postID'])) { |
|
| 57 | - if($_GET['vote'] == "up") { |
|
| 57 | + if(isset($_GET['vote']) && isset($_GET['postID'])) |
|
| 58 | + { |
|
| 59 | + if($_GET['vote'] == "up") |
|
| 60 | + { |
|
| 58 | 61 | $accountCreator = new Upvote(); |
| 59 | 62 | } |
| 60 | - else if($_GET['vote'] == "down") { |
|
| 63 | + else if($_GET['vote'] == "down") |
|
| 64 | + { |
|
| 61 | 65 | $accountCreator = new Downvote(); |
| 62 | 66 | } |
| 63 | 67 | $accountCreator->setAccessToken($accessToken); |
@@ -69,7 +73,8 @@ discard block |
||
| 69 | 73 | |
| 70 | 74 | |
| 71 | 75 | //SendJodel |
| 72 | - if(isset($_POST['message'])) { |
|
| 76 | + if(isset($_POST['message'])) |
|
| 77 | + { |
|
| 73 | 78 | $ancestor; |
| 74 | 79 | if(isset($_POST['ancestor'])) |
| 75 | 80 | { |
@@ -115,7 +120,11 @@ discard block |
||
| 115 | 120 | <a href="index.php"> |
| 116 | 121 | <h1> |
| 117 | 122 | JodelBlue |
| 118 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?> |
|
| 123 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
| 124 | +{ |
|
| 125 | + echo '<i class="fa fa-refresh fa-1x"></i>'; |
|
| 126 | +} |
|
| 127 | +?> |
|
| 119 | 128 | </h1> |
| 120 | 129 | </a> |
| 121 | 130 | <div class="clear"></div> |
@@ -129,7 +138,8 @@ discard block |
||
| 129 | 138 | $posts; |
| 130 | 139 | |
| 131 | 140 | //Get Post Details |
| 132 | - if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { |
|
| 141 | + if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) |
|
| 142 | + { |
|
| 133 | 143 | //Header Nav in Comment View |
| 134 | 144 | ?> |
| 135 | 145 | <a id="comment-back" href="index.php#postId-<?php echo $_GET['postID'];?>"> |
@@ -147,17 +157,22 @@ discard block |
||
| 147 | 157 | $data = $accountCreator->execute(); |
| 148 | 158 | |
| 149 | 159 | $posts[0] = $data; |
| 150 | - if(isset($data['children'])) { |
|
| 151 | - foreach($data['children'] as $child) { |
|
| 160 | + if(isset($data['children'])) |
|
| 161 | + { |
|
| 162 | + foreach($data['children'] as $child) |
|
| 163 | + { |
|
| 152 | 164 | array_push($posts, $child); |
| 153 | 165 | } |
| 154 | 166 | $loops = $data['child_count'] + 1; |
| 155 | 167 | } |
| 156 | - else $loops = 1; |
|
| 168 | + else { |
|
| 169 | + $loops = 1; |
|
| 170 | + } |
|
| 157 | 171 | $showCommentIcon = FALSE; |
| 158 | 172 | } |
| 159 | 173 | //Get Posts |
| 160 | - else { |
|
| 174 | + else |
|
| 175 | + { |
|
| 161 | 176 | if(isset($_GET['commentView'])) |
| 162 | 177 | { |
| 163 | 178 | $commentView = true; |
@@ -183,9 +198,11 @@ discard block |
||
| 183 | 198 | } |
| 184 | 199 | |
| 185 | 200 | |
| 186 | - for($i = 0; $i<$loops; $i++) { |
|
| 201 | + for($i = 0; $i<$loops; $i++) |
|
| 202 | + { |
|
| 187 | 203 | |
| 188 | - if(isset($posts[$i])) { |
|
| 204 | + if(isset($posts[$i])) |
|
| 205 | + { |
|
| 189 | 206 | $lastPostId = $posts[$i]['post_id']; |
| 190 | 207 | |
| 191 | 208 | |
@@ -201,7 +218,8 @@ discard block |
||
| 201 | 218 | $timediff_inHours = (string)$timediff->format('%h'); |
| 202 | 219 | $timediff_inDays = (string)$timediff->format('%d'); |
| 203 | 220 | $timediff_inMonth = (string)$timediff->format('%m'); |
| 204 | - if($timediff_inMonth!=0) { |
|
| 221 | + if($timediff_inMonth!=0) |
|
| 222 | + { |
|
| 205 | 223 | $timediff = $timediff_inMonth . "m"; |
| 206 | 224 | } |
| 207 | 225 | else |
@@ -234,10 +252,12 @@ discard block |
||
| 234 | 252 | <article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;"> |
| 235 | 253 | <content> |
| 236 | 254 | <?php |
| 237 | - if(isset($posts[$i]["image_url"])) { |
|
| 255 | + if(isset($posts[$i]["image_url"])) |
|
| 256 | + { |
|
| 238 | 257 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
| 239 | 258 | } |
| 240 | - else { |
|
| 259 | + else |
|
| 260 | + { |
|
| 241 | 261 | echo nl2br($posts[$i]["message"]); |
| 242 | 262 | } |
| 243 | 263 | ?> |
@@ -263,13 +283,19 @@ discard block |
||
| 263 | 283 | </span> |
| 264 | 284 | </td> |
| 265 | 285 | <td class="comments"> |
| 266 | - <?php if($showCommentIcon) {?> |
|
| 286 | + <?php if($showCommentIcon) |
|
| 287 | +{ |
|
| 288 | +?> |
|
| 267 | 289 | <span data-tooltip="Comments"> |
| 268 | 290 | <a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"];?>"> |
| 269 | 291 | <i class="fa fa-commenting-o"></i> |
| 270 | - <?php if(array_key_exists("child_count", $posts[$i])) { |
|
| 292 | + <?php if(array_key_exists("child_count", $posts[$i])) |
|
| 293 | +{ |
|
| 271 | 294 | echo $posts[$i]["child_count"]; |
| 272 | - } else echo "0"; |
|
| 295 | + } |
|
| 296 | + else { |
|
| 297 | + echo "0"; |
|
| 298 | + } |
|
| 273 | 299 | ?> |
| 274 | 300 | </a> |
| 275 | 301 | </span> |
@@ -293,7 +319,9 @@ discard block |
||
| 293 | 319 | |
| 294 | 320 | </content> |
| 295 | 321 | |
| 296 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 322 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
| 323 | +{ |
|
| 324 | +?> |
|
| 297 | 325 | <p id="loading"> |
| 298 | 326 | Loading… |
| 299 | 327 | </p> |
@@ -304,7 +332,14 @@ discard block |
||
| 304 | 332 | <article> |
| 305 | 333 | <h2>Position</h2> |
| 306 | 334 | <form method="get"> |
| 307 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; else echo $posts[0]["location"]["name"]; ?>" required> |
|
| 335 | + <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) |
|
| 336 | +{ |
|
| 337 | + echo $newPositionStatus; |
|
| 338 | +} |
|
| 339 | +else { |
|
| 340 | + echo $posts[0]["location"]["name"]; |
|
| 341 | +} |
|
| 342 | +?>" required> |
|
| 308 | 343 | |
| 309 | 344 | <input type="submit" value="Set Location" /> |
| 310 | 345 | </form> |
@@ -317,7 +352,9 @@ discard block |
||
| 317 | 352 | </article> |
| 318 | 353 | |
| 319 | 354 | <article> |
| 320 | - <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
|
| 355 | + <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) |
|
| 356 | +{ |
|
| 357 | +?> |
|
| 321 | 358 | <h2>Comment on Jodel</h2> |
| 322 | 359 | <form method="POST"> |
| 323 | 360 | <input type="hidden" name="ancestor" value="<?php echo $_GET['postID'];?>" /> |
@@ -325,7 +362,10 @@ discard block |
||
| 325 | 362 | <br /> |
| 326 | 363 | <input type="submit" value="SEND" /> |
| 327 | 364 | </form> |
| 328 | - <?php } else { ?> |
|
| 365 | + <?php } |
|
| 366 | +else |
|
| 367 | +{ |
|
| 368 | +?> |
|
| 329 | 369 | <h2>New Jodel</h2> |
| 330 | 370 | <form method="POST"> |
| 331 | 371 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -345,13 +385,25 @@ discard block |
||
| 345 | 385 | <div class="col-sm-12"> |
| 346 | 386 | <div class="row"> |
| 347 | 387 | <div class="col-sm-3"> |
| 348 | - <a href="index.php" <?php if(isset($timeView)) echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 388 | + <a href="index.php" <?php if(isset($timeView)) |
|
| 389 | +{ |
|
| 390 | + echo 'class="active"'; |
|
| 391 | +} |
|
| 392 | +?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 349 | 393 | </div> |
| 350 | 394 | <div class="col-sm-3"> |
| 351 | - <a href="index.php?commentView=true" <?php if(isset($commentView)) echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 395 | + <a href="index.php?commentView=true" <?php if(isset($commentView)) |
|
| 396 | +{ |
|
| 397 | + echo 'class="active"'; |
|
| 398 | +} |
|
| 399 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 352 | 400 | </div> |
| 353 | 401 | <div class="col-sm-3"> |
| 354 | - <a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 402 | + <a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) |
|
| 403 | +{ |
|
| 404 | + echo 'class="active"'; |
|
| 405 | +} |
|
| 406 | +?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 355 | 407 | </div> |
| 356 | 408 | <div class="col-sm-3"> |
| 357 | 409 | <nav> |
@@ -375,7 +427,9 @@ discard block |
||
| 375 | 427 | $(this).addClass('selected'); |
| 376 | 428 | }); |
| 377 | 429 | |
| 378 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 430 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
| 431 | +{ |
|
| 432 | +?> |
|
| 379 | 433 | $(document).ready(function() { |
| 380 | 434 | var win = $(window); |
| 381 | 435 | var lastPostId = "<?php echo $lastPostId; ?>"; |