@@ -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'; |
@@ -75,18 +75,18 @@ 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 | - $result = json_decode($result->body, true); |
|
89 | + $result = json_decode($result->body, TRUE); |
|
90 | 90 | |
91 | 91 | if(array_key_exists('error', $result) && $result['error'] == 'length') |
92 | 92 | { |
@@ -94,32 +94,32 @@ 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 | break; |
120 | 120 | case 503: |
121 | - error_log('Error 503 - ' . print_r($result, true)); |
|
122 | - $result = json_decode($result->body, true); |
|
121 | + error_log('Error 503 - ' . print_r($result, TRUE)); |
|
122 | + $result = json_decode($result->body, TRUE); |
|
123 | 123 | |
124 | 124 | if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable') |
125 | 125 | { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | break; |
129 | 129 | default: |
130 | 130 | error_log('Error '.$result->status_code.' - unknown error'); |
131 | - $result = json_decode($result->body, true); |
|
131 | + $result = json_decode($result->body, TRUE); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | //important for account refresh |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | private function getSignHeaders() |
152 | 152 | { |
153 | - if($this->getAccessToken() == null) { |
|
153 | + if($this->getAccessToken() == NULL) { |
|
154 | 154 | $payload_accessToken = ""; |
155 | 155 | } |
156 | 156 | else { |
@@ -93,16 +93,16 @@ discard block |
||
93 | 93 | { |
94 | 94 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($city) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
95 | 95 | $result = Requests::post($url); |
96 | - if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
|
96 | + if(json_decode($result->body, TRUE)['status'] == 'ZERO_RESULTS' || json_decode($result->body, TRUE)['status'] == 'INVALID_REQUEST') |
|
97 | 97 | { |
98 | 98 | error_log('Error locationEquals'); |
99 | 99 | return FALSE; |
100 | 100 | } |
101 | 101 | else |
102 | 102 | { |
103 | - $name = json_decode($result->body, true)['results']['0']['address_components']['0']['long_name']; |
|
104 | - $lat = json_decode($result->body, true)['results']['0']['geometry']['location']['lat']; |
|
105 | - $lng = json_decode($result->body, true)['results']['0']['geometry']['location']['lng']; |
|
103 | + $name = json_decode($result->body, TRUE)['results']['0']['address_components']['0']['long_name']; |
|
104 | + $lat = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lat']; |
|
105 | + $lng = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lng']; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | $db = new DatabaseConnect(); |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | { |
147 | 147 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
148 | 148 | $result = Requests::post($url); |
149 | - if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
|
149 | + if(json_decode($result->body, TRUE)['status'] == 'ZERO_RESULTS' || json_decode($result->body, TRUE)['status'] == 'INVALID_REQUEST') |
|
150 | 150 | { |
151 | 151 | return "0 results"; |
152 | 152 | } |
153 | 153 | else |
154 | 154 | { |
155 | - $name = json_decode($result->body, true)['results']['0']['address_components']['0']['long_name']; |
|
156 | - $lat = json_decode($result->body, true)['results']['0']['geometry']['location']['lat']; |
|
157 | - $lng = json_decode($result->body, true)['results']['0']['geometry']['location']['lng']; |
|
155 | + $name = json_decode($result->body, TRUE)['results']['0']['address_components']['0']['long_name']; |
|
156 | + $lat = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lat']; |
|
157 | + $lng = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lng']; |
|
158 | 158 | |
159 | 159 | $location = new Location(); |
160 | 160 | $location->setLat($lat); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | lng='" . $lng . "' |
177 | 177 | WHERE access_token='" . $this->accessToken . "'"); |
178 | 178 | |
179 | - if($result === false) |
|
179 | + if($result === FALSE) |
|
180 | 180 | { |
181 | 181 | echo "Updating location failed: (" . $db->errno . ") " . $db->error; |
182 | 182 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $accountCreator->postId = htmlspecialchars($postId); |
278 | 278 | $data = $accountCreator->execute(); |
279 | 279 | |
280 | - error_log('Could not vote: ' . print_r($data, true)); |
|
280 | + error_log('Could not vote: ' . print_r($data, TRUE)); |
|
281 | 281 | |
282 | 282 | if(array_key_exists('post', $data)) |
283 | 283 | { |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | } |
291 | 291 | else |
292 | 292 | { |
293 | - error_log('Could not vote: ' . print_r($data, true)); |
|
293 | + error_log('Could not vote: ' . print_r($data, TRUE)); |
|
294 | 294 | return FALSE; |
295 | 295 | } |
296 | 296 | } |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | |
356 | 356 | if($data != 'Success') |
357 | 357 | { |
358 | - error_log('Could not set location befor Post: ' . print_r($data, true)); |
|
358 | + error_log('Could not set location befor Post: ' . print_r($data, TRUE)); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | $accountCreator->location = $this->location; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | return $errorMsg; |
378 | 378 | } |
379 | 379 | |
380 | - error_log(print_r($data, true)); |
|
380 | + error_log(print_r($data, TRUE)); |
|
381 | 381 | |
382 | 382 | if(isset($_POST['ancestor'])) |
383 | 383 | { |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | expiration_date='" . $expiration_date . "' |
436 | 436 | WHERE device_uid='" . $device_uid . "'"); |
437 | 437 | |
438 | - if($result === false){ |
|
438 | + if($result === FALSE){ |
|
439 | 439 | error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
440 | 440 | } |
441 | 441 | } |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | |
484 | 484 | $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')"); |
485 | 485 | |
486 | - if($result === false) |
|
486 | + if($result === FALSE) |
|
487 | 487 | { |
488 | 488 | $error = db_error(); |
489 | 489 | echo $error; |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
516 | 516 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
517 | 517 | |
518 | - if($result === false){ |
|
518 | + if($result === FALSE){ |
|
519 | 519 | $error = db_error(); |
520 | 520 | echo $error; |
521 | 521 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
548 | 548 | |
549 | 549 | $success = TRUE; |
550 | - if($result === false){ |
|
550 | + if($result === FALSE){ |
|
551 | 551 | $error = $db->error(); |
552 | 552 | echo $error; |
553 | 553 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |