@@ -2,22 +2,22 @@ |
||
2 | 2 | class PostCaptcha extends AbstractRequest |
3 | 3 | { |
4 | 4 | public $captchaKey; |
5 | - public $captchaSolution; |
|
5 | + public $captchaSolution; |
|
6 | 6 | |
7 | - function getApiEndPoint() |
|
8 | - { |
|
9 | - return '/v3/user/verification/imageCaptcha/'; |
|
10 | - } |
|
11 | - function getPayload() |
|
12 | - { |
|
13 | - return array( |
|
14 | - 'key' => $this->captchaKey, |
|
15 | - 'answer' => $this->captchaSolution, |
|
16 | - ); |
|
17 | - } |
|
18 | - function getMethod() |
|
19 | - { |
|
20 | - return 'POST'; |
|
21 | - } |
|
7 | + function getApiEndPoint() |
|
8 | + { |
|
9 | + return '/v3/user/verification/imageCaptcha/'; |
|
10 | + } |
|
11 | + function getPayload() |
|
12 | + { |
|
13 | + return array( |
|
14 | + 'key' => $this->captchaKey, |
|
15 | + 'answer' => $this->captchaSolution, |
|
16 | + ); |
|
17 | + } |
|
18 | + function getMethod() |
|
19 | + { |
|
20 | + return 'POST'; |
|
21 | + } |
|
22 | 22 | } |
23 | 23 |
@@ -2,18 +2,18 @@ |
||
2 | 2 | class GetUserConfig extends AbstractRequest |
3 | 3 | { |
4 | 4 | |
5 | - function getApiEndPoint() |
|
6 | - { |
|
7 | - return '/v3/user/config/'; |
|
8 | - } |
|
9 | - function getPayload() |
|
10 | - { |
|
11 | - return array( |
|
12 | - ); |
|
13 | - } |
|
14 | - function getMethod() |
|
15 | - { |
|
16 | - return 'GET'; |
|
17 | - } |
|
5 | + function getApiEndPoint() |
|
6 | + { |
|
7 | + return '/v3/user/config/'; |
|
8 | + } |
|
9 | + function getPayload() |
|
10 | + { |
|
11 | + return array( |
|
12 | + ); |
|
13 | + } |
|
14 | + function getMethod() |
|
15 | + { |
|
16 | + return 'GET'; |
|
17 | + } |
|
18 | 18 | } |
19 | 19 |
@@ -3,37 +3,37 @@ |
||
3 | 3 | |
4 | 4 | class UpdateLocation extends AbstractRequest { |
5 | 5 | /** |
6 | - * @var Location |
|
7 | - */ |
|
8 | - public $location; |
|
9 | - /** |
|
10 | - * @return Location |
|
11 | - */ |
|
12 | - public function getLocation() |
|
13 | - { |
|
14 | - return $this->location; |
|
15 | - } |
|
16 | - /** |
|
17 | - * @param Location $location |
|
18 | - */ |
|
19 | - public function setLocation($location) |
|
20 | - { |
|
21 | - $this->location = $location; |
|
22 | - } |
|
6 | + * @var Location |
|
7 | + */ |
|
8 | + public $location; |
|
9 | + /** |
|
10 | + * @return Location |
|
11 | + */ |
|
12 | + public function getLocation() |
|
13 | + { |
|
14 | + return $this->location; |
|
15 | + } |
|
16 | + /** |
|
17 | + * @param Location $location |
|
18 | + */ |
|
19 | + public function setLocation($location) |
|
20 | + { |
|
21 | + $this->location = $location; |
|
22 | + } |
|
23 | 23 | |
24 | - function getApiEndPoint() |
|
25 | - { |
|
26 | - return '/v2/users/location'; |
|
27 | - } |
|
28 | - function getPayload() |
|
29 | - { |
|
30 | - return array( |
|
24 | + function getApiEndPoint() |
|
25 | + { |
|
26 | + return '/v2/users/location'; |
|
27 | + } |
|
28 | + function getPayload() |
|
29 | + { |
|
30 | + return array( |
|
31 | 31 | 'location' => $this->getLocation()->toArray(), |
32 | - ); |
|
33 | - } |
|
34 | - function getMethod() |
|
35 | - { |
|
36 | - return 'PUT'; |
|
37 | - } |
|
32 | + ); |
|
33 | + } |
|
34 | + function getMethod() |
|
35 | + { |
|
36 | + return 'PUT'; |
|
37 | + } |
|
38 | 38 | } |
39 | 39 |
@@ -1,18 +1,18 @@ |
||
1 | 1 | <?php |
2 | 2 | class GetCaptcha extends AbstractRequest |
3 | 3 | { |
4 | - function getApiEndPoint() |
|
5 | - { |
|
6 | - return '/v3/user/verification/imageCaptcha/'; |
|
7 | - } |
|
8 | - function getPayload() |
|
9 | - { |
|
10 | - return array( |
|
11 | - ); |
|
12 | - } |
|
13 | - function getMethod() |
|
14 | - { |
|
15 | - return 'GET'; |
|
16 | - } |
|
4 | + function getApiEndPoint() |
|
5 | + { |
|
6 | + return '/v3/user/verification/imageCaptcha/'; |
|
7 | + } |
|
8 | + function getPayload() |
|
9 | + { |
|
10 | + return array( |
|
11 | + ); |
|
12 | + } |
|
13 | + function getMethod() |
|
14 | + { |
|
15 | + return 'GET'; |
|
16 | + } |
|
17 | 17 | } |
18 | 18 |
@@ -2,20 +2,20 @@ discard block |
||
2 | 2 | |
3 | 3 | abstract class AbstractRequest |
4 | 4 | { |
5 | - const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
|
6 | - const APIURL = 'https://api.go-tellm.com/api'; |
|
7 | - const SECRET = 'OFIqFvBgkccPNTVbIzkYaSmrwMlbVzRoOBBjXUIG'; |
|
8 | - const USERAGENT = 'Jodel/4.32.2 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )'; |
|
9 | - const CLIENT_TYPE = 'android_4.32.2'; |
|
5 | + const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
|
6 | + const APIURL = 'https://api.go-tellm.com/api'; |
|
7 | + const SECRET = 'OFIqFvBgkccPNTVbIzkYaSmrwMlbVzRoOBBjXUIG'; |
|
8 | + const USERAGENT = 'Jodel/4.32.2 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )'; |
|
9 | + const CLIENT_TYPE = 'android_4.32.2'; |
|
10 | 10 | |
11 | - private $accessToken = null; |
|
12 | - private $payLoad; |
|
13 | - public $expects = ''; |
|
14 | - public $version = 'v2'; |
|
15 | - public $hasPayload = FALSE; |
|
11 | + private $accessToken = null; |
|
12 | + private $payLoad; |
|
13 | + public $expects = ''; |
|
14 | + public $version = 'v2'; |
|
15 | + public $hasPayload = FALSE; |
|
16 | 16 | |
17 | - public function execute() |
|
18 | - { |
|
17 | + public function execute() |
|
18 | + { |
|
19 | 19 | $result = new \stdClass(); |
20 | 20 | |
21 | 21 | $this->payLoad = $this->getPayload(); |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | - $this->payLoad = json_encode($this->payLoad); |
|
29 | - $header = $this->getSignHeaders(); |
|
30 | - $url = $this->getFullUrl(); |
|
28 | + $this->payLoad = json_encode($this->payLoad); |
|
29 | + $header = $this->getSignHeaders(); |
|
30 | + $url = $this->getFullUrl(); |
|
31 | 31 | |
32 | - if ($this->getAccessToken()) { |
|
33 | - $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
|
34 | - } |
|
35 | - //Comment out to debug the Request: |
|
32 | + if ($this->getAccessToken()) { |
|
33 | + $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
|
34 | + } |
|
35 | + //Comment out to debug the Request: |
|
36 | 36 | |
37 | - /* |
|
37 | + /* |
|
38 | 38 | printf("URL: "); |
39 | 39 | var_dump($url); |
40 | 40 | echo "<br />"; |
@@ -45,86 +45,86 @@ discard block |
||
45 | 45 | var_dump($this->payLoad); |
46 | 46 | echo "<br />"; |
47 | 47 | */ |
48 | - /* |
|
48 | + /* |
|
49 | 49 | $options = array( |
50 | 50 | 'timeout' => 100, |
51 | 51 | 'connect_timeout' => 100, |
52 | 52 | 'proxy' => '186.103.169.165:8080', |
53 | 53 | );*/ |
54 | 54 | |
55 | - switch ($this->getMethod()) { |
|
56 | - case 'POST': |
|
57 | - $result = Requests::post($url, $header, $this->payLoad); |
|
58 | - break; |
|
59 | - case 'GET': |
|
60 | - if($this->hasPayload) |
|
61 | - { |
|
62 | - $result = Requests::get($url, $header, $this->payLoad); |
|
63 | - } |
|
64 | - else |
|
65 | - { |
|
66 | - $result = Requests::get($url, $header); |
|
67 | - } |
|
68 | - break; |
|
69 | - case 'PUT': |
|
70 | - $result = Requests::put($url, $header, $this->payLoad); |
|
71 | - break; |
|
72 | - } |
|
73 | - switch ($result->status_code) { |
|
74 | - case 200: |
|
75 | - $result = json_decode($result->body, true); |
|
76 | - break; |
|
77 | - case 204: |
|
78 | - $result = "Success"; |
|
79 | - break; |
|
80 | - case 400: |
|
81 | - //throw new \Exception('Unauthorized'); |
|
82 | - error_log('Error 400 - Fehlerhafte Anfrage'); // - JodelDeviceId:' . $deviceUid); |
|
83 | - break; |
|
84 | - case 401: |
|
55 | + switch ($this->getMethod()) { |
|
56 | + case 'POST': |
|
57 | + $result = Requests::post($url, $header, $this->payLoad); |
|
58 | + break; |
|
59 | + case 'GET': |
|
60 | + if($this->hasPayload) |
|
61 | + { |
|
62 | + $result = Requests::get($url, $header, $this->payLoad); |
|
63 | + } |
|
64 | + else |
|
65 | + { |
|
66 | + $result = Requests::get($url, $header); |
|
67 | + } |
|
68 | + break; |
|
69 | + case 'PUT': |
|
70 | + $result = Requests::put($url, $header, $this->payLoad); |
|
71 | + break; |
|
72 | + } |
|
73 | + switch ($result->status_code) { |
|
74 | + case 200: |
|
75 | + $result = json_decode($result->body, true); |
|
76 | + break; |
|
77 | + case 204: |
|
78 | + $result = "Success"; |
|
79 | + break; |
|
80 | + case 400: |
|
81 | + //throw new \Exception('Unauthorized'); |
|
82 | + error_log('Error 400 - Fehlerhafte Anfrage'); // - JodelDeviceId:' . $deviceUid); |
|
83 | + break; |
|
84 | + case 401: |
|
85 | 85 | //throw new \Exception('Unauthorized'); |
86 | - error_log('Error 401 - Unauthorized'); // - JodelDeviceId:' . $deviceUid); |
|
87 | - break; |
|
88 | - case 404: |
|
89 | - //echo "Es wurde bereits gevoted"; |
|
90 | - error_log('Error 404 - Es wurde bereits gevoted'); // - JodelDeviceId:' . $deviceUid); |
|
86 | + error_log('Error 401 - Unauthorized'); // - JodelDeviceId:' . $deviceUid); |
|
87 | + break; |
|
88 | + case 404: |
|
89 | + //echo "Es wurde bereits gevoted"; |
|
90 | + error_log('Error 404 - Es wurde bereits gevoted'); // - JodelDeviceId:' . $deviceUid); |
|
91 | 91 | case 477: |
92 | - //echo "Es wurde bereits gevoted"; |
|
93 | - //throw new \Exception('Signing failed!'); |
|
94 | - error_log('Error 477 - Signing failed'); // - JodelDeviceId:' . $deviceUid); |
|
95 | - break; |
|
96 | - case 429: |
|
97 | - error_log('Error 429 - Too Many Requests'); // - JodelDeviceId:' . $deviceUid); |
|
98 | - exit("Error 429: Too Many Requests"); |
|
99 | - break; |
|
100 | - case 403: |
|
101 | - error_log('Error 403 - Access denied'); // - JodelDeviceId:' . $deviceUid); |
|
102 | - exit("Error 403: Access denied"); |
|
103 | - break; |
|
104 | - default: |
|
105 | - error_log('Error '.$result->status_code.' - Unauthorized'); // - JodelDeviceId:' . $deviceUid); |
|
106 | - //throw new \Exception('Unknown Error: '.$result->status_code); |
|
107 | - } |
|
92 | + //echo "Es wurde bereits gevoted"; |
|
93 | + //throw new \Exception('Signing failed!'); |
|
94 | + error_log('Error 477 - Signing failed'); // - JodelDeviceId:' . $deviceUid); |
|
95 | + break; |
|
96 | + case 429: |
|
97 | + error_log('Error 429 - Too Many Requests'); // - JodelDeviceId:' . $deviceUid); |
|
98 | + exit("Error 429: Too Many Requests"); |
|
99 | + break; |
|
100 | + case 403: |
|
101 | + error_log('Error 403 - Access denied'); // - JodelDeviceId:' . $deviceUid); |
|
102 | + exit("Error 403: Access denied"); |
|
103 | + break; |
|
104 | + default: |
|
105 | + error_log('Error '.$result->status_code.' - Unauthorized'); // - JodelDeviceId:' . $deviceUid); |
|
106 | + //throw new \Exception('Unknown Error: '.$result->status_code); |
|
107 | + } |
|
108 | 108 | |
109 | - if($device_uid != '') |
|
110 | - { |
|
109 | + if($device_uid != '') |
|
110 | + { |
|
111 | 111 | $result[0] = $result; |
112 | 112 | $result[1] = $device_uid; |
113 | 113 | } |
114 | 114 | |
115 | - /* |
|
115 | + /* |
|
116 | 116 | var_dump($result); |
117 | 117 | */ |
118 | 118 | |
119 | - return $result; |
|
120 | - } |
|
121 | - abstract function getPayload(); |
|
122 | - /** |
|
123 | - * Gets Sign headers |
|
124 | - * @return array headers |
|
125 | - */ |
|
126 | - private function getSignHeaders() |
|
127 | - { |
|
119 | + return $result; |
|
120 | + } |
|
121 | + abstract function getPayload(); |
|
122 | + /** |
|
123 | + * Gets Sign headers |
|
124 | + * @return array headers |
|
125 | + */ |
|
126 | + private function getSignHeaders() |
|
127 | + { |
|
128 | 128 | if($this->getAccessToken() == null) { |
129 | 129 | $payload_accessToken = ""; |
130 | 130 | } |
@@ -133,54 +133,54 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | |
136 | - $headers = array( |
|
137 | - "Connection" => "keep-alive", |
|
138 | - "Accept-Encoding" => "gzip", |
|
139 | - "Content-Type" => "application/json; charset=UTF-8", |
|
140 | - "User-Agent" => self::USERAGENT |
|
141 | - ); |
|
142 | - $timestamp = new DateTime(); |
|
143 | - $timestamp = $timestamp->format(DateTime::ATOM); |
|
144 | - $timestamp = substr($timestamp, 0, -6); |
|
145 | - $timestamp .= "Z"; |
|
146 | - $urlParts = parse_url($this->getFullUrl()); |
|
147 | - $url2 = ""; |
|
148 | - $req = [$this->getMethod(), |
|
149 | - $urlParts['host'], |
|
150 | - "443", |
|
151 | - $urlParts['path'], |
|
152 | - $payload_accessToken, |
|
153 | - $timestamp, |
|
154 | - $url2, |
|
155 | - $this->payLoad]; |
|
156 | - $reqString = implode("%", $req); |
|
157 | - $secret = self::SECRET; |
|
158 | - $signature = hash_hmac('sha1', $reqString, $secret); |
|
159 | - $signature = strtoupper($signature); |
|
160 | - $headers['X-Authorization'] = 'HMAC ' . $signature; |
|
161 | - $headers['X-Client-Type'] = self::CLIENT_TYPE; |
|
162 | - $headers['X-Timestamp'] = $timestamp; |
|
163 | - $headers['X-Api-Version'] = '0.2'; |
|
164 | - return $headers; |
|
165 | - } |
|
166 | - private function getFullUrl() |
|
167 | - { |
|
168 | - return self::APIURL . $this->getApiEndPoint(); |
|
169 | - } |
|
170 | - abstract function getApiEndPoint(); |
|
171 | - abstract function getMethod(); |
|
172 | - /** |
|
173 | - * @return string |
|
174 | - */ |
|
175 | - private function getAccessToken() |
|
176 | - { |
|
177 | - return $this->accessToken; |
|
178 | - } |
|
179 | - /** |
|
180 | - * @param string $accessToken |
|
181 | - */ |
|
182 | - public function setAccessToken($accessToken) |
|
183 | - { |
|
184 | - $this->accessToken = $accessToken; |
|
185 | - } |
|
136 | + $headers = array( |
|
137 | + "Connection" => "keep-alive", |
|
138 | + "Accept-Encoding" => "gzip", |
|
139 | + "Content-Type" => "application/json; charset=UTF-8", |
|
140 | + "User-Agent" => self::USERAGENT |
|
141 | + ); |
|
142 | + $timestamp = new DateTime(); |
|
143 | + $timestamp = $timestamp->format(DateTime::ATOM); |
|
144 | + $timestamp = substr($timestamp, 0, -6); |
|
145 | + $timestamp .= "Z"; |
|
146 | + $urlParts = parse_url($this->getFullUrl()); |
|
147 | + $url2 = ""; |
|
148 | + $req = [$this->getMethod(), |
|
149 | + $urlParts['host'], |
|
150 | + "443", |
|
151 | + $urlParts['path'], |
|
152 | + $payload_accessToken, |
|
153 | + $timestamp, |
|
154 | + $url2, |
|
155 | + $this->payLoad]; |
|
156 | + $reqString = implode("%", $req); |
|
157 | + $secret = self::SECRET; |
|
158 | + $signature = hash_hmac('sha1', $reqString, $secret); |
|
159 | + $signature = strtoupper($signature); |
|
160 | + $headers['X-Authorization'] = 'HMAC ' . $signature; |
|
161 | + $headers['X-Client-Type'] = self::CLIENT_TYPE; |
|
162 | + $headers['X-Timestamp'] = $timestamp; |
|
163 | + $headers['X-Api-Version'] = '0.2'; |
|
164 | + return $headers; |
|
165 | + } |
|
166 | + private function getFullUrl() |
|
167 | + { |
|
168 | + return self::APIURL . $this->getApiEndPoint(); |
|
169 | + } |
|
170 | + abstract function getApiEndPoint(); |
|
171 | + abstract function getMethod(); |
|
172 | + /** |
|
173 | + * @return string |
|
174 | + */ |
|
175 | + private function getAccessToken() |
|
176 | + { |
|
177 | + return $this->accessToken; |
|
178 | + } |
|
179 | + /** |
|
180 | + * @param string $accessToken |
|
181 | + */ |
|
182 | + public function setAccessToken($accessToken) |
|
183 | + { |
|
184 | + $this->accessToken = $accessToken; |
|
185 | + } |
|
186 | 186 | } |
@@ -2,25 +2,25 @@ |
||
2 | 2 | |
3 | 3 | class GetChannel extends AbstractRequest |
4 | 4 | { |
5 | - /** |
|
6 | - * @var Location |
|
7 | - */ |
|
8 | - public $location; |
|
9 | - public $channel; |
|
10 | - public $hasPayload = FALSE; |
|
5 | + /** |
|
6 | + * @var Location |
|
7 | + */ |
|
8 | + public $location; |
|
9 | + public $channel; |
|
10 | + public $hasPayload = FALSE; |
|
11 | 11 | |
12 | - function getApiEndPoint() |
|
13 | - { |
|
14 | - $apiEndPoint = '/v3/posts/hashtag/combo?hashtag=' . $this->channel; |
|
15 | - return $apiEndPoint; |
|
16 | - } |
|
17 | - function getPayload() |
|
18 | - { |
|
19 | - return array( |
|
20 | - ); |
|
21 | - } |
|
22 | - function getMethod() |
|
23 | - { |
|
24 | - return 'GET'; |
|
25 | - } |
|
12 | + function getApiEndPoint() |
|
13 | + { |
|
14 | + $apiEndPoint = '/v3/posts/hashtag/combo?hashtag=' . $this->channel; |
|
15 | + return $apiEndPoint; |
|
16 | + } |
|
17 | + function getPayload() |
|
18 | + { |
|
19 | + return array( |
|
20 | + ); |
|
21 | + } |
|
22 | + function getMethod() |
|
23 | + { |
|
24 | + return 'GET'; |
|
25 | + } |
|
26 | 26 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | class Jodel |
4 | 4 | { |
5 | - public $jodel; |
|
5 | + public $jodel; |
|
6 | 6 | |
7 | 7 | |
8 | 8 | } |
9 | 9 | \ No newline at end of file |
@@ -9,75 +9,75 @@ discard block |
||
9 | 9 | * Compute HTML Code |
10 | 10 | */ |
11 | 11 | function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE) |
12 | - { //ToDO |
|
13 | - //Replace # with link |
|
14 | - //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
|
15 | - |
|
16 | - //Time to time difference |
|
17 | - $now = new DateTime(); |
|
18 | - $d = new DateTime($post['created_at']); |
|
19 | - $timediff = $now->diff($d); |
|
20 | - |
|
21 | - $timediff_inSeconds = (string)$timediff->format('%s'); |
|
22 | - $timediff_inMinutes = (string)$timediff->format('%i'); |
|
23 | - $timediff_inHours = (string)$timediff->format('%h'); |
|
24 | - $timediff_inDays = (string)$timediff->format('%d'); |
|
25 | - $timediff_inMonth = (string)$timediff->format('%m'); |
|
26 | - |
|
27 | - if($timediff_inMonth!=0) |
|
28 | - { |
|
29 | - $timediff = $timediff_inMonth . "m"; |
|
30 | - } |
|
31 | - else |
|
32 | - { |
|
33 | - if($timediff_inDays!=0) |
|
34 | - { |
|
35 | - $timediff = $timediff_inDays . "d"; |
|
36 | - } |
|
37 | - else |
|
38 | - { |
|
39 | - if($timediff_inHours!=0) |
|
40 | - { |
|
41 | - $timediff = $timediff_inHours . "h"; |
|
42 | - } |
|
43 | - else |
|
44 | - { |
|
45 | - if($timediff_inMinutes!=0) |
|
46 | - { |
|
47 | - $timediff = $timediff_inMinutes . "m"; |
|
48 | - } |
|
49 | - else |
|
50 | - { |
|
51 | - $timediff = $timediff_inSeconds . "s"; |
|
52 | - } |
|
53 | - } |
|
54 | - } |
|
55 | - } |
|
56 | - |
|
57 | - |
|
58 | - ?> |
|
12 | + { //ToDO |
|
13 | + //Replace # with link |
|
14 | + //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
|
15 | + |
|
16 | + //Time to time difference |
|
17 | + $now = new DateTime(); |
|
18 | + $d = new DateTime($post['created_at']); |
|
19 | + $timediff = $now->diff($d); |
|
20 | + |
|
21 | + $timediff_inSeconds = (string)$timediff->format('%s'); |
|
22 | + $timediff_inMinutes = (string)$timediff->format('%i'); |
|
23 | + $timediff_inHours = (string)$timediff->format('%h'); |
|
24 | + $timediff_inDays = (string)$timediff->format('%d'); |
|
25 | + $timediff_inMonth = (string)$timediff->format('%m'); |
|
26 | + |
|
27 | + if($timediff_inMonth!=0) |
|
28 | + { |
|
29 | + $timediff = $timediff_inMonth . "m"; |
|
30 | + } |
|
31 | + else |
|
32 | + { |
|
33 | + if($timediff_inDays!=0) |
|
34 | + { |
|
35 | + $timediff = $timediff_inDays . "d"; |
|
36 | + } |
|
37 | + else |
|
38 | + { |
|
39 | + if($timediff_inHours!=0) |
|
40 | + { |
|
41 | + $timediff = $timediff_inHours . "h"; |
|
42 | + } |
|
43 | + else |
|
44 | + { |
|
45 | + if($timediff_inMinutes!=0) |
|
46 | + { |
|
47 | + $timediff = $timediff_inMinutes . "m"; |
|
48 | + } |
|
49 | + else |
|
50 | + { |
|
51 | + $timediff = $timediff_inSeconds . "s"; |
|
52 | + } |
|
53 | + } |
|
54 | + } |
|
55 | + } |
|
56 | + |
|
57 | + |
|
58 | + ?> |
|
59 | 59 | <article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color'];?>;"> |
60 | 60 | <content> |
61 | 61 | <?php |
62 | - if(isset($post['image_url'])) |
|
63 | - { |
|
64 | - $regexRest = '/[^\w$ .!?-]+/u'; |
|
65 | - |
|
66 | - echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
|
67 | - } |
|
68 | - else { |
|
69 | - echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
|
70 | - } |
|
71 | - ?> |
|
62 | + if(isset($post['image_url'])) |
|
63 | + { |
|
64 | + $regexRest = '/[^\w$ .!?-]+/u'; |
|
65 | + |
|
66 | + echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
|
67 | + } |
|
68 | + else { |
|
69 | + echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
|
70 | + } |
|
71 | + ?> |
|
72 | 72 | </content> |
73 | 73 | <aside> |
74 | 74 | <?php |
75 | - if($isDetailedView) |
|
76 | - {?> |
|
75 | + if($isDetailedView) |
|
76 | + {?> |
|
77 | 77 | <a href="index.php?vote=up&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow"> |
78 | 78 | <?php } |
79 | - else |
|
80 | - {?> |
|
79 | + else |
|
80 | + {?> |
|
81 | 81 | <a href="index.php?vote=up&postId=<?php echo $post['post_id'];?>" rel="nofollow"> |
82 | 82 | <?php } ?> |
83 | 83 | <i class="fa fa-angle-up fa-3x"></i> |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | <br /> |
86 | 86 | <?php echo $post["vote_count"];?><br /> |
87 | 87 | <?php |
88 | - if($isDetailedView) |
|
89 | - {?> |
|
88 | + if($isDetailedView) |
|
89 | + {?> |
|
90 | 90 | <a href="index.php?vote=down&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow"> |
91 | 91 | <?php } |
92 | - else |
|
93 | - {?> |
|
92 | + else |
|
93 | + {?> |
|
94 | 94 | <a href="index.php?vote=down&postId=<?php echo $post['post_id'];?>" rel="nofollow"> |
95 | 95 | <?php } ?> |
96 | 96 | <i class="fa fa-angle-down fa-3x"></i> |
@@ -113,39 +113,39 @@ discard block |
||
113 | 113 | <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postId=<?php echo $post["post_id"];?>"> |
114 | 114 | <i class="fa fa-commenting-o"></i> |
115 | 115 | <?php if(array_key_exists("child_count", $post)) { |
116 | - echo $post["child_count"]; |
|
117 | - } else echo "0"; |
|
118 | - ?> |
|
116 | + echo $post["child_count"]; |
|
117 | + } else echo "0"; |
|
118 | + ?> |
|
119 | 119 | </a> |
120 | 120 | </span> |
121 | 121 | <?php } ?> |
122 | 122 | </td> |
123 | 123 | <td class="distance"> |
124 | 124 | <?php |
125 | - if($isDetailedView) |
|
126 | - { |
|
127 | - if(isset($post["parent_creator"]) && $post["parent_creator"] == 1) |
|
128 | - { |
|
129 | - ?> |
|
125 | + if($isDetailedView) |
|
126 | + { |
|
127 | + if(isset($post["parent_creator"]) && $post["parent_creator"] == 1) |
|
128 | + { |
|
129 | + ?> |
|
130 | 130 | <span data-tooltip="Author"> |
131 | 131 | <i class="fa fa-user-o"></i> OJ | |
132 | 132 | </span> |
133 | 133 | <?php |
134 | - } |
|
135 | - else |
|
136 | - { |
|
137 | - //Is not parent Jodel in detailed View |
|
138 | - if(!array_key_exists('child_count', $post) && array_key_exists('parent_creator', $post)) |
|
139 | - { |
|
140 | - ?> |
|
134 | + } |
|
135 | + else |
|
136 | + { |
|
137 | + //Is not parent Jodel in detailed View |
|
138 | + if(!array_key_exists('child_count', $post) && array_key_exists('parent_creator', $post)) |
|
139 | + { |
|
140 | + ?> |
|
141 | 141 | <span data-tooltip="Author"> |
142 | 142 | <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> | |
143 | 143 | </span> |
144 | 144 | <?php |
145 | - } |
|
146 | - } |
|
147 | - } |
|
148 | - ?> |
|
145 | + } |
|
146 | + } |
|
147 | + } |
|
148 | + ?> |
|
149 | 149 | |
150 | 150 | <span class="tip" data-tooltip="Distance"> |
151 | 151 | <i class="fa fa-map-marker"></i> |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | </footer> |
159 | 159 | </article> |
160 | 160 | <?php |
161 | - } |
|
161 | + } |
|
162 | 162 | |
163 | 163 | |
164 | 164 | /** |
@@ -3,18 +3,18 @@ |
||
3 | 3 | |
4 | 4 | class GetPostDetails extends AbstractRequest { |
5 | 5 | |
6 | - function getApiEndPoint() |
|
7 | - { |
|
8 | - return '/v2/posts/' . $_GET['postId']; |
|
9 | - } |
|
10 | - function getPayload() |
|
11 | - { |
|
12 | - return array( |
|
13 | - ); |
|
14 | - } |
|
15 | - function getMethod() |
|
16 | - { |
|
17 | - return 'GET'; |
|
18 | - } |
|
6 | + function getApiEndPoint() |
|
7 | + { |
|
8 | + return '/v2/posts/' . $_GET['postId']; |
|
9 | + } |
|
10 | + function getPayload() |
|
11 | + { |
|
12 | + return array( |
|
13 | + ); |
|
14 | + } |
|
15 | + function getMethod() |
|
16 | + { |
|
17 | + return 'GET'; |
|
18 | + } |
|
19 | 19 | } |
20 | 20 |