@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | $this->refreshToken(); |
| 37 | 37 | } |
| 38 | - $this->accessToken = $this->getAccessToken(); |
|
| 38 | + $this->accessToken = $this->getAccessToken(); |
|
| 39 | 39 | |
| 40 | 40 | /* if($this->isAccountVerified() != 1) |
| 41 | 41 | { |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $db = new DatabaseConnect(); |
| 109 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 109 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 110 | 110 | |
| 111 | 111 | $location = new Location(); |
| 112 | 112 | |
| 113 | - if ($result->num_rows > 0) |
|
| 113 | + if($result->num_rows > 0) |
|
| 114 | 114 | { |
| 115 | 115 | // output data of each row |
| 116 | 116 | while($row = $result->fetch_assoc()) |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | else |
| 184 | 184 | { |
| 185 | - user_log('User with JodelDeviceId:' . $this->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 185 | + user_log('User with JodelDeviceId:' . $this->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
@@ -194,11 +194,11 @@ discard block |
||
| 194 | 194 | function getLocation() |
| 195 | 195 | { |
| 196 | 196 | $db = new DatabaseConnect(); |
| 197 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 197 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 198 | 198 | |
| 199 | 199 | $location = new Location(); |
| 200 | 200 | |
| 201 | - if ($result->num_rows > 0) |
|
| 201 | + if($result->num_rows > 0) |
|
| 202 | 202 | { |
| 203 | 203 | // output data of each row |
| 204 | 204 | while($row = $result->fetch_assoc()) |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | if(isset($_POST['color'])) |
| 322 | 322 | { |
| 323 | 323 | $color = $_POST['color']; |
| 324 | - switch ($color) { |
|
| 324 | + switch($color) { |
|
| 325 | 325 | case '8ABDB0': |
| 326 | 326 | $color = '8ABDB0'; |
| 327 | 327 | break; |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $db = new DatabaseConnect(); |
| 390 | 390 | $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
| 391 | 391 | |
| 392 | - if ($result->num_rows > 0) |
|
| 392 | + if($result->num_rows > 0) |
|
| 393 | 393 | { |
| 394 | 394 | // output data of each row |
| 395 | 395 | while($row = $result->fetch_assoc()) |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | expiration_date='" . $expiration_date . "' |
| 429 | 429 | WHERE device_uid='" . $device_uid . "'"); |
| 430 | 430 | |
| 431 | - if($result === false){ |
|
| 431 | + if($result === false) { |
|
| 432 | 432 | error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
| 433 | 433 | } |
| 434 | 434 | } |
@@ -438,11 +438,11 @@ discard block |
||
| 438 | 438 | function getAccessToken() |
| 439 | 439 | { |
| 440 | 440 | $db = new DatabaseConnect(); |
| 441 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 441 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 442 | 442 | |
| 443 | 443 | $accessToken; |
| 444 | 444 | |
| 445 | - if ($result->num_rows > 0) |
|
| 445 | + if($result->num_rows > 0) |
|
| 446 | 446 | { |
| 447 | 447 | // output data of each row |
| 448 | 448 | while($row = $result->fetch_assoc()) |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
| 509 | 509 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
| 510 | 510 | |
| 511 | - if($result === false){ |
|
| 511 | + if($result === false) { |
|
| 512 | 512 | $error = db_error(); |
| 513 | 513 | echo $error; |
| 514 | 514 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
@@ -536,11 +536,11 @@ discard block |
||
| 536 | 536 | $result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type, |
| 537 | 537 | expires_in, expiration_date, distinct_id, device_uid, name, lat, lng) |
| 538 | 538 | VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type . |
| 539 | - "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 539 | + "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 540 | 540 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 541 | 541 | |
| 542 | 542 | $success = TRUE; |
| 543 | - if($result === false){ |
|
| 543 | + if($result === false) { |
|
| 544 | 544 | $error = $db->error(); |
| 545 | 545 | echo $error; |
| 546 | 546 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $header = $this->getSignHeaders(); |
| 30 | 30 | $url = $this->getFullUrl(); |
| 31 | 31 | |
| 32 | - if ($this->getAccessToken()) { |
|
| 32 | + if($this->getAccessToken()) { |
|
| 33 | 33 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
| 34 | 34 | } |
| 35 | 35 | //Comment out to debug the Request: |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | 'proxy' => '186.103.169.165:8080', |
| 53 | 53 | );*/ |
| 54 | 54 | |
| 55 | - switch ($this->getMethod()) { |
|
| 55 | + switch($this->getMethod()) { |
|
| 56 | 56 | case 'POST': |
| 57 | 57 | $result = Requests::post($url, $header, $this->payLoad); |
| 58 | 58 | break; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $result = Requests::put($url, $header, $this->payLoad); |
| 71 | 71 | break; |
| 72 | 72 | } |
| 73 | - switch ($result->status_code) { |
|
| 73 | + switch($result->status_code) { |
|
| 74 | 74 | case 200: |
| 75 | 75 | $result = json_decode($result->body, true); |
| 76 | 76 | break; |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable"') |
| 109 | 109 | { |
| 110 | - header('location:'.$_SERVER['PHP_SELF']); |
|
| 110 | + header('location:' . $_SERVER['PHP_SELF']); |
|
| 111 | 111 | } |
| 112 | 112 | break; |
| 113 | 113 | default: |
| 114 | - error_log('Error '.$result->status_code.' - Unauthorized'); |
|
| 114 | + error_log('Error ' . $result->status_code . ' - Unauthorized'); |
|
| 115 | 115 | $result = json_decode($result->body, true); |
| 116 | 116 | } |
| 117 | 117 | |