@@ -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_forId1); |
@@ -116,7 +121,8 @@ discard block |
||
116 | 121 | |
117 | 122 | |
118 | 123 | //SendJodel |
119 | - if(isset($_POST['message'])) { |
|
124 | + if(isset($_POST['message'])) |
|
125 | + { |
|
120 | 126 | $accountCreator = new SendJodel(); |
121 | 127 | |
122 | 128 | if(isset($_POST['ancestor'])) |
@@ -127,7 +133,8 @@ discard block |
||
127 | 133 | if(isset($_POST['color'])) |
128 | 134 | { |
129 | 135 | $color = $_POST['color']; |
130 | - switch ($color) { |
|
136 | + switch ($color) |
|
137 | + { |
|
131 | 138 | case '8ABDB0': |
132 | 139 | $color = '8ABDB0'; |
133 | 140 | break; |
@@ -273,7 +280,8 @@ discard block |
||
273 | 280 | $data = $accountCreator->execute(); |
274 | 281 | |
275 | 282 | $posts[0] = $data; |
276 | - if(array_key_exists('children', $data)) { |
|
283 | + if(array_key_exists('children', $data)) |
|
284 | + { |
|
277 | 285 | foreach($data['children'] as $key => $child) |
278 | 286 | { |
279 | 287 | |
@@ -348,7 +356,9 @@ discard block |
||
348 | 356 | |
349 | 357 | </content> |
350 | 358 | |
351 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
359 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
360 | +{ |
|
361 | +?> |
|
352 | 362 | <p id="loading"> |
353 | 363 | Loading… |
354 | 364 | </p> |
@@ -361,7 +371,11 @@ discard block |
||
361 | 371 | <div> |
362 | 372 | <h2>Position</h2> |
363 | 373 | <form method="get"> |
364 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
374 | + <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) |
|
375 | +{ |
|
376 | + echo $newPositionStatus; |
|
377 | +} |
|
378 | +?>" required> |
|
365 | 379 | |
366 | 380 | <input type="submit" value="Set Location" /> |
367 | 381 | </form> |
@@ -377,7 +391,9 @@ discard block |
||
377 | 391 | |
378 | 392 | <article> |
379 | 393 | <div> |
380 | - <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
|
394 | + <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) |
|
395 | +{ |
|
396 | +?> |
|
381 | 397 | <h2>Comment on Jodel</h2> |
382 | 398 | <form method="POST"> |
383 | 399 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
@@ -385,7 +401,10 @@ discard block |
||
385 | 401 | <br /> |
386 | 402 | <input type="submit" value="SEND" /> |
387 | 403 | </form> |
388 | - <?php } else { ?> |
|
404 | + <?php } |
|
405 | +else |
|
406 | +{ |
|
407 | +?> |
|
389 | 408 | <h2>New Jodel</h2> |
390 | 409 | <form method="POST"> |
391 | 410 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -417,13 +436,25 @@ discard block |
||
417 | 436 | <div class="col-sm-12"> |
418 | 437 | <div class="row"> |
419 | 438 | <div class="col-sm-3"> |
420 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
439 | + <a href="index.php" <?php if($view=='time') |
|
440 | +{ |
|
441 | + echo 'class="active"'; |
|
442 | +} |
|
443 | +?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
421 | 444 | </div> |
422 | 445 | <div class="col-sm-3"> |
423 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
446 | + <a href="index.php?view=comment" <?php if($view=='comment') |
|
447 | +{ |
|
448 | + echo 'class="active"'; |
|
449 | +} |
|
450 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
424 | 451 | </div> |
425 | 452 | <div class="col-sm-3"> |
426 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
453 | + <a href="index.php?view=upVote" <?php if($view=='upVote') |
|
454 | +{ |
|
455 | + echo 'class="active"'; |
|
456 | +} |
|
457 | +?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
427 | 458 | </div> |
428 | 459 | <div class="col-sm-3"> |
429 | 460 | <nav> |
@@ -466,7 +497,9 @@ discard block |
||
466 | 497 | $('html,body').animate({scrollTop: aTag.offset().top-90},'slow'); |
467 | 498 | } |
468 | 499 | |
469 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
500 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
501 | +{ |
|
502 | +?> |
|
470 | 503 | |
471 | 504 | |
472 | 505 |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | if(!isset($_COOKIE['JodelDeviceId'])) |
37 | 37 | { |
38 | 38 | $deviceUid = createAccount(); |
39 | - setcookie('JodelDeviceId', $deviceUid, time()+60*60*24*365*10); |
|
40 | - error_log('Created account with JodelDeviceId:' . $deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
|
39 | + setcookie('JodelDeviceId', $deviceUid, time() + 60 * 60 * 24 * 365 * 10); |
|
40 | + error_log('Created account with JodelDeviceId:' . $deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
|
41 | 41 | |
42 | 42 | } |
43 | 43 | else |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | //Set View |
58 | 58 | if(isset($_GET['view'])) |
59 | 59 | { |
60 | - switch ($_GET['view']) { |
|
60 | + switch($_GET['view']) { |
|
61 | 61 | case 'comment': |
62 | 62 | $view = 'comment'; |
63 | 63 | break; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | else |
116 | 116 | { |
117 | 117 | $newPositionStatus = $name; |
118 | - error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
118 | + error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | if(isset($_POST['color'])) |
151 | 151 | { |
152 | 152 | $color = $_POST['color']; |
153 | - switch ($color) { |
|
153 | + switch($color) { |
|
154 | 154 | case '8ABDB0': |
155 | 155 | $color = '8ABDB0'; |
156 | 156 | break; |
@@ -328,13 +328,13 @@ discard block |
||
328 | 328 | else |
329 | 329 | { |
330 | 330 | $version = 'v2'; |
331 | - if($view=='comment') |
|
331 | + if($view == 'comment') |
|
332 | 332 | { |
333 | 333 | $url = "/v2/posts/location/discussed/"; |
334 | 334 | } |
335 | 335 | else |
336 | 336 | { |
337 | - if($view=='upVote') |
|
337 | + if($view == 'upVote') |
|
338 | 338 | { |
339 | 339 | $url = "/v2/posts/location/popular/"; |
340 | 340 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | } |
359 | 359 | |
360 | 360 | |
361 | - for($i = 0; $i<$loops; $i++) |
|
361 | + for($i = 0; $i < $loops; $i++) |
|
362 | 362 | { |
363 | 363 | if(array_key_exists($i, $posts) && array_key_exists('post_id', $posts[$i]) && isset($posts[$i]['post_id'])) |
364 | 364 | { |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
403 | 403 | <h2>Comment on Jodel</h2> |
404 | 404 | <form method="POST"> |
405 | - <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
|
405 | + <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" /> |
|
406 | 406 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
407 | 407 | <br /> |
408 | 408 | <input type="submit" value="SEND" /> |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | <div class="col-sm-12"> |
440 | 440 | <div class="row"> |
441 | 441 | <div class="col-sm-3"> |
442 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
442 | + <a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
443 | 443 | </div> |
444 | 444 | <div class="col-sm-3"> |
445 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
445 | + <a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
446 | 446 | </div> |
447 | 447 | <div class="col-sm-3"> |
448 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
448 | + <a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
449 | 449 | </div> |
450 | 450 | <div class="col-sm-3"> |
451 | 451 | <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; |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | $accessToken_forId1; |
13 | 13 | $deviceUid; |
14 | 14 | |
15 | -setcookie("JodelId", "", time()-3600); |
|
15 | +setcookie("JodelId", "", time() - 3600); |
|
16 | 16 | |
17 | 17 | if(!isset($_COOKIE["JodelDeviceId"])) |
18 | 18 | { |
19 | 19 | $deviceUid = createAccount(); |
20 | - setcookie("JodelDeviceId", $deviceUid, time()+60*60*24*365*10); |
|
20 | + setcookie("JodelDeviceId", $deviceUid, time() + 60 * 60 * 24 * 365 * 10); |
|
21 | 21 | |
22 | 22 | } |
23 | 23 | else |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | if(isset($_GET['view'])) |
38 | 38 | { |
39 | - switch ($_GET['view']) { |
|
39 | + switch($_GET['view']) { |
|
40 | 40 | case 'comment': |
41 | 41 | $view = 'comment'; |
42 | 42 | break; |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | $view = 'time'; |
56 | 56 | } |
57 | 57 | |
58 | - if($view=='comment') |
|
58 | + if($view == 'comment') |
|
59 | 59 | { |
60 | 60 | $url = "/v2/posts/location/discussed/"; |
61 | 61 | } |
62 | 62 | else |
63 | 63 | { |
64 | - if($view=='upVote') |
|
64 | + if($view == 'upVote') |
|
65 | 65 | { |
66 | 66 | $url = "/v2/posts/location/popular/"; |
67 | 67 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | ?> |
82 | 82 | <div class="nextPosts"> |
83 | 83 | <?php |
84 | - for($i = 0; $i<$loops; $i++) |
|
84 | + for($i = 0; $i < $loops; $i++) |
|
85 | 85 | { |
86 | 86 | if(isset($posts[$i])) |
87 | 87 | { |
@@ -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 |
@@ -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 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | $config = parse_ini_file('config/config.ini.php'); |
4 | 4 | if(!isset($_GET['pw']) || $config['pw'] != $_GET['pw']) |
5 | 5 | { |
6 | - error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on admin.php'); |
|
6 | + error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on admin.php'); |
|
7 | 7 | die(); |
8 | 8 | } |
9 | 9 |
@@ -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> |
@@ -309,7 +309,7 @@ |
||
309 | 309 | { |
310 | 310 | preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
311 | 311 | |
312 | - return (isset($matches[0])) ? true : false; |
|
312 | + return (isset($matches[0])) ? true : false; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | function botDeviceUidIsSet($config) |
@@ -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; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | { |
310 | 310 | preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
311 | 311 | |
312 | - return (isset($matches[0])) ? true : false; |
|
312 | + return (isset($matches[0]))?true : false; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | function botDeviceUidIsSet($config) |
@@ -340,25 +340,25 @@ discard block |
||
340 | 340 | $timediff_inDays = (string)$timediff->format('%d'); |
341 | 341 | $timediff_inMonth = (string)$timediff->format('%m'); |
342 | 342 | |
343 | - if($timediff_inMonth!=0) |
|
343 | + if($timediff_inMonth != 0) |
|
344 | 344 | { |
345 | 345 | $timediff = $timediff_inMonth . "m"; |
346 | 346 | } |
347 | 347 | else |
348 | 348 | { |
349 | - if($timediff_inDays!=0) |
|
349 | + if($timediff_inDays != 0) |
|
350 | 350 | { |
351 | 351 | $timediff = $timediff_inDays . "d"; |
352 | 352 | } |
353 | 353 | else |
354 | 354 | { |
355 | - if($timediff_inHours!=0) |
|
355 | + if($timediff_inHours != 0) |
|
356 | 356 | { |
357 | 357 | $timediff = $timediff_inHours . "h"; |
358 | 358 | } |
359 | 359 | else |
360 | 360 | { |
361 | - if($timediff_inMinutes!=0) |
|
361 | + if($timediff_inMinutes != 0) |
|
362 | 362 | { |
363 | 363 | $timediff = $timediff_inMinutes . "m"; |
364 | 364 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | |
373 | 373 | |
374 | 374 | ?> |
375 | - <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;"> |
|
375 | + <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"]; ?>;"> |
|
376 | 376 | <content> |
377 | 377 | <?php |
378 | 378 | if(isset($post["image_url"])) { |
@@ -384,12 +384,12 @@ discard block |
||
384 | 384 | ?> |
385 | 385 | </content> |
386 | 386 | <aside> |
387 | - <a href="index.php?vote=up&postID=<?php echo $post["post_id"];?>"> |
|
387 | + <a href="index.php?vote=up&postID=<?php echo $post["post_id"]; ?>"> |
|
388 | 388 | <i class="fa fa-angle-up fa-3x"></i> |
389 | 389 | </a> |
390 | 390 | <br /> |
391 | - <?php echo $post["vote_count"];?><br /> |
|
392 | - <a href="index.php?vote=down&postID=<?php echo $post["post_id"];?>"> |
|
391 | + <?php echo $post["vote_count"]; ?><br /> |
|
392 | + <a href="index.php?vote=down&postID=<?php echo $post["post_id"]; ?>"> |
|
393 | 393 | <i class="fa fa-angle-down fa-3x"></i> |
394 | 394 | </a> |
395 | 395 | </aside> |
@@ -400,14 +400,14 @@ discard block |
||
400 | 400 | <td class="time"> |
401 | 401 | <span class="tip" data-tooltip="Time"> |
402 | 402 | <i class="fa fa-clock-o"></i> |
403 | - <?php echo $timediff;?> |
|
404 | - <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span> |
|
403 | + <?php echo $timediff; ?> |
|
404 | + <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s'); ?></span> |
|
405 | 405 | </span> |
406 | 406 | </td> |
407 | 407 | <td class="comments"> |
408 | 408 | <?php if(!$isDetailedView) {?> |
409 | 409 | <span data-tooltip="Comments"> |
410 | - <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>"> |
|
410 | + <a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $post["post_id"]; ?>"> |
|
411 | 411 | <i class="fa fa-commenting-o"></i> |
412 | 412 | <?php if(array_key_exists("child_count", $post)) { |
413 | 413 | echo $post["child_count"]; |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | { |
437 | 437 | ?> |
438 | 438 | <span data-tooltip="Author"> |
439 | - <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> | |
|
439 | + <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"]; ?> | |
|
440 | 440 | </span> |
441 | 441 | <?php |
442 | 442 | } |
@@ -446,8 +446,8 @@ discard block |
||
446 | 446 | |
447 | 447 | <span class="tip" data-tooltip="Distance"> |
448 | 448 | <i class="fa fa-map-marker"></i> |
449 | - <?php echo $post['distance'];?> km |
|
450 | - <span class="tiptext"><?php echo $post['location']['name'];?></span> |
|
449 | + <?php echo $post['distance']; ?> km |
|
450 | + <span class="tiptext"><?php echo $post['location']['name']; ?></span> |
|
451 | 451 | </span> |
452 | 452 | </td> |
453 | 453 | </tr> |
@@ -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; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | { |
310 | 310 | preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
311 | 311 | |
312 | - return (isset($matches[0])) ? true : false; |
|
312 | + return (isset($matches[0])) ? TRUE : FALSE; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | function botDeviceUidIsSet($config) |