@@ -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 = 'hFvMqLauMtnodakokftuKETbIsVLxpqfjAXiRoih'; |
@@ -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; |
@@ -73,7 +76,8 @@ discard block |
||
| 73 | 76 | |
| 74 | 77 | http_response_code($result->status_code); |
| 75 | 78 | |
| 76 | - switch ($result->status_code) { |
|
| 79 | + switch ($result->status_code) |
|
| 80 | + { |
|
| 77 | 81 | case 200: |
| 78 | 82 | $result = json_decode($result->body, true); |
| 79 | 83 | break; |
@@ -153,10 +157,12 @@ discard block |
||
| 153 | 157 | */ |
| 154 | 158 | private function getSignHeaders() |
| 155 | 159 | { |
| 156 | - if($this->getAccessToken() == null) { |
|
| 160 | + if($this->getAccessToken() == null) |
|
| 161 | + { |
|
| 157 | 162 | $payload_accessToken = ""; |
| 158 | 163 | } |
| 159 | - else { |
|
| 164 | + else |
|
| 165 | + { |
|
| 160 | 166 | $payload_accessToken = $this->getAccessToken(); |
| 161 | 167 | } |
| 162 | 168 | |
@@ -63,25 +63,25 @@ discard block |
||
| 63 | 63 | $timediff_inDays = (string)$timediff->format('%d'); |
| 64 | 64 | $timediff_inMonth = (string)$timediff->format('%m'); |
| 65 | 65 | |
| 66 | - if($timediff_inMonth!=0) |
|
| 66 | + if($timediff_inMonth != 0) |
|
| 67 | 67 | { |
| 68 | 68 | $timediff = $timediff_inMonth . "m"; |
| 69 | 69 | } |
| 70 | 70 | else |
| 71 | 71 | { |
| 72 | - if($timediff_inDays!=0) |
|
| 72 | + if($timediff_inDays != 0) |
|
| 73 | 73 | { |
| 74 | 74 | $timediff = $timediff_inDays . "d"; |
| 75 | 75 | } |
| 76 | 76 | else |
| 77 | 77 | { |
| 78 | - if($timediff_inHours!=0) |
|
| 78 | + if($timediff_inHours != 0) |
|
| 79 | 79 | { |
| 80 | 80 | $timediff = $timediff_inHours . "h"; |
| 81 | 81 | } |
| 82 | 82 | else |
| 83 | 83 | { |
| 84 | - if($timediff_inMinutes!=0) |
|
| 84 | + if($timediff_inMinutes != 0) |
|
| 85 | 85 | { |
| 86 | 86 | $timediff = $timediff_inMinutes . "m"; |
| 87 | 87 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | ?> |
| 98 | - <article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color'];?>;"> |
|
| 98 | + <article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color']; ?>;"> |
|
| 99 | 99 | <content> |
| 100 | 100 | <?php |
| 101 | 101 | if(isset($post['image_url'])) |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | ?> |
| 111 | 111 | </content> |
| 112 | 112 | <aside> |
| 113 | - <button onclick="vote('<?php echo $post['post_id'];?>', 'up', this)"> |
|
| 113 | + <button onclick="vote('<?php echo $post['post_id']; ?>', 'up', this)"> |
|
| 114 | 114 | <i class="fa fa-angle-up fa-3x"></i> |
| 115 | 115 | </button> |
| 116 | - <br><span><?php echo $post["vote_count"];?></span><br> |
|
| 116 | + <br><span><?php echo $post["vote_count"]; ?></span><br> |
|
| 117 | 117 | |
| 118 | - <button onclick="vote('<?php echo $post['post_id'];?>', 'down', this)"> |
|
| 118 | + <button onclick="vote('<?php echo $post['post_id']; ?>', 'down', this)"> |
|
| 119 | 119 | <i class="fa fa-angle-down fa-3x"></i> |
| 120 | 120 | </button> |
| 121 | 121 | </aside> |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | <span class="time"> |
| 127 | 127 | <span class="tip" data-tooltip="Time"> |
| 128 | 128 | <i class="fa fa-clock-o"></i> |
| 129 | - <?php echo $timediff;?> |
|
| 130 | - <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span> |
|
| 129 | + <?php echo $timediff; ?> |
|
| 130 | + <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s'); ?></span> |
|
| 131 | 131 | </span> |
| 132 | 132 | </span> |
| 133 | 133 | <?php if(!$this->isDetailedView) {?> |
| 134 | 134 | <span class="comments"> |
| 135 | 135 | <span data-tooltip="Comments"> |
| 136 | - <a href="<?php echo $this->changePostId($post['post_id'])->toUrl();?>"> |
|
| 136 | + <a href="<?php echo $this->changePostId($post['post_id'])->toUrl(); ?>"> |
|
| 137 | 137 | <i class="fa fa-commenting-o"></i> |
| 138 | 138 | <?php if(array_key_exists("child_count", $post)) |
| 139 | 139 | { |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | <span class="tip" data-tooltip="Distance"> |
| 176 | 176 | <i class="fa fa-map-marker"></i> |
| 177 | - <?php echo $post['distance'];?> km |
|
| 178 | - <span class="tiptext"><?php echo $post['location']['name'];?></span> |
|
| 177 | + <?php echo $post['distance']; ?> km |
|
| 178 | + <span class="tiptext"><?php echo $post['location']['name']; ?></span> |
|
| 179 | 179 | </span> |
| 180 | 180 | </span> |
| 181 | 181 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | if($post != '' && array_key_exists('message', $post) && $post['message'] != '' && $this->isDetailedView) |
| 216 | 216 | { |
| 217 | - $description = 'On JodelBlue in ' . htmlspecialchars($this->city) . ' with ' . htmlspecialchars($post['vote_count']) . ' Upvotes: ' . substr(htmlspecialchars($post['message']), 0, 130); |
|
| 217 | + $description = 'On JodelBlue in ' . htmlspecialchars($this->city) . ' with ' . htmlspecialchars($post['vote_count']) . ' Upvotes: ' . substr(htmlspecialchars($post['message']), 0, 130); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | return $description; |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | return $data['recent']; |
| 318 | 318 | } |
| 319 | - else if(array_key_exists('posts', $data)&& array_key_exists(0, $data['posts'])) |
|
| 319 | + else if(array_key_exists('posts', $data) && array_key_exists(0, $data['posts'])) |
|
| 320 | 320 | { |
| 321 | 321 | return $data['posts']; |
| 322 | 322 | } |