@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $accessToken; |
15 | 15 | $newPostionStatus; |
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()) |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | <a href="index.php"> |
116 | 116 | <h1> |
117 | 117 | JodelBlue |
118 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?> |
|
118 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>'; ?> |
|
119 | 119 | </h1> |
120 | 120 | </a> |
121 | 121 | <div class="clear"></div> |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { |
133 | 133 | //Header Nav in Comment View |
134 | 134 | ?> |
135 | - <a id="comment-back" href="index.php#postId-<?php echo $_GET['postID'];?>"> |
|
135 | + <a id="comment-back" href="index.php#postId-<?php echo $_GET['postID']; ?>"> |
|
136 | 136 | <i class="fa fa-angle-left fa-3x"></i> |
137 | 137 | </a> |
138 | 138 | |
139 | - <a id="comment-refresh" href="index.php?getPostDetails=<?php echo $_GET['getPostDetails'];?>&postID=<?php echo $_GET['postID'];?>"> |
|
139 | + <a id="comment-refresh" href="index.php?getPostDetails=<?php echo $_GET['getPostDetails']; ?>&postID=<?php echo $_GET['postID']; ?>"> |
|
140 | 140 | <i class="fa fa-refresh fa-2x"></i> |
141 | 141 | </a> |
142 | 142 | <?php |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | |
186 | - for($i = 0; $i<$loops; $i++) { |
|
186 | + for($i = 0; $i < $loops; $i++) { |
|
187 | 187 | |
188 | 188 | if(isset($posts[$i])) { |
189 | 189 | $lastPostId = $posts[$i]['post_id']; |
@@ -201,24 +201,24 @@ discard block |
||
201 | 201 | $timediff_inHours = (string)$timediff->format('%h'); |
202 | 202 | $timediff_inDays = (string)$timediff->format('%d'); |
203 | 203 | $timediff_inMonth = (string)$timediff->format('%m'); |
204 | - if($timediff_inMonth!=0) { |
|
204 | + if($timediff_inMonth != 0) { |
|
205 | 205 | $timediff = $timediff_inMonth . "m"; |
206 | 206 | } |
207 | 207 | else |
208 | 208 | { |
209 | - if($timediff_inDays!=0) |
|
209 | + if($timediff_inDays != 0) |
|
210 | 210 | { |
211 | 211 | $timediff = $timediff_inDays . "d"; |
212 | 212 | } |
213 | 213 | else |
214 | 214 | { |
215 | - if($timediff_inHours!=0) |
|
215 | + if($timediff_inHours != 0) |
|
216 | 216 | { |
217 | 217 | $timediff = $timediff_inHours . "h"; |
218 | 218 | } |
219 | 219 | else |
220 | 220 | { |
221 | - if($timediff_inMinutes!=0) |
|
221 | + if($timediff_inMinutes != 0) |
|
222 | 222 | { |
223 | 223 | $timediff = $timediff_inMinutes . "m"; |
224 | 224 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } |
232 | 232 | ?> |
233 | 233 | |
234 | - <article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;"> |
|
234 | + <article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"]; ?>;"> |
|
235 | 235 | <content> |
236 | 236 | <?php |
237 | 237 | if(isset($posts[$i]["image_url"])) { |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | ?> |
244 | 244 | </content> |
245 | 245 | <aside> |
246 | - <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
246 | + <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
247 | 247 | <i class="fa fa-angle-up fa-3x"></i> |
248 | 248 | </a> |
249 | 249 | <br /> |
250 | - <?php echo $posts[$i]["vote_count"];?><br /> |
|
251 | - <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
250 | + <?php echo $posts[$i]["vote_count"]; ?><br /> |
|
251 | + <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
252 | 252 | <i class="fa fa-angle-down fa-3x"></i> |
253 | 253 | </a> |
254 | 254 | </aside> |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | <td class="time"> |
260 | 260 | <span data-tooltip="Time"> |
261 | 261 | <i class="fa fa-clock-o"></i> |
262 | - <?php echo $timediff;?> |
|
262 | + <?php echo $timediff; ?> |
|
263 | 263 | </span> |
264 | 264 | </td> |
265 | 265 | <td class="comments"> |
266 | 266 | <?php if($showCommentIcon) {?> |
267 | 267 | <span data-tooltip="Comments"> |
268 | - <a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
268 | + <a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
269 | 269 | <i class="fa fa-commenting-o"></i> |
270 | 270 | <?php if(array_key_exists("child_count", $posts[$i])) { |
271 | 271 | echo $posts[$i]["child_count"]; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | <td class="distance"> |
279 | 279 | <span data-tooltip="Distance"> |
280 | 280 | <i class="fa fa-map-marker"></i> |
281 | - <?php echo $posts[$i]["distance"];?> km |
|
281 | + <?php echo $posts[$i]["distance"]; ?> km |
|
282 | 282 | </span> |
283 | 283 | </td> |
284 | 284 | </tr> |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
321 | 321 | <h2>Comment on Jodel</h2> |
322 | 322 | <form method="POST"> |
323 | - <input type="hidden" name="ancestor" value="<?php echo $_GET['postID'];?>" /> |
|
323 | + <input type="hidden" name="ancestor" value="<?php echo $_GET['postID']; ?>" /> |
|
324 | 324 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
325 | 325 | <br /> |
326 | 326 | <input type="submit" value="SEND" /> |
@@ -345,13 +345,13 @@ discard block |
||
345 | 345 | <div class="col-sm-12"> |
346 | 346 | <div class="row"> |
347 | 347 | <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> |
|
348 | + <a href="index.php" <?php if(isset($timeView)) echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
349 | 349 | </div> |
350 | 350 | <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> |
|
351 | + <a href="index.php?commentView=true" <?php if(isset($commentView)) echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
352 | 352 | </div> |
353 | 353 | <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> |
|
354 | + <a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
355 | 355 | </div> |
356 | 356 | <div class="col-sm-3"> |
357 | 357 | <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 | |
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; ?>"; |