@@ -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 | { |
@@ -45,7 +45,8 @@ |
||
45 | 45 | |
46 | 46 | if(isset($_GET['view'])) |
47 | 47 | { |
48 | - switch ($_GET['view']) { |
|
48 | + switch ($_GET['view']) |
|
49 | + { |
|
49 | 50 | case 'comment': |
50 | 51 | $view = 'comment'; |
51 | 52 | break; |
@@ -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> |
@@ -35,7 +35,8 @@ discard block |
||
35 | 35 | //Set View |
36 | 36 | if(isset($_GET['view'])) |
37 | 37 | { |
38 | - switch ($_GET['view']) { |
|
38 | + switch ($_GET['view']) |
|
39 | + { |
|
39 | 40 | case 'comment': |
40 | 41 | $view = 'comment'; |
41 | 42 | break; |
@@ -55,7 +56,8 @@ discard block |
||
55 | 56 | } |
56 | 57 | |
57 | 58 | //Set Location |
58 | - if(isset($_GET['city'])) { |
|
59 | + if(isset($_GET['city'])) |
|
60 | + { |
|
59 | 61 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
60 | 62 | $result = Requests::post($url); |
61 | 63 | if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
@@ -99,11 +101,14 @@ discard block |
||
99 | 101 | } |
100 | 102 | |
101 | 103 | //Vote |
102 | - if(isset($_GET['vote']) && isset($_GET['postID'])) { |
|
103 | - if($_GET['vote'] == "up") { |
|
104 | + if(isset($_GET['vote']) && isset($_GET['postID'])) |
|
105 | + { |
|
106 | + if($_GET['vote'] == "up") |
|
107 | + { |
|
104 | 108 | $accountCreator = new Upvote(); |
105 | 109 | } |
106 | - else if($_GET['vote'] == "down") { |
|
110 | + else if($_GET['vote'] == "down") |
|
111 | + { |
|
107 | 112 | $accountCreator = new Downvote(); |
108 | 113 | } |
109 | 114 | $accountCreator->setAccessToken($accessToken); |
@@ -115,7 +120,8 @@ discard block |
||
115 | 120 | |
116 | 121 | |
117 | 122 | //SendJodel |
118 | - if(isset($_POST['message'])) { |
|
123 | + if(isset($_POST['message'])) |
|
124 | + { |
|
119 | 125 | $accountCreator = new SendJodel(); |
120 | 126 | |
121 | 127 | if(isset($_POST['ancestor'])) |
@@ -126,7 +132,8 @@ discard block |
||
126 | 132 | if(isset($_POST['color'])) |
127 | 133 | { |
128 | 134 | $color = $_POST['color']; |
129 | - switch ($color) { |
|
135 | + switch ($color) |
|
136 | + { |
|
130 | 137 | case '8ABDB0': |
131 | 138 | $color = '8ABDB0'; |
132 | 139 | break; |
@@ -228,7 +235,8 @@ discard block |
||
228 | 235 | $data = $accountCreator->execute(); |
229 | 236 | |
230 | 237 | $posts[0] = $data; |
231 | - if(isset($data['children'])) { |
|
238 | + if(isset($data['children'])) |
|
239 | + { |
|
232 | 240 | foreach($data['children'] as $key => $child) |
233 | 241 | { |
234 | 242 | |
@@ -250,7 +258,9 @@ discard block |
||
250 | 258 | } |
251 | 259 | $loops = $data['child_count'] + 1; |
252 | 260 | } |
253 | - else $loops = 1; |
|
261 | + else { |
|
262 | + $loops = 1; |
|
263 | + } |
|
254 | 264 | $isDetailedView = TRUE; |
255 | 265 | } |
256 | 266 | //Get Posts |
@@ -291,7 +301,9 @@ discard block |
||
291 | 301 | |
292 | 302 | </content> |
293 | 303 | |
294 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
304 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
305 | +{ |
|
306 | +?> |
|
295 | 307 | <p id="loading"> |
296 | 308 | Loading… |
297 | 309 | </p> |
@@ -304,7 +316,11 @@ discard block |
||
304 | 316 | <div> |
305 | 317 | <h2>Position</h2> |
306 | 318 | <form method="get"> |
307 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
319 | + <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) |
|
320 | +{ |
|
321 | + echo $newPositionStatus; |
|
322 | +} |
|
323 | +?>" required> |
|
308 | 324 | |
309 | 325 | <input type="submit" value="Set Location" /> |
310 | 326 | </form> |
@@ -320,7 +336,9 @@ discard block |
||
320 | 336 | |
321 | 337 | <article> |
322 | 338 | <div> |
323 | - <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
|
339 | + <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) |
|
340 | +{ |
|
341 | +?> |
|
324 | 342 | <h2>Comment on Jodel</h2> |
325 | 343 | <form method="POST"> |
326 | 344 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
@@ -328,7 +346,10 @@ discard block |
||
328 | 346 | <br /> |
329 | 347 | <input type="submit" value="SEND" /> |
330 | 348 | </form> |
331 | - <?php } else { ?> |
|
349 | + <?php } |
|
350 | +else |
|
351 | +{ |
|
352 | +?> |
|
332 | 353 | <h2>New Jodel</h2> |
333 | 354 | <form method="POST"> |
334 | 355 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -360,13 +381,25 @@ discard block |
||
360 | 381 | <div class="col-sm-12"> |
361 | 382 | <div class="row"> |
362 | 383 | <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> |
|
384 | + <a href="index.php" <?php if($view=='time') |
|
385 | +{ |
|
386 | + echo 'class="active"'; |
|
387 | +} |
|
388 | +?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
364 | 389 | </div> |
365 | 390 | <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> |
|
391 | + <a href="index.php?view=comment" <?php if($view=='comment') |
|
392 | +{ |
|
393 | + echo 'class="active"'; |
|
394 | +} |
|
395 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
367 | 396 | </div> |
368 | 397 | <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> |
|
398 | + <a href="index.php?view=upVote" <?php if($view=='upVote') |
|
399 | +{ |
|
400 | + echo 'class="active"'; |
|
401 | +} |
|
402 | +?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
370 | 403 | </div> |
371 | 404 | <div class="col-sm-3"> |
372 | 405 | <nav> |
@@ -398,7 +431,9 @@ discard block |
||
398 | 431 | } |
399 | 432 | |
400 | 433 | |
401 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
434 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
435 | +{ |
|
436 | +?> |
|
402 | 437 | $(document).ready(function() { |
403 | 438 | var win = $(window); |
404 | 439 | var lastPostId = "<?php echo $lastPostId; ?>"; |
@@ -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> |
@@ -18,14 +18,16 @@ discard block |
||
18 | 18 | |
19 | 19 | $lastPostId = ''; |
20 | 20 | |
21 | -function isTokenFresh(Location $location) { |
|
21 | +function isTokenFresh(Location $location) |
|
22 | +{ |
|
22 | 23 | $db = new DatabaseConnect(); |
23 | 24 | $result = $db->query("SELECT * FROM accounts WHERE id='1'"); |
24 | 25 | |
25 | 26 | if ($result->num_rows > 0) |
26 | 27 | { |
27 | 28 | // output data of each row |
28 | - while($row = $result->fetch_assoc()) { |
|
29 | + while($row = $result->fetch_assoc()) |
|
30 | + { |
|
29 | 31 | //$access_token = $row["access_token"]; |
30 | 32 | $expiration_date = $row["expiration_date"]; |
31 | 33 | $deviceUid = $row["device_uid"]; |
@@ -37,7 +39,8 @@ discard block |
||
37 | 39 | echo '0 results'; |
38 | 40 | } |
39 | 41 | |
40 | - if($expiration_date <= time()) { |
|
42 | + if($expiration_date <= time()) |
|
43 | + { |
|
41 | 44 | $accountCreator = new CreateUser(); |
42 | 45 | $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
43 | 46 | $accountCreator->setDeviceUid($deviceUid); |
@@ -54,7 +57,8 @@ discard block |
||
54 | 57 | expiration_date='" . $expiration_date . "' |
55 | 58 | WHERE device_uid='" . $device_uid . "'"); |
56 | 59 | |
57 | - if($result === false){ |
|
60 | + if($result === false) |
|
61 | + { |
|
58 | 62 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
59 | 63 | } |
60 | 64 | } |
@@ -71,7 +75,8 @@ discard block |
||
71 | 75 | return $data["karma"]; |
72 | 76 | } |
73 | 77 | |
74 | -function registerAccount(Location $location) { |
|
78 | +function registerAccount(Location $location) |
|
79 | +{ |
|
75 | 80 | $accountCreator = new CreateUser(); |
76 | 81 | $accountCreator->setLocation($location); |
77 | 82 | $data = $accountCreator->execute(); |
@@ -96,7 +101,8 @@ discard block |
||
96 | 101 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
97 | 102 | |
98 | 103 | $success = TRUE; |
99 | - if($result === false){ |
|
104 | + if($result === false) |
|
105 | + { |
|
100 | 106 | $error = db_error(); |
101 | 107 | echo $error; |
102 | 108 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -107,7 +113,7 @@ discard block |
||
107 | 113 | } |
108 | 114 | |
109 | 115 | function getPosts($lastPostId, $accessToken, $url) |
110 | -{ |
|
116 | +{ |
|
111 | 117 | $accountCreator = new GetPosts(); |
112 | 118 | $accountCreator->setLastPostId($lastPostId); |
113 | 119 | $accountCreator->setAccessToken($accessToken); |
@@ -128,7 +134,8 @@ discard block |
||
128 | 134 | } |
129 | 135 | |
130 | 136 | function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE) |
131 | -{ //ToDO |
|
137 | +{ |
|
138 | +//ToDO |
|
132 | 139 | //Replace # with link |
133 | 140 | //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
134 | 141 | |
@@ -179,10 +186,12 @@ discard block |
||
179 | 186 | <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;"> |
180 | 187 | <content> |
181 | 188 | <?php |
182 | - if(isset($post["image_url"])) { |
|
189 | + if(isset($post["image_url"])) |
|
190 | + { |
|
183 | 191 | echo '<img src="' . $post["image_url"] . '">'; |
184 | 192 | } |
185 | - else { |
|
193 | + else |
|
194 | + { |
|
186 | 195 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($post["message"]))); |
187 | 196 | } |
188 | 197 | ?> |
@@ -208,13 +217,19 @@ discard block |
||
208 | 217 | </span> |
209 | 218 | </td> |
210 | 219 | <td class="comments"> |
211 | - <?php if(!$isDetailedView) {?> |
|
220 | + <?php if(!$isDetailedView) |
|
221 | +{ |
|
222 | +?> |
|
212 | 223 | <span data-tooltip="Comments"> |
213 | 224 | <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>"> |
214 | 225 | <i class="fa fa-commenting-o"></i> |
215 | - <?php if(array_key_exists("child_count", $post)) { |
|
226 | + <?php if(array_key_exists("child_count", $post)) |
|
227 | +{ |
|
216 | 228 | echo $post["child_count"]; |
217 | - } else echo "0"; |
|
229 | + } |
|
230 | + else { |
|
231 | + echo "0"; |
|
232 | + } |
|
218 | 233 | ?> |
219 | 234 | </a> |
220 | 235 | </span> |