@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | if(!isset($_COOKIE["JodelDeviceId"])) |
| 37 | 37 | { |
| 38 | 38 | $deviceUid = createAccount(); |
| 39 | - setcookie('JodelDeviceId', $deviceUid, time()+60*60*24*365*10); |
|
| 40 | - error_log('Created account with JodelDeviceId:' . $deviceUid . ' for [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
|
| 39 | + setcookie('JodelDeviceId', $deviceUid, time() + 60 * 60 * 24 * 365 * 10); |
|
| 40 | + error_log('Created account with JodelDeviceId:' . $deviceUid . ' for [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
|
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | else |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | //Set View |
| 58 | 58 | if(isset($_GET['view'])) |
| 59 | 59 | { |
| 60 | - switch ($_GET['view']) { |
|
| 60 | + switch($_GET['view']) { |
|
| 61 | 61 | case 'comment': |
| 62 | 62 | $view = 'comment'; |
| 63 | 63 | break; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | else |
| 116 | 116 | { |
| 117 | 117 | $newPositionStatus = $name; |
| 118 | - error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 118 | + error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | if(isset($_POST['color'])) |
| 151 | 151 | { |
| 152 | 152 | $color = $_POST['color']; |
| 153 | - switch ($color) { |
|
| 153 | + switch($color) { |
|
| 154 | 154 | case '8ABDB0': |
| 155 | 155 | $color = '8ABDB0'; |
| 156 | 156 | break; |
@@ -328,13 +328,13 @@ discard block |
||
| 328 | 328 | else |
| 329 | 329 | { |
| 330 | 330 | $version = 'v2'; |
| 331 | - if($view=='comment') |
|
| 331 | + if($view == 'comment') |
|
| 332 | 332 | { |
| 333 | 333 | $url = "/v2/posts/location/discussed/"; |
| 334 | 334 | } |
| 335 | 335 | else |
| 336 | 336 | { |
| 337 | - if($view=='upVote') |
|
| 337 | + if($view == 'upVote') |
|
| 338 | 338 | { |
| 339 | 339 | $url = "/v2/posts/location/popular/"; |
| 340 | 340 | } |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | |
| 361 | - for($i = 0; $i<$loops; $i++) |
|
| 361 | + for($i = 0; $i < $loops; $i++) |
|
| 362 | 362 | { |
| 363 | 363 | if(array_key_exists($i, $posts)) |
| 364 | 364 | { |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
| 403 | 403 | <h2>Comment on Jodel</h2> |
| 404 | 404 | <form method="POST"> |
| 405 | - <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
|
| 405 | + <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" /> |
|
| 406 | 406 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
| 407 | 407 | <br /> |
| 408 | 408 | <input type="submit" value="SEND" /> |
@@ -439,13 +439,13 @@ discard block |
||
| 439 | 439 | <div class="col-sm-12"> |
| 440 | 440 | <div class="row"> |
| 441 | 441 | <div class="col-sm-3"> |
| 442 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 442 | + <a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 443 | 443 | </div> |
| 444 | 444 | <div class="col-sm-3"> |
| 445 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 445 | + <a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 446 | 446 | </div> |
| 447 | 447 | <div class="col-sm-3"> |
| 448 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 448 | + <a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 449 | 449 | </div> |
| 450 | 450 | <div class="col-sm-3"> |
| 451 | 451 | <nav> |
@@ -309,7 +309,7 @@ |
||
| 309 | 309 | { |
| 310 | 310 | preg_match('/bot|spider|google|twitter^$/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
| 311 | 311 | |
| 312 | - return (isset($matches[0])) ? false : true; |
|
| 312 | + return (isset($matches[0])) ? false : true; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | function botDeviceUidIsSet($config) |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $access_token; |
| 27 | 27 | |
| 28 | - if ($result->num_rows > 0) |
|
| 28 | + if($result->num_rows > 0) |
|
| 29 | 29 | { |
| 30 | 30 | // output data of each row |
| 31 | 31 | while($row = $result->fetch_assoc()) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | if($expiration_date <= time()) { |
| 44 | 44 | $accountCreator = new CreateUser(); |
| 45 | - $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
|
| 45 | + $accountCreator->setAccessToken($access_token); //$accountData->getAccessToken()); |
|
| 46 | 46 | $accountCreator->setDeviceUid($deviceUid); |
| 47 | 47 | $accountCreator->setLocation($location); |
| 48 | 48 | $data = $accountCreator->execute(); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | expiration_date='" . $expiration_date . "' |
| 58 | 58 | WHERE device_uid='" . $device_uid . "'"); |
| 59 | 59 | |
| 60 | - if($result === false){ |
|
| 60 | + if($result === false) { |
|
| 61 | 61 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $db = new DatabaseConnect(); |
| 71 | 71 | $result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
| 72 | 72 | |
| 73 | - if ($result->num_rows > 0) |
|
| 73 | + if($result->num_rows > 0) |
|
| 74 | 74 | { |
| 75 | 75 | // output data of each row |
| 76 | 76 | while($row = $result->fetch_assoc()) { |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | if($expiration_date <= time()) { |
| 89 | 89 | $accountCreator = new CreateUser(); |
| 90 | - $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
|
| 90 | + $accountCreator->setAccessToken($access_token); //$accountData->getAccessToken()); |
|
| 91 | 91 | $accountCreator->setDeviceUid($deviceUid); |
| 92 | 92 | $accountCreator->setLocation($location); |
| 93 | 93 | $data = $accountCreator->execute(); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | expiration_date='" . $expiration_date . "' |
| 103 | 103 | WHERE device_uid='" . $device_uid . "'"); |
| 104 | 104 | |
| 105 | - if($result === false){ |
|
| 105 | + if($result === false) { |
|
| 106 | 106 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | $access_token; |
| 119 | 119 | |
| 120 | - if ($result->num_rows > 0) |
|
| 120 | + if($result->num_rows > 0) |
|
| 121 | 121 | { |
| 122 | 122 | // output data of each row |
| 123 | 123 | while($row = $result->fetch_assoc()) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | expiration_date='" . $expiration_date . "' |
| 150 | 150 | WHERE device_uid='" . $device_uid . "'"); |
| 151 | 151 | |
| 152 | - if($result === false){ |
|
| 152 | + if($result === false) { |
|
| 153 | 153 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | function getLocationByAccessToken($accessToken) |
| 161 | 161 | { |
| 162 | 162 | $db = new DatabaseConnect(); |
| 163 | - $result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
|
| 163 | + $result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
|
| 164 | 164 | |
| 165 | 165 | $location = new Location(); |
| 166 | 166 | |
| 167 | - if ($result->num_rows > 0) |
|
| 167 | + if($result->num_rows > 0) |
|
| 168 | 168 | { |
| 169 | 169 | // output data of each row |
| 170 | 170 | while($row = $result->fetch_assoc()) |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | function getLocationByDeviceUid($deviceUid) |
| 186 | 186 | { |
| 187 | 187 | $db = new DatabaseConnect(); |
| 188 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 188 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 189 | 189 | |
| 190 | 190 | $location = new Location(); |
| 191 | 191 | |
| 192 | - if ($result->num_rows > 0) |
|
| 192 | + if($result->num_rows > 0) |
|
| 193 | 193 | { |
| 194 | 194 | // output data of each row |
| 195 | 195 | while($row = $result->fetch_assoc()) |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | function getAccessTokenByDeviceUid($deviceUid) |
| 211 | 211 | { |
| 212 | 212 | $db = new DatabaseConnect(); |
| 213 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 213 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 214 | 214 | |
| 215 | 215 | $accessToken; |
| 216 | 216 | |
| 217 | - if ($result->num_rows > 0) |
|
| 217 | + if($result->num_rows > 0) |
|
| 218 | 218 | { |
| 219 | 219 | // output data of each row |
| 220 | 220 | while($row = $result->fetch_assoc()) |
@@ -261,11 +261,11 @@ discard block |
||
| 261 | 261 | $result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type, |
| 262 | 262 | expires_in, expiration_date, distinct_id, device_uid, name, lat, lng) |
| 263 | 263 | VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type . |
| 264 | - "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 264 | + "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 265 | 265 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 266 | 266 | |
| 267 | 267 | $success = TRUE; |
| 268 | - if($result === false){ |
|
| 268 | + if($result === false) { |
|
| 269 | 269 | $error = db_error(); |
| 270 | 270 | echo $error; |
| 271 | 271 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | { |
| 310 | 310 | preg_match('/bot|spider|google|twitter^$/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
| 311 | 311 | |
| 312 | - return (isset($matches[0])) ? false : true; |
|
| 312 | + return (isset($matches[0]))?false : true; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | function botDeviceUidIsSet($config) |
@@ -340,25 +340,25 @@ discard block |
||
| 340 | 340 | $timediff_inDays = (string)$timediff->format('%d'); |
| 341 | 341 | $timediff_inMonth = (string)$timediff->format('%m'); |
| 342 | 342 | |
| 343 | - if($timediff_inMonth!=0) |
|
| 343 | + if($timediff_inMonth != 0) |
|
| 344 | 344 | { |
| 345 | 345 | $timediff = $timediff_inMonth . "m"; |
| 346 | 346 | } |
| 347 | 347 | else |
| 348 | 348 | { |
| 349 | - if($timediff_inDays!=0) |
|
| 349 | + if($timediff_inDays != 0) |
|
| 350 | 350 | { |
| 351 | 351 | $timediff = $timediff_inDays . "d"; |
| 352 | 352 | } |
| 353 | 353 | else |
| 354 | 354 | { |
| 355 | - if($timediff_inHours!=0) |
|
| 355 | + if($timediff_inHours != 0) |
|
| 356 | 356 | { |
| 357 | 357 | $timediff = $timediff_inHours . "h"; |
| 358 | 358 | } |
| 359 | 359 | else |
| 360 | 360 | { |
| 361 | - if($timediff_inMinutes!=0) |
|
| 361 | + if($timediff_inMinutes != 0) |
|
| 362 | 362 | { |
| 363 | 363 | $timediff = $timediff_inMinutes . "m"; |
| 364 | 364 | } |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | |
| 373 | 373 | |
| 374 | 374 | ?> |
| 375 | - <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;"> |
|
| 375 | + <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"]; ?>;"> |
|
| 376 | 376 | <content> |
| 377 | 377 | <?php |
| 378 | 378 | if(isset($post["image_url"])) { |
@@ -384,12 +384,12 @@ discard block |
||
| 384 | 384 | ?> |
| 385 | 385 | </content> |
| 386 | 386 | <aside> |
| 387 | - <a href="index.php?vote=up&postID=<?php echo $post["post_id"];?>"> |
|
| 387 | + <a href="index.php?vote=up&postID=<?php echo $post["post_id"]; ?>"> |
|
| 388 | 388 | <i class="fa fa-angle-up fa-3x"></i> |
| 389 | 389 | </a> |
| 390 | 390 | <br /> |
| 391 | - <?php echo $post["vote_count"];?><br /> |
|
| 392 | - <a href="index.php?vote=down&postID=<?php echo $post["post_id"];?>"> |
|
| 391 | + <?php echo $post["vote_count"]; ?><br /> |
|
| 392 | + <a href="index.php?vote=down&postID=<?php echo $post["post_id"]; ?>"> |
|
| 393 | 393 | <i class="fa fa-angle-down fa-3x"></i> |
| 394 | 394 | </a> |
| 395 | 395 | </aside> |
@@ -400,14 +400,14 @@ discard block |
||
| 400 | 400 | <td class="time"> |
| 401 | 401 | <span class="tip" data-tooltip="Time"> |
| 402 | 402 | <i class="fa fa-clock-o"></i> |
| 403 | - <?php echo $timediff;?> |
|
| 404 | - <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span> |
|
| 403 | + <?php echo $timediff; ?> |
|
| 404 | + <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s'); ?></span> |
|
| 405 | 405 | </span> |
| 406 | 406 | </td> |
| 407 | 407 | <td class="comments"> |
| 408 | 408 | <?php if(!$isDetailedView) {?> |
| 409 | 409 | <span data-tooltip="Comments"> |
| 410 | - <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>"> |
|
| 410 | + <a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $post["post_id"]; ?>"> |
|
| 411 | 411 | <i class="fa fa-commenting-o"></i> |
| 412 | 412 | <?php if(array_key_exists("child_count", $post)) { |
| 413 | 413 | echo $post["child_count"]; |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | { |
| 437 | 437 | ?> |
| 438 | 438 | <span data-tooltip="Author"> |
| 439 | - <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> | |
|
| 439 | + <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"]; ?> | |
|
| 440 | 440 | </span> |
| 441 | 441 | <?php |
| 442 | 442 | } |
@@ -446,8 +446,8 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | <span class="tip" data-tooltip="Distance"> |
| 448 | 448 | <i class="fa fa-map-marker"></i> |
| 449 | - <?php echo $post['distance'];?> km |
|
| 450 | - <span class="tiptext"><?php echo $post['location']['name'];?></span> |
|
| 449 | + <?php echo $post['distance']; ?> km |
|
| 450 | + <span class="tiptext"><?php echo $post['location']['name']; ?></span> |
|
| 451 | 451 | </span> |
| 452 | 452 | </td> |
| 453 | 453 | </tr> |