@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | const USERAGENT = 'Jodel/4.34.2 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )'; |
| 9 | 9 | const CLIENT_TYPE = 'android_4.34.2'; |
| 10 | 10 | |
| 11 | - private $accessToken = null; |
|
| 11 | + private $accessToken = NULL; |
|
| 12 | 12 | private $payLoad; |
| 13 | 13 | public $expects = ''; |
| 14 | 14 | public $version = 'v2'; |
@@ -72,25 +72,25 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | switch ($result->status_code) { |
| 74 | 74 | case 200: |
| 75 | - $result = json_decode($result->body, true); |
|
| 75 | + $result = json_decode($result->body, TRUE); |
|
| 76 | 76 | break; |
| 77 | 77 | case 204: |
| 78 | 78 | $result = "Success"; |
| 79 | 79 | break; |
| 80 | 80 | case 400: |
| 81 | 81 | error_log('Error 400 - Fehlerhafte Anfrage'); |
| 82 | - $result = json_decode($result->body, true); |
|
| 82 | + $result = json_decode($result->body, TRUE); |
|
| 83 | 83 | break; |
| 84 | 84 | case 401: |
| 85 | 85 | error_log('Error 401 - Unauthorized'); |
| 86 | - $result = json_decode($result->body, true); |
|
| 86 | + $result = json_decode($result->body, TRUE); |
|
| 87 | 87 | break; |
| 88 | 88 | case 404: |
| 89 | 89 | error_log('Error 404 - Es wurde bereits gevoted'); |
| 90 | - $result = json_decode($result->body, true); |
|
| 90 | + $result = json_decode($result->body, TRUE); |
|
| 91 | 91 | case 477: |
| 92 | 92 | error_log('Error 477 - Signing failed'); |
| 93 | - $result = json_decode($result->body, true); |
|
| 93 | + $result = json_decode($result->body, TRUE); |
|
| 94 | 94 | break; |
| 95 | 95 | case 429: |
| 96 | 96 | error_log('Error 429 - Too Many Requests'); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | break; |
| 103 | 103 | default: |
| 104 | 104 | error_log('Error '.$result->status_code.' - Unauthorized'); |
| 105 | - $result = json_decode($result->body, true); |
|
| 105 | + $result = json_decode($result->body, TRUE); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | //important for account refresh |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | private function getSignHeaders() |
| 126 | 126 | { |
| 127 | - if($this->getAccessToken() == null) { |
|
| 127 | + if($this->getAccessToken() == NULL) { |
|
| 128 | 128 | $payload_accessToken = ""; |
| 129 | 129 | } |
| 130 | 130 | else { |
@@ -364,7 +364,7 @@ |
||
| 364 | 364 | } |
| 365 | 365 | else |
| 366 | 366 | { |
| 367 | - error_log('Could not find Posts in: ' . $this->city . ' Error: ' . print_r($data, true)); |
|
| 367 | + error_log('Could not find Posts in: ' . $this->city . ' Error: ' . print_r($data, TRUE)); |
|
| 368 | 368 | //error_log(print_r($data, true)); |
| 369 | 369 | |
| 370 | 370 | $notFound[0] = array( |
@@ -51,16 +51,16 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($city) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
| 53 | 53 | $result = Requests::post($url); |
| 54 | - if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
|
| 54 | + if(json_decode($result->body, TRUE)['status'] == 'ZERO_RESULTS' || json_decode($result->body, TRUE)['status'] == 'INVALID_REQUEST') |
|
| 55 | 55 | { |
| 56 | 56 | error_log('Error locationEquals'); |
| 57 | 57 | return FALSE; |
| 58 | 58 | } |
| 59 | 59 | else |
| 60 | 60 | { |
| 61 | - $name = json_decode($result->body, true)['results']['0']['address_components']['0']['long_name']; |
|
| 62 | - $lat = json_decode($result->body, true)['results']['0']['geometry']['location']['lat']; |
|
| 63 | - $lng = json_decode($result->body, true)['results']['0']['geometry']['location']['lng']; |
|
| 61 | + $name = json_decode($result->body, TRUE)['results']['0']['address_components']['0']['long_name']; |
|
| 62 | + $lat = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lat']; |
|
| 63 | + $lng = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lng']; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $db = new DatabaseConnect(); |
@@ -104,15 +104,15 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
| 106 | 106 | $result = Requests::post($url); |
| 107 | - if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
|
| 107 | + if(json_decode($result->body, TRUE)['status'] == 'ZERO_RESULTS' || json_decode($result->body, TRUE)['status'] == 'INVALID_REQUEST') |
|
| 108 | 108 | { |
| 109 | 109 | return "0 results"; |
| 110 | 110 | } |
| 111 | 111 | else |
| 112 | 112 | { |
| 113 | - $name = json_decode($result->body, true)['results']['0']['address_components']['0']['long_name']; |
|
| 114 | - $lat = json_decode($result->body, true)['results']['0']['geometry']['location']['lat']; |
|
| 115 | - $lng = json_decode($result->body, true)['results']['0']['geometry']['location']['lng']; |
|
| 113 | + $name = json_decode($result->body, TRUE)['results']['0']['address_components']['0']['long_name']; |
|
| 114 | + $lat = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lat']; |
|
| 115 | + $lng = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lng']; |
|
| 116 | 116 | |
| 117 | 117 | $location = new Location(); |
| 118 | 118 | $location->setLat($lat); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | lng='" . $lng . "' |
| 135 | 135 | WHERE access_token='" . $this->accessToken . "'"); |
| 136 | 136 | |
| 137 | - if($result === false) |
|
| 137 | + if($result === FALSE) |
|
| 138 | 138 | { |
| 139 | 139 | echo "Updating location failed: (" . $db->errno . ") " . $db->error; |
| 140 | 140 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $accountCreator->postId = htmlspecialchars($postId); |
| 230 | 230 | $data = $accountCreator->execute(); |
| 231 | 231 | |
| 232 | - error_log('Could not vote: ' . print_r($data, true)); |
|
| 232 | + error_log('Could not vote: ' . print_r($data, TRUE)); |
|
| 233 | 233 | |
| 234 | 234 | if(array_key_exists('post', $data)) |
| 235 | 235 | { |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | else |
| 244 | 244 | { |
| 245 | - error_log('Could not vote: ' . print_r($data, true)); |
|
| 245 | + error_log('Could not vote: ' . print_r($data, TRUE)); |
|
| 246 | 246 | return FALSE; |
| 247 | 247 | } |
| 248 | 248 | } |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | if($data != 'Success') |
| 308 | 308 | { |
| 309 | - error_log('Could not set location befor Post: ' . print_r($data, true)); |
|
| 309 | + error_log('Could not set location befor Post: ' . print_r($data, TRUE)); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $accountCreator->location = $this->location; |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | $accountCreator->setAccessToken($this->accessToken); |
| 315 | 315 | $data = $accountCreator->execute(); |
| 316 | 316 | |
| 317 | - error_log(print_r($data, true)); |
|
| 317 | + error_log(print_r($data, TRUE)); |
|
| 318 | 318 | |
| 319 | 319 | if(isset($_POST['ancestor'])) |
| 320 | 320 | { |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | expiration_date='" . $expiration_date . "' |
| 373 | 373 | WHERE device_uid='" . $device_uid . "'"); |
| 374 | 374 | |
| 375 | - if($result === false){ |
|
| 375 | + if($result === FALSE){ |
|
| 376 | 376 | error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
| 377 | 377 | } |
| 378 | 378 | } |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')"); |
| 422 | 422 | |
| 423 | - if($result === false) |
|
| 423 | + if($result === FALSE) |
|
| 424 | 424 | { |
| 425 | 425 | $error = db_error(); |
| 426 | 426 | echo $error; |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
| 453 | 453 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
| 454 | 454 | |
| 455 | - if($result === false){ |
|
| 455 | + if($result === FALSE){ |
|
| 456 | 456 | $error = db_error(); |
| 457 | 457 | echo $error; |
| 458 | 458 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 485 | 485 | |
| 486 | 486 | $success = TRUE; |
| 487 | - if($result === false){ |
|
| 487 | + if($result === FALSE){ |
|
| 488 | 488 | $error = $db->error(); |
| 489 | 489 | echo $error; |
| 490 | 490 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |