@@ -28,7 +28,8 @@ discard block |
||
| 28 | 28 | if ($result->num_rows > 0) |
| 29 | 29 | { |
| 30 | 30 | // output data of each row |
| 31 | - while($row = $result->fetch_assoc()) { |
|
| 31 | + while($row = $result->fetch_assoc()) |
|
| 32 | + { |
|
| 32 | 33 | //$access_token = $row["access_token"]; |
| 33 | 34 | $expiration_date = $row["expiration_date"]; |
| 34 | 35 | $deviceUid = $row["device_uid"]; |
@@ -40,7 +41,8 @@ discard block |
||
| 40 | 41 | echo '0 results'; |
| 41 | 42 | } |
| 42 | 43 | |
| 43 | - if($expiration_date <= time()) { |
|
| 44 | + if($expiration_date <= time()) |
|
| 45 | + { |
|
| 44 | 46 | $accountCreator = new CreateUser(); |
| 45 | 47 | $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
| 46 | 48 | $accountCreator->setDeviceUid($deviceUid); |
@@ -57,7 +59,8 @@ discard block |
||
| 57 | 59 | expiration_date='" . $expiration_date . "' |
| 58 | 60 | WHERE device_uid='" . $device_uid . "'"); |
| 59 | 61 | |
| 60 | - if($result === false){ |
|
| 62 | + if($result === false) |
|
| 63 | + { |
|
| 61 | 64 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 62 | 65 | } |
| 63 | 66 | } |
@@ -73,7 +76,8 @@ discard block |
||
| 73 | 76 | if ($result->num_rows > 0) |
| 74 | 77 | { |
| 75 | 78 | // output data of each row |
| 76 | - while($row = $result->fetch_assoc()) { |
|
| 79 | + while($row = $result->fetch_assoc()) |
|
| 80 | + { |
|
| 77 | 81 | //$access_token = $row["access_token"]; |
| 78 | 82 | $expiration_date = $row["expiration_date"]; |
| 79 | 83 | $deviceUid = $row["device_uid"]; |
@@ -85,7 +89,8 @@ discard block |
||
| 85 | 89 | echo '0 results'; |
| 86 | 90 | } |
| 87 | 91 | |
| 88 | - if($expiration_date <= time()) { |
|
| 92 | + if($expiration_date <= time()) |
|
| 93 | + { |
|
| 89 | 94 | $accountCreator = new CreateUser(); |
| 90 | 95 | $accountCreator->setAccessToken($access_token);//$accountData->getAccessToken()); |
| 91 | 96 | $accountCreator->setDeviceUid($deviceUid); |
@@ -102,7 +107,8 @@ discard block |
||
| 102 | 107 | expiration_date='" . $expiration_date . "' |
| 103 | 108 | WHERE device_uid='" . $device_uid . "'"); |
| 104 | 109 | |
| 105 | - if($result === false){ |
|
| 110 | + if($result === false) |
|
| 111 | + { |
|
| 106 | 112 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 107 | 113 | } |
| 108 | 114 | } |
@@ -120,7 +126,8 @@ discard block |
||
| 120 | 126 | if ($result->num_rows > 0) |
| 121 | 127 | { |
| 122 | 128 | // output data of each row |
| 123 | - while($row = $result->fetch_assoc()) { |
|
| 129 | + while($row = $result->fetch_assoc()) |
|
| 130 | + { |
|
| 124 | 131 | //$access_token = $row["access_token"]; |
| 125 | 132 | $expiration_date = $row["expiration_date"]; |
| 126 | 133 | $deviceUid = $row["device_uid"]; |
@@ -132,7 +139,8 @@ discard block |
||
| 132 | 139 | echo '0 results'; |
| 133 | 140 | } |
| 134 | 141 | |
| 135 | - if($expiration_date <= time()) { |
|
| 142 | + if($expiration_date <= time()) |
|
| 143 | + { |
|
| 136 | 144 | $accountCreator = new CreateUser(); |
| 137 | 145 | $accountCreator->setAccessToken($access_token); |
| 138 | 146 | $accountCreator->setDeviceUid($deviceUid); |
@@ -149,7 +157,8 @@ discard block |
||
| 149 | 157 | expiration_date='" . $expiration_date . "' |
| 150 | 158 | WHERE device_uid='" . $device_uid . "'"); |
| 151 | 159 | |
| 152 | - if($result === false){ |
|
| 160 | + if($result === false) |
|
| 161 | + { |
|
| 153 | 162 | echo "Adding account failed: (" . $db->errno . ") " . $db->error; |
| 154 | 163 | } |
| 155 | 164 | } |
@@ -240,7 +249,8 @@ discard block |
||
| 240 | 249 | return $data["karma"]; |
| 241 | 250 | } |
| 242 | 251 | |
| 243 | -function registerAccount(Location $location) { |
|
| 252 | +function registerAccount(Location $location) |
|
| 253 | +{ |
|
| 244 | 254 | $accountCreator = new CreateUser(); |
| 245 | 255 | $accountCreator->setLocation($location); |
| 246 | 256 | $data = $accountCreator->execute(); |
@@ -265,7 +275,8 @@ discard block |
||
| 265 | 275 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 266 | 276 | |
| 267 | 277 | $success = TRUE; |
| 268 | - if($result === false){ |
|
| 278 | + if($result === false) |
|
| 279 | + { |
|
| 269 | 280 | $error = db_error(); |
| 270 | 281 | echo $error; |
| 271 | 282 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -276,7 +287,7 @@ discard block |
||
| 276 | 287 | } |
| 277 | 288 | |
| 278 | 289 | function getPosts($lastPostId, $accessToken, $url, $version = 'v2') |
| 279 | -{ |
|
| 290 | +{ |
|
| 280 | 291 | $accountCreator = new GetPosts(); |
| 281 | 292 | $accountCreator->setLastPostId($lastPostId); |
| 282 | 293 | $accountCreator->setAccessToken($accessToken); |
@@ -306,7 +317,8 @@ discard block |
||
| 306 | 317 | } |
| 307 | 318 | |
| 308 | 319 | function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE) |
| 309 | -{ //ToDO |
|
| 320 | +{ |
|
| 321 | +//ToDO |
|
| 310 | 322 | //Replace # with link |
| 311 | 323 | //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
| 312 | 324 | |
@@ -356,10 +368,12 @@ discard block |
||
| 356 | 368 | <article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;"> |
| 357 | 369 | <content> |
| 358 | 370 | <?php |
| 359 | - if(isset($post["image_url"])) { |
|
| 371 | + if(isset($post["image_url"])) |
|
| 372 | + { |
|
| 360 | 373 | echo '<img src="' . $post["image_url"] . '">'; |
| 361 | 374 | } |
| 362 | - else { |
|
| 375 | + else |
|
| 376 | + { |
|
| 363 | 377 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($post["message"]))); |
| 364 | 378 | } |
| 365 | 379 | ?> |
@@ -386,13 +400,19 @@ discard block |
||
| 386 | 400 | </span> |
| 387 | 401 | </td> |
| 388 | 402 | <td class="comments"> |
| 389 | - <?php if(!$isDetailedView) {?> |
|
| 403 | + <?php if(!$isDetailedView) |
|
| 404 | +{ |
|
| 405 | +?> |
|
| 390 | 406 | <span data-tooltip="Comments"> |
| 391 | 407 | <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>"> |
| 392 | 408 | <i class="fa fa-commenting-o"></i> |
| 393 | - <?php if(array_key_exists("child_count", $post)) { |
|
| 409 | + <?php if(array_key_exists("child_count", $post)) |
|
| 410 | +{ |
|
| 394 | 411 | echo $post["child_count"]; |
| 395 | - } else echo "0"; |
|
| 412 | + } |
|
| 413 | + else { |
|
| 414 | + echo "0"; |
|
| 415 | + } |
|
| 396 | 416 | ?> |
| 397 | 417 | </a> |
| 398 | 418 | </span> |