mmainstreet /
jodel-web
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | error_reporting(-1); |
||
| 3 | include 'php/jodel-web.php'; |
||
| 4 | |||
| 5 | $config = parse_ini_file('config/config.ini.php'); |
||
| 6 | |||
| 7 | $location = new Location(); |
||
| 8 | $location->setLat($config['default_lat']); |
||
| 9 | $location->setLng($config['default_lng']); |
||
| 10 | $location->setCityName($config['default_location']); |
||
| 11 | |||
| 12 | $accessToken; |
||
| 13 | $accessToken_forId1; |
||
| 14 | $deviceUid; |
||
| 15 | $isSpider = FALSE; |
||
| 16 | |||
| 17 | //What is dude doing with my Server? |
||
| 18 | if($_SERVER['REMOTE_ADDR'] == '94.231.103.52') |
||
| 19 | { |
||
| 20 | echo('You are flooting my Server! Pls enable Cookies in your script and contact me: [email protected]'); |
||
| 21 | die(); |
||
| 22 | } |
||
| 23 | |||
| 24 | //Check if it's a Spider or Google Bot |
||
| 25 | if(botDeviceUidIsSet($config) && isUserBot()) |
||
| 26 | { |
||
| 27 | $isSpider = TRUE; |
||
| 28 | error_log('Spider or Bot checked in!'); |
||
| 29 | |||
| 30 | $deviceUid = $config['botDeviceUid']; |
||
| 31 | $config = NULL; |
||
|
0 ignored issues
–
show
|
|||
| 32 | } |
||
| 33 | else |
||
| 34 | { |
||
| 35 | $config = NULL; |
||
| 36 | if(!isset($_COOKIE['JodelDeviceId']) || !isDeviceUidInDatabase($_COOKIE['JodelDeviceId'])) |
||
| 37 | { |
||
| 38 | $deviceUid = createAccount(); |
||
| 39 | setcookie('JodelDeviceId', $deviceUid, time()+60*60*24*365*10); |
||
| 40 | error_log('Created account with JodelDeviceId:' . $deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
||
| 41 | |||
| 42 | } |
||
| 43 | else |
||
| 44 | { |
||
| 45 | $deviceUid = $_COOKIE['JodelDeviceId']; |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | $location = getLocationByDeviceUid($deviceUid); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 50 | $newPositionStatus = $location->getCityName(); |
||
| 51 | $accessToken = isTokenFreshByDeviceUid($location, $deviceUid); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 52 | //Acc is fresh. token and location is set |
||
| 53 | |||
| 54 | $accessToken_forId1 = isTokenFresh($location); |
||
| 55 | $deviceUid_forId1 = getDeviceUidByAccessToken($accessToken_forId1); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 56 | |||
| 57 | //Set View |
||
| 58 | if(isset($_GET['view'])) |
||
| 59 | { |
||
| 60 | switch ($_GET['view']) { |
||
| 61 | case 'comment': |
||
| 62 | $view = 'comment'; |
||
| 63 | break; |
||
| 64 | |||
| 65 | case 'upVote': |
||
| 66 | $view = 'upVote'; |
||
| 67 | break; |
||
| 68 | |||
| 69 | default: |
||
| 70 | $view = 'time'; |
||
| 71 | break; |
||
| 72 | } |
||
| 73 | } |
||
| 74 | else |
||
| 75 | { |
||
| 76 | $view = 'time'; |
||
| 77 | } |
||
| 78 | |||
| 79 | //Verify Account |
||
| 80 | if(isset($_GET['solution']) && isset($_GET['key'])) |
||
| 81 | { |
||
| 82 | verifyCaptcha($accessToken_forId1); |
||
| 83 | } |
||
| 84 | |||
| 85 | //Set Location |
||
| 86 | if(isset($_GET['city'])) |
||
| 87 | { |
||
| 88 | $newPositionStatus = setLocation($accessToken, $deviceUid); |
||
| 89 | } |
||
| 90 | |||
| 91 | //Vote |
||
| 92 | if(isset($_GET['vote']) && isset($_GET['postID'])) |
||
| 93 | { |
||
| 94 | <<<<<<< HEAD |
||
|
0 ignored issues
–
show
|
|||
| 95 | if(!deviceUidHasVotedThisPostId($deviceUid_forId1, $_GET['postID'])) |
||
| 96 | { |
||
| 97 | if($_GET['vote'] == "up") |
||
| 98 | { |
||
| 99 | $accountCreator = new Upvote(); |
||
| 100 | } |
||
| 101 | else if($_GET['vote'] == "down") |
||
| 102 | { |
||
| 103 | $accountCreator = new Downvote(); |
||
| 104 | } |
||
| 105 | $accountCreator->setAccessToken($accessToken_forId1); |
||
| 106 | $accountCreator->postId = htmlspecialchars($_GET['postID']); |
||
| 107 | $data = $accountCreator->execute(); |
||
| 108 | ======= |
||
| 109 | votePostId($deviceUid_forId1, $accessToken_forId1); |
||
| 110 | } |
||
| 111 | |||
| 112 | //SendJodel |
||
| 113 | if(isset($_POST['message'])) |
||
| 114 | { |
||
| 115 | sendJodel($location, $accessToken_forId1); |
||
| 116 | } |
||
| 117 | >>>>>>> mmainstreet/master |
||
| 118 | |||
| 119 | |||
| 120 | $posts; |
||
| 121 | |||
| 122 | //Get Post Details |
||
| 123 | if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) |
||
| 124 | { |
||
| 125 | $userHandleBuffer = []; |
||
| 126 | |||
| 127 | $accountCreator = new GetPostDetails(); |
||
| 128 | $accountCreator->setAccessToken($accessToken); |
||
| 129 | $data = $accountCreator->execute(); |
||
| 130 | |||
| 131 | $posts[0] = $data; |
||
| 132 | if(array_key_exists('children', $data)) { |
||
| 133 | foreach($data['children'] as $key => $child) |
||
| 134 | { |
||
| 135 | |||
| 136 | if(!$child["parent_creator"] == 1) |
||
| 137 | { |
||
| 138 | $numberForUser = array_search($child['user_handle'], $userHandleBuffer); |
||
| 139 | if($numberForUser === FALSE) |
||
| 140 | { |
||
| 141 | array_push($userHandleBuffer, $child['user_handle']); |
||
| 142 | $data['children'][$key]['user_handle'] = count($userHandleBuffer); |
||
| 143 | } |
||
| 144 | else |
||
| 145 | { |
||
| 146 | $data['children'][$key]['user_handle'] = $numberForUser + 1; |
||
| 147 | } |
||
| 148 | } |
||
| 149 | |||
| 150 | array_push($posts, $data['children'][$key]); |
||
| 151 | } |
||
| 152 | $loops = $data['child_count'] + 1; |
||
| 153 | } |
||
| 154 | else |
||
| 155 | { |
||
| 156 | $loops = 1; |
||
| 157 | } |
||
| 158 | $isDetailedView = TRUE; |
||
| 159 | } |
||
| 160 | //Get Posts |
||
| 161 | else |
||
| 162 | { |
||
| 163 | $version = 'v2'; |
||
| 164 | if($view=='comment') |
||
| 165 | { |
||
| 166 | $url = "/v2/posts/location/discussed/"; |
||
| 167 | } |
||
| 168 | else |
||
| 169 | { |
||
| 170 | if($view=='upVote') |
||
| 171 | { |
||
| 172 | $url = "/v2/posts/location/popular/"; |
||
| 173 | } |
||
| 174 | else |
||
| 175 | { |
||
| 176 | $url = "/v3/posts/location/combo/"; |
||
| 177 | $version = 'v3'; |
||
| 178 | } |
||
| 179 | } |
||
| 180 | |||
| 181 | if($version == 'v3') |
||
| 182 | { |
||
| 183 | $posts = getPosts($lastPostId, $accessToken, $url, $version)['recent']; |
||
| 184 | } |
||
| 185 | else |
||
| 186 | { |
||
| 187 | $posts = getPosts($lastPostId, $accessToken, $url, $version)['posts']; |
||
| 188 | } |
||
| 189 | $loops = 29; |
||
| 190 | $isDetailedView = FALSE; |
||
| 191 | } |
||
| 192 | ?> |
||
| 193 | <!DOCTYPE html> |
||
| 194 | <html lang="en"> |
||
| 195 | <head> |
||
| 196 | <title><?php echo getTitle($posts[0], $view, $isDetailedView);?></title> |
||
| 197 | |||
| 198 | <meta charset="utf-8"> |
||
| 199 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
||
| 200 | <meta http-equiv="x-ua-compatible" content="ie=edge"> |
||
| 201 | |||
| 202 | <meta name="description" content="<?php echo getMetaDescription($posts[0], $view, $isDetailedView);?>"> |
||
| 203 | <meta name="keywords" content="jodelblue, jodel, blue, webclient, web, client, web-app, browser, app"> |
||
| 204 | |||
| 205 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous"> |
||
|
0 ignored issues
–
show
|
|||
| 206 | <link rel="stylesheet" href="css/font-awesome.min.css"> |
||
| 207 | <link rel="stylesheet" href="style.css" type="text/css"> |
||
| 208 | |||
| 209 | <link rel="shortcut icon" type="image/x-icon" href="./img/favicon/favicon.ico"> |
||
| 210 | <link rel="icon" type="image/x-icon" href="./img/favicon/favicon.ico"> |
||
| 211 | <link rel="icon" type="image/gif" href="./img/favicon/favicon.gif"> |
||
| 212 | <link rel="icon" type="image/png" href="./img/favicon/favicon.png"> |
||
| 213 | <link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon.png"> |
||
| 214 | <link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-57x57.png" sizes="57x57"> |
||
| 215 | <link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-60x60.png" sizes="60x60"> |
||
| 216 | <link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-72x72.png" sizes="72x72"> |
||
| 217 | <link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-76x76.png" sizes="76x76"> |
||
| 218 | <link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-114x114.png" sizes="114x114"> |
||
| 219 | <link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-120x120.png" sizes="120x120"> |
||
| 220 | <link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-128x128.png" sizes="128x128"> |
||
| 221 | <link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-144x144.png" sizes="144x144"> |
||
| 222 | <link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-152x152.png" sizes="152x152"> |
||
| 223 | <link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-180x180.png" sizes="180x180"> |
||
| 224 | <link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-precomposed.png"> |
||
| 225 | <link rel="icon" type="image/png" href="./img/favicon/favicon-16x16.png" sizes="16x16"> |
||
| 226 | <link rel="icon" type="image/png" href="./img/favicon/favicon-32x32.png" sizes="32x32"> |
||
| 227 | <link rel="icon" type="image/png" href="./img/favicon/favicon-96x96.png" sizes="96x96"> |
||
| 228 | <link rel="icon" type="image/png" href="./img/favicon/favicon-160x160.png" sizes="160x160"> |
||
| 229 | <link rel="icon" type="image/png" href="./img/favicon/favicon-192x192.png" sizes="192x192"> |
||
| 230 | <link rel="icon" type="image/png" href="./img/favicon/favicon-196x196.png" sizes="196x196"> |
||
| 231 | <meta name="msapplication-TileImage" content="./img/favicon/win8-tile-144x144.png"> |
||
| 232 | <meta name="msapplication-TileColor" content="#5682a3"> |
||
| 233 | <meta name="msapplication-navbutton-color" content="#5682a3"> |
||
| 234 | <meta name="application-name" content="JodelBlue"/> |
||
| 235 | <meta name="msapplication-tooltip" content="JodelBlue"/> |
||
| 236 | <meta name="apple-mobile-web-app-title" content="JodelBlue"/> |
||
| 237 | <meta name="msapplication-square70x70logo" content="./img/favicon/win8-tile-70x70.png"> |
||
| 238 | <meta name="msapplication-square144x144logo" content="./img/favicon/win8-tile-144x144.png"> |
||
| 239 | <meta name="msapplication-square150x150logo" content="./img/favicon/win8-tile-150x150.png"> |
||
| 240 | <meta name="msapplication-wide310x150logo" content="./img/favicon/win8-tile-310x150.png"> |
||
| 241 | <meta name="msapplication-square310x310logo" content="./img/favicon/win8-tile-310x310.png"> |
||
| 242 | </head> |
||
| 243 | |||
| 244 | <body> |
||
| 245 | <header> |
||
| 246 | <nav class="navbar navbar-full navbar-dark navbar-fixed-top"> |
||
| 247 | <div class="container"> |
||
| 248 | <?php |
||
| 249 | if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) |
||
| 250 | { |
||
| 251 | echo '<a id="comment-back" href="index.php?view=' . $view . '#postId-' . htmlspecialchars($_GET['postID']) . '">'; |
||
|
0 ignored issues
–
show
|
|||
| 252 | echo '<i class="fa fa-angle-left fa-3x"></i>'; |
||
| 253 | echo '</a>'; |
||
| 254 | echo '<h1>'; |
||
| 255 | echo '<a href="index.php?getPostDetails=' . htmlspecialchars($_GET['getPostDetails']) . '&postID=' . htmlspecialchars($_GET['postID']) . '" class="spinnable">'; |
||
|
0 ignored issues
–
show
|
|||
| 256 | } |
||
| 257 | else |
||
| 258 | { |
||
| 259 | echo '<h1>'; |
||
| 260 | echo '<a href="./" class="spinnable">'; |
||
| 261 | } |
||
| 262 | ?> |
||
| 263 | JodelBlue <i class="fa fa-refresh fa-1x"></i></a> |
||
| 264 | </h1> |
||
| 265 | |||
| 266 | <div id="location_mobile" class="hidden-sm-up"> |
||
| 267 | <form method="get"> |
||
| 268 | <input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
||
|
0 ignored issues
–
show
|
|||
| 269 | |||
| 270 | <input type="submit" id="submit_mobile" class="fa" value="" /> |
||
| 271 | </form> |
||
| 272 | </div> |
||
| 273 | </div> |
||
| 274 | </nav> |
||
| 275 | </header> |
||
| 276 | |||
| 277 | <div class="mainContent container"> |
||
| 278 | <div class="content row"> |
||
| 279 | <article class="topContent col-sm-8"> |
||
| 280 | |||
| 281 | <content id="posts"> |
||
| 282 | <?php |
||
| 283 | for($i = 0; $i<$loops; $i++) |
||
| 284 | { |
||
| 285 | if(array_key_exists($i, $posts) && array_key_exists('post_id', $posts[$i]) && isset($posts[$i]['post_id'])) |
||
| 286 | { |
||
| 287 | $lastPostId = $posts[$i]['post_id']; |
||
| 288 | |||
| 289 | jodelToHtml($posts[$i], $view, $isDetailedView); |
||
| 290 | } |
||
| 291 | } ?> |
||
| 292 | |||
| 293 | </content> |
||
| 294 | |||
| 295 | <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
||
| 296 | <p id="loading"> |
||
| 297 | Loading… |
||
| 298 | </p> |
||
| 299 | <?php } ?> |
||
| 300 | </article> |
||
| 301 | |||
| 302 | <aside class="topSidebar col-sm-4 sidebar-outer"> |
||
| 303 | <div class="fixed"> |
||
| 304 | <article> |
||
| 305 | <div> |
||
| 306 | <h2>Position</h2> |
||
| 307 | <form method="get"> |
||
| 308 | <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
||
|
0 ignored issues
–
show
|
|||
| 309 | |||
| 310 | <input type="submit" value="Set Location" /> |
||
| 311 | </form> |
||
| 312 | </div> |
||
| 313 | </article> |
||
| 314 | |||
| 315 | <article> |
||
| 316 | <div> |
||
| 317 | <h2>Karma</h2> |
||
| 318 | <?php echo getKarma($accessToken_forId1); ?> |
||
| 319 | </div> |
||
| 320 | </article> |
||
| 321 | |||
| 322 | <article> |
||
| 323 | <div> |
||
| 324 | <?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?> |
||
| 325 | <h2>Comment on Jodel</h2> |
||
| 326 | <form method="POST"> |
||
| 327 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" /> |
||
| 328 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
||
|
0 ignored issues
–
show
|
|||
| 329 | <br /> |
||
| 330 | <input type="submit" value="SEND" /> |
||
| 331 | </form> |
||
| 332 | <?php } else { ?> |
||
| 333 | <h2>New Jodel</h2> |
||
| 334 | <form method="POST"> |
||
| 335 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
||
|
0 ignored issues
–
show
|
|||
| 336 | <br /> |
||
| 337 | <select id="postColorPicker" name="color"> |
||
| 338 | <option value="06A3CB">Blue</option> |
||
| 339 | <option value="8ABDB0">Teal</option> |
||
| 340 | <option value="9EC41C">Green</option> |
||
| 341 | <option value="FFBA00">Yellow</option> |
||
| 342 | <option value="DD5F5F">Red</option> |
||
| 343 | <option value="FF9908">Orange</option> |
||
| 344 | </select> |
||
| 345 | <br /> |
||
| 346 | <input type="submit" value="SEND" /> |
||
| 347 | </form> |
||
| 348 | <?php } ?> |
||
| 349 | </div> |
||
| 350 | </article> |
||
| 351 | |||
| 352 | <article> |
||
| 353 | <div> |
||
| 354 | <h2>Login</h2> |
||
| 355 | </div> |
||
| 356 | </article> |
||
| 357 | </div> |
||
| 358 | </aside> |
||
| 359 | </div> |
||
| 360 | <div id="sortJodelBy" class="row"> |
||
| 361 | <div class="col-xs-12"> |
||
| 362 | <div class="row"> |
||
| 363 | <div class="col-xs-3"> |
||
| 364 | <a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
||
| 365 | </div> |
||
| 366 | <div class="col-xs-3"> |
||
| 367 | <a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
||
|
0 ignored issues
–
show
|
|||
| 368 | </div> |
||
| 369 | <div class="col-xs-3"> |
||
| 370 | <a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
||
|
0 ignored issues
–
show
|
|||
| 371 | </div> |
||
| 372 | <div class="col-xs-3"> |
||
| 373 | <nav> |
||
| 374 | <a href="./about-us.html">about us</a> |
||
| 375 | </nav> |
||
| 376 | </div> |
||
| 377 | </div> |
||
| 378 | </div> |
||
| 379 | </div> |
||
| 380 | </div> |
||
| 381 | |||
| 382 | |||
| 383 | <!-- jQuery, Tether, Bootstrap JS and own--> |
||
| 384 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha384-3ceskX3iaEnIogmQchP8opvBy3Mi7Ce34nWjpBIwVTHfGYWQS9jwHDVRnpKKHJg7" crossorigin="anonymous"></script> |
||
|
0 ignored issues
–
show
|
|||
| 385 | <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.7/js/tether.min.js" integrity="sha384-XTs3FgkjiBgo8qjEjBk0tGmf3wPrWtA6coPfQDfFEY8AnYJwjalXCiosYRBIBZX8" crossorigin="anonymous"></script> |
||
|
0 ignored issues
–
show
|
|||
| 386 | <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/js/bootstrap.min.js" integrity="sha384-BLiI7JTZm+JWlgKa0M0kGRpJbF2J8q+qreVrKBC47e3K6BW78kGLrCkeRX6I9RoK" crossorigin="anonymous"></script> |
||
|
0 ignored issues
–
show
|
|||
| 387 | <script src="js/jQueryEmoji.js"></script> |
||
| 388 | |||
| 389 | <script> |
||
| 390 | //BackButton |
||
| 391 | function goBack() |
||
| 392 | { |
||
| 393 | window.history.back(); |
||
| 394 | } |
||
| 395 | |||
| 396 | $(document).ready(function() |
||
| 397 | { |
||
| 398 | //Transform UTF-8 Emoji to img |
||
| 399 | $('.jodel > content').Emoji(); |
||
| 400 | |||
| 401 | $('a').on('click', function(){ |
||
| 402 | $('a').removeClass('selected'); |
||
| 403 | $(this).addClass('selected'); |
||
| 404 | }); |
||
| 405 | |||
| 406 | function scrollToAnchor(aid){ |
||
| 407 | var aTag = $("article[id='"+ aid +"']"); |
||
| 408 | $('html,body').animate({scrollTop: aTag.offset().top-90},'slow'); |
||
| 409 | } |
||
| 410 | |||
| 411 | <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?> |
||
| 412 | |||
| 413 | |||
| 414 | |||
| 415 | |||
| 416 | |||
| 417 | var win = $(window); |
||
| 418 | var lastPostId = "<?php echo $lastPostId; ?>"; |
||
| 419 | var view = "<?php echo $view; ?>" |
||
| 420 | var old_lastPostId = ""; |
||
| 421 | var morePostsAvailable = true; |
||
| 422 | |||
| 423 | if(window.location.hash) |
||
| 424 | { |
||
| 425 | var hash = window.location.hash.slice(1); |
||
| 426 | |||
| 427 | if(!$("article[id='"+ hash +"']").length) |
||
| 428 | { |
||
| 429 | for (var i = 5; i >= 0; i--) |
||
| 430 | { |
||
| 431 | if(!$("article[id='"+ hash +"']").length) |
||
| 432 | { |
||
| 433 | $.ajax({ |
||
| 434 | url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view, |
||
| 435 | dataType: 'html', |
||
| 436 | async: false, |
||
| 437 | success: function(html) { |
||
| 438 | var div = document.createElement('div'); |
||
| 439 | div.innerHTML = html; |
||
| 440 | var elements = div.childNodes; |
||
| 441 | old_lastPostId = lastPostId; |
||
| 442 | lastPostId = elements[3].textContent; |
||
| 443 | lastPostId = lastPostId.replace(/\s+/g, ''); |
||
| 444 | //alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId); |
||
| 445 | if(lastPostId == old_lastPostId) { |
||
| 446 | |||
| 447 | //morePostsAvailable = false; |
||
| 448 | } |
||
| 449 | else { |
||
| 450 | //alert(elements[3].textContent); |
||
| 451 | $('#posts').append(elements[1].innerHTML); |
||
| 452 | $('#posts').hide().show(0); |
||
| 453 | } |
||
| 454 | $('#loading').hide(); |
||
| 455 | } |
||
| 456 | }); |
||
| 457 | |||
| 458 | $('.jodel > content').Emoji(); |
||
| 459 | } |
||
| 460 | |||
| 461 | } |
||
| 462 | scrollToAnchor(hash); |
||
| 463 | |||
| 464 | } |
||
| 465 | } |
||
| 466 | |||
| 467 | // Each time the user scrolls |
||
| 468 | win.scroll(function() { |
||
| 469 | |||
| 470 | |||
| 471 | // End of the document reached? |
||
| 472 | if ($(window).scrollTop() + $(window).height() > $(document).height() - 100 && morePostsAvailable) |
||
| 473 | { |
||
| 474 | $('#loading').show(); |
||
| 475 | |||
| 476 | $.ajax({ |
||
| 477 | url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view, |
||
| 478 | dataType: 'html', |
||
| 479 | async: false, |
||
| 480 | success: function(html) { |
||
| 481 | var div = document.createElement('div'); |
||
| 482 | div.innerHTML = html; |
||
| 483 | var elements = div.childNodes; |
||
| 484 | old_lastPostId = lastPostId; |
||
| 485 | lastPostId = elements[3].textContent; |
||
| 486 | lastPostId = lastPostId.replace(/\s+/g, ''); |
||
| 487 | //alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId); |
||
| 488 | if(lastPostId == old_lastPostId) |
||
| 489 | { |
||
| 490 | |||
| 491 | //morePostsAvailable = false; |
||
| 492 | } |
||
| 493 | else |
||
| 494 | { |
||
| 495 | //alert(elements[3].textContent); |
||
| 496 | $('#posts').append(elements[1].innerHTML); |
||
| 497 | } |
||
| 498 | $('#loading').hide(); |
||
| 499 | } |
||
| 500 | }); |
||
| 501 | |||
| 502 | $('.jodel > content').Emoji(); |
||
| 503 | } |
||
| 504 | }); |
||
| 505 | <?php } ?> |
||
| 506 | }); |
||
| 507 | |||
| 508 | </script> |
||
| 509 | |||
| 510 | <?php |
||
| 511 | if(is_file('./piwik-script.html')) |
||
| 512 | { |
||
| 513 | require_once('./piwik-script.html'); |
||
| 514 | } |
||
| 515 | ?> |
||
| 516 | |||
| 517 | </body> |
||
| 518 | </html> |
||
| 519 | |||
| 520 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.