@@ -1,5 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | -class Upvote extends AbstractRequest { |
|
| 2 | +class Upvote extends AbstractRequest |
|
| 3 | +{ |
|
| 3 | 4 | |
| 4 | 5 | public $postId; |
| 5 | 6 | |
@@ -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 | |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | abstract class AbstractRequest |
| 4 | -{ |
|
| 4 | +{ |
|
| 5 | 5 | const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
| 6 | 6 | const APIURL = 'https://api.go-tellm.com/api'; |
| 7 | 7 | const SECRET = 'OFIqFvBgkccPNTVbIzkYaSmrwMlbVzRoOBBjXUIG'; |
@@ -19,7 +19,8 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $this->payLoad = $this->getPayload(); |
| 21 | 21 | $device_uid = ''; |
| 22 | - if(isset($this->payLoad['device_uid'])) { |
|
| 22 | + if(isset($this->payLoad['device_uid'])) |
|
| 23 | + { |
|
| 23 | 24 | $device_uid = $this->payLoad['device_uid']; |
| 24 | 25 | } |
| 25 | 26 | |
@@ -28,7 +29,8 @@ discard block |
||
| 28 | 29 | $header = $this->getSignHeaders(); |
| 29 | 30 | $url = $this->getFullUrl(); |
| 30 | 31 | |
| 31 | - if ($this->getAccessToken()) { |
|
| 32 | + if ($this->getAccessToken()) |
|
| 33 | + { |
|
| 32 | 34 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
| 33 | 35 | } |
| 34 | 36 | //Comment out to debug the Request: |
@@ -45,7 +47,8 @@ discard block |
||
| 45 | 47 | 'proxy' => '186.103.169.165:8080', |
| 46 | 48 | );*/ |
| 47 | 49 | |
| 48 | - switch ($this->getMethod()) { |
|
| 50 | + switch ($this->getMethod()) |
|
| 51 | + { |
|
| 49 | 52 | case 'POST': |
| 50 | 53 | $result = Requests::post($url, $header, $this->payLoad); |
| 51 | 54 | break; |
@@ -63,7 +66,8 @@ discard block |
||
| 63 | 66 | $result = Requests::put($url, $header, $this->payLoad); |
| 64 | 67 | break; |
| 65 | 68 | } |
| 66 | - switch ($result->status_code) { |
|
| 69 | + switch ($result->status_code) |
|
| 70 | + { |
|
| 67 | 71 | case 200: |
| 68 | 72 | $result = json_decode($result->body, true); |
| 69 | 73 | break; |
@@ -114,10 +118,12 @@ discard block |
||
| 114 | 118 | */ |
| 115 | 119 | private function getSignHeaders() |
| 116 | 120 | { |
| 117 | - if($this->getAccessToken() == null) { |
|
| 121 | + if($this->getAccessToken() == null) |
|
| 122 | + { |
|
| 118 | 123 | $payload_accessToken = ""; |
| 119 | 124 | } |
| 120 | - else { |
|
| 125 | + else |
|
| 126 | + { |
|
| 121 | 127 | $payload_accessToken = $this->getAccessToken(); |
| 122 | 128 | } |
| 123 | 129 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | const USERAGENT = 'Jodel/4.32.2 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )'; |
| 9 | 9 | const CLIENT_TYPE = 'android_4.32.2'; |
| 10 | 10 | |
| 11 | - private $accessToken = null; |
|
| 11 | + private $accessToken = NULL; |
|
| 12 | 12 | private $payLoad; |
| 13 | 13 | public $expects = ''; |
| 14 | 14 | public $version = 'v2'; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | switch ($result->status_code) { |
| 67 | 67 | case 200: |
| 68 | - $result = json_decode($result->body, true); |
|
| 68 | + $result = json_decode($result->body, TRUE); |
|
| 69 | 69 | break; |
| 70 | 70 | case 204: |
| 71 | 71 | $result = "Success"; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | private function getSignHeaders() |
| 116 | 116 | { |
| 117 | - if($this->getAccessToken() == null) { |
|
| 117 | + if($this->getAccessToken() == NULL) { |
|
| 118 | 118 | $payload_accessToken = ""; |
| 119 | 119 | } |
| 120 | 120 | else { |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $header = $this->getSignHeaders(); |
| 29 | 29 | $url = $this->getFullUrl(); |
| 30 | 30 | |
| 31 | - if ($this->getAccessToken()) { |
|
| 31 | + if($this->getAccessToken()) { |
|
| 32 | 32 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
| 33 | 33 | } |
| 34 | 34 | //Comment out to debug the Request: |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | 'proxy' => '186.103.169.165:8080', |
| 51 | 51 | );*/ |
| 52 | 52 | |
| 53 | - switch ($this->getMethod()) { |
|
| 53 | + switch($this->getMethod()) { |
|
| 54 | 54 | case 'POST': |
| 55 | 55 | $result = Requests::post($url, $header, $this->payLoad); |
| 56 | 56 | break; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $result = Requests::put($url, $header, $this->payLoad); |
| 69 | 69 | break; |
| 70 | 70 | } |
| 71 | - switch ($result->status_code) { |
|
| 71 | + switch($result->status_code) { |
|
| 72 | 72 | case 200: |
| 73 | 73 | $result = json_decode($result->body, true); |
| 74 | 74 | break; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | exit("Error 403: Access denied"); |
| 97 | 97 | break; |
| 98 | 98 | default: |
| 99 | - error_log('Error '.$result->status_code.' - Unauthorized'); // - JodelDeviceId:' . $deviceUid); |
|
| 99 | + error_log('Error ' . $result->status_code . ' - Unauthorized'); // - JodelDeviceId:' . $deviceUid); |
|
| 100 | 100 | //throw new \Exception('Unknown Error: '.$result->status_code); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -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 | } |
@@ -616,7 +616,7 @@ |
||
| 616 | 616 | <?php |
| 617 | 617 | if(is_file('./piwik-script.html')) |
| 618 | 618 | { |
| 619 | - require_once('./piwik-script.html'); |
|
| 619 | + require_once('./piwik-script.html'); |
|
| 620 | 620 | } |
| 621 | 621 | ?> |
| 622 | 622 | |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | -<?php include 'php/jodel-web.php';?> |
|
| 1 | +<?php include 'php/jodel-web.php'; ?> |
|
| 2 | 2 | <!DOCTYPE html> |
| 3 | 3 | <html lang="en"> |
| 4 | 4 | <head> |
| 5 | - <title><?php echo $viewTest::getTitle($posts[0], $view, $isDetailedView);?></title> |
|
| 5 | + <title><?php echo $viewTest::getTitle($posts[0], $view, $isDetailedView); ?></title> |
|
| 6 | 6 | |
| 7 | 7 | <meta charset="utf-8"> |
| 8 | 8 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
| 9 | 9 | <meta http-equiv="x-ua-compatible" content="ie=edge"> |
| 10 | 10 | |
| 11 | - <meta name="description" content="<?php echo $viewTest::getMetaDescription($posts[0], $view, $isDetailedView);?>"> |
|
| 11 | + <meta name="description" content="<?php echo $viewTest::getMetaDescription($posts[0], $view, $isDetailedView); ?>"> |
|
| 12 | 12 | <meta name="keywords" content="jodelblue, jodel, blue, webclient, web, client, web-app, browser, app"> |
| 13 | 13 | |
| 14 | 14 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous"> |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | <content id="posts"> |
| 92 | 92 | <?php |
| 93 | - for($i = 0; $i<$loops; $i++) |
|
| 93 | + for($i = 0; $i < $loops; $i++) |
|
| 94 | 94 | { |
| 95 | 95 | if(array_key_exists($i, $posts) && array_key_exists('post_id', $posts[$i]) && isset($posts[$i]['post_id'])) |
| 96 | 96 | { |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
| 135 | 135 | <h2>Comment on Jodel</h2> |
| 136 | 136 | <form method="POST"> |
| 137 | - <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
|
| 137 | + <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" /> |
|
| 138 | 138 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
| 139 | 139 | <br /> |
| 140 | 140 | <input type="submit" value="SEND" /> |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | <div class="col-xs-12"> |
| 172 | 172 | <div class="row"> |
| 173 | 173 | <div class="col-xs-3"> |
| 174 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 174 | + <a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 175 | 175 | </div> |
| 176 | 176 | <div class="col-xs-3"> |
| 177 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 177 | + <a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 178 | 178 | </div> |
| 179 | 179 | <div class="col-xs-3"> |
| 180 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 180 | + <a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 181 | 181 | </div> |
| 182 | 182 | <div class="col-xs-3"> |
| 183 | 183 | <nav> |
@@ -75,7 +75,11 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | <div id="location_mobile" class="hidden-sm-up"> |
| 77 | 77 | <form method="get"> |
| 78 | - <input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
| 78 | + <input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus)) |
|
| 79 | +{ |
|
| 80 | + echo $newPositionStatus; |
|
| 81 | +} |
|
| 82 | +?>" required> |
|
| 79 | 83 | |
| 80 | 84 | <input type="submit" id="submit_mobile" class="fa" value="" /> |
| 81 | 85 | </form> |
@@ -102,7 +106,9 @@ discard block |
||
| 102 | 106 | |
| 103 | 107 | </content> |
| 104 | 108 | |
| 105 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 109 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
| 110 | +{ |
|
| 111 | +?> |
|
| 106 | 112 | <p id="loading"> |
| 107 | 113 | Loading… |
| 108 | 114 | </p> |
@@ -115,7 +121,11 @@ discard block |
||
| 115 | 121 | <div> |
| 116 | 122 | <h2>Position / Hashtag</h2> |
| 117 | 123 | <form method="get"> |
| 118 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
| 124 | + <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) |
|
| 125 | +{ |
|
| 126 | + echo $newPositionStatus; |
|
| 127 | +} |
|
| 128 | +?>" required> |
|
| 119 | 129 | <label>try: #jhj</label><br> |
| 120 | 130 | <input type="submit" value="Set Location" /> |
| 121 | 131 | </form> |
@@ -131,7 +141,9 @@ discard block |
||
| 131 | 141 | |
| 132 | 142 | <article> |
| 133 | 143 | <div> |
| 134 | - <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
|
| 144 | + <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) |
|
| 145 | +{ |
|
| 146 | +?> |
|
| 135 | 147 | <h2>Comment on Jodel</h2> |
| 136 | 148 | <form method="POST"> |
| 137 | 149 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
@@ -139,7 +151,10 @@ discard block |
||
| 139 | 151 | <br /> |
| 140 | 152 | <input type="submit" value="SEND" /> |
| 141 | 153 | </form> |
| 142 | - <?php } else { ?> |
|
| 154 | + <?php } |
|
| 155 | +else |
|
| 156 | +{ |
|
| 157 | +?> |
|
| 143 | 158 | <h2>New Jodel</h2> |
| 144 | 159 | <form method="POST"> |
| 145 | 160 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -171,13 +186,25 @@ discard block |
||
| 171 | 186 | <div class="col-xs-12"> |
| 172 | 187 | <div class="row"> |
| 173 | 188 | <div class="col-xs-3"> |
| 174 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 189 | + <a href="index.php" <?php if($view=='time') |
|
| 190 | +{ |
|
| 191 | + echo 'class="active"'; |
|
| 192 | +} |
|
| 193 | +?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 175 | 194 | </div> |
| 176 | 195 | <div class="col-xs-3"> |
| 177 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 196 | + <a href="index.php?view=comment" <?php if($view=='comment') |
|
| 197 | +{ |
|
| 198 | + echo 'class="active"'; |
|
| 199 | +} |
|
| 200 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 178 | 201 | </div> |
| 179 | 202 | <div class="col-xs-3"> |
| 180 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 203 | + <a href="index.php?view=upVote" <?php if($view=='upVote') |
|
| 204 | +{ |
|
| 205 | + echo 'class="active"'; |
|
| 206 | +} |
|
| 207 | +?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 181 | 208 | </div> |
| 182 | 209 | <div class="col-xs-3"> |
| 183 | 210 | <nav> |
@@ -218,7 +245,9 @@ discard block |
||
| 218 | 245 | $('html,body').animate({scrollTop: aTag.offset().top-90},'slow'); |
| 219 | 246 | } |
| 220 | 247 | |
| 221 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 248 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
| 249 | +{ |
|
| 250 | +?> |
|
| 222 | 251 | |
| 223 | 252 | |
| 224 | 253 | |
@@ -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 | |
@@ -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 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class GetCaptcha extends AbstractRequest |
| 3 | -{ |
|
| 3 | +{ |
|
| 4 | 4 | function getApiEndPoint() |
| 5 | 5 | { |
| 6 | 6 | return '/v3/user/verification/imageCaptcha/'; |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | $config = parse_ini_file('config/config.ini.php'); |
| 4 | 4 | if(!isset($_GET['pw']) || $config['pw'] != $_GET['pw']) |
| 5 | 5 | { |
| 6 | - error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php'); |
|
| 7 | - $respone = array("message" => $_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php',"success" => false); |
|
| 6 | + error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php'); |
|
| 7 | + $respone = array("message" => $_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php', "success" => false); |
|
| 8 | 8 | echo json_encode($response); |
| 9 | 9 | |
| 10 | 10 | die(); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | -if (isset($captcha)) |
|
| 73 | +if(isset($captcha)) |
|
| 74 | 74 | { |
| 75 | 75 | $response = array("success" => $success, "message" => $message, "captcha" => $captcha, "accessToken" => $token); |
| 76 | 76 | } |
@@ -40,17 +40,20 @@ discard block |
||
| 40 | 40 | $token = $accessToken; |
| 41 | 41 | $success = false; |
| 42 | 42 | } |
| 43 | - else { |
|
| 43 | + else |
|
| 44 | + { |
|
| 44 | 45 | |
| 45 | 46 | $location = getLocationByAccessToken($accessToken); |
| 46 | 47 | |
| 47 | 48 | $accessToken = isTokenFreshByAccessToken($location, $accessToken); |
| 48 | 49 | |
| 49 | 50 | |
| 50 | - if($_POST['vote'] == "up") { |
|
| 51 | + if($_POST['vote'] == "up") |
|
| 52 | + { |
|
| 51 | 53 | $accountCreator = new Upvote(); |
| 52 | 54 | } |
| 53 | - else if($_POST['vote'] == "down") { |
|
| 55 | + else if($_POST['vote'] == "down") |
|
| 56 | + { |
|
| 54 | 57 | $accountCreator = new Downvote(); |
| 55 | 58 | } |
| 56 | 59 | |
@@ -74,7 +77,7 @@ discard block |
||
| 74 | 77 | { |
| 75 | 78 | $response = array("success" => $success, "message" => $message, "captcha" => $captcha, "accessToken" => $token); |
| 76 | 79 | } |
| 77 | -else |
|
| 80 | +else |
|
| 78 | 81 | { |
| 79 | 82 | $response = array("success" => $success, "message" => $message); |
| 80 | 83 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | if(!isset($_GET['pw']) || $config['pw'] != $_GET['pw']) |
| 5 | 5 | { |
| 6 | 6 | error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php'); |
| 7 | - $respone = array("message" => $_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php',"success" => false); |
|
| 7 | + $respone = array("message" => $_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php',"success" => FALSE); |
|
| 8 | 8 | echo json_encode($response); |
| 9 | 9 | |
| 10 | 10 | die(); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | $message = ""; |
| 23 | -$success = true; |
|
| 23 | +$success = TRUE; |
|
| 24 | 24 | $token = ""; |
| 25 | 25 | if(isset($_POST['vote']) && isset($_POST['postId'])) |
| 26 | 26 | { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $message = "This account is not verified. Please verify this account first."; |
| 39 | 39 | $captcha = getCaptcha($accessToken); |
| 40 | 40 | $token = $accessToken; |
| 41 | - $success = false; |
|
| 41 | + $success = FALSE; |
|
| 42 | 42 | } |
| 43 | 43 | else { |
| 44 | 44 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | else |
| 67 | 67 | { |
| 68 | 68 | $message = 'There is no account available for this jodel. Please create at least one new account to vote this jodel.'; |
| 69 | - $success = false; |
|
| 69 | + $success = FALSE; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
@@ -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 |