@@ -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 = 'cYjTAwjdJyiuXAyrMhkCDiVZhshhLhotNotLiPVu'; |
@@ -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; |
@@ -151,10 +155,12 @@ discard block |
||
| 151 | 155 | */ |
| 152 | 156 | private function getSignHeaders() |
| 153 | 157 | { |
| 154 | - if($this->getAccessToken() == null) { |
|
| 158 | + if($this->getAccessToken() == null) |
|
| 159 | + { |
|
| 155 | 160 | $payload_accessToken = ""; |
| 156 | 161 | } |
| 157 | - else { |
|
| 162 | + else |
|
| 163 | + { |
|
| 158 | 164 | $payload_accessToken = $this->getAccessToken(); |
| 159 | 165 | } |
| 160 | 166 | |
@@ -62,7 +62,8 @@ discard block |
||
| 62 | 62 | . "','" . $db->escape_string($_POST['device_uid']) |
| 63 | 63 | . "','" . $db->escape_string($_POST['rights']) . "')"); |
| 64 | 64 | |
| 65 | - if($result === false){ |
|
| 65 | + if($result === false) |
|
| 66 | + { |
|
| 66 | 67 | $error = db_error(); |
| 67 | 68 | error_log($error); |
| 68 | 69 | error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error); |
@@ -165,7 +166,9 @@ discard block |
||
| 165 | 166 | <div class="row"> |
| 166 | 167 | <article class="topContent col-12 col-sm-12"> |
| 167 | 168 | <content id="posts" class="adminpanel"> |
| 168 | - <?php if($userIsAdmin) { ?> |
|
| 169 | + <?php if($userIsAdmin) |
|
| 170 | +{ |
|
| 171 | +?> |
|
| 169 | 172 | <div class="row"> |
| 170 | 173 | <div class="col-md-12"> |
| 171 | 174 | <h2>Account management</h2> |
@@ -212,7 +215,8 @@ discard block |
||
| 212 | 215 | <?php |
| 213 | 216 | } |
| 214 | 217 | |
| 215 | - if($userIsVoter) { |
|
| 218 | + if($userIsVoter) |
|
| 219 | + { |
|
| 216 | 220 | ?> |
| 217 | 221 | <div class="row"> |
| 218 | 222 | <div class="col-12 col-sm-12"> |
@@ -232,7 +236,11 @@ discard block |
||
| 232 | 236 | </div> |
| 233 | 237 | <div class="form-group"> |
| 234 | 238 | <label for="postIdDelay">Post Id</label> |
| 235 | - <input placeholder="postId" class="form-control" id="postIdDelay" value="<?php if(isset($_GET['postId'])) echo $_GET['postId'];?>" type="text" name="postId"> |
|
| 239 | + <input placeholder="postId" class="form-control" id="postIdDelay" value="<?php if(isset($_GET['postId'])) |
|
| 240 | +{ |
|
| 241 | + echo $_GET['postId']; |
|
| 242 | +} |
|
| 243 | +?>" type="text" name="postId"> |
|
| 236 | 244 | </div> |
| 237 | 245 | <div class="row"> |
| 238 | 246 | <div class="col-6 col-sm-6"><button type="button" name="vote" value="up" class="half" onclick="voteWithAjax('up');">Upvote</button></div> |