Gazelle/sections/reports/stats.php

201 lines
4.8 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
2013-04-17 08:00:58 +00:00
if (!check_perms('admin_reports') && !check_perms('site_moderate_forums')) {
2011-03-28 14:21:28 +00:00
error(403);
}
2012-10-11 08:00:15 +00:00
View::show_header('Other reports stats');
2011-03-28 14:21:28 +00:00
?>
2012-08-19 08:00:19 +00:00
<div class="header">
<h2>Other reports stats!</h2>
<div class="linkbox">
<a href="reports.php">New</a> |
<a href="reports.php?view=old">Old</a> |
<a href="reports.php?action=stats">Stats</a>
</div>
2012-04-16 08:00:24 +00:00
</div>
2013-10-29 08:01:29 +00:00
<div class="thin float_clear">
<div class="two_columns pad">
2011-03-28 14:21:28 +00:00
<?
2013-08-28 23:08:41 +00:00
if (check_perms('admin_reports')) {
2013-07-04 08:00:56 +00:00
$DB->query("
SELECT um.Username,
COUNT(r.ID) AS Reports
FROM reports AS r
JOIN users_main AS um ON um.ID = r.ResolverID
WHERE r.ReportedTime > '2009-08-21 22:39:41'
AND r.ReportedTime > NOW() - INTERVAL 24 HOUR
GROUP BY r.ResolverID
ORDER BY Reports DESC");
2011-03-28 14:21:28 +00:00
$Results = $DB->to_array();
?>
2013-10-29 08:01:29 +00:00
<h3><strong>Reports resolved in the last 24 hours</strong></h3>
<table class="box border">
<tr class="colhead">
<td class="colhead_dark">Username</td>
<td class="colhead_dark number_column">Reports</td>
2011-03-28 14:21:28 +00:00
</tr>
2013-07-04 08:00:56 +00:00
<?
foreach ($Results as $Result) {
2013-04-17 08:00:58 +00:00
list($Username, $Reports) = $Result;
2013-10-25 08:00:59 +00:00
if ($Username == $LoggedUser['Username']) {
$RowClass = ' class="rowa"';
} else {
$RowClass = '';
}
2011-03-28 14:21:28 +00:00
?>
2013-10-25 08:00:59 +00:00
<tr<?=$RowClass?>>
2011-03-28 14:21:28 +00:00
<td><?=$Username?></td>
2013-08-28 23:08:41 +00:00
<td class="number_column"><?=number_format($Reports)?></td>
2011-03-28 14:21:28 +00:00
</tr>
2013-04-17 08:00:58 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</table>
<?
2013-07-04 08:00:56 +00:00
$DB->query("
SELECT um.Username,
COUNT(r.ID) AS Reports
FROM reports AS r
JOIN users_main AS um ON um.ID = r.ResolverID
WHERE r.ReportedTime > '2009-08-21 22:39:41'
AND r.ReportedTime > NOW() - INTERVAL 1 WEEK
GROUP BY r.ResolverID
ORDER BY Reports DESC");
2011-03-28 14:21:28 +00:00
$Results = $DB->to_array();
?>
2013-10-29 08:01:29 +00:00
<h3><strong>Reports resolved in the last week</strong></h3>
<table class="box border">
<tr class="colhead">
<td class="colhead_dark">Username</td>
<td class="colhead_dark number_column">Reports</td>
2011-03-28 14:21:28 +00:00
</tr>
2013-07-04 08:00:56 +00:00
<?
foreach ($Results as $Result) {
2013-04-17 08:00:58 +00:00
list($Username, $Reports) = $Result;
2013-10-25 08:00:59 +00:00
if ($Username == $LoggedUser['Username']) {
$RowClass = ' class="rowa"';
} else {
$RowClass = '';
}
2011-03-28 14:21:28 +00:00
?>
2013-10-25 08:00:59 +00:00
<tr<?=$RowClass?>>
2011-03-28 14:21:28 +00:00
<td><?=$Username?></td>
2013-08-28 23:08:41 +00:00
<td class="number_column"><?=number_format($Reports)?></td>
2011-03-28 14:21:28 +00:00
</tr>
2013-04-17 08:00:58 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</table>
<?
2013-07-04 08:00:56 +00:00
$DB->query("
SELECT um.Username,
COUNT(r.ID) AS Reports
FROM reports AS r
JOIN users_main AS um ON um.ID = r.ResolverID
WHERE r.ReportedTime > '2009-08-21 22:39:41'
AND r.ReportedTime > NOW() - INTERVAL 1 MONTH
GROUP BY r.ResolverID
ORDER BY Reports DESC");
2011-03-28 14:21:28 +00:00
$Results = $DB->to_array();
?>
2013-10-29 08:01:29 +00:00
<h3><strong>Reports resolved in the last month</strong></h3>
<table class="box border">
<tr class="colhead">
<td class="colhead_dark">Username</td>
<td class="colhead_dark number_column">Reports</td>
2011-03-28 14:21:28 +00:00
</tr>
2013-07-04 08:00:56 +00:00
<?
foreach ($Results as $Result) {
2013-04-17 08:00:58 +00:00
list($Username, $Reports) = $Result;
2013-10-25 08:00:59 +00:00
if ($Username == $LoggedUser['Username']) {
$RowClass = ' class="rowa"';
} else {
$RowClass = '';
}
2011-03-28 14:21:28 +00:00
?>
2013-10-25 08:00:59 +00:00
<tr<?=$RowClass?>>
2011-03-28 14:21:28 +00:00
<td><?=$Username?></td>
2013-08-28 23:08:41 +00:00
<td class="number_column"><?=number_format($Reports)?></td>
2011-03-28 14:21:28 +00:00
</tr>
2013-04-17 08:00:58 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</table>
<?
2013-07-04 08:00:56 +00:00
$DB->query("
SELECT um.Username,
COUNT(r.ID) AS Reports
FROM reports AS r
JOIN users_main AS um ON um.ID = r.ResolverID
GROUP BY r.ResolverID
ORDER BY Reports DESC");
2011-03-28 14:21:28 +00:00
$Results = $DB->to_array();
?>
2013-10-29 08:01:29 +00:00
<h3><strong>Reports resolved since "other" reports (2009-08-21)</strong></h3>
<table class="box border">
<tr class="colhead">
<td class="colhead_dark">Username</td>
<td class="colhead_dark number_column">Reports</td>
2011-03-28 14:21:28 +00:00
</tr>
2013-07-04 08:00:56 +00:00
<?
foreach ($Results as $Result) {
2013-04-17 08:00:58 +00:00
list($Username, $Reports) = $Result;
2013-10-25 08:00:59 +00:00
if ($Username == $LoggedUser['Username']) {
$RowClass = ' class="rowa"';
} else {
$RowClass = '';
}
2011-03-28 14:21:28 +00:00
?>
2013-10-25 08:00:59 +00:00
<tr<?=$RowClass?>>
2011-03-28 14:21:28 +00:00
<td><?=$Username?></td>
2013-08-28 23:08:41 +00:00
<td class="number_column"><?=number_format($Reports)?></td>
2011-03-28 14:21:28 +00:00
</tr>
2013-04-17 08:00:58 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</table>
2013-08-28 23:08:41 +00:00
<?
} //if (check_perms('admin_reports')) ?>
2013-10-29 08:01:29 +00:00
</div>
<div class="two_columns pad">
2013-04-17 08:00:58 +00:00
<?
2013-11-26 08:01:14 +00:00
$TrashForumIDs = '12';
2013-10-25 08:00:59 +00:00
$DB->query("
SELECT u.Username,
2013-11-17 08:00:47 +00:00
COUNT(f.LastPostAuthorID) as Trashed
FROM forums_topics AS f
LEFT JOIN users_main AS u ON u.ID = f.LastPostAuthorID
2013-11-26 08:01:14 +00:00
WHERE f.ForumID IN ($TrashForumIDs)
2013-11-17 08:00:47 +00:00
GROUP BY f.LastPostAuthorID
2013-10-25 08:00:59 +00:00
ORDER BY Trashed DESC
LIMIT 30");
$Results = $DB->to_array();
?>
2013-10-29 08:01:29 +00:00
<h3><strong>Threads trashed since the beginning of time</strong></h3>
<table class="box border">
<tr class="colhead">
<td class="colhead_dark number_column">Place</td>
<td class="colhead_dark">Username</td>
<td class="colhead_dark number_column">Trashed</td>
</tr>
2013-04-17 08:00:58 +00:00
<?
2013-10-25 08:00:59 +00:00
$i = 1;
foreach ($Results as $Result) {
list($Username, $Trashed) = $Result;
if ($Username == $LoggedUser['Username']) {
$RowClass = ' class="rowa"';
} else {
$RowClass = '';
}
?>
2013-10-29 08:01:29 +00:00
<tr<?=$RowClass?>>
<td class="number_column"><?=$i?></td>
<td><?=$Username?></td>
<td class="number_column"><?=number_format($Trashed)?></td>
</tr>
2013-07-04 08:00:56 +00:00
<?
2013-10-25 08:00:59 +00:00
$i++;
}
?>
2013-10-29 08:01:29 +00:00
</table>
</div>
2011-03-28 14:21:28 +00:00
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
?>