@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | if($location->getLat() == $lat && $location->getLng() == $lng && $location->getCityName() == $name) |
88 | 88 | { |
89 | 89 | return TRUE; |
90 | - } |
|
90 | + } |
|
91 | 91 | else |
92 | 92 | { |
93 | 93 | return FALSE; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | if(substr($_GET['city'], 0, 1) === '#') |
101 | 101 | { |
102 | 102 | return htmlspecialchars($_GET['city']) . " " . $this->location->cityName; |
103 | - } |
|
103 | + } |
|
104 | 104 | else |
105 | 105 | { |
106 | 106 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
@@ -262,7 +262,8 @@ discard block |
||
262 | 262 | if(isset($_POST['color'])) |
263 | 263 | { |
264 | 264 | $color = $_POST['color']; |
265 | - switch ($color) { |
|
265 | + switch ($color) |
|
266 | + { |
|
266 | 267 | case '8ABDB0': |
267 | 268 | $color = '8ABDB0'; |
268 | 269 | break; |
@@ -355,7 +356,8 @@ discard block |
||
355 | 356 | expiration_date='" . $expiration_date . "' |
356 | 357 | WHERE device_uid='" . $device_uid . "'"); |
357 | 358 | |
358 | - if($result === false){ |
|
359 | + if($result === false) |
|
360 | + { |
|
359 | 361 | error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
360 | 362 | } |
361 | 363 | } |
@@ -435,14 +437,16 @@ discard block |
||
435 | 437 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
436 | 438 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
437 | 439 | |
438 | - if($result === false){ |
|
440 | + if($result === false) |
|
441 | + { |
|
439 | 442 | $error = db_error(); |
440 | 443 | echo $error; |
441 | 444 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
442 | 445 | } |
443 | 446 | } |
444 | 447 | |
445 | - function registerAccount($location) { |
|
448 | + function registerAccount($location) |
|
449 | + { |
|
446 | 450 | $accountCreator = new CreateUser(); |
447 | 451 | $accountCreator->setLocation($location); |
448 | 452 | $data = $accountCreator->execute(); |
@@ -467,7 +471,8 @@ discard block |
||
467 | 471 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
468 | 472 | |
469 | 473 | $success = TRUE; |
470 | - if($result === false){ |
|
474 | + if($result === false) |
|
475 | + { |
|
471 | 476 | $error = db_error(); |
472 | 477 | echo $error; |
473 | 478 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -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 = 'LDWWpuUigOnKCbCLpoNMDHCqHCWbLKPzHbnIUKIf'; |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | $this->payLoad = $this->getPayload(); |
22 | 22 | $device_uid = ''; |
23 | - if(isset($this->payLoad['device_uid'])) { |
|
23 | + if(isset($this->payLoad['device_uid'])) |
|
24 | + { |
|
24 | 25 | $device_uid = $this->payLoad['device_uid']; |
25 | 26 | } |
26 | 27 | |
@@ -29,7 +30,8 @@ discard block |
||
29 | 30 | $header = $this->getSignHeaders(); |
30 | 31 | $url = $this->getFullUrl(); |
31 | 32 | |
32 | - if ($this->getAccessToken()) { |
|
33 | + if ($this->getAccessToken()) |
|
34 | + { |
|
33 | 35 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
34 | 36 | } |
35 | 37 | //Comment out to debug the Request: |
@@ -52,7 +54,8 @@ discard block |
||
52 | 54 | 'proxy' => '186.103.169.165:8080', |
53 | 55 | );*/ |
54 | 56 | |
55 | - switch ($this->getMethod()) { |
|
57 | + switch ($this->getMethod()) |
|
58 | + { |
|
56 | 59 | case 'POST': |
57 | 60 | $result = Requests::post($url, $header, $this->payLoad); |
58 | 61 | break; |
@@ -70,7 +73,8 @@ discard block |
||
70 | 73 | $result = Requests::put($url, $header, $this->payLoad); |
71 | 74 | break; |
72 | 75 | } |
73 | - switch ($result->status_code) { |
|
76 | + switch ($result->status_code) |
|
77 | + { |
|
74 | 78 | case 200: |
75 | 79 | $result = json_decode($result->body, true); |
76 | 80 | break; |
@@ -125,10 +129,12 @@ discard block |
||
125 | 129 | */ |
126 | 130 | private function getSignHeaders() |
127 | 131 | { |
128 | - if($this->getAccessToken() == null) { |
|
132 | + if($this->getAccessToken() == null) |
|
133 | + { |
|
129 | 134 | $payload_accessToken = ""; |
130 | 135 | } |
131 | - else { |
|
136 | + else |
|
137 | + { |
|
132 | 138 | $payload_accessToken = $this->getAccessToken(); |
133 | 139 | } |
134 | 140 |
@@ -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)) |
@@ -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 |
@@ -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 |
@@ -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 <?php if($view->view == 'combo')echo 'class="active"';?> href="<?php echo $view->changeView('combo')->toUrl();?>"><i class="fa fa-clock-o fa-3x"></i></a> |
|
5 | + <a <?php if($view->view == 'combo') |
|
6 | +{ |
|
7 | + echo 'class="active"'; |
|
8 | +} |
|
9 | +?> href="<?php echo $view->changeView('combo')->toUrl();?>"><i class="fa fa-clock-o fa-3x"></i></a> |
|
6 | 10 | </div> |
7 | 11 | <div class="col-xs-3"> |
8 | - <a <?php if($view->view == 'discussed') echo 'class="active"';?> href="<?php echo $view->changeView('discussed')->toUrl();?>"><i class="fa fa-commenting-o fa-3x"></i></a> |
|
12 | + <a <?php if($view->view == 'discussed') |
|
13 | +{ |
|
14 | + echo 'class="active"'; |
|
15 | +} |
|
16 | +?> href="<?php echo $view->changeView('discussed')->toUrl();?>"><i class="fa fa-commenting-o fa-3x"></i></a> |
|
9 | 17 | </div> |
10 | 18 | <div class="col-xs-3"> |
11 | - <a <?php if($view->view == 'popular') echo 'class="active"';?> href="<?php echo $view->changeView('popular')->toUrl();?>"><i class="fa fa-angle-up fa-3x"></i></a> |
|
19 | + <a <?php if($view->view == 'popular') |
|
20 | +{ |
|
21 | + echo 'class="active"'; |
|
22 | +} |
|
23 | +?> href="<?php echo $view->changeView('popular')->toUrl();?>"><i class="fa fa-angle-up fa-3x"></i></a> |
|
12 | 24 | </div> |
13 | 25 | <div class="col-xs-3"> |
14 | 26 | <nav> |