@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $this->flags = array_merge($default_flags, $flags); |
78 | 78 | |
79 | 79 | $this->reference_time = time(); |
80 | - if ($reference_time !== null) { |
|
80 | + if($reference_time !== null) { |
|
81 | 81 | $this->reference_time = $reference_time; |
82 | 82 | } |
83 | 83 | |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | // If a cookie has both the Max-Age and the Expires attribute, the Max- |
98 | 98 | // Age attribute has precedence and controls the expiration date of the |
99 | 99 | // cookie. |
100 | - if (isset($this->attributes['max-age'])) { |
|
100 | + if(isset($this->attributes['max-age'])) { |
|
101 | 101 | $max_age = $this->attributes['max-age']; |
102 | 102 | return $max_age < $this->reference_time; |
103 | 103 | } |
104 | 104 | |
105 | - if (isset($this->attributes['expires'])) { |
|
105 | + if(isset($this->attributes['expires'])) { |
|
106 | 106 | $expires = $this->attributes['expires']; |
107 | 107 | return $expires < $this->reference_time; |
108 | 108 | } |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | * @return boolean Whether the cookie is valid for the given URI |
118 | 118 | */ |
119 | 119 | public function uri_matches(Requests_IRI $uri) { |
120 | - if (!$this->domain_matches($uri->host)) { |
|
120 | + if(!$this->domain_matches($uri->host)) { |
|
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | |
124 | - if (!$this->path_matches($uri->path)) { |
|
124 | + if(!$this->path_matches($uri->path)) { |
|
125 | 125 | return false; |
126 | 126 | } |
127 | 127 | |
@@ -135,37 +135,37 @@ discard block |
||
135 | 135 | * @return boolean Whether the cookie is valid for the given domain |
136 | 136 | */ |
137 | 137 | public function domain_matches($string) { |
138 | - if (!isset($this->attributes['domain'])) { |
|
138 | + if(!isset($this->attributes['domain'])) { |
|
139 | 139 | // Cookies created manually; cookies created by Requests will set |
140 | 140 | // the domain to the requested domain |
141 | 141 | return true; |
142 | 142 | } |
143 | 143 | |
144 | 144 | $domain_string = $this->attributes['domain']; |
145 | - if ($domain_string === $string) { |
|
145 | + if($domain_string === $string) { |
|
146 | 146 | // The domain string and the string are identical. |
147 | 147 | return true; |
148 | 148 | } |
149 | 149 | |
150 | 150 | // If the cookie is marked as host-only and we don't have an exact |
151 | 151 | // match, reject the cookie |
152 | - if ($this->flags['host-only'] === true) { |
|
152 | + if($this->flags['host-only'] === true) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | |
156 | - if (strlen($string) <= strlen($domain_string)) { |
|
156 | + if(strlen($string) <= strlen($domain_string)) { |
|
157 | 157 | // For obvious reasons, the string cannot be a suffix if the domain |
158 | 158 | // is shorter than the domain string |
159 | 159 | return false; |
160 | 160 | } |
161 | 161 | |
162 | - if (substr($string, -1 * strlen($domain_string)) !== $domain_string) { |
|
162 | + if(substr($string, -1 * strlen($domain_string)) !== $domain_string) { |
|
163 | 163 | // The domain string should be a suffix of the string. |
164 | 164 | return false; |
165 | 165 | } |
166 | 166 | |
167 | 167 | $prefix = substr($string, 0, strlen($string) - strlen($domain_string)); |
168 | - if (substr($prefix, -1) !== '.') { |
|
168 | + if(substr($prefix, -1) !== '.') { |
|
169 | 169 | // The last character of the string that is not included in the |
170 | 170 | // domain string should be a %x2E (".") character. |
171 | 171 | return false; |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | * @return boolean Whether the cookie is valid for the given path |
185 | 185 | */ |
186 | 186 | public function path_matches($request_path) { |
187 | - if (empty($request_path)) { |
|
187 | + if(empty($request_path)) { |
|
188 | 188 | // Normalize empty path to root |
189 | 189 | $request_path = '/'; |
190 | 190 | } |
191 | 191 | |
192 | - if (!isset($this->attributes['path'])) { |
|
192 | + if(!isset($this->attributes['path'])) { |
|
193 | 193 | // Cookies created manually; cookies created by Requests will set |
194 | 194 | // the path to the requested path |
195 | 195 | return true; |
@@ -197,19 +197,19 @@ discard block |
||
197 | 197 | |
198 | 198 | $cookie_path = $this->attributes['path']; |
199 | 199 | |
200 | - if ($cookie_path === $request_path) { |
|
200 | + if($cookie_path === $request_path) { |
|
201 | 201 | // The cookie-path and the request-path are identical. |
202 | 202 | return true; |
203 | 203 | } |
204 | 204 | |
205 | - if (strlen($request_path) > strlen($cookie_path) && substr($request_path, 0, strlen($cookie_path)) === $cookie_path) { |
|
206 | - if (substr($cookie_path, -1) === '/') { |
|
205 | + if(strlen($request_path) > strlen($cookie_path) && substr($request_path, 0, strlen($cookie_path)) === $cookie_path) { |
|
206 | + if(substr($cookie_path, -1) === '/') { |
|
207 | 207 | // The cookie-path is a prefix of the request-path, and the last |
208 | 208 | // character of the cookie-path is %x2F ("/"). |
209 | 209 | return true; |
210 | 210 | } |
211 | 211 | |
212 | - if (substr($request_path, strlen($cookie_path), 1) === '/') { |
|
212 | + if(substr($request_path, strlen($cookie_path), 1) === '/') { |
|
213 | 213 | // The cookie-path is a prefix of the request-path, and the |
214 | 214 | // first character of the request-path that is not included in |
215 | 215 | // the cookie-path is a %x2F ("/") character. |
@@ -226,15 +226,15 @@ discard block |
||
226 | 226 | * @return boolean Whether the cookie was successfully normalized |
227 | 227 | */ |
228 | 228 | public function normalize() { |
229 | - foreach ($this->attributes as $key => $value) { |
|
229 | + foreach($this->attributes as $key => $value) { |
|
230 | 230 | $orig_value = $value; |
231 | 231 | $value = $this->normalize_attribute($key, $value); |
232 | - if ($value === null) { |
|
232 | + if($value === null) { |
|
233 | 233 | unset($this->attributes[$key]); |
234 | 234 | continue; |
235 | 235 | } |
236 | 236 | |
237 | - if ($value !== $orig_value) { |
|
237 | + if($value !== $orig_value) { |
|
238 | 238 | $this->attributes[$key] = $value; |
239 | 239 | } |
240 | 240 | } |
@@ -252,15 +252,15 @@ discard block |
||
252 | 252 | * @return mixed Value if available, or null if the attribute value is invalid (and should be skipped) |
253 | 253 | */ |
254 | 254 | protected function normalize_attribute($name, $value) { |
255 | - switch (strtolower($name)) { |
|
255 | + switch(strtolower($name)) { |
|
256 | 256 | case 'expires': |
257 | 257 | // Expiration parsing, as per RFC 6265 section 5.2.1 |
258 | - if (is_int($value)) { |
|
258 | + if(is_int($value)) { |
|
259 | 259 | return $value; |
260 | 260 | } |
261 | 261 | |
262 | 262 | $expiry_time = strtotime($value); |
263 | - if ($expiry_time === false) { |
|
263 | + if($expiry_time === false) { |
|
264 | 264 | return null; |
265 | 265 | } |
266 | 266 | |
@@ -268,17 +268,17 @@ discard block |
||
268 | 268 | |
269 | 269 | case 'max-age': |
270 | 270 | // Expiration parsing, as per RFC 6265 section 5.2.2 |
271 | - if (is_int($value)) { |
|
271 | + if(is_int($value)) { |
|
272 | 272 | return $value; |
273 | 273 | } |
274 | 274 | |
275 | 275 | // Check that we have a valid age |
276 | - if (!preg_match('/^-?\d+$/', $value)) { |
|
276 | + if(!preg_match('/^-?\d+$/', $value)) { |
|
277 | 277 | return null; |
278 | 278 | } |
279 | 279 | |
280 | - $delta_seconds = (int) $value; |
|
281 | - if ($delta_seconds <= 0) { |
|
280 | + $delta_seconds = (int)$value; |
|
281 | + if($delta_seconds <= 0) { |
|
282 | 282 | $expiry_time = 0; |
283 | 283 | } |
284 | 284 | else { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | case 'domain': |
291 | 291 | // Domain normalization, as per RFC 6265 section 5.2.3 |
292 | - if ($value[0] === '.') { |
|
292 | + if($value[0] === '.') { |
|
293 | 293 | $value = substr($value, 1); |
294 | 294 | } |
295 | 295 | |
@@ -332,11 +332,11 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public function format_for_set_cookie() { |
334 | 334 | $header_value = $this->format_for_header(); |
335 | - if (!empty($this->attributes)) { |
|
335 | + if(!empty($this->attributes)) { |
|
336 | 336 | $parts = array(); |
337 | - foreach ($this->attributes as $key => $value) { |
|
337 | + foreach($this->attributes as $key => $value) { |
|
338 | 338 | // Ignore non-associative attributes |
339 | - if (is_numeric($key)) { |
|
339 | + if(is_numeric($key)) { |
|
340 | 340 | $parts[] = $value; |
341 | 341 | } |
342 | 342 | else { |
@@ -383,10 +383,10 @@ discard block |
||
383 | 383 | $parts = explode(';', $string); |
384 | 384 | $kvparts = array_shift($parts); |
385 | 385 | |
386 | - if (!empty($name)) { |
|
386 | + if(!empty($name)) { |
|
387 | 387 | $value = $string; |
388 | 388 | } |
389 | - elseif (strpos($kvparts, '=') === false) { |
|
389 | + elseif(strpos($kvparts, '=') === false) { |
|
390 | 390 | // Some sites might only have a value without the equals separator. |
391 | 391 | // Deviate from RFC 6265 and pretend it was actually a blank name |
392 | 392 | // (`=foo`) |
@@ -404,9 +404,9 @@ discard block |
||
404 | 404 | // Attribute key are handled case-insensitively |
405 | 405 | $attributes = new Requests_Utility_CaseInsensitiveDictionary(); |
406 | 406 | |
407 | - if (!empty($parts)) { |
|
408 | - foreach ($parts as $part) { |
|
409 | - if (strpos($part, '=') === false) { |
|
407 | + if(!empty($parts)) { |
|
408 | + foreach($parts as $part) { |
|
409 | + if(strpos($part, '=') === false) { |
|
410 | 410 | $part_key = $part; |
411 | 411 | $part_value = true; |
412 | 412 | } |
@@ -433,16 +433,16 @@ discard block |
||
433 | 433 | */ |
434 | 434 | public static function parse_from_headers(Requests_Response_Headers $headers, Requests_IRI $origin = null, $time = null) { |
435 | 435 | $cookie_headers = $headers->getValues('Set-Cookie'); |
436 | - if (empty($cookie_headers)) { |
|
436 | + if(empty($cookie_headers)) { |
|
437 | 437 | return array(); |
438 | 438 | } |
439 | 439 | |
440 | 440 | $cookies = array(); |
441 | - foreach ($cookie_headers as $header) { |
|
441 | + foreach($cookie_headers as $header) { |
|
442 | 442 | $parsed = self::parse($header, '', $time); |
443 | 443 | |
444 | 444 | // Default domain/path attributes |
445 | - if (empty($parsed->attributes['domain']) && !empty($origin)) { |
|
445 | + if(empty($parsed->attributes['domain']) && !empty($origin)) { |
|
446 | 446 | $parsed->attributes['domain'] = $origin->host; |
447 | 447 | $parsed->flags['host-only'] = true; |
448 | 448 | } |
@@ -451,17 +451,17 @@ discard block |
||
451 | 451 | } |
452 | 452 | |
453 | 453 | $path_is_valid = (!empty($parsed->attributes['path']) && $parsed->attributes['path'][0] === '/'); |
454 | - if (!$path_is_valid && !empty($origin)) { |
|
454 | + if(!$path_is_valid && !empty($origin)) { |
|
455 | 455 | $path = $origin->path; |
456 | 456 | |
457 | 457 | // Default path normalization as per RFC 6265 section 5.1.4 |
458 | - if (substr($path, 0, 1) !== '/') { |
|
458 | + if(substr($path, 0, 1) !== '/') { |
|
459 | 459 | // If the uri-path is empty or if the first character of |
460 | 460 | // the uri-path is not a %x2F ("/") character, output |
461 | 461 | // %x2F ("/") and skip the remaining steps. |
462 | 462 | $path = '/'; |
463 | 463 | } |
464 | - elseif (substr_count($path, '/') === 1) { |
|
464 | + elseif(substr_count($path, '/') === 1) { |
|
465 | 465 | // If the uri-path contains no more than one %x2F ("/") |
466 | 466 | // character, output %x2F ("/") and skip the remaining |
467 | 467 | // step. |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | } |
478 | 478 | |
479 | 479 | // Reject invalid cookie domains |
480 | - if (!empty($origin) && !$parsed->domain_matches($origin->host)) { |
|
480 | + if(!empty($origin) && !$parsed->domain_matches($origin->host)) { |
|
481 | 481 | continue; |
482 | 482 | } |
483 | 483 |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public static function autoloader($class) { |
139 | 139 | // Check that the class starts with "Requests" |
140 | - if (strpos($class, 'Requests') !== 0) { |
|
140 | + if(strpos($class, 'Requests') !== 0) { |
|
141 | 141 | return; |
142 | 142 | } |
143 | 143 | |
144 | 144 | $file = str_replace('_', '/', $class); |
145 | - if (file_exists(dirname(__FILE__) . '/' . $file . '.php')) { |
|
145 | + if(file_exists(dirname(__FILE__) . '/' . $file . '.php')) { |
|
146 | 146 | require_once(dirname(__FILE__) . '/' . $file . '.php'); |
147 | 147 | } |
148 | 148 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param string $transport Transport class to add, must support the Requests_Transport interface |
163 | 163 | */ |
164 | 164 | public static function add_transport($transport) { |
165 | - if (empty(self::$transports)) { |
|
165 | + if(empty(self::$transports)) { |
|
166 | 166 | self::$transports = array( |
167 | 167 | 'Requests_Transport_cURL', |
168 | 168 | 'Requests_Transport_fsockopen', |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | $cap_string = serialize($capabilities); |
187 | 187 | |
188 | 188 | // Don't search for a transport if it's already been done for these $capabilities |
189 | - if (isset(self::$transport[$cap_string]) && self::$transport[$cap_string] !== null) { |
|
189 | + if(isset(self::$transport[$cap_string]) && self::$transport[$cap_string] !== null) { |
|
190 | 190 | return new self::$transport[$cap_string](); |
191 | 191 | } |
192 | 192 | // @codeCoverageIgnoreEnd |
193 | 193 | |
194 | - if (empty(self::$transports)) { |
|
194 | + if(empty(self::$transports)) { |
|
195 | 195 | self::$transports = array( |
196 | 196 | 'Requests_Transport_cURL', |
197 | 197 | 'Requests_Transport_fsockopen', |
@@ -199,18 +199,18 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | // Find us a working transport |
202 | - foreach (self::$transports as $class) { |
|
203 | - if (!class_exists($class)) { |
|
202 | + foreach(self::$transports as $class) { |
|
203 | + if(!class_exists($class)) { |
|
204 | 204 | continue; |
205 | 205 | } |
206 | 206 | |
207 | 207 | $result = call_user_func(array($class, 'test'), $capabilities); |
208 | - if ($result) { |
|
208 | + if($result) { |
|
209 | 209 | self::$transport[$cap_string] = $class; |
210 | 210 | break; |
211 | 211 | } |
212 | 212 | } |
213 | - if (self::$transport[$cap_string] === null) { |
|
213 | + if(self::$transport[$cap_string] === null) { |
|
214 | 214 | throw new Requests_Exception('No working transports found', 'notransport', self::$transports); |
215 | 215 | } |
216 | 216 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * @return Requests_Response |
356 | 356 | */ |
357 | 357 | public static function request($url, $headers = array(), $data = array(), $type = self::GET, $options = array()) { |
358 | - if (empty($options['type'])) { |
|
358 | + if(empty($options['type'])) { |
|
359 | 359 | $options['type'] = $type; |
360 | 360 | } |
361 | 361 | $options = array_merge(self::get_default_options(), $options); |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | |
365 | 365 | $options['hooks']->dispatch('requests.before_request', array(&$url, &$headers, &$data, &$type, &$options)); |
366 | 366 | |
367 | - if (!empty($options['transport'])) { |
|
367 | + if(!empty($options['transport'])) { |
|
368 | 368 | $transport = $options['transport']; |
369 | 369 | |
370 | - if (is_string($options['transport'])) { |
|
370 | + if(is_string($options['transport'])) { |
|
371 | 371 | $transport = new $transport(); |
372 | 372 | } |
373 | 373 | } |
@@ -427,29 +427,29 @@ discard block |
||
427 | 427 | public static function request_multiple($requests, $options = array()) { |
428 | 428 | $options = array_merge(self::get_default_options(true), $options); |
429 | 429 | |
430 | - if (!empty($options['hooks'])) { |
|
430 | + if(!empty($options['hooks'])) { |
|
431 | 431 | $options['hooks']->register('transport.internal.parse_response', array('Requests', 'parse_multiple')); |
432 | - if (!empty($options['complete'])) { |
|
432 | + if(!empty($options['complete'])) { |
|
433 | 433 | $options['hooks']->register('multiple.request.complete', $options['complete']); |
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
437 | - foreach ($requests as $id => &$request) { |
|
438 | - if (!isset($request['headers'])) { |
|
437 | + foreach($requests as $id => &$request) { |
|
438 | + if(!isset($request['headers'])) { |
|
439 | 439 | $request['headers'] = array(); |
440 | 440 | } |
441 | - if (!isset($request['data'])) { |
|
441 | + if(!isset($request['data'])) { |
|
442 | 442 | $request['data'] = array(); |
443 | 443 | } |
444 | - if (!isset($request['type'])) { |
|
444 | + if(!isset($request['type'])) { |
|
445 | 445 | $request['type'] = self::GET; |
446 | 446 | } |
447 | - if (!isset($request['options'])) { |
|
447 | + if(!isset($request['options'])) { |
|
448 | 448 | $request['options'] = $options; |
449 | 449 | $request['options']['type'] = $request['type']; |
450 | 450 | } |
451 | 451 | else { |
452 | - if (empty($request['options']['type'])) { |
|
452 | + if(empty($request['options']['type'])) { |
|
453 | 453 | $request['options']['type'] = $request['type']; |
454 | 454 | } |
455 | 455 | $request['options'] = array_merge($options, $request['options']); |
@@ -458,19 +458,19 @@ discard block |
||
458 | 458 | self::set_defaults($request['url'], $request['headers'], $request['data'], $request['type'], $request['options']); |
459 | 459 | |
460 | 460 | // Ensure we only hook in once |
461 | - if ($request['options']['hooks'] !== $options['hooks']) { |
|
461 | + if($request['options']['hooks'] !== $options['hooks']) { |
|
462 | 462 | $request['options']['hooks']->register('transport.internal.parse_response', array('Requests', 'parse_multiple')); |
463 | - if (!empty($request['options']['complete'])) { |
|
463 | + if(!empty($request['options']['complete'])) { |
|
464 | 464 | $request['options']['hooks']->register('multiple.request.complete', $request['options']['complete']); |
465 | 465 | } |
466 | 466 | } |
467 | 467 | } |
468 | 468 | unset($request); |
469 | 469 | |
470 | - if (!empty($options['transport'])) { |
|
470 | + if(!empty($options['transport'])) { |
|
471 | 471 | $transport = $options['transport']; |
472 | 472 | |
473 | - if (is_string($options['transport'])) { |
|
473 | + if(is_string($options['transport'])) { |
|
474 | 474 | $transport = new $transport(); |
475 | 475 | } |
476 | 476 | } |
@@ -479,10 +479,10 @@ discard block |
||
479 | 479 | } |
480 | 480 | $responses = $transport->request_multiple($requests, $options); |
481 | 481 | |
482 | - foreach ($responses as $id => &$response) { |
|
482 | + foreach($responses as $id => &$response) { |
|
483 | 483 | // If our hook got messed with somehow, ensure we end up with the |
484 | 484 | // correct response |
485 | - if (is_string($response)) { |
|
485 | + if(is_string($response)) { |
|
486 | 486 | $request = $requests[$id]; |
487 | 487 | self::parse_multiple($response, $request); |
488 | 488 | $request['options']['hooks']->dispatch('multiple.request.complete', array(&$response, $id)); |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | 'verify' => Requests::get_certificate_path(), |
522 | 522 | 'verifyname' => true, |
523 | 523 | ); |
524 | - if ($multirequest !== false) { |
|
524 | + if($multirequest !== false) { |
|
525 | 525 | $defaults['complete'] = null; |
526 | 526 | } |
527 | 527 | return $defaults; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | * @return string Default certificate path. |
534 | 534 | */ |
535 | 535 | public static function get_certificate_path() { |
536 | - if ( ! empty( Requests::$certificate_path ) ) { |
|
536 | + if(!empty(Requests::$certificate_path)) { |
|
537 | 537 | return Requests::$certificate_path; |
538 | 538 | } |
539 | 539 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | * |
546 | 546 | * @param string $path Certificate path, pointing to a PEM file. |
547 | 547 | */ |
548 | - public static function set_certificate_path( $path ) { |
|
548 | + public static function set_certificate_path($path) { |
|
549 | 549 | Requests::$certificate_path = $path; |
550 | 550 | } |
551 | 551 | |
@@ -560,39 +560,39 @@ discard block |
||
560 | 560 | * @return array $options |
561 | 561 | */ |
562 | 562 | protected static function set_defaults(&$url, &$headers, &$data, &$type, &$options) { |
563 | - if (!preg_match('/^http(s)?:\/\//i', $url, $matches)) { |
|
563 | + if(!preg_match('/^http(s)?:\/\//i', $url, $matches)) { |
|
564 | 564 | throw new Requests_Exception('Only HTTP(S) requests are handled.', 'nonhttp', $url); |
565 | 565 | } |
566 | 566 | |
567 | - if (empty($options['hooks'])) { |
|
567 | + if(empty($options['hooks'])) { |
|
568 | 568 | $options['hooks'] = new Requests_Hooks(); |
569 | 569 | } |
570 | 570 | |
571 | - if (is_array($options['auth'])) { |
|
571 | + if(is_array($options['auth'])) { |
|
572 | 572 | $options['auth'] = new Requests_Auth_Basic($options['auth']); |
573 | 573 | } |
574 | - if ($options['auth'] !== false) { |
|
574 | + if($options['auth'] !== false) { |
|
575 | 575 | $options['auth']->register($options['hooks']); |
576 | 576 | } |
577 | 577 | |
578 | - if (is_string($options['proxy']) || is_array($options['proxy'])) { |
|
578 | + if(is_string($options['proxy']) || is_array($options['proxy'])) { |
|
579 | 579 | $options['proxy'] = new Requests_Proxy_HTTP($options['proxy']); |
580 | 580 | } |
581 | - if ($options['proxy'] !== false) { |
|
581 | + if($options['proxy'] !== false) { |
|
582 | 582 | $options['proxy']->register($options['hooks']); |
583 | 583 | } |
584 | 584 | |
585 | - if (is_array($options['cookies'])) { |
|
585 | + if(is_array($options['cookies'])) { |
|
586 | 586 | $options['cookies'] = new Requests_Cookie_Jar($options['cookies']); |
587 | 587 | } |
588 | - elseif (empty($options['cookies'])) { |
|
588 | + elseif(empty($options['cookies'])) { |
|
589 | 589 | $options['cookies'] = new Requests_Cookie_Jar(); |
590 | 590 | } |
591 | - if ($options['cookies'] !== false) { |
|
591 | + if($options['cookies'] !== false) { |
|
592 | 592 | $options['cookies']->register($options['hooks']); |
593 | 593 | } |
594 | 594 | |
595 | - if ($options['idn'] !== false) { |
|
595 | + if($options['idn'] !== false) { |
|
596 | 596 | $iri = new Requests_IRI($url); |
597 | 597 | $iri->host = Requests_IDNAEncoder::encode($iri->ihost); |
598 | 598 | $url = $iri->uri; |
@@ -601,8 +601,8 @@ discard block |
||
601 | 601 | // Massage the type to ensure we support it. |
602 | 602 | $type = strtoupper($type); |
603 | 603 | |
604 | - if (!isset($options['data_format'])) { |
|
605 | - if (in_array($type, array(self::HEAD, self::GET, self::DELETE))) { |
|
604 | + if(!isset($options['data_format'])) { |
|
605 | + if(in_array($type, array(self::HEAD, self::GET, self::DELETE))) { |
|
606 | 606 | $options['data_format'] = 'query'; |
607 | 607 | } |
608 | 608 | else { |
@@ -627,15 +627,15 @@ discard block |
||
627 | 627 | */ |
628 | 628 | protected static function parse_response($headers, $url, $req_headers, $req_data, $options) { |
629 | 629 | $return = new Requests_Response(); |
630 | - if (!$options['blocking']) { |
|
630 | + if(!$options['blocking']) { |
|
631 | 631 | return $return; |
632 | 632 | } |
633 | 633 | |
634 | 634 | $return->raw = $headers; |
635 | 635 | $return->url = $url; |
636 | 636 | |
637 | - if (!$options['filename']) { |
|
638 | - if (($pos = strpos($headers, "\r\n\r\n")) === false) { |
|
637 | + if(!$options['filename']) { |
|
638 | + if(($pos = strpos($headers, "\r\n\r\n")) === false) { |
|
639 | 639 | // Crap! |
640 | 640 | throw new Requests_Exception('Missing header/body separator', 'requests.no_crlf_separator'); |
641 | 641 | } |
@@ -652,44 +652,44 @@ discard block |
||
652 | 652 | $headers = preg_replace('/\n[ \t]/', ' ', $headers); |
653 | 653 | $headers = explode("\n", $headers); |
654 | 654 | preg_match('#^HTTP/(1\.\d)[ \t]+(\d+)#i', array_shift($headers), $matches); |
655 | - if (empty($matches)) { |
|
655 | + if(empty($matches)) { |
|
656 | 656 | throw new Requests_Exception('Response could not be parsed', 'noversion', $headers); |
657 | 657 | } |
658 | - $return->protocol_version = (float) $matches[1]; |
|
659 | - $return->status_code = (int) $matches[2]; |
|
660 | - if ($return->status_code >= 200 && $return->status_code < 300) { |
|
658 | + $return->protocol_version = (float)$matches[1]; |
|
659 | + $return->status_code = (int)$matches[2]; |
|
660 | + if($return->status_code >= 200 && $return->status_code < 300) { |
|
661 | 661 | $return->success = true; |
662 | 662 | } |
663 | 663 | |
664 | - foreach ($headers as $header) { |
|
664 | + foreach($headers as $header) { |
|
665 | 665 | list($key, $value) = explode(':', $header, 2); |
666 | 666 | $value = trim($value); |
667 | 667 | preg_replace('#(\s+)#i', ' ', $value); |
668 | 668 | $return->headers[$key] = $value; |
669 | 669 | } |
670 | - if (isset($return->headers['transfer-encoding'])) { |
|
670 | + if(isset($return->headers['transfer-encoding'])) { |
|
671 | 671 | $return->body = self::decode_chunked($return->body); |
672 | 672 | unset($return->headers['transfer-encoding']); |
673 | 673 | } |
674 | - if (isset($return->headers['content-encoding'])) { |
|
674 | + if(isset($return->headers['content-encoding'])) { |
|
675 | 675 | $return->body = self::decompress($return->body); |
676 | 676 | } |
677 | 677 | |
678 | 678 | //fsockopen and cURL compatibility |
679 | - if (isset($return->headers['connection'])) { |
|
679 | + if(isset($return->headers['connection'])) { |
|
680 | 680 | unset($return->headers['connection']); |
681 | 681 | } |
682 | 682 | |
683 | 683 | $options['hooks']->dispatch('requests.before_redirect_check', array(&$return, $req_headers, $req_data, $options)); |
684 | 684 | |
685 | - if ($return->is_redirect() && $options['follow_redirects'] === true) { |
|
686 | - if (isset($return->headers['location']) && $options['redirected'] < $options['redirects']) { |
|
687 | - if ($return->status_code === 303) { |
|
685 | + if($return->is_redirect() && $options['follow_redirects'] === true) { |
|
686 | + if(isset($return->headers['location']) && $options['redirected'] < $options['redirects']) { |
|
687 | + if($return->status_code === 303) { |
|
688 | 688 | $options['type'] = self::GET; |
689 | 689 | } |
690 | 690 | $options['redirected']++; |
691 | 691 | $location = $return->headers['location']; |
692 | - if (strpos($location, 'http://') !== 0 && strpos($location, 'https://') !== 0) { |
|
692 | + if(strpos($location, 'http://') !== 0 && strpos($location, 'https://') !== 0) { |
|
693 | 693 | // relative redirect, for compatibility make it absolute |
694 | 694 | $location = Requests_IRI::absolutize($url, $location); |
695 | 695 | $location = $location->uri; |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | $redirected->history[] = $return; |
708 | 708 | return $redirected; |
709 | 709 | } |
710 | - elseif ($options['redirected'] >= $options['redirects']) { |
|
710 | + elseif($options['redirected'] >= $options['redirects']) { |
|
711 | 711 | throw new Requests_Exception('Too many redirects', 'toomanyredirects', $return); |
712 | 712 | } |
713 | 713 | } |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | $options = $request['options']; |
737 | 737 | $response = self::parse_response($response, $url, $headers, $data, $options); |
738 | 738 | } |
739 | - catch (Requests_Exception $e) { |
|
739 | + catch(Requests_Exception $e) { |
|
740 | 740 | $response = $e; |
741 | 741 | } |
742 | 742 | } |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | * @return string Decoded body |
750 | 750 | */ |
751 | 751 | protected static function decode_chunked($data) { |
752 | - if (!preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', trim($data))) { |
|
752 | + if(!preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', trim($data))) { |
|
753 | 753 | return $data; |
754 | 754 | } |
755 | 755 | |
@@ -758,15 +758,15 @@ discard block |
||
758 | 758 | $decoded = ''; |
759 | 759 | $encoded = $data; |
760 | 760 | |
761 | - while (true) { |
|
762 | - $is_chunked = (bool) preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', $encoded, $matches); |
|
763 | - if (!$is_chunked) { |
|
761 | + while(true) { |
|
762 | + $is_chunked = (bool)preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', $encoded, $matches); |
|
763 | + if(!$is_chunked) { |
|
764 | 764 | // Looks like it's not chunked after all |
765 | 765 | return $data; |
766 | 766 | } |
767 | 767 | |
768 | 768 | $length = hexdec(trim($matches[1])); |
769 | - if ($length === 0) { |
|
769 | + if($length === 0) { |
|
770 | 770 | // Ignore trailer headers |
771 | 771 | return $decoded; |
772 | 772 | } |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | $decoded .= substr($encoded, $chunk_length, $length); |
776 | 776 | $encoded = substr($encoded, $chunk_length + $length + 2); |
777 | 777 | |
778 | - if (trim($encoded) === '0' || empty($encoded)) { |
|
778 | + if(trim($encoded) === '0' || empty($encoded)) { |
|
779 | 779 | return $decoded; |
780 | 780 | } |
781 | 781 | } |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | */ |
794 | 794 | public static function flatten($array) { |
795 | 795 | $return = array(); |
796 | - foreach ($array as $key => $value) { |
|
796 | + foreach($array as $key => $value) { |
|
797 | 797 | $return[] = sprintf('%s: %s', $key, $value); |
798 | 798 | } |
799 | 799 | return $return; |
@@ -821,21 +821,21 @@ discard block |
||
821 | 821 | * @return string Decompressed string |
822 | 822 | */ |
823 | 823 | public static function decompress($data) { |
824 | - if (substr($data, 0, 2) !== "\x1f\x8b" && substr($data, 0, 2) !== "\x78\x9c") { |
|
824 | + if(substr($data, 0, 2) !== "\x1f\x8b" && substr($data, 0, 2) !== "\x78\x9c") { |
|
825 | 825 | // Not actually compressed. Probably cURL ruining this for us. |
826 | 826 | return $data; |
827 | 827 | } |
828 | 828 | |
829 | - if (function_exists('gzdecode') && ($decoded = @gzdecode($data)) !== false) { |
|
829 | + if(function_exists('gzdecode') && ($decoded = @gzdecode($data)) !== false) { |
|
830 | 830 | return $decoded; |
831 | 831 | } |
832 | - elseif (function_exists('gzinflate') && ($decoded = @gzinflate($data)) !== false) { |
|
832 | + elseif(function_exists('gzinflate') && ($decoded = @gzinflate($data)) !== false) { |
|
833 | 833 | return $decoded; |
834 | 834 | } |
835 | - elseif (($decoded = self::compatible_gzinflate($data)) !== false) { |
|
835 | + elseif(($decoded = self::compatible_gzinflate($data)) !== false) { |
|
836 | 836 | return $decoded; |
837 | 837 | } |
838 | - elseif (function_exists('gzuncompress') && ($decoded = @gzuncompress($data)) !== false) { |
|
838 | + elseif(function_exists('gzuncompress') && ($decoded = @gzuncompress($data)) !== false) { |
|
839 | 839 | return $decoded; |
840 | 840 | } |
841 | 841 | |
@@ -865,26 +865,26 @@ discard block |
||
865 | 865 | public static function compatible_gzinflate($gzData) { |
866 | 866 | // Compressed data might contain a full zlib header, if so strip it for |
867 | 867 | // gzinflate() |
868 | - if (substr($gzData, 0, 3) == "\x1f\x8b\x08") { |
|
868 | + if(substr($gzData, 0, 3) == "\x1f\x8b\x08") { |
|
869 | 869 | $i = 10; |
870 | 870 | $flg = ord(substr($gzData, 3, 1)); |
871 | - if ($flg > 0) { |
|
872 | - if ($flg & 4) { |
|
871 | + if($flg > 0) { |
|
872 | + if($flg&4) { |
|
873 | 873 | list($xlen) = unpack('v', substr($gzData, $i, 2)); |
874 | 874 | $i = $i + 2 + $xlen; |
875 | 875 | } |
876 | - if ($flg & 8) { |
|
876 | + if($flg&8) { |
|
877 | 877 | $i = strpos($gzData, "\0", $i) + 1; |
878 | 878 | } |
879 | - if ($flg & 16) { |
|
879 | + if($flg&16) { |
|
880 | 880 | $i = strpos($gzData, "\0", $i) + 1; |
881 | 881 | } |
882 | - if ($flg & 2) { |
|
882 | + if($flg&2) { |
|
883 | 883 | $i = $i + 2; |
884 | 884 | } |
885 | 885 | } |
886 | 886 | $decompressed = self::compatible_gzinflate(substr($gzData, $i)); |
887 | - if (false !== $decompressed) { |
|
887 | + if(false !== $decompressed) { |
|
888 | 888 | return $decompressed; |
889 | 889 | } |
890 | 890 | } |
@@ -905,17 +905,17 @@ discard block |
||
905 | 905 | // First 2 bytes should be divisible by 0x1F |
906 | 906 | list(, $first_two_bytes) = unpack('n', $gzData); |
907 | 907 | |
908 | - if (0x08 == $first_nibble && 0 == ($first_two_bytes % 0x1F)) { |
|
908 | + if(0x08 == $first_nibble && 0 == ($first_two_bytes % 0x1F)) { |
|
909 | 909 | $huffman_encoded = true; |
910 | 910 | } |
911 | 911 | |
912 | - if ($huffman_encoded) { |
|
913 | - if (false !== ($decompressed = @gzinflate(substr($gzData, 2)))) { |
|
912 | + if($huffman_encoded) { |
|
913 | + if(false !== ($decompressed = @gzinflate(substr($gzData, 2)))) { |
|
914 | 914 | return $decompressed; |
915 | 915 | } |
916 | 916 | } |
917 | 917 | |
918 | - if ("\x50\x4b\x03\x04" == substr($gzData, 0, 4)) { |
|
918 | + if("\x50\x4b\x03\x04" == substr($gzData, 0, 4)) { |
|
919 | 919 | // ZIP file format header |
920 | 920 | // Offset 6: 2 bytes, General-purpose field |
921 | 921 | // Offset 26: 2 bytes, filename length |
@@ -927,9 +927,9 @@ discard block |
||
927 | 927 | // If the file has been compressed on the fly, 0x08 bit is set of |
928 | 928 | // the general purpose field. We can use this to differentiate |
929 | 929 | // between a compressed document, and a ZIP file |
930 | - $zip_compressed_on_the_fly = (0x08 == (0x08 & $general_purpose_flag)); |
|
930 | + $zip_compressed_on_the_fly = (0x08 == (0x08&$general_purpose_flag)); |
|
931 | 931 | |
932 | - if (!$zip_compressed_on_the_fly) { |
|
932 | + if(!$zip_compressed_on_the_fly) { |
|
933 | 933 | // Don't attempt to decode a compressed zip file |
934 | 934 | return $gzData; |
935 | 935 | } |
@@ -937,20 +937,20 @@ discard block |
||
937 | 937 | // Determine the first byte of data, based on the above ZIP header |
938 | 938 | // offsets: |
939 | 939 | $first_file_start = array_sum(unpack('v2', substr($gzData, 26, 4))); |
940 | - if (false !== ($decompressed = @gzinflate(substr($gzData, 30 + $first_file_start)))) { |
|
940 | + if(false !== ($decompressed = @gzinflate(substr($gzData, 30 + $first_file_start)))) { |
|
941 | 941 | return $decompressed; |
942 | 942 | } |
943 | 943 | return false; |
944 | 944 | } |
945 | 945 | |
946 | 946 | // Finally fall back to straight gzinflate |
947 | - if (false !== ($decompressed = @gzinflate($gzData))) { |
|
947 | + if(false !== ($decompressed = @gzinflate($gzData))) { |
|
948 | 948 | return $decompressed; |
949 | 949 | } |
950 | 950 | |
951 | 951 | // Fallback for all above failing, not expected, but included for |
952 | 952 | // debugging and preventing regressions and to track stats |
953 | - if (false !== ($decompressed = @gzinflate(substr($gzData, 2)))) { |
|
953 | + if(false !== ($decompressed = @gzinflate(substr($gzData, 2)))) { |
|
954 | 954 | return $decompressed; |
955 | 955 | } |
956 | 956 | |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | |
960 | 960 | public static function match_domain($host, $reference) { |
961 | 961 | // Check for a direct match |
962 | - if ($host === $reference) { |
|
962 | + if($host === $reference) { |
|
963 | 963 | return true; |
964 | 964 | } |
965 | 965 | |
@@ -967,10 +967,10 @@ discard block |
||
967 | 967 | // Also validates that the host has 3 parts or more, as per Firefox's |
968 | 968 | // ruleset. |
969 | 969 | $parts = explode('.', $host); |
970 | - if (ip2long($host) === false && count($parts) >= 3) { |
|
970 | + if(ip2long($host) === false && count($parts) >= 3) { |
|
971 | 971 | $parts[0] = '*'; |
972 | 972 | $wildcard = implode('.', $parts); |
973 | - if ($wildcard === $reference) { |
|
973 | + if($wildcard === $reference) { |
|
974 | 974 | return true; |
975 | 975 | } |
976 | 976 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | $config = parse_ini_file('config/config.ini.php'); |
4 | 4 | if(!isset($_GET['pw']) || $config['pw'] != $_GET['pw']) |
5 | 5 | { |
6 | - error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on admin.php'); |
|
6 | + error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on admin.php'); |
|
7 | 7 | die(); |
8 | 8 | } |
9 | 9 |
@@ -29,5 +29,5 @@ |
||
29 | 29 | * @see Requests_Hooks::register |
30 | 30 | * @param Requests_Hooks $hooks Hook system |
31 | 31 | */ |
32 | - public function register(Requests_Hooks &$hooks); |
|
32 | + public function register(Requests_Hooks&$hooks); |
|
33 | 33 | } |
34 | 34 | \ No newline at end of file |
@@ -37,7 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | $str = ''; |
39 | 39 | $max = mb_strlen($keyspace, '8bit') - 1; |
40 | - for ($i = 0; $i < $length; ++$i) { |
|
40 | + for($i = 0; $i < $length; ++$i) { |
|
41 | 41 | $str .= $keyspace[rand(0, $max)]; |
42 | 42 | } |
43 | 43 | return $str; |
@@ -11,22 +11,22 @@ discard block |
||
11 | 11 | public $url; |
12 | 12 | |
13 | 13 | |
14 | - function setUrl ($url) |
|
14 | + function setUrl($url) |
|
15 | 15 | { |
16 | 16 | $this->url = $url; |
17 | 17 | } |
18 | 18 | |
19 | - function getUrl () |
|
19 | + function getUrl() |
|
20 | 20 | { |
21 | 21 | return $this->url; |
22 | 22 | } |
23 | 23 | |
24 | - function setLastPostId ($lastPostId) |
|
24 | + function setLastPostId($lastPostId) |
|
25 | 25 | { |
26 | 26 | $this->lastPostId = $lastPostId; |
27 | 27 | } |
28 | 28 | |
29 | - function getlastPostId () |
|
29 | + function getlastPostId() |
|
30 | 30 | { |
31 | 31 | return $this->lastPostId; |
32 | 32 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $apiEndPoint = $this->getUrl(); |
37 | 37 | |
38 | - if ($this->getLastPostId() != "") { |
|
38 | + if($this->getLastPostId() != "") { |
|
39 | 39 | $apiEndPoint = $this->getUrl() . '?after=' . $this->getLastPostId(); |
40 | 40 | } |
41 | 41 | return $apiEndPoint; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | if(!isset($_COOKIE["JodelDeviceId"])) |
19 | 19 | { |
20 | 20 | $deviceUid = createAccount(); |
21 | - setcookie("JodelDeviceId", $deviceUid, time()+60*60*24*365*10); |
|
21 | + setcookie("JodelDeviceId", $deviceUid, time() + 60 * 60 * 24 * 365 * 10); |
|
22 | 22 | |
23 | 23 | } |
24 | 24 | else |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | if(isset($_GET['view'])) |
39 | 39 | { |
40 | - switch ($_GET['view']) { |
|
40 | + switch($_GET['view']) { |
|
41 | 41 | case 'comment': |
42 | 42 | $view = 'comment'; |
43 | 43 | break; |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | $view = 'time'; |
57 | 57 | } |
58 | 58 | |
59 | - if($view=='comment') |
|
59 | + if($view == 'comment') |
|
60 | 60 | { |
61 | 61 | $url = "/v2/posts/location/discussed/"; |
62 | 62 | } |
63 | 63 | else |
64 | 64 | { |
65 | - if($view=='upVote') |
|
65 | + if($view == 'upVote') |
|
66 | 66 | { |
67 | 67 | $url = "/v2/posts/location/popular/"; |
68 | 68 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | ?> |
83 | 83 | <div class="nextPosts"> |
84 | 84 | <?php |
85 | - for($i = 0; $i<$loops; $i++) |
|
85 | + for($i = 0; $i < $loops; $i++) |
|
86 | 86 | { |
87 | 87 | if(isset($posts[$i])) |
88 | 88 | { |
@@ -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: |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'proxy' => '186.103.169.165:8080', |
51 | 51 | );*/ |
52 | 52 | |
53 | - switch ($this->getMethod()) { |
|
53 | + switch($this->getMethod()) { |
|
54 | 54 | case 'POST': |
55 | 55 | $result = Requests::post($url, $header, $this->payLoad); |
56 | 56 | break; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $result = Requests::put($url, $header, $this->payLoad); |
69 | 69 | break; |
70 | 70 | } |
71 | - switch ($result->status_code) { |
|
71 | + switch($result->status_code) { |
|
72 | 72 | case 200: |
73 | 73 | $result = json_decode($result->body, true); |
74 | 74 | break; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | exit("Error 403: Access denied"); |
97 | 97 | break; |
98 | 98 | default: |
99 | - error_log('Error '.$result->status_code.' - Unauthorized'); // - JodelDeviceId:' . $deviceUid); |
|
99 | + error_log('Error ' . $result->status_code . ' - Unauthorized'); // - JodelDeviceId:' . $deviceUid); |
|
100 | 100 | //throw new \Exception('Unknown Error: '.$result->status_code); |
101 | 101 | } |
102 | 102 |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | if(!isset($_COOKIE['JodelDeviceId']) || !isDeviceUidInDatabase($db->real_escape_string($_COOKIE['JodelDeviceId']))) |
40 | 40 | { |
41 | 41 | $deviceUid = createAccount(); |
42 | - setcookie('JodelDeviceId', $deviceUid, time()+60*60*24*365*10); |
|
43 | - error_log('Created account with JodelDeviceId:' . $deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
|
42 | + setcookie('JodelDeviceId', $deviceUid, time() + 60 * 60 * 24 * 365 * 10); |
|
43 | + error_log('Created account with JodelDeviceId:' . $deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | else |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | //Set View |
62 | 62 | if(isset($_GET['view'])) |
63 | 63 | { |
64 | - switch ($_GET['view']) { |
|
64 | + switch($_GET['view']) { |
|
65 | 65 | case 'comment': |
66 | 66 | $view = 'comment'; |
67 | 67 | break; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | else |
120 | 120 | { |
121 | 121 | $newPositionStatus = $name; |
122 | - error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
122 | + error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | if(isset($_POST['color'])) |
173 | 173 | { |
174 | 174 | $color = $_POST['color']; |
175 | - switch ($color) { |
|
175 | + switch($color) { |
|
176 | 176 | case '8ABDB0': |
177 | 177 | $color = '8ABDB0'; |
178 | 178 | break; |
@@ -267,13 +267,13 @@ discard block |
||
267 | 267 | else |
268 | 268 | { |
269 | 269 | $version = 'v2'; |
270 | - if($view=='comment') |
|
270 | + if($view == 'comment') |
|
271 | 271 | { |
272 | 272 | $url = "/v2/posts/location/discussed/"; |
273 | 273 | } |
274 | 274 | else |
275 | 275 | { |
276 | - if($view=='upVote') |
|
276 | + if($view == 'upVote') |
|
277 | 277 | { |
278 | 278 | $url = "/v2/posts/location/popular/"; |
279 | 279 | } |
@@ -299,13 +299,13 @@ discard block |
||
299 | 299 | <!DOCTYPE html> |
300 | 300 | <html lang="en"> |
301 | 301 | <head> |
302 | - <title><?php echo getTitle($posts[0], $view, $isDetailedView);?></title> |
|
302 | + <title><?php echo getTitle($posts[0], $view, $isDetailedView); ?></title> |
|
303 | 303 | |
304 | 304 | <meta charset="utf-8"> |
305 | 305 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
306 | 306 | <meta http-equiv="x-ua-compatible" content="ie=edge"> |
307 | 307 | |
308 | - <meta name="description" content="<?php echo getMetaDescription($posts[0], $view, $isDetailedView);?>"> |
|
308 | + <meta name="description" content="<?php echo getMetaDescription($posts[0], $view, $isDetailedView); ?>"> |
|
309 | 309 | <meta name="keywords" content="jodelblue, jodel, blue, webclient, web, client, web-app, browser, app"> |
310 | 310 | |
311 | 311 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous"> |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | <content id="posts"> |
388 | 388 | <?php |
389 | - for($i = 0; $i<$loops; $i++) |
|
389 | + for($i = 0; $i < $loops; $i++) |
|
390 | 390 | { |
391 | 391 | if(array_key_exists($i, $posts) && array_key_exists('post_id', $posts[$i]) && isset($posts[$i]['post_id'])) |
392 | 392 | { |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
431 | 431 | <h2>Comment on Jodel</h2> |
432 | 432 | <form method="POST"> |
433 | - <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
|
433 | + <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" /> |
|
434 | 434 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
435 | 435 | <br /> |
436 | 436 | <input type="submit" value="SEND" /> |
@@ -467,13 +467,13 @@ discard block |
||
467 | 467 | <div class="col-xs-12"> |
468 | 468 | <div class="row"> |
469 | 469 | <div class="col-xs-3"> |
470 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
470 | + <a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
471 | 471 | </div> |
472 | 472 | <div class="col-xs-3"> |
473 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
473 | + <a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
474 | 474 | </div> |
475 | 475 | <div class="col-xs-3"> |
476 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
476 | + <a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
477 | 477 | </div> |
478 | 478 | <div class="col-xs-3"> |
479 | 479 | <nav> |