@@ -43,7 +43,8 @@ discard block |
||
43 | 43 | if ($result->num_rows > 0) |
44 | 44 | { |
45 | 45 | // output data of each row |
46 | - while($row = $result->fetch_assoc()) { |
|
46 | + while($row = $result->fetch_assoc()) |
|
47 | + { |
|
47 | 48 | //$access_token = $row["access_token"]; |
48 | 49 | $expiration_date = $row["expiration_date"]; |
49 | 50 | $deviceUid = $row["device_uid"]; |
@@ -55,7 +56,8 @@ discard block |
||
55 | 56 | echo '0 results'; |
56 | 57 | } |
57 | 58 | |
58 | - if($expiration_date <= time()) { |
|
59 | + if($expiration_date <= time()) |
|
60 | + { |
|
59 | 61 | $accountCreator = new CreateUser(); |
60 | 62 | $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
61 | 63 | $accountCreator->setDeviceUid($deviceUid); |
@@ -72,7 +74,8 @@ discard block |
||
72 | 74 | expiration_date='" . $expiration_date . "' |
73 | 75 | WHERE device_uid='" . $device_uid . "'"); |
74 | 76 | |
75 | - if($result === false){ |
|
77 | + if($result === false) |
|
78 | + { |
|
76 | 79 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
77 | 80 | } |
78 | 81 | } |
@@ -88,7 +91,8 @@ discard block |
||
88 | 91 | if ($result->num_rows > 0) |
89 | 92 | { |
90 | 93 | // output data of each row |
91 | - while($row = $result->fetch_assoc()) { |
|
94 | + while($row = $result->fetch_assoc()) |
|
95 | + { |
|
92 | 96 | //$access_token = $row["access_token"]; |
93 | 97 | $expiration_date = $row["expiration_date"]; |
94 | 98 | $deviceUid = $row["device_uid"]; |
@@ -100,7 +104,8 @@ discard block |
||
100 | 104 | echo '0 results'; |
101 | 105 | } |
102 | 106 | |
103 | - if($expiration_date <= time()) { |
|
107 | + if($expiration_date <= time()) |
|
108 | + { |
|
104 | 109 | $accountCreator = new CreateUser(); |
105 | 110 | $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
106 | 111 | $accountCreator->setDeviceUid($deviceUid); |
@@ -117,7 +122,8 @@ discard block |
||
117 | 122 | expiration_date='" . $expiration_date . "' |
118 | 123 | WHERE device_uid='" . $device_uid . "'"); |
119 | 124 | |
120 | - if($result === false){ |
|
125 | + if($result === false) |
|
126 | + { |
|
121 | 127 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
122 | 128 | } |
123 | 129 | } |
@@ -135,7 +141,8 @@ discard block |
||
135 | 141 | if ($result->num_rows > 0) |
136 | 142 | { |
137 | 143 | // output data of each row |
138 | - while($row = $result->fetch_assoc()) { |
|
144 | + while($row = $result->fetch_assoc()) |
|
145 | + { |
|
139 | 146 | //$access_token = $row["access_token"]; |
140 | 147 | $expiration_date = $row["expiration_date"]; |
141 | 148 | $deviceUid = $row["device_uid"]; |
@@ -147,7 +154,8 @@ discard block |
||
147 | 154 | echo '0 results'; |
148 | 155 | } |
149 | 156 | |
150 | - if($expiration_date <= time()) { |
|
157 | + if($expiration_date <= time()) |
|
158 | + { |
|
151 | 159 | $accountCreator = new CreateUser(); |
152 | 160 | $accountCreator->setAccessToken($access_token); |
153 | 161 | $accountCreator->setDeviceUid($deviceUid); |
@@ -164,7 +172,8 @@ discard block |
||
164 | 172 | expiration_date='" . $expiration_date . "' |
165 | 173 | WHERE device_uid='" . $device_uid . "'"); |
166 | 174 | |
167 | - if($result === false){ |
|
175 | + if($result === false) |
|
176 | + { |
|
168 | 177 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
169 | 178 | } |
170 | 179 | } |
@@ -313,7 +322,8 @@ discard block |
||
313 | 322 | $result = $db->query("INSERT INTO votes (device_uid, postId) |
314 | 323 | VALUES ('" . $device_uid . "','" . $postId . "') "); |
315 | 324 | |
316 | - if($result === false){ |
|
325 | + if($result === false) |
|
326 | + { |
|
317 | 327 | $error = db_error(); |
318 | 328 | echo $error; |
319 | 329 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
@@ -321,7 +331,8 @@ discard block |
||
321 | 331 | |
322 | 332 | } |
323 | 333 | |
324 | -function registerAccount(Location $location) { |
|
334 | +function registerAccount(Location $location) |
|
335 | +{ |
|
325 | 336 | $accountCreator = new CreateUser(); |
326 | 337 | $accountCreator->setLocation($location); |
327 | 338 | $data = $accountCreator->execute(); |
@@ -346,7 +357,8 @@ discard block |
||
346 | 357 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
347 | 358 | |
348 | 359 | $success = TRUE; |
349 | - if($result === false){ |
|
360 | + if($result === false) |
|
361 | + { |
|
350 | 362 | $error = db_error(); |
351 | 363 | echo $error; |
352 | 364 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -357,7 +369,7 @@ discard block |
||
357 | 369 | } |
358 | 370 | |
359 | 371 | function getPosts($lastPostId, $accessToken, $url, $version = 'v2') |
360 | -{ |
|
372 | +{ |
|
361 | 373 | $accountCreator = new GetPosts(); |
362 | 374 | $accountCreator->setLastPostId($lastPostId); |
363 | 375 | $accountCreator->setAccessToken($accessToken); |
@@ -408,7 +420,8 @@ discard block |
||
408 | 420 | } |
409 | 421 | |
410 | 422 | function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE) |
411 | -{ //ToDO |
|
423 | +{ |
|
424 | +//ToDO |
|
412 | 425 | //Replace # with link |
413 | 426 | //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
414 | 427 | |
@@ -458,10 +471,12 @@ discard block |
||
458 | 471 | <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;"> |
459 | 472 | <content> |
460 | 473 | <?php |
461 | - if(isset($post["image_url"])) { |
|
474 | + if(isset($post["image_url"])) |
|
475 | + { |
|
462 | 476 | echo '<img src="' . $post["image_url"] . '">'; |
463 | 477 | } |
464 | - else { |
|
478 | + else |
|
479 | + { |
|
465 | 480 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($post["message"]))); |
466 | 481 | } |
467 | 482 | ?> |
@@ -469,11 +484,13 @@ discard block |
||
469 | 484 | <aside> |
470 | 485 | <?php |
471 | 486 | if($isDetailedView) |
472 | - {?> |
|
487 | + { |
|
488 | +?> |
|
473 | 489 | <a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>"> |
474 | 490 | <?php } |
475 | - else |
|
476 | - {?> |
|
491 | +else |
|
492 | + { |
|
493 | +?> |
|
477 | 494 | <a href="index.php?vote=up&postID=<?php echo $post['post_id'];?>"> |
478 | 495 | <?php } ?> |
479 | 496 | <i class="fa fa-angle-up fa-3x"></i> |
@@ -482,11 +499,13 @@ discard block |
||
482 | 499 | <?php echo $post["vote_count"];?><br /> |
483 | 500 | <?php |
484 | 501 | if($isDetailedView) |
485 | - {?> |
|
502 | + { |
|
503 | +?> |
|
486 | 504 | <a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>"> |
487 | 505 | <?php } |
488 | - else |
|
489 | - {?> |
|
506 | +else |
|
507 | + { |
|
508 | +?> |
|
490 | 509 | <a href="index.php?vote=down&postID=<?php echo $post['post_id'];?>"> |
491 | 510 | <?php } ?> |
492 | 511 | <i class="fa fa-angle-down fa-3x"></i> |
@@ -504,13 +523,19 @@ discard block |
||
504 | 523 | </span> |
505 | 524 | </td> |
506 | 525 | <td class="comments"> |
507 | - <?php if(!$isDetailedView) {?> |
|
526 | + <?php if(!$isDetailedView) |
|
527 | +{ |
|
528 | +?> |
|
508 | 529 | <span data-tooltip="Comments"> |
509 | 530 | <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>"> |
510 | 531 | <i class="fa fa-commenting-o"></i> |
511 | - <?php if(array_key_exists("child_count", $post)) { |
|
532 | + <?php if(array_key_exists("child_count", $post)) |
|
533 | +{ |
|
512 | 534 | echo $post["child_count"]; |
513 | - } else echo "0"; |
|
535 | + } |
|
536 | + else { |
|
537 | + echo "0"; |
|
538 | + } |
|
514 | 539 | ?> |
515 | 540 | </a> |
516 | 541 | </span> |