commit 6e2d375c70ba364397c66c417384163d6a12e30f
parent 0d3f9912812804c4061be8123dbd729a888cd2a1
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Sat, 27 Apr 2024 22:42:18 +0200
Cleanup listing logic
Diffstat:
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/index.html b/index.html
@@ -41,7 +41,7 @@ if (file_exists("./env.php")) {
<br>
<div class="row" style="margin-left:auto;margin-right:auto;">
<?php
- for ($year = $start_year; $year <= date("Y"); $year++) {
+ for ($year = date("Y"); $year >= $start_year; $year--) {
echo "<a class='button' href='" . $year . "/'>" . $year . "</a>";
}
?>
@@ -51,9 +51,9 @@ if (file_exists("./env.php")) {
<br>
<div class="row" style="margin-left:auto;margin-right:auto;">
<?php
- for ($year = $start_year; $year <= date("Y"); $year++) {
- for ($month = 1; $month <= 12; $month++) {
- if ($year == $start_year && ($month < $start_month || $month > date("m"))) {
+ for ($year = date("Y"); $year >= $start_year; $year--) {
+ for ($month = 12; $month >= 1; $month--) {
+ if (($year == $start_year && ($month < $start_month)) || ($year == date("Y") && ($month > date("m")))) {
// Skipping...
} else {
echo "<a class='button' href='" . $year . "/" . substr("0{$month}", -2) . "/'>" . date("F", strtotime($year . "-" . substr("{$month}", -2) . "-01")) . " " . $year . "</a>";
@@ -67,12 +67,12 @@ if (file_exists("./env.php")) {
<br>
<div class="row" style="margin-left:auto;margin-right:auto;">
<?php
- for ($year = $start_year; $year <= date("Y"); $year++) {
- for ($week = 1; $week <= 53; $week++) {
- if ($year == $start_year && ($week > $start_week || $week > date("W"))) {
+ for ($year = date("Y"); $year >= $start_year; $year--) {
+ for ($week = 53; $week >= 1; $week++) {
+ if (($year == $start_year && ($week < $start_week)) || ($year == date("Y") && ($week > date("W")))) {
// Skipping...
} else {
- echo "<a class='button' href='" . $year . "/week-" . substr("0{$week}", -2) . "/'>" . date("F", strtotime($year . "-W" . substr("{$week}", -2))) . " " . $year . "</a>";
+ echo "<a class='button' href='" . $year . "/week-" . substr("0{$week}", -2) . "/'>Week " . $week . $year . "</a>";
}
}
}