@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class GetCaptcha extends AbstractRequest |
| 3 | -{ |
|
| 3 | +{ |
|
| 4 | 4 | function getApiEndPoint() |
| 5 | 5 | { |
| 6 | 6 | return '/v3/user/verification/imageCaptcha/'; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | if(substr($_GET['city'], 0, 1) === '#') |
| 57 | 57 | { |
| 58 | 58 | return htmlspecialchars($_GET['city']) . " " . $this->location->cityName; |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | else |
| 61 | 61 | { |
| 62 | 62 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
@@ -203,7 +203,8 @@ discard block |
||
| 203 | 203 | if(isset($_POST['color'])) |
| 204 | 204 | { |
| 205 | 205 | $color = $_POST['color']; |
| 206 | - switch ($color) { |
|
| 206 | + switch ($color) |
|
| 207 | + { |
|
| 207 | 208 | case '8ABDB0': |
| 208 | 209 | $color = '8ABDB0'; |
| 209 | 210 | break; |
@@ -262,7 +263,8 @@ discard block |
||
| 262 | 263 | if ($result->num_rows > 0) |
| 263 | 264 | { |
| 264 | 265 | // output data of each row |
| 265 | - while($row = $result->fetch_assoc()) { |
|
| 266 | + while($row = $result->fetch_assoc()) |
|
| 267 | + { |
|
| 266 | 268 | //$access_token = $row["access_token"]; |
| 267 | 269 | $expiration_date = $row["expiration_date"]; |
| 268 | 270 | $deviceUid = $row["device_uid"]; |
@@ -274,7 +276,8 @@ discard block |
||
| 274 | 276 | echo '0 results'; |
| 275 | 277 | } |
| 276 | 278 | |
| 277 | - if($expiration_date <= time()) { |
|
| 279 | + if($expiration_date <= time()) |
|
| 280 | + { |
|
| 278 | 281 | $accountCreator = new CreateUser(); |
| 279 | 282 | $accountCreator->setAccessToken($access_token); |
| 280 | 283 | $accountCreator->setDeviceUid($deviceUid); |
@@ -291,7 +294,8 @@ discard block |
||
| 291 | 294 | expiration_date='" . $expiration_date . "' |
| 292 | 295 | WHERE device_uid='" . $device_uid . "'"); |
| 293 | 296 | |
| 294 | - if($result === false){ |
|
| 297 | + if($result === false) |
|
| 298 | + { |
|
| 295 | 299 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 296 | 300 | } |
| 297 | 301 | } |
@@ -381,14 +385,16 @@ discard block |
||
| 381 | 385 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
| 382 | 386 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
| 383 | 387 | |
| 384 | - if($result === false){ |
|
| 388 | + if($result === false) |
|
| 389 | + { |
|
| 385 | 390 | $error = db_error(); |
| 386 | 391 | echo $error; |
| 387 | 392 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
| 388 | 393 | } |
| 389 | 394 | } |
| 390 | 395 | |
| 391 | - function registerAccount($location) { |
|
| 396 | + function registerAccount($location) |
|
| 397 | + { |
|
| 392 | 398 | $accountCreator = new CreateUser(); |
| 393 | 399 | $accountCreator->setLocation($location); |
| 394 | 400 | $data = $accountCreator->execute(); |
@@ -413,7 +419,8 @@ discard block |
||
| 413 | 419 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 414 | 420 | |
| 415 | 421 | $success = TRUE; |
| 416 | - if($result === false){ |
|
| 422 | + if($result === false) |
|
| 423 | + { |
|
| 417 | 424 | $error = db_error(); |
| 418 | 425 | echo $error; |
| 419 | 426 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -75,7 +75,11 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | <div id="location_mobile" class="hidden-sm-up"> |
| 77 | 77 | <form method="get"> |
| 78 | - <input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
| 78 | + <input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus)) |
|
| 79 | +{ |
|
| 80 | + echo $newPositionStatus; |
|
| 81 | +} |
|
| 82 | +?>" required> |
|
| 79 | 83 | |
| 80 | 84 | <input type="submit" id="submit_mobile" class="fa" value="" /> |
| 81 | 85 | </form> |
@@ -102,7 +106,9 @@ discard block |
||
| 102 | 106 | |
| 103 | 107 | </content> |
| 104 | 108 | |
| 105 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 109 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
| 110 | +{ |
|
| 111 | +?> |
|
| 106 | 112 | <p id="loading"> |
| 107 | 113 | Loading… |
| 108 | 114 | </p> |
@@ -115,7 +121,11 @@ discard block |
||
| 115 | 121 | <div> |
| 116 | 122 | <h2>Position / Hashtag</h2> |
| 117 | 123 | <form method="get"> |
| 118 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
| 124 | + <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) |
|
| 125 | +{ |
|
| 126 | + echo $newPositionStatus; |
|
| 127 | +} |
|
| 128 | +?>" required> |
|
| 119 | 129 | <label>try: #jhj</label><br> |
| 120 | 130 | <input type="submit" value="Set Location" /> |
| 121 | 131 | </form> |
@@ -131,7 +141,9 @@ discard block |
||
| 131 | 141 | |
| 132 | 142 | <article> |
| 133 | 143 | <div> |
| 134 | - <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?> |
|
| 144 | + <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) |
|
| 145 | +{ |
|
| 146 | +?> |
|
| 135 | 147 | <h2>Comment on Jodel</h2> |
| 136 | 148 | <form method="POST"> |
| 137 | 149 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" /> |
@@ -139,7 +151,10 @@ discard block |
||
| 139 | 151 | <br /> |
| 140 | 152 | <input type="submit" value="SEND" /> |
| 141 | 153 | </form> |
| 142 | - <?php } else { ?> |
|
| 154 | + <?php } |
|
| 155 | +else |
|
| 156 | +{ |
|
| 157 | +?> |
|
| 143 | 158 | <h2>New Jodel</h2> |
| 144 | 159 | <form method="POST"> |
| 145 | 160 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -171,13 +186,25 @@ discard block |
||
| 171 | 186 | <div class="col-xs-12"> |
| 172 | 187 | <div class="row"> |
| 173 | 188 | <div class="col-xs-3"> |
| 174 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 189 | + <a href="index.php" <?php if($view=='time') |
|
| 190 | +{ |
|
| 191 | + echo 'class="active"'; |
|
| 192 | +} |
|
| 193 | +?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 175 | 194 | </div> |
| 176 | 195 | <div class="col-xs-3"> |
| 177 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 196 | + <a href="index.php?view=comment" <?php if($view=='comment') |
|
| 197 | +{ |
|
| 198 | + echo 'class="active"'; |
|
| 199 | +} |
|
| 200 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 178 | 201 | </div> |
| 179 | 202 | <div class="col-xs-3"> |
| 180 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 203 | + <a href="index.php?view=upVote" <?php if($view=='upVote') |
|
| 204 | +{ |
|
| 205 | + echo 'class="active"'; |
|
| 206 | +} |
|
| 207 | +?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 181 | 208 | </div> |
| 182 | 209 | <div class="col-xs-3"> |
| 183 | 210 | <nav> |
@@ -218,7 +245,9 @@ discard block |
||
| 218 | 245 | $('html,body').animate({scrollTop: aTag.offset().top-90},'slow'); |
| 219 | 246 | } |
| 220 | 247 | |
| 221 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 248 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
| 249 | +{ |
|
| 250 | +?> |
|
| 222 | 251 | |
| 223 | 252 | |
| 224 | 253 | |
@@ -9,7 +9,8 @@ discard block |
||
| 9 | 9 | * Compute HTML Code |
| 10 | 10 | */ |
| 11 | 11 | function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE) |
| 12 | - { //ToDO |
|
| 12 | + { |
|
| 13 | +//ToDO |
|
| 13 | 14 | //Replace # with link |
| 14 | 15 | //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
| 15 | 16 | |
@@ -65,7 +66,8 @@ discard block |
||
| 65 | 66 | |
| 66 | 67 | echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
| 67 | 68 | } |
| 68 | - else { |
|
| 69 | + else |
|
| 70 | + { |
|
| 69 | 71 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
| 70 | 72 | } |
| 71 | 73 | ?> |
@@ -73,11 +75,13 @@ discard block |
||
| 73 | 75 | <aside> |
| 74 | 76 | <?php |
| 75 | 77 | if($isDetailedView) |
| 76 | - {?> |
|
| 78 | + { |
|
| 79 | +?> |
|
| 77 | 80 | <a href="index.php?vote=up&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow"> |
| 78 | 81 | <?php } |
| 79 | - else |
|
| 80 | - {?> |
|
| 82 | +else |
|
| 83 | + { |
|
| 84 | +?> |
|
| 81 | 85 | <a href="index.php?vote=up&postId=<?php echo $post['post_id'];?>" rel="nofollow"> |
| 82 | 86 | <?php } ?> |
| 83 | 87 | <i class="fa fa-angle-up fa-3x"></i> |
@@ -86,11 +90,13 @@ discard block |
||
| 86 | 90 | <?php echo $post["vote_count"];?><br /> |
| 87 | 91 | <?php |
| 88 | 92 | if($isDetailedView) |
| 89 | - {?> |
|
| 93 | + { |
|
| 94 | +?> |
|
| 90 | 95 | <a href="index.php?vote=down&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow"> |
| 91 | 96 | <?php } |
| 92 | - else |
|
| 93 | - {?> |
|
| 97 | +else |
|
| 98 | + { |
|
| 99 | +?> |
|
| 94 | 100 | <a href="index.php?vote=down&postId=<?php echo $post['post_id'];?>" rel="nofollow"> |
| 95 | 101 | <?php } ?> |
| 96 | 102 | <i class="fa fa-angle-down fa-3x"></i> |
@@ -108,13 +114,19 @@ discard block |
||
| 108 | 114 | </span> |
| 109 | 115 | </td> |
| 110 | 116 | <td class="comments"> |
| 111 | - <?php if(!$isDetailedView) {?> |
|
| 117 | + <?php if(!$isDetailedView) |
|
| 118 | +{ |
|
| 119 | +?> |
|
| 112 | 120 | <span data-tooltip="Comments"> |
| 113 | 121 | <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postId=<?php echo $post["post_id"];?>"> |
| 114 | 122 | <i class="fa fa-commenting-o"></i> |
| 115 | - <?php if(array_key_exists("child_count", $post)) { |
|
| 123 | + <?php if(array_key_exists("child_count", $post)) |
|
| 124 | +{ |
|
| 116 | 125 | echo $post["child_count"]; |
| 117 | - } else echo "0"; |
|
| 126 | + } |
|
| 127 | + else { |
|
| 128 | + echo "0"; |
|
| 129 | + } |
|
| 118 | 130 | ?> |
| 119 | 131 | </a> |
| 120 | 132 | </span> |
@@ -230,7 +242,7 @@ discard block |
||
| 230 | 242 | } |
| 231 | 243 | |
| 232 | 244 | function getPosts($lastPostId, $accessToken, $url, $version = 'v2') |
| 233 | - { |
|
| 245 | + { |
|
| 234 | 246 | $accountCreator = new GetPosts(); |
| 235 | 247 | $accountCreator->setLastPostId($lastPostId); |
| 236 | 248 | $accountCreator->setAccessToken($accessToken); |
@@ -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 |
@@ -114,7 +114,8 @@ discard block |
||
| 114 | 114 | //Set View |
| 115 | 115 | if(isset($_GET['view'])) |
| 116 | 116 | { |
| 117 | - switch ($_GET['view']) { |
|
| 117 | + switch ($_GET['view']) |
|
| 118 | + { |
|
| 118 | 119 | case 'comment': |
| 119 | 120 | $view = 'comment'; |
| 120 | 121 | break; |
@@ -151,7 +152,7 @@ discard block |
||
| 151 | 152 | { |
| 152 | 153 | $jodelAccountForKarma->votePostId($_GET['postId'], $_GET['vote']); |
| 153 | 154 | if(isset($_GET['getPostDetails']) && isset($_GET['getPostDetails'])) |
| 154 | - { |
|
| 155 | + { |
|
| 155 | 156 | header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId'])); |
| 156 | 157 | } |
| 157 | 158 | else |
@@ -169,7 +170,7 @@ discard block |
||
| 169 | 170 | |
| 170 | 171 | |
| 171 | 172 | function getPosts($lastPostId, $accessToken, $url, $version = 'v2') |
| 172 | - { |
|
| 173 | + { |
|
| 173 | 174 | $accountCreator = new GetPosts(); |
| 174 | 175 | $accountCreator->setLastPostId($lastPostId); |
| 175 | 176 | $accountCreator->setAccessToken($accessToken); |
@@ -290,7 +291,8 @@ discard block |
||
| 290 | 291 | |
| 291 | 292 | $posts[0] = $data; |
| 292 | 293 | |
| 293 | - if(array_key_exists('children', $data)) { |
|
| 294 | + if(array_key_exists('children', $data)) |
|
| 295 | + { |
|
| 294 | 296 | foreach($data['children'] as $key => $child) |
| 295 | 297 | { |
| 296 | 298 | |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | { |
| 60 | 60 | $response = array("success" => $success, "message" => $message, "captcha" => $captcha, "deviceUid" => $deviceUid); |
| 61 | 61 | } |
| 62 | -else |
|
| 62 | +else |
|
| 63 | 63 | { |
| 64 | 64 | $response = array("success" => $success, "message" => $message); |
| 65 | 65 | } |