@@ -150,15 +150,15 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=' . $this->getGeocodingToken(); |
| 152 | 152 | $result = Requests::post($url); |
| 153 | - if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
|
| 153 | + if(json_decode($result->body, TRUE)['status'] == 'ZERO_RESULTS' || json_decode($result->body, TRUE)['status'] == 'INVALID_REQUEST') |
|
| 154 | 154 | { |
| 155 | 155 | return "0 results"; |
| 156 | 156 | } |
| 157 | 157 | else |
| 158 | 158 | { |
| 159 | - $name = json_decode($result->body, true)['results']['0']['address_components']['0']['long_name']; |
|
| 160 | - $lat = json_decode($result->body, true)['results']['0']['geometry']['location']['lat']; |
|
| 161 | - $lng = json_decode($result->body, true)['results']['0']['geometry']['location']['lng']; |
|
| 159 | + $name = json_decode($result->body, TRUE)['results']['0']['address_components']['0']['long_name']; |
|
| 160 | + $lat = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lat']; |
|
| 161 | + $lng = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lng']; |
|
| 162 | 162 | |
| 163 | 163 | $location = new Location(); |
| 164 | 164 | $location->setLat($lat); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | lng='" . $lng . "' |
| 181 | 181 | WHERE access_token='" . $this->accessToken . "'"); |
| 182 | 182 | |
| 183 | - if($result === false) |
|
| 183 | + if($result === FALSE) |
|
| 184 | 184 | { |
| 185 | 185 | echo "Updating location failed: (" . $db->errno . ") " . $db->error; |
| 186 | 186 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $accountCreator->postId = htmlspecialchars($postId); |
| 286 | 286 | $data = $accountCreator->execute(); |
| 287 | 287 | |
| 288 | - user_log('User voted: ' . print_r($data, true)); |
|
| 288 | + user_log('User voted: ' . print_r($data, TRUE)); |
|
| 289 | 289 | |
| 290 | 290 | if(array_key_exists('post', $data)) |
| 291 | 291 | { |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | else |
| 301 | 301 | { |
| 302 | - error_log('Could not vote: ' . print_r($data, true)); |
|
| 302 | + error_log('Could not vote: ' . print_r($data, TRUE)); |
|
| 303 | 303 | return FALSE; |
| 304 | 304 | } |
| 305 | 305 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | if($data != 'Success') |
| 368 | 368 | { |
| 369 | - error_log('Could not set location befor Post: ' . print_r($data, true)); |
|
| 369 | + error_log('Could not set location befor Post: ' . print_r($data, TRUE)); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | $accountCreator->location = $this->location; |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | return $errorMsg; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - user_log('User posted: ' . print_r($data, true)); |
|
| 391 | + user_log('User posted: ' . print_r($data, TRUE)); |
|
| 392 | 392 | |
| 393 | 393 | if(isset($_POST['ancestor'])) |
| 394 | 394 | { |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | expiration_date='" . $expiration_date . "' |
| 447 | 447 | WHERE device_uid='" . $device_uid . "'"); |
| 448 | 448 | |
| 449 | - if($result === false){ |
|
| 449 | + if($result === FALSE){ |
|
| 450 | 450 | error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
| 451 | 451 | } |
| 452 | 452 | } |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | |
| 495 | 495 | $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')"); |
| 496 | 496 | |
| 497 | - if($result === false) |
|
| 497 | + if($result === FALSE) |
|
| 498 | 498 | { |
| 499 | 499 | $error = db_error(); |
| 500 | 500 | echo $error; |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
| 527 | 527 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
| 528 | 528 | |
| 529 | - if($result === false){ |
|
| 529 | + if($result === FALSE){ |
|
| 530 | 530 | $error = db_error(); |
| 531 | 531 | echo $error; |
| 532 | 532 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 559 | 559 | |
| 560 | 560 | $success = TRUE; |
| 561 | - if($result === false){ |
|
| 561 | + if($result === FALSE){ |
|
| 562 | 562 | $error = $db->error(); |
| 563 | 563 | echo $error; |
| 564 | 564 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | const USERAGENT = 'Jodel/4.41.0 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )'; |
| 9 | 9 | const CLIENT_TYPE = 'android_4.41.0'; |
| 10 | 10 | |
| 11 | - private $accessToken = null; |
|
| 11 | + private $accessToken = NULL; |
|
| 12 | 12 | private $payLoad; |
| 13 | 13 | public $expects = ''; |
| 14 | 14 | public $version = 'v2'; |
@@ -75,15 +75,15 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | switch ($result->status_code) { |
| 77 | 77 | case 200: |
| 78 | - $result = json_decode($result->body, true); |
|
| 78 | + $result = json_decode($result->body, TRUE); |
|
| 79 | 79 | break; |
| 80 | 80 | case 204: |
| 81 | 81 | $result = 'Success'; |
| 82 | 82 | http_response_code(200); |
| 83 | 83 | break; |
| 84 | 84 | case 400: |
| 85 | - $result = json_decode($result->body, true); |
|
| 86 | - error_log('Error 400 - ' . print_r($result, true)); |
|
| 85 | + $result = json_decode($result->body, TRUE); |
|
| 86 | + error_log('Error 400 - ' . print_r($result, TRUE)); |
|
| 87 | 87 | break; |
| 88 | 88 | case 401: |
| 89 | 89 | //$result = json_decode($result->body, true); |
@@ -94,33 +94,33 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | else |
| 96 | 96 | { |
| 97 | - error_log('Error 401 - ' . print_r($result, true)); |
|
| 97 | + error_log('Error 401 - ' . print_r($result, TRUE)); |
|
| 98 | 98 | } |
| 99 | 99 | break; |
| 100 | 100 | case 404: |
| 101 | - error_log('Error 404 - ' . print_r($result, true)); |
|
| 102 | - $result = json_decode($result->body, true); |
|
| 101 | + error_log('Error 404 - ' . print_r($result, TRUE)); |
|
| 102 | + $result = json_decode($result->body, TRUE); |
|
| 103 | 103 | break; |
| 104 | 104 | case 477: |
| 105 | - $result = json_decode($result->body, true); |
|
| 106 | - error_log('Error 477 - ' . print_r($result, true)); |
|
| 105 | + $result = json_decode($result->body, TRUE); |
|
| 106 | + error_log('Error 477 - ' . print_r($result, TRUE)); |
|
| 107 | 107 | break; |
| 108 | 108 | case 429: |
| 109 | - error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true)); |
|
| 109 | + error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, TRUE), TRUE)); |
|
| 110 | 110 | exit("Error 429: Too Many Requests"); |
| 111 | 111 | break; |
| 112 | 112 | case 403: |
| 113 | - error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true)); |
|
| 114 | - $result = json_decode($result->body, true); |
|
| 113 | + error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, TRUE), TRUE)); |
|
| 114 | + $result = json_decode($result->body, TRUE); |
|
| 115 | 115 | break; |
| 116 | 116 | case 502: |
| 117 | - error_log('Error 502 - ' . print_r($result, true)); |
|
| 118 | - $result = json_decode($result->body, true); |
|
| 117 | + error_log('Error 502 - ' . print_r($result, TRUE)); |
|
| 118 | + $result = json_decode($result->body, TRUE); |
|
| 119 | 119 | header('location:'.$_SERVER['PHP_SELF']); |
| 120 | 120 | break; |
| 121 | 121 | case 503: |
| 122 | - error_log('Error 503 - ' . print_r($result, true)); |
|
| 123 | - $result = json_decode($result->body, true); |
|
| 122 | + error_log('Error 503 - ' . print_r($result, TRUE)); |
|
| 123 | + $result = json_decode($result->body, TRUE); |
|
| 124 | 124 | |
| 125 | 125 | if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable') |
| 126 | 126 | { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | break; |
| 130 | 130 | default: |
| 131 | 131 | error_log('Error '.$result->status_code.' - unknown error'); |
| 132 | - $result = json_decode($result->body, true); |
|
| 132 | + $result = json_decode($result->body, TRUE); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | //important for account refresh |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | private function getSignHeaders() |
| 155 | 155 | { |
| 156 | - if($this->getAccessToken() == null) { |
|
| 156 | + if($this->getAccessToken() == NULL) { |
|
| 157 | 157 | $payload_accessToken = ""; |
| 158 | 158 | } |
| 159 | 159 | else { |