@@ -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 |
@@ -2,112 +2,112 @@ discard block |
||
2 | 2 | |
3 | 3 | class View |
4 | 4 | { |
5 | - public $country; |
|
6 | - public $city; |
|
7 | - public $hashtag; |
|
5 | + public $country; |
|
6 | + public $city; |
|
7 | + public $hashtag; |
|
8 | 8 | public $view; |
9 | - public $postId; |
|
10 | - public $isDetailedView; |
|
11 | - public $baseUrl; |
|
12 | - public $rights; |
|
9 | + public $postId; |
|
10 | + public $isDetailedView; |
|
11 | + public $baseUrl; |
|
12 | + public $rights; |
|
13 | 13 | |
14 | 14 | public $lastPostId = ''; |
15 | 15 | |
16 | - function __construct($baseUrl, $country, $city, $hashtag = '%23all', $view = 'time', $postId = '') |
|
17 | - { |
|
18 | - $this->baseUrl = $baseUrl; |
|
19 | - $this->country = $country; |
|
20 | - $this->city = $city; |
|
21 | - $this->hashtag = urldecode($hashtag); |
|
22 | - $this->view = $view; |
|
23 | - $this->postId = $postId; |
|
16 | + function __construct($baseUrl, $country, $city, $hashtag = '%23all', $view = 'time', $postId = '') |
|
17 | + { |
|
18 | + $this->baseUrl = $baseUrl; |
|
19 | + $this->country = $country; |
|
20 | + $this->city = $city; |
|
21 | + $this->hashtag = urldecode($hashtag); |
|
22 | + $this->view = $view; |
|
23 | + $this->postId = $postId; |
|
24 | 24 | |
25 | - if(isUserAdmin()) |
|
26 | - { |
|
27 | - $this->rights = 'admin'; |
|
28 | - } |
|
29 | - else if(isUserVoter()) |
|
30 | - { |
|
31 | - $this->rights = 'voter'; |
|
32 | - } |
|
33 | - else |
|
34 | - { |
|
35 | - $this->rights = 'user'; |
|
36 | - } |
|
25 | + if(isUserAdmin()) |
|
26 | + { |
|
27 | + $this->rights = 'admin'; |
|
28 | + } |
|
29 | + else if(isUserVoter()) |
|
30 | + { |
|
31 | + $this->rights = 'voter'; |
|
32 | + } |
|
33 | + else |
|
34 | + { |
|
35 | + $this->rights = 'user'; |
|
36 | + } |
|
37 | 37 | |
38 | - if($postId == '') |
|
39 | - { |
|
40 | - $this->isDetailedView = FALSE; |
|
41 | - } |
|
42 | - else |
|
43 | - { |
|
44 | - $this->isDetailedView = TRUE; |
|
45 | - } |
|
46 | - } |
|
38 | + if($postId == '') |
|
39 | + { |
|
40 | + $this->isDetailedView = FALSE; |
|
41 | + } |
|
42 | + else |
|
43 | + { |
|
44 | + $this->isDetailedView = TRUE; |
|
45 | + } |
|
46 | + } |
|
47 | 47 | /** |
48 | 48 | * Compute HTML Code |
49 | 49 | */ |
50 | 50 | function jodelToHtml($post) |
51 | - { //ToDO |
|
52 | - //Replace # with link |
|
53 | - //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
|
51 | + { //ToDO |
|
52 | + //Replace # with link |
|
53 | + //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
|
54 | 54 | |
55 | - //Time to time difference |
|
56 | - $now = new DateTime(); |
|
57 | - $d = new DateTime($post['created_at']); |
|
58 | - $timediff = $now->diff($d); |
|
55 | + //Time to time difference |
|
56 | + $now = new DateTime(); |
|
57 | + $d = new DateTime($post['created_at']); |
|
58 | + $timediff = $now->diff($d); |
|
59 | 59 | |
60 | - $timediff_inSeconds = (string)$timediff->format('%s'); |
|
61 | - $timediff_inMinutes = (string)$timediff->format('%i'); |
|
62 | - $timediff_inHours = (string)$timediff->format('%h'); |
|
63 | - $timediff_inDays = (string)$timediff->format('%d'); |
|
64 | - $timediff_inMonth = (string)$timediff->format('%m'); |
|
60 | + $timediff_inSeconds = (string)$timediff->format('%s'); |
|
61 | + $timediff_inMinutes = (string)$timediff->format('%i'); |
|
62 | + $timediff_inHours = (string)$timediff->format('%h'); |
|
63 | + $timediff_inDays = (string)$timediff->format('%d'); |
|
64 | + $timediff_inMonth = (string)$timediff->format('%m'); |
|
65 | 65 | |
66 | - if($timediff_inMonth!=0) |
|
67 | - { |
|
68 | - $timediff = $timediff_inMonth . "m"; |
|
69 | - } |
|
70 | - else |
|
71 | - { |
|
72 | - if($timediff_inDays!=0) |
|
73 | - { |
|
74 | - $timediff = $timediff_inDays . "d"; |
|
75 | - } |
|
76 | - else |
|
77 | - { |
|
78 | - if($timediff_inHours!=0) |
|
79 | - { |
|
80 | - $timediff = $timediff_inHours . "h"; |
|
81 | - } |
|
82 | - else |
|
83 | - { |
|
84 | - if($timediff_inMinutes!=0) |
|
85 | - { |
|
86 | - $timediff = $timediff_inMinutes . "m"; |
|
87 | - } |
|
88 | - else |
|
89 | - { |
|
90 | - $timediff = $timediff_inSeconds . "s"; |
|
91 | - } |
|
92 | - } |
|
93 | - } |
|
94 | - } |
|
66 | + if($timediff_inMonth!=0) |
|
67 | + { |
|
68 | + $timediff = $timediff_inMonth . "m"; |
|
69 | + } |
|
70 | + else |
|
71 | + { |
|
72 | + if($timediff_inDays!=0) |
|
73 | + { |
|
74 | + $timediff = $timediff_inDays . "d"; |
|
75 | + } |
|
76 | + else |
|
77 | + { |
|
78 | + if($timediff_inHours!=0) |
|
79 | + { |
|
80 | + $timediff = $timediff_inHours . "h"; |
|
81 | + } |
|
82 | + else |
|
83 | + { |
|
84 | + if($timediff_inMinutes!=0) |
|
85 | + { |
|
86 | + $timediff = $timediff_inMinutes . "m"; |
|
87 | + } |
|
88 | + else |
|
89 | + { |
|
90 | + $timediff = $timediff_inSeconds . "s"; |
|
91 | + } |
|
92 | + } |
|
93 | + } |
|
94 | + } |
|
95 | 95 | |
96 | 96 | |
97 | - ?> |
|
97 | + ?> |
|
98 | 98 | <article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color'];?>;"> |
99 | 99 | <content> |
100 | 100 | <?php |
101 | - if(isset($post['image_url'])) |
|
102 | - { |
|
103 | - $regexRest = '/[^\w$ .!?-]+/u'; |
|
101 | + if(isset($post['image_url'])) |
|
102 | + { |
|
103 | + $regexRest = '/[^\w$ .!?-]+/u'; |
|
104 | 104 | |
105 | - echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
|
106 | - } |
|
107 | - else { |
|
108 | - echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
|
109 | - } |
|
110 | - ?> |
|
105 | + echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
|
106 | + } |
|
107 | + else { |
|
108 | + echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
|
109 | + } |
|
110 | + ?> |
|
111 | 111 | </content> |
112 | 112 | <aside> |
113 | 113 | <button onclick="vote('<?php echo $post['post_id'];?>', 'up', this)"> |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | <a href="<?php echo $this->changePostId($post['post_id'])->toUrl();?>"> |
137 | 137 | <i class="fa fa-commenting-o"></i> |
138 | 138 | <?php if(array_key_exists("child_count", $post)) |
139 | - { |
|
140 | - echo $post["child_count"]; |
|
141 | - } else echo "0"; |
|
142 | - ?> |
|
139 | + { |
|
140 | + echo $post["child_count"]; |
|
141 | + } else echo "0"; |
|
142 | + ?> |
|
143 | 143 | </a> |
144 | 144 | </span> |
145 | 145 | |
@@ -159,30 +159,30 @@ discard block |
||
159 | 159 | ?> |
160 | 160 | <span class="distance"> |
161 | 161 | <?php |
162 | - if($this->isDetailedView) |
|
163 | - { |
|
164 | - if(isset($post['user_handle']) && $post['user_handle'] == 'OJ') |
|
165 | - { |
|
166 | - ?> |
|
162 | + if($this->isDetailedView) |
|
163 | + { |
|
164 | + if(isset($post['user_handle']) && $post['user_handle'] == 'OJ') |
|
165 | + { |
|
166 | + ?> |
|
167 | 167 | <span data-tooltip="Author"> |
168 | 168 | <i class="fa fa-user-o"></i> OJ | |
169 | 169 | </span> |
170 | 170 | <?php |
171 | - } |
|
172 | - else |
|
173 | - { |
|
174 | - //Is not parent Jodel in detailed View |
|
175 | - if(!array_key_exists('child_count', $post)) |
|
176 | - { |
|
177 | - ?> |
|
171 | + } |
|
172 | + else |
|
173 | + { |
|
174 | + //Is not parent Jodel in detailed View |
|
175 | + if(!array_key_exists('child_count', $post)) |
|
176 | + { |
|
177 | + ?> |
|
178 | 178 | <span data-tooltip="Author"> |
179 | 179 | <i class="fa fa-user-o"></i> #<?php echo $post['user_handle'];?> | |
180 | 180 | </span> |
181 | 181 | <?php |
182 | - } |
|
183 | - } |
|
184 | - } |
|
185 | - ?> |
|
182 | + } |
|
183 | + } |
|
184 | + } |
|
185 | + ?> |
|
186 | 186 | |
187 | 187 | <span class="tip" data-tooltip="Distance"> |
188 | 188 | <i class="fa fa-map-marker"></i> |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | </footer> |
196 | 196 | </article> |
197 | 197 | <?php |
198 | - } |
|
198 | + } |
|
199 | 199 | |
200 | 200 | |
201 | 201 | /** |
@@ -232,147 +232,147 @@ discard block |
||
232 | 232 | return $description; |
233 | 233 | } |
234 | 234 | |
235 | - function toUrl($msg = '') |
|
236 | - { |
|
237 | - $url = $this->baseUrl . 'index.php?country=DE' . |
|
238 | - '&city=' . urlencode($this->city) . |
|
239 | - '&hashtag=' . urlencode($this->hashtag) . |
|
240 | - '&view=' . $this->view; |
|
241 | - if($this->postId != '') |
|
242 | - { |
|
243 | - $url .= '&postId=' . $this->postId . |
|
244 | - '&getPostDetails=TRUE'; |
|
245 | - } |
|
235 | + function toUrl($msg = '') |
|
236 | + { |
|
237 | + $url = $this->baseUrl . 'index.php?country=DE' . |
|
238 | + '&city=' . urlencode($this->city) . |
|
239 | + '&hashtag=' . urlencode($this->hashtag) . |
|
240 | + '&view=' . $this->view; |
|
241 | + if($this->postId != '') |
|
242 | + { |
|
243 | + $url .= '&postId=' . $this->postId . |
|
244 | + '&getPostDetails=TRUE'; |
|
245 | + } |
|
246 | 246 | |
247 | - if($msg != '') |
|
248 | - { |
|
249 | - $url .= '&msg=' . urlencode($msg); |
|
250 | - } |
|
247 | + if($msg != '') |
|
248 | + { |
|
249 | + $url .= '&msg=' . urlencode($msg); |
|
250 | + } |
|
251 | 251 | |
252 | - return $url; |
|
253 | - } |
|
252 | + return $url; |
|
253 | + } |
|
254 | 254 | |
255 | - function changePostId($postId) |
|
256 | - { |
|
257 | - $tempView = clone $this; |
|
258 | - $tempView->postId = $postId; |
|
259 | - $tempView->isDetailedView = TRUE; |
|
260 | - return $tempView; |
|
261 | - } |
|
255 | + function changePostId($postId) |
|
256 | + { |
|
257 | + $tempView = clone $this; |
|
258 | + $tempView->postId = $postId; |
|
259 | + $tempView->isDetailedView = TRUE; |
|
260 | + return $tempView; |
|
261 | + } |
|
262 | 262 | |
263 | - function back() |
|
264 | - { |
|
265 | - $tempView = clone $this; |
|
266 | - $tempView->postId = ''; |
|
267 | - return $tempView; |
|
268 | - } |
|
263 | + function back() |
|
264 | + { |
|
265 | + $tempView = clone $this; |
|
266 | + $tempView->postId = ''; |
|
267 | + return $tempView; |
|
268 | + } |
|
269 | 269 | |
270 | - function changeView($view) |
|
271 | - { |
|
272 | - $tempView = clone $this; |
|
273 | - $tempView->view = $view; |
|
274 | - return $tempView; |
|
275 | - } |
|
270 | + function changeView($view) |
|
271 | + { |
|
272 | + $tempView = clone $this; |
|
273 | + $tempView->view = $view; |
|
274 | + return $tempView; |
|
275 | + } |
|
276 | 276 | |
277 | 277 | function getPosts($jodelAccount) |
278 | 278 | { |
279 | - if($this->hashtag != '#all' && $this->hashtag != '' && $this->hashtag != NULL) |
|
280 | - { |
|
281 | - $accountCreator = new GetChannel(); |
|
282 | - $accountCreator->view = $this->view; |
|
283 | - $accountCreator->setAccessToken($jodelAccount->accessToken); |
|
284 | - $accountCreator->channel = $this->hashtag; |
|
285 | - $accountCreator->lastPostId = $this->lastPostId; |
|
286 | - $data = $accountCreator->execute(); |
|
287 | - } |
|
288 | - else |
|
289 | - { |
|
290 | - if($this->lastPostId == '' && $this->view == 'combo') |
|
291 | - { |
|
292 | - $url = "/v3/posts/location/combo"; |
|
293 | - } |
|
294 | - else |
|
295 | - { |
|
296 | - if($this->view == 'discussed') |
|
297 | - { |
|
298 | - $url = "/v2/posts/location/discussed/"; |
|
299 | - } |
|
300 | - else |
|
301 | - { |
|
302 | - if($this->view == 'popular') |
|
303 | - { |
|
304 | - $url = "/v2/posts/location/popular/"; |
|
305 | - } |
|
306 | - else |
|
307 | - { |
|
308 | - $url = "/v2/posts/location/"; |
|
309 | - } |
|
310 | - } |
|
311 | - } |
|
279 | + if($this->hashtag != '#all' && $this->hashtag != '' && $this->hashtag != NULL) |
|
280 | + { |
|
281 | + $accountCreator = new GetChannel(); |
|
282 | + $accountCreator->view = $this->view; |
|
283 | + $accountCreator->setAccessToken($jodelAccount->accessToken); |
|
284 | + $accountCreator->channel = $this->hashtag; |
|
285 | + $accountCreator->lastPostId = $this->lastPostId; |
|
286 | + $data = $accountCreator->execute(); |
|
287 | + } |
|
288 | + else |
|
289 | + { |
|
290 | + if($this->lastPostId == '' && $this->view == 'combo') |
|
291 | + { |
|
292 | + $url = "/v3/posts/location/combo"; |
|
293 | + } |
|
294 | + else |
|
295 | + { |
|
296 | + if($this->view == 'discussed') |
|
297 | + { |
|
298 | + $url = "/v2/posts/location/discussed/"; |
|
299 | + } |
|
300 | + else |
|
301 | + { |
|
302 | + if($this->view == 'popular') |
|
303 | + { |
|
304 | + $url = "/v2/posts/location/popular/"; |
|
305 | + } |
|
306 | + else |
|
307 | + { |
|
308 | + $url = "/v2/posts/location/"; |
|
309 | + } |
|
310 | + } |
|
311 | + } |
|
312 | 312 | |
313 | - $accountCreator = new GetPosts(); |
|
314 | - $accountCreator->setLastPostId($this->lastPostId); |
|
315 | - $accountCreator->setAccessToken($jodelAccount->accessToken); |
|
316 | - $accountCreator->setUrl($url); |
|
317 | - $accountCreator->version = 'v3'; |
|
313 | + $accountCreator = new GetPosts(); |
|
314 | + $accountCreator->setLastPostId($this->lastPostId); |
|
315 | + $accountCreator->setAccessToken($jodelAccount->accessToken); |
|
316 | + $accountCreator->setUrl($url); |
|
317 | + $accountCreator->version = 'v3'; |
|
318 | 318 | |
319 | - $config = parse_ini_file('config/config.ini.php'); |
|
320 | - $location = new Location(); |
|
321 | - $location->setLat($config['default_lat']); |
|
322 | - $location->setLng($config['default_lng']); |
|
323 | - $location->setCityName($config['default_location']); |
|
324 | - $accountCreator->location = $location; |
|
325 | - $data = $accountCreator->execute(); |
|
326 | - } |
|
327 | - if(array_key_exists('recent', $data) && array_key_exists(0, $data['recent'])) |
|
328 | - { |
|
329 | - return $data['recent']; |
|
330 | - } |
|
331 | - else if(array_key_exists('posts', $data)&& array_key_exists(0, $data['posts'])) |
|
332 | - { |
|
333 | - return $data['posts']; |
|
334 | - } |
|
335 | - else |
|
336 | - { |
|
337 | - if($this->lastPostId == '') |
|
338 | - { |
|
339 | - error_log('Could not find Posts in: ' . $this->city . ' Error: ' . print_r($data, true)); |
|
340 | - //error_log(print_r($data, true)); |
|
319 | + $config = parse_ini_file('config/config.ini.php'); |
|
320 | + $location = new Location(); |
|
321 | + $location->setLat($config['default_lat']); |
|
322 | + $location->setLng($config['default_lng']); |
|
323 | + $location->setCityName($config['default_location']); |
|
324 | + $accountCreator->location = $location; |
|
325 | + $data = $accountCreator->execute(); |
|
326 | + } |
|
327 | + if(array_key_exists('recent', $data) && array_key_exists(0, $data['recent'])) |
|
328 | + { |
|
329 | + return $data['recent']; |
|
330 | + } |
|
331 | + else if(array_key_exists('posts', $data)&& array_key_exists(0, $data['posts'])) |
|
332 | + { |
|
333 | + return $data['posts']; |
|
334 | + } |
|
335 | + else |
|
336 | + { |
|
337 | + if($this->lastPostId == '') |
|
338 | + { |
|
339 | + error_log('Could not find Posts in: ' . $this->city . ' Error: ' . print_r($data, true)); |
|
340 | + //error_log(print_r($data, true)); |
|
341 | 341 | |
342 | - $notFound[0] = array( |
|
343 | - "post_id" => "0", |
|
344 | - "discovered_by" => 0, |
|
345 | - "message" => "No more Posts found", |
|
346 | - "created_at" => "2017-02-11T16:44:50.385Z", |
|
347 | - "updated_at" => "2017-02-11T16:44:50.385Z", |
|
348 | - "pin_count" => 0, |
|
349 | - "color" => "5682a3", |
|
350 | - "got_thanks" => FALSE, |
|
351 | - "post_own" => "friend", |
|
352 | - "discovered" => 0, |
|
353 | - "distance" => 9, |
|
354 | - "vote_count" => 0, |
|
355 | - "location" => |
|
356 | - array("name" => "Berlin", |
|
357 | - "loc_coordinates" => |
|
358 | - array( |
|
359 | - "lat" => 0, |
|
360 | - "lng" => 0 |
|
361 | - ), |
|
362 | - "loc_accuracy" => 0, |
|
363 | - "country" => "", |
|
364 | - "city" => "", |
|
365 | - ), |
|
366 | - "tags" => |
|
367 | - array(), |
|
368 | - "user_handle" => "0" |
|
369 | - ); |
|
370 | - return $notFound; |
|
371 | - } |
|
372 | - else |
|
373 | - { |
|
374 | - return FALSE; |
|
375 | - } |
|
376 | - } |
|
342 | + $notFound[0] = array( |
|
343 | + "post_id" => "0", |
|
344 | + "discovered_by" => 0, |
|
345 | + "message" => "No more Posts found", |
|
346 | + "created_at" => "2017-02-11T16:44:50.385Z", |
|
347 | + "updated_at" => "2017-02-11T16:44:50.385Z", |
|
348 | + "pin_count" => 0, |
|
349 | + "color" => "5682a3", |
|
350 | + "got_thanks" => FALSE, |
|
351 | + "post_own" => "friend", |
|
352 | + "discovered" => 0, |
|
353 | + "distance" => 9, |
|
354 | + "vote_count" => 0, |
|
355 | + "location" => |
|
356 | + array("name" => "Berlin", |
|
357 | + "loc_coordinates" => |
|
358 | + array( |
|
359 | + "lat" => 0, |
|
360 | + "lng" => 0 |
|
361 | + ), |
|
362 | + "loc_accuracy" => 0, |
|
363 | + "country" => "", |
|
364 | + "city" => "", |
|
365 | + ), |
|
366 | + "tags" => |
|
367 | + array(), |
|
368 | + "user_handle" => "0" |
|
369 | + ); |
|
370 | + return $notFound; |
|
371 | + } |
|
372 | + else |
|
373 | + { |
|
374 | + return FALSE; |
|
375 | + } |
|
376 | + } |
|
377 | 377 | } |
378 | 378 | } |