diff --git a/partials/base.php b/partials/base.php index bc3b6fe..e900007 100644 --- a/partials/base.php +++ b/partials/base.php @@ -1,77 +1,43 @@ mainURL] = $parsedTwtxtFile; - } + $parsedTwtxtFile = getTwtsFromTwtxtString($twtsURL); + if (!is_null($parsedTwtxtFile)) { + $parsedTwtxtFiles[$parsedTwtxtFile->mainURL] = $parsedTwtxtFile; + } } else { // Show timeline for the URL - $parsedTwtxtFiles = []; - foreach ($fileLines as $currentLine) { - if (str_starts_with($currentLine, '#')) { - if (!is_null(getDoubleParameter('follow', $currentLine))) { - $follow = getDoubleParameter('follow', $currentLine); - $twtFollowingList[] = $follow; + $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; - } - } - } - } + // 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; - } + if (!is_null($currentTwtFile)) { + $twts += $currentTwtFile->twts; + } } if (!empty($_GET['hash'])) { - $hash = $_GET['hash']; - $twts = array_filter($twts, function($twt) use ($hash) { - return $twt->hash === $hash || $twt->replyToHash === $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); + $twts = array_reverse($twts, true); } $page = 1; if (!empty($_GET['page'])) { - $page = intval($_GET['page']); + $page = intval($_GET['page']); } -$startingTwt = (($page - 1) * TWTS_PER_PAGE); -$twts = array_slice($twts, $startingTwt, TWTS_PER_PAGE); +// If we should paginate our twts list +if (!empty($paginateTwts)) { + $startingTwt = (($page - 1) * TWTS_PER_PAGE); + $twts = array_slice($twts, $startingTwt, TWTS_PER_PAGE); +} $baseURL = str_replace("/index.php", "", $_SERVER['SCRIPT_NAME']); diff --git a/partials/profile.php b/partials/profile.php index 4a35c9a..ea5498a 100644 --- a/partials/profile.php +++ b/partials/profile.php @@ -2,35 +2,34 @@ // Get info about profile from URL as an objects if (!empty($_GET['profile'])) { - $url = $twtsURL; + $url = $twtsURL; } + $profile = getTwtsFromTwtxtString($url); - -$profileURL = $baseURL.'/?profile='.$profile->mainURL; - -?> +$profileURL = $baseURL . '/?profile=' . $profile->mainURL; +?>
= $profile->description ?>
+=$profile->description?>
- Posts | + Posts | - Gallery + Gallery - = $profile->mainURL ?> + =$profile->mainURL?> (How to follow) @@ -39,17 +38,3 @@ $profileURL = $baseURL.'/?profile='.$profile->mainURL;= $profile->description ?>
- - twtxt.txt | + twtxt.txt | How to follow @@ -94,7 +94,7 @@ krsort($twts, SORT_NUMERIC); diff --git a/views/add_feed.php b/views/add_feed.php index 8e76f20..c0331ac 100644 --- a/views/add_feed.php +++ b/views/add_feed.php @@ -1,4 +1,5 @@ - Recent twts in reply to #= $id ?> - + Following feeds| Nick | diff --git a/views/gallery.php b/views/gallery.php index fe7ef9d..6958c7c 100644 --- a/views/gallery.php +++ b/views/gallery.php @@ -8,7 +8,7 @@ include_once 'partials/header.php'; -
|---|