@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Upvote extends AbstractRequest { |
| 3 | 3 | |
| 4 | - public $postId; |
|
| 4 | + public $postId; |
|
| 5 | 5 | |
| 6 | - function getApiEndPoint() |
|
| 7 | - { |
|
| 8 | - return '/v2/posts/' . $this->postId . '/upvote'; |
|
| 9 | - } |
|
| 10 | - function getPayload() |
|
| 11 | - { |
|
| 12 | - return array( |
|
| 6 | + function getApiEndPoint() |
|
| 7 | + { |
|
| 8 | + return '/v2/posts/' . $this->postId . '/upvote'; |
|
| 9 | + } |
|
| 10 | + function getPayload() |
|
| 11 | + { |
|
| 12 | + return array( |
|
| 13 | 13 | // "reason_code" => -1, |
| 14 | - ); |
|
| 15 | - } |
|
| 16 | - function getMethod() |
|
| 17 | - { |
|
| 18 | - return 'PUT'; |
|
| 19 | - } |
|
| 14 | + ); |
|
| 15 | + } |
|
| 16 | + function getMethod() |
|
| 17 | + { |
|
| 18 | + return 'PUT'; |
|
| 19 | + } |
|
| 20 | 20 | } |
| 21 | 21 | |
@@ -297,11 +297,11 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | if($result->num_rows == 0) |
| 299 | 299 | { |
| 300 | - return FALSE; |
|
| 300 | + return FALSE; |
|
| 301 | 301 | } |
| 302 | 302 | else |
| 303 | 303 | { |
| 304 | - return TRUE; |
|
| 304 | + return TRUE; |
|
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | { |
| 399 | 399 | preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
| 400 | 400 | |
| 401 | - return (isset($matches[0])) ? true : false; |
|
| 401 | + return (isset($matches[0])) ? true : false; |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | function botDeviceUidIsSet($config) |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | <?php |
| 505 | 505 | if(isset($post['image_url'])) |
| 506 | 506 | { |
| 507 | - $regexRest = '/[^\w$ .!?-]+/u'; |
|
| 507 | + $regexRest = '/[^\w$ .!?-]+/u'; |
|
| 508 | 508 | |
| 509 | 509 | echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
| 510 | 510 | } |
@@ -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 | |
@@ -2,19 +2,19 @@ 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'; |
|
| 11 | + private $accessToken = null; |
|
| 12 | + private $payLoad; |
|
| 13 | + public $expects = ''; |
|
| 14 | + public $version = 'v2'; |
|
| 15 | 15 | |
| 16 | - public function execute() |
|
| 17 | - { |
|
| 16 | + public function execute() |
|
| 17 | + { |
|
| 18 | 18 | $result = new \stdClass(); |
| 19 | 19 | |
| 20 | 20 | $this->payLoad = $this->getPayload(); |
@@ -24,16 +24,16 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - $this->payLoad = json_encode($this->payLoad); |
|
| 28 | - $header = $this->getSignHeaders(); |
|
| 29 | - $url = $this->getFullUrl(); |
|
| 27 | + $this->payLoad = json_encode($this->payLoad); |
|
| 28 | + $header = $this->getSignHeaders(); |
|
| 29 | + $url = $this->getFullUrl(); |
|
| 30 | 30 | |
| 31 | - if ($this->getAccessToken()) { |
|
| 32 | - $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
|
| 33 | - } |
|
| 34 | - //Comment out to debug the Request: |
|
| 31 | + if ($this->getAccessToken()) { |
|
| 32 | + $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
|
| 33 | + } |
|
| 34 | + //Comment out to debug the Request: |
|
| 35 | 35 | |
| 36 | - /* |
|
| 36 | + /* |
|
| 37 | 37 | printf("URL: "); |
| 38 | 38 | var_dump($url); |
| 39 | 39 | echo "<br />"; |
@@ -44,82 +44,82 @@ discard block |
||
| 44 | 44 | var_dump($this->payLoad); |
| 45 | 45 | echo "<br />"; |
| 46 | 46 | */ |
| 47 | - /* |
|
| 47 | + /* |
|
| 48 | 48 | $options = array( |
| 49 | 49 | 'timeout' => 100, |
| 50 | 50 | 'connect_timeout' => 100, |
| 51 | 51 | 'proxy' => '186.103.169.165:8080', |
| 52 | 52 | );*/ |
| 53 | 53 | |
| 54 | - switch ($this->getMethod()) { |
|
| 55 | - case 'POST': |
|
| 56 | - $result = Requests::post($url, $header, $this->payLoad); |
|
| 57 | - break; |
|
| 58 | - case 'GET': |
|
| 59 | - if($this->version == 'v3') |
|
| 60 | - { |
|
| 61 | - $result = Requests::get($url, $header); |
|
| 62 | - } |
|
| 63 | - else |
|
| 64 | - { |
|
| 65 | - $result = Requests::get($url, $header); |
|
| 66 | - } |
|
| 67 | - break; |
|
| 68 | - case 'PUT': |
|
| 69 | - $result = Requests::put($url, $header, $this->payLoad); |
|
| 70 | - break; |
|
| 71 | - } |
|
| 72 | - switch ($result->status_code) { |
|
| 73 | - case 200: |
|
| 74 | - $result = json_decode($result->body, true); |
|
| 75 | - break; |
|
| 76 | - case 204: |
|
| 77 | - $result = "Success"; |
|
| 78 | - break; |
|
| 79 | - case 401: |
|
| 54 | + switch ($this->getMethod()) { |
|
| 55 | + case 'POST': |
|
| 56 | + $result = Requests::post($url, $header, $this->payLoad); |
|
| 57 | + break; |
|
| 58 | + case 'GET': |
|
| 59 | + if($this->version == 'v3') |
|
| 60 | + { |
|
| 61 | + $result = Requests::get($url, $header); |
|
| 62 | + } |
|
| 63 | + else |
|
| 64 | + { |
|
| 65 | + $result = Requests::get($url, $header); |
|
| 66 | + } |
|
| 67 | + break; |
|
| 68 | + case 'PUT': |
|
| 69 | + $result = Requests::put($url, $header, $this->payLoad); |
|
| 70 | + break; |
|
| 71 | + } |
|
| 72 | + switch ($result->status_code) { |
|
| 73 | + case 200: |
|
| 74 | + $result = json_decode($result->body, true); |
|
| 75 | + break; |
|
| 76 | + case 204: |
|
| 77 | + $result = "Success"; |
|
| 78 | + break; |
|
| 79 | + case 401: |
|
| 80 | 80 | //throw new \Exception('Unauthorized'); |
| 81 | - error_log('Error 401 - Unauthorized'); // - JodelDeviceId:' . $deviceUid); |
|
| 82 | - break; |
|
| 83 | - case 404: |
|
| 84 | - //echo "Es wurde bereits gevoted"; |
|
| 85 | - error_log('Error 404 - Es wurde bereits gevoted'); // - JodelDeviceId:' . $deviceUid); |
|
| 81 | + error_log('Error 401 - Unauthorized'); // - JodelDeviceId:' . $deviceUid); |
|
| 82 | + break; |
|
| 83 | + case 404: |
|
| 84 | + //echo "Es wurde bereits gevoted"; |
|
| 85 | + error_log('Error 404 - Es wurde bereits gevoted'); // - JodelDeviceId:' . $deviceUid); |
|
| 86 | 86 | case 477: |
| 87 | - //echo "Es wurde bereits gevoted"; |
|
| 88 | - //throw new \Exception('Signing failed!'); |
|
| 89 | - error_log('Error 477 - Signing failed'); // - JodelDeviceId:' . $deviceUid); |
|
| 90 | - break; |
|
| 91 | - case 429: |
|
| 92 | - error_log('Error 429 - Too Many Requests'); // - JodelDeviceId:' . $deviceUid); |
|
| 93 | - exit("Error 429: Too Many Requests"); |
|
| 94 | - break; |
|
| 95 | - case 403: |
|
| 96 | - error_log('Error 403 - Access denied'); // - JodelDeviceId:' . $deviceUid); |
|
| 97 | - exit("Error 403: Access denied"); |
|
| 98 | - break; |
|
| 99 | - default: |
|
| 100 | - error_log('Error '.$result->status_code.' - Unauthorized'); // - JodelDeviceId:' . $deviceUid); |
|
| 101 | - //throw new \Exception('Unknown Error: '.$result->status_code); |
|
| 102 | - } |
|
| 87 | + //echo "Es wurde bereits gevoted"; |
|
| 88 | + //throw new \Exception('Signing failed!'); |
|
| 89 | + error_log('Error 477 - Signing failed'); // - JodelDeviceId:' . $deviceUid); |
|
| 90 | + break; |
|
| 91 | + case 429: |
|
| 92 | + error_log('Error 429 - Too Many Requests'); // - JodelDeviceId:' . $deviceUid); |
|
| 93 | + exit("Error 429: Too Many Requests"); |
|
| 94 | + break; |
|
| 95 | + case 403: |
|
| 96 | + error_log('Error 403 - Access denied'); // - JodelDeviceId:' . $deviceUid); |
|
| 97 | + exit("Error 403: Access denied"); |
|
| 98 | + break; |
|
| 99 | + default: |
|
| 100 | + error_log('Error '.$result->status_code.' - Unauthorized'); // - JodelDeviceId:' . $deviceUid); |
|
| 101 | + //throw new \Exception('Unknown Error: '.$result->status_code); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - if($device_uid != '') |
|
| 105 | - { |
|
| 104 | + if($device_uid != '') |
|
| 105 | + { |
|
| 106 | 106 | $result[0] = $result; |
| 107 | 107 | $result[1] = $device_uid; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - /* |
|
| 110 | + /* |
|
| 111 | 111 | var_dump($result); |
| 112 | 112 | */ |
| 113 | 113 | |
| 114 | - return $result; |
|
| 115 | - } |
|
| 116 | - abstract function getPayload(); |
|
| 117 | - /** |
|
| 118 | - * Gets Sign headers |
|
| 119 | - * @return array headers |
|
| 120 | - */ |
|
| 121 | - private function getSignHeaders() |
|
| 122 | - { |
|
| 114 | + return $result; |
|
| 115 | + } |
|
| 116 | + abstract function getPayload(); |
|
| 117 | + /** |
|
| 118 | + * Gets Sign headers |
|
| 119 | + * @return array headers |
|
| 120 | + */ |
|
| 121 | + private function getSignHeaders() |
|
| 122 | + { |
|
| 123 | 123 | if($this->getAccessToken() == null) { |
| 124 | 124 | $payload_accessToken = ""; |
| 125 | 125 | } |
@@ -128,54 +128,54 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
| 131 | - $headers = array( |
|
| 132 | - "Connection" => "keep-alive", |
|
| 133 | - "Accept-Encoding" => "gzip", |
|
| 134 | - "Content-Type" => "application/json; charset=UTF-8", |
|
| 135 | - "User-Agent" => self::USERAGENT |
|
| 136 | - ); |
|
| 137 | - $timestamp = new DateTime(); |
|
| 138 | - $timestamp = $timestamp->format(DateTime::ATOM); |
|
| 139 | - $timestamp = substr($timestamp, 0, -6); |
|
| 140 | - $timestamp .= "Z"; |
|
| 141 | - $urlParts = parse_url($this->getFullUrl()); |
|
| 142 | - $url2 = ""; |
|
| 143 | - $req = [$this->getMethod(), |
|
| 144 | - $urlParts['host'], |
|
| 145 | - "443", |
|
| 146 | - $urlParts['path'], |
|
| 147 | - $payload_accessToken, |
|
| 148 | - $timestamp, |
|
| 149 | - $url2, |
|
| 150 | - $this->payLoad]; |
|
| 151 | - $reqString = implode("%", $req); |
|
| 152 | - $secret = self::SECRET; |
|
| 153 | - $signature = hash_hmac('sha1', $reqString, $secret); |
|
| 154 | - $signature = strtoupper($signature); |
|
| 155 | - $headers['X-Authorization'] = 'HMAC ' . $signature; |
|
| 156 | - $headers['X-Client-Type'] = self::CLIENT_TYPE; |
|
| 157 | - $headers['X-Timestamp'] = $timestamp; |
|
| 158 | - $headers['X-Api-Version'] = '0.2'; |
|
| 159 | - return $headers; |
|
| 160 | - } |
|
| 161 | - private function getFullUrl() |
|
| 162 | - { |
|
| 163 | - return self::APIURL . $this->getApiEndPoint(); |
|
| 164 | - } |
|
| 165 | - abstract function getApiEndPoint(); |
|
| 166 | - abstract function getMethod(); |
|
| 167 | - /** |
|
| 168 | - * @return string |
|
| 169 | - */ |
|
| 170 | - private function getAccessToken() |
|
| 171 | - { |
|
| 172 | - return $this->accessToken; |
|
| 173 | - } |
|
| 174 | - /** |
|
| 175 | - * @param string $accessToken |
|
| 176 | - */ |
|
| 177 | - public function setAccessToken($accessToken) |
|
| 178 | - { |
|
| 179 | - $this->accessToken = $accessToken; |
|
| 180 | - } |
|
| 131 | + $headers = array( |
|
| 132 | + "Connection" => "keep-alive", |
|
| 133 | + "Accept-Encoding" => "gzip", |
|
| 134 | + "Content-Type" => "application/json; charset=UTF-8", |
|
| 135 | + "User-Agent" => self::USERAGENT |
|
| 136 | + ); |
|
| 137 | + $timestamp = new DateTime(); |
|
| 138 | + $timestamp = $timestamp->format(DateTime::ATOM); |
|
| 139 | + $timestamp = substr($timestamp, 0, -6); |
|
| 140 | + $timestamp .= "Z"; |
|
| 141 | + $urlParts = parse_url($this->getFullUrl()); |
|
| 142 | + $url2 = ""; |
|
| 143 | + $req = [$this->getMethod(), |
|
| 144 | + $urlParts['host'], |
|
| 145 | + "443", |
|
| 146 | + $urlParts['path'], |
|
| 147 | + $payload_accessToken, |
|
| 148 | + $timestamp, |
|
| 149 | + $url2, |
|
| 150 | + $this->payLoad]; |
|
| 151 | + $reqString = implode("%", $req); |
|
| 152 | + $secret = self::SECRET; |
|
| 153 | + $signature = hash_hmac('sha1', $reqString, $secret); |
|
| 154 | + $signature = strtoupper($signature); |
|
| 155 | + $headers['X-Authorization'] = 'HMAC ' . $signature; |
|
| 156 | + $headers['X-Client-Type'] = self::CLIENT_TYPE; |
|
| 157 | + $headers['X-Timestamp'] = $timestamp; |
|
| 158 | + $headers['X-Api-Version'] = '0.2'; |
|
| 159 | + return $headers; |
|
| 160 | + } |
|
| 161 | + private function getFullUrl() |
|
| 162 | + { |
|
| 163 | + return self::APIURL . $this->getApiEndPoint(); |
|
| 164 | + } |
|
| 165 | + abstract function getApiEndPoint(); |
|
| 166 | + abstract function getMethod(); |
|
| 167 | + /** |
|
| 168 | + * @return string |
|
| 169 | + */ |
|
| 170 | + private function getAccessToken() |
|
| 171 | + { |
|
| 172 | + return $this->accessToken; |
|
| 173 | + } |
|
| 174 | + /** |
|
| 175 | + * @param string $accessToken |
|
| 176 | + */ |
|
| 177 | + public function setAccessToken($accessToken) |
|
| 178 | + { |
|
| 179 | + $this->accessToken = $accessToken; |
|
| 180 | + } |
|
| 181 | 181 | } |
@@ -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 | |
@@ -416,104 +416,4 @@ |
||
| 416 | 416 | |
| 417 | 417 | var win = $(window); |
| 418 | 418 | var lastPostId = "<?php echo $lastPostId; ?>"; |
| 419 | - var view = "<?php echo $view; ?>" |
|
| 420 | - var old_lastPostId = ""; |
|
| 421 | - var morePostsAvailable = true; |
|
| 422 | - |
|
| 423 | - if(window.location.hash) |
|
| 424 | - { |
|
| 425 | - var hash = window.location.hash.slice(1); |
|
| 426 | - |
|
| 427 | - if(!$("article[id='"+ hash +"']").length) |
|
| 428 | - { |
|
| 429 | - for (var i = 5; i >= 0; i--) |
|
| 430 | - { |
|
| 431 | - if(!$("article[id='"+ hash +"']").length) |
|
| 432 | - { |
|
| 433 | - $.ajax({ |
|
| 434 | - url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view, |
|
| 435 | - dataType: 'html', |
|
| 436 | - async: false, |
|
| 437 | - success: function(html) { |
|
| 438 | - var div = document.createElement('div'); |
|
| 439 | - div.innerHTML = html; |
|
| 440 | - var elements = div.childNodes; |
|
| 441 | - old_lastPostId = lastPostId; |
|
| 442 | - lastPostId = elements[3].textContent; |
|
| 443 | - lastPostId = lastPostId.replace(/\s+/g, ''); |
|
| 444 | - //alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId); |
|
| 445 | - if(lastPostId == old_lastPostId) { |
|
| 446 | - |
|
| 447 | - //morePostsAvailable = false; |
|
| 448 | - } |
|
| 449 | - else { |
|
| 450 | - //alert(elements[3].textContent); |
|
| 451 | - $('#posts').append(elements[1].innerHTML); |
|
| 452 | - $('#posts').hide().show(0); |
|
| 453 | - } |
|
| 454 | - $('#loading').hide(); |
|
| 455 | - } |
|
| 456 | - }); |
|
| 457 | - |
|
| 458 | - $('.jodel > content').Emoji(); |
|
| 459 | - } |
|
| 460 | - |
|
| 461 | - } |
|
| 462 | - scrollToAnchor(hash); |
|
| 463 | - |
|
| 464 | - } |
|
| 465 | - } |
|
| 466 | - |
|
| 467 | - // Each time the user scrolls |
|
| 468 | - win.scroll(function() { |
|
| 469 | - |
|
| 470 | - |
|
| 471 | - // End of the document reached? |
|
| 472 | - if ($(window).scrollTop() + $(window).height() > $(document).height() - 100 && morePostsAvailable) |
|
| 473 | - { |
|
| 474 | - $('#loading').show(); |
|
| 475 | - |
|
| 476 | - $.ajax({ |
|
| 477 | - url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view, |
|
| 478 | - dataType: 'html', |
|
| 479 | - async: false, |
|
| 480 | - success: function(html) { |
|
| 481 | - var div = document.createElement('div'); |
|
| 482 | - div.innerHTML = html; |
|
| 483 | - var elements = div.childNodes; |
|
| 484 | - old_lastPostId = lastPostId; |
|
| 485 | - lastPostId = elements[3].textContent; |
|
| 486 | - lastPostId = lastPostId.replace(/\s+/g, ''); |
|
| 487 | - //alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId); |
|
| 488 | - if(lastPostId == old_lastPostId) |
|
| 489 | - { |
|
| 490 | - |
|
| 491 | - //morePostsAvailable = false; |
|
| 492 | - } |
|
| 493 | - else |
|
| 494 | - { |
|
| 495 | - //alert(elements[3].textContent); |
|
| 496 | - $('#posts').append(elements[1].innerHTML); |
|
| 497 | - } |
|
| 498 | - $('#loading').hide(); |
|
| 499 | - } |
|
| 500 | - }); |
|
| 501 | - |
|
| 502 | - $('.jodel > content').Emoji(); |
|
| 503 | - } |
|
| 504 | - }); |
|
| 505 | - <?php } ?> |
|
| 506 | - }); |
|
| 507 | - |
|
| 508 | - </script> |
|
| 509 | - |
|
| 510 | - <?php |
|
| 511 | - if(is_file('./piwik-script.html')) |
|
| 512 | - { |
|
| 513 | - require_once('./piwik-script.html'); |
|
| 514 | - } |
|
| 515 | - ?> |
|
| 516 | - |
|
| 517 | - </body> |
|
| 518 | -</html> |
|
| 519 | - |
|
| 419 | + var view = "<?php echo $view |
|
| 520 | 420 | \ No newline at end of file |