aboutsummaryrefslogtreecommitdiff
path: root/admin/panes/telemetry.php
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-08-08 12:04:30 +0200
committerMinteck <nekostarfan@gmail.com>2021-08-08 12:04:30 +0200
commit95112b1eb06a4be531ded59563d53a63a8d614e8 (patch)
treefd3dc676227309c87a39feab9ca458985e327907 /admin/panes/telemetry.php
parent87303b0d3540037fb94efdde24dbaacb2880d6cb (diff)
downloadmain-95112b1eb06a4be531ded59563d53a63a8d614e8.tar.gz
main-95112b1eb06a4be531ded59563d53a63a8d614e8.tar.bz2
main-95112b1eb06a4be531ded59563d53a63a8d614e8.zip
Opening!
Diffstat (limited to 'admin/panes/telemetry.php')
-rw-r--r--admin/panes/telemetry.php946
1 files changed, 946 insertions, 0 deletions
diff --git a/admin/panes/telemetry.php b/admin/panes/telemetry.php
new file mode 100644
index 0000000..e87be24
--- /dev/null
+++ b/admin/panes/telemetry.php
@@ -0,0 +1,946 @@
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */
+
+function urlize($scheme) {
+ $p = explode(":", $scheme);
+
+ if ($p[0] === "space") {
+ return "https://minteck.ro.lt" . $p[1];
+ }
+
+ if ($p[0] === "unchained") {
+ return "https://unchainedtech.minteck.ro.lt" . $p[1];
+ }
+
+ if ($p[0] === "kartik") {
+ return "https://kartik.hopto.org" . $p[1];
+ }
+
+ return "about:blank";
+}
+
+?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">Telemetry Information</h2>
+
+ <?php $db = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/telemetry.json")); ?>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item">Lifetime Visitors <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $months) {
+ foreach ($months as $days) {
+ foreach ($days as $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ echo (count($uniques));
+
+ ?></span></li>
+ <li class="list-group-item">Most Viewed Page <span style="float:right;"><?php
+
+ $record = 0;
+ $recname = "-";
+
+ foreach ($db as $months) {
+ foreach ($months as $days) {
+ foreach ($days as $pages) {
+ foreach ($pages as $page => $visitors) {
+ $thispage = 0;
+
+ foreach ($visitors as $visitor) {
+ $thispage++;
+ }
+
+ if ($thispage > $record) {
+ $recname = "<a href='" . urlize($page) . "' target='_blank'><code>" . $page . "</code></a>";
+ $record = $thispage;
+ }
+ }
+ }
+ }
+ }
+
+ echo ($recname);
+
+ ?></span></li>
+ <li class="list-group-item">Least Viewed Page <span style="float:right;"><?php
+
+ $record = 2;
+ $recname = "-";
+
+ foreach ($db as $months) {
+ foreach ($months as $days) {
+ foreach ($days as $pages) {
+ foreach ($pages as $page => $visitors) {
+ $thispage = 0;
+
+ foreach ($visitors as $visitor) {
+ $thispage++;
+ }
+
+ if ($thispage < $record) {
+ $recname = "<a href='" . urlize($page) . "' target='_blank'><code>" . $page . "</code></a>";
+ $record = $thispage;
+ }
+ }
+ }
+ }
+ }
+
+ echo ($recname);
+
+ ?></span></li>
+ </ul>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item text-muted">Tomorrow <span style="float:right;"><?php
+
+ $uniques = [];
+ $totalDays = 0;
+
+ foreach ($db as $months) {
+ foreach ($months as $days) {
+ foreach ($days as $pages) {
+ $totalDays++;
+ $dayUniques = [];
+
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $dayUniques)) {
+ array_push($dayUniques, $visitor);
+ }
+ }
+ }
+
+ $uniques = array_merge($uniques, $dayUniques);
+ }
+ }
+ }
+
+ $expect = round(count($uniques) / $totalDays);
+ echo ($expect);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ if ($day === date('d')) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($expect - count($uniques)), 0, 1) !== "-") {
+ if ((int)($expect - count($uniques)) === 0) {
+ echo("<span style='color:orange;opacity:.5;'> (±" . ($expect - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;opacity:.5;'> (+" . ($expect - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;opacity:.5;'> (" . ($expect - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item">Today <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ if ($day === date('d')) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ if ($day === date('d', strtotime("-1 day"))) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item">Yesterday <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ if ($day === date('d', strtotime("-1 day"))) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $yesterday = count($uniques);
+ echo ($yesterday);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ if ($day === date('d', strtotime("-2 day"))) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($yesterday - count($uniques)), 0, 1) !== "-") {
+ if ((int)($yesterday - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($yesterday - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($yesterday - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($yesterday - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ </ul>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item text-muted"><?= date("F Y", strtotime("+1 month")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+ $totalDays = 0;
+
+ foreach ($db as $months) {
+ foreach ($months as $days) {
+ $totalDays++;
+ $dayUniques = [];
+
+ foreach ($days as $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $dayUniques)) {
+ array_push($dayUniques, $visitor);
+ }
+ }
+ }
+ }
+
+ $uniques = array_merge($uniques, $dayUniques);
+ }
+ }
+
+ $expect = round(count($uniques) / $totalDays);
+ echo ($expect);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($expect - count($uniques)), 0, 1) !== "-") {
+ if ((int)($expect - count($uniques)) === 0) {
+ echo("<span style='color:orange;opacity:.5;'> (±" . ($expect - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;opacity:.5;'> (+" . ($expect - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;opacity:.5;'> (" . ($expect - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item"><?= date("F Y") ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-1 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item"><?= date("F Y", strtotime("-1 month")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-1 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-2 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item"><?= date("F Y", strtotime("-2 month")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-2 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-3 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li><li class="list-group-item"><?= date("F Y", strtotime("-3 month")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-3 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-4 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li><li class="list-group-item"><?= date("F Y", strtotime("-4 month")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-4 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-5 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li><li class="list-group-item"><?= date("F Y", strtotime("-5 month")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-5 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-6 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ </ul>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item"><?= date("Y") ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y', strtotime("-1 year"))) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item"><?= date("Y", strtotime("-1 year")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y', strtotime("-1 year"))) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y', strtotime("-2 year"))) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item"><?= date("Y", strtotime("-2 year")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y', strtotime("-2 year"))) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y', strtotime("-3 year"))) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ </ul>
+
+ <br>
+
+ <ul class="list-group">
+ <li class="list-group-item">
+ <details>
+ <summary>Kartik downloads</summary>
+ <ul class="list-group">
+ <li class="list-group-item"><b>All update channels <span style="float:right;"><?= (int)trim(file_get_contents("/mnt/kartik-cdn/stats/stable")) + (int)trim(file_get_contents("/mnt/kartik-cdn/stats/eap")) + (int)trim(file_get_contents("/mnt/kartik-cdn/stats/beta")) + (int)trim(file_get_contents("/mnt/kartik-cdn/stats/nightly")) ?> downloads</span></b></li>
+ <li class="list-group-item"><img alt="" src="https://github.com/Minteck-Projects/Kartik-Core/raw/trunk/logo/logo.png" width="24px"> Kartik Stable <span style="float:right;"><?= trim(file_get_contents("/mnt/kartik-cdn/stats/stable")) ?> downloads</span></li>
+ <li class="list-group-item"><img alt="" src="https://github.com/Minteck-Projects/Kartik-Core/raw/trunk/logo/logo-eap.png" width="24px"> Kartik EAP <span style="float:right;"><?= trim(file_get_contents("/mnt/kartik-cdn/stats/eap")) ?> downloads</span></li>
+ <li class="list-group-item"><img alt="" src="https://github.com/Minteck-Projects/Kartik-Core/raw/trunk/logo/logo-beta.png" width="24px"> Kartik Beta <span style="float:right;"><?= trim(file_get_contents("/mnt/kartik-cdn/stats/beta")) ?> downloads</span></li>
+ <li class="list-group-item"><img alt="" src="https://github.com/Minteck-Projects/Kartik-Core/raw/trunk/logo/logo-nightly.png" width="24px"> Kartik Nightly <span style="float:right;"><?= trim(file_get_contents("/mnt/kartik-cdn/stats/nightly")) ?> downloads</span></li>
+ </ul>
+ </details>
+ </li>
+ <li class="list-group-item">
+ <details>
+ <summary>Page-specific statistics</summary>
+ <p>
+ <?php
+
+ $assocs = [];
+ $spages = [];
+
+ foreach ($db as $year => $months) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ if (substr($page, 0, 7) !== "/admin/") {
+ if (!isset($spages[$page])) {
+ $spages[$page] = 0;
+ }
+ foreach ($visitors as $visitor) {
+ if (!in_array($page . "|" . $visitor, $assocs)) {
+ $spages[$page]++;
+ array_push($assocs, $page . "|" . $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $max = 0;
+ foreach ($spages as $visitors) {
+ if ($visitors > $max) {
+ $max = $visitors;
+ }
+ }
+
+ arsort($spages);
+
+ foreach ($spages as $page => $visitors): ?>
+ <div class="progress" style="height:25px;background:#222;margin-bottom:2px;">
+ <div class="progress-bar" style="background:#444;width:<?= ($visitors/$max)*100 ?>%;"></div>
+ <span class="progress-bar-text"><a class="text-white" href="<?= urlize($page) ?>" target="_blank"><?= $page ?></a> <span class="text-muted">(<?= $visitors ?>)</span></span>
+ </div>
+ <?php endforeach; ?>
+ </p>
+
+ <style>
+ .progress-bar-text {
+ position: absolute;
+ padding-top: 14px;
+ font-size: 14px;
+ text-align:left;
+ padding-left:10px;
+ }
+ </style>
+ </details>
+ </li>
+ </ul>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?> \ No newline at end of file