@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | if($location->getLat() == $lat && $location->getLng() == $lng && $location->getCityName() == $name) |
| 88 | 88 | { |
| 89 | 89 | return TRUE; |
| 90 | - } |
|
| 90 | + } |
|
| 91 | 91 | else |
| 92 | 92 | { |
| 93 | 93 | return FALSE; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | if(substr($_GET['city'], 0, 1) === '#') |
| 101 | 101 | { |
| 102 | 102 | return htmlspecialchars($_GET['city']) . " " . $this->location->cityName; |
| 103 | - } |
|
| 103 | + } |
|
| 104 | 104 | else |
| 105 | 105 | { |
| 106 | 106 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
@@ -262,7 +262,8 @@ discard block |
||
| 262 | 262 | if(isset($_POST['color'])) |
| 263 | 263 | { |
| 264 | 264 | $color = $_POST['color']; |
| 265 | - switch ($color) { |
|
| 265 | + switch ($color) |
|
| 266 | + { |
|
| 266 | 267 | case '8ABDB0': |
| 267 | 268 | $color = '8ABDB0'; |
| 268 | 269 | break; |
@@ -355,7 +356,8 @@ discard block |
||
| 355 | 356 | expiration_date='" . $expiration_date . "' |
| 356 | 357 | WHERE device_uid='" . $device_uid . "'"); |
| 357 | 358 | |
| 358 | - if($result === false){ |
|
| 359 | + if($result === false) |
|
| 360 | + { |
|
| 359 | 361 | error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
| 360 | 362 | } |
| 361 | 363 | } |
@@ -435,14 +437,16 @@ discard block |
||
| 435 | 437 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
| 436 | 438 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
| 437 | 439 | |
| 438 | - if($result === false){ |
|
| 440 | + if($result === false) |
|
| 441 | + { |
|
| 439 | 442 | $error = db_error(); |
| 440 | 443 | echo $error; |
| 441 | 444 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
| 442 | 445 | } |
| 443 | 446 | } |
| 444 | 447 | |
| 445 | - function registerAccount($location) { |
|
| 448 | + function registerAccount($location) |
|
| 449 | + { |
|
| 446 | 450 | $accountCreator = new CreateUser(); |
| 447 | 451 | $accountCreator->setLocation($location); |
| 448 | 452 | $data = $accountCreator->execute(); |
@@ -467,7 +471,8 @@ discard block |
||
| 467 | 471 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 468 | 472 | |
| 469 | 473 | $success = TRUE; |
| 470 | - if($result === false){ |
|
| 474 | + if($result === false) |
|
| 475 | + { |
|
| 471 | 476 | $error = db_error(); |
| 472 | 477 | echo $error; |
| 473 | 478 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | abstract class AbstractRequest |
| 4 | -{ |
|
| 4 | +{ |
|
| 5 | 5 | const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
| 6 | 6 | const APIURL = 'https://api.go-tellm.com/api'; |
| 7 | 7 | const SECRET = 'LDWWpuUigOnKCbCLpoNMDHCqHCWbLKPzHbnIUKIf'; |
@@ -20,7 +20,8 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | $this->payLoad = $this->getPayload(); |
| 22 | 22 | $device_uid = ''; |
| 23 | - if(isset($this->payLoad['device_uid'])) { |
|
| 23 | + if(isset($this->payLoad['device_uid'])) |
|
| 24 | + { |
|
| 24 | 25 | $device_uid = $this->payLoad['device_uid']; |
| 25 | 26 | } |
| 26 | 27 | |
@@ -29,7 +30,8 @@ discard block |
||
| 29 | 30 | $header = $this->getSignHeaders(); |
| 30 | 31 | $url = $this->getFullUrl(); |
| 31 | 32 | |
| 32 | - if ($this->getAccessToken()) { |
|
| 33 | + if ($this->getAccessToken()) |
|
| 34 | + { |
|
| 33 | 35 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
| 34 | 36 | } |
| 35 | 37 | //Comment out to debug the Request: |
@@ -52,7 +54,8 @@ discard block |
||
| 52 | 54 | 'proxy' => '186.103.169.165:8080', |
| 53 | 55 | );*/ |
| 54 | 56 | |
| 55 | - switch ($this->getMethod()) { |
|
| 57 | + switch ($this->getMethod()) |
|
| 58 | + { |
|
| 56 | 59 | case 'POST': |
| 57 | 60 | $result = Requests::post($url, $header, $this->payLoad); |
| 58 | 61 | break; |
@@ -70,7 +73,8 @@ discard block |
||
| 70 | 73 | $result = Requests::put($url, $header, $this->payLoad); |
| 71 | 74 | break; |
| 72 | 75 | } |
| 73 | - switch ($result->status_code) { |
|
| 76 | + switch ($result->status_code) |
|
| 77 | + { |
|
| 74 | 78 | case 200: |
| 75 | 79 | $result = json_decode($result->body, true); |
| 76 | 80 | break; |
@@ -125,10 +129,12 @@ discard block |
||
| 125 | 129 | */ |
| 126 | 130 | private function getSignHeaders() |
| 127 | 131 | { |
| 128 | - if($this->getAccessToken() == null) { |
|
| 132 | + if($this->getAccessToken() == null) |
|
| 133 | + { |
|
| 129 | 134 | $payload_accessToken = ""; |
| 130 | 135 | } |
| 131 | - else { |
|
| 136 | + else |
|
| 137 | + { |
|
| 132 | 138 | $payload_accessToken = $this->getAccessToken(); |
| 133 | 139 | } |
| 134 | 140 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | if(configPropertyExists($config, 'karmaDeviceUid')) |
| 100 | - { |
|
| 100 | + { |
|
| 101 | 101 | $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
| 102 | 102 | } |
| 103 | 103 | else |
@@ -165,7 +165,8 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | if(isset($_GET['view'])) |
| 167 | 167 | { |
| 168 | - switch ($_GET['view']) { |
|
| 168 | + switch ($_GET['view']) |
|
| 169 | + { |
|
| 169 | 170 | case 'discussed': |
| 170 | 171 | $view = 'discussed'; |
| 171 | 172 | break; |
@@ -212,7 +213,7 @@ discard block |
||
| 212 | 213 | { |
| 213 | 214 | $jodelAccountForKarma->votePostId($_GET['postId'], $_GET['vote']); |
| 214 | 215 | if(isset($_GET['getPostDetails']) && isset($_GET['getPostDetails'])) |
| 215 | - { |
|
| 216 | + { |
|
| 216 | 217 | header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId'])); |
| 217 | 218 | } |
| 218 | 219 | else |
@@ -20,7 +20,8 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | $posts[0] = $data; |
| 22 | 22 | |
| 23 | - if(array_key_exists('children', $data)) { |
|
| 23 | + if(array_key_exists('children', $data)) |
|
| 24 | + { |
|
| 24 | 25 | foreach($data['children'] as $key => $child) |
| 25 | 26 | { |
| 26 | 27 | |
@@ -78,7 +79,9 @@ discard block |
||
| 78 | 79 | } ?> |
| 79 | 80 | </content> |
| 80 | 81 | |
| 81 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 82 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
| 83 | +{ |
|
| 84 | +?> |
|
| 82 | 85 | <p id="loading"> |
| 83 | 86 | Loading… |
| 84 | 87 | </p> |
@@ -91,7 +94,11 @@ discard block |
||
| 91 | 94 | <div> |
| 92 | 95 | <h2>Position / Hashtag</h2> |
| 93 | 96 | <form method="get"> |
| 94 | - <input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
| 97 | + <input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) |
|
| 98 | +{ |
|
| 99 | + echo $newPositionStatus; |
|
| 100 | +} |
|
| 101 | +?>" required> |
|
| 95 | 102 | <label>try: #jhj</label><br> |
| 96 | 103 | <input type="submit" value="Set Location" /> |
| 97 | 104 | </form> |
@@ -107,7 +114,9 @@ discard block |
||
| 107 | 114 | |
| 108 | 115 | <article> |
| 109 | 116 | <div> |
| 110 | - <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?> |
|
| 117 | + <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) |
|
| 118 | +{ |
|
| 119 | +?> |
|
| 111 | 120 | <h2>Comment on Jodel</h2> |
| 112 | 121 | <form method="POST"> |
| 113 | 122 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" /> |
@@ -115,7 +124,10 @@ discard block |
||
| 115 | 124 | <br /> |
| 116 | 125 | <input type="submit" value="SEND" /> |
| 117 | 126 | </form> |
| 118 | - <?php } else { ?> |
|
| 127 | + <?php } |
|
| 128 | +else |
|
| 129 | +{ |
|
| 130 | +?> |
|
| 119 | 131 | <h2>New Jodel</h2> |
| 120 | 132 | <form method="POST"> |
| 121 | 133 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -1,12 +1,24 @@ |
||
| 1 | 1 | <div id="sortJodelBy" class="row"> |
| 2 | 2 | <div class="col-3"> |
| 3 | - <a <?php if($view->view == 'combo')echo 'class="active"';?> href="<?php echo $view->changeView('combo')->back()->toUrl();?>"><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 3 | + <a <?php if($view->view == 'combo') |
|
| 4 | +{ |
|
| 5 | + echo 'class="active"'; |
|
| 6 | +} |
|
| 7 | +?> href="<?php echo $view->changeView('combo')->back()->toUrl();?>"><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 4 | 8 | </div> |
| 5 | 9 | <div class="col-3"> |
| 6 | - <a <?php if($view->view == 'discussed') echo 'class="active"';?> href="<?php echo $view->changeView('discussed')->back()->toUrl();?>"><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 10 | + <a <?php if($view->view == 'discussed') |
|
| 11 | +{ |
|
| 12 | + echo 'class="active"'; |
|
| 13 | +} |
|
| 14 | +?> href="<?php echo $view->changeView('discussed')->back()->toUrl();?>"><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 7 | 15 | </div> |
| 8 | 16 | <div class="col-3"> |
| 9 | - <a <?php if($view->view == 'popular') echo 'class="active"';?> href="<?php echo $view->changeView('popular')->back()->toUrl();?>"><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 17 | + <a <?php if($view->view == 'popular') |
|
| 18 | +{ |
|
| 19 | + echo 'class="active"'; |
|
| 20 | +} |
|
| 21 | +?> href="<?php echo $view->changeView('popular')->back()->toUrl();?>"><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 10 | 22 | </div> |
| 11 | 23 | <div class="col-3"> |
| 12 | 24 | <nav> |
@@ -29,7 +29,9 @@ |
||
| 29 | 29 | $('html,body').animate({scrollTop: aTag.offset().top-90},'slow'); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 32 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
| 33 | +{ |
|
| 34 | +?> |
|
| 33 | 35 | |
| 34 | 36 | var win = $(window); |
| 35 | 37 | var lastPostId = "<?php echo $view->lastPostId; ?>"; |
@@ -74,7 +74,11 @@ |
||
| 74 | 74 | |
| 75 | 75 | <div id="location_mobile" class="hidden-sm-up"> |
| 76 | 76 | <form method="get"> |
| 77 | - <input type="text" id="city_mobile" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
| 77 | + <input type="text" id="city_mobile" name="search" placeholder="<?php if(isset($newPositionStatus)) |
|
| 78 | +{ |
|
| 79 | + echo $newPositionStatus; |
|
| 80 | +} |
|
| 81 | +?>" required> |
|
| 78 | 82 | |
| 79 | 83 | <input type="submit" id="submit_mobile" class="fa" value="" /> |
| 80 | 84 | </form> |
@@ -34,7 +34,8 @@ discard block |
||
| 34 | 34 | * Compute HTML Code |
| 35 | 35 | */ |
| 36 | 36 | function jodelToHtml($post) |
| 37 | - { //ToDO |
|
| 37 | + { |
|
| 38 | +//ToDO |
|
| 38 | 39 | //Replace # with link |
| 39 | 40 | //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
| 40 | 41 | |
@@ -90,7 +91,8 @@ discard block |
||
| 90 | 91 | |
| 91 | 92 | echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
| 92 | 93 | } |
| 93 | - else { |
|
| 94 | + else |
|
| 95 | + { |
|
| 94 | 96 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
| 95 | 97 | } |
| 96 | 98 | ?> |
@@ -98,11 +100,13 @@ discard block |
||
| 98 | 100 | <aside> |
| 99 | 101 | <?php |
| 100 | 102 | if($this->isDetailedView) |
| 101 | - {?> |
|
| 103 | + { |
|
| 104 | +?> |
|
| 102 | 105 | <a href="index.php?vote=up&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow"> |
| 103 | 106 | <?php } |
| 104 | - else |
|
| 105 | - {?> |
|
| 107 | +else |
|
| 108 | + { |
|
| 109 | +?> |
|
| 106 | 110 | <a href="index.php?vote=up&postId=<?php echo $post['post_id'];?>" rel="nofollow"> |
| 107 | 111 | <?php } ?> |
| 108 | 112 | <i class="fa fa-angle-up fa-3x"></i> |
@@ -111,11 +115,13 @@ discard block |
||
| 111 | 115 | <?php echo $post["vote_count"];?><br /> |
| 112 | 116 | <?php |
| 113 | 117 | if($this->isDetailedView) |
| 114 | - {?> |
|
| 118 | + { |
|
| 119 | +?> |
|
| 115 | 120 | <a href="index.php?vote=down&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow"> |
| 116 | 121 | <?php } |
| 117 | - else |
|
| 118 | - {?> |
|
| 122 | +else |
|
| 123 | + { |
|
| 124 | +?> |
|
| 119 | 125 | <a href="index.php?vote=down&postId=<?php echo $post['post_id'];?>" rel="nofollow"> |
| 120 | 126 | <?php } ?> |
| 121 | 127 | <i class="fa fa-angle-down fa-3x"></i> |
@@ -133,13 +139,19 @@ discard block |
||
| 133 | 139 | </span> |
| 134 | 140 | </td> |
| 135 | 141 | <td class="comments"> |
| 136 | - <?php if(!$this->isDetailedView) {?> |
|
| 142 | + <?php if(!$this->isDetailedView) |
|
| 143 | +{ |
|
| 144 | +?> |
|
| 137 | 145 | <span data-tooltip="Comments"> |
| 138 | 146 | <a href="<?php echo $this->changePostId($post['post_id'])->toUrl();?>"> |
| 139 | 147 | <i class="fa fa-commenting-o"></i> |
| 140 | - <?php if(array_key_exists("child_count", $post)) { |
|
| 148 | + <?php if(array_key_exists("child_count", $post)) |
|
| 149 | +{ |
|
| 141 | 150 | echo $post["child_count"]; |
| 142 | - } else echo "0"; |
|
| 151 | + } |
|
| 152 | + else { |
|
| 153 | + echo "0"; |
|
| 154 | + } |
|
| 143 | 155 | ?> |
| 144 | 156 | </a> |
| 145 | 157 | </span> |
@@ -342,7 +354,7 @@ discard block |
||
| 342 | 354 | $data = $accountCreator->execute(); |
| 343 | 355 | } |
| 344 | 356 | if(array_key_exists('recent', $data)) |
| 345 | - { |
|
| 357 | + { |
|
| 346 | 358 | return $data['recent']; |
| 347 | 359 | } |
| 348 | 360 | else if(array_key_exists('posts', $data)) |