/profile $twtsURL = $_GET['twts']; if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) { die('Not a valid URL'); } $parsedTwtxtFile = getTwtsFromTwtxtString($twtsURL); if (!is_null($parsedTwtxtFile)) { $parsedTwtxtFiles[$parsedTwtxtFile->mainURL] = $parsedTwtxtFile; } } else { // Show timeline for the URL --> / (home) $parsedTwtxtFiles = []; foreach ($fileLines as $currentLine) { if (str_starts_with($currentLine, '#')) { if (!is_null(getDoubleParameter('follow', $currentLine))) { $follow = getDoubleParameter('follow', $currentLine); $twtFollowingList[] = $follow; // Read the parsed files if in Cache $followURL = $follow[1]; $parsedTwtxtFile = getTwtsFromTwtxtString($followURL); if (!is_null($parsedTwtxtFile)) { $parsedTwtxtFiles[$parsedTwtxtFile->mainURL] = $parsedTwtxtFile; } } } } } $twts = []; # Combine all the followers twts foreach ($parsedTwtxtFiles as $currentTwtFile) { if (!is_null($currentTwtFile)) { $twts += $currentTwtFile->twts; } } # Show individual posts if (!empty($_GET['hash'])) { $hash = $_GET['hash']; $twts = array_filter($twts, function($twt) use ($hash) { return $twt->hash === $hash || $twt->replyToHash === $hash; }); } krsort($twts, SORT_NUMERIC); if (!empty($_GET['hash'])) { $twts = array_reverse($twts, true); } $page = 1; if (!empty($_GET['page'])) { $page = intval($_GET['page']); } $startingTwt = (($page - 1) * TWTS_PER_PAGE); $twts = array_slice($twts, $startingTwt, TWTS_PER_PAGE);