@@ -31,5 +31,5 @@ |
||
| 31 | 31 | * @see Requests_Hooks::register |
| 32 | 32 | * @param Requests_Hooks $hooks Hook system |
| 33 | 33 | */ |
| 34 | - public function register(Requests_Hooks &$hooks); |
|
| 34 | + public function register(Requests_Hooks&$hooks); |
|
| 35 | 35 | } |
| 36 | 36 | \ No newline at end of file |
@@ -20,7 +20,8 @@ |
||
| 20 | 20 | * @subpackage Proxy |
| 21 | 21 | * @since 1.6 |
| 22 | 22 | */ |
| 23 | -interface Requests_Proxy { |
|
| 23 | +interface Requests_Proxy |
|
| 24 | +{ |
|
| 24 | 25 | /** |
| 25 | 26 | * Register hooks as needed |
| 26 | 27 | * |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class Location{ |
|
| 3 | +class Location { |
|
| 4 | 4 | |
| 5 | 5 | public $cityName; |
| 6 | 6 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | $this->lng = $lng; |
| 39 | 39 | } |
| 40 | - public function toArray(){ |
|
| 40 | + public function toArray() { |
|
| 41 | 41 | return array( |
| 42 | 42 | "city" => $this->getCityName(), |
| 43 | 43 | "country" => 'DE', |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class Location{ |
|
| 3 | +class Location |
|
| 4 | +{ |
|
| 4 | 5 | |
| 5 | 6 | public $cityName; |
| 6 | 7 | |
@@ -37,7 +38,8 @@ discard block |
||
| 37 | 38 | { |
| 38 | 39 | $this->lng = $lng; |
| 39 | 40 | } |
| 40 | - public function toArray(){ |
|
| 41 | + public function toArray() |
|
| 42 | + { |
|
| 41 | 43 | return array( |
| 42 | 44 | "city" => $this->getCityName(), |
| 43 | 45 | "country" => 'DE', |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | } |
| 14 | 14 | $db = new DatabaseConnect(); |
| 15 | -if ($db->connect_errno) { |
|
| 15 | +if($db->connect_errno) { |
|
| 16 | 16 | echo 'Sorry, die Verbindung zu unserem superfetten endgeilen |
| 17 | 17 | Server ist hops gegangen. Wegen '.$db -> connect_error; |
| 18 | 18 | } |
@@ -12,7 +12,8 @@ |
||
| 12 | 12 | |
| 13 | 13 | } |
| 14 | 14 | $db = new DatabaseConnect(); |
| 15 | -if ($db->connect_errno) { |
|
| 15 | +if ($db->connect_errno) |
|
| 16 | +{ |
|
| 16 | 17 | echo 'Sorry, die Verbindung zu unserem superfetten endgeilen |
| 17 | 18 | Server ist hops gegangen. Wegen '.$db -> connect_error; |
| 18 | 19 | } |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | |
| 4 | -class GetKarma extends AbstractRequest { |
|
| 4 | +class GetKarma extends AbstractRequest |
|
| 5 | +{ |
|
| 5 | 6 | |
| 6 | 7 | function getApiEndPoint() |
| 7 | 8 | { |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | |
| 4 | -class SetLocation extends AbstractRequest { |
|
| 4 | +class SetLocation extends AbstractRequest |
|
| 5 | +{ |
|
| 5 | 6 | /** |
| 6 | 7 | * @var Location |
| 7 | 8 | */ |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | { |
| 37 | 37 | $str = ''; |
| 38 | 38 | $max = mb_strlen($keyspace, '8bit') - 1; |
| 39 | - for ($i = 0; $i < $length; ++$i) { |
|
| 39 | + for($i = 0; $i < $length; ++$i) { |
|
| 40 | 40 | $str .= $keyspace[random_int(0, $max)]; |
| 41 | 41 | } |
| 42 | 42 | return $str; |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class CreateUser extends AbstractRequest { |
|
| 3 | +class CreateUser extends AbstractRequest |
|
| 4 | +{ |
|
| 4 | 5 | /** |
| 5 | 6 | * @var Location |
| 6 | 7 | */ |
@@ -25,7 +26,7 @@ discard block |
||
| 25 | 26 | return $this->deviceUid; |
| 26 | 27 | } |
| 27 | 28 | public function setDeviceUid($deviceUid) |
| 28 | - { |
|
| 29 | + { |
|
| 29 | 30 | $this->deviceUid = $deviceUid; |
| 30 | 31 | } |
| 31 | 32 | public function generateDeviceUid() |
@@ -36,7 +37,8 @@ discard block |
||
| 36 | 37 | { |
| 37 | 38 | $str = ''; |
| 38 | 39 | $max = mb_strlen($keyspace, '8bit') - 1; |
| 39 | - for ($i = 0; $i < $length; ++$i) { |
|
| 40 | + for ($i = 0; $i < $length; ++$i) |
|
| 41 | + { |
|
| 40 | 42 | $str .= $keyspace[random_int(0, $max)]; |
| 41 | 43 | } |
| 42 | 44 | return $str; |
@@ -7,22 +7,22 @@ discard block |
||
| 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 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $apiEndPoint = $this->getUrl(); |
| 33 | 33 | //echo $GLOBALS['lastPostId']; |
| 34 | - if ($this->getLastPostId() != "") { |
|
| 34 | + if($this->getLastPostId() != "") { |
|
| 35 | 35 | $apiEndPoint = $this->getUrl() . '/location/?after=' . $this->getLastPostId(); |
| 36 | 36 | } |
| 37 | 37 | return $apiEndPoint; |
@@ -31,7 +31,8 @@ |
||
| 31 | 31 | { |
| 32 | 32 | $apiEndPoint = $this->getUrl(); |
| 33 | 33 | //echo $GLOBALS['lastPostId']; |
| 34 | - if ($this->getLastPostId() != "") { |
|
| 34 | + if ($this->getLastPostId() != "") |
|
| 35 | + { |
|
| 35 | 36 | $apiEndPoint = $this->getUrl() . '/location/?after=' . $this->getLastPostId(); |
| 36 | 37 | } |
| 37 | 38 | return $apiEndPoint; |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | |
| 4 | -class Upvote extends AbstractRequest { |
|
| 4 | +class Upvote extends AbstractRequest |
|
| 5 | +{ |
|
| 5 | 6 | |
| 6 | 7 | function getApiEndPoint() |
| 7 | 8 | { |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $header = $this->getSignHeaders(); |
| 29 | 29 | $url = $this->getFullUrl(); |
| 30 | 30 | |
| 31 | - if ($this->getAccessToken()) { |
|
| 31 | + if($this->getAccessToken()) { |
|
| 32 | 32 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
| 33 | 33 | } |
| 34 | 34 | //Comment out to debug the Request: |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | |
| 41 | 41 | |
| 42 | - switch ($this->getMethod()) { |
|
| 42 | + switch($this->getMethod()) { |
|
| 43 | 43 | case 'POST': |
| 44 | 44 | $result = Requests::post($url, $header, $this->payLoad); |
| 45 | 45 | break; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $result = Requests::put($url, $header, $this->payLoad); |
| 51 | 51 | break; |
| 52 | 52 | } |
| 53 | - switch ($result->status_code) { |
|
| 53 | + switch($result->status_code) { |
|
| 54 | 54 | case 200: |
| 55 | 55 | $result = json_decode($result->body, true); |
| 56 | 56 | break; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | throw new \Exception('Signing failed!'); |
| 68 | 68 | break; |
| 69 | 69 | default: |
| 70 | - throw new \Exception('Unknown Error: '.$result->status_code); |
|
| 70 | + throw new \Exception('Unknown Error: ' . $result->status_code); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if($device_uid != "") |
@@ -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 = "VwJHzYUbPjGiXWauoVNaHoCWsaacTmnkGwNtHhjy"; |
@@ -19,7 +19,8 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $this->payLoad = $this->getPayload(); |
| 21 | 21 | $device_uid = ""; |
| 22 | - if(isset($this->payLoad["device_uid"])) { |
|
| 22 | + if(isset($this->payLoad["device_uid"])) |
|
| 23 | + { |
|
| 23 | 24 | $device_uid = $this->payLoad["device_uid"]; |
| 24 | 25 | } |
| 25 | 26 | |
@@ -28,7 +29,8 @@ discard block |
||
| 28 | 29 | $header = $this->getSignHeaders(); |
| 29 | 30 | $url = $this->getFullUrl(); |
| 30 | 31 | |
| 31 | - if ($this->getAccessToken()) { |
|
| 32 | + if ($this->getAccessToken()) |
|
| 33 | + { |
|
| 32 | 34 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
| 33 | 35 | } |
| 34 | 36 | //Comment out to debug the Request: |
@@ -39,7 +41,8 @@ discard block |
||
| 39 | 41 | */ |
| 40 | 42 | |
| 41 | 43 | |
| 42 | - switch ($this->getMethod()) { |
|
| 44 | + switch ($this->getMethod()) |
|
| 45 | + { |
|
| 43 | 46 | case 'POST': |
| 44 | 47 | $result = Requests::post($url, $header, $this->payLoad); |
| 45 | 48 | break; |
@@ -50,7 +53,8 @@ discard block |
||
| 50 | 53 | $result = Requests::put($url, $header, $this->payLoad); |
| 51 | 54 | break; |
| 52 | 55 | } |
| 53 | - switch ($result->status_code) { |
|
| 56 | + switch ($result->status_code) |
|
| 57 | + { |
|
| 54 | 58 | case 200: |
| 55 | 59 | $result = json_decode($result->body, true); |
| 56 | 60 | break; |
@@ -90,10 +94,12 @@ discard block |
||
| 90 | 94 | public function getSignHeaders() |
| 91 | 95 | { |
| 92 | 96 | $payload_accessToken; |
| 93 | - if($this->getAccessToken() == null) { |
|
| 97 | + if($this->getAccessToken() == null) |
|
| 98 | + { |
|
| 94 | 99 | $payload_accessToken = ""; |
| 95 | 100 | } |
| 96 | - else { |
|
| 101 | + else |
|
| 102 | + { |
|
| 97 | 103 | $payload_accessToken = $this->getAccessToken(); |
| 98 | 104 | } |
| 99 | 105 | |