@@ -35,15 +35,15 @@ discard block |
||
35 | 35 | if(isset($_GET['city'])) { |
36 | 36 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
37 | 37 | $result = Requests::post($url); |
38 | - if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
|
38 | + if(json_decode($result->body, TRUE)['status'] == 'ZERO_RESULTS' || json_decode($result->body, TRUE)['status'] == 'INVALID_REQUEST') |
|
39 | 39 | { |
40 | 40 | $newPositionStatus = "0 results"; |
41 | 41 | } |
42 | 42 | else |
43 | 43 | { |
44 | - $name = json_decode($result->body, true)['results']['0']['address_components']['0']['long_name']; |
|
45 | - $lat = json_decode($result->body, true)['results']['0']['geometry']['location']['lat']; |
|
46 | - $lng = json_decode($result->body, true)['results']['0']['geometry']['location']['lng']; |
|
44 | + $name = json_decode($result->body, TRUE)['results']['0']['address_components']['0']['long_name']; |
|
45 | + $lat = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lat']; |
|
46 | + $lng = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lng']; |
|
47 | 47 | |
48 | 48 | $location = new Location(); |
49 | 49 | $location->setLat($lat); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | lng='" . $lng . "' |
64 | 64 | WHERE id='1'"); |
65 | 65 | |
66 | - if($result === false) |
|
66 | + if($result === FALSE) |
|
67 | 67 | { |
68 | 68 | echo "Updating location failed: (" . $db->errno . ") " . $db->error; |
69 | 69 | } |
@@ -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> |
@@ -401,7 +434,9 @@ discard block |
||
401 | 434 | $('html,body').animate({scrollTop: aTag.offset().top-90},'slow'); |
402 | 435 | } |
403 | 436 | |
404 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
437 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
438 | +{ |
|
439 | +?> |
|
405 | 440 | |
406 | 441 | |
407 | 442 |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | $accessToken_forId1; |
12 | 12 | $deviceUid; |
13 | 13 | |
14 | - setcookie("JodelId", "", time()-3600); |
|
14 | + setcookie("JodelId", "", time() - 3600); |
|
15 | 15 | |
16 | 16 | if(!isset($_COOKIE["JodelDeviceId"])) |
17 | 17 | { |
18 | 18 | $deviceUid = createAccount(); |
19 | - setcookie("JodelDeviceId", $deviceUid, time()+60*60*24*365*10); |
|
19 | + setcookie("JodelDeviceId", $deviceUid, time() + 60 * 60 * 24 * 365 * 10); |
|
20 | 20 | |
21 | 21 | } |
22 | 22 | else |
@@ -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; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | if(isset($_POST['color'])) |
128 | 128 | { |
129 | 129 | $color = $_POST['color']; |
130 | - switch ($color) { |
|
130 | + switch($color) { |
|
131 | 131 | case '8ABDB0': |
132 | 132 | $color = '8ABDB0'; |
133 | 133 | break; |
@@ -297,13 +297,13 @@ discard block |
||
297 | 297 | else |
298 | 298 | { |
299 | 299 | $version = 'v2'; |
300 | - if($view=='comment') |
|
300 | + if($view == 'comment') |
|
301 | 301 | { |
302 | 302 | $url = "/v2/posts/location/discussed/"; |
303 | 303 | } |
304 | 304 | else |
305 | 305 | { |
306 | - if($view=='upVote') |
|
306 | + if($view == 'upVote') |
|
307 | 307 | { |
308 | 308 | $url = "/v2/posts/location/popular/"; |
309 | 309 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | } |
328 | 328 | |
329 | 329 | |
330 | - for($i = 0; $i<$loops; $i++) |
|
330 | + for($i = 0; $i < $loops; $i++) |
|
331 | 331 | { |
332 | 332 | |
333 | 333 | if(isset($posts[$i])) |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
373 | 373 | <h2>Comment on Jodel</h2> |
374 | 374 | <form method="POST"> |
375 | - <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
|
375 | + <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" /> |
|
376 | 376 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
377 | 377 | <br /> |
378 | 378 | <input type="submit" value="SEND" /> |
@@ -409,13 +409,13 @@ discard block |
||
409 | 409 | <div class="col-sm-12"> |
410 | 410 | <div class="row"> |
411 | 411 | <div class="col-sm-3"> |
412 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
412 | + <a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
413 | 413 | </div> |
414 | 414 | <div class="col-sm-3"> |
415 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
415 | + <a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
416 | 416 | </div> |
417 | 417 | <div class="col-sm-3"> |
418 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
418 | + <a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
419 | 419 | </div> |
420 | 420 | <div class="col-sm-3"> |
421 | 421 | <nav> |
@@ -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; |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | |
25 | 25 | isTokenFreshByAccessToken($location, $accessToken); |
26 | 26 | |
27 | -$result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
|
27 | +$result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
|
28 | 28 | |
29 | 29 | $newPositionStatus; |
30 | 30 | |
31 | -if ($result->num_rows > 0) |
|
31 | +if($result->num_rows > 0) |
|
32 | 32 | { |
33 | 33 | // output data of each row |
34 | 34 | while($row = $result->fetch_assoc()) |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | if(isset($_GET['view'])) |
46 | 46 | { |
47 | - switch ($_GET['view']) { |
|
47 | + switch($_GET['view']) { |
|
48 | 48 | case 'comment': |
49 | 49 | $view = 'comment'; |
50 | 50 | break; |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | $view = 'time'; |
64 | 64 | } |
65 | 65 | |
66 | - if($view=='comment') |
|
66 | + if($view == 'comment') |
|
67 | 67 | { |
68 | 68 | $url = "/v2/posts/location/discussed/"; |
69 | 69 | } |
70 | 70 | else |
71 | 71 | { |
72 | - if($view=='upVote') |
|
72 | + if($view == 'upVote') |
|
73 | 73 | { |
74 | 74 | $url = "/v2/posts/location/popular/"; |
75 | 75 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ?> |
90 | 90 | <div class="nextPosts"> |
91 | 91 | <?php |
92 | - for($i = 0; $i<$loops; $i++) |
|
92 | + for($i = 0; $i < $loops; $i++) |
|
93 | 93 | { |
94 | 94 | if(isset($posts[$i])) |
95 | 95 | { |
@@ -1,20 +1,20 @@ |
||
1 | 1 | <?php |
2 | 2 | class Downvote extends AbstractRequest |
3 | 3 | { |
4 | - public $postId; |
|
4 | + public $postId; |
|
5 | 5 | |
6 | - function getApiEndPoint() |
|
7 | - { |
|
8 | - return '/v2/posts/' . $this->postId . '/downvote'; |
|
9 | - } |
|
10 | - function getPayload() |
|
11 | - { |
|
12 | - return array( |
|
13 | - ); |
|
14 | - } |
|
15 | - function getMethod() |
|
16 | - { |
|
17 | - return 'PUT'; |
|
18 | - } |
|
6 | + function getApiEndPoint() |
|
7 | + { |
|
8 | + return '/v2/posts/' . $this->postId . '/downvote'; |
|
9 | + } |
|
10 | + function getPayload() |
|
11 | + { |
|
12 | + return array( |
|
13 | + ); |
|
14 | + } |
|
15 | + function getMethod() |
|
16 | + { |
|
17 | + return 'PUT'; |
|
18 | + } |
|
19 | 19 | } |
20 | 20 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | $i = 0; |
22 | 22 | $result = $db->query("SELECT access_token FROM accounts"); |
23 | 23 | |
24 | - if ($result->num_rows > 0) |
|
24 | + if($result->num_rows > 0) |
|
25 | 25 | { |
26 | 26 | // output data of each row |
27 | 27 | while(($row = $result->fetch_assoc()) && $i < $_POST['quantity']) |
@@ -32,10 +32,12 @@ |
||
32 | 32 | |
33 | 33 | isTokenFreshByAccessToken($location, $accessToken); |
34 | 34 | |
35 | - if($_POST['vote'] == "up") { |
|
35 | + if($_POST['vote'] == "up") |
|
36 | + { |
|
36 | 37 | $accountCreator = new Upvote(); |
37 | 38 | } |
38 | - else if($_POST['vote'] == "down") { |
|
39 | + else if($_POST['vote'] == "down") |
|
40 | + { |
|
39 | 41 | $accountCreator = new Downvote(); |
40 | 42 | } |
41 | 43 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | $access_token; |
27 | 27 | |
28 | - if ($result->num_rows > 0) |
|
28 | + if($result->num_rows > 0) |
|
29 | 29 | { |
30 | 30 | // output data of each row |
31 | 31 | while($row = $result->fetch_assoc()) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | if($expiration_date <= time()) { |
44 | 44 | $accountCreator = new CreateUser(); |
45 | - $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
|
45 | + $accountCreator->setAccessToken($access_token); //$accountData->getAccessToken()); |
|
46 | 46 | $accountCreator->setDeviceUid($deviceUid); |
47 | 47 | $accountCreator->setLocation($location); |
48 | 48 | $data = $accountCreator->execute(); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | expiration_date='" . $expiration_date . "' |
58 | 58 | WHERE device_uid='" . $device_uid . "'"); |
59 | 59 | |
60 | - if($result === false){ |
|
60 | + if($result === false) { |
|
61 | 61 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
62 | 62 | } |
63 | 63 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $db = new DatabaseConnect(); |
71 | 71 | $result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
72 | 72 | |
73 | - if ($result->num_rows > 0) |
|
73 | + if($result->num_rows > 0) |
|
74 | 74 | { |
75 | 75 | // output data of each row |
76 | 76 | while($row = $result->fetch_assoc()) { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | if($expiration_date <= time()) { |
89 | 89 | $accountCreator = new CreateUser(); |
90 | - $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
|
90 | + $accountCreator->setAccessToken($access_token); //$accountData->getAccessToken()); |
|
91 | 91 | $accountCreator->setDeviceUid($deviceUid); |
92 | 92 | $accountCreator->setLocation($location); |
93 | 93 | $data = $accountCreator->execute(); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | expiration_date='" . $expiration_date . "' |
103 | 103 | WHERE device_uid='" . $device_uid . "'"); |
104 | 104 | |
105 | - if($result === false){ |
|
105 | + if($result === false) { |
|
106 | 106 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
107 | 107 | } |
108 | 108 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | $access_token; |
119 | 119 | |
120 | - if ($result->num_rows > 0) |
|
120 | + if($result->num_rows > 0) |
|
121 | 121 | { |
122 | 122 | // output data of each row |
123 | 123 | while($row = $result->fetch_assoc()) { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | expiration_date='" . $expiration_date . "' |
150 | 150 | WHERE device_uid='" . $device_uid . "'"); |
151 | 151 | |
152 | - if($result === false){ |
|
152 | + if($result === false) { |
|
153 | 153 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
154 | 154 | } |
155 | 155 | } |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | function getLocationByAccessToken($accessToken) |
161 | 161 | { |
162 | 162 | $db = new DatabaseConnect(); |
163 | - $result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
|
163 | + $result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
|
164 | 164 | |
165 | 165 | $location = new Location(); |
166 | 166 | |
167 | - if ($result->num_rows > 0) |
|
167 | + if($result->num_rows > 0) |
|
168 | 168 | { |
169 | 169 | // output data of each row |
170 | 170 | while($row = $result->fetch_assoc()) |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | function getLocationByDeviceUid($deviceUid) |
186 | 186 | { |
187 | 187 | $db = new DatabaseConnect(); |
188 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
188 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
189 | 189 | |
190 | 190 | $location = new Location(); |
191 | 191 | |
192 | - if ($result->num_rows > 0) |
|
192 | + if($result->num_rows > 0) |
|
193 | 193 | { |
194 | 194 | // output data of each row |
195 | 195 | while($row = $result->fetch_assoc()) |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | function getAccessTokenByDeviceUid($deviceUid) |
211 | 211 | { |
212 | 212 | $db = new DatabaseConnect(); |
213 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
213 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
214 | 214 | |
215 | 215 | $accessToken; |
216 | 216 | |
217 | - if ($result->num_rows > 0) |
|
217 | + if($result->num_rows > 0) |
|
218 | 218 | { |
219 | 219 | // output data of each row |
220 | 220 | while($row = $result->fetch_assoc()) |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | $result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type, |
262 | 262 | expires_in, expiration_date, distinct_id, device_uid, name, lat, lng) |
263 | 263 | VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type . |
264 | - "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
264 | + "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
265 | 265 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
266 | 266 | |
267 | 267 | $success = TRUE; |
268 | - if($result === false){ |
|
268 | + if($result === false) { |
|
269 | 269 | $error = db_error(); |
270 | 270 | echo $error; |
271 | 271 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -321,25 +321,25 @@ discard block |
||
321 | 321 | $timediff_inDays = (string)$timediff->format('%d'); |
322 | 322 | $timediff_inMonth = (string)$timediff->format('%m'); |
323 | 323 | |
324 | - if($timediff_inMonth!=0) |
|
324 | + if($timediff_inMonth != 0) |
|
325 | 325 | { |
326 | 326 | $timediff = $timediff_inMonth . "m"; |
327 | 327 | } |
328 | 328 | else |
329 | 329 | { |
330 | - if($timediff_inDays!=0) |
|
330 | + if($timediff_inDays != 0) |
|
331 | 331 | { |
332 | 332 | $timediff = $timediff_inDays . "d"; |
333 | 333 | } |
334 | 334 | else |
335 | 335 | { |
336 | - if($timediff_inHours!=0) |
|
336 | + if($timediff_inHours != 0) |
|
337 | 337 | { |
338 | 338 | $timediff = $timediff_inHours . "h"; |
339 | 339 | } |
340 | 340 | else |
341 | 341 | { |
342 | - if($timediff_inMinutes!=0) |
|
342 | + if($timediff_inMinutes != 0) |
|
343 | 343 | { |
344 | 344 | $timediff = $timediff_inMinutes . "m"; |
345 | 345 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | |
355 | 355 | ?> |
356 | - <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;"> |
|
356 | + <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"]; ?>;"> |
|
357 | 357 | <content> |
358 | 358 | <?php |
359 | 359 | if(isset($post["image_url"])) { |
@@ -365,12 +365,12 @@ discard block |
||
365 | 365 | ?> |
366 | 366 | </content> |
367 | 367 | <aside> |
368 | - <a href="index.php?vote=up&postID=<?php echo $post["post_id"];?>"> |
|
368 | + <a href="index.php?vote=up&postID=<?php echo $post["post_id"]; ?>"> |
|
369 | 369 | <i class="fa fa-angle-up fa-3x"></i> |
370 | 370 | </a> |
371 | 371 | <br /> |
372 | - <?php echo $post["vote_count"];?><br /> |
|
373 | - <a href="index.php?vote=down&postID=<?php echo $post["post_id"];?>"> |
|
372 | + <?php echo $post["vote_count"]; ?><br /> |
|
373 | + <a href="index.php?vote=down&postID=<?php echo $post["post_id"]; ?>"> |
|
374 | 374 | <i class="fa fa-angle-down fa-3x"></i> |
375 | 375 | </a> |
376 | 376 | </aside> |
@@ -381,14 +381,14 @@ discard block |
||
381 | 381 | <td class="time"> |
382 | 382 | <span class="tip" data-tooltip="Time"> |
383 | 383 | <i class="fa fa-clock-o"></i> |
384 | - <?php echo $timediff;?> |
|
385 | - <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span> |
|
384 | + <?php echo $timediff; ?> |
|
385 | + <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s'); ?></span> |
|
386 | 386 | </span> |
387 | 387 | </td> |
388 | 388 | <td class="comments"> |
389 | 389 | <?php if(!$isDetailedView) {?> |
390 | 390 | <span data-tooltip="Comments"> |
391 | - <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>"> |
|
391 | + <a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $post["post_id"]; ?>"> |
|
392 | 392 | <i class="fa fa-commenting-o"></i> |
393 | 393 | <?php if(array_key_exists("child_count", $post)) { |
394 | 394 | echo $post["child_count"]; |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | { |
418 | 418 | ?> |
419 | 419 | <span data-tooltip="Author"> |
420 | - <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> | |
|
420 | + <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"]; ?> | |
|
421 | 421 | </span> |
422 | 422 | <?php |
423 | 423 | } |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | |
428 | 428 | <span class="tip" data-tooltip="Distance"> |
429 | 429 | <i class="fa fa-map-marker"></i> |
430 | - <?php echo $post['distance'];?> km |
|
431 | - <span class="tiptext"><?php echo $post['location']['name'];?></span> |
|
430 | + <?php echo $post['distance']; ?> km |
|
431 | + <span class="tiptext"><?php echo $post['location']['name']; ?></span> |
|
432 | 432 | </span> |
433 | 433 | </td> |
434 | 434 | </tr> |
@@ -28,7 +28,8 @@ discard block |
||
28 | 28 | if ($result->num_rows > 0) |
29 | 29 | { |
30 | 30 | // output data of each row |
31 | - while($row = $result->fetch_assoc()) { |
|
31 | + while($row = $result->fetch_assoc()) |
|
32 | + { |
|
32 | 33 | //$access_token = $row["access_token"]; |
33 | 34 | $expiration_date = $row["expiration_date"]; |
34 | 35 | $deviceUid = $row["device_uid"]; |
@@ -40,7 +41,8 @@ discard block |
||
40 | 41 | echo '0 results'; |
41 | 42 | } |
42 | 43 | |
43 | - if($expiration_date <= time()) { |
|
44 | + if($expiration_date <= time()) |
|
45 | + { |
|
44 | 46 | $accountCreator = new CreateUser(); |
45 | 47 | $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
46 | 48 | $accountCreator->setDeviceUid($deviceUid); |
@@ -57,7 +59,8 @@ discard block |
||
57 | 59 | expiration_date='" . $expiration_date . "' |
58 | 60 | WHERE device_uid='" . $device_uid . "'"); |
59 | 61 | |
60 | - if($result === false){ |
|
62 | + if($result === false) |
|
63 | + { |
|
61 | 64 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
62 | 65 | } |
63 | 66 | } |
@@ -73,7 +76,8 @@ discard block |
||
73 | 76 | if ($result->num_rows > 0) |
74 | 77 | { |
75 | 78 | // output data of each row |
76 | - while($row = $result->fetch_assoc()) { |
|
79 | + while($row = $result->fetch_assoc()) |
|
80 | + { |
|
77 | 81 | //$access_token = $row["access_token"]; |
78 | 82 | $expiration_date = $row["expiration_date"]; |
79 | 83 | $deviceUid = $row["device_uid"]; |
@@ -85,7 +89,8 @@ discard block |
||
85 | 89 | echo '0 results'; |
86 | 90 | } |
87 | 91 | |
88 | - if($expiration_date <= time()) { |
|
92 | + if($expiration_date <= time()) |
|
93 | + { |
|
89 | 94 | $accountCreator = new CreateUser(); |
90 | 95 | $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
91 | 96 | $accountCreator->setDeviceUid($deviceUid); |
@@ -102,7 +107,8 @@ discard block |
||
102 | 107 | expiration_date='" . $expiration_date . "' |
103 | 108 | WHERE device_uid='" . $device_uid . "'"); |
104 | 109 | |
105 | - if($result === false){ |
|
110 | + if($result === false) |
|
111 | + { |
|
106 | 112 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
107 | 113 | } |
108 | 114 | } |
@@ -120,7 +126,8 @@ discard block |
||
120 | 126 | if ($result->num_rows > 0) |
121 | 127 | { |
122 | 128 | // output data of each row |
123 | - while($row = $result->fetch_assoc()) { |
|
129 | + while($row = $result->fetch_assoc()) |
|
130 | + { |
|
124 | 131 | //$access_token = $row["access_token"]; |
125 | 132 | $expiration_date = $row["expiration_date"]; |
126 | 133 | $deviceUid = $row["device_uid"]; |
@@ -132,7 +139,8 @@ discard block |
||
132 | 139 | echo '0 results'; |
133 | 140 | } |
134 | 141 | |
135 | - if($expiration_date <= time()) { |
|
142 | + if($expiration_date <= time()) |
|
143 | + { |
|
136 | 144 | $accountCreator = new CreateUser(); |
137 | 145 | $accountCreator->setAccessToken($access_token); |
138 | 146 | $accountCreator->setDeviceUid($deviceUid); |
@@ -149,7 +157,8 @@ discard block |
||
149 | 157 | expiration_date='" . $expiration_date . "' |
150 | 158 | WHERE device_uid='" . $device_uid . "'"); |
151 | 159 | |
152 | - if($result === false){ |
|
160 | + if($result === false) |
|
161 | + { |
|
153 | 162 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
154 | 163 | } |
155 | 164 | } |
@@ -240,7 +249,8 @@ discard block |
||
240 | 249 | return $data["karma"]; |
241 | 250 | } |
242 | 251 | |
243 | -function registerAccount(Location $location) { |
|
252 | +function registerAccount(Location $location) |
|
253 | +{ |
|
244 | 254 | $accountCreator = new CreateUser(); |
245 | 255 | $accountCreator->setLocation($location); |
246 | 256 | $data = $accountCreator->execute(); |
@@ -265,7 +275,8 @@ discard block |
||
265 | 275 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
266 | 276 | |
267 | 277 | $success = TRUE; |
268 | - if($result === false){ |
|
278 | + if($result === false) |
|
279 | + { |
|
269 | 280 | $error = db_error(); |
270 | 281 | echo $error; |
271 | 282 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -276,7 +287,7 @@ discard block |
||
276 | 287 | } |
277 | 288 | |
278 | 289 | function getPosts($lastPostId, $accessToken, $url, $version = 'v2') |
279 | -{ |
|
290 | +{ |
|
280 | 291 | $accountCreator = new GetPosts(); |
281 | 292 | $accountCreator->setLastPostId($lastPostId); |
282 | 293 | $accountCreator->setAccessToken($accessToken); |
@@ -306,7 +317,8 @@ discard block |
||
306 | 317 | } |
307 | 318 | |
308 | 319 | function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE) |
309 | -{ //ToDO |
|
320 | +{ |
|
321 | +//ToDO |
|
310 | 322 | //Replace # with link |
311 | 323 | //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
312 | 324 | |
@@ -356,10 +368,12 @@ discard block |
||
356 | 368 | <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;"> |
357 | 369 | <content> |
358 | 370 | <?php |
359 | - if(isset($post["image_url"])) { |
|
371 | + if(isset($post["image_url"])) |
|
372 | + { |
|
360 | 373 | echo '<img src="' . $post["image_url"] . '">'; |
361 | 374 | } |
362 | - else { |
|
375 | + else |
|
376 | + { |
|
363 | 377 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($post["message"]))); |
364 | 378 | } |
365 | 379 | ?> |
@@ -386,13 +400,19 @@ discard block |
||
386 | 400 | </span> |
387 | 401 | </td> |
388 | 402 | <td class="comments"> |
389 | - <?php if(!$isDetailedView) {?> |
|
403 | + <?php if(!$isDetailedView) |
|
404 | +{ |
|
405 | +?> |
|
390 | 406 | <span data-tooltip="Comments"> |
391 | 407 | <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>"> |
392 | 408 | <i class="fa fa-commenting-o"></i> |
393 | - <?php if(array_key_exists("child_count", $post)) { |
|
409 | + <?php if(array_key_exists("child_count", $post)) |
|
410 | +{ |
|
394 | 411 | echo $post["child_count"]; |
395 | - } else echo "0"; |
|
412 | + } |
|
413 | + else { |
|
414 | + echo "0"; |
|
415 | + } |
|
396 | 416 | ?> |
397 | 417 | </a> |
398 | 418 | </span> |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | expiration_date='" . $expiration_date . "' |
58 | 58 | WHERE device_uid='" . $device_uid . "'"); |
59 | 59 | |
60 | - if($result === false){ |
|
60 | + if($result === FALSE){ |
|
61 | 61 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
62 | 62 | } |
63 | 63 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | expiration_date='" . $expiration_date . "' |
103 | 103 | WHERE device_uid='" . $device_uid . "'"); |
104 | 104 | |
105 | - if($result === false){ |
|
105 | + if($result === FALSE){ |
|
106 | 106 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
107 | 107 | } |
108 | 108 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | expiration_date='" . $expiration_date . "' |
150 | 150 | WHERE device_uid='" . $device_uid . "'"); |
151 | 151 | |
152 | - if($result === false){ |
|
152 | + if($result === FALSE){ |
|
153 | 153 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
154 | 154 | } |
155 | 155 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
266 | 266 | |
267 | 267 | $success = TRUE; |
268 | - if($result === false){ |
|
268 | + if($result === FALSE){ |
|
269 | 269 | $error = db_error(); |
270 | 270 | echo $error; |
271 | 271 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |