commit f8049a90cfd2b088760b487e00458318412254d0
parent 8f7441c8be81559f5d54c4ecb652e84f5a8d0c21
Author: René Wagner <rwa@clttr.info>
Date: Mon, 29 May 2023 19:12:19 +0200
clear stats older 1 year from the stats file to keep it small
additionally we now actual use of the breadcrumb bar on the admin page
Diffstat:
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
@@ -36,7 +36,7 @@ The passwort will be securely hashed at the first login on the admin page.
### Requirements
* Webserver (Apache, nginx, Caddy, ...)
-* PHP 7.4 or above
+* PHP 8.0 or above
## 1-2-3 Step update
1. Download the latest [release](https://git.sr.ht/~rwa/devshort/refs) and upload it to the installation place
diff --git a/admin.php b/admin.php
@@ -8,14 +8,13 @@ $config_content = json_decode(file_get_contents($config_path), true);
$stats_path = implode(DIRECTORY_SEPARATOR, array(__DIR__, "data", "stats.json"));
$stats_content = json_decode(file_get_contents($stats_path), true);
-// convert the old timestamp format in the stats file to the now used date-format
+// remove outdated stats to keep stats.json small
$converted = 0;
foreach ( $stats_content as &$stats_entry ) {
foreach ($stats_entry as $key => $value) {
- if ( is_numeric($key) ) {
+ if ($key < date('Y-m-d', strtotime('-1 year'))) {
$converted = 1;
- unset($sub_stats[$key]);
- $sub_stats[date("Y-m-d", $key)] = $value;
+ unset($stats_entry[$key]);
}
}
}
@@ -83,7 +82,7 @@ if ($config_content["settings"]["custom_links"]) {
<meta name="robots" content="noindex, nofollow">
<meta name="author" content="<?php echo $config_content["settings"]["author"]; ?> and the devShort team">
<link href="<?php echo $config_content["settings"]["favicon"]; ?>" rel="icon">
- <title>Admin panel | <?php echo $config_content["settings"]["name"]; ?></title>
+ <title>admin panel | <?php echo $config_content["settings"]["name"]; ?></title>
<link href="assets/vendor/bootstrap/bootstrap.min.css" rel="stylesheet">
</head>
@@ -91,15 +90,19 @@ if ($config_content["settings"]["custom_links"]) {
<main class="flex-shrink-0">
<div class="container">
- <h1 class="mt-5 text-center"><?php echo $config_content["settings"]["name"]; ?></h1>
- <h4 class="mb-4 text-center">admin panel</h4>
+ <nav class="mt-3" aria-label="breadcrumb">
+ <ol class="breadcrumb shadow-sm">
+ <li class="breadcrumb-item"><a href="<?php echo $config_content["settings"]["home_link"]; ?>">Home</a></li>
+ <li class="breadcrumb-item" aria-current="page"><a href="/"><?php echo $config_content["settings"]["name"]; ?></a></li>
+ <li class="breadcrumb-item active">admin panel</li>
+ </ol>
+ </nav>
<div class="row" id="app">
<div class="col-md-4 col-lg-3">
<div class="card d-none d-md-block mb-3">
<div class="card-body">
<h5 class="card-title">Tools</h5>
- <a class="card-link" href="index.php">Index</a>
- <a class="card-link" href="#reload" v-on:click="loadData">Reload</a>
+ <a class="card-link" href="#reload" v-on:click="loadData">Reload charts</a>
<a class="card-link" href="admin-auth.php?logout">Logout</a>
</div>
</div>