diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2026-03-19 06:34:42 +0100 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2026-03-19 06:34:42 +0100 |
| commit | cab37cd31c16fa8c3968f0f8d9004ab59d9e23bc (patch) | |
| tree | 7eb48dc207edb0395c23b9c55896bdf67e23ec93 | |
| parent | a2a221f7f33ed13eccae3d54c03352cc292cf051 (diff) | |
| download | 959-master.tar.gz 959-master.zip | |
| -rw-r--r-- | 1-screenshot.png | bin | 0 -> 241557 bytes | |||
| -rw-r--r-- | index.php | 254 |
2 files changed, 127 insertions, 127 deletions
diff --git a/1-screenshot.png b/1-screenshot.png Binary files differnew file mode 100644 index 0000000..d95a71c --- /dev/null +++ b/1-screenshot.png @@ -1,127 +1,127 @@ -<?php -/** - * Compact overview for awstats multi-domain HTML web statistics - * - * Lists all years + months for each domain. - * Put it as index.php in the base output directory of "buildstatic.sh", - * "/var/cache/awstats/". - * Can also be symlinked into the domain subdirectories. - * - * @author Christian Weiske <cweiske+awstats-overview@cweiske.de> - */ -$hiddenDomains = [ - 'old-ahso4', -]; - -$domains = glob('*', GLOB_ONLYDIR); -$domains = array_filter( - $domains, - function ($domain) use ($hiddenDomains) { - return !in_array($domain, $hiddenDomains); - } -); - -$singleDomainView = array_reduce( - $domains, - function ($carry, $domain) { - return $carry && strlen($domain) == 4 && ctype_digit($domain); - }, - true -); -if ($singleDomainView) { - //we are in a domain directory - $domains = [basename(getcwd())]; - chdir('..'); -} - -$struct = []; -foreach ($domains as $domain) { - $dyears = glob($domain . '/*', GLOB_ONLYDIR); - foreach ($dyears as $dyear) { - $year = basename($dyear); - $dymonths = glob($dyear . '/*', GLOB_ONLYDIR | GLOB_MARK); - foreach ($dymonths as $num => $dymonth) { - $month = basename($dymonth); - if ($num == 0 && $month != '01') { - foreach (range(1, $month - 1) as $dummy) { - $struct[$domain][$year][str_pad($dummy, 2, '0', STR_PAD_LEFT)] = null; - } - } - $struct[$domain][$year][$month] = $dymonth; - } - } -} - -$title = 'awstats overview'; -if ($singleDomainView) { - $title .= ': ' . array_key_first($struct); -} -?> -<!DOCTYPE html> -<html> - <head> - <title><?= $title ?></title> - <meta name="viewport" content="width=device-width, initial-scale=1"/> - <?php if ($singleDomainView): ?> - <base href="../"/> - <?php endif; ?> - <style type="text/css"> - div.domains { - display: flex; - flex-wrap: wrap; - gap: 1em; - } - - dl { - display: grid; - grid-template-columns: max-content auto; - } - dt { - grid-column-start: 1; - } - dd { - grid-column-start: 2; - margin-left: 1em; - } - - ul { - padding-left: 0; - } - ul > li { - display: inline; - } - li.disabled { - color: #DDD; - } - </style> - </head> - <body> - <h1><?= $title ?></h1> - - <div class="domains"> - <?php foreach ($struct as $domain => $years): ?> - <div class="domain" id="<?= $domain ?>"> - <?php if (!$singleDomainView): ?> - <h2><a href="<?= $domain ?>"><?= $domain ?></a></h2> - <?php endif; ?> - <dl> - <?php foreach ($years as $year => $months): ?> - <dt><?= $year ?></dt> - <dd> - <ul> - <?php foreach ($months as $month => $path): ?> - <?php if ($path === null): ?> - <li class="disabled"><?= $month ?></li> - <?php else: ?> - <li><a href="<?= $path ?>"><?= $month ?></a></li> - <?php endif; ?> - <?php endforeach; ?> - </ul> - </dd> - <?php endforeach; ?> - </dl> - </div> - <?php endforeach; ?> - </div> - </body> -</html> +<?php
+/**
+ * Compact overview for awstats multi-domain HTML web statistics
+ *
+ * Lists all years + months for each domain.
+ * Put it as index.php in the base output directory of "buildstatic.sh",
+ * "/var/cache/awstats/".
+ * Can also be symlinked into the domain subdirectories.
+ *
+ * @author Christian Weiske <cweiske+awstats-overview@cweiske.de>
+ */
+$hiddenDomains = [
+ 'old-ahso4',
+];
+
+$domains = glob('*', GLOB_ONLYDIR);
+$domains = array_filter(
+ $domains,
+ function ($domain) use ($hiddenDomains) {
+ return !in_array($domain, $hiddenDomains);
+ }
+);
+
+$singleDomainView = array_reduce(
+ $domains,
+ function ($carry, $domain) {
+ return $carry && strlen($domain) == 4 && ctype_digit($domain);
+ },
+ true
+);
+if ($singleDomainView) {
+ //we are in a domain directory
+ $domains = [basename(getcwd())];
+ chdir('..');
+}
+
+$struct = [];
+foreach ($domains as $domain) {
+ $dyears = glob($domain . '/*', GLOB_ONLYDIR);
+ foreach ($dyears as $dyear) {
+ $year = basename($dyear);
+ $dymonths = glob($dyear . '/*', GLOB_ONLYDIR | GLOB_MARK);
+ foreach ($dymonths as $num => $dymonth) {
+ $month = basename($dymonth);
+ if ($num == 0 && $month != '01') {
+ foreach (range(1, $month - 1) as $dummy) {
+ $struct[$domain][$year][str_pad($dummy, 2, '0', STR_PAD_LEFT)] = null;
+ }
+ }
+ $struct[$domain][$year][$month] = $dymonth;
+ }
+ }
+}
+
+$title = 'awstats overview';
+if ($singleDomainView) {
+ $title .= ': ' . array_key_first($struct);
+}
+?>
+<!DOCTYPE html>
+<html>
+ <head>
+ <title><?= $title ?></title>
+ <meta name="viewport" content="width=device-width, initial-scale=1"/>
+ <?php if ($singleDomainView): ?>
+ <base href="../"/>
+ <?php endif; ?>
+ <style type="text/css">
+ div.domains {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 1em;
+ }
+
+ dl {
+ display: grid;
+ grid-template-columns: max-content auto;
+ }
+ dt {
+ grid-column-start: 1;
+ }
+ dd {
+ grid-column-start: 2;
+ margin-left: 1em;
+ }
+
+ ul {
+ padding-left: 0;
+ }
+ ul > li {
+ display: inline;
+ }
+ li.disabled {
+ color: #DDD;
+ }
+ </style>
+ </head>
+ <body>
+ <h1><?= $title ?></h1>
+
+ <div class="domains">
+ <?php foreach ($struct as $domain => $years): ?>
+ <div class="domain" id="<?= $domain ?>">
+ <?php if (!$singleDomainView): ?>
+ <h2><a href="<?= $domain ?>"><?= $domain ?></a></h2>
+ <?php endif; ?>
+ <dl>
+ <?php foreach ($years as $year => $months): ?>
+ <dt><?= $year ?></dt>
+ <dd>
+ <ul>
+ <?php foreach ($months as $month => $path): ?>
+ <?php if ($path === null): ?>
+ <li class="disabled"><?= $month ?></li>
+ <?php else: ?>
+ <li><a href="<?= $path ?>"><?= $month ?></a></li>
+ <?php endif; ?>
+ <?php endforeach; ?>
+ </ul>
+ </dd>
+ <?php endforeach; ?>
+ </dl>
+ </div>
+ <?php endforeach; ?>
+ </div>
+ </body>
+</html>
|
