@@ -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,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 |
@@ -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 |
@@ -2,41 +2,41 @@ |
||
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; |
|
11 | - public $lastPostId = ''; |
|
12 | - public $view = 'combo'; |
|
5 | + /** |
|
6 | + * @var Location |
|
7 | + */ |
|
8 | + public $location; |
|
9 | + public $channel; |
|
10 | + public $hasPayload = FALSE; |
|
11 | + public $lastPostId = ''; |
|
12 | + public $view = 'combo'; |
|
13 | 13 | |
14 | - function getApiEndPoint() |
|
15 | - { |
|
16 | - if($this->lastPostId == '') |
|
17 | - { |
|
18 | - $apiEndPoint = '/v3/posts/hashtag/' . $this->view . '?hashtag=' . $this->channel; |
|
19 | - } |
|
20 | - else |
|
21 | - { |
|
22 | - if($this->view == 'combo') |
|
23 | - { |
|
24 | - $apiEndPoint = '/v3/posts/hashtag?hashtag=' . $this->channel . '&after=' . $this->lastPostId; |
|
25 | - } |
|
26 | - else |
|
27 | - { |
|
28 | - $apiEndPoint = '/v3/posts/hashtag/' . $this->view . '?hashtag=' . $this->channel . '&after=' . $this->lastPostId; |
|
29 | - } |
|
30 | - } |
|
31 | - return $apiEndPoint; |
|
32 | - } |
|
33 | - function getPayload() |
|
34 | - { |
|
35 | - return array( |
|
36 | - ); |
|
37 | - } |
|
38 | - function getMethod() |
|
39 | - { |
|
40 | - return 'GET'; |
|
41 | - } |
|
14 | + function getApiEndPoint() |
|
15 | + { |
|
16 | + if($this->lastPostId == '') |
|
17 | + { |
|
18 | + $apiEndPoint = '/v3/posts/hashtag/' . $this->view . '?hashtag=' . $this->channel; |
|
19 | + } |
|
20 | + else |
|
21 | + { |
|
22 | + if($this->view == 'combo') |
|
23 | + { |
|
24 | + $apiEndPoint = '/v3/posts/hashtag?hashtag=' . $this->channel . '&after=' . $this->lastPostId; |
|
25 | + } |
|
26 | + else |
|
27 | + { |
|
28 | + $apiEndPoint = '/v3/posts/hashtag/' . $this->view . '?hashtag=' . $this->channel . '&after=' . $this->lastPostId; |
|
29 | + } |
|
30 | + } |
|
31 | + return $apiEndPoint; |
|
32 | + } |
|
33 | + function getPayload() |
|
34 | + { |
|
35 | + return array( |
|
36 | + ); |
|
37 | + } |
|
38 | + function getMethod() |
|
39 | + { |
|
40 | + return 'GET'; |
|
41 | + } |
|
42 | 42 | } |
@@ -129,7 +129,7 @@ |
||
129 | 129 | <?php |
130 | 130 | if(is_file(realpath(__DIR__ . '/..') . '/piwik-script.html')) |
131 | 131 | { |
132 | - include(realpath(__DIR__ . '/..') . '/piwik-script.html'); |
|
132 | + include(realpath(__DIR__ . '/..') . '/piwik-script.html'); |
|
133 | 133 | } |
134 | 134 | ?> |
135 | 135 |
@@ -13,17 +13,17 @@ |
||
13 | 13 | public $varsToDump; |
14 | 14 | |
15 | 15 | function __construct($msg = 'not Set', $varsToDump = 'not Set', $view = 'not Set', $actions = 'not Set', $accountId = 'not Set', $isVerified = 'not Set', $isTokenFresh = 'not Set', $page = 'not Set', $referrer = 'not Set') |
16 | - { |
|
17 | - $this->view = $view; |
|
18 | - $this->actions = $actions; |
|
19 | - $this->accountId = $accountId; |
|
20 | - $this->isVerified = $isVerified; |
|
21 | - $this->isTokenFresh = $isTokenFresh; |
|
22 | - $this->page = $page; |
|
23 | - $this->referrer = $referrer; |
|
24 | - $this->msg = $msg; |
|
25 | - $this->varsToDump = $varsToDump; |
|
26 | - } |
|
16 | + { |
|
17 | + $this->view = $view; |
|
18 | + $this->actions = $actions; |
|
19 | + $this->accountId = $accountId; |
|
20 | + $this->isVerified = $isVerified; |
|
21 | + $this->isTokenFresh = $isTokenFresh; |
|
22 | + $this->page = $page; |
|
23 | + $this->referrer = $referrer; |
|
24 | + $this->msg = $msg; |
|
25 | + $this->varsToDump = $varsToDump; |
|
26 | + } |
|
27 | 27 | |
28 | 28 | function writeErrorToLog() |
29 | 29 | { |
@@ -1,41 +1,41 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class SendJodel extends AbstractRequest { |
4 | - public $location; |
|
5 | - public $ancestor = ""; |
|
6 | - public $color = ""; |
|
7 | - public $image = ''; |
|
4 | + public $location; |
|
5 | + public $ancestor = ""; |
|
6 | + public $color = ""; |
|
7 | + public $image = ''; |
|
8 | 8 | |
9 | - function getApiEndPoint() |
|
10 | - { |
|
11 | - return '/v3/posts/'; |
|
12 | - } |
|
9 | + function getApiEndPoint() |
|
10 | + { |
|
11 | + return '/v3/posts/'; |
|
12 | + } |
|
13 | 13 | |
14 | - function getPayload() |
|
15 | - { |
|
16 | - if($this->image != '') |
|
17 | - { |
|
18 | - return array( |
|
19 | - "ancestor" => $this->ancestor, |
|
20 | - "color" => $this->color, |
|
21 | - "location" => $this->location->toArray(), |
|
22 | - "message" => $_POST['message'], |
|
23 | - 'image' => base64_encode($this->image), |
|
24 | - ); |
|
25 | - } |
|
26 | - else |
|
27 | - { |
|
28 | - return array( |
|
29 | - "ancestor" => $this->ancestor, |
|
30 | - "color" => $this->color, |
|
31 | - "location" => $this->location->toArray(), |
|
32 | - "message" => $_POST['message'], |
|
33 | - ); |
|
34 | - } |
|
14 | + function getPayload() |
|
15 | + { |
|
16 | + if($this->image != '') |
|
17 | + { |
|
18 | + return array( |
|
19 | + "ancestor" => $this->ancestor, |
|
20 | + "color" => $this->color, |
|
21 | + "location" => $this->location->toArray(), |
|
22 | + "message" => $_POST['message'], |
|
23 | + 'image' => base64_encode($this->image), |
|
24 | + ); |
|
25 | + } |
|
26 | + else |
|
27 | + { |
|
28 | + return array( |
|
29 | + "ancestor" => $this->ancestor, |
|
30 | + "color" => $this->color, |
|
31 | + "location" => $this->location->toArray(), |
|
32 | + "message" => $_POST['message'], |
|
33 | + ); |
|
34 | + } |
|
35 | 35 | |
36 | - } |
|
37 | - function getMethod() |
|
38 | - { |
|
39 | - return 'POST'; |
|
40 | - } |
|
36 | + } |
|
37 | + function getMethod() |
|
38 | + { |
|
39 | + return 'POST'; |
|
40 | + } |
|
41 | 41 | } |
@@ -44,17 +44,17 @@ |
||
44 | 44 | { |
45 | 45 | //insert voter into db |
46 | 46 | $db = new DatabaseConnect(); |
47 | - $result = $db->query("INSERT INTO users (user_token, remaining_votes, device_uid, rights) |
|
47 | + $result = $db->query("INSERT INTO users (user_token, remaining_votes, device_uid, rights) |
|
48 | 48 | VALUES ('" . $db->escape_string($_POST['user_token']) |
49 | - . "','" . $db->escape_string($_POST['remaining_votes']) |
|
50 | - . "','" . $db->escape_string($_POST['device_uid']) |
|
51 | - . "','" . $db->escape_string($_POST['rights']) . "')"); |
|
49 | + . "','" . $db->escape_string($_POST['remaining_votes']) |
|
50 | + . "','" . $db->escape_string($_POST['device_uid']) |
|
51 | + . "','" . $db->escape_string($_POST['rights']) . "')"); |
|
52 | 52 | |
53 | - if($result === false){ |
|
54 | - $error = db_error(); |
|
55 | - error_log($error); |
|
56 | - error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error); |
|
57 | - } |
|
53 | + if($result === false){ |
|
54 | + $error = db_error(); |
|
55 | + error_log($error); |
|
56 | + error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error); |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | //Vote |
@@ -49,27 +49,27 @@ discard block |
||
49 | 49 | |
50 | 50 | function user_log($msg) |
51 | 51 | { |
52 | - $log = $msg . PHP_EOL; |
|
53 | - file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("j.n.Y") . '.txt', $log, FILE_APPEND); |
|
52 | + $log = $msg . PHP_EOL; |
|
53 | + file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("j.n.Y") . '.txt', $log, FILE_APPEND); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | function isUserBot() |
57 | 57 | { |
58 | - preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
|
58 | + preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
|
59 | 59 | |
60 | - return (isset($matches[0])) ? true : false; |
|
60 | + return (isset($matches[0])) ? true : false; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | function configPropertyExists($config, $property) |
64 | 64 | { |
65 | - if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
|
66 | - { |
|
67 | - return FALSE; |
|
68 | - } |
|
69 | - else |
|
70 | - { |
|
71 | - return TRUE; |
|
72 | - } |
|
65 | + if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
|
66 | + { |
|
67 | + return FALSE; |
|
68 | + } |
|
69 | + else |
|
70 | + { |
|
71 | + return TRUE; |
|
72 | + } |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | function isUserVoter() |
@@ -110,19 +110,19 @@ discard block |
||
110 | 110 | |
111 | 111 | function isDeviceUidInDatabase($deviceUid) |
112 | 112 | { |
113 | - $db = new DatabaseConnect(); |
|
114 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
113 | + $db = new DatabaseConnect(); |
|
114 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
115 | 115 | |
116 | - if ($result->num_rows > 0) |
|
117 | - { |
|
118 | - $db->close(); |
|
119 | - return TRUE; |
|
120 | - } |
|
121 | - else |
|
122 | - { |
|
123 | - $db->close(); |
|
124 | - return FALSE; |
|
125 | - } |
|
116 | + if ($result->num_rows > 0) |
|
117 | + { |
|
118 | + $db->close(); |
|
119 | + return TRUE; |
|
120 | + } |
|
121 | + else |
|
122 | + { |
|
123 | + $db->close(); |
|
124 | + return FALSE; |
|
125 | + } |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | //Check if it's a Spider or Google Bot |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | if(configPropertyExists($config, 'karmaDeviceUid')) |
152 | - { |
|
153 | - $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
|
154 | - } |
|
155 | - else |
|
156 | - { |
|
157 | - error_log("No Karma deviceUid set in config file"); |
|
152 | + { |
|
153 | + $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
|
154 | + } |
|
155 | + else |
|
156 | + { |
|
157 | + error_log("No Karma deviceUid set in config file"); |
|
158 | 158 | $jodelAccountForKarma = new JodelAccount($deviceUid); |
159 | - } |
|
159 | + } |
|
160 | 160 | |
161 | 161 | /* |
162 | 162 | * Cunstruct View |