Security: verwijder hardcoded wachtwoord, voeg random-wachtwoord-generator toe bij eerste installatie

This commit is contained in:
2026-08-27 08:57:05 +00:00
parent 6485f693dc
commit 74612aefbb
55 changed files with 6019 additions and 876 deletions
+55 -1
View File
@@ -1,14 +1,41 @@
<?php
/**
* Statistics plugin: toont analytics-statistieken in het beheer.
*
* Systeem-plugin die analytics-gegevens toont, zoals totaal aantal views,
* unieke bezoekers, landen en top-pagina's.
*
* @since 2.6.4
*/
class Statistics
{
/**
* Plugin-API instantie voor communicatie met de CMS-core.
*
* @since 2.6.4
* @var PluginAPIInterface|null
*/
private ?PluginAPIInterface $api = null;
/**
* Stelt de Plugin-API instantie in.
*
* @since 2.6.4
* @param PluginAPIInterface $api De Plugin-API instantie.
* @return void
*/
public function setAPI(PluginAPIInterface $api): void
{
$this->api = $api;
}
/**
* Geeft de plugin-configuratie terug.
*
* @since 2.6.4
* @return array<string, mixed> Plugin-configuratie met title, viewable en type.
*/
public function getConfig(): array
{
return [
@@ -18,6 +45,12 @@ class Statistics
];
}
/**
* Geeft de admin-menu-items voor deze plugin terug.
*
* @since 2.6.4
* @return array<int, array<string, mixed>> Lijst met admin-menu-item configuraties.
*/
public function getAdminMenu(): array
{
$config = $this->getPluginConfig();
@@ -38,7 +71,12 @@ class Statistics
}
/**
* Get this plugin's runtime config (defaults + overrides).
* Haalt de runtime-configuratie van deze plugin op (standaardwaarden plus overrides).
*
* Leest standaardwaarden uit plugin.json en overschrijft deze met config.json.
*
* @since 2.6.4
* @return array<string, mixed> De samengevoegde plugin-configuratie.
*/
private function getPluginConfig(): array
{
@@ -64,6 +102,16 @@ class Statistics
return array_merge($defaults, $overrides);
}
/**
* Verwerkt een admin-route en toont de statistieken-pagina.
*
* Toont analytics-gegevens zoals views, unieke bezoekers, landen en
* top-pagina's, mits analytics ingeschakeld is.
*
* @since 2.6.4
* @param string $action De uit te voeren actie.
* @return string|null De HTML-uitvoer van de statistieken-pagina, of null.
*/
public function handleAdminRoute(string $action): ?string
{
// System plugin: translations resolve against the admin language.
@@ -182,6 +230,12 @@ class Statistics
return ob_get_clean();
}
/**
* Haalt de Analytics-instantie op basis van de analytics-configuratie.
*
* @since 2.6.4
* @return Analytics|null De Analytics-instantie, of null als analytics uitgeschakeld is.
*/
private function getAnalytics(): ?Analytics
{
if ($this->api === null) {