Merge pull request #26 from eapl-gemugami/23-commented-line-maybe-causing-issue-after-a-refresh

fix(refresh): uncomment ob_start and fix style in refresh.php
This commit is contained in:
sørenpeter 2024-12-13 15:50:49 +01:00 committed by GitHub
commit 67dae996c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,38 +1,32 @@
<?php <?php
require_once "partials/base.php";
require_once("partials/base.php");
if (!isset($_SESSION['password'])) { if (!isset($_SESSION['password'])) {
header('Location: ./login'); header('Location: ./login');
exit(); exit();
} }
//ob_start(); ob_start();
$title = "Refresh - ".$title; $title = "Refresh - $title";
ob_end_flush(); ob_end_flush();
include 'partials/header.php'; include 'partials/header.php';
?> ?>
<p id="refreshLabel"> <p id="refreshLabel">
<strong id="refreshInfo">Loading feeds followed by:</strong> <strong id="refreshInfo">Loading feeds followed by:</strong>
<span id="refreshURL"><?= preg_replace('(^https?://)', '', $url) ?></span> <span id="refreshURL"><?= preg_replace('(^https?://)', '', $url) ?></span>
<span id="refreshCounter"></span> <span id="refreshCounter"></span>
</p> </p>
<progress id="refreshProgress" value=""></progress> <progress id="refreshProgress" value=""></progress>
<?php <?php
include 'partials/footer.php'; include 'partials/footer.php';
ob_start(); ob_start();
flush(); flush();
// Get URL from query // Get URL from query
$url = $config['public_txt_url']; $url = $config['public_txt_url'];
if (!empty($_GET['url'])) { if (!empty($_GET['url'])) {
@ -56,8 +50,7 @@ foreach ($fileLines as $currentLine) {
// Loop over feeds followed // Loop over feeds followed
/* Progress bar based on: https://github.com/w3shaman/php-progress-bar */ // Progress bar based on: https://github.com/w3shaman/php-progress-bar
$i = 1; $i = 1;
$total = count($twtFollowingList); $total = count($twtFollowingList);
@ -65,20 +58,20 @@ echo '<script language="javascript">document.getElementById("refreshInfo").inner
foreach ($twtFollowingList as $following) { foreach ($twtFollowingList as $following) {
//ob_start(); //ob_start();
$float = $i/$total; $float = $i / $total;
$percent = intval($float * 100)."%"; $percent = intval($float * 100) . "%";
$feed = $following[1]; $feed = $following[1];
//$feed = preg_replace('(^https?://)', '', $feed); //$feed = preg_replace('(^https?://)', '', $feed);
//$feed = $following[0].'@'. parse_url($following[1], PHP_URL_HOST); //$feed = $following[0].'@'. parse_url($following[1], PHP_URL_HOST);
$feed = $following[0].' ('.$following[1].')'; $feed = "{$following[0]} ({$following[1]})";
// Javascript for updating the progress bar and information // Javascript for updating the progress bar and information
echo '<script language="javascript"> echo "<script language=\"javascript\">
document.getElementById("refreshURL").innerHTML = "'.$feed.'"; document.getElementById(\"refreshURL\").innerHTML = \"$feed\";
document.getElementById("refreshCounter").innerHTML = "('.$i.' of '.$total.')"; document.getElementById(\"refreshCounter\").innerHTML = \"($i of $total.')\";
document.getElementById("refreshProgress").value = "'.$float.'"; document.getElementById(\"refreshProgress\").value = \"$float\";
document.getElementById("refreshProgress").innerHTML = "'.$percent.'"; document.getElementById(\"refreshProgress\").innerHTML = \"$percent\";
</script>'; </script>";
updateCachedFile($following[1]); updateCachedFile($following[1]);
ob_flush(); // Send output to browser immediately ob_flush(); // Send output to browser immediately