@@ -32,6 +32,10 @@ |
||
32 | 32 | { |
33 | 33 | return $this->random_str(64, 'abcdef0123456789'); |
34 | 34 | } |
35 | + |
|
36 | + /** |
|
37 | + * @param integer $length |
|
38 | + */ |
|
35 | 39 | function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') |
36 | 40 | { |
37 | 41 | $str = ''; |
@@ -1,66 +1,66 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class CreateUser extends AbstractRequest { |
4 | - /** |
|
5 | - * @var Location |
|
6 | - */ |
|
7 | - public $location; |
|
8 | - public $deviceUid; |
|
9 | - /** |
|
10 | - * @return Location |
|
11 | - */ |
|
12 | - public function getLocation(): Location |
|
13 | - { |
|
14 | - return $this->location; |
|
15 | - } |
|
16 | - /** |
|
17 | - * @param Location $location |
|
18 | - */ |
|
19 | - public function setLocation(Location $location) |
|
20 | - { |
|
21 | - $this->location = $location; |
|
22 | - } |
|
23 | - public function getDeviceUid() |
|
24 | - { |
|
4 | + /** |
|
5 | + * @var Location |
|
6 | + */ |
|
7 | + public $location; |
|
8 | + public $deviceUid; |
|
9 | + /** |
|
10 | + * @return Location |
|
11 | + */ |
|
12 | + public function getLocation(): Location |
|
13 | + { |
|
14 | + return $this->location; |
|
15 | + } |
|
16 | + /** |
|
17 | + * @param Location $location |
|
18 | + */ |
|
19 | + public function setLocation(Location $location) |
|
20 | + { |
|
21 | + $this->location = $location; |
|
22 | + } |
|
23 | + public function getDeviceUid() |
|
24 | + { |
|
25 | 25 | return $this->deviceUid; |
26 | 26 | } |
27 | 27 | public function setDeviceUid($deviceUid) |
28 | - { |
|
28 | + { |
|
29 | 29 | $this->deviceUid = $deviceUid; |
30 | 30 | } |
31 | - public function generateDeviceUid() |
|
32 | - { |
|
33 | - return $this->random_str(64, 'abcdef0123456789'); |
|
34 | - } |
|
35 | - function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') |
|
36 | - { |
|
37 | - $str = ''; |
|
38 | - $max = mb_strlen($keyspace, '8bit') - 1; |
|
39 | - for ($i = 0; $i < $length; ++$i) { |
|
40 | - $str .= $keyspace[random_int(0, $max)]; |
|
41 | - } |
|
42 | - return $str; |
|
43 | - } |
|
44 | - function getApiEndPoint() |
|
45 | - { |
|
46 | - return '/v2/users'; |
|
47 | - } |
|
48 | - function getPayload() |
|
49 | - { |
|
31 | + public function generateDeviceUid() |
|
32 | + { |
|
33 | + return $this->random_str(64, 'abcdef0123456789'); |
|
34 | + } |
|
35 | + function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') |
|
36 | + { |
|
37 | + $str = ''; |
|
38 | + $max = mb_strlen($keyspace, '8bit') - 1; |
|
39 | + for ($i = 0; $i < $length; ++$i) { |
|
40 | + $str .= $keyspace[random_int(0, $max)]; |
|
41 | + } |
|
42 | + return $str; |
|
43 | + } |
|
44 | + function getApiEndPoint() |
|
45 | + { |
|
46 | + return '/v2/users'; |
|
47 | + } |
|
48 | + function getPayload() |
|
49 | + { |
|
50 | 50 | if(!isset($this->deviceUid)) |
51 | 51 | { |
52 | 52 | $this->setDeviceUid($this->generateDeviceUid()); |
53 | 53 | } |
54 | 54 | echo $this->getDeviceUid(); |
55 | - echo "<br>"; |
|
55 | + echo "<br>"; |
|
56 | 56 | return array( |
57 | 57 | "location" => $this->getLocation()->toArray(), |
58 | 58 | "client_id" => self::CLIENTID, |
59 | 59 | "device_uid" => $this->getDeviceUid(), |
60 | 60 | ); |
61 | - } |
|
62 | - function getMethod() |
|
63 | - { |
|
64 | - return 'POST'; |
|
65 | - } |
|
61 | + } |
|
62 | + function getMethod() |
|
63 | + { |
|
64 | + return 'POST'; |
|
65 | + } |
|
66 | 66 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | } |
48 | 48 | function getPayload() |
49 | 49 | { |
50 | - if(!isset($this->deviceUid)) |
|
50 | + if (!isset($this->deviceUid)) |
|
51 | 51 | { |
52 | 52 | $this->setDeviceUid($this->generateDeviceUid()); |
53 | 53 | } |
@@ -226,6 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | /** |
228 | 228 | * Send a GET request |
229 | + * @param string $url |
|
229 | 230 | */ |
230 | 231 | public static function get($url, $headers = array(), $options = array()) { |
231 | 232 | return self::request($url, $headers, null, self::GET, $options); |
@@ -263,12 +264,14 @@ discard block |
||
263 | 264 | */ |
264 | 265 | /** |
265 | 266 | * Send a POST request |
267 | + * @param string $url |
|
266 | 268 | */ |
267 | 269 | public static function post($url, $headers = array(), $data = array(), $options = array()) { |
268 | 270 | return self::request($url, $headers, $data, self::POST, $options); |
269 | 271 | } |
270 | 272 | /** |
271 | 273 | * Send a PUT request |
274 | + * @param string $url |
|
272 | 275 | */ |
273 | 276 | public static function put($url, $headers = array(), $data = array(), $options = array()) { |
274 | 277 | return self::request($url, $headers, $data, self::PUT, $options); |
@@ -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 | |
@@ -655,8 +655,8 @@ discard block |
||
655 | 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]; |
|
658 | + $return->protocol_version = (float)$matches[1]; |
|
659 | + $return->status_code = (int)$matches[2]; |
|
660 | 660 | if ($return->status_code >= 200 && $return->status_code < 300) { |
661 | 661 | $return->success = true; |
662 | 662 | } |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | $encoded = $data; |
760 | 760 | |
761 | 761 | while (true) { |
762 | - $is_chunked = (bool) preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', $encoded, $matches); |
|
762 | + $is_chunked = (bool)preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', $encoded, $matches); |
|
763 | 763 | if (!$is_chunked) { |
764 | 764 | // Looks like it's not chunked after all |
765 | 765 | return $data; |
@@ -869,17 +869,17 @@ discard block |
||
869 | 869 | $i = 10; |
870 | 870 | $flg = ord(substr($gzData, 3, 1)); |
871 | 871 | if ($flg > 0) { |
872 | - if ($flg & 4) { |
|
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 | } |
@@ -927,7 +927,7 @@ 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 | 932 | if (!$zip_compressed_on_the_fly) { |
933 | 933 | // Don't attempt to decode a compressed zip file |
@@ -370,8 +370,7 @@ discard block |
||
370 | 370 | if (is_string($options['transport'])) { |
371 | 371 | $transport = new $transport(); |
372 | 372 | } |
373 | - } |
|
374 | - else { |
|
373 | + } else { |
|
375 | 374 | $need_ssl = (0 === stripos($url, 'https://')); |
376 | 375 | $capabilities = array('ssl' => $need_ssl); |
377 | 376 | $transport = self::get_transport($capabilities); |
@@ -447,8 +446,7 @@ discard block |
||
447 | 446 | if (!isset($request['options'])) { |
448 | 447 | $request['options'] = $options; |
449 | 448 | $request['options']['type'] = $request['type']; |
450 | - } |
|
451 | - else { |
|
449 | + } else { |
|
452 | 450 | if (empty($request['options']['type'])) { |
453 | 451 | $request['options']['type'] = $request['type']; |
454 | 452 | } |
@@ -473,8 +471,7 @@ discard block |
||
473 | 471 | if (is_string($options['transport'])) { |
474 | 472 | $transport = new $transport(); |
475 | 473 | } |
476 | - } |
|
477 | - else { |
|
474 | + } else { |
|
478 | 475 | $transport = self::get_transport(); |
479 | 476 | } |
480 | 477 | $responses = $transport->request_multiple($requests, $options); |
@@ -584,8 +581,7 @@ discard block |
||
584 | 581 | |
585 | 582 | if (is_array($options['cookies'])) { |
586 | 583 | $options['cookies'] = new Requests_Cookie_Jar($options['cookies']); |
587 | - } |
|
588 | - elseif (empty($options['cookies'])) { |
|
584 | + } elseif (empty($options['cookies'])) { |
|
589 | 585 | $options['cookies'] = new Requests_Cookie_Jar(); |
590 | 586 | } |
591 | 587 | if ($options['cookies'] !== false) { |
@@ -604,8 +600,7 @@ discard block |
||
604 | 600 | if (!isset($options['data_format'])) { |
605 | 601 | if (in_array($type, array(self::HEAD, self::GET, self::DELETE))) { |
606 | 602 | $options['data_format'] = 'query'; |
607 | - } |
|
608 | - else { |
|
603 | + } else { |
|
609 | 604 | $options['data_format'] = 'body'; |
610 | 605 | } |
611 | 606 | } |
@@ -642,8 +637,7 @@ discard block |
||
642 | 637 | |
643 | 638 | $headers = substr($return->raw, 0, $pos); |
644 | 639 | $return->body = substr($return->raw, $pos + strlen("\n\r\n\r")); |
645 | - } |
|
646 | - else { |
|
640 | + } else { |
|
647 | 641 | $return->body = ''; |
648 | 642 | } |
649 | 643 | // Pretend CRLF = LF for compatibility (RFC 2616, section 19.3) |
@@ -706,8 +700,7 @@ discard block |
||
706 | 700 | $redirected = self::request($location, $req_headers, $req_data, $options['type'], $options); |
707 | 701 | $redirected->history[] = $return; |
708 | 702 | return $redirected; |
709 | - } |
|
710 | - elseif ($options['redirected'] >= $options['redirects']) { |
|
703 | + } elseif ($options['redirected'] >= $options['redirects']) { |
|
711 | 704 | throw new Requests_Exception('Too many redirects', 'toomanyredirects', $return); |
712 | 705 | } |
713 | 706 | } |
@@ -735,8 +728,7 @@ discard block |
||
735 | 728 | $data = $request['data']; |
736 | 729 | $options = $request['options']; |
737 | 730 | $response = self::parse_response($response, $url, $headers, $data, $options); |
738 | - } |
|
739 | - catch (Requests_Exception $e) { |
|
731 | + } catch (Requests_Exception $e) { |
|
740 | 732 | $response = $e; |
741 | 733 | } |
742 | 734 | } |
@@ -828,14 +820,11 @@ discard block |
||
828 | 820 | |
829 | 821 | if (function_exists('gzdecode') && ($decoded = @gzdecode($data)) !== false) { |
830 | 822 | return $decoded; |
831 | - } |
|
832 | - elseif (function_exists('gzinflate') && ($decoded = @gzinflate($data)) !== false) { |
|
823 | + } elseif (function_exists('gzinflate') && ($decoded = @gzinflate($data)) !== false) { |
|
833 | 824 | return $decoded; |
834 | - } |
|
835 | - elseif (($decoded = self::compatible_gzinflate($data)) !== false) { |
|
825 | + } elseif (($decoded = self::compatible_gzinflate($data)) !== false) { |
|
836 | 826 | return $decoded; |
837 | - } |
|
838 | - elseif (function_exists('gzuncompress') && ($decoded = @gzuncompress($data)) !== false) { |
|
827 | + } elseif (function_exists('gzuncompress') && ($decoded = @gzuncompress($data)) !== false) { |
|
839 | 828 | return $decoded; |
840 | 829 | } |
841 | 830 |
@@ -357,7 +357,7 @@ |
||
357 | 357 | * @param int $delta |
358 | 358 | * @param int $numpoints |
359 | 359 | * @param bool $firsttime |
360 | - * @return int New bias |
|
360 | + * @return double New bias |
|
361 | 361 | */ |
362 | 362 | protected static function adapt($delta, $numpoints, $firsttime) { |
363 | 363 | # function adapt(delta,numpoints,firsttime): |
@@ -145,26 +145,26 @@ discard block |
||
145 | 145 | $value = ord($input[$position]); |
146 | 146 | |
147 | 147 | // One byte sequence: |
148 | - if ((~$value & 0x80) === 0x80) { |
|
148 | + if ((~$value&0x80) === 0x80) { |
|
149 | 149 | $character = $value; |
150 | 150 | $length = 1; |
151 | 151 | $remaining = 0; |
152 | 152 | } |
153 | 153 | // Two byte sequence: |
154 | - elseif (($value & 0xE0) === 0xC0) { |
|
155 | - $character = ($value & 0x1F) << 6; |
|
154 | + elseif (($value&0xE0) === 0xC0) { |
|
155 | + $character = ($value&0x1F) << 6; |
|
156 | 156 | $length = 2; |
157 | 157 | $remaining = 1; |
158 | 158 | } |
159 | 159 | // Three byte sequence: |
160 | - elseif (($value & 0xF0) === 0xE0) { |
|
161 | - $character = ($value & 0x0F) << 12; |
|
160 | + elseif (($value&0xF0) === 0xE0) { |
|
161 | + $character = ($value&0x0F) << 12; |
|
162 | 162 | $length = 3; |
163 | 163 | $remaining = 2; |
164 | 164 | } |
165 | 165 | // Four byte sequence: |
166 | - elseif (($value & 0xF8) === 0xF0) { |
|
167 | - $character = ($value & 0x07) << 18; |
|
166 | + elseif (($value&0xF8) === 0xF0) { |
|
167 | + $character = ($value&0x07) << 18; |
|
168 | 168 | $length = 4; |
169 | 169 | $remaining = 3; |
170 | 170 | } |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | $value = ord($input[$position]); |
182 | 182 | |
183 | 183 | // If it is invalid, count the sequence as invalid and reprocess the current byte: |
184 | - if (($value & 0xC0) !== 0x80) { |
|
184 | + if (($value&0xC0) !== 0x80) { |
|
185 | 185 | throw new Requests_Exception('Invalid Unicode codepoint', 'idna.invalidcodepoint', $character); |
186 | 186 | } |
187 | 187 | |
188 | - $character |= ($value & 0x3F) << (--$remaining * 6); |
|
188 | + $character |= ($value&0x3F) << (--$remaining * 6); |
|
189 | 189 | } |
190 | 190 | $position--; |
191 | 191 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | || $length > 3 && $character <= 0xFFFF |
198 | 198 | // Outside of range of ucschar codepoints |
199 | 199 | // Noncharacters |
200 | - || ($character & 0xFFFE) === 0xFFFE |
|
200 | + || ($character&0xFFFE) === 0xFFFE |
|
201 | 201 | || $character >= 0xFDD0 && $character <= 0xFDEF |
202 | 202 | || ( |
203 | 203 | // Everything else not in ucschar |
@@ -291,11 +291,9 @@ |
||
291 | 291 | # tmax if k >= bias + tmax, or k - bias otherwise |
292 | 292 | if ($k <= ($bias + self::BOOTSTRAP_TMIN)) { |
293 | 293 | $t = self::BOOTSTRAP_TMIN; |
294 | - } |
|
295 | - elseif ($k >= ($bias + self::BOOTSTRAP_TMAX)) { |
|
294 | + } elseif ($k >= ($bias + self::BOOTSTRAP_TMAX)) { |
|
296 | 295 | $t = self::BOOTSTRAP_TMAX; |
297 | - } |
|
298 | - else { |
|
296 | + } else { |
|
299 | 297 | $t = $k - $bias; |
300 | 298 | } |
301 | 299 | # if q < t then break |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * |
250 | 250 | * Returns false if $base is not absolute, otherwise an IRI. |
251 | 251 | * |
252 | - * @param IRI|string $base (Absolute) Base IRI |
|
252 | + * @param string $base (Absolute) Base IRI |
|
253 | 253 | * @param IRI|string $relative Relative IRI |
254 | 254 | * @return IRI|false |
255 | 255 | */ |
@@ -984,6 +984,7 @@ discard block |
||
984 | 984 | * Convert an IRI to a URI (or parts thereof) |
985 | 985 | * |
986 | 986 | * @param string|bool IRI to convert (or false from {@see get_iri}) |
987 | + * @param false|string $string |
|
987 | 988 | * @return string|false URI if IRI is valid, false otherwise. |
988 | 989 | */ |
989 | 990 | protected function to_uri($string) { |
@@ -442,20 +442,20 @@ discard block |
||
442 | 442 | |
443 | 443 | // No one byte sequences are valid due to the while. |
444 | 444 | // Two byte sequence: |
445 | - if (($value & 0xE0) === 0xC0) { |
|
446 | - $character = ($value & 0x1F) << 6; |
|
445 | + if (($value&0xE0) === 0xC0) { |
|
446 | + $character = ($value&0x1F) << 6; |
|
447 | 447 | $length = 2; |
448 | 448 | $remaining = 1; |
449 | 449 | } |
450 | 450 | // Three byte sequence: |
451 | - elseif (($value & 0xF0) === 0xE0) { |
|
452 | - $character = ($value & 0x0F) << 12; |
|
451 | + elseif (($value&0xF0) === 0xE0) { |
|
452 | + $character = ($value&0x0F) << 12; |
|
453 | 453 | $length = 3; |
454 | 454 | $remaining = 2; |
455 | 455 | } |
456 | 456 | // Four byte sequence: |
457 | - elseif (($value & 0xF8) === 0xF0) { |
|
458 | - $character = ($value & 0x07) << 18; |
|
457 | + elseif (($value&0xF8) === 0xF0) { |
|
458 | + $character = ($value&0x07) << 18; |
|
459 | 459 | $length = 4; |
460 | 460 | $remaining = 3; |
461 | 461 | } |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | $value = ord($string[$position]); |
473 | 473 | |
474 | 474 | // Check that the byte is valid, then add it to the character: |
475 | - if (($value & 0xC0) === 0x80) { |
|
476 | - $character |= ($value & 0x3F) << (--$remaining * 6); |
|
475 | + if (($value&0xC0) === 0x80) { |
|
476 | + $character |= ($value&0x3F) << (--$remaining * 6); |
|
477 | 477 | } |
478 | 478 | // If it is invalid, count the sequence as invalid and reprocess the current byte: |
479 | 479 | else { |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | || $length > 3 && $character <= 0xFFFF |
500 | 500 | // Outside of range of ucschar codepoints |
501 | 501 | // Noncharacters |
502 | - || ($character & 0xFFFE) === 0xFFFE |
|
502 | + || ($character&0xFFFE) === 0xFFFE |
|
503 | 503 | || $character >= 0xFDD0 && $character <= 0xFDEF |
504 | 504 | || ( |
505 | 505 | // Everything else not in ucschar |
@@ -569,20 +569,20 @@ discard block |
||
569 | 569 | $length = 1; |
570 | 570 | } |
571 | 571 | // Two byte sequence: |
572 | - elseif (($value & 0xE0) === 0xC0) { |
|
573 | - $character = ($value & 0x1F) << 6; |
|
572 | + elseif (($value&0xE0) === 0xC0) { |
|
573 | + $character = ($value&0x1F) << 6; |
|
574 | 574 | $length = 2; |
575 | 575 | $remaining = 1; |
576 | 576 | } |
577 | 577 | // Three byte sequence: |
578 | - elseif (($value & 0xF0) === 0xE0) { |
|
579 | - $character = ($value & 0x0F) << 12; |
|
578 | + elseif (($value&0xF0) === 0xE0) { |
|
579 | + $character = ($value&0x0F) << 12; |
|
580 | 580 | $length = 3; |
581 | 581 | $remaining = 2; |
582 | 582 | } |
583 | 583 | // Four byte sequence: |
584 | - elseif (($value & 0xF8) === 0xF0) { |
|
585 | - $character = ($value & 0x07) << 18; |
|
584 | + elseif (($value&0xF8) === 0xF0) { |
|
585 | + $character = ($value&0x07) << 18; |
|
586 | 586 | $length = 4; |
587 | 587 | $remaining = 3; |
588 | 588 | } |
@@ -595,9 +595,9 @@ discard block |
||
595 | 595 | // Continuation byte: |
596 | 596 | else { |
597 | 597 | // Check that the byte is valid, then add it to the character: |
598 | - if (($value & 0xC0) === 0x80) { |
|
598 | + if (($value&0xC0) === 0x80) { |
|
599 | 599 | $remaining--; |
600 | - $character |= ($value & 0x3F) << ($remaining * 6); |
|
600 | + $character |= ($value&0x3F) << ($remaining * 6); |
|
601 | 601 | } |
602 | 602 | // If it is invalid, count the sequence as invalid and reprocess the current byte as the start of a sequence: |
603 | 603 | else { |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | || $character < 0x2D |
622 | 622 | || $character > 0xEFFFD |
623 | 623 | // Noncharacters |
624 | - || ($character & 0xFFFE) === 0xFFFE |
|
624 | + || ($character&0xFFFE) === 0xFFFE |
|
625 | 625 | || $character >= 0xFDD0 && $character <= 0xFDEF |
626 | 626 | // Everything else not in iunreserved (this is all BMP) |
627 | 627 | || $character === 0x2F |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | return $return; |
732 | 732 | } |
733 | 733 | |
734 | - $parsed = $this->parse_iri((string) $iri); |
|
734 | + $parsed = $this->parse_iri((string)$iri); |
|
735 | 735 | |
736 | 736 | $return = $this->set_scheme($parsed['scheme']) |
737 | 737 | && $this->set_authority($parsed['authority']) |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | } |
910 | 910 | |
911 | 911 | if (strspn($port, '0123456789') === strlen($port)) { |
912 | - $this->port = (int) $port; |
|
912 | + $this->port = (int)$port; |
|
913 | 913 | $this->scheme_normalization(); |
914 | 914 | return true; |
915 | 915 | } |
@@ -930,10 +930,10 @@ discard block |
||
930 | 930 | $cache = array(); |
931 | 931 | } |
932 | 932 | |
933 | - $ipath = (string) $ipath; |
|
933 | + $ipath = (string)$ipath; |
|
934 | 934 | |
935 | 935 | if (isset($cache[$ipath])) { |
936 | - $this->ipath = $cache[$ipath][(int) ($this->scheme !== null)]; |
|
936 | + $this->ipath = $cache[$ipath][(int)($this->scheme !== null)]; |
|
937 | 937 | } |
938 | 938 | else { |
939 | 939 | $valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/'); |
@@ -155,8 +155,7 @@ discard block |
||
155 | 155 | public function __set($name, $value) { |
156 | 156 | if (method_exists($this, 'set_' . $name)) { |
157 | 157 | call_user_func(array($this, 'set_' . $name), $value); |
158 | - } |
|
159 | - elseif ( |
|
158 | + } elseif ( |
|
160 | 159 | $name === 'iauthority' |
161 | 160 | || $name === 'iuserinfo' |
162 | 161 | || $name === 'ihost' |
@@ -187,8 +186,7 @@ discard block |
||
187 | 186 | ) { |
188 | 187 | $method = 'get_' . $name; |
189 | 188 | $return = $this->$method(); |
190 | - } |
|
191 | - elseif (array_key_exists($name, $props)) { |
|
189 | + } elseif (array_key_exists($name, $props)) { |
|
192 | 190 | $return = $this->$name; |
193 | 191 | } |
194 | 192 | // host -> ihost |
@@ -200,16 +198,14 @@ discard block |
||
200 | 198 | elseif (($prop = substr($name, 1)) && array_key_exists($prop, $props)) { |
201 | 199 | $name = $prop; |
202 | 200 | $return = $this->$prop; |
203 | - } |
|
204 | - else { |
|
201 | + } else { |
|
205 | 202 | trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE); |
206 | 203 | $return = null; |
207 | 204 | } |
208 | 205 | |
209 | 206 | if ($return === null && isset($this->normalization[$this->scheme][$name])) { |
210 | 207 | return $this->normalization[$this->scheme][$name]; |
211 | - } |
|
212 | - else { |
|
208 | + } else { |
|
213 | 209 | return $return; |
214 | 210 | } |
215 | 211 | } |
@@ -259,8 +255,7 @@ discard block |
||
259 | 255 | } |
260 | 256 | if (!$relative->is_valid()) { |
261 | 257 | return false; |
262 | - } |
|
263 | - elseif ($relative->scheme !== null) { |
|
258 | + } elseif ($relative->scheme !== null) { |
|
264 | 259 | return clone $relative; |
265 | 260 | } |
266 | 261 | |
@@ -275,8 +270,7 @@ discard block |
||
275 | 270 | if ($relative->iuserinfo !== null || $relative->ihost !== null || $relative->port !== null) { |
276 | 271 | $target = clone $relative; |
277 | 272 | $target->scheme = $base->scheme; |
278 | - } |
|
279 | - else { |
|
273 | + } else { |
|
280 | 274 | $target = new Requests_IRI; |
281 | 275 | $target->scheme = $base->scheme; |
282 | 276 | $target->iuserinfo = $base->iuserinfo; |
@@ -285,32 +279,26 @@ discard block |
||
285 | 279 | if ($relative->ipath !== '') { |
286 | 280 | if ($relative->ipath[0] === '/') { |
287 | 281 | $target->ipath = $relative->ipath; |
288 | - } |
|
289 | - elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') { |
|
282 | + } elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') { |
|
290 | 283 | $target->ipath = '/' . $relative->ipath; |
291 | - } |
|
292 | - elseif (($last_segment = strrpos($base->ipath, '/')) !== false) { |
|
284 | + } elseif (($last_segment = strrpos($base->ipath, '/')) !== false) { |
|
293 | 285 | $target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath; |
294 | - } |
|
295 | - else { |
|
286 | + } else { |
|
296 | 287 | $target->ipath = $relative->ipath; |
297 | 288 | } |
298 | 289 | $target->ipath = $target->remove_dot_segments($target->ipath); |
299 | 290 | $target->iquery = $relative->iquery; |
300 | - } |
|
301 | - else { |
|
291 | + } else { |
|
302 | 292 | $target->ipath = $base->ipath; |
303 | 293 | if ($relative->iquery !== null) { |
304 | 294 | $target->iquery = $relative->iquery; |
305 | - } |
|
306 | - elseif ($base->iquery !== null) { |
|
295 | + } elseif ($base->iquery !== null) { |
|
307 | 296 | $target->iquery = $base->iquery; |
308 | 297 | } |
309 | 298 | } |
310 | 299 | $target->ifragment = $relative->ifragment; |
311 | 300 | } |
312 | - } |
|
313 | - else { |
|
301 | + } else { |
|
314 | 302 | $target = clone $base; |
315 | 303 | $target->ifragment = null; |
316 | 304 | } |
@@ -362,8 +350,7 @@ discard block |
||
362 | 350 | // then remove that prefix from the input buffer; otherwise, |
363 | 351 | if (strpos($input, '../') === 0) { |
364 | 352 | $input = substr($input, 3); |
365 | - } |
|
366 | - elseif (strpos($input, './') === 0) { |
|
353 | + } elseif (strpos($input, './') === 0) { |
|
367 | 354 | $input = substr($input, 2); |
368 | 355 | } |
369 | 356 | // B: if the input buffer begins with a prefix of "/./" or "/.", |
@@ -371,8 +358,7 @@ discard block |
||
371 | 358 | // with "/" in the input buffer; otherwise, |
372 | 359 | elseif (strpos($input, '/./') === 0) { |
373 | 360 | $input = substr($input, 2); |
374 | - } |
|
375 | - elseif ($input === '/.') { |
|
361 | + } elseif ($input === '/.') { |
|
376 | 362 | $input = '/'; |
377 | 363 | } |
378 | 364 | // C: if the input buffer begins with a prefix of "/../" or "/..", |
@@ -382,8 +368,7 @@ discard block |
||
382 | 368 | elseif (strpos($input, '/../') === 0) { |
383 | 369 | $input = substr($input, 3); |
384 | 370 | $output = substr_replace($output, '', strrpos($output, '/')); |
385 | - } |
|
386 | - elseif ($input === '/..') { |
|
371 | + } elseif ($input === '/..') { |
|
387 | 372 | $input = '/'; |
388 | 373 | $output = substr_replace($output, '', strrpos($output, '/')); |
389 | 374 | } |
@@ -399,8 +384,7 @@ discard block |
||
399 | 384 | elseif (($pos = strpos($input, '/', 1)) !== false) { |
400 | 385 | $output .= substr($input, 0, $pos); |
401 | 386 | $input = substr_replace($input, '', 0, $pos); |
402 | - } |
|
403 | - else { |
|
387 | + } else { |
|
404 | 388 | $output .= $input; |
405 | 389 | $input = ''; |
406 | 390 | } |
@@ -482,8 +466,7 @@ discard block |
||
482 | 466 | break; |
483 | 467 | } |
484 | 468 | } |
485 | - } |
|
486 | - else { |
|
469 | + } else { |
|
487 | 470 | $position = $strlen - 1; |
488 | 471 | $valid = false; |
489 | 472 | } |
@@ -634,8 +617,7 @@ discard block |
||
634 | 617 | for ($j = $start; $j <= $i; $j++) { |
635 | 618 | $string .= '%' . strtoupper($bytes[$j]); |
636 | 619 | } |
637 | - } |
|
638 | - else { |
|
620 | + } else { |
|
639 | 621 | for ($j = $start; $j <= $i; $j++) { |
640 | 622 | $string .= chr(hexdec($bytes[$j])); |
641 | 623 | } |
@@ -760,12 +742,10 @@ discard block |
||
760 | 742 | protected function set_scheme($scheme) { |
761 | 743 | if ($scheme === null) { |
762 | 744 | $this->scheme = null; |
763 | - } |
|
764 | - elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) { |
|
745 | + } elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) { |
|
765 | 746 | $this->scheme = null; |
766 | 747 | return false; |
767 | - } |
|
768 | - else { |
|
748 | + } else { |
|
769 | 749 | $this->scheme = strtolower($scheme); |
770 | 750 | } |
771 | 751 | return true; |
@@ -803,8 +783,7 @@ discard block |
||
803 | 783 | if (($iuserinfo_end = strrpos($remaining, '@')) !== false) { |
804 | 784 | $iuserinfo = substr($remaining, 0, $iuserinfo_end); |
805 | 785 | $remaining = substr($remaining, $iuserinfo_end + 1); |
806 | - } |
|
807 | - else { |
|
786 | + } else { |
|
808 | 787 | $iuserinfo = null; |
809 | 788 | } |
810 | 789 | if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false) { |
@@ -813,8 +792,7 @@ discard block |
||
813 | 792 | $port = null; |
814 | 793 | } |
815 | 794 | $remaining = substr($remaining, 0, $port_start); |
816 | - } |
|
817 | - else { |
|
795 | + } else { |
|
818 | 796 | $port = null; |
819 | 797 | } |
820 | 798 | |
@@ -839,8 +817,7 @@ discard block |
||
839 | 817 | protected function set_userinfo($iuserinfo) { |
840 | 818 | if ($iuserinfo === null) { |
841 | 819 | $this->iuserinfo = null; |
842 | - } |
|
843 | - else { |
|
820 | + } else { |
|
844 | 821 | $this->iuserinfo = $this->replace_invalid_with_pct_encoding($iuserinfo, '!$&\'()*+,;=:'); |
845 | 822 | $this->scheme_normalization(); |
846 | 823 | } |
@@ -863,13 +840,11 @@ discard block |
||
863 | 840 | if (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']') { |
864 | 841 | if (Requests_IPv6::check_ipv6(substr($ihost, 1, -1))) { |
865 | 842 | $this->ihost = '[' . Requests_IPv6::compress(substr($ihost, 1, -1)) . ']'; |
866 | - } |
|
867 | - else { |
|
843 | + } else { |
|
868 | 844 | $this->ihost = null; |
869 | 845 | return false; |
870 | 846 | } |
871 | - } |
|
872 | - else { |
|
847 | + } else { |
|
873 | 848 | $ihost = $this->replace_invalid_with_pct_encoding($ihost, '!$&\'()*+,;='); |
874 | 849 | |
875 | 850 | // Lowercase, but ignore pct-encoded sections (as they should |
@@ -880,8 +855,7 @@ discard block |
||
880 | 855 | while (($position += strcspn($ihost, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ%', $position)) < $strlen) { |
881 | 856 | if ($ihost[$position] === '%') { |
882 | 857 | $position += 3; |
883 | - } |
|
884 | - else { |
|
858 | + } else { |
|
885 | 859 | $ihost[$position] = strtolower($ihost[$position]); |
886 | 860 | $position++; |
887 | 861 | } |
@@ -934,8 +908,7 @@ discard block |
||
934 | 908 | |
935 | 909 | if (isset($cache[$ipath])) { |
936 | 910 | $this->ipath = $cache[$ipath][(int) ($this->scheme !== null)]; |
937 | - } |
|
938 | - else { |
|
911 | + } else { |
|
939 | 912 | $valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/'); |
940 | 913 | $removed = $this->remove_dot_segments($valid); |
941 | 914 | |
@@ -955,8 +928,7 @@ discard block |
||
955 | 928 | protected function set_query($iquery) { |
956 | 929 | if ($iquery === null) { |
957 | 930 | $this->iquery = null; |
958 | - } |
|
959 | - else { |
|
931 | + } else { |
|
960 | 932 | $this->iquery = $this->replace_invalid_with_pct_encoding($iquery, '!$&\'()*+,;=:@/?', true); |
961 | 933 | $this->scheme_normalization(); |
962 | 934 | } |
@@ -972,8 +944,7 @@ discard block |
||
972 | 944 | protected function set_fragment($ifragment) { |
973 | 945 | if ($ifragment === null) { |
974 | 946 | $this->ifragment = null; |
975 | - } |
|
976 | - else { |
|
947 | + } else { |
|
977 | 948 | $this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?'); |
978 | 949 | $this->scheme_normalization(); |
979 | 950 | } |
@@ -1076,8 +1047,7 @@ discard block |
||
1076 | 1047 | $iauthority = $this->get_iauthority(); |
1077 | 1048 | if (is_string($iauthority)) { |
1078 | 1049 | return $this->to_uri($iauthority); |
1079 | - } |
|
1080 | - else { |
|
1050 | + } else { |
|
1081 | 1051 | return $iauthority; |
1082 | 1052 | } |
1083 | 1053 | } |
@@ -232,7 +232,7 @@ |
||
232 | 232 | * |
233 | 233 | * @param array $request Request data (same form as {@see request_multiple}) |
234 | 234 | * @param boolean $merge_options Should we merge options as well? |
235 | - * @return array Request data |
|
235 | + * @return string Request data |
|
236 | 236 | */ |
237 | 237 | protected function merge_request($request, $merge_options = true) { |
238 | 238 | if ($this->url !== null) { |
@@ -249,8 +249,7 @@ |
||
249 | 249 | if (is_array($this->data)) { |
250 | 250 | $request['data'] = $this->data; |
251 | 251 | } |
252 | - } |
|
253 | - elseif (is_array($request['data']) && is_array($this->data)) { |
|
252 | + } elseif (is_array($request['data']) && is_array($this->data)) { |
|
254 | 253 | $request['data'] = array_merge($this->data, $request['data']); |
255 | 254 | } |
256 | 255 |
@@ -29,7 +29,6 @@ |
||
29 | 29 | return $this->ancestor; |
30 | 30 | } |
31 | 31 | /** |
32 | - * @param Location $location |
|
33 | 32 | */ |
34 | 33 | public function setAncestor($ancestor) |
35 | 34 | { |
@@ -1,59 +1,59 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class SendJodel extends AbstractRequest { |
4 | - /** |
|
5 | - * @var Location |
|
6 | - */ |
|
7 | - public $location; |
|
8 | - /** |
|
9 | - * @return Location |
|
10 | - */ |
|
11 | - public function getLocation(): Location |
|
12 | - { |
|
13 | - return $this->location; |
|
14 | - } |
|
15 | - /** |
|
16 | - * @param Location $location |
|
17 | - */ |
|
18 | - public function setLocation(Location $location) |
|
19 | - { |
|
20 | - $this->location = $location; |
|
21 | - } |
|
4 | + /** |
|
5 | + * @var Location |
|
6 | + */ |
|
7 | + public $location; |
|
8 | + /** |
|
9 | + * @return Location |
|
10 | + */ |
|
11 | + public function getLocation(): Location |
|
12 | + { |
|
13 | + return $this->location; |
|
14 | + } |
|
15 | + /** |
|
16 | + * @param Location $location |
|
17 | + */ |
|
18 | + public function setLocation(Location $location) |
|
19 | + { |
|
20 | + $this->location = $location; |
|
21 | + } |
|
22 | 22 | |
23 | - public $ancestor; |
|
24 | - /** |
|
25 | - * @return Location |
|
26 | - */ |
|
27 | - public function getAncestor() |
|
28 | - { |
|
29 | - return $this->ancestor; |
|
30 | - } |
|
31 | - /** |
|
32 | - * @param Location $location |
|
33 | - */ |
|
34 | - public function setAncestor($ancestor) |
|
35 | - { |
|
36 | - if(isset($ancestor) && $ancestor != "") |
|
37 | - { |
|
23 | + public $ancestor; |
|
24 | + /** |
|
25 | + * @return Location |
|
26 | + */ |
|
27 | + public function getAncestor() |
|
28 | + { |
|
29 | + return $this->ancestor; |
|
30 | + } |
|
31 | + /** |
|
32 | + * @param Location $location |
|
33 | + */ |
|
34 | + public function setAncestor($ancestor) |
|
35 | + { |
|
36 | + if(isset($ancestor) && $ancestor != "") |
|
37 | + { |
|
38 | 38 | $this->ancestor = $ancestor; |
39 | 39 | } |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | - function getApiEndPoint() |
|
43 | - { |
|
44 | - return '/v3/posts/'; |
|
45 | - } |
|
46 | - function getPayload() |
|
47 | - { |
|
48 | - return array( |
|
42 | + function getApiEndPoint() |
|
43 | + { |
|
44 | + return '/v3/posts/'; |
|
45 | + } |
|
46 | + function getPayload() |
|
47 | + { |
|
48 | + return array( |
|
49 | 49 | "ancestor" => $this->getAncestor(), |
50 | 50 | "color" => "9EC41C", |
51 | - "location" => $this->getLocation()->toArray(), |
|
52 | - "message" => $_POST['message'], |
|
53 | - ); |
|
54 | - } |
|
55 | - function getMethod() |
|
56 | - { |
|
57 | - return 'POST'; |
|
58 | - } |
|
51 | + "location" => $this->getLocation()->toArray(), |
|
52 | + "message" => $_POST['message'], |
|
53 | + ); |
|
54 | + } |
|
55 | + function getMethod() |
|
56 | + { |
|
57 | + return 'POST'; |
|
58 | + } |
|
59 | 59 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | */ |
34 | 34 | public function setAncestor($ancestor) |
35 | 35 | { |
36 | - if(isset($ancestor) && $ancestor != "") |
|
36 | + if (isset($ancestor) && $ancestor != "") |
|
37 | 37 | { |
38 | 38 | $this->ancestor = $ancestor; |
39 | 39 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | if ($result->num_rows > 0) |
18 | 18 | { |
19 | 19 | // output data of each row |
20 | - while($row = $result->fetch_assoc()) |
|
20 | + while ($row = $result->fetch_assoc()) |
|
21 | 21 | { |
22 | 22 | $accessToken = $row["access_token"]; |
23 | 23 | } |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | //createAccount(); |
32 | 32 | |
33 | 33 | //Set Location |
34 | - if(isset($_GET['city'])) { |
|
34 | + if (isset($_GET['city'])) { |
|
35 | 35 | |
36 | 36 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . $_GET['city'] . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
37 | 37 | $result = Requests::post($url); |
38 | - if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS') |
|
38 | + if (json_decode($result->body, true)['status'] == 'ZERO_RESULTS') |
|
39 | 39 | { |
40 | 40 | $newPostionStatus = "0 results"; |
41 | 41 | } |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | //Vote |
56 | - if(isset($_GET['vote']) && isset($_GET['postID'])) { |
|
57 | - if($_GET['vote'] == "up") { |
|
56 | + if (isset($_GET['vote']) && isset($_GET['postID'])) { |
|
57 | + if ($_GET['vote'] == "up") { |
|
58 | 58 | $accountCreator = new Upvote(); |
59 | 59 | } |
60 | - else if($_GET['vote'] == "down") { |
|
60 | + else if ($_GET['vote'] == "down") { |
|
61 | 61 | $accountCreator = new Downvote(); |
62 | 62 | } |
63 | 63 | $accountCreator->setAccessToken($accessToken); |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | |
70 | 70 | |
71 | 71 | //SendJodel |
72 | - if(isset($_POST['message'])) { |
|
72 | + if (isset($_POST['message'])) { |
|
73 | 73 | $ancestor; |
74 | - if(isset($_POST['ancestor'])) |
|
74 | + if (isset($_POST['ancestor'])) |
|
75 | 75 | { |
76 | 76 | $ancestor = $_POST['ancestor']; |
77 | 77 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | <a href="index.php"> |
114 | 114 | <h1> |
115 | 115 | Jodel WebClient |
116 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?> |
|
116 | + <?php if (!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>'; ?> |
|
117 | 117 | </h1> |
118 | 118 | </a> |
119 | 119 | <div class="clear"></div> |
@@ -128,14 +128,14 @@ discard block |
||
128 | 128 | $posts; |
129 | 129 | |
130 | 130 | //Get Post Details |
131 | - if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { |
|
131 | + if (isset($_GET['postID']) && isset($_GET['getPostDetails'])) { |
|
132 | 132 | //Header Nav in Comment View |
133 | 133 | ?> |
134 | - <a id="comment-back" href="index.php#postId-<?php echo $_GET['postID'];?>"> |
|
134 | + <a id="comment-back" href="index.php#postId-<?php echo $_GET['postID']; ?>"> |
|
135 | 135 | <i class="fa fa-angle-left fa-3x"></i> |
136 | 136 | </a> |
137 | 137 | |
138 | - <a id="comment-refresh" href="index.php?getPostDetails=<?php echo $_GET['getPostDetails'];?>&postID=<?php echo $_GET['postID'];?>"> |
|
138 | + <a id="comment-refresh" href="index.php?getPostDetails=<?php echo $_GET['getPostDetails']; ?>&postID=<?php echo $_GET['postID']; ?>"> |
|
139 | 139 | <i class="fa fa-refresh fa-2x"></i> |
140 | 140 | </a> |
141 | 141 | <?php |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $data = $accountCreator->execute(); |
147 | 147 | |
148 | 148 | $posts[0] = $data; |
149 | - if(isset($data['children'])) { |
|
150 | - foreach($data['children'] as $child) { |
|
149 | + if (isset($data['children'])) { |
|
150 | + foreach ($data['children'] as $child) { |
|
151 | 151 | array_push($posts, $child); |
152 | 152 | } |
153 | 153 | $loops = $data['child_count'] + 1; |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | } |
158 | 158 | //Get Posts |
159 | 159 | else { |
160 | - if(isset($_GET['commentView'])) |
|
160 | + if (isset($_GET['commentView'])) |
|
161 | 161 | { |
162 | 162 | $commentView = true; |
163 | 163 | $url = "/v2/posts/location/discussed/"; |
164 | 164 | } |
165 | 165 | else |
166 | 166 | { |
167 | - if(isset($_GET['upVoteView'])) |
|
167 | + if (isset($_GET['upVoteView'])) |
|
168 | 168 | { |
169 | 169 | $upVoteView = true; |
170 | 170 | $url = "/v2/posts/location/popular/"; |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | - for($i = 0; $i<$loops; $i++) { |
|
185 | + for ($i = 0; $i < $loops; $i++) { |
|
186 | 186 | |
187 | - if(isset($posts[$i])) { |
|
187 | + if (isset($posts[$i])) { |
|
188 | 188 | $lastPostId = $posts[$i]['post_id']; |
189 | 189 | |
190 | 190 | |
@@ -200,24 +200,24 @@ discard block |
||
200 | 200 | $timediff_inHours = (string)$timediff->format('%h'); |
201 | 201 | $timediff_inDays = (string)$timediff->format('%d'); |
202 | 202 | $timediff_inMonth = (string)$timediff->format('%m'); |
203 | - if($timediff_inMonth!=0) { |
|
203 | + if ($timediff_inMonth != 0) { |
|
204 | 204 | $timediff = $timediff_inMonth . "m"; |
205 | 205 | } |
206 | 206 | else |
207 | 207 | { |
208 | - if($timediff_inDays!=0) |
|
208 | + if ($timediff_inDays != 0) |
|
209 | 209 | { |
210 | 210 | $timediff = $timediff_inDays . "d"; |
211 | 211 | } |
212 | 212 | else |
213 | 213 | { |
214 | - if($timediff_inHours!=0) |
|
214 | + if ($timediff_inHours != 0) |
|
215 | 215 | { |
216 | 216 | $timediff = $timediff_inHours . "h"; |
217 | 217 | } |
218 | 218 | else |
219 | 219 | { |
220 | - if($timediff_inMinutes!=0) |
|
220 | + if ($timediff_inMinutes != 0) |
|
221 | 221 | { |
222 | 222 | $timediff = $timediff_inMinutes . "m"; |
223 | 223 | } |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | } |
231 | 231 | ?> |
232 | 232 | |
233 | - <article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;"> |
|
233 | + <article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"]; ?>;"> |
|
234 | 234 | <content> |
235 | 235 | <?php |
236 | - if(isset($posts[$i]["image_url"])) { |
|
236 | + if (isset($posts[$i]["image_url"])) { |
|
237 | 237 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
238 | 238 | } |
239 | 239 | else { |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | ?> |
243 | 243 | </content> |
244 | 244 | <aside> |
245 | - <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
245 | + <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
246 | 246 | <i class="fa fa-angle-up fa-3x"></i> |
247 | 247 | </a> |
248 | 248 | <br /> |
249 | - <?php echo $posts[$i]["vote_count"];?><br /> |
|
250 | - <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
249 | + <?php echo $posts[$i]["vote_count"]; ?><br /> |
|
250 | + <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
251 | 251 | <i class="fa fa-angle-down fa-3x"></i> |
252 | 252 | </a> |
253 | 253 | </aside> |
@@ -258,15 +258,15 @@ discard block |
||
258 | 258 | <td class="time"> |
259 | 259 | <span data-tooltip="Time"> |
260 | 260 | <i class="fa fa-clock-o"></i> |
261 | - <?php echo $timediff;?> |
|
261 | + <?php echo $timediff; ?> |
|
262 | 262 | </span> |
263 | 263 | </td> |
264 | 264 | <td class="comments"> |
265 | - <?php if($showCommentIcon) {?> |
|
265 | + <?php if ($showCommentIcon) {?> |
|
266 | 266 | <span data-tooltip="Comments"> |
267 | - <a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
267 | + <a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
268 | 268 | <i class="fa fa-commenting-o"></i> |
269 | - <?php if(array_key_exists("child_count", $posts[$i])) { |
|
269 | + <?php if (array_key_exists("child_count", $posts[$i])) { |
|
270 | 270 | echo $posts[$i]["child_count"]; |
271 | 271 | } else echo "0"; |
272 | 272 | ?> |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | <td class="distance"> |
278 | 278 | <span data-tooltip="Distance"> |
279 | 279 | <i class="fa fa-map-marker"></i> |
280 | - <?php echo $posts[$i]["distance"];?> km |
|
280 | + <?php echo $posts[$i]["distance"]; ?> km |
|
281 | 281 | </span> |
282 | 282 | </td> |
283 | 283 | </tr> |
@@ -292,15 +292,15 @@ discard block |
||
292 | 292 | </content> |
293 | 293 | |
294 | 294 | </article> |
295 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
295 | + <?php if (!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
296 | 296 | <p id="loading"> |
297 | 297 | <img src="images/loading.gif" alt="Loading…" /> |
298 | 298 | </p> |
299 | 299 | <?php } ?> |
300 | 300 | <nav id="sortJodelBy"> |
301 | - <a href="index.php" <?php if(isset($timeView)) echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
302 | - <a href="index.php?commentView=true" <?php if(isset($commentView)) echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
303 | - <a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
301 | + <a href="index.php" <?php if (isset($timeView)) echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
302 | + <a href="index.php?commentView=true" <?php if (isset($commentView)) echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
303 | + <a href="index.php?upVoteView=true" <?php if (isset($upVoteView)) echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
304 | 304 | </nav> |
305 | 305 | </div> |
306 | 306 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | <article> |
309 | 309 | <h3>Position</h3> |
310 | 310 | <form method="get"> |
311 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; else echo $posts[0]["location"]["name"]; ?>" required> |
|
311 | + <input type="text" id="city" name="city" placeholder="<?php if (isset($newPositionStatus)) echo $newPositionStatus; else echo $posts[0]["location"]["name"]; ?>" required> |
|
312 | 312 | |
313 | 313 | <input type="submit" value="Set Location" /> |
314 | 314 | </form> |
@@ -321,10 +321,10 @@ discard block |
||
321 | 321 | </article> |
322 | 322 | |
323 | 323 | <article> |
324 | - <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
|
324 | + <?php if (isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
|
325 | 325 | <h2>Comment on Jodel</h2> |
326 | 326 | <form method="POST"> |
327 | - <input type="hidden" name="ancestor" value="<?php echo $_GET['postID'];?>" /> |
|
327 | + <input type="hidden" name="ancestor" value="<?php echo $_GET['postID']; ?>" /> |
|
328 | 328 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
329 | 329 | <br /> |
330 | 330 | <input type="submit" value="SEND" /> |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $(this).addClass('selected'); |
359 | 359 | }); |
360 | 360 | |
361 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
361 | + <?php if (!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
362 | 362 | $(document).ready(function() { |
363 | 363 | var win = $(window); |
364 | 364 | var lastPostId = "<?php echo $lastPostId; ?>"; |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $accessToken = $row["access_token"]; |
23 | 23 | } |
24 | - } |
|
25 | - else |
|
24 | + } else |
|
26 | 25 | { |
27 | 26 | echo "Error: 0 results"; |
28 | 27 | } |
@@ -38,8 +37,7 @@ discard block |
||
38 | 37 | if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS') |
39 | 38 | { |
40 | 39 | $newPostionStatus = "0 results"; |
41 | - } |
|
42 | - else |
|
40 | + } else |
|
43 | 41 | { |
44 | 42 | $location = new Location(); |
45 | 43 | $location->setLat(json_decode($result->body, true)['results']['0']['geometry']['location']['lat']); |
@@ -56,8 +54,7 @@ discard block |
||
56 | 54 | if(isset($_GET['vote']) && isset($_GET['postID'])) { |
57 | 55 | if($_GET['vote'] == "up") { |
58 | 56 | $accountCreator = new Upvote(); |
59 | - } |
|
60 | - else if($_GET['vote'] == "down") { |
|
57 | + } else if($_GET['vote'] == "down") { |
|
61 | 58 | $accountCreator = new Downvote(); |
62 | 59 | } |
63 | 60 | $accountCreator->setAccessToken($accessToken); |
@@ -113,7 +110,10 @@ discard block |
||
113 | 110 | <a href="index.php"> |
114 | 111 | <h1> |
115 | 112 | Jodel WebClient |
116 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?> |
|
113 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { |
|
114 | + echo '<i class="fa fa-refresh fa-1x"></i>'; |
|
115 | +} |
|
116 | +?> |
|
117 | 117 | </h1> |
118 | 118 | </a> |
119 | 119 | <div class="clear"></div> |
@@ -151,8 +151,9 @@ discard block |
||
151 | 151 | array_push($posts, $child); |
152 | 152 | } |
153 | 153 | $loops = $data['child_count'] + 1; |
154 | + } else { |
|
155 | + $loops = 1; |
|
154 | 156 | } |
155 | - else $loops = 1; |
|
156 | 157 | $showCommentIcon = FALSE; |
157 | 158 | } |
158 | 159 | //Get Posts |
@@ -161,15 +162,13 @@ discard block |
||
161 | 162 | { |
162 | 163 | $commentView = true; |
163 | 164 | $url = "/v2/posts/location/discussed/"; |
164 | - } |
|
165 | - else |
|
165 | + } else |
|
166 | 166 | { |
167 | 167 | if(isset($_GET['upVoteView'])) |
168 | 168 | { |
169 | 169 | $upVoteView = true; |
170 | 170 | $url = "/v2/posts/location/popular/"; |
171 | - } |
|
172 | - else |
|
171 | + } else |
|
173 | 172 | { |
174 | 173 | $timeView = true; |
175 | 174 | $url = "/v2/posts"; |
@@ -202,26 +201,22 @@ discard block |
||
202 | 201 | $timediff_inMonth = (string)$timediff->format('%m'); |
203 | 202 | if($timediff_inMonth!=0) { |
204 | 203 | $timediff = $timediff_inMonth . "m"; |
205 | - } |
|
206 | - else |
|
204 | + } else |
|
207 | 205 | { |
208 | 206 | if($timediff_inDays!=0) |
209 | 207 | { |
210 | 208 | $timediff = $timediff_inDays . "d"; |
211 | - } |
|
212 | - else |
|
209 | + } else |
|
213 | 210 | { |
214 | 211 | if($timediff_inHours!=0) |
215 | 212 | { |
216 | 213 | $timediff = $timediff_inHours . "h"; |
217 | - } |
|
218 | - else |
|
214 | + } else |
|
219 | 215 | { |
220 | 216 | if($timediff_inMinutes!=0) |
221 | 217 | { |
222 | 218 | $timediff = $timediff_inMinutes . "m"; |
223 | - } |
|
224 | - else |
|
219 | + } else |
|
225 | 220 | { |
226 | 221 | $timediff = $timediff_inSeconds . "s"; |
227 | 222 | } |
@@ -235,8 +230,7 @@ discard block |
||
235 | 230 | <?php |
236 | 231 | if(isset($posts[$i]["image_url"])) { |
237 | 232 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
238 | - } |
|
239 | - else { |
|
233 | + } else { |
|
240 | 234 | echo nl2br($posts[$i]["message"]); |
241 | 235 | } |
242 | 236 | ?> |
@@ -268,7 +262,9 @@ discard block |
||
268 | 262 | <i class="fa fa-commenting-o"></i> |
269 | 263 | <?php if(array_key_exists("child_count", $posts[$i])) { |
270 | 264 | echo $posts[$i]["child_count"]; |
271 | - } else echo "0"; |
|
265 | + } else { |
|
266 | + echo "0"; |
|
267 | + } |
|
272 | 268 | ?> |
273 | 269 | </a> |
274 | 270 | </span> |
@@ -298,9 +294,18 @@ discard block |
||
298 | 294 | </p> |
299 | 295 | <?php } ?> |
300 | 296 | <nav id="sortJodelBy"> |
301 | - <a href="index.php" <?php if(isset($timeView)) echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
302 | - <a href="index.php?commentView=true" <?php if(isset($commentView)) echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
303 | - <a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
297 | + <a href="index.php" <?php if(isset($timeView)) { |
|
298 | + echo 'class="active"'; |
|
299 | +} |
|
300 | +?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
301 | + <a href="index.php?commentView=true" <?php if(isset($commentView)) { |
|
302 | + echo 'class="active"'; |
|
303 | +} |
|
304 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
305 | + <a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) { |
|
306 | + echo 'class="active"'; |
|
307 | +} |
|
308 | +?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
304 | 309 | </nav> |
305 | 310 | </div> |
306 | 311 | |
@@ -308,7 +313,12 @@ discard block |
||
308 | 313 | <article> |
309 | 314 | <h3>Position</h3> |
310 | 315 | <form method="get"> |
311 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; else echo $posts[0]["location"]["name"]; ?>" required> |
|
316 | + <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) { |
|
317 | + echo $newPositionStatus; |
|
318 | +} else { |
|
319 | + echo $posts[0]["location"]["name"]; |
|
320 | +} |
|
321 | +?>" required> |
|
312 | 322 | |
313 | 323 | <input type="submit" value="Set Location" /> |
314 | 324 | </form> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | if ($result->num_rows > 0) { |
32 | 32 | // output data of each row |
33 | - while($row = $result->fetch_assoc()) { |
|
33 | + while ($row = $result->fetch_assoc()) { |
|
34 | 34 | $access_token = $row["access_token"]; |
35 | 35 | } |
36 | 36 | } else { |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | } |
48 | 48 | $posts; |
49 | 49 | |
50 | - if(isset($_GET['commentView'])) |
|
50 | + if (isset($_GET['commentView'])) |
|
51 | 51 | { |
52 | 52 | $commentView = true; |
53 | 53 | $url = "/posts/location/discussed/"; |
54 | 54 | } |
55 | 55 | else |
56 | 56 | { |
57 | - if(isset($_GET['upVoteView'])) |
|
57 | + if (isset($_GET['upVoteView'])) |
|
58 | 58 | { |
59 | 59 | $upVoteView = true; |
60 | 60 | $url = "/posts/location/popular/"; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | - if(isset($_GET['lastPostId'])) { |
|
69 | + if (isset($_GET['lastPostId'])) { |
|
70 | 70 | |
71 | 71 | $lastPostId = $_GET['lastPostId']; |
72 | 72 | |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | ?> |
77 | 77 | <div class="nextPosts"> |
78 | 78 | <?php |
79 | - for($i = 0; $i<$loops; $i++) { |
|
79 | + for ($i = 0; $i < $loops; $i++) { |
|
80 | 80 | |
81 | - if(isset($posts[$i])) { |
|
81 | + if (isset($posts[$i])) { |
|
82 | 82 | $lastPostId = $posts[$i]['post_id']; |
83 | 83 | |
84 | 84 | |
@@ -94,24 +94,24 @@ discard block |
||
94 | 94 | $timediff_inHours = (string)$timediff->format('%h'); |
95 | 95 | $timediff_inDays = (string)$timediff->format('%d'); |
96 | 96 | $timediff_inMonth = (string)$timediff->format('%m'); |
97 | - if($timediff_inMonth!=0) { |
|
97 | + if ($timediff_inMonth != 0) { |
|
98 | 98 | $timediff = $timediff_inMonth . "m"; |
99 | 99 | } |
100 | 100 | else |
101 | 101 | { |
102 | - if($timediff_inDays!=0) |
|
102 | + if ($timediff_inDays != 0) |
|
103 | 103 | { |
104 | 104 | $timediff = $timediff_inDays . "d"; |
105 | 105 | } |
106 | 106 | else |
107 | 107 | { |
108 | - if($timediff_inHours!=0) |
|
108 | + if ($timediff_inHours != 0) |
|
109 | 109 | { |
110 | 110 | $timediff = $timediff_inHours . "h"; |
111 | 111 | } |
112 | 112 | else |
113 | 113 | { |
114 | - if($timediff_inMinutes!=0) |
|
114 | + if ($timediff_inMinutes != 0) |
|
115 | 115 | { |
116 | 116 | $timediff = $timediff_inMinutes . "m"; |
117 | 117 | } |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | } |
125 | 125 | ?> |
126 | 126 | |
127 | - <article class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;"> |
|
127 | + <article class="jodel" style="background-color: #<?php echo $posts[$i]["color"]; ?>;"> |
|
128 | 128 | <content> |
129 | 129 | <?php |
130 | - if(isset($posts[$i]["image_url"])) { |
|
130 | + if (isset($posts[$i]["image_url"])) { |
|
131 | 131 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
132 | 132 | } |
133 | 133 | else { |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | ?> |
137 | 137 | </content> |
138 | 138 | <aside> |
139 | - <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
139 | + <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
140 | 140 | <i class="fa fa-angle-up fa-3x"></i> |
141 | 141 | </a> |
142 | 142 | <br /> |
143 | - <?php echo $posts[$i]["vote_count"];?><br /> |
|
144 | - <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
143 | + <?php echo $posts[$i]["vote_count"]; ?><br /> |
|
144 | + <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
145 | 145 | <i class="fa fa-angle-down fa-3x"></i> |
146 | 146 | </a> |
147 | 147 | </aside> |
@@ -152,15 +152,15 @@ discard block |
||
152 | 152 | <td class="time"> |
153 | 153 | <span data-tooltip="Time"> |
154 | 154 | <i class="fa fa-clock-o"></i> |
155 | - <?php echo $timediff;?> |
|
155 | + <?php echo $timediff; ?> |
|
156 | 156 | </span> |
157 | 157 | </td> |
158 | 158 | <td class="comments"> |
159 | - <?php if($showCommentIcon) {?> |
|
159 | + <?php if ($showCommentIcon) {?> |
|
160 | 160 | <span data-tooltip="Comments"> |
161 | - <a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
161 | + <a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"]; ?>"> |
|
162 | 162 | <i class="fa fa-commenting-o"></i> |
163 | - <?php if(array_key_exists("child_count", $posts[$i])) { |
|
163 | + <?php if (array_key_exists("child_count", $posts[$i])) { |
|
164 | 164 | echo $posts[$i]["child_count"]; |
165 | 165 | } else echo "0"; |
166 | 166 | ?> |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | <td class="distance"> |
172 | 172 | <span data-tooltip="Distance"> |
173 | 173 | <i class="fa fa-map-marker"></i> |
174 | - <?php echo $posts[$i]["distance"];?> km |
|
174 | + <?php echo $posts[$i]["distance"]; ?> km |
|
175 | 175 | </span> |
176 | 176 | </td> |
177 | 177 | </tr> |
@@ -51,15 +51,13 @@ discard block |
||
51 | 51 | { |
52 | 52 | $commentView = true; |
53 | 53 | $url = "/posts/location/discussed/"; |
54 | - } |
|
55 | - else |
|
54 | + } else |
|
56 | 55 | { |
57 | 56 | if(isset($_GET['upVoteView'])) |
58 | 57 | { |
59 | 58 | $upVoteView = true; |
60 | 59 | $url = "/posts/location/popular/"; |
61 | - } |
|
62 | - else |
|
60 | + } else |
|
63 | 61 | { |
64 | 62 | $timeView = true; |
65 | 63 | $url = "/v2/posts"; |
@@ -96,26 +94,22 @@ discard block |
||
96 | 94 | $timediff_inMonth = (string)$timediff->format('%m'); |
97 | 95 | if($timediff_inMonth!=0) { |
98 | 96 | $timediff = $timediff_inMonth . "m"; |
99 | - } |
|
100 | - else |
|
97 | + } else |
|
101 | 98 | { |
102 | 99 | if($timediff_inDays!=0) |
103 | 100 | { |
104 | 101 | $timediff = $timediff_inDays . "d"; |
105 | - } |
|
106 | - else |
|
102 | + } else |
|
107 | 103 | { |
108 | 104 | if($timediff_inHours!=0) |
109 | 105 | { |
110 | 106 | $timediff = $timediff_inHours . "h"; |
111 | - } |
|
112 | - else |
|
107 | + } else |
|
113 | 108 | { |
114 | 109 | if($timediff_inMinutes!=0) |
115 | 110 | { |
116 | 111 | $timediff = $timediff_inMinutes . "m"; |
117 | - } |
|
118 | - else |
|
112 | + } else |
|
119 | 113 | { |
120 | 114 | $timediff = $timediff_inSeconds . "s"; |
121 | 115 | } |
@@ -129,8 +123,7 @@ discard block |
||
129 | 123 | <?php |
130 | 124 | if(isset($posts[$i]["image_url"])) { |
131 | 125 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
132 | - } |
|
133 | - else { |
|
126 | + } else { |
|
134 | 127 | echo nl2br($posts[$i]["message"]); |
135 | 128 | } |
136 | 129 | ?> |
@@ -162,7 +155,9 @@ discard block |
||
162 | 155 | <i class="fa fa-commenting-o"></i> |
163 | 156 | <?php if(array_key_exists("child_count", $posts[$i])) { |
164 | 157 | echo $posts[$i]["child_count"]; |
165 | - } else echo "0"; |
|
158 | + } else { |
|
159 | + echo "0"; |
|
160 | + } |
|
166 | 161 | ?> |
167 | 162 | </a> |
168 | 163 | </span> |
@@ -40,6 +40,6 @@ |
||
40 | 40 | ) DEFAULT CHARSET=utf8"; |
41 | 41 | if(!$db->query($query)) |
42 | 42 | { |
43 | - throw new Exception($db->error($mysqli)); |
|
43 | + throw new Exception($db->error($mysqli)); |
|
44 | 44 | } |
45 | 45 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | `X-Api-Version` varchar(10) NOT NULL default '0.2', |
39 | 39 | PRIMARY KEY (`id`) |
40 | 40 | ) DEFAULT CHARSET=utf8"; |
41 | - if(!$db->query($query)) |
|
41 | + if (!$db->query($query)) |
|
42 | 42 | { |
43 | 43 | throw new Exception($db->error($mysqli)); |
44 | 44 | } |