@@ -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 | } |
@@ -2,105 +2,105 @@ 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; |
|
9 | + public $postId; |
|
10 | + public $isDetailedView; |
|
11 | 11 | |
12 | 12 | public $lastPostId = ''; |
13 | 13 | |
14 | - function __construct($country, $city, $hashtag = '#all', $view = 'time', $postId = '') |
|
15 | - { |
|
16 | - $this->country = $country; |
|
17 | - $this->city = $city; |
|
18 | - $this->hashtag = $hashtag; |
|
19 | - $this->view = $view; |
|
20 | - $this->postId = $postId; |
|
14 | + function __construct($country, $city, $hashtag = '#all', $view = 'time', $postId = '') |
|
15 | + { |
|
16 | + $this->country = $country; |
|
17 | + $this->city = $city; |
|
18 | + $this->hashtag = $hashtag; |
|
19 | + $this->view = $view; |
|
20 | + $this->postId = $postId; |
|
21 | 21 | |
22 | - if($postId == '') |
|
23 | - { |
|
24 | - $this->isDetailedView = FALSE; |
|
25 | - } |
|
26 | - else |
|
27 | - { |
|
28 | - $this->isDetailedView = TRUE; |
|
29 | - } |
|
30 | - } |
|
22 | + if($postId == '') |
|
23 | + { |
|
24 | + $this->isDetailedView = FALSE; |
|
25 | + } |
|
26 | + else |
|
27 | + { |
|
28 | + $this->isDetailedView = TRUE; |
|
29 | + } |
|
30 | + } |
|
31 | 31 | /** |
32 | 32 | * Compute HTML Code |
33 | 33 | */ |
34 | 34 | function jodelToHtml($post) |
35 | - { //ToDO |
|
36 | - //Replace # with link |
|
37 | - //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
|
35 | + { //ToDO |
|
36 | + //Replace # with link |
|
37 | + //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
|
38 | 38 | |
39 | - //Time to time difference |
|
40 | - $now = new DateTime(); |
|
41 | - $d = new DateTime($post['created_at']); |
|
42 | - $timediff = $now->diff($d); |
|
39 | + //Time to time difference |
|
40 | + $now = new DateTime(); |
|
41 | + $d = new DateTime($post['created_at']); |
|
42 | + $timediff = $now->diff($d); |
|
43 | 43 | |
44 | - $timediff_inSeconds = (string)$timediff->format('%s'); |
|
45 | - $timediff_inMinutes = (string)$timediff->format('%i'); |
|
46 | - $timediff_inHours = (string)$timediff->format('%h'); |
|
47 | - $timediff_inDays = (string)$timediff->format('%d'); |
|
48 | - $timediff_inMonth = (string)$timediff->format('%m'); |
|
44 | + $timediff_inSeconds = (string)$timediff->format('%s'); |
|
45 | + $timediff_inMinutes = (string)$timediff->format('%i'); |
|
46 | + $timediff_inHours = (string)$timediff->format('%h'); |
|
47 | + $timediff_inDays = (string)$timediff->format('%d'); |
|
48 | + $timediff_inMonth = (string)$timediff->format('%m'); |
|
49 | 49 | |
50 | - if($timediff_inMonth!=0) |
|
51 | - { |
|
52 | - $timediff = $timediff_inMonth . "m"; |
|
53 | - } |
|
54 | - else |
|
55 | - { |
|
56 | - if($timediff_inDays!=0) |
|
57 | - { |
|
58 | - $timediff = $timediff_inDays . "d"; |
|
59 | - } |
|
60 | - else |
|
61 | - { |
|
62 | - if($timediff_inHours!=0) |
|
63 | - { |
|
64 | - $timediff = $timediff_inHours . "h"; |
|
65 | - } |
|
66 | - else |
|
67 | - { |
|
68 | - if($timediff_inMinutes!=0) |
|
69 | - { |
|
70 | - $timediff = $timediff_inMinutes . "m"; |
|
71 | - } |
|
72 | - else |
|
73 | - { |
|
74 | - $timediff = $timediff_inSeconds . "s"; |
|
75 | - } |
|
76 | - } |
|
77 | - } |
|
78 | - } |
|
50 | + if($timediff_inMonth!=0) |
|
51 | + { |
|
52 | + $timediff = $timediff_inMonth . "m"; |
|
53 | + } |
|
54 | + else |
|
55 | + { |
|
56 | + if($timediff_inDays!=0) |
|
57 | + { |
|
58 | + $timediff = $timediff_inDays . "d"; |
|
59 | + } |
|
60 | + else |
|
61 | + { |
|
62 | + if($timediff_inHours!=0) |
|
63 | + { |
|
64 | + $timediff = $timediff_inHours . "h"; |
|
65 | + } |
|
66 | + else |
|
67 | + { |
|
68 | + if($timediff_inMinutes!=0) |
|
69 | + { |
|
70 | + $timediff = $timediff_inMinutes . "m"; |
|
71 | + } |
|
72 | + else |
|
73 | + { |
|
74 | + $timediff = $timediff_inSeconds . "s"; |
|
75 | + } |
|
76 | + } |
|
77 | + } |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | - ?> |
|
81 | + ?> |
|
82 | 82 | <article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color'];?>;"> |
83 | 83 | <content> |
84 | 84 | <?php |
85 | - if(isset($post['image_url'])) |
|
86 | - { |
|
87 | - $regexRest = '/[^\w$ .!?-]+/u'; |
|
85 | + if(isset($post['image_url'])) |
|
86 | + { |
|
87 | + $regexRest = '/[^\w$ .!?-]+/u'; |
|
88 | 88 | |
89 | - echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
|
90 | - } |
|
91 | - else { |
|
92 | - echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
|
93 | - } |
|
94 | - ?> |
|
89 | + echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
|
90 | + } |
|
91 | + else { |
|
92 | + echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
|
93 | + } |
|
94 | + ?> |
|
95 | 95 | </content> |
96 | 96 | <aside> |
97 | 97 | <?php |
98 | - if($this->isDetailedView) |
|
99 | - {?> |
|
98 | + if($this->isDetailedView) |
|
99 | + {?> |
|
100 | 100 | <a href="index.php?vote=up&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow"> |
101 | 101 | <?php } |
102 | - else |
|
103 | - {?> |
|
102 | + else |
|
103 | + {?> |
|
104 | 104 | <a href="index.php?vote=up&postId=<?php echo $post['post_id'];?>" rel="nofollow"> |
105 | 105 | <?php } ?> |
106 | 106 | <i class="fa fa-angle-up fa-3x"></i> |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | <br /> |
109 | 109 | <?php echo $post["vote_count"];?><br /> |
110 | 110 | <?php |
111 | - if($this->isDetailedView) |
|
112 | - {?> |
|
111 | + if($this->isDetailedView) |
|
112 | + {?> |
|
113 | 113 | <a href="index.php?vote=down&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow"> |
114 | 114 | <?php } |
115 | - else |
|
116 | - {?> |
|
115 | + else |
|
116 | + {?> |
|
117 | 117 | <a href="index.php?vote=down&postId=<?php echo $post['post_id'];?>" rel="nofollow"> |
118 | 118 | <?php } ?> |
119 | 119 | <i class="fa fa-angle-down fa-3x"></i> |
@@ -136,39 +136,39 @@ discard block |
||
136 | 136 | <a href="index.php?getPostDetails=true&view=<?php echo $this->view;?>&postId=<?php echo $post["post_id"];?>"> |
137 | 137 | <i class="fa fa-commenting-o"></i> |
138 | 138 | <?php if(array_key_exists("child_count", $post)) { |
139 | - echo $post["child_count"]; |
|
140 | - } else echo "0"; |
|
141 | - ?> |
|
139 | + echo $post["child_count"]; |
|
140 | + } else echo "0"; |
|
141 | + ?> |
|
142 | 142 | </a> |
143 | 143 | </span> |
144 | 144 | <?php } ?> |
145 | 145 | </td> |
146 | 146 | <td class="distance"> |
147 | 147 | <?php |
148 | - if($this->isDetailedView) |
|
149 | - { |
|
150 | - if(isset($post["parent_creator"]) && $post["parent_creator"] == 1) |
|
151 | - { |
|
152 | - ?> |
|
148 | + if($this->isDetailedView) |
|
149 | + { |
|
150 | + if(isset($post["parent_creator"]) && $post["parent_creator"] == 1) |
|
151 | + { |
|
152 | + ?> |
|
153 | 153 | <span data-tooltip="Author"> |
154 | 154 | <i class="fa fa-user-o"></i> OJ | |
155 | 155 | </span> |
156 | 156 | <?php |
157 | - } |
|
158 | - else |
|
159 | - { |
|
160 | - //Is not parent Jodel in detailed View |
|
161 | - if(!array_key_exists('child_count', $post) && array_key_exists('parent_creator', $post)) |
|
162 | - { |
|
163 | - ?> |
|
157 | + } |
|
158 | + else |
|
159 | + { |
|
160 | + //Is not parent Jodel in detailed View |
|
161 | + if(!array_key_exists('child_count', $post) && array_key_exists('parent_creator', $post)) |
|
162 | + { |
|
163 | + ?> |
|
164 | 164 | <span data-tooltip="Author"> |
165 | 165 | <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> | |
166 | 166 | </span> |
167 | 167 | <?php |
168 | - } |
|
169 | - } |
|
170 | - } |
|
171 | - ?> |
|
168 | + } |
|
169 | + } |
|
170 | + } |
|
171 | + ?> |
|
172 | 172 | |
173 | 173 | <span class="tip" data-tooltip="Distance"> |
174 | 174 | <i class="fa fa-map-marker"></i> |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | </footer> |
182 | 182 | </article> |
183 | 183 | <?php |
184 | - } |
|
184 | + } |
|
185 | 185 | |
186 | 186 | |
187 | 187 | /** |
@@ -254,96 +254,96 @@ discard block |
||
254 | 254 | |
255 | 255 | function getPosts($jodelAccount) |
256 | 256 | { |
257 | - if($this->hashtag != '#all' && $this->hashtag != '' && $this->hashtag != NULL) |
|
258 | - { |
|
259 | - $accountCreator = new GetChannel(); |
|
260 | - $accountCreator->view = $this->view; |
|
261 | - $accountCreator->setAccessToken($jodelAccount->accessToken); |
|
262 | - $accountCreator->channel = $this->hashtag; |
|
263 | - $accountCreator->lastPostId = $this->lastPostId; |
|
264 | - $data = $accountCreator->execute(); |
|
265 | - } |
|
266 | - else |
|
267 | - { |
|
268 | - if($this->lastPostId == '' && $this->view == 'combo') |
|
269 | - { |
|
270 | - $url = "/v3/posts/location/combo"; |
|
271 | - } |
|
272 | - else |
|
273 | - { |
|
274 | - if($this->view == 'discussed') |
|
275 | - { |
|
276 | - $url = "/v2/posts/location/discussed/"; |
|
277 | - } |
|
278 | - else |
|
279 | - { |
|
280 | - if($this->view == 'popular') |
|
281 | - { |
|
282 | - $url = "/v2/posts/location/popular/"; |
|
283 | - } |
|
284 | - else |
|
285 | - { |
|
286 | - $url = "/v2/posts/location/"; |
|
287 | - } |
|
288 | - } |
|
289 | - } |
|
257 | + if($this->hashtag != '#all' && $this->hashtag != '' && $this->hashtag != NULL) |
|
258 | + { |
|
259 | + $accountCreator = new GetChannel(); |
|
260 | + $accountCreator->view = $this->view; |
|
261 | + $accountCreator->setAccessToken($jodelAccount->accessToken); |
|
262 | + $accountCreator->channel = $this->hashtag; |
|
263 | + $accountCreator->lastPostId = $this->lastPostId; |
|
264 | + $data = $accountCreator->execute(); |
|
265 | + } |
|
266 | + else |
|
267 | + { |
|
268 | + if($this->lastPostId == '' && $this->view == 'combo') |
|
269 | + { |
|
270 | + $url = "/v3/posts/location/combo"; |
|
271 | + } |
|
272 | + else |
|
273 | + { |
|
274 | + if($this->view == 'discussed') |
|
275 | + { |
|
276 | + $url = "/v2/posts/location/discussed/"; |
|
277 | + } |
|
278 | + else |
|
279 | + { |
|
280 | + if($this->view == 'popular') |
|
281 | + { |
|
282 | + $url = "/v2/posts/location/popular/"; |
|
283 | + } |
|
284 | + else |
|
285 | + { |
|
286 | + $url = "/v2/posts/location/"; |
|
287 | + } |
|
288 | + } |
|
289 | + } |
|
290 | 290 | |
291 | - $accountCreator = new GetPosts(); |
|
292 | - $accountCreator->setLastPostId($this->lastPostId); |
|
293 | - $accountCreator->setAccessToken($jodelAccount->accessToken); |
|
294 | - $accountCreator->setUrl($url); |
|
295 | - $accountCreator->version = 'v3'; |
|
291 | + $accountCreator = new GetPosts(); |
|
292 | + $accountCreator->setLastPostId($this->lastPostId); |
|
293 | + $accountCreator->setAccessToken($jodelAccount->accessToken); |
|
294 | + $accountCreator->setUrl($url); |
|
295 | + $accountCreator->version = 'v3'; |
|
296 | 296 | |
297 | - $config = parse_ini_file('config/config.ini.php'); |
|
298 | - $location = new Location(); |
|
299 | - $location->setLat($config['default_lat']); |
|
300 | - $location->setLng($config['default_lng']); |
|
301 | - $location->setCityName($config['default_location']); |
|
302 | - $accountCreator->location = $location; |
|
303 | - $data = $accountCreator->execute(); |
|
304 | - } |
|
305 | - if(array_key_exists('recent', $data)) |
|
306 | - { |
|
307 | - return $data['recent']; |
|
308 | - } |
|
309 | - else if(array_key_exists('posts', $data)) |
|
310 | - { |
|
311 | - return $data['posts']; |
|
312 | - } |
|
313 | - else |
|
314 | - { |
|
315 | - error_log('Fehler View getPosts '); |
|
316 | - error_log(print_r($data, true)); |
|
297 | + $config = parse_ini_file('config/config.ini.php'); |
|
298 | + $location = new Location(); |
|
299 | + $location->setLat($config['default_lat']); |
|
300 | + $location->setLng($config['default_lng']); |
|
301 | + $location->setCityName($config['default_location']); |
|
302 | + $accountCreator->location = $location; |
|
303 | + $data = $accountCreator->execute(); |
|
304 | + } |
|
305 | + if(array_key_exists('recent', $data)) |
|
306 | + { |
|
307 | + return $data['recent']; |
|
308 | + } |
|
309 | + else if(array_key_exists('posts', $data)) |
|
310 | + { |
|
311 | + return $data['posts']; |
|
312 | + } |
|
313 | + else |
|
314 | + { |
|
315 | + error_log('Fehler View getPosts '); |
|
316 | + error_log(print_r($data, true)); |
|
317 | 317 | |
318 | - $notFound[0] = array( |
|
319 | - "post_id" => "0", |
|
320 | - "discovered_by" => 0, |
|
321 | - "message" => "Not found", |
|
322 | - "created_at" => "2017-02-11T16:44:50.385Z", |
|
323 | - "updated_at" => "2017-02-11T16:44:50.385Z", |
|
324 | - "pin_count" => 0, |
|
325 | - "color" => "FFBA00", |
|
326 | - "got_thanks" => FALSE, |
|
327 | - "post_own" => "friend", |
|
328 | - "discovered" => 0, |
|
329 | - "distance" => 9, |
|
330 | - "vote_count" => 0, |
|
331 | - "location" => |
|
332 | - array("name" => "Berlin", |
|
333 | - "loc_coordinates" => |
|
334 | - array( |
|
335 | - "lat" => 0, |
|
336 | - "lng" => 0 |
|
337 | - ), |
|
338 | - "loc_accuracy" => 0, |
|
339 | - "country" => "", |
|
340 | - "city" => "", |
|
341 | - ), |
|
342 | - "tags" => |
|
343 | - array(), |
|
344 | - "user_handle" => "0" |
|
345 | - ); |
|
346 | - return $notFound; |
|
347 | - } |
|
318 | + $notFound[0] = array( |
|
319 | + "post_id" => "0", |
|
320 | + "discovered_by" => 0, |
|
321 | + "message" => "Not found", |
|
322 | + "created_at" => "2017-02-11T16:44:50.385Z", |
|
323 | + "updated_at" => "2017-02-11T16:44:50.385Z", |
|
324 | + "pin_count" => 0, |
|
325 | + "color" => "FFBA00", |
|
326 | + "got_thanks" => FALSE, |
|
327 | + "post_own" => "friend", |
|
328 | + "discovered" => 0, |
|
329 | + "distance" => 9, |
|
330 | + "vote_count" => 0, |
|
331 | + "location" => |
|
332 | + array("name" => "Berlin", |
|
333 | + "loc_coordinates" => |
|
334 | + array( |
|
335 | + "lat" => 0, |
|
336 | + "lng" => 0 |
|
337 | + ), |
|
338 | + "loc_accuracy" => 0, |
|
339 | + "country" => "", |
|
340 | + "city" => "", |
|
341 | + ), |
|
342 | + "tags" => |
|
343 | + array(), |
|
344 | + "user_handle" => "0" |
|
345 | + ); |
|
346 | + return $notFound; |
|
347 | + } |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | \ No newline at end of file |
@@ -32,7 +32,8 @@ discard block |
||
32 | 32 | * Compute HTML Code |
33 | 33 | */ |
34 | 34 | function jodelToHtml($post) |
35 | - { //ToDO |
|
35 | + { |
|
36 | +//ToDO |
|
36 | 37 | //Replace # with link |
37 | 38 | //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
38 | 39 | |
@@ -88,7 +89,8 @@ discard block |
||
88 | 89 | |
89 | 90 | echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
90 | 91 | } |
91 | - else { |
|
92 | + else |
|
93 | + { |
|
92 | 94 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
93 | 95 | } |
94 | 96 | ?> |
@@ -96,11 +98,13 @@ discard block |
||
96 | 98 | <aside> |
97 | 99 | <?php |
98 | 100 | if($this->isDetailedView) |
99 | - {?> |
|
101 | + { |
|
102 | +?> |
|
100 | 103 | <a href="index.php?vote=up&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow"> |
101 | 104 | <?php } |
102 | - else |
|
103 | - {?> |
|
105 | +else |
|
106 | + { |
|
107 | +?> |
|
104 | 108 | <a href="index.php?vote=up&postId=<?php echo $post['post_id'];?>" rel="nofollow"> |
105 | 109 | <?php } ?> |
106 | 110 | <i class="fa fa-angle-up fa-3x"></i> |
@@ -109,11 +113,13 @@ discard block |
||
109 | 113 | <?php echo $post["vote_count"];?><br /> |
110 | 114 | <?php |
111 | 115 | if($this->isDetailedView) |
112 | - {?> |
|
116 | + { |
|
117 | +?> |
|
113 | 118 | <a href="index.php?vote=down&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow"> |
114 | 119 | <?php } |
115 | - else |
|
116 | - {?> |
|
120 | +else |
|
121 | + { |
|
122 | +?> |
|
117 | 123 | <a href="index.php?vote=down&postId=<?php echo $post['post_id'];?>" rel="nofollow"> |
118 | 124 | <?php } ?> |
119 | 125 | <i class="fa fa-angle-down fa-3x"></i> |
@@ -131,13 +137,19 @@ discard block |
||
131 | 137 | </span> |
132 | 138 | </td> |
133 | 139 | <td class="comments"> |
134 | - <?php if(!$this->isDetailedView) {?> |
|
140 | + <?php if(!$this->isDetailedView) |
|
141 | +{ |
|
142 | +?> |
|
135 | 143 | <span data-tooltip="Comments"> |
136 | 144 | <a href="index.php?getPostDetails=true&view=<?php echo $this->view;?>&postId=<?php echo $post["post_id"];?>"> |
137 | 145 | <i class="fa fa-commenting-o"></i> |
138 | - <?php if(array_key_exists("child_count", $post)) { |
|
146 | + <?php if(array_key_exists("child_count", $post)) |
|
147 | +{ |
|
139 | 148 | echo $post["child_count"]; |
140 | - } else echo "0"; |
|
149 | + } |
|
150 | + else { |
|
151 | + echo "0"; |
|
152 | + } |
|
141 | 153 | ?> |
142 | 154 | </a> |
143 | 155 | </span> |
@@ -303,7 +315,7 @@ discard block |
||
303 | 315 | $data = $accountCreator->execute(); |
304 | 316 | } |
305 | 317 | if(array_key_exists('recent', $data)) |
306 | - { |
|
318 | + { |
|
307 | 319 | return $data['recent']; |
308 | 320 | } |
309 | 321 | else if(array_key_exists('posts', $data)) |
@@ -41,36 +41,36 @@ discard block |
||
41 | 41 | |
42 | 42 | function isUserBot() |
43 | 43 | { |
44 | - preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
|
44 | + preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
|
45 | 45 | |
46 | - return (isset($matches[0])) ? true : false; |
|
46 | + return (isset($matches[0])) ? true : false; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | function configPropertyExists($config, $property) |
50 | 50 | { |
51 | - if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
|
52 | - { |
|
53 | - return FALSE; |
|
54 | - } |
|
55 | - else |
|
56 | - { |
|
57 | - return TRUE; |
|
58 | - } |
|
51 | + if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
|
52 | + { |
|
53 | + return FALSE; |
|
54 | + } |
|
55 | + else |
|
56 | + { |
|
57 | + return TRUE; |
|
58 | + } |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | function isDeviceUidInDatabase($deviceUid) |
62 | 62 | { |
63 | - $db = new DatabaseConnect(); |
|
64 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
65 | - |
|
66 | - if ($result->num_rows > 0) |
|
67 | - { |
|
68 | - return TRUE; |
|
69 | - } |
|
70 | - else |
|
71 | - { |
|
72 | - return FALSE; |
|
73 | - } |
|
63 | + $db = new DatabaseConnect(); |
|
64 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
65 | + |
|
66 | + if ($result->num_rows > 0) |
|
67 | + { |
|
68 | + return TRUE; |
|
69 | + } |
|
70 | + else |
|
71 | + { |
|
72 | + return FALSE; |
|
73 | + } |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | //Check if it's a Spider or Google Bot |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | if(configPropertyExists($config, 'karmaDeviceUid')) |
100 | - { |
|
101 | - $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
|
102 | - } |
|
103 | - else |
|
104 | - { |
|
105 | - error_log("No Karma deviceUid set in config file"); |
|
100 | + { |
|
101 | + $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
|
102 | + } |
|
103 | + else |
|
104 | + { |
|
105 | + error_log("No Karma deviceUid set in config file"); |
|
106 | 106 | $jodelAccountForKarma = new JodelAccount($deviceUid); |
107 | - } |
|
107 | + } |
|
108 | 108 | |
109 | 109 | /* |
110 | 110 | * Cunstruct View |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | { |
213 | 213 | $jodelAccountForKarma->votePostId($_GET['postId'], $_GET['vote']); |
214 | 214 | if(isset($_GET['getPostDetails']) && isset($_GET['getPostDetails'])) |
215 | - { |
|
216 | - header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId'])); |
|
217 | - } |
|
218 | - else |
|
219 | - { |
|
220 | - header("Location: index.php#postId-" . htmlspecialchars($_GET['postId'])); |
|
221 | - } |
|
222 | - die(); |
|
215 | + { |
|
216 | + header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId'])); |
|
217 | + } |
|
218 | + else |
|
219 | + { |
|
220 | + header("Location: index.php#postId-" . htmlspecialchars($_GET['postId'])); |
|
221 | + } |
|
222 | + die(); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | //SendJodel |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | if(configPropertyExists($config, 'karmaDeviceUid')) |
100 | - { |
|
100 | + { |
|
101 | 101 | $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
102 | 102 | } |
103 | 103 | else |
@@ -165,7 +165,8 @@ discard block |
||
165 | 165 | |
166 | 166 | if(isset($_GET['view'])) |
167 | 167 | { |
168 | - switch ($_GET['view']) { |
|
168 | + switch ($_GET['view']) |
|
169 | + { |
|
169 | 170 | case 'discussed': |
170 | 171 | $view = 'discussed'; |
171 | 172 | break; |
@@ -212,7 +213,7 @@ discard block |
||
212 | 213 | { |
213 | 214 | $jodelAccountForKarma->votePostId($_GET['postId'], $_GET['vote']); |
214 | 215 | if(isset($_GET['getPostDetails']) && isset($_GET['getPostDetails'])) |
215 | - { |
|
216 | + { |
|
216 | 217 | header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId'])); |
217 | 218 | } |
218 | 219 | else |
@@ -2,13 +2,25 @@ |
||
2 | 2 | <div class="col-xs-12"> |
3 | 3 | <div class="row"> |
4 | 4 | <div class="col-xs-3"> |
5 | - <a href="<?php echo $baseUrl;?>index.php" <?php if($view->view=='combo') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
5 | + <a href="<?php echo $baseUrl;?>index.php" <?php if($view->view=='combo') |
|
6 | +{ |
|
7 | + echo 'class="active"'; |
|
8 | +} |
|
9 | +?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
6 | 10 | </div> |
7 | 11 | <div class="col-xs-3"> |
8 | - <a href="<?php echo $baseUrl;?>index.php?view=discussed" <?php if($view->view=='discussed') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
12 | + <a href="<?php echo $baseUrl;?>index.php?view=discussed" <?php if($view->view=='discussed') |
|
13 | +{ |
|
14 | + echo 'class="active"'; |
|
15 | +} |
|
16 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
9 | 17 | </div> |
10 | 18 | <div class="col-xs-3"> |
11 | - <a href="<?php echo $baseUrl;?>index.php?view=popular" <?php if($view->view=='popular') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
19 | + <a href="<?php echo $baseUrl;?>index.php?view=popular" <?php if($view->view=='popular') |
|
20 | +{ |
|
21 | + echo 'class="active"'; |
|
22 | +} |
|
23 | +?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
12 | 24 | </div> |
13 | 25 | <div class="col-xs-3"> |
14 | 26 | <nav> |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | $posts[0] = $data; |
22 | 22 | |
23 | - if(array_key_exists('children', $data)) { |
|
23 | + if(array_key_exists('children', $data)) |
|
24 | + { |
|
24 | 25 | foreach($data['children'] as $key => $child) |
25 | 26 | { |
26 | 27 | |
@@ -124,7 +125,11 @@ discard block |
||
124 | 125 | |
125 | 126 | <div id="location_mobile" class="hidden-sm-up"> |
126 | 127 | <form method="get"> |
127 | - <input type="text" id="city_mobile" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
128 | + <input type="text" id="city_mobile" name="search" placeholder="<?php if(isset($newPositionStatus)) |
|
129 | +{ |
|
130 | + echo $newPositionStatus; |
|
131 | +} |
|
132 | +?>" required> |
|
128 | 133 | |
129 | 134 | <input type="submit" id="submit_mobile" class="fa" value="" /> |
130 | 135 | </form> |
@@ -146,7 +151,9 @@ discard block |
||
146 | 151 | } ?> |
147 | 152 | </content> |
148 | 153 | |
149 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
154 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
155 | +{ |
|
156 | +?> |
|
150 | 157 | <p id="loading"> |
151 | 158 | Loading… |
152 | 159 | </p> |
@@ -159,7 +166,11 @@ discard block |
||
159 | 166 | <div> |
160 | 167 | <h2>Position / Hashtag</h2> |
161 | 168 | <form method="get"> |
162 | - <input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
169 | + <input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) |
|
170 | +{ |
|
171 | + echo $newPositionStatus; |
|
172 | +} |
|
173 | +?>" required> |
|
163 | 174 | <label>try: #jhj</label><br> |
164 | 175 | <input type="submit" value="Set Location" /> |
165 | 176 | </form> |
@@ -175,7 +186,9 @@ discard block |
||
175 | 186 | |
176 | 187 | <article> |
177 | 188 | <div> |
178 | - <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?> |
|
189 | + <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) |
|
190 | +{ |
|
191 | +?> |
|
179 | 192 | <h2>Comment on Jodel</h2> |
180 | 193 | <form method="POST"> |
181 | 194 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" /> |
@@ -183,7 +196,10 @@ discard block |
||
183 | 196 | <br /> |
184 | 197 | <input type="submit" value="SEND" /> |
185 | 198 | </form> |
186 | - <?php } else { ?> |
|
199 | + <?php } |
|
200 | +else |
|
201 | +{ |
|
202 | +?> |
|
187 | 203 | <h2>New Jodel</h2> |
188 | 204 | <form method="POST"> |
189 | 205 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -242,7 +258,9 @@ discard block |
||
242 | 258 | $('html,body').animate({scrollTop: aTag.offset().top-90},'slow'); |
243 | 259 | } |
244 | 260 | |
245 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
261 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
262 | +{ |
|
263 | +?> |
|
246 | 264 | |
247 | 265 | |
248 | 266 |