@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | function isDeviceUidInDatabase($deviceUid) |
| 22 | 22 | { |
| 23 | 23 | $db = new DatabaseConnect(); |
| 24 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 24 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 25 | 25 | |
| 26 | 26 | $access_token; |
| 27 | 27 | |
| 28 | - if ($result->num_rows > 0) |
|
| 28 | + if($result->num_rows > 0) |
|
| 29 | 29 | { |
| 30 | 30 | return TRUE; |
| 31 | 31 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $access_token; |
| 44 | 44 | |
| 45 | - if ($result->num_rows > 0) |
|
| 45 | + if($result->num_rows > 0) |
|
| 46 | 46 | { |
| 47 | 47 | // output data of each row |
| 48 | 48 | while($row = $result->fetch_assoc()) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | if($expiration_date <= time()) { |
| 61 | 61 | $accountCreator = new CreateUser(); |
| 62 | - $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
|
| 62 | + $accountCreator->setAccessToken($access_token); //$accountData->getAccessToken()); |
|
| 63 | 63 | $accountCreator->setDeviceUid($deviceUid); |
| 64 | 64 | $accountCreator->setLocation($location); |
| 65 | 65 | $data = $accountCreator->execute(); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | expiration_date='" . $expiration_date . "' |
| 75 | 75 | WHERE device_uid='" . $device_uid . "'"); |
| 76 | 76 | |
| 77 | - if($result === false){ |
|
| 77 | + if($result === false) { |
|
| 78 | 78 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $db = new DatabaseConnect(); |
| 88 | 88 | $result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
| 89 | 89 | |
| 90 | - if ($result->num_rows > 0) |
|
| 90 | + if($result->num_rows > 0) |
|
| 91 | 91 | { |
| 92 | 92 | // output data of each row |
| 93 | 93 | while($row = $result->fetch_assoc()) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | if($expiration_date <= time()) { |
| 106 | 106 | $accountCreator = new CreateUser(); |
| 107 | - $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
|
| 107 | + $accountCreator->setAccessToken($access_token); //$accountData->getAccessToken()); |
|
| 108 | 108 | $accountCreator->setDeviceUid($deviceUid); |
| 109 | 109 | $accountCreator->setLocation($location); |
| 110 | 110 | $data = $accountCreator->execute(); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | expiration_date='" . $expiration_date . "' |
| 120 | 120 | WHERE device_uid='" . $device_uid . "'"); |
| 121 | 121 | |
| 122 | - if($result === false){ |
|
| 122 | + if($result === false) { |
|
| 123 | 123 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $access_token; |
| 136 | 136 | |
| 137 | - if ($result->num_rows > 0) |
|
| 137 | + if($result->num_rows > 0) |
|
| 138 | 138 | { |
| 139 | 139 | // output data of each row |
| 140 | 140 | while($row = $result->fetch_assoc()) { |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | expiration_date='" . $expiration_date . "' |
| 167 | 167 | WHERE device_uid='" . $device_uid . "'"); |
| 168 | 168 | |
| 169 | - if($result === false){ |
|
| 169 | + if($result === false) { |
|
| 170 | 170 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | function getLocationByAccessToken($accessToken) |
| 178 | 178 | { |
| 179 | 179 | $db = new DatabaseConnect(); |
| 180 | - $result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
|
| 180 | + $result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'"); |
|
| 181 | 181 | |
| 182 | 182 | $location = new Location(); |
| 183 | 183 | |
| 184 | - if ($result->num_rows > 0) |
|
| 184 | + if($result->num_rows > 0) |
|
| 185 | 185 | { |
| 186 | 186 | // output data of each row |
| 187 | 187 | while($row = $result->fetch_assoc()) |
@@ -202,11 +202,11 @@ discard block |
||
| 202 | 202 | function getLocationByDeviceUid($deviceUid) |
| 203 | 203 | { |
| 204 | 204 | $db = new DatabaseConnect(); |
| 205 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 205 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 206 | 206 | |
| 207 | 207 | $location = new Location(); |
| 208 | 208 | |
| 209 | - if ($result->num_rows > 0) |
|
| 209 | + if($result->num_rows > 0) |
|
| 210 | 210 | { |
| 211 | 211 | // output data of each row |
| 212 | 212 | while($row = $result->fetch_assoc()) |
@@ -227,11 +227,11 @@ discard block |
||
| 227 | 227 | function getDeviceUidByAccessToken($accesstoken) |
| 228 | 228 | { |
| 229 | 229 | $db = new DatabaseConnect(); |
| 230 | - $result = $db->query("SELECT device_uid FROM accounts WHERE access_token='" . $accesstoken . "'"); |
|
| 230 | + $result = $db->query("SELECT device_uid FROM accounts WHERE access_token='" . $accesstoken . "'"); |
|
| 231 | 231 | |
| 232 | 232 | $deviceUid; |
| 233 | 233 | |
| 234 | - if ($result->num_rows > 0) |
|
| 234 | + if($result->num_rows > 0) |
|
| 235 | 235 | { |
| 236 | 236 | // output data of each row |
| 237 | 237 | while($row = $result->fetch_assoc()) |
@@ -250,11 +250,11 @@ discard block |
||
| 250 | 250 | function getAccessTokenByDeviceUid($deviceUid) |
| 251 | 251 | { |
| 252 | 252 | $db = new DatabaseConnect(); |
| 253 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 253 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 254 | 254 | |
| 255 | 255 | $accessToken; |
| 256 | 256 | |
| 257 | - if ($result->num_rows > 0) |
|
| 257 | + if($result->num_rows > 0) |
|
| 258 | 258 | { |
| 259 | 259 | // output data of each row |
| 260 | 260 | while($row = $result->fetch_assoc()) |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $result = $db->query("INSERT INTO votes (device_uid, postId) |
| 287 | 287 | VALUES ('" . $device_uid . "','" . $postId . "') "); |
| 288 | 288 | |
| 289 | - if($result === false){ |
|
| 289 | + if($result === false) { |
|
| 290 | 290 | $error = db_error(); |
| 291 | 291 | echo $error; |
| 292 | 292 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
@@ -315,11 +315,11 @@ discard block |
||
| 315 | 315 | $result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type, |
| 316 | 316 | expires_in, expiration_date, distinct_id, device_uid, name, lat, lng) |
| 317 | 317 | VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type . |
| 318 | - "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 318 | + "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 319 | 319 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 320 | 320 | |
| 321 | 321 | $success = TRUE; |
| 322 | - if($result === false){ |
|
| 322 | + if($result === false) { |
|
| 323 | 323 | $error = db_error(); |
| 324 | 324 | echo $error; |
| 325 | 325 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | { |
| 366 | 366 | preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
| 367 | 367 | |
| 368 | - return (isset($matches[0])) ? true : false; |
|
| 368 | + return (isset($matches[0]))?true : false; |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | function botDeviceUidIsSet($config) |
@@ -396,25 +396,25 @@ discard block |
||
| 396 | 396 | $timediff_inDays = (string)$timediff->format('%d'); |
| 397 | 397 | $timediff_inMonth = (string)$timediff->format('%m'); |
| 398 | 398 | |
| 399 | - if($timediff_inMonth!=0) |
|
| 399 | + if($timediff_inMonth != 0) |
|
| 400 | 400 | { |
| 401 | 401 | $timediff = $timediff_inMonth . "m"; |
| 402 | 402 | } |
| 403 | 403 | else |
| 404 | 404 | { |
| 405 | - if($timediff_inDays!=0) |
|
| 405 | + if($timediff_inDays != 0) |
|
| 406 | 406 | { |
| 407 | 407 | $timediff = $timediff_inDays . "d"; |
| 408 | 408 | } |
| 409 | 409 | else |
| 410 | 410 | { |
| 411 | - if($timediff_inHours!=0) |
|
| 411 | + if($timediff_inHours != 0) |
|
| 412 | 412 | { |
| 413 | 413 | $timediff = $timediff_inHours . "h"; |
| 414 | 414 | } |
| 415 | 415 | else |
| 416 | 416 | { |
| 417 | - if($timediff_inMinutes!=0) |
|
| 417 | + if($timediff_inMinutes != 0) |
|
| 418 | 418 | { |
| 419 | 419 | $timediff = $timediff_inMinutes . "m"; |
| 420 | 420 | } |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | |
| 430 | 430 | ?> |
| 431 | - <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;"> |
|
| 431 | + <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"]; ?>;"> |
|
| 432 | 432 | <content> |
| 433 | 433 | <?php |
| 434 | 434 | if(isset($post["image_url"])) { |
@@ -443,24 +443,24 @@ discard block |
||
| 443 | 443 | <?php |
| 444 | 444 | if($isDetailedView) |
| 445 | 445 | {?> |
| 446 | - <a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>"> |
|
| 446 | + <a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id']; ?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']); ?>"> |
|
| 447 | 447 | <?php } |
| 448 | 448 | else |
| 449 | 449 | {?> |
| 450 | - <a href="index.php?vote=up&postID=<?php echo $post['post_id'];?>"> |
|
| 450 | + <a href="index.php?vote=up&postID=<?php echo $post['post_id']; ?>"> |
|
| 451 | 451 | <?php } ?> |
| 452 | 452 | <i class="fa fa-angle-up fa-3x"></i> |
| 453 | 453 | </a> |
| 454 | 454 | <br /> |
| 455 | - <?php echo $post["vote_count"];?><br /> |
|
| 455 | + <?php echo $post["vote_count"]; ?><br /> |
|
| 456 | 456 | <?php |
| 457 | 457 | if($isDetailedView) |
| 458 | 458 | {?> |
| 459 | - <a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>"> |
|
| 459 | + <a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id']; ?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']); ?>"> |
|
| 460 | 460 | <?php } |
| 461 | 461 | else |
| 462 | 462 | {?> |
| 463 | - <a href="index.php?vote=down&postID=<?php echo $post['post_id'];?>"> |
|
| 463 | + <a href="index.php?vote=down&postID=<?php echo $post['post_id']; ?>"> |
|
| 464 | 464 | <?php } ?> |
| 465 | 465 | <i class="fa fa-angle-down fa-3x"></i> |
| 466 | 466 | </a> |
@@ -472,14 +472,14 @@ discard block |
||
| 472 | 472 | <td class="time"> |
| 473 | 473 | <span class="tip" data-tooltip="Time"> |
| 474 | 474 | <i class="fa fa-clock-o"></i> |
| 475 | - <?php echo $timediff;?> |
|
| 476 | - <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span> |
|
| 475 | + <?php echo $timediff; ?> |
|
| 476 | + <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s'); ?></span> |
|
| 477 | 477 | </span> |
| 478 | 478 | </td> |
| 479 | 479 | <td class="comments"> |
| 480 | 480 | <?php if(!$isDetailedView) {?> |
| 481 | 481 | <span data-tooltip="Comments"> |
| 482 | - <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>"> |
|
| 482 | + <a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $post["post_id"]; ?>"> |
|
| 483 | 483 | <i class="fa fa-commenting-o"></i> |
| 484 | 484 | <?php if(array_key_exists("child_count", $post)) { |
| 485 | 485 | echo $post["child_count"]; |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | { |
| 509 | 509 | ?> |
| 510 | 510 | <span data-tooltip="Author"> |
| 511 | - <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> | |
|
| 511 | + <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"]; ?> | |
|
| 512 | 512 | </span> |
| 513 | 513 | <?php |
| 514 | 514 | } |
@@ -518,8 +518,8 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | <span class="tip" data-tooltip="Distance"> |
| 520 | 520 | <i class="fa fa-map-marker"></i> |
| 521 | - <?php echo $post['distance'];?> km |
|
| 522 | - <span class="tiptext"><?php echo $post['location']['name'];?></span> |
|
| 521 | + <?php echo $post['distance']; ?> km |
|
| 522 | + <span class="tiptext"><?php echo $post['location']['name']; ?></span> |
|
| 523 | 523 | </span> |
| 524 | 524 | </td> |
| 525 | 525 | </tr> |
@@ -45,7 +45,8 @@ discard block |
||
| 45 | 45 | if ($result->num_rows > 0) |
| 46 | 46 | { |
| 47 | 47 | // output data of each row |
| 48 | - while($row = $result->fetch_assoc()) { |
|
| 48 | + while($row = $result->fetch_assoc()) |
|
| 49 | + { |
|
| 49 | 50 | //$access_token = $row["access_token"]; |
| 50 | 51 | $expiration_date = $row["expiration_date"]; |
| 51 | 52 | $deviceUid = $row["device_uid"]; |
@@ -57,7 +58,8 @@ discard block |
||
| 57 | 58 | echo '0 results'; |
| 58 | 59 | } |
| 59 | 60 | |
| 60 | - if($expiration_date <= time()) { |
|
| 61 | + if($expiration_date <= time()) |
|
| 62 | + { |
|
| 61 | 63 | $accountCreator = new CreateUser(); |
| 62 | 64 | $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
| 63 | 65 | $accountCreator->setDeviceUid($deviceUid); |
@@ -74,7 +76,8 @@ discard block |
||
| 74 | 76 | expiration_date='" . $expiration_date . "' |
| 75 | 77 | WHERE device_uid='" . $device_uid . "'"); |
| 76 | 78 | |
| 77 | - if($result === false){ |
|
| 79 | + if($result === false) |
|
| 80 | + { |
|
| 78 | 81 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 79 | 82 | } |
| 80 | 83 | } |
@@ -90,7 +93,8 @@ discard block |
||
| 90 | 93 | if ($result->num_rows > 0) |
| 91 | 94 | { |
| 92 | 95 | // output data of each row |
| 93 | - while($row = $result->fetch_assoc()) { |
|
| 96 | + while($row = $result->fetch_assoc()) |
|
| 97 | + { |
|
| 94 | 98 | //$access_token = $row["access_token"]; |
| 95 | 99 | $expiration_date = $row["expiration_date"]; |
| 96 | 100 | $deviceUid = $row["device_uid"]; |
@@ -102,7 +106,8 @@ discard block |
||
| 102 | 106 | echo '0 results'; |
| 103 | 107 | } |
| 104 | 108 | |
| 105 | - if($expiration_date <= time()) { |
|
| 109 | + if($expiration_date <= time()) |
|
| 110 | + { |
|
| 106 | 111 | $accountCreator = new CreateUser(); |
| 107 | 112 | $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
| 108 | 113 | $accountCreator->setDeviceUid($deviceUid); |
@@ -119,7 +124,8 @@ discard block |
||
| 119 | 124 | expiration_date='" . $expiration_date . "' |
| 120 | 125 | WHERE device_uid='" . $device_uid . "'"); |
| 121 | 126 | |
| 122 | - if($result === false){ |
|
| 127 | + if($result === false) |
|
| 128 | + { |
|
| 123 | 129 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 124 | 130 | } |
| 125 | 131 | } |
@@ -137,7 +143,8 @@ discard block |
||
| 137 | 143 | if ($result->num_rows > 0) |
| 138 | 144 | { |
| 139 | 145 | // output data of each row |
| 140 | - while($row = $result->fetch_assoc()) { |
|
| 146 | + while($row = $result->fetch_assoc()) |
|
| 147 | + { |
|
| 141 | 148 | //$access_token = $row["access_token"]; |
| 142 | 149 | $expiration_date = $row["expiration_date"]; |
| 143 | 150 | $deviceUid = $row["device_uid"]; |
@@ -149,7 +156,8 @@ discard block |
||
| 149 | 156 | echo '0 results'; |
| 150 | 157 | } |
| 151 | 158 | |
| 152 | - if($expiration_date <= time()) { |
|
| 159 | + if($expiration_date <= time()) |
|
| 160 | + { |
|
| 153 | 161 | $accountCreator = new CreateUser(); |
| 154 | 162 | $accountCreator->setAccessToken($access_token); |
| 155 | 163 | $accountCreator->setDeviceUid($deviceUid); |
@@ -166,7 +174,8 @@ discard block |
||
| 166 | 174 | expiration_date='" . $expiration_date . "' |
| 167 | 175 | WHERE device_uid='" . $device_uid . "'"); |
| 168 | 176 | |
| 169 | - if($result === false){ |
|
| 177 | + if($result === false) |
|
| 178 | + { |
|
| 170 | 179 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 171 | 180 | } |
| 172 | 181 | } |
@@ -280,13 +289,15 @@ discard block |
||
| 280 | 289 | return $data["karma"]; |
| 281 | 290 | } |
| 282 | 291 | |
| 283 | -function addVoteWithPostIdToDeviceUid($postId, $device_uid) { |
|
| 292 | +function addVoteWithPostIdToDeviceUid($postId, $device_uid) |
|
| 293 | +{ |
|
| 284 | 294 | |
| 285 | 295 | $db = new DatabaseConnect(); |
| 286 | 296 | $result = $db->query("INSERT INTO votes (device_uid, postId) |
| 287 | 297 | VALUES ('" . $device_uid . "','" . $postId . "') "); |
| 288 | 298 | |
| 289 | - if($result === false){ |
|
| 299 | + if($result === false) |
|
| 300 | + { |
|
| 290 | 301 | $error = db_error(); |
| 291 | 302 | echo $error; |
| 292 | 303 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
@@ -294,7 +305,8 @@ discard block |
||
| 294 | 305 | |
| 295 | 306 | } |
| 296 | 307 | |
| 297 | -function registerAccount(Location $location) { |
|
| 308 | +function registerAccount(Location $location) |
|
| 309 | +{ |
|
| 298 | 310 | $accountCreator = new CreateUser(); |
| 299 | 311 | $accountCreator->setLocation($location); |
| 300 | 312 | $data = $accountCreator->execute(); |
@@ -319,7 +331,8 @@ discard block |
||
| 319 | 331 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 320 | 332 | |
| 321 | 333 | $success = TRUE; |
| 322 | - if($result === false){ |
|
| 334 | + if($result === false) |
|
| 335 | + { |
|
| 323 | 336 | $error = db_error(); |
| 324 | 337 | echo $error; |
| 325 | 338 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -330,7 +343,7 @@ discard block |
||
| 330 | 343 | } |
| 331 | 344 | |
| 332 | 345 | function getPosts($lastPostId, $accessToken, $url, $version = 'v2') |
| 333 | -{ |
|
| 346 | +{ |
|
| 334 | 347 | $accountCreator = new GetPosts(); |
| 335 | 348 | $accountCreator->setLastPostId($lastPostId); |
| 336 | 349 | $accountCreator->setAccessToken($accessToken); |
@@ -381,7 +394,8 @@ discard block |
||
| 381 | 394 | } |
| 382 | 395 | |
| 383 | 396 | function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE) |
| 384 | -{ //ToDO |
|
| 397 | +{ |
|
| 398 | +//ToDO |
|
| 385 | 399 | //Replace # with link |
| 386 | 400 | //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
| 387 | 401 | |
@@ -431,10 +445,12 @@ discard block |
||
| 431 | 445 | <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;"> |
| 432 | 446 | <content> |
| 433 | 447 | <?php |
| 434 | - if(isset($post["image_url"])) { |
|
| 448 | + if(isset($post["image_url"])) |
|
| 449 | + { |
|
| 435 | 450 | echo '<img src="' . $post["image_url"] . '">'; |
| 436 | 451 | } |
| 437 | - else { |
|
| 452 | + else |
|
| 453 | + { |
|
| 438 | 454 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($post["message"]))); |
| 439 | 455 | } |
| 440 | 456 | ?> |
@@ -442,11 +458,13 @@ discard block |
||
| 442 | 458 | <aside> |
| 443 | 459 | <?php |
| 444 | 460 | if($isDetailedView) |
| 445 | - {?> |
|
| 461 | + { |
|
| 462 | +?> |
|
| 446 | 463 | <a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>"> |
| 447 | 464 | <?php } |
| 448 | - else |
|
| 449 | - {?> |
|
| 465 | +else |
|
| 466 | + { |
|
| 467 | +?> |
|
| 450 | 468 | <a href="index.php?vote=up&postID=<?php echo $post['post_id'];?>"> |
| 451 | 469 | <?php } ?> |
| 452 | 470 | <i class="fa fa-angle-up fa-3x"></i> |
@@ -455,11 +473,13 @@ discard block |
||
| 455 | 473 | <?php echo $post["vote_count"];?><br /> |
| 456 | 474 | <?php |
| 457 | 475 | if($isDetailedView) |
| 458 | - {?> |
|
| 476 | + { |
|
| 477 | +?> |
|
| 459 | 478 | <a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>"> |
| 460 | 479 | <?php } |
| 461 | - else |
|
| 462 | - {?> |
|
| 480 | +else |
|
| 481 | + { |
|
| 482 | +?> |
|
| 463 | 483 | <a href="index.php?vote=down&postID=<?php echo $post['post_id'];?>"> |
| 464 | 484 | <?php } ?> |
| 465 | 485 | <i class="fa fa-angle-down fa-3x"></i> |
@@ -477,13 +497,19 @@ discard block |
||
| 477 | 497 | </span> |
| 478 | 498 | </td> |
| 479 | 499 | <td class="comments"> |
| 480 | - <?php if(!$isDetailedView) {?> |
|
| 500 | + <?php if(!$isDetailedView) |
|
| 501 | +{ |
|
| 502 | +?> |
|
| 481 | 503 | <span data-tooltip="Comments"> |
| 482 | 504 | <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>"> |
| 483 | 505 | <i class="fa fa-commenting-o"></i> |
| 484 | - <?php if(array_key_exists("child_count", $post)) { |
|
| 506 | + <?php if(array_key_exists("child_count", $post)) |
|
| 507 | +{ |
|
| 485 | 508 | echo $post["child_count"]; |
| 486 | - } else echo "0"; |
|
| 509 | + } |
|
| 510 | + else { |
|
| 511 | + echo "0"; |
|
| 512 | + } |
|
| 487 | 513 | ?> |
| 488 | 514 | </a> |
| 489 | 515 | </span> |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | expiration_date='" . $expiration_date . "' |
| 75 | 75 | WHERE device_uid='" . $device_uid . "'"); |
| 76 | 76 | |
| 77 | - if($result === false){ |
|
| 77 | + if($result === FALSE){ |
|
| 78 | 78 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | expiration_date='" . $expiration_date . "' |
| 120 | 120 | WHERE device_uid='" . $device_uid . "'"); |
| 121 | 121 | |
| 122 | - if($result === false){ |
|
| 122 | + if($result === FALSE){ |
|
| 123 | 123 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | expiration_date='" . $expiration_date . "' |
| 167 | 167 | WHERE device_uid='" . $device_uid . "'"); |
| 168 | 168 | |
| 169 | - if($result === false){ |
|
| 169 | + if($result === FALSE){ |
|
| 170 | 170 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $result = $db->query("INSERT INTO votes (device_uid, postId) |
| 287 | 287 | VALUES ('" . $device_uid . "','" . $postId . "') "); |
| 288 | 288 | |
| 289 | - if($result === false){ |
|
| 289 | + if($result === FALSE){ |
|
| 290 | 290 | $error = db_error(); |
| 291 | 291 | echo $error; |
| 292 | 292 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 320 | 320 | |
| 321 | 321 | $success = TRUE; |
| 322 | - if($result === false){ |
|
| 322 | + if($result === FALSE){ |
|
| 323 | 323 | $error = db_error(); |
| 324 | 324 | echo $error; |
| 325 | 325 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | { |
| 366 | 366 | preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
| 367 | 367 | |
| 368 | - return (isset($matches[0])) ? true : false; |
|
| 368 | + return (isset($matches[0])) ? TRUE : FALSE; |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | function botDeviceUidIsSet($config) |
@@ -47,6 +47,6 @@ |
||
| 47 | 47 | |
| 48 | 48 | if(!$db->query($query) || !$db->query($query2)) |
| 49 | 49 | { |
| 50 | - throw new Exception($db->error($mysqli)); |
|
| 50 | + throw new Exception($db->error($mysqli)); |
|
| 51 | 51 | } |
| 52 | 52 | |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | if(!isset($_COOKIE['JodelDeviceId']) || !isDeviceUidInDatabase($db->real_escape_string($_COOKIE['JodelDeviceId']))) |
| 41 | 41 | { |
| 42 | 42 | $deviceUid = createAccount(); |
| 43 | - setcookie('JodelDeviceId', $deviceUid, time()+60*60*24*365*10); |
|
| 44 | - error_log('Created account with JodelDeviceId:' . $deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
|
| 43 | + setcookie('JodelDeviceId', $deviceUid, time() + 60 * 60 * 24 * 365 * 10); |
|
| 44 | + error_log('Created account with JodelDeviceId:' . $deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
|
| 45 | 45 | |
| 46 | 46 | } |
| 47 | 47 | else |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | //Set View |
| 63 | 63 | if(isset($_GET['view'])) |
| 64 | 64 | { |
| 65 | - switch ($_GET['view']) { |
|
| 65 | + switch($_GET['view']) { |
|
| 66 | 66 | case 'comment': |
| 67 | 67 | $view = 'comment'; |
| 68 | 68 | break; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | else |
| 121 | 121 | { |
| 122 | 122 | $newPositionStatus = $name; |
| 123 | - error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 123 | + error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | if(isset($_POST['color'])) |
| 168 | 168 | { |
| 169 | 169 | $color = $_POST['color']; |
| 170 | - switch ($color) { |
|
| 170 | + switch($color) { |
|
| 171 | 171 | case '8ABDB0': |
| 172 | 172 | $color = '8ABDB0'; |
| 173 | 173 | break; |
@@ -353,13 +353,13 @@ discard block |
||
| 353 | 353 | else |
| 354 | 354 | { |
| 355 | 355 | $version = 'v2'; |
| 356 | - if($view=='comment') |
|
| 356 | + if($view == 'comment') |
|
| 357 | 357 | { |
| 358 | 358 | $url = "/v2/posts/location/discussed/"; |
| 359 | 359 | } |
| 360 | 360 | else |
| 361 | 361 | { |
| 362 | - if($view=='upVote') |
|
| 362 | + if($view == 'upVote') |
|
| 363 | 363 | { |
| 364 | 364 | $url = "/v2/posts/location/popular/"; |
| 365 | 365 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | |
| 386 | - for($i = 0; $i<$loops; $i++) |
|
| 386 | + for($i = 0; $i < $loops; $i++) |
|
| 387 | 387 | { |
| 388 | 388 | if(array_key_exists($i, $posts) && array_key_exists('post_id', $posts[$i]) && isset($posts[$i]['post_id'])) |
| 389 | 389 | { |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
| 428 | 428 | <h2>Comment on Jodel</h2> |
| 429 | 429 | <form method="POST"> |
| 430 | - <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
|
| 430 | + <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" /> |
|
| 431 | 431 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
| 432 | 432 | <br /> |
| 433 | 433 | <input type="submit" value="SEND" /> |
@@ -464,13 +464,13 @@ discard block |
||
| 464 | 464 | <div class="col-xs-12"> |
| 465 | 465 | <div class="row"> |
| 466 | 466 | <div class="col-xs-3"> |
| 467 | - <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 467 | + <a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 468 | 468 | </div> |
| 469 | 469 | <div class="col-xs-3"> |
| 470 | - <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 470 | + <a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 471 | 471 | </div> |
| 472 | 472 | <div class="col-xs-3"> |
| 473 | - <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 473 | + <a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 474 | 474 | </div> |
| 475 | 475 | <div class="col-xs-3"> |
| 476 | 476 | <nav> |