Страница со статистикой

Сделана основа для страницы со статистикой и несколько функций в бэке для неё
This commit is contained in:
shr3dd3r committed 2024-02-01 13:20:39 +03:00
1 parent 751476c4f8
commit de456dea0a
8 files changed
+142 -9

No files matched your search

+4 -1
View File
@@ -7,6 +7,7 @@ $MARKUP_CURRENT_PAGE = "class=\"current\"";
$MARKUP_CURRENT_PAGE_LOGIN = "";
$MARKUP_CURRENT_PAGE_REGISTER = "";
$MARKUP_CURRENT_PAGE_VIEWTAGS = "";
$MARKUP_CURRENT_PAGE_STATS = "";
if ($WHAT_PAGE_IS_CURRENT["login"])
$MARKUP_CURRENT_PAGE_LOGIN = $MARKUP_CURRENT_PAGE;
@@ -14,6 +15,8 @@ elseif ($WHAT_PAGE_IS_CURRENT["register"])
$MARKUP_CURRENT_PAGE_REGISTER = $MARKUP_CURRENT_PAGE;
elseif ($WHAT_PAGE_IS_CURRENT["view_tags"])
$MARKUP_CURRENT_PAGE_VIEWTAGS = $MARKUP_CURRENT_PAGE;
elseif ($WHAT_PAGE_IS_CURRENT["view_stats"])
$MARKUP_CURRENT_PAGE_STATS = $MARKUP_CURRENT_PAGE;
@@ -40,7 +43,7 @@ elseif ($WHAT_PAGE_IS_CURRENT["view_tags"])
<p><a title="A paginated list of every tag" href="./?do=view_tags">Tags</p></a>
</li>
<span>|</span>
<li>
<li <?php echo $MARKUP_CURRENT_PAGE_STATS; ?>>
<p><a title="Statistics of current instance" href="./?do=view_stats">Stats</p></a>
</li>
<span>|</span>
+50
View File
@@ -0,0 +1,50 @@
<?php
// Approved tags list
// Includes
require_once("api/_config.php");
require_once("api/user/index.php");
require_once("api/tags/index.php");
require_once("api/post/index.php");
require_once("api/comments/index.php");
require_once("front/pages/main_nav.php");
require_once("front/notifications.php");
// Getting stats
$statUsers = User_GetUsersAmount(); // array
$statTags = Tags_GetTagsAmount(); // int
$statPosts = Post_GetPostsAmount(); // int
$statComms = Comments_GetTotalAmount(); // int
NTFY_EchoAllNotices();
?>
<div class="visualbox">
<h1>Instance statistics</h1>
<table>
<tr>
<th><p>Users amount</p></th>
<td><p>Total: <?php echo $statUsers["users"]; ?></p></td>
<td><p>Banned: <?php echo $statUsers["banned"]; ?></p></td>
</tr>
<tr>
<th><p>Tags amount</p></th>
<td><p>Total: <?php echo $statTags; ?></p></td>
</tr>
<tr>
<th><p>Posts amount</p></th>
<td><p>Total: <?php echo $statPosts; ?></p></td>
</tr>
<tr>
<th><p>Comments amount</p></th>
<td><p>Total: <?php echo $statComms; ?></p></td>
</tr>
</table>
</div>
+26
View File
@@ -62,6 +62,32 @@ nav.main ul span {
/* Table */
table, tr, th, td {
border: 2px solid #009049;
}
table {
border-collapse: collapse;
}
th, td {
padding: 4px;
}
th {
padding-left: 8px;
padding-right: 8px;
}
td {
padding-left: 16px;
padding-right: 16px;
}
/* Other */
form.login div {