@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | if ($result->num_rows > 0) |
| 18 | 18 | { |
| 19 | 19 | // output data of each row |
| 20 | - while($row = $result->fetch_assoc()) |
|
| 20 | + while ($row = $result->fetch_assoc()) |
|
| 21 | 21 | { |
| 22 | 22 | $accessToken = $row["access_token"]; |
| 23 | 23 | } |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | //createAccount(); |
| 32 | 32 | |
| 33 | 33 | //Set Location |
| 34 | - if(isset($_GET['city'])) { |
|
| 34 | + if (isset($_GET['city'])) { |
|
| 35 | 35 | |
| 36 | 36 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . $_GET['city'] . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
| 37 | 37 | $result = Requests::post($url); |
| 38 | - if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS') |
|
| 38 | + if (json_decode($result->body, true)['status'] == 'ZERO_RESULTS') |
|
| 39 | 39 | { |
| 40 | 40 | $newPostionStatus = "0 results"; |
| 41 | 41 | } |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | //Vote |
| 56 | - if(isset($_GET['vote']) && isset($_GET['postID'])) { |
|
| 57 | - if($_GET['vote'] == "up") { |
|
| 56 | + if (isset($_GET['vote']) && isset($_GET['postID'])) { |
|
| 57 | + if ($_GET['vote'] == "up") { |
|
| 58 | 58 | $accountCreator = new Upvote(); |
| 59 | 59 | } |
| 60 | - else if($_GET['vote'] == "down") { |
|
| 60 | + else if ($_GET['vote'] == "down") { |
|
| 61 | 61 | $accountCreator = new Downvote(); |
| 62 | 62 | } |
| 63 | 63 | $accountCreator->setAccessToken($accessToken); |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | //SendJodel |
| 72 | - if(isset($_POST['message'])) { |
|
| 72 | + if (isset($_POST['message'])) { |
|
| 73 | 73 | $ancestor; |
| 74 | - if(isset($_POST['ancestor'])) |
|
| 74 | + if (isset($_POST['ancestor'])) |
|
| 75 | 75 | { |
| 76 | 76 | $ancestor = $_POST['ancestor']; |
| 77 | 77 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | <a href="index.php"> |
| 114 | 114 | <h1> |
| 115 | 115 | Jodel WebClient |
| 116 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?> |
|
| 116 | + <?php if (!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>'; ?> |
|
| 117 | 117 | </h1> |
| 118 | 118 | </a> |
| 119 | 119 | <div class="clear"></div> |
@@ -128,14 +128,14 @@ discard block |
||
| 128 | 128 | $posts; |
| 129 | 129 | |
| 130 | 130 | //Get Post Details |
| 131 | - if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { |
|
| 131 | + if (isset($_GET['postID']) && isset($_GET['getPostDetails'])) { |
|
| 132 | 132 | //Header Nav in Comment View |
| 133 | 133 | ?> |
| 134 | - <a id="comment-back" href="index.php#postId-<?php echo $_GET['postID'];?>"> |
|
| 134 | + <a id="comment-back" href="index.php#postId-<?php echo $_GET['postID']; ?>"> |
|
| 135 | 135 | <i class="fa fa-angle-left fa-3x"></i> |
| 136 | 136 | </a> |
| 137 | 137 | |
| 138 | - <a id="comment-refresh" href="index.php?getPostDetails=<?php echo $_GET['getPostDetails'];?>&postID=<?php echo $_GET['postID'];?>"> |
|
| 138 | + <a id="comment-refresh" href="index.php?getPostDetails=<?php echo $_GET['getPostDetails']; ?>&postID=<?php echo $_GET['postID']; ?>"> |
|
| 139 | 139 | <i class="fa fa-refresh fa-2x"></i> |
| 140 | 140 | </a> |
| 141 | 141 | <?php |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | $data = $accountCreator->execute(); |
| 147 | 147 | |
| 148 | 148 | $posts[0] = $data; |
| 149 | - if(isset($data['children'])) { |
|
| 150 | - foreach($data['children'] as $child) { |
|
| 149 | + if (isset($data['children'])) { |
|
| 150 | + foreach ($data['children'] as $child) { |
|
| 151 | 151 | array_push($posts, $child); |
| 152 | 152 | } |
| 153 | 153 | $loops = $data['child_count'] + 1; |
@@ -157,14 +157,14 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | //Get Posts |
| 159 | 159 | else { |
| 160 | - if(isset($_GET['commentView'])) |
|
| 160 | + if (isset($_GET['commentView'])) |
|
| 161 | 161 | { |
| 162 | 162 | $commentView = true; |
| 163 | 163 | $url = "/v2/posts/location/discussed/"; |
| 164 | 164 | } |
| 165 | 165 | else |
| 166 | 166 | { |
| 167 | - if(isset($_GET['upVoteView'])) |
|
| 167 | + if (isset($_GET['upVoteView'])) |
|
| 168 | 168 | { |
| 169 | 169 | $upVoteView = true; |
| 170 | 170 | $url = "/v2/posts/location/popular/"; |
@@ -182,9 +182,9 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | |
| 185 | - for($i = 0; $i<$loops; $i++) { |
|
| 185 | + for ($i = 0; $i < $loops; $i++) { |
|
| 186 | 186 | |
| 187 | - if(isset($posts[$i])) { |
|
| 187 | + if (isset($posts[$i])) { |
|
| 188 | 188 | $lastPostId = $posts[$i]['post_id']; |
| 189 | 189 | |
| 190 | 190 | |
@@ -200,24 +200,24 @@ discard block |
||
| 200 | 200 | $timediff_inHours = (string)$timediff->format('%h'); |
| 201 | 201 | $timediff_inDays = (string)$timediff->format('%d'); |
| 202 | 202 | $timediff_inMonth = (string)$timediff->format('%m'); |
| 203 | - if($timediff_inMonth!=0) { |
|
| 203 | + if ($timediff_inMonth != 0) { |
|
| 204 | 204 | $timediff = $timediff_inMonth . "m"; |
| 205 | 205 | } |
| 206 | 206 | else |
| 207 | 207 | { |
| 208 | - if($timediff_inDays!=0) |
|
| 208 | + if ($timediff_inDays != 0) |
|
| 209 | 209 | { |
| 210 | 210 | $timediff = $timediff_inDays . "d"; |
| 211 | 211 | } |
| 212 | 212 | else |
| 213 | 213 | { |
| 214 | - if($timediff_inHours!=0) |
|
| 214 | + if ($timediff_inHours != 0) |
|
| 215 | 215 | { |
| 216 | 216 | $timediff = $timediff_inHours . "h"; |
| 217 | 217 | } |
| 218 | 218 | else |
| 219 | 219 | { |
| 220 | - if($timediff_inMinutes!=0) |
|
| 220 | + if ($timediff_inMinutes != 0) |
|
| 221 | 221 | { |
| 222 | 222 | $timediff = $timediff_inMinutes . "m"; |
| 223 | 223 | } |
@@ -230,10 +230,10 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | ?> |
| 232 | 232 | |
| 233 | - <article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;"> |
|
| 233 | + <article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"]; ?>;"> |
|
| 234 | 234 | <content> |
| 235 | 235 | <?php |
| 236 | - if(isset($posts[$i]["image_url"])) { |
|
| 236 | + if (isset($posts[$i]["image_url"])) { |
|
| 237 | 237 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
| 238 | 238 | } |
| 239 | 239 | else { |
@@ -242,12 +242,12 @@ discard block |
||
| 242 | 242 | ?> |
| 243 | 243 | </content> |
| 244 | 244 | <aside> |
| 245 | - <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 245 | + <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
| 246 | 246 | <i class="fa fa-angle-up fa-3x"></i> |
| 247 | 247 | </a> |
| 248 | 248 | <br /> |
| 249 | - <?php echo $posts[$i]["vote_count"];?><br /> |
|
| 250 | - <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 249 | + <?php echo $posts[$i]["vote_count"]; ?><br /> |
|
| 250 | + <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
| 251 | 251 | <i class="fa fa-angle-down fa-3x"></i> |
| 252 | 252 | </a> |
| 253 | 253 | </aside> |
@@ -258,15 +258,15 @@ discard block |
||
| 258 | 258 | <td class="time"> |
| 259 | 259 | <span data-tooltip="Time"> |
| 260 | 260 | <i class="fa fa-clock-o"></i> |
| 261 | - <?php echo $timediff;?> |
|
| 261 | + <?php echo $timediff; ?> |
|
| 262 | 262 | </span> |
| 263 | 263 | </td> |
| 264 | 264 | <td class="comments"> |
| 265 | - <?php if($showCommentIcon) {?> |
|
| 265 | + <?php if ($showCommentIcon) {?> |
|
| 266 | 266 | <span data-tooltip="Comments"> |
| 267 | - <a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 267 | + <a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
| 268 | 268 | <i class="fa fa-commenting-o"></i> |
| 269 | - <?php if(array_key_exists("child_count", $posts[$i])) { |
|
| 269 | + <?php if (array_key_exists("child_count", $posts[$i])) { |
|
| 270 | 270 | echo $posts[$i]["child_count"]; |
| 271 | 271 | } else echo "0"; |
| 272 | 272 | ?> |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | <td class="distance"> |
| 278 | 278 | <span data-tooltip="Distance"> |
| 279 | 279 | <i class="fa fa-map-marker"></i> |
| 280 | - <?php echo $posts[$i]["distance"];?> km |
|
| 280 | + <?php echo $posts[$i]["distance"]; ?> km |
|
| 281 | 281 | </span> |
| 282 | 282 | </td> |
| 283 | 283 | </tr> |
@@ -292,15 +292,15 @@ discard block |
||
| 292 | 292 | </content> |
| 293 | 293 | |
| 294 | 294 | </article> |
| 295 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 295 | + <?php if (!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 296 | 296 | <p id="loading"> |
| 297 | 297 | <img src="images/loading.gif" alt="Loading…" /> |
| 298 | 298 | </p> |
| 299 | 299 | <?php } ?> |
| 300 | 300 | <nav id="sortJodelBy"> |
| 301 | - <a href="index.php" <?php if(isset($timeView)) echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 302 | - <a href="index.php?commentView=true" <?php if(isset($commentView)) echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 303 | - <a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 301 | + <a href="index.php" <?php if (isset($timeView)) echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 302 | + <a href="index.php?commentView=true" <?php if (isset($commentView)) echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 303 | + <a href="index.php?upVoteView=true" <?php if (isset($upVoteView)) echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 304 | 304 | </nav> |
| 305 | 305 | </div> |
| 306 | 306 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | <article> |
| 309 | 309 | <h3>Position</h3> |
| 310 | 310 | <form method="get"> |
| 311 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; else echo $posts[0]["location"]["name"]; ?>" required> |
|
| 311 | + <input type="text" id="city" name="city" placeholder="<?php if (isset($newPositionStatus)) echo $newPositionStatus; else echo $posts[0]["location"]["name"]; ?>" required> |
|
| 312 | 312 | |
| 313 | 313 | <input type="submit" value="Set Location" /> |
| 314 | 314 | </form> |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | </article> |
| 322 | 322 | |
| 323 | 323 | <article> |
| 324 | - <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
|
| 324 | + <?php if (isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
|
| 325 | 325 | <h2>Comment on Jodel</h2> |
| 326 | 326 | <form method="POST"> |
| 327 | - <input type="hidden" name="ancestor" value="<?php echo $_GET['postID'];?>" /> |
|
| 327 | + <input type="hidden" name="ancestor" value="<?php echo $_GET['postID']; ?>" /> |
|
| 328 | 328 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
| 329 | 329 | <br /> |
| 330 | 330 | <input type="submit" value="SEND" /> |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | $(this).addClass('selected'); |
| 359 | 359 | }); |
| 360 | 360 | |
| 361 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 361 | + <?php if (!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 362 | 362 | $(document).ready(function() { |
| 363 | 363 | var win = $(window); |
| 364 | 364 | var lastPostId = "<?php echo $lastPostId; ?>"; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | if ($result->num_rows > 0) { |
| 32 | 32 | // output data of each row |
| 33 | - while($row = $result->fetch_assoc()) { |
|
| 33 | + while ($row = $result->fetch_assoc()) { |
|
| 34 | 34 | $access_token = $row["access_token"]; |
| 35 | 35 | } |
| 36 | 36 | } else { |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | $posts; |
| 49 | 49 | |
| 50 | - if(isset($_GET['commentView'])) |
|
| 50 | + if (isset($_GET['commentView'])) |
|
| 51 | 51 | { |
| 52 | 52 | $commentView = true; |
| 53 | 53 | $url = "/posts/location/discussed/"; |
| 54 | 54 | } |
| 55 | 55 | else |
| 56 | 56 | { |
| 57 | - if(isset($_GET['upVoteView'])) |
|
| 57 | + if (isset($_GET['upVoteView'])) |
|
| 58 | 58 | { |
| 59 | 59 | $upVoteView = true; |
| 60 | 60 | $url = "/posts/location/popular/"; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if(isset($_GET['lastPostId'])) { |
|
| 69 | + if (isset($_GET['lastPostId'])) { |
|
| 70 | 70 | |
| 71 | 71 | $lastPostId = $_GET['lastPostId']; |
| 72 | 72 | |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | ?> |
| 77 | 77 | <div class="nextPosts"> |
| 78 | 78 | <?php |
| 79 | - for($i = 0; $i<$loops; $i++) { |
|
| 79 | + for ($i = 0; $i < $loops; $i++) { |
|
| 80 | 80 | |
| 81 | - if(isset($posts[$i])) { |
|
| 81 | + if (isset($posts[$i])) { |
|
| 82 | 82 | $lastPostId = $posts[$i]['post_id']; |
| 83 | 83 | |
| 84 | 84 | |
@@ -94,24 +94,24 @@ discard block |
||
| 94 | 94 | $timediff_inHours = (string)$timediff->format('%h'); |
| 95 | 95 | $timediff_inDays = (string)$timediff->format('%d'); |
| 96 | 96 | $timediff_inMonth = (string)$timediff->format('%m'); |
| 97 | - if($timediff_inMonth!=0) { |
|
| 97 | + if ($timediff_inMonth != 0) { |
|
| 98 | 98 | $timediff = $timediff_inMonth . "m"; |
| 99 | 99 | } |
| 100 | 100 | else |
| 101 | 101 | { |
| 102 | - if($timediff_inDays!=0) |
|
| 102 | + if ($timediff_inDays != 0) |
|
| 103 | 103 | { |
| 104 | 104 | $timediff = $timediff_inDays . "d"; |
| 105 | 105 | } |
| 106 | 106 | else |
| 107 | 107 | { |
| 108 | - if($timediff_inHours!=0) |
|
| 108 | + if ($timediff_inHours != 0) |
|
| 109 | 109 | { |
| 110 | 110 | $timediff = $timediff_inHours . "h"; |
| 111 | 111 | } |
| 112 | 112 | else |
| 113 | 113 | { |
| 114 | - if($timediff_inMinutes!=0) |
|
| 114 | + if ($timediff_inMinutes != 0) |
|
| 115 | 115 | { |
| 116 | 116 | $timediff = $timediff_inMinutes . "m"; |
| 117 | 117 | } |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | ?> |
| 126 | 126 | |
| 127 | - <article class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;"> |
|
| 127 | + <article class="jodel" style="background-color: #<?php echo $posts[$i]["color"]; ?>;"> |
|
| 128 | 128 | <content> |
| 129 | 129 | <?php |
| 130 | - if(isset($posts[$i]["image_url"])) { |
|
| 130 | + if (isset($posts[$i]["image_url"])) { |
|
| 131 | 131 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
| 132 | 132 | } |
| 133 | 133 | else { |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | ?> |
| 137 | 137 | </content> |
| 138 | 138 | <aside> |
| 139 | - <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 139 | + <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
| 140 | 140 | <i class="fa fa-angle-up fa-3x"></i> |
| 141 | 141 | </a> |
| 142 | 142 | <br /> |
| 143 | - <?php echo $posts[$i]["vote_count"];?><br /> |
|
| 144 | - <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 143 | + <?php echo $posts[$i]["vote_count"]; ?><br /> |
|
| 144 | + <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
| 145 | 145 | <i class="fa fa-angle-down fa-3x"></i> |
| 146 | 146 | </a> |
| 147 | 147 | </aside> |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | <td class="time"> |
| 153 | 153 | <span data-tooltip="Time"> |
| 154 | 154 | <i class="fa fa-clock-o"></i> |
| 155 | - <?php echo $timediff;?> |
|
| 155 | + <?php echo $timediff; ?> |
|
| 156 | 156 | </span> |
| 157 | 157 | </td> |
| 158 | 158 | <td class="comments"> |
| 159 | - <?php if($showCommentIcon) {?> |
|
| 159 | + <?php if ($showCommentIcon) {?> |
|
| 160 | 160 | <span data-tooltip="Comments"> |
| 161 | - <a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 161 | + <a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
| 162 | 162 | <i class="fa fa-commenting-o"></i> |
| 163 | - <?php if(array_key_exists("child_count", $posts[$i])) { |
|
| 163 | + <?php if (array_key_exists("child_count", $posts[$i])) { |
|
| 164 | 164 | echo $posts[$i]["child_count"]; |
| 165 | 165 | } else echo "0"; |
| 166 | 166 | ?> |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | <td class="distance"> |
| 172 | 172 | <span data-tooltip="Distance"> |
| 173 | 173 | <i class="fa fa-map-marker"></i> |
| 174 | - <?php echo $posts[$i]["distance"];?> km |
|
| 174 | + <?php echo $posts[$i]["distance"]; ?> km |
|
| 175 | 175 | </span> |
| 176 | 176 | </td> |
| 177 | 177 | </tr> |
@@ -40,6 +40,6 @@ |
||
| 40 | 40 | ) DEFAULT CHARSET=utf8"; |
| 41 | 41 | if(!$db->query($query)) |
| 42 | 42 | { |
| 43 | - throw new Exception($db->error($mysqli)); |
|
| 43 | + throw new Exception($db->error($mysqli)); |
|
| 44 | 44 | } |
| 45 | 45 | |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | `X-Api-Version` varchar(10) NOT NULL default '0.2', |
| 39 | 39 | PRIMARY KEY (`id`) |
| 40 | 40 | ) DEFAULT CHARSET=utf8"; |
| 41 | - if(!$db->query($query)) |
|
| 41 | + if (!$db->query($query)) |
|
| 42 | 42 | { |
| 43 | 43 | throw new Exception($db->error($mysqli)); |
| 44 | 44 | } |
@@ -2,94 +2,94 @@ |
||
| 2 | 2 | |
| 3 | 3 | class AccountData |
| 4 | 4 | { |
| 5 | - /** |
|
| 6 | - * @var string |
|
| 7 | - */ |
|
| 8 | - public $accessToken; |
|
| 9 | - /** |
|
| 10 | - * @var string |
|
| 11 | - */ |
|
| 12 | - public $expirationDate; |
|
| 13 | - /** |
|
| 14 | - * @var string |
|
| 15 | - */ |
|
| 16 | - public $refreshToken; |
|
| 17 | - /** |
|
| 18 | - * @var string |
|
| 19 | - */ |
|
| 20 | - public $distinctId; |
|
| 21 | - /** |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - public $deviceUid; |
|
| 25 | - /** |
|
| 26 | - * @return string |
|
| 27 | - */ |
|
| 28 | - public function getAccessToken(): string |
|
| 29 | - { |
|
| 30 | - return $this->accessToken; |
|
| 31 | - } |
|
| 32 | - /** |
|
| 33 | - * @param string $accessToken |
|
| 34 | - */ |
|
| 35 | - public function setAccessToken(string $accessToken) |
|
| 36 | - { |
|
| 37 | - $this->accessToken = $accessToken; |
|
| 38 | - } |
|
| 39 | - /** |
|
| 40 | - * @return string |
|
| 41 | - */ |
|
| 42 | - public function getExpirationDate(): string |
|
| 43 | - { |
|
| 44 | - return $this->expirationDate; |
|
| 45 | - } |
|
| 46 | - /** |
|
| 47 | - * @param string $expirationDate |
|
| 48 | - */ |
|
| 49 | - public function setExpirationDate(string $expirationDate) |
|
| 50 | - { |
|
| 51 | - $this->expirationDate = $expirationDate; |
|
| 52 | - } |
|
| 53 | - /** |
|
| 54 | - * @return string |
|
| 55 | - */ |
|
| 56 | - public function getRefreshToken(): string |
|
| 57 | - { |
|
| 58 | - return $this->refreshToken; |
|
| 59 | - } |
|
| 60 | - /** |
|
| 61 | - * @param string $refreshToken |
|
| 62 | - */ |
|
| 63 | - public function setRefreshToken(string $refreshToken) |
|
| 64 | - { |
|
| 65 | - $this->refreshToken = $refreshToken; |
|
| 66 | - } |
|
| 67 | - /** |
|
| 68 | - * @return string |
|
| 69 | - */ |
|
| 70 | - public function getDistinctId(): string |
|
| 71 | - { |
|
| 72 | - return $this->distinctId; |
|
| 73 | - } |
|
| 74 | - /** |
|
| 75 | - * @param string $distinctId |
|
| 76 | - */ |
|
| 77 | - public function setDistinctId(string $distinctId) |
|
| 78 | - { |
|
| 79 | - $this->distinctId = $distinctId; |
|
| 80 | - } |
|
| 81 | - /** |
|
| 82 | - * @return string |
|
| 83 | - */ |
|
| 84 | - public function getDeviceUid(): string |
|
| 85 | - { |
|
| 86 | - return $this->deviceUid; |
|
| 87 | - } |
|
| 88 | - /** |
|
| 89 | - * @param string $deviceUid |
|
| 90 | - */ |
|
| 91 | - public function setDeviceUid(string $deviceUid) |
|
| 92 | - { |
|
| 93 | - $this->deviceUid = $deviceUid; |
|
| 94 | - } |
|
| 5 | + /** |
|
| 6 | + * @var string |
|
| 7 | + */ |
|
| 8 | + public $accessToken; |
|
| 9 | + /** |
|
| 10 | + * @var string |
|
| 11 | + */ |
|
| 12 | + public $expirationDate; |
|
| 13 | + /** |
|
| 14 | + * @var string |
|
| 15 | + */ |
|
| 16 | + public $refreshToken; |
|
| 17 | + /** |
|
| 18 | + * @var string |
|
| 19 | + */ |
|
| 20 | + public $distinctId; |
|
| 21 | + /** |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + public $deviceUid; |
|
| 25 | + /** |
|
| 26 | + * @return string |
|
| 27 | + */ |
|
| 28 | + public function getAccessToken(): string |
|
| 29 | + { |
|
| 30 | + return $this->accessToken; |
|
| 31 | + } |
|
| 32 | + /** |
|
| 33 | + * @param string $accessToken |
|
| 34 | + */ |
|
| 35 | + public function setAccessToken(string $accessToken) |
|
| 36 | + { |
|
| 37 | + $this->accessToken = $accessToken; |
|
| 38 | + } |
|
| 39 | + /** |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 42 | + public function getExpirationDate(): string |
|
| 43 | + { |
|
| 44 | + return $this->expirationDate; |
|
| 45 | + } |
|
| 46 | + /** |
|
| 47 | + * @param string $expirationDate |
|
| 48 | + */ |
|
| 49 | + public function setExpirationDate(string $expirationDate) |
|
| 50 | + { |
|
| 51 | + $this->expirationDate = $expirationDate; |
|
| 52 | + } |
|
| 53 | + /** |
|
| 54 | + * @return string |
|
| 55 | + */ |
|
| 56 | + public function getRefreshToken(): string |
|
| 57 | + { |
|
| 58 | + return $this->refreshToken; |
|
| 59 | + } |
|
| 60 | + /** |
|
| 61 | + * @param string $refreshToken |
|
| 62 | + */ |
|
| 63 | + public function setRefreshToken(string $refreshToken) |
|
| 64 | + { |
|
| 65 | + $this->refreshToken = $refreshToken; |
|
| 66 | + } |
|
| 67 | + /** |
|
| 68 | + * @return string |
|
| 69 | + */ |
|
| 70 | + public function getDistinctId(): string |
|
| 71 | + { |
|
| 72 | + return $this->distinctId; |
|
| 73 | + } |
|
| 74 | + /** |
|
| 75 | + * @param string $distinctId |
|
| 76 | + */ |
|
| 77 | + public function setDistinctId(string $distinctId) |
|
| 78 | + { |
|
| 79 | + $this->distinctId = $distinctId; |
|
| 80 | + } |
|
| 81 | + /** |
|
| 82 | + * @return string |
|
| 83 | + */ |
|
| 84 | + public function getDeviceUid(): string |
|
| 85 | + { |
|
| 86 | + return $this->deviceUid; |
|
| 87 | + } |
|
| 88 | + /** |
|
| 89 | + * @param string $deviceUid |
|
| 90 | + */ |
|
| 91 | + public function setDeviceUid(string $deviceUid) |
|
| 92 | + { |
|
| 93 | + $this->deviceUid = $deviceUid; |
|
| 94 | + } |
|
| 95 | 95 | } |
@@ -3,18 +3,18 @@ |
||
| 3 | 3 | |
| 4 | 4 | class GetKarma extends AbstractRequest { |
| 5 | 5 | |
| 6 | - function getApiEndPoint() |
|
| 7 | - { |
|
| 8 | - return '/v2/users/karma'; |
|
| 9 | - } |
|
| 10 | - function getPayload() |
|
| 11 | - { |
|
| 12 | - return array( |
|
| 13 | - ); |
|
| 14 | - } |
|
| 15 | - function getMethod() |
|
| 16 | - { |
|
| 17 | - return 'GET'; |
|
| 18 | - } |
|
| 6 | + function getApiEndPoint() |
|
| 7 | + { |
|
| 8 | + return '/v2/users/karma'; |
|
| 9 | + } |
|
| 10 | + function getPayload() |
|
| 11 | + { |
|
| 12 | + return array( |
|
| 13 | + ); |
|
| 14 | + } |
|
| 15 | + function getMethod() |
|
| 16 | + { |
|
| 17 | + return 'GET'; |
|
| 18 | + } |
|
| 19 | 19 | } |
| 20 | 20 | |
@@ -3,37 +3,37 @@ |
||
| 3 | 3 | |
| 4 | 4 | class SetLocation extends AbstractRequest { |
| 5 | 5 | /** |
| 6 | - * @var Location |
|
| 7 | - */ |
|
| 8 | - public $location; |
|
| 9 | - /** |
|
| 10 | - * @return Location |
|
| 11 | - */ |
|
| 12 | - public function getLocation(): Location |
|
| 13 | - { |
|
| 14 | - return $this->location; |
|
| 15 | - } |
|
| 16 | - /** |
|
| 17 | - * @param Location $location |
|
| 18 | - */ |
|
| 19 | - public function setLocation(Location $location) |
|
| 20 | - { |
|
| 21 | - $this->location = $location; |
|
| 22 | - } |
|
| 6 | + * @var Location |
|
| 7 | + */ |
|
| 8 | + public $location; |
|
| 9 | + /** |
|
| 10 | + * @return Location |
|
| 11 | + */ |
|
| 12 | + public function getLocation(): Location |
|
| 13 | + { |
|
| 14 | + return $this->location; |
|
| 15 | + } |
|
| 16 | + /** |
|
| 17 | + * @param Location $location |
|
| 18 | + */ |
|
| 19 | + public function setLocation(Location $location) |
|
| 20 | + { |
|
| 21 | + $this->location = $location; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - function getApiEndPoint() |
|
| 25 | - { |
|
| 26 | - return '/v2/users/location'; |
|
| 27 | - } |
|
| 28 | - function getPayload() |
|
| 29 | - { |
|
| 30 | - return array( |
|
| 24 | + function getApiEndPoint() |
|
| 25 | + { |
|
| 26 | + return '/v2/users/location'; |
|
| 27 | + } |
|
| 28 | + function getPayload() |
|
| 29 | + { |
|
| 30 | + return array( |
|
| 31 | 31 | "location" => $this->getLocation()->toArray(), |
| 32 | - ); |
|
| 33 | - } |
|
| 34 | - function getMethod() |
|
| 35 | - { |
|
| 36 | - return 'PUT'; |
|
| 37 | - } |
|
| 32 | + ); |
|
| 33 | + } |
|
| 34 | + function getMethod() |
|
| 35 | + { |
|
| 36 | + return 'PUT'; |
|
| 37 | + } |
|
| 38 | 38 | } |
| 39 | 39 | |
@@ -1,66 +1,66 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class CreateUser extends AbstractRequest { |
| 4 | - /** |
|
| 5 | - * @var Location |
|
| 6 | - */ |
|
| 7 | - public $location; |
|
| 8 | - public $deviceUid; |
|
| 9 | - /** |
|
| 10 | - * @return Location |
|
| 11 | - */ |
|
| 12 | - public function getLocation(): Location |
|
| 13 | - { |
|
| 14 | - return $this->location; |
|
| 15 | - } |
|
| 16 | - /** |
|
| 17 | - * @param Location $location |
|
| 18 | - */ |
|
| 19 | - public function setLocation(Location $location) |
|
| 20 | - { |
|
| 21 | - $this->location = $location; |
|
| 22 | - } |
|
| 23 | - public function getDeviceUid() |
|
| 24 | - { |
|
| 4 | + /** |
|
| 5 | + * @var Location |
|
| 6 | + */ |
|
| 7 | + public $location; |
|
| 8 | + public $deviceUid; |
|
| 9 | + /** |
|
| 10 | + * @return Location |
|
| 11 | + */ |
|
| 12 | + public function getLocation(): Location |
|
| 13 | + { |
|
| 14 | + return $this->location; |
|
| 15 | + } |
|
| 16 | + /** |
|
| 17 | + * @param Location $location |
|
| 18 | + */ |
|
| 19 | + public function setLocation(Location $location) |
|
| 20 | + { |
|
| 21 | + $this->location = $location; |
|
| 22 | + } |
|
| 23 | + public function getDeviceUid() |
|
| 24 | + { |
|
| 25 | 25 | return $this->deviceUid; |
| 26 | 26 | } |
| 27 | 27 | public function setDeviceUid($deviceUid) |
| 28 | - { |
|
| 28 | + { |
|
| 29 | 29 | $this->deviceUid = $deviceUid; |
| 30 | 30 | } |
| 31 | - public function generateDeviceUid() |
|
| 32 | - { |
|
| 33 | - return $this->random_str(64, 'abcdef0123456789'); |
|
| 34 | - } |
|
| 35 | - function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') |
|
| 36 | - { |
|
| 37 | - $str = ''; |
|
| 38 | - $max = mb_strlen($keyspace, '8bit') - 1; |
|
| 39 | - for ($i = 0; $i < $length; ++$i) { |
|
| 40 | - $str .= $keyspace[random_int(0, $max)]; |
|
| 41 | - } |
|
| 42 | - return $str; |
|
| 43 | - } |
|
| 44 | - function getApiEndPoint() |
|
| 45 | - { |
|
| 46 | - return '/v2/users'; |
|
| 47 | - } |
|
| 48 | - function getPayload() |
|
| 49 | - { |
|
| 31 | + public function generateDeviceUid() |
|
| 32 | + { |
|
| 33 | + return $this->random_str(64, 'abcdef0123456789'); |
|
| 34 | + } |
|
| 35 | + function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') |
|
| 36 | + { |
|
| 37 | + $str = ''; |
|
| 38 | + $max = mb_strlen($keyspace, '8bit') - 1; |
|
| 39 | + for ($i = 0; $i < $length; ++$i) { |
|
| 40 | + $str .= $keyspace[random_int(0, $max)]; |
|
| 41 | + } |
|
| 42 | + return $str; |
|
| 43 | + } |
|
| 44 | + function getApiEndPoint() |
|
| 45 | + { |
|
| 46 | + return '/v2/users'; |
|
| 47 | + } |
|
| 48 | + function getPayload() |
|
| 49 | + { |
|
| 50 | 50 | if(!isset($this->deviceUid)) |
| 51 | 51 | { |
| 52 | 52 | $this->setDeviceUid($this->generateDeviceUid()); |
| 53 | 53 | } |
| 54 | 54 | echo $this->getDeviceUid(); |
| 55 | - echo "<br>"; |
|
| 55 | + echo "<br>"; |
|
| 56 | 56 | return array( |
| 57 | 57 | "location" => $this->getLocation()->toArray(), |
| 58 | 58 | "client_id" => self::CLIENTID, |
| 59 | 59 | "device_uid" => $this->getDeviceUid(), |
| 60 | 60 | ); |
| 61 | - } |
|
| 62 | - function getMethod() |
|
| 63 | - { |
|
| 64 | - return 'POST'; |
|
| 65 | - } |
|
| 61 | + } |
|
| 62 | + function getMethod() |
|
| 63 | + { |
|
| 64 | + return 'POST'; |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | } |
| 48 | 48 | function getPayload() |
| 49 | 49 | { |
| 50 | - if(!isset($this->deviceUid)) |
|
| 50 | + if (!isset($this->deviceUid)) |
|
| 51 | 51 | { |
| 52 | 52 | $this->setDeviceUid($this->generateDeviceUid()); |
| 53 | 53 | } |
@@ -5,20 +5,20 @@ discard block |
||
| 5 | 5 | { |
| 6 | 6 | public $lastPostId; |
| 7 | 7 | |
| 8 | - public $url; |
|
| 8 | + public $url; |
|
| 9 | 9 | |
| 10 | - function setUrl ($url) |
|
| 11 | - { |
|
| 12 | - $this->url = $url; |
|
| 13 | - } |
|
| 10 | + function setUrl ($url) |
|
| 11 | + { |
|
| 12 | + $this->url = $url; |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | - function getUrl () |
|
| 16 | - { |
|
| 17 | - return $this->url; |
|
| 18 | - } |
|
| 15 | + function getUrl () |
|
| 16 | + { |
|
| 17 | + return $this->url; |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - function setLastPostId ($lastPostId) |
|
| 21 | - { |
|
| 20 | + function setLastPostId ($lastPostId) |
|
| 21 | + { |
|
| 22 | 22 | $this->lastPostId = $lastPostId; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -27,22 +27,22 @@ discard block |
||
| 27 | 27 | return $this->lastPostId; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - function getApiEndPoint() |
|
| 31 | - { |
|
| 32 | - $apiEndPoint = $this->getUrl(); |
|
| 33 | - //echo $GLOBALS['lastPostId']; |
|
| 34 | - if ($this->getLastPostId() != "") { |
|
| 30 | + function getApiEndPoint() |
|
| 31 | + { |
|
| 32 | + $apiEndPoint = $this->getUrl(); |
|
| 33 | + //echo $GLOBALS['lastPostId']; |
|
| 34 | + if ($this->getLastPostId() != "") { |
|
| 35 | 35 | $apiEndPoint = $this->getUrl() . '/location/?after=' . $this->getLastPostId(); |
| 36 | 36 | } |
| 37 | - return $apiEndPoint; |
|
| 38 | - } |
|
| 39 | - function getPayload() |
|
| 40 | - { |
|
| 41 | - return array( |
|
| 42 | - ); |
|
| 43 | - } |
|
| 44 | - function getMethod() |
|
| 45 | - { |
|
| 46 | - return 'GET'; |
|
| 47 | - } |
|
| 37 | + return $apiEndPoint; |
|
| 38 | + } |
|
| 39 | + function getPayload() |
|
| 40 | + { |
|
| 41 | + return array( |
|
| 42 | + ); |
|
| 43 | + } |
|
| 44 | + function getMethod() |
|
| 45 | + { |
|
| 46 | + return 'GET'; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -7,22 +7,22 @@ |
||
| 7 | 7 | |
| 8 | 8 | public $url; |
| 9 | 9 | |
| 10 | - function setUrl ($url) |
|
| 10 | + function setUrl($url) |
|
| 11 | 11 | { |
| 12 | 12 | $this->url = $url; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - function getUrl () |
|
| 15 | + function getUrl() |
|
| 16 | 16 | { |
| 17 | 17 | return $this->url; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - function setLastPostId ($lastPostId) |
|
| 20 | + function setLastPostId($lastPostId) |
|
| 21 | 21 | { |
| 22 | 22 | $this->lastPostId = $lastPostId; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - function getlastPostId () |
|
| 25 | + function getlastPostId() |
|
| 26 | 26 | { |
| 27 | 27 | return $this->lastPostId; |
| 28 | 28 | } |
@@ -3,19 +3,19 @@ |
||
| 3 | 3 | |
| 4 | 4 | class Upvote extends AbstractRequest { |
| 5 | 5 | |
| 6 | - function getApiEndPoint() |
|
| 7 | - { |
|
| 8 | - return '/v2/posts/' . $_GET['postID'] . '/upvote'; |
|
| 9 | - } |
|
| 10 | - function getPayload() |
|
| 11 | - { |
|
| 12 | - return array( |
|
| 6 | + function getApiEndPoint() |
|
| 7 | + { |
|
| 8 | + return '/v2/posts/' . $_GET['postID'] . '/upvote'; |
|
| 9 | + } |
|
| 10 | + function getPayload() |
|
| 11 | + { |
|
| 12 | + return array( |
|
| 13 | 13 | "reason_code" => -1, |
| 14 | - ); |
|
| 15 | - } |
|
| 16 | - function getMethod() |
|
| 17 | - { |
|
| 18 | - return 'PUT'; |
|
| 19 | - } |
|
| 14 | + ); |
|
| 15 | + } |
|
| 16 | + function getMethod() |
|
| 17 | + { |
|
| 18 | + return 'PUT'; |
|
| 19 | + } |
|
| 20 | 20 | } |
| 21 | 21 | |