@@ -30,10 +30,12 @@ discard block |
||
30 | 30 | var_dump($accessToken); |
31 | 31 | isTokenFreshByAccessToken($location, $accessToken); |
32 | 32 | |
33 | - if($_POST['vote'] == "up") { |
|
33 | + if($_POST['vote'] == "up") |
|
34 | + { |
|
34 | 35 | $accountCreator = new Upvote(); |
35 | 36 | } |
36 | - else if($_POST['vote'] == "down") { |
|
37 | + else if($_POST['vote'] == "down") |
|
38 | + { |
|
37 | 39 | $accountCreator = new Downvote(); |
38 | 40 | } |
39 | 41 | |
@@ -151,7 +153,11 @@ discard block |
||
151 | 153 | <div> |
152 | 154 | <h2>Position</h2> |
153 | 155 | <form method="get"> |
154 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
156 | + <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) |
|
157 | +{ |
|
158 | + echo $newPositionStatus; |
|
159 | +} |
|
160 | +?>" required> |
|
155 | 161 | |
156 | 162 | <input type="submit" value="Set Location" /> |
157 | 163 | </form> |
@@ -167,7 +173,9 @@ discard block |
||
167 | 173 | |
168 | 174 | <article> |
169 | 175 | <div> |
170 | - <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
|
176 | + <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) |
|
177 | +{ |
|
178 | +?> |
|
171 | 179 | <h2>Comment on Jodel</h2> |
172 | 180 | <form method="POST"> |
173 | 181 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
@@ -175,7 +183,10 @@ discard block |
||
175 | 183 | <br /> |
176 | 184 | <input type="submit" value="SEND" /> |
177 | 185 | </form> |
178 | - <?php } else { ?> |
|
186 | + <?php } |
|
187 | +else |
|
188 | +{ |
|
189 | +?> |
|
179 | 190 | <h2>New Jodel</h2> |
180 | 191 | <form method="POST"> |
181 | 192 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -207,13 +218,25 @@ discard block |
||
207 | 218 | <div class="col-sm-12"> |
208 | 219 | <div class="row"> |
209 | 220 | <div class="col-sm-3"> |
210 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
221 | + <a href="index.php" <?php if($view=='time') |
|
222 | +{ |
|
223 | + echo 'class="active"'; |
|
224 | +} |
|
225 | +?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
211 | 226 | </div> |
212 | 227 | <div class="col-sm-3"> |
213 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
228 | + <a href="index.php?view=comment" <?php if($view=='comment') |
|
229 | +{ |
|
230 | + echo 'class="active"'; |
|
231 | +} |
|
232 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
214 | 233 | </div> |
215 | 234 | <div class="col-sm-3"> |
216 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
235 | + <a href="index.php?view=upVote" <?php if($view=='upVote') |
|
236 | +{ |
|
237 | + echo 'class="active"'; |
|
238 | +} |
|
239 | +?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
217 | 240 | </div> |
218 | 241 | <div class="col-sm-3"> |
219 | 242 | <nav> |
@@ -256,7 +279,9 @@ discard block |
||
256 | 279 | $('html,body').animate({scrollTop: aTag.offset().top-90},'slow'); |
257 | 280 | } |
258 | 281 | |
259 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
|
282 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) |
|
283 | +{ |
|
284 | +?> |
|
260 | 285 | |
261 | 286 | |
262 | 287 |
@@ -26,7 +26,8 @@ discard block |
||
26 | 26 | if ($result->num_rows > 0) |
27 | 27 | { |
28 | 28 | // output data of each row |
29 | - while($row = $result->fetch_assoc()) { |
|
29 | + while($row = $result->fetch_assoc()) |
|
30 | + { |
|
30 | 31 | //$access_token = $row["access_token"]; |
31 | 32 | $expiration_date = $row["expiration_date"]; |
32 | 33 | $deviceUid = $row["device_uid"]; |
@@ -38,7 +39,8 @@ discard block |
||
38 | 39 | echo '0 results'; |
39 | 40 | } |
40 | 41 | |
41 | - if($expiration_date <= time()) { |
|
42 | + if($expiration_date <= time()) |
|
43 | + { |
|
42 | 44 | $accountCreator = new CreateUser(); |
43 | 45 | $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
44 | 46 | $accountCreator->setDeviceUid($deviceUid); |
@@ -55,7 +57,8 @@ discard block |
||
55 | 57 | expiration_date='" . $expiration_date . "' |
56 | 58 | WHERE device_uid='" . $device_uid . "'"); |
57 | 59 | |
58 | - if($result === false){ |
|
60 | + if($result === false) |
|
61 | + { |
|
59 | 62 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
60 | 63 | } |
61 | 64 | } |
@@ -71,7 +74,8 @@ discard block |
||
71 | 74 | if ($result->num_rows > 0) |
72 | 75 | { |
73 | 76 | // output data of each row |
74 | - while($row = $result->fetch_assoc()) { |
|
77 | + while($row = $result->fetch_assoc()) |
|
78 | + { |
|
75 | 79 | //$access_token = $row["access_token"]; |
76 | 80 | $expiration_date = $row["expiration_date"]; |
77 | 81 | $deviceUid = $row["device_uid"]; |
@@ -83,7 +87,8 @@ discard block |
||
83 | 87 | echo '0 results'; |
84 | 88 | } |
85 | 89 | |
86 | - if($expiration_date <= time()) { |
|
90 | + if($expiration_date <= time()) |
|
91 | + { |
|
87 | 92 | $accountCreator = new CreateUser(); |
88 | 93 | $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
89 | 94 | $accountCreator->setDeviceUid($deviceUid); |
@@ -100,7 +105,8 @@ discard block |
||
100 | 105 | expiration_date='" . $expiration_date . "' |
101 | 106 | WHERE device_uid='" . $device_uid . "'"); |
102 | 107 | |
103 | - if($result === false){ |
|
108 | + if($result === false) |
|
109 | + { |
|
104 | 110 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
105 | 111 | } |
106 | 112 | } |
@@ -117,7 +123,8 @@ discard block |
||
117 | 123 | return $data["karma"]; |
118 | 124 | } |
119 | 125 | |
120 | -function registerAccount(Location $location) { |
|
126 | +function registerAccount(Location $location) |
|
127 | +{ |
|
121 | 128 | $accountCreator = new CreateUser(); |
122 | 129 | $accountCreator->setLocation($location); |
123 | 130 | $data = $accountCreator->execute(); |
@@ -142,7 +149,8 @@ discard block |
||
142 | 149 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
143 | 150 | |
144 | 151 | $success = TRUE; |
145 | - if($result === false){ |
|
152 | + if($result === false) |
|
153 | + { |
|
146 | 154 | $error = db_error(); |
147 | 155 | echo $error; |
148 | 156 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -153,7 +161,7 @@ discard block |
||
153 | 161 | } |
154 | 162 | |
155 | 163 | function getPosts($lastPostId, $accessToken, $url, $version = 'v2') |
156 | -{ |
|
164 | +{ |
|
157 | 165 | $accountCreator = new GetPosts(); |
158 | 166 | $accountCreator->setLastPostId($lastPostId); |
159 | 167 | $accountCreator->setAccessToken($accessToken); |
@@ -181,7 +189,8 @@ discard block |
||
181 | 189 | } |
182 | 190 | |
183 | 191 | function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE) |
184 | -{ //ToDO |
|
192 | +{ |
|
193 | +//ToDO |
|
185 | 194 | //Replace # with link |
186 | 195 | //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
187 | 196 | |
@@ -232,10 +241,12 @@ discard block |
||
232 | 241 | <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;"> |
233 | 242 | <content> |
234 | 243 | <?php |
235 | - if(isset($post["image_url"])) { |
|
244 | + if(isset($post["image_url"])) |
|
245 | + { |
|
236 | 246 | echo '<img src="' . $post["image_url"] . '">'; |
237 | 247 | } |
238 | - else { |
|
248 | + else |
|
249 | + { |
|
239 | 250 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($post["message"]))); |
240 | 251 | } |
241 | 252 | ?> |
@@ -261,13 +272,19 @@ discard block |
||
261 | 272 | </span> |
262 | 273 | </td> |
263 | 274 | <td class="comments"> |
264 | - <?php if(!$isDetailedView) {?> |
|
275 | + <?php if(!$isDetailedView) |
|
276 | +{ |
|
277 | +?> |
|
265 | 278 | <span data-tooltip="Comments"> |
266 | 279 | <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>"> |
267 | 280 | <i class="fa fa-commenting-o"></i> |
268 | - <?php if(array_key_exists("child_count", $post)) { |
|
281 | + <?php if(array_key_exists("child_count", $post)) |
|
282 | +{ |
|
269 | 283 | echo $post["child_count"]; |
270 | - } else echo "0"; |
|
284 | + } |
|
285 | + else { |
|
286 | + echo "0"; |
|
287 | + } |
|
271 | 288 | ?> |
272 | 289 | </a> |
273 | 290 | </span> |